UNPKG

@wandelbots/wandelbots-js-react-components

Version:

React UI toolkit for building applications on top of the Wandelbots platform

1,284 lines 237 kB
import { e as te, j as E, a as O } from "./index-CAib4NKw.js"; import { useTheme as re, Box as K, Button as oe, Typography as se, Chip as ne } from "@mui/material"; import { observer as ae } from "mobx-react-lite"; import { useTranslation as le } from "react-i18next"; import { PlayArrow as W, Stop as X, Pause as ce } from "@mui/icons-material"; import { autorun as pe, reaction as de } from "mobx"; import N, { useEffect as ie } from "react"; var j = /* @__PURE__ */ ((e) => (e.IDLE = "idle", e.PREPARING = "preparing", e.STARTING = "starting", e.RUNNING = "running", e.PAUSING = "pausing", e.PAUSED = "paused", e.STOPPING = "stopping", e.COMPLETED = "completed", e.FAILED = "failed", e.STOPPED = "stopped", e.ERROR = "error", e))(j || {}); const Ye = te( ae( ({ state: e, onRun: r, onPause: t, onStop: s, onReset: c, requiresManualReset: n = !1, variant: l = "with_pause", className: a }) => { const o = re(), { t: p } = le(), d = () => { const x = { run: { enabled: e === "idle" || e === "stopped" || e === "paused" || e === "completed" || e === "failed" || e === "error", label: p(e === "paused" ? "ProgramControl.Resume.bt" : e === "error" || e === "failed" ? "ProgramControl.Retry.bt" : "ProgramControl.Start.bt"), color: o.palette.success.main, onClick: r }, pause: { enabled: e === "running", label: p("ProgramControl.Pause.bt"), color: "#FFFFFF33", onClick: t || (() => { }) }, stop: { enabled: e === "preparing" || e === "starting" || e === "running" || e === "pausing" || e === "paused", label: p("ProgramControl.Stop.bt"), color: o.palette.error.main, onClick: s } }; return l === "without_pause" ? [x.run, x.stop] : [x.run, x.pause, x.stop]; }, i = (x) => { const v = { sx: { fontSize: "55px" } }; if (l === "without_pause") return x === 0 ? /* @__PURE__ */ E.jsx(W, { ...v }) : /* @__PURE__ */ E.jsx(X, { ...v }); switch (x) { case 0: return /* @__PURE__ */ E.jsx(W, { ...v }); case 1: return /* @__PURE__ */ E.jsx(ce, { ...v }); case 2: return /* @__PURE__ */ E.jsx(X, { ...v }); default: return null; } }, V = d(); return /* @__PURE__ */ E.jsx( K, { className: a, sx: { display: "flex", flexDirection: "column", alignItems: "center", gap: 2 }, children: /* @__PURE__ */ E.jsx( K, { sx: { display: "flex", gap: "40px", flexWrap: "wrap", justifyContent: "center", alignItems: "center" }, children: V.map((x, v) => /* @__PURE__ */ E.jsxs( K, { sx: { display: "flex", flexDirection: "column", alignItems: "center", gap: 1 }, children: [ /* @__PURE__ */ E.jsx( oe, { variant: "contained", disabled: !x.enabled || e === "preparing" || e === "starting" || e === "pausing" || e === "stopping" && !n, onClick: x.onClick, sx: { width: "88px", height: "88px", borderRadius: "88px", backgroundColor: x.color, opacity: x.enabled && e !== "preparing" && e !== "starting" && e !== "pausing" && !(e === "stopping" && !n) ? 1 : 0.3, "&:hover": { backgroundColor: x.color, opacity: x.enabled && e !== "preparing" && e !== "starting" && e !== "pausing" && !(e === "stopping" && !n) ? 0.8 : 0.3 }, "&:disabled": { backgroundColor: x.color, opacity: 0.3 }, minWidth: "88px", flexShrink: 0 }, children: i(v) } ), /* @__PURE__ */ E.jsx( se, { variant: "body1", sx: { color: x.enabled && e !== "preparing" && e !== "starting" && e !== "pausing" && !(e === "stopping" && !n) ? x.color : o.palette.text.disabled, textAlign: "center", opacity: x.enabled && e !== "preparing" && e !== "starting" && e !== "pausing" && !(e === "stopping" && !n) ? 1 : 0.3 }, children: x.label } ) ] }, x.label )) } ) } ); } ) ), ze = te( ae( ({ programState: e, safetyState: r, operationMode: t, className: s }) => { const c = re(), { t: n } = le(), l = () => { if (r === "SAFETY_STATE_DEVICE_EMERGENCY_STOP" || r === "SAFETY_STATE_ROBOT_EMERGENCY_STOP" || r === "SAFETY_STATE_STOP_0" || r === "SAFETY_STATE_STOP_1" || r === "SAFETY_STATE_STOP_2" || r === "SAFETY_STATE_PROTECTIVE_STOP" || r === "SAFETY_STATE_STOP" || r === "SAFETY_STATE_REDUCED" || r === "SAFETY_STATE_MASTERING" || r === "SAFETY_STATE_CONFIRM_SAFETY" || r === "SAFETY_STATE_OPERATOR_SAFETY" || r === "SAFETY_STATE_RECOVERY" || r === "SAFETY_STATE_VIOLATION") return { label: n("ProgramStateIndicator.EStop.lb"), color: c.palette.error.main }; if (r === "SAFETY_STATE_UNKNOWN" || r === "SAFETY_STATE_FAULT") return { label: n("ProgramStateIndicator.Error.lb"), color: c.palette.error.main }; if (r === "SAFETY_STATE_NORMAL") switch (e) { case j.PREPARING: return { label: n("ProgramStateIndicator.Preparing.lb"), color: c.palette.warning.main }; case j.STARTING: return { label: n("ProgramStateIndicator.Starting.lb"), color: c.palette.warning.main }; case j.RUNNING: return { label: n("ProgramStateIndicator.Running.lb"), color: c.palette.success.main }; case j.PAUSING: return { label: n("ProgramStateIndicator.Pausing.lb"), color: c.palette.warning.main }; case j.PAUSED: return { label: n("ProgramStateIndicator.Paused.lb"), color: c.palette.grey[600] }; case j.STOPPING: return { label: n("ProgramStateIndicator.Stopping.lb"), color: c.palette.warning.main }; case j.COMPLETED: return { label: n("ProgramStateIndicator.Completed.lb"), color: c.palette.success.main }; case j.FAILED: return { label: n("ProgramStateIndicator.Failed.lb"), color: c.palette.error.main }; case j.STOPPED: return { label: n("ProgramStateIndicator.Stopped.lb"), color: c.palette.warning.main }; case j.ERROR: return { label: n("ProgramStateIndicator.Error.lb"), color: c.palette.error.main }; case j.IDLE: default: return { label: n("ProgramStateIndicator.Ready.lb"), color: c.palette.success.main }; } return { label: n("ProgramStateIndicator.Idle.lb"), color: c.palette.grey[600] }; }, { label: a, color: o } = l(), d = `${a} / ${(() => { switch (t) { case "OPERATION_MODE_AUTO": return n("ProgramStateIndicator.Auto.lb"); case "OPERATION_MODE_MANUAL": return n("ProgramStateIndicator.Manual.lb"); case "OPERATION_MODE_MANUAL_T1": return n("ProgramStateIndicator.ManualT1.lb"); case "OPERATION_MODE_MANUAL_T2": return n("ProgramStateIndicator.ManualT2.lb"); default: return n("ProgramStateIndicator.Auto.lb"); } })()}`; return /* @__PURE__ */ E.jsx( ne, { className: s, label: /* @__PURE__ */ E.jsx( se, { variant: "body2", sx: { fontSize: "0.75rem", // Smaller than body2 lineHeight: 1.2 }, children: d } ), variant: "filled", sx: { backgroundColor: o, color: c.palette.getContrastText(o), fontWeight: 500, height: "auto", "& .MuiChip-label": { paddingX: 1.5, paddingY: 0.5 } } } ); } ) ); function $(e) { ie(e, []); } function $e(e) { $(() => pe(e)); } function We(e, r, t) { $(() => de(e, r, t)); } function Xe(e) { return $(() => { let r; function t() { e(), r = requestAnimationFrame(t); } return r = requestAnimationFrame(t), () => { cancelAnimationFrame(r); }; }); } class he { constructor(r = [], t = {}) { this.currentValues = [], this.targetValues = [], this.previousTargetValues = [], this.targetUpdateTime = 0, this.animationId = null, this.updateCount = 0, this.velocities = [], this.animate = () => { this.update(0.016666666666666666) ? this.animationId = null : this.animationId = requestAnimationFrame(this.animate); }, this.options = { tension: 120, friction: 20, threshold: 1e-3, onChange: () => { }, onComplete: () => { }, ...t }, this.currentValues = [...r], this.targetValues = [...r], this.previousTargetValues = [...r], this.velocities = new Array(r.length).fill(0), this.targetUpdateTime = performance.now(), this.updateCount = 0; } /** * Update interpolation using spring physics * * Call this method every frame for smooth animation. In React Three Fiber, * call from within useFrame callback with the provided delta time. * * @param delta - Time elapsed since last update in seconds (e.g., 1/60 ≈ 0.0167 for 60fps) * @returns true when interpolation is complete (all values reached their targets) */ update(r = 1 / 60) { let t = !1, s = !0; this.updateCount++; const c = Math.min(r, 1 / 15), n = this.updateCount === 1 ? 0.7 : 1; for (let l = 0; l < this.currentValues.length; l++) { const a = this.currentValues[l], o = this.targetValues[l], p = this.velocities[l], d = o - a, i = d * this.options.tension * n, V = p * this.options.friction, x = i - V, v = p + x * c, q = a + v * c; Math.abs(d) < this.options.threshold && Math.abs(v) < this.options.threshold * 10 ? this.currentValues[l] !== o && (this.currentValues[l] = o, this.velocities[l] = 0, t = !0) : (s = !1, this.currentValues[l] = q, this.velocities[l] = v, t = !0); } return t && this.options.onChange(this.currentValues), s && this.options.onComplete(this.currentValues), s; } /** * Set new target values for the interpolation to move towards * * Includes smart blending for very rapid target updates (faster than 120fps) * to prevent jarring movements when targets change frequently. */ setTarget(r) { const t = performance.now(), s = t - this.targetUpdateTime; this.previousTargetValues = [...this.targetValues], this.targetValues = [...r], this.targetUpdateTime = t, this.updateCount = 0; const c = this.previousTargetValues.every( (n, l) => n === this.currentValues[l] ); if (s < 8 && s > 0 && this.previousTargetValues.length > 0 && !c) { const n = Math.min(s / 8, 1); for (let l = 0; l < this.targetValues.length; l++) { const a = this.previousTargetValues[l] || 0, o = r[l] || 0; Math.abs(o - a) > 0.1 && (this.targetValues[l] = a + (o - a) * n); } } for (; this.currentValues.length < r.length; ) this.currentValues.push(r[this.currentValues.length]), this.velocities.push(0); this.currentValues.length > r.length && (this.currentValues = this.currentValues.slice(0, r.length), this.velocities = this.velocities.slice(0, r.length)); } /** * Get a copy of all current interpolated values */ getCurrentValues() { return [...this.currentValues]; } /** * Get a single interpolated value by its array index */ getValue(r) { return this.currentValues[r] ?? 0; } /** * Check if automatic interpolation is currently running * * This only tracks auto-interpolation started with startAutoInterpolation(). * Manual update() calls are not tracked by this method. */ isInterpolating() { return this.animationId !== null; } /** * Stop automatic interpolation if it's running * * This cancels the internal animation frame loop but does not affect * manual update() calls. */ stop() { this.animationId !== null && (cancelAnimationFrame(this.animationId), this.animationId = null); } /** * Instantly set values without interpolation */ setImmediate(r) { this.stop(), this.currentValues = [...r], this.targetValues = [...r], this.previousTargetValues = [...r], this.velocities = new Array(r.length).fill(0), this.targetUpdateTime = performance.now(), this.updateCount = 0, this.options.onChange(this.currentValues); } /** * Update interpolation options */ updateOptions(r) { this.options = { ...this.options, ...r }; } /** * Start automatic interpolation with an animation loop * * This begins a requestAnimationFrame loop that calls update() automatically. * For React Three Fiber components, prefer using manual update() calls * within useFrame hooks instead. */ startAutoInterpolation() { this.startInterpolation(); } /** * Clean up all resources and stop any running animations * * This cancels any active animation frames and resets internal state. * Call this when the component unmounts or is no longer needed. */ destroy() { this.stop(); } startInterpolation() { this.animationId === null && this.animate(); } } function Ze(e = [], r = {}) { const t = N.useRef(null); return t.current || (t.current = new he(e, r)), N.useEffect(() => { var s; (s = t.current) == null || s.updateOptions(r); }, [r]), N.useEffect(() => () => { var s; (s = t.current) == null || s.destroy(); }, []), [t.current]; } function k(e) { "@babel/helpers - typeof"; return k = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) { return typeof r; } : function(r) { return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r; }, k(e); } function Ve(e, r) { if (k(e) != "object" || !e) return e; var t = e[Symbol.toPrimitive]; if (t !== void 0) { var s = t.call(e, r); if (k(s) != "object") return s; throw new TypeError("@@toPrimitive must return a primitive value."); } return (r === "string" ? String : Number)(e); } function Oe(e) { var r = Ve(e, "string"); return k(r) == "symbol" ? r : r + ""; } function me(e, r, t) { return (r = Oe(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } const m = "/api/v2".replace(/\/+$/, ""), Z = { csv: "," }; var R = class { constructor(e, r = m, t = O) { this.basePath = r, this.axios = t, me(this, "configuration", void 0), e && (this.configuration = e, this.basePath = e.basePath ?? r); } }, Ce = class extends Error { constructor(e, r) { super(r), this.field = e, this.name = "RequiredError"; } }; const C = {}, S = "https://example.com", h = function(e, r, t) { if (t == null) throw new Ce(r, `Required parameter ${r} was null or undefined when calling ${e}.`); }, u = function(e, r) { r && (r.username || r.password) && (e.auth = { username: r.username, password: r.password }); }, P = async function(e, r) { r && r.accessToken && (e.Authorization = "Bearer " + (typeof r.accessToken == "function" ? await r.accessToken() : await r.accessToken)); }; function z(e, r, t = "") { r != null && (typeof r == "object" ? Array.isArray(r) ? r.forEach((s) => z(e, s, t)) : Object.keys(r).forEach((s) => z(e, r[s], `${t}${t !== "" ? "." : ""}${s}`)) : e.has(t) ? e.append(t, r) : e.set(t, r)); } const b = function(e, ...r) { const t = new URLSearchParams(e.search); z(t, r), e.search = t.toString(); }, A = function(e, r, t) { const s = typeof e != "string"; return (s && t && t.isJsonMime ? t.isJsonMime(r.headers["Content-Type"]) : s) ? JSON.stringify(e !== void 0 ? e : {}) : e || ""; }, I = function(e) { return e.pathname + e.search + e.hash; }, y = function(e, r, t, s) { return (c = r, n = t) => { const l = { ...e.options, url: (c.defaults.baseURL ? "" : (s == null ? void 0 : s.basePath) ?? n) + e.url }; return c.request(l); }; }, ge = { Abb: "abb", Fanuc: "fanuc", Kuka: "kuka", Universalrobots: "universalrobots", Yaskawa: "yaskawa" }, Se = function(e) { return { addApp: async (r, t, s, c = {}) => { h("addApp", "cell", r), h("addApp", "app", t); const n = "/cells/{cell}/apps".replace("{cell}", encodeURIComponent(String(r))), l = new URL(n, S); let a; e && (a = e.baseOptions); const o = { method: "POST", ...a, ...c }, p = {}, d = {}; u(o, e), await P(p, e), s !== void 0 && (d.completion_timeout = s), p["Content-Type"] = "application/json", b(l, d); let i = a && a.headers ? a.headers : {}; return o.headers = { ...p, ...i, ...c.headers }, o.data = A(t, o, e), { url: I(l), options: o }; }, clearApps: async (r, t, s = {}) => { h("clearApps", "cell", r); const c = "/cells/{cell}/apps".replace("{cell}", encodeURIComponent(String(r))), n = new URL(c, S); let l; e && (l = e.baseOptions); const a = { method: "DELETE", ...l, ...s }, o = {}, p = {}; u(a, e), await P(o, e), t !== void 0 && (p.completion_timeout = t), b(n, p); let d = l && l.headers ? l.headers : {}; return a.headers = { ...o, ...d, ...s.headers }, { url: I(n), options: a }; }, deleteApp: async (r, t, s, c = {}) => { h("deleteApp", "cell", r), h("deleteApp", "app", t); const n = "/cells/{cell}/apps/{app}".replace("{cell}", encodeURIComponent(String(r))).replace("{app}", encodeURIComponent(String(t))), l = new URL(n, S); let a; e && (a = e.baseOptions); const o = { method: "DELETE", ...a, ...c }, p = {}, d = {}; u(o, e), await P(p, e), s !== void 0 && (d.completion_timeout = s), b(l, d); let i = a && a.headers ? a.headers : {}; return o.headers = { ...p, ...i, ...c.headers }, { url: I(l), options: o }; }, getApp: async (r, t, s = {}) => { h("getApp", "cell", r), h("getApp", "app", t); const c = "/cells/{cell}/apps/{app}".replace("{cell}", encodeURIComponent(String(r))).replace("{app}", encodeURIComponent(String(t))), n = new URL(c, S); let l; e && (l = e.baseOptions); const a = { method: "GET", ...l, ...s }, o = {}, p = {}; u(a, e), await P(o, e), b(n, p); let d = l && l.headers ? l.headers : {}; return a.headers = { ...o, ...d, ...s.headers }, { url: I(n), options: a }; }, listApps: async (r, t = {}) => { h("listApps", "cell", r); const s = "/cells/{cell}/apps".replace("{cell}", encodeURIComponent(String(r))), c = new URL(s, S); let n; e && (n = e.baseOptions); const l = { method: "GET", ...n, ...t }, a = {}, o = {}; u(l, e), await P(a, e), b(c, o); let p = n && n.headers ? n.headers : {}; return l.headers = { ...a, ...p, ...t.headers }, { url: I(c), options: l }; }, updateApp: async (r, t, s, c, n = {}) => { h("updateApp", "cell", r), h("updateApp", "app", t), h("updateApp", "app2", s); const l = "/cells/{cell}/apps/{app}".replace("{cell}", encodeURIComponent(String(r))).replace("{app}", encodeURIComponent(String(t))), a = new URL(l, S); let o; e && (o = e.baseOptions); const p = { method: "PUT", ...o, ...n }, d = {}, i = {}; u(p, e), await P(d, e), c !== void 0 && (i.completion_timeout = c), d["Content-Type"] = "application/json", b(a, i); let V = o && o.headers ? o.headers : {}; return p.headers = { ...d, ...V, ...n.headers }, p.data = A(s, p, e), { url: I(a), options: p }; } }; }, L = function(e) { const r = Se(e); return { async addApp(t, s, c, n) { var p, d; const l = await r.addApp(t, s, c, n), a = (e == null ? void 0 : e.serverIndex) ?? 0, o = (d = (p = C["ApplicationApi.addApp"]) == null ? void 0 : p[a]) == null ? void 0 : d.url; return (i, V) => y(l, O, m, e)(i, o || V); }, async clearApps(t, s, c) { var o, p; const n = await r.clearApps(t, s, c), l = (e == null ? void 0 : e.serverIndex) ?? 0, a = (p = (o = C["ApplicationApi.clearApps"]) == null ? void 0 : o[l]) == null ? void 0 : p.url; return (d, i) => y(n, O, m, e)(d, a || i); }, async deleteApp(t, s, c, n) { var p, d; const l = await r.deleteApp(t, s, c, n), a = (e == null ? void 0 : e.serverIndex) ?? 0, o = (d = (p = C["ApplicationApi.deleteApp"]) == null ? void 0 : p[a]) == null ? void 0 : d.url; return (i, V) => y(l, O, m, e)(i, o || V); }, async getApp(t, s, c) { var o, p; const n = await r.getApp(t, s, c), l = (e == null ? void 0 : e.serverIndex) ?? 0, a = (p = (o = C["ApplicationApi.getApp"]) == null ? void 0 : o[l]) == null ? void 0 : p.url; return (d, i) => y(n, O, m, e)(d, a || i); }, async listApps(t, s) { var a, o; const c = await r.listApps(t, s), n = (e == null ? void 0 : e.serverIndex) ?? 0, l = (o = (a = C["ApplicationApi.listApps"]) == null ? void 0 : a[n]) == null ? void 0 : o.url; return (p, d) => y(c, O, m, e)(p, l || d); }, async updateApp(t, s, c, n, l) { var d, i; const a = await r.updateApp(t, s, c, n, l), o = (e == null ? void 0 : e.serverIndex) ?? 0, p = (i = (d = C["ApplicationApi.updateApp"]) == null ? void 0 : d[o]) == null ? void 0 : i.url; return (V, x) => y(a, O, m, e)(V, p || x); } }; }; var fe = class extends R { /** * Install a basic, containerized web application to the cell to control robots with a customized frontend. #### Prerequisites - A Docker hub account or similar container registry account, with valid credentials. #### Workflow After adding the application to the cell, open the application on the Wandelbots NOVA home screen. Read [build your application](https://docs.wandelbots.io/latest/developing-introduction) for more information. #### Predefined environment variables <!-- theme: NOTE --> > **NOTE** > - `NOVA_API`: The API endpoint accessible from within the application container. > - `NATS_BROKER`: The NATS broker endpoint accessible from within the application container. > - `BASE_PATH`: The application\'s root path, accessible at http://$host/$BASE_PATH > - `CELL_NAME`: The name of the cell hosting the deployed application. * @summary Add Application * @param {string} cell Unique identifier addressing a cell in all API calls. * @param {App} app * @param {number} [completionTimeout] * @param {*} [options] Override http request option. * @throws {RequiredError} */ addApp(e, r, t, s) { return L(this.configuration).addApp(e, r, t, s).then((c) => c(this.axios, this.basePath)); } /** * Delete all GUI applications from the cell. * @summary Clear Applications * @param {string} cell Unique identifier addressing a cell in all API calls. * @param {number} [completionTimeout] * @param {*} [options] Override http request option. * @throws {RequiredError} */ clearApps(e, r, t) { return L(this.configuration).clearApps(e, r, t).then((s) => s(this.axios, this.basePath)); } /** * Delete a GUI application from the cell. * @summary Delete Application * @param {string} cell Unique identifier addressing a cell in all API calls. * @param {string} app * @param {number} [completionTimeout] * @param {*} [options] Override http request option. * @throws {RequiredError} */ deleteApp(e, r, t, s) { return L(this.configuration).deleteApp(e, r, t, s).then((c) => c(this.axios, this.basePath)); } /** * Get the configuration for an active GUI application in the cell. To update the configuration of a GUI application in the cell, use this configuration with [updateApp](updateApp). * @summary Configuration * @param {string} cell Unique identifier addressing a cell in all API calls. * @param {string} app * @param {*} [options] Override http request option. * @throws {RequiredError} */ getApp(e, r, t) { return L(this.configuration).getApp(e, r, t).then((s) => s(this.axios, this.basePath)); } /** * List all GUI applications that have been added to a cell with [addApp](addApp). If the cell does not contain GUI applications, the list is returned empty. * @summary List Applications * @param {string} cell Unique identifier addressing a cell in all API calls. * @param {*} [options] Override http request option. * @throws {RequiredError} */ listApps(e, r) { return L(this.configuration).listApps(e, r).then((t) => t(this.axios, this.basePath)); } /** * Update the configuration of a GUI application in the cell. * @summary Update Configuration * @param {string} cell Unique identifier addressing a cell in all API calls. * @param {string} app * @param {App} app2 * @param {number} [completionTimeout] * @param {*} [options] Override http request option. * @throws {RequiredError} */ updateApp(e, r, t, s, c) { return L(this.configuration).updateApp(e, r, t, s, c).then((n) => n(this.axios, this.basePath)); } }; const ue = function(e) { return { addBusIOService: async (r, t, s, c = {}) => { h("addBusIOService", "cell", r), h("addBusIOService", "busIOType", t); const n = "/cells/{cell}/bus-ios".replace("{cell}", encodeURIComponent(String(r))), l = new URL(n, S); let a; e && (a = e.baseOptions); const o = { method: "POST", ...a, ...c }, p = {}, d = {}; u(o, e), await P(p, e), s !== void 0 && (d.completion_timeout = s), p["Content-Type"] = "application/json", b(l, d); let i = a && a.headers ? a.headers : {}; return o.headers = { ...p, ...i, ...c.headers }, o.data = A(t, o, e), { url: I(l), options: o }; }, addModbusIO: async (r, t, s, c = {}) => { h("addModbusIO", "cell", r), h("addModbusIO", "io", t), h("addModbusIO", "modbusIOData", s); const n = "/cells/{cell}/bus-ios/modbus/ios/{io}".replace("{cell}", encodeURIComponent(String(r))).replace("{io}", encodeURIComponent(String(t))), l = new URL(n, S); let a; e && (a = e.baseOptions); const o = { method: "PUT", ...a, ...c }, p = {}, d = {}; u(o, e), await P(p, e), p["Content-Type"] = "application/json", b(l, d); let i = a && a.headers ? a.headers : {}; return o.headers = { ...p, ...i, ...c.headers }, o.data = A(s, o, e), { url: I(l), options: o }; }, addProfinetIO: async (r, t, s, c = {}) => { h("addProfinetIO", "cell", r), h("addProfinetIO", "io", t), h("addProfinetIO", "profinetIOData", s); const n = "/cells/{cell}/bus-ios/profinet/ios/{io}".replace("{cell}", encodeURIComponent(String(r))).replace("{io}", encodeURIComponent(String(t))), l = new URL(n, S); let a; e && (a = e.baseOptions); const o = { method: "PUT", ...a, ...c }, p = {}, d = {}; u(o, e), await P(p, e), p["Content-Type"] = "application/json", b(l, d); let i = a && a.headers ? a.headers : {}; return o.headers = { ...p, ...i, ...c.headers }, o.data = A(s, o, e), { url: I(l), options: o }; }, clearBusIOService: async (r, t, s = {}) => { h("clearBusIOService", "cell", r); const c = "/cells/{cell}/bus-ios".replace("{cell}", encodeURIComponent(String(r))), n = new URL(c, S); let l; e && (l = e.baseOptions); const a = { method: "DELETE", ...l, ...s }, o = {}, p = {}; u(a, e), await P(o, e), t !== void 0 && (p.completion_timeout = t), b(n, p); let d = l && l.headers ? l.headers : {}; return a.headers = { ...o, ...d, ...s.headers }, { url: I(n), options: a }; }, deleteModbusIO: async (r, t, s = {}) => { h("deleteModbusIO", "cell", r), h("deleteModbusIO", "io", t); const c = "/cells/{cell}/bus-ios/modbus/ios/{io}".replace("{cell}", encodeURIComponent(String(r))).replace("{io}", encodeURIComponent(String(t))), n = new URL(c, S); let l; e && (l = e.baseOptions); const a = { method: "DELETE", ...l, ...s }, o = {}, p = {}; u(a, e), await P(o, e), b(n, p); let d = l && l.headers ? l.headers : {}; return a.headers = { ...o, ...d, ...s.headers }, { url: I(n), options: a }; }, deleteProfinetIO: async (r, t, s = {}) => { h("deleteProfinetIO", "cell", r), h("deleteProfinetIO", "io", t); const c = "/cells/{cell}/bus-ios/profinet/ios/{io}".replace("{cell}", encodeURIComponent(String(r))).replace("{io}", encodeURIComponent(String(t))), n = new URL(c, S); let l; e && (l = e.baseOptions); const a = { method: "DELETE", ...l, ...s }, o = {}, p = {}; u(a, e), await P(o, e), b(n, p); let d = l && l.headers ? l.headers : {}; return a.headers = { ...o, ...d, ...s.headers }, { url: I(n), options: a }; }, getBusIOService: async (r, t = {}) => { h("getBusIOService", "cell", r); const s = "/cells/{cell}/bus-ios".replace("{cell}", encodeURIComponent(String(r))), c = new URL(s, S); let n; e && (n = e.baseOptions); const l = { method: "GET", ...n, ...t }, a = {}, o = {}; u(l, e), await P(a, e), b(c, o); let p = n && n.headers ? n.headers : {}; return l.headers = { ...a, ...p, ...t.headers }, { url: I(c), options: l }; }, getBusIOState: async (r, t = {}) => { h("getBusIOState", "cell", r); const s = "/cells/{cell}/bus-ios/state".replace("{cell}", encodeURIComponent(String(r))), c = new URL(s, S); let n; e && (n = e.baseOptions); const l = { method: "GET", ...n, ...t }, a = {}, o = {}; u(l, e), await P(a, e), b(c, o); let p = n && n.headers ? n.headers : {}; return l.headers = { ...a, ...p, ...t.headers }, { url: I(c), options: l }; }, getBusIOValues: async (r, t, s = {}) => { h("getBusIOValues", "cell", r); const c = "/cells/{cell}/bus-ios/ios/values".replace("{cell}", encodeURIComponent(String(r))), n = new URL(c, S); let l; e && (l = e.baseOptions); const a = { method: "GET", ...l, ...s }, o = {}, p = {}; u(a, e), await P(o, e), t && (p.ios = t), b(n, p); let d = l && l.headers ? l.headers : {}; return a.headers = { ...o, ...d, ...s.headers }, { url: I(n), options: a }; }, getProfinetDescription: async (r, t = {}) => { h("getProfinetDescription", "cell", r); const s = "/cells/{cell}/bus-ios/profinet/description".replace("{cell}", encodeURIComponent(String(r))), c = new URL(s, S); let n; e && (n = e.baseOptions); const l = { method: "GET", ...n, ...t }, a = {}, o = {}; u(l, e), await P(a, e), b(c, o); let p = n && n.headers ? n.headers : {}; return l.headers = { ...a, ...p, ...t.headers }, { url: I(c), options: l }; }, getProfinetIOsFromFile: async (r, t, s, c = {}) => { h("getProfinetIOsFromFile", "cell", r); const n = "/cells/{cell}/bus-ios/profinet/iofile".replace("{cell}", encodeURIComponent(String(r))), l = new URL(n, S); let a; e && (a = e.baseOptions); const o = { method: "GET", ...a, ...c }, p = {}, d = {}; u(o, e), await P(p, e), t !== void 0 && (d.input_offset = t), s !== void 0 && (d.output_offset = s), b(l, d); let i = a && a.headers ? a.headers : {}; return o.headers = { ...p, ...i, ...c.headers }, { url: I(l), options: o }; }, listBusIODescriptions: async (r, t = {}) => { h("listBusIODescriptions", "cell", r); const s = "/cells/{cell}/bus-ios/ios/description".replace("{cell}", encodeURIComponent(String(r))), c = new URL(s, S); let n; e && (n = e.baseOptions); const l = { method: "GET", ...n, ...t }, a = {}, o = {}; u(l, e), await P(a, e), b(c, o); let p = n && n.headers ? n.headers : {}; return l.headers = { ...a, ...p, ...t.headers }, { url: I(c), options: l }; }, listModbusIOs: async (r, t = {}) => { h("listModbusIOs", "cell", r); const s = "/cells/{cell}/bus-ios/modbus/ios".replace("{cell}", encodeURIComponent(String(r))), c = new URL(s, S); let n; e && (n = e.baseOptions); const l = { method: "GET", ...n, ...t }, a = {}, o = {}; u(l, e), await P(a, e), b(c, o); let p = n && n.headers ? n.headers : {}; return l.headers = { ...a, ...p, ...t.headers }, { url: I(c), options: l }; }, listProfinetIOs: async (r, t = {}) => { h("listProfinetIOs", "cell", r); const s = "/cells/{cell}/bus-ios/profinet/ios".replace("{cell}", encodeURIComponent(String(r))), c = new URL(s, S); let n; e && (n = e.baseOptions); const l = { method: "GET", ...n, ...t }, a = {}, o = {}; u(l, e), await P(a, e), b(c, o); let p = n && n.headers ? n.headers : {}; return l.headers = { ...a, ...p, ...t.headers }, { url: I(c), options: l }; }, setBusIOValues: async (r, t, s = {}) => { h("setBusIOValues", "cell", r), h("setBusIOValues", "iOValue", t); const c = "/cells/{cell}/bus-ios/ios/values".replace("{cell}", encodeURIComponent(String(r))), n = new URL(c, S); let l; e && (l = e.baseOptions); const a = { method: "PUT", ...l, ...s }, o = {}, p = {}; u(a, e), await P(o, e), o["Content-Type"] = "application/json", b(n, p); let d = l && l.headers ? l.headers : {}; return a.headers = { ...o, ...d, ...s.headers }, a.data = A(t, a, e), { url: I(n), options: a }; }, setProfinetIOsFromFile: async (r, t, s = {}) => { h("setProfinetIOsFromFile", "cell", r), h("setProfinetIOsFromFile", "profinetInputOutputConfig", t); const c = "/cells/{cell}/bus-ios/profinet/iofile".replace("{cell}", encodeURIComponent(String(r))), n = new URL(c, S); let l; e && (l = e.baseOptions); const a = { method: "PUT", ...l, ...s }, o = {}, p = {}; u(a, e), await P(o, e), o["Content-Type"] = "application/json", b(n, p); let d = l && l.headers ? l.headers : {}; return a.headers = { ...o, ...d, ...s.headers }, a.data = A(t, a, e), { url: I(n), options: a }; } }; }, U = function(e) { const r = ue(e); return { async addBusIOService(t, s, c, n) { var p, d; const l = await r.addBusIOService(t, s, c, n), a = (e == null ? void 0 : e.serverIndex) ?? 0, o = (d = (p = C["BUSInputsOutputsApi.addBusIOService"]) == null ? void 0 : p[a]) == null ? void 0 : d.url; return (i, V) => y(l, O, m, e)(i, o || V); }, async addModbusIO(t, s, c, n) { var p, d; const l = await r.addModbusIO(t, s, c, n), a = (e == null ? void 0 : e.serverIndex) ?? 0, o = (d = (p = C["BUSInputsOutputsApi.addModbusIO"]) == null ? void 0 : p[a]) == null ? void 0 : d.url; return (i, V) => y(l, O, m, e)(i, o || V); }, async addProfinetIO(t, s, c, n) { var p, d; const l = await r.addProfinetIO(t, s, c, n), a = (e == null ? void 0 : e.serverIndex) ?? 0, o = (d = (p = C["BUSInputsOutputsApi.addProfinetIO"]) == null ? void 0 : p[a]) == null ? void 0 : d.url; return (i, V) => y(l, O, m, e)(i, o || V); }, async clearBusIOService(t, s, c) { var o, p; const n = await r.clearBusIOService(t, s, c), l = (e == null ? void 0 : e.serverIndex) ?? 0, a = (p = (o = C["BUSInputsOutputsApi.clearBusIOService"]) == null ? void 0 : o[l]) == null ? void 0 : p.url; return (d, i) => y(n, O, m, e)(d, a || i); }, async deleteModbusIO(t, s, c) { var o, p; const n = await r.deleteModbusIO(t, s, c), l = (e == null ? void 0 : e.serverIndex) ?? 0, a = (p = (o = C["BUSInputsOutputsApi.deleteModbusIO"]) == null ? void 0 : o[l]) == null ? void 0 : p.url; return (d, i) => y(n, O, m, e)(d, a || i); }, async deleteProfinetIO(t, s, c) { var o, p; const n = await r.deleteProfinetIO(t, s, c), l = (e == null ? void 0 : e.serverIndex) ?? 0, a = (p = (o = C["BUSInputsOutputsApi.deleteProfinetIO"]) == null ? void 0 : o[l]) == null ? void 0 : p.url; return (d, i) => y(n, O, m, e)(d, a || i); }, async getBusIOService(t, s) { var a, o; const c = await r.getBusIOService(t, s), n = (e == null ? void 0 : e.serverIndex) ?? 0, l = (o = (a = C["BUSInputsOutputsApi.getBusIOService"]) == null ? void 0 : a[n]) == null ? void 0 : o.url; return (p, d) => y(c, O, m, e)(p, l || d); }, async getBusIOState(t, s) { var a, o; const c = await r.getBusIOState(t, s), n = (e == null ? void 0 : e.serverIndex) ?? 0, l = (o = (a = C["BUSInputsOutputsApi.getBusIOState"]) == null ? void 0 : a[n]) == null ? void 0 : o.url; return (p, d) => y(c, O, m, e)(p, l || d); }, async getBusIOValues(t, s, c) { var o, p; const n = await r.getBusIOValues(t, s, c), l = (e == null ? void 0 : e.serverIndex) ?? 0, a = (p = (o = C["BUSInputsOutputsApi.getBusIOValues"]) == null ? void 0 : o[l]) == null ? void 0 : p.url; return (d, i) => y(n, O, m, e)(d, a || i); }, async getProfinetDescription(t, s) { var a, o; const c = await r.getProfinetDescription(t, s), n = (e == null ? void 0 : e.serverIndex) ?? 0, l = (o = (a = C["BUSInputsOutputsApi.getProfinetDescription"]) == null ? void 0 : a[n]) == null ? void 0 : o.url; return (p, d) => y(c, O, m, e)(p, l || d); }, async getProfinetIOsFromFile(t, s, c, n) { var p, d; const l = await r.getProfinetIOsFromFile(t, s, c, n), a = (e == null ? void 0 : e.serverIndex) ?? 0, o = (d = (p = C["BUSInputsOutputsApi.getProfinetIOsFromFile"]) == null ? void 0 : p[a]) == null ? void 0 : d.url; return (i, V) => y(l, O, m, e)(i, o || V); }, async listBusIODescriptions(t, s) { var a, o; const c = await r.listBusIODescriptions(t, s), n = (e == null ? void 0 : e.serverIndex) ?? 0, l = (o = (a = C["BUSInputsOutputsApi.listBusIODescriptions"]) == null ? void 0 : a[n]) == null ? void 0 : o.url; return (p, d) => y(c, O, m, e)(p, l || d); }, async listModbusIOs(t, s) { var a, o; const c = await r.listModbusIOs(t, s), n = (e == null ? void 0 : e.serverIndex) ?? 0, l = (o = (a = C["BUSInputsOutputsApi.listModbusIOs"]) == null ? void 0 : a[n]) == null ? void 0 : o.url; return (p, d) => y(c, O, m, e)(p, l || d); }, async listProfinetIOs(t, s) { var a, o; const c = await r.listProfinetIOs(t, s), n = (e == null ? void 0 : e.serverIndex) ?? 0, l = (o = (a = C["BUSInputsOutputsApi.listProfinetIOs"]) == null ? void 0 : a[n]) == null ? void 0 : o.url; return (p, d) => y(c, O, m, e)(p, l || d); }, async setBusIOValues(t, s, c) { var o, p; const n = await r.setBusIOValues(t, s, c), l = (e == null ? void 0 : e.serverIndex) ?? 0, a = (p = (o = C["BUSInputsOutputsApi.setBusIOValues"]) == null ? void 0 : o[l]) == null ? void 0 : p.url; return (d, i) => y(n, O, m, e)(d, a || i); }, async setProfinetIOsFromFile(t, s, c) { var o, p; const n = await r.setProfinetIOsFromFile(t, s, c), l = (e == null ? void 0 : e.serverIndex) ?? 0, a = (p = (o = C["BUSInputsOutputsApi.setProfinetIOsFromFile"]) == null ? void 0 : o[l]) == null ? void 0 : p.url; return (d, i) => y(n, O, m, e)(d, a || i); } }; }; var et = class extends R { /** * Add the BUS inputs/outputs service to the cell. Starts a containerized service that enables BUS connections via the specified ethernet port. * @summary Add Service * @param {string} cell Unique identifier addressing a cell in all API calls. * @param {BusIOType} busIOType * @param {number} [completionTimeout] * @param {*} [options] Override http request option. * @throws {RequiredError} */ addBusIOService(e, r, t, s) { return U(this.configuration).addBusIOService(e, r, t, s).then((c) => c(this.axios, this.basePath)); } /** * Adds an input/output variable to or updates an input/output variable on the MODBUS device, e.g., NOVA\'s MODBUS service. The inputs/outputs map variables to specific memory addresses in the process image. The NOVA\'s MODBUS service\'s configuration can be viewed via [listModbusIOs](listModbusIOs). * @summary Add MODBUS Input/Output * @param {string} cell Unique identifier addressing a cell in all API calls. * @param {string} io Unique identifier to address an Input/Output in the cell. * @param {ModbusIOData} modbusIOData * @param {*} [options] Override http request option. * @throws {RequiredError} */ addModbusIO(e, r, t, s) { return U(this.configuration).addModbusIO(e, r, t, s).then((c) => c(this.axios, this.basePath)); } /** * Adds an input/output variable to or updates an input/output variable on the PROFINET device, e.g., NOVA\'s PROFINET service. The inputs/outputs map variables to specific memory addresses in the process image. The default process image has buffer lengths of 64 bytes for input and output. - The size of the buffer is determined by the `config_file_content` that is passed in [addBusIOService](addBusIOService) and has to be in accordance with the GSDML file describing the PROFINET device. The PROFINET controller as well as NOVA\'s PROFINET service use an input/output variable configuration to interpret the bits of the input/output process image. - The NOVA\'s PROFINET service\'s configuration can be viewed via [listProfinetIOs](listProfinetIOs). For the PROFINET controller, e.g., a connected PLC, refer to the corresponding third party software, e.g., TIA portal). * @summary Add PROFINET Input/Output * @param {string} cell Unique identifier addressing a cell in all API calls. * @param {string} io Unique identifier to address an Input/Output in the cell. * @param {ProfinetIOData} profinetIOData * @param {*} [options] Override http request option. * @throws {RequiredError} */ addProfinetIO(e, r, t, s) { return U(this.configuration).addProfinetIO(e, r, t, s).then((c) => c(this.axios, this.basePath)); } /** * Remove the BUS inputs/outputs service from the cell. * @summary Clear Service * @param {string} cell Unique identifier addressing a cell in all API calls. * @param {number} [completionTimeout] * @param {*} [options] Override http request option. * @throws {RequiredError} */ clearBusIOService(e, r, t) { return U(this.configuration).clearBusIOService(e, r, t).then((s) => s(this.axios, this.basePath)); } /** * Removes an input/output variable configuration from the MODBUS device, e.g., NOVA\'s MODBUS service. * @summary Remove MODBUS Input/Ouptut * @param {string} cell Unique identifier addressing a cell in all API calls. * @param {string} io Unique identifier to address an Input/Output in the cell. * @param {*} [options] Override http request option. * @throws {RequiredError} */ deleteModbusIO(e, r, t) { return U(this.configuration).deleteModbusIO(e, r, t).then((s) => s(this.axios, this.basePath)); } /** * Removes an input/output variable configuration from the PROFINET device, e.g., NOVA\'s PROFINET service. * @summary Remove PROFINET Input/Ouptut * @param {string} cell Unique identifier addressing a cell in all API calls. * @param {string} io Unique identifier to address an Input/Output in the cell. * @param {*} [options] Override http request option. * @throws {RequiredError} */ deleteProfinetIO(e, r, t) { return U(this.configuration).deleteProfinetIO(e, r, t).then((s) => s(this.axios, this.basePath)); } /** * Get deployed BUS inputs/outputs service. * @summary Get Service * @param {string} cell Unique identifier addressing a cell in all API calls. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBusIOService(e, r) { return U(this.configuration).getBusIOService(e, r).then((t) => t(this.axios, this.basePath)); } /** * Get the current state of the BUS Inputs/Outputs service. * @summary State * @param {string} cell Unique identifier addressing a cell in all API calls. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBusIOState(e, r) { return U(this.configuration).getBusIOState(e, r).then((t) => t(this.axios, this.basePath)); } /** * Retrieves the current values of inputs/outputs. The identifiers of the inputs/outputs must be provided in the request. Request all available input/output identifiers via [listBusIODescriptions](listBusIODescriptions). * @summary Get Input/Output Values * @param {string} cell Unique identifier addressing a cell in all API calls. * @param {Array<string>} [ios] * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBusIOValues(e, r, t) { return U(this.configuration).getBusIOValues(e, r, t).then((s) => s(this.axios, this.basePath)); } /** * Get description of NOVA as a PROFINET device. * @summary Get PROFINET Description * @param {string} cell Unique identifier addressing a cell in all API calls. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getProfinetDescription(e, r) { return U(this.configuration).getProfinetDescription(e, r).then((t) => t(this.axios, this.basePath)); } /** * Get input/output variable configuration of the PROFINET device, e.g., NOVA\'s PROFINET service as file. You can specify byte offsets for the input and output variable addresses to get an XML tagmap that is ready to paste to the third party software, e.g., TIA portal. * @summary PROFINET Inputs/Outputs to File * @param {string} cell Unique identifier addressing a cell in all API calls. * @param {number} [inputOffset] * @param {number} [outputOffset] * @param {*} [options] Override http request option. * @throws {RequiredError} */ getProfinetIOsFromFile(e, r, t, s) { return U(this.configuration).getProfinetIOsFromFile(e, r, t, s).then((c) => c(this.axios, this.basePath)); } /** * List all input/output descriptions for configured BUS services. The input/output descriptions contain information like name, type and unit. The input/output direction is given in perspective of the BUS service. * @summary List Descriptions * @param {string} cell Unique identifier addressing a cell in all API calls. * @param {*} [options] Override http request option. * @throws {RequiredError} */ listBusIODescriptions(e, r) { return U(this.configuration).listBusIODescriptio