aes70 1.3.6 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog +12 -0
- package/dist/AES70.es5.js +1 -1
- package/package.json +1 -1
- package/src/OCP1/message_generator.js +1 -1
- package/src/controller/ControlClasses/OcaFilterFIR.d.ts +5 -0
- package/src/controller/ControlClasses/OcaFilterFIR.js +9 -1
- package/src/controller/ControlClasses/OcaPowerManager.d.ts +5 -0
- package/src/controller/ControlClasses/OcaPowerManager.js +9 -1
- package/src/controller/ControlClasses/OcaPowerSupply.d.ts +10 -0
- package/src/controller/ControlClasses/OcaPowerSupply.js +20 -2
- package/src/controller/ControlClasses/OcaSensor.d.ts +5 -0
- package/src/controller/ControlClasses/OcaSensor.js +9 -1
- package/src/controller/ControlClasses.d.ts +0 -1
- package/src/controller/client_connection.d.ts +1 -1
- package/src/controller/client_connection.js +17 -5
- package/src/controller/make_control_class.js +24 -4
- package/src/controller/remote_device.js +2 -3
- package/src/controller/udp_connection.js +5 -1
- package/tests/device/locking.js +2 -1
- package/tests/device/method_callback.js +24 -0
- package/tests/device/test.js +11 -5
- package/tests/device.js +3 -1
- package/bin/connectMany.js +0 -64
package/Changelog
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes and version updates will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.3.7] - 2022-06-26
|
|
6
|
+
|
|
7
|
+
- Fixed a bug in the testsuite which could lead tests to spuriously fail if they
|
|
8
|
+
run too long.
|
|
9
|
+
- Introduce an optional callback based variant for all remote methods in control
|
|
10
|
+
classes.
|
|
11
|
+
- UDPConnection: Improve the estimation of the time a command has been sent.
|
|
12
|
+
This can prevent commands from failing spuriously in situations in which the
|
|
13
|
+
send queue is very long.
|
|
14
|
+
- Corrected some control class method attributes which were incorrect in the
|
|
15
|
+
standards documents.
|
|
16
|
+
|
|
5
17
|
## [1.3.6] - 2022-03-13
|
|
6
18
|
|
|
7
19
|
- Add conditional 'exports' entry for NodeJS and
|
package/dist/AES70.es5.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";function e(...e){try{console.warn(...e)}catch(e){}}function t(...e){try{console.error(...e)}catch(e){}}class n{constructor(){this.event_handlers=new Map}emit(e){const t=this.event_handlers.get(e),n=Array.prototype.slice.call(arguments,1);t&&t.forEach(e=>{try{e.apply(this,n)}catch(t){console.warn("ERROR when calling %o: %o",e,t)}})}on(e,t){let n=this.event_handlers.get(e);n||this.event_handlers.set(e,n=new Set),n.add(t)}addEventListener(e,t){this.on(e,t)}removeEventListener(e,t){const n=this.event_handlers.get(e);if(!n||!n.has(t))throw new Error("removeEventListeners(): not installed.");n.delete(t)}}class r{get messageType(){return this.constructor.messageType}}class o{get byteLength(){let e=this._byteLength;if(-1===e){const t=this.encoders,n=this.data;e=0;for(let r=0;r<t.length;r++)e+=t[r].encodedLength(n[r]);this._byteLength=e}return e}constructor(e,t){this.encoders=e,this.data=t,this._byteLength=-1}encodeTo(e,t){t|=0;const{encoders:n,data:r}=this;for(let o=0;o<n.length;o++)t=n[o].encodeTo(e,t,r[o]);return t}}class s extends r{constructor(e,t,n,r,o){super(),this.target=+e,this.method_level=0|t,this.method_index=0|n,this.param_count=0|r,this.parameters=o||null,this.handle=0}static get messageType(){return 0}encode_to(e,t){if(t|=0,e.setUint32(t,this.encoded_length()),t+=4,e.setUint32(t,this.handle),t+=4,e.setUint32(t,this.target),t+=4,e.setUint16(t,this.method_level),t+=2,e.setUint16(t,this.method_index),t+=2,e.setUint8(t,this.param_count),t++,this.param_count){const n=this.parameters;n instanceof o?t=n.encodeTo(e,t):(new Uint8Array(e.buffer).set(new Uint8Array(n),e.byteOffset+t),t+=n.byteLength)}return t}encoded_length(){return 17+(this.param_count?this.parameters.byteLength:0)}decode_from(e,t,n){let r=e.getUint32(t);if(t+=4,this.handle=e.getUint32(t),t+=4,this.target=e.getUint32(t),t+=4,this.method_level=e.getUint16(t),t+=2,this.method_index=e.getUint16(t),t+=2,this.param_count=e.getUint8(t),t++,r-=17,r<0)throw new Error("Bad Command Length.");if(r>0){if(!this.param_count)throw new Error("Expected no parameter bytes.");this.parameters=e.buffer.slice(e.byteOffset+t,e.byteOffset+t+r),t+=r}return t}response(e,t,n){return new Response(this.handle,e,t,n)}}class i extends s{static get messageType(){return 1}}function a(e){if(!e.isConstantLength)return e;const t=e.encodedLength(),n=e.decode,r=e.encodeTo;return{isConstantLength:!0,encodedLength:e.encodedLength,encodeTo:r,decode:n,decodeFrom:function(e,r){const o=n(e,r);return[r+t,o]},decodeLength:function(e,n){return n+t}}}function c(e,t){const n=Object.keys(e).length;return t||(t=class{constructor(...t){if(t.length===n){let n=0;for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this[r]=t[n++])}else{if(1!==t.length||"object"!=typeof t[0])throw new TypeError("Unexpected arguments.");{const n=t[0];for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(this[t]=n[t])}}}}),a({type:t,isConstantLength:!1,encodedLength:function(t){let n=0;for(const r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;n+=e[r].encodedLength(t[r])}return n},encodeTo:function(t,n,r){for(const o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;n=e[o].encodeTo(t,n,r[o])}return n},decodeFrom:function(n,r){const o=new Array(e.length);let s=0;for(const t in e){if(!Object.prototype.hasOwnProperty.call(e,t))continue;const i=e[t];let a;[r,a]=i.decodeFrom(n,r),o[s++]=a}return[r,new t(...o)]},decodeLength:function(t,n){for(const r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;n=e[r].decodeLength(t,n)}return n}})}const l=a({isConstantLength:!0,encodedLength:function(e){return 2},encodeTo:function(e,t,n){return e.setUint16(t,0|n,!1),t+2},decode:function(e,t){return e.getUint16(t,!1)}});class u{constructor(e,t){this.DefLevel=e,this.EventIndex=t}}const h=c({DefLevel:l,EventIndex:l},u),d=a({isConstantLength:!0,encodedLength:function(e){return 4},encodeTo:function(e,t,n){return e.setUint32(t,n,!1),t+4},decode:function(e,t){return e.getUint32(t,!1)}});class g{constructor(e,t){this.EmitterONo=e,this.EventID=t}}const S=c({EmitterONo:d,EventID:h},g);class f extends r{constructor(e,t,n,r,o,s,i){super(),this.target=e,this.method_level=0|t,this.method_index=0|n,this.context=r,this.event=o,this.param_count=0|s,this.parameters=i||null}static get messageType(){return 2}encode_to(e,t){e.setUint32(t,this.encoded_length()),t+=4,e.setUint32(t,this.target),t+=4,e.setUint16(t,this.method_level),t+=2,e.setUint16(t,this.method_index),t+=2,e.setUint8(t,this.param_count),t++;const n=this.context;if(n){const r=n.byteLength;e.setUint16(t,r),t+=2,r>0&&(new Uint8Array(e.buffer).set(new Uint8Array(this.context),e.byteOffset+t),t+=r)}else e.setUint16(t,0),t+=2;return e.setUint32(t,this.event.EmitterONo),t+=4,e.setUint16(t,this.event.EventID.DefLevel),t+=2,e.setUint16(t,this.event.EventID.EventIndex),t+=2,this.param_count>1&&(this.parameters instanceof o?t=this.parameters.encodeTo(e,t):(new Uint8Array(e.buffer).set(new Uint8Array(this.parameters),e.byteOffset+t),t+=this.parameters.byteLength)),t}encoded_length(){return 23+(this.param_count>1?this.parameters.byteLength:0)+(this.context?this.context.byteLength:0)}decode_from(e,t,n){let r=e.getUint32(t);t+=4,this.target=e.getUint32(t),t+=4,this.method_level=e.getUint16(t),t+=2,this.method_index=e.getUint16(t),t+=2,this.param_count=e.getUint8(t),t++;const o=e.getUint16(t);let s;if(t+=2,o?(this.context=e.buffer.slice(e.byteOffset+t,e.byteOffset+t+o),t+=o):this.context=null,[t,s]=S.decodeFrom(e,t),this.event=s,r-=23+o,r<0)throw new Error("Bad Notification Length.");return r>0&&(this.parameters=e.buffer.slice(e.byteOffset+t,e.byteOffset+t+r),t+=r),t}}class p extends r{constructor(e,t,n,r){super(),this.handle=e,this.status_code=0|t,this.param_count=0|n,this.parameters=r||null}static get messageType(){return 3}encoded_length(){return 10+(this.param_count?this.parameters.byteLength:0)}decode_from(e,t,n){let r=e.getUint32(t);if(t+=4,this.handle=e.getUint32(t),t+=4,this.status_code=e.getUint8(t),t++,this.param_count=e.getUint8(t),t++,r-=10,r<0)throw new Error("Bad Response length.");if(r>0){if(!this.param_count)throw new Error("Decoding response with parameterCount=0 but %o bytes of parameters",r);this.parameters=e.buffer.slice(e.byteOffset+t,e.byteOffset+t+r),t+=r}return t}encode_to(e,t){return e.setUint32(t,this.encoded_length()),t+=4,e.setUint32(t,this.handle),t+=4,e.setUint8(t,this.status_code),t++,e.setUint8(t,this.param_count),t++,this.param_count&&(this.parameters instanceof o?t=this.parameters.encodeTo(e,t):(new Uint8Array(e.buffer).set(new Uint8Array(this.parameters),e.byteOffset+t),t+=this.parameters.byteLength)),t}}class m extends r{static get messageType(){return 4}constructor(e){super(),this.time=e||0}decode_from(e,t,n){if(4==n)this.time=e.getUint32(t),t+=4;else{if(2!=n)throw new Error("Bad keepalive timeout length.");this.time=1e3*e.getUint16(t),t+=2}return t}encode_to(e,t){return this.time%1e3?(e.setUint32(t,this.time),t+=4):(e.setUint16(t,this.time/1e3),t+=2),t}encoded_length(){return this.time%1e3?4:2}}const O=[s,i,f,p,m];function y(e,t,n){if(e.byteLength<e.byteOffset+t+10)return-1;if(t|=0,59!=e.getUint8(t))throw new Error("Bad sync value.");t++,t+=2;const r=e.getUint32(t);t+=4;const o=e.getUint8(t);t++;const s=e.getUint16(t);t+=2;const i=e.byteOffset+t-9+r;if(i>e.byteLength)return-1;n.length=s;const a=O[o];if(void 0===a)throw new Error("Bad Message Type");if(a===m&&1!==s)throw new Error("Bad KeepAlive message count.");for(let r=0;r<s;r++)n[r]=new a,t=n[r].decode_from(e,t,i-e.byteOffset-t);if(t!=i)throw new Error("Decode error: "+t+" vs "+i);return t}function b(e,t,n,r,o){r||(r=0),o||(o=n.length);if(!(o-r<=65535))throw new Error("Too many PDUs.");e.setUint8(t,59);const s=t+=1;e.setUint16(t,1);const i=t+=2;t+=4,e.setUint8(t,n[r].messageType),t++,e.setUint16(t,o-r),t+=2;for(let s=r;s<o;s++)t=n[s].encode_to(e,t);return e.setUint32(i,t-s),t}class C{constructor(e,t){if(!(e<=4294967295))throw new TypeError("Invalid batch size.");this._pdus=[],this._batchSize=e,this._resultCallback=t,this._currentSize=0,this._currentCount=0,this._lastMessageType=-1,this._flushScheduled=!1,this._flushCb=()=>{this._flushScheduled=!1,null!==this._pdus&&this.flush()}}add(e){const t=this._currentSize,n=e.encoded_length(),r=e.messageType;let o=this._lastMessageType===r&&4!==r&&this._currentCount<65535,s=n;o||(s+=10),t&&t+s>this._batchSize&&(this.flush(),s=n+10),this._pdus.push(e),this._currentSize+=s,o?this._currentCount++:this._currentCount=1,this._lastMessageType=r,this._currentSize>this._batchSize?this.flush():1===this._pdus.length&&this.scheduleFlush()}scheduleFlush(){this._flushScheduled||(this._flushScheduled=!0,Promise.resolve().then(this._flushCb).catch(e=>{console.error(e)}))}flush(){if(!this._currentSize)return;const e=this._pdus,t=new ArrayBuffer(this._currentSize),n=new DataView(t),r=e.length;for(let t=0,o=0,s=0;t<r;t++){const i=e[t].messageType;t!==r-1&&t+1-o!=65535&&4!==i&&i===e[t+1].messageType||(s=b(n,s,e,o,t+1),o=t+1)}this._currentSize=0,this._lastMessageType=-1,this._currentCount=0,this._pdus.length=0,this._resultCallback(t)}dispose(){this._pdus=null}}class w extends n{constructor(e){e||(e={}),super();const t=this._now();this.options=e;const n=e.batch>=0?e.batch:65536;this._message_generator=new C(n,e=>this.write(e)),this.inbuf=null,this.inpos=0,this.last_rx_time=t,this.last_tx_time=t,this.rx_bytes=0,this.tx_bytes=0,this.keepalive_interval=-1,this._keepalive_interval_id=null;const r=()=>{this.removeEventListener("close",r),this.removeEventListener("error",r),this.cleanup()};this.on("close",r),this.on("error",r)}get is_reliable(){return!0}send(e){if(this.is_closed())throw new Error("Connection is closed.");this._message_generator.add(e)}tx_idle_time(){return this._now()-this.last_tx_time}rx_idle_time(){return this._now()-this.last_tx_time}read(e){if(this.rx_bytes+=e.byteLength,this.last_rx_time=this._now(),this.inbuf){const t=this.inbuf.byteLength-this.inpos,n=new Uint8Array(new ArrayBuffer(t+e.byteLength));n.set(new Uint8Array(this.inbuf,this.inpos)),n.set(new Uint8Array(e),t),this.inbuf=null,this.inpos=0,e=n.buffer}let t=0;const n=new DataView(e);try{do{const r=[],o=y(n,t,r);if(-1==o){this.inbuf=e,this.inpos=t;break}t=o,this.incoming(r)}while(t<e.byteLength)}catch(e){console.error(e),this.is_reliable&&(console.error("Error when handling incoming data. Closing connection."),this.close())}this._check_keepalive()}incoming(e){}write(e){this.last_tx_time=this._now(),this.tx_bytes+=e.byteLength}is_closed(){return null===this._message_generator}close(){this.emit("close")}error(e){this.emit("error",e)}cleanup(){if(this.is_closed())throw new Error("cleanup() called twice.");this.set_keepalive_interval(0),this._message_generator.dispose(),this._message_generator=null}_check_keepalive(){if(!(this.keepalive_interval>0))return;const e=this.keepalive_interval;this.rx_idle_time()>3*e?(this.emit("timeout"),this.error(new Error("Keepalive timeout."))):this.tx_idle_time()>.75*e&&(this.flush(),this.tx_idle_time()>.75*e&&this.send(new m(e)))}flush(){this._message_generator.flush()}set_keepalive_interval(e){const t=1e3*e;null!==this._keepalive_interval_id&&(clearInterval(this._keepalive_interval_id),this._keepalive_interval_id=null),this.keepalive_interval=t,this.is_closed()||(this.send(new m(t)),t>0&&(this._keepalive_interval_id=setInterval(()=>{this._check_keepalive()},t/2)))}}function P(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function G(e){let t=null;function n(n){if(null===t){t=new Map;for(const n in e)P(e,n)&&t.set(e[n],n)}return t.get(n)}let r=null;const o=class{constructor(t){if("string"==typeof t){if(!P(e,t))throw new Error("No such enum value.");return this.constructor[t]}if(null!==r&&r.has(t))return r.get(t);this.value=t,function(e,t){null===r&&(r=new Map),r.set(e,t)}(t,this)}get name(){return n(this.value)}valueOf(){return this.value}toString(){return this.name}static getName(e){const t=n(e);if(void 0===t)throw new Error("No such enum value.");return t}static getValue(t){const n=function(t){if(P(e,t))return e[t]}(t);if(void 0===n)throw new Error("No such enum value.");return n}static values(){return e}};for(const t in e)P(e,t)&&Object.defineProperty(o,t,{get:function(){return new this(e[t])},enumerable:!1,configurable:!0});return o}class v extends(G({OK:0,ProtocolVersionError:1,DeviceError:2,Locked:3,BadFormat:4,BadONo:5,ParameterError:6,ParameterOutOfRange:7,NotImplemented:8,InvalidRequest:9,ProcessingFailed:10,BadMethod:11,PartiallySucceeded:12,Timeout:13,BufferOverflow:14})){}class D{constructor(e,t){this.status=new v(e),this.cmd=t}static check_status(e,t){return e instanceof this&&e.status===t}toString(){return"RemoteError("+this.status+")"}}class _{constructor(e){this.values=e}item(e){return this.values[e]}get length(){return this.values.length}}class T{get handle(){return this.command.handle}constructor(e,t,n,r){this.resolve=e,this.reject=t,this.returnTypes=n,this.command=r,this.lastSent=0,this.retries=0}response(e){const{resolve:t,reject:n,returnTypes:r,command:o}=this;if(0!==e.status_code)n(new D(e.status_code,o));else if(r)try{const n=Math.min(e.param_count,r.length);if(0===n)t();else{const o=new Array(n),s=new DataView(e.parameters);for(let e=0,t=0;e<n;e++){let n;[t,n]=r[e].decodeFrom(s,t),o[e]=n}t(1===n?o[0]:new _(o))}}catch(e){n(e)}else t(e)}}function I(e){const t=e.EmitterONo,n=e.EventID;return[t,n.DefLevel,n.EventIndex].join(",")}class M extends w{constructor(e){super(e),this._pendingCommands=new Map,this._nextCommandHandle=0,this._subscribers=new Map}cleanup(){super.cleanup(),this._subscribers=null;const e=this._pendingCommands;this._pendingCommands=null;const t=new Error("closed");e.forEach((e,n)=>{e.reject(t)})}_addSubscriber(e,t){const n=I(e),r=this._subscribers;if(r.has(n))throw new Error("Subscriber already exists.");r.set(n,t)}_removeSubscriber(e){const t=I(e),n=this._subscribers;if(!n.has(t))throw new Error("Unknown subscriber.");n.delete(t)}_getNextCommandHandle(){let e;const t=this._pendingCommands;if(null===t)throw new Error("Connection not open.");do{e=this._nextCommandHandle,this._nextCommandHandle=e+1|0}while(t.has(e));return e}send_command(e,t){return new Promise((n,r)=>{const o=this._getNextCommandHandle();e.handle=o;const s=new T(n,r,t,e);this._pendingCommands.set(o,s),s.lastSent=this._now(),this.send(e)})}_removePendingCommand(e){const t=this._pendingCommands,n=t.get(e);return n?(t.delete(e),n):null}incoming(e){for(let t=0;t<e.length;t++){if(null===this._pendingCommands)return;const n=e[t];if(n instanceof p){const e=this._removePendingCommand(n.handle);if(null===e){if(this.is_reliable)return void this.error(new Error("Unknown handle."));continue}e.response(n)}else if(n instanceof f){const e=this._subscribers,t=I(n.event),r=e.get(t);if(!r)continue;r(n)}else{if(!(n instanceof m))throw new Error("Unexpected PDU");if(!(n.time>0))throw new Error("Bad keepalive timeout.")}}}}class A{constructor(e,t,n){this.object=e,this.id=t,this.handlers=new Set,this.result=null,this.argumentTypes=n}GetOcaEvent(){return new g(this.object.ObjectNumber,this.id)}do_subscribe(){}do_unsubscribe(){}subscribe(e){return this.handlers.add(e),1===this.handlers.size?this.result=this.do_subscribe().then(()=>(this.result=null,!0)):null!==this.result?this.result:Promise.resolve(!0)}unsubscribe(e){return this.handlers.delete(e),this.handlers.size||this.do_unsubscribe().catch((function(){})),Promise.resolve(!0)}Dipose(){this.handlers.clear(),this.handlers.size&&this.do_unsubscribe().catch((function(){}))}}const L=new ArrayBuffer;class E extends A{constructor(e,n,r){super(e,n,r),this.callback=e=>{if(!this.handlers.size)return;const n=new Array(r.length),o=new DataView(e.parameters||L);for(let e=0,t=0;t<r.length;t++){let s;[e,s]=r[t].decodeFrom(o,e),n[t]=s}const s=this.object;this.handlers.forEach((function(e){try{e.apply(s,n)}catch(e){t(e)}}))}}do_subscribe(){return this.object.device.add_subscription(this.GetOcaEvent(),this.callback)}do_unsubscribe(e){return this.object.device.remove_subscription(this.GetOcaEvent(),this.callback)}}class k extends A{constructor(e,n,r){super(e,n,r),this.callback=(n,o,s)=>{if(n.DefLevel!==this.id.DefLevel||n.PropertyIndex!==this.id.PropertyIndex)return;const i=r[0].decodeFrom(o,0)[1];this.handlers.forEach((function(r){try{r.call(e,i,s,n)}catch(e){t(e)}}))}}do_subscribe(){return this.object.OnPropertyChanged.subscribe(this.callback)}do_unsubscribe(e){return this.object.OnPropertyChanged.unsubscribe(this.callback)}}class x extends(G({CurrentChanged:1,MinChanged:2,MaxChanged:3,ItemAdded:4,ItemChanged:5,ItemDeleted:6})){}class U{init(e){this.o=e,this.values=[],this.synchronized=!1,this.subscriptions=[]}sync(){if(this.synchronized)return Promise.resolve();let e=0;const t=[];return this.o.get_properties().forEach(n=>{const r=n.getter(this.o);if(!r)return;const o=n.event(this.o);if(o){const n=function(e,t,n){n===x.CurrentChanged&&(this.values[e]=t)}.bind(this,e);this.subscriptions.push(o.unsubscribe.bind(o,n)),t.push(o.subscribe(n).catch((function(){})))}t.push(r().then(function(e,t){t instanceof _&&(t=t.item(0)),this.values[e]=t}.bind(this,e),(function(){}))),e++}),Promise.all(t)}forEach(e,t){let n=0;t||(t=this),this.o.get_properties().forEach(r=>{r.getter(this.o)&&(e.call(t,this.values[n],r.name),n++)})}Dispose(){this.o=null,this.subscriptions.forEach(e=>e()),this.subscriptions=null}}class N{constructor(e,t){this.DefLevel=e,this.PropertyIndex=t}}class R{constructor(e,t,n){const r=new Map,o=[];this.by_name=r,this.parent=n,this.properties=o,this.level=t;for(let t=0;t<e.length;t++){const n=e[t];if(r.set(n.name,n),o[n.index]=n,n.aliases){const e=n.aliases;for(let t=0;t<e.length;t++)r.set(e[t],n)}}}find_property(e){if(e instanceof N){if(e.DefLevel==this.level)return this.properties[e.PropertyIndex];if(this.parent)return this.parent.find_property(e)}else{if("string"!=typeof e)throw new Error("Expected PropertyID");{const t=this.by_name.get(e);if(t)return t;if(this.parent)return this.parent.find_property(e)}}}find_name(e){const t=this.find_property(e);if(t)return t.name}forEach(e,t){const n=this.parent?this.parent.forEach(e,t):[],r=this.properties;for(let o=0;o<r.length;o++){const s=r[o];void 0!==s&&n.push(e.call(t,s))}return n}}class F{constructor(e,t,n,r,o,s,i){this.name=e,this.type=t,this.level=n,this.index=r,this.readonly=o,this.static=s,this.aliases=i}GetPropertyID(){return new N(this.level,this.index)}GetName(){return this.name}getter(e,t){let n=this.name,r=0;const o=this.aliases;if(this.static){const t=e.constructor[n];if(void 0!==t)return function(){return Promise.resolve(t)}}else{const r=e["Get"+n];if(r)return t?r:r.bind(e)}return o&&r<o.length&&(n=o[r++]),null}setter(e,t){if(this.readonly||this.static)return null;let n=this.name,r=0;const o=this.aliases;{const s=e["Set"+n];if(s)return t?s:s.bind(e);o&&r<o.length&&(n=o[r++])}return null}event(e){let t=this.name,n=0;const r=this.aliases;{const o=e["On"+t+"Changed"];if(o)return o;r&&n<r.length&&(t=r[n++])}return null}subscribe(e,n){const r=this.event(e),o=this.getter(e);return r&&r.subscribe(n).catch(t),o&&o().then(n,t),r||!!o}}function B(e,t){if(!t||!t.length)return;const[n,r,s,a,c]=t;e.prototype[n]=function(){const e=new i(this.ono,r,s,a.length,new o(a,Array.from(arguments)));return this.device.send_command(e,c)}}function j(e,t){const[n,r,o,s]=t;Object.defineProperty(e.prototype,"On"+n,{get:function(){const e="_On"+n,t=this[e];return t||(this[e]=new E(this,new u(r,o),s))}})}function V(e,t){t.static||"ObjectNumber"!==t.name&&Object.defineProperty(e.prototype,"On"+t.name+"Changed",{get:function(){const e="_On"+t.name+"Changed",n=this[e];return n||(this[e]=new k(this,new N(t.level,t.index),t.type))}})}function z(e){if("object"==typeof e&&e instanceof F)return e;if(Array.isArray(e))return"object"!=typeof e[1]&&(e[1]=function(e){throw new Error("Not implemented.")}(e[1])),new F(...e);throw new Error("Bad property.")}function q(e,t,n,r,o,s,i,a){let c=null,l=null;i=i.map(e=>z(e));const u=class extends o{static get ClassID(){return n}static get ClassVersion(){return r}static get ClassName(){return e}static get_properties(){return null===l&&(l=new R(i,t,o.get_properties())),l}static GetPropertySync(){return null===c&&(c=function(e){const t=Object.create(U.prototype),n=Object.create(e.prototype);let r=0;e.get_properties().forEach(e=>{const o=!!e.setter(n,!0);if(!e.getter(n,!0))return;const s={enumerable:!0,get:(i=r,function(){return this.values[i]})};var i,a;o&&(s.set=(a=e.setter(n,!0),function(e){return a.call(this.o,e),e})),Object.defineProperty(t,e.name,s),r++});const o=function(e){this.init(e)};return o.prototype=t,o}(this)),c}constructor(e,t){super(e,t);for(let e=0;e<i.length;e++){this["_On"+i[e].name+"Changed"]=null}for(let e=0;e<a.length;e++){this["_On"+a[e][0]]=null}}Dispose(){super.Dispose();for(let e=0;e<i.length;e++){const t=this["_On"+i[e].name+"Changed"];t&&t.Dispose()}for(let e=0;e<a.length;e++){const t=this["_On"+a[e][0]];t&&t.Dispose()}}};for(let e=0;e<s.length;e++)B(u,s[e]);for(let e=0;e<i.length;e++)V(u,i[e]);for(let e=0;e<a.length;e++)j(u,a[e]);return u}const H=a({isConstantLength:!0,encodedLength:function(e){return 1},encodeTo:function(e,t,n){return e.setUint8(t,n?1:0),t+1},decode:function(e,t){return 0!==e.getUint8(t)}}),W=a({isConstantLength:!1,encodedLength:function(e){if("string"!=typeof e)throw new TypeError("Expected string.");const t=e.length;if(t>65535)throw new Error("Array too long for String16 OCP.1 encoding.");return 2+2*t},encodeTo:function(e,t,n){const r=n.length;e.setUint16(t,r,!1),t+=2;for(let o=0;o<r;o++,t+=2)e.setUint16(t,n.charCodeAt(o),!1);return t},decodeFrom:function(e,t){const n=e.getUint16(t,!1);t+=2;const r=new Array(n);for(let o=0;o<n;o++,t+=2)r[o]=e.getUint16(t,!1);return[t,String.fromCharCode.apply(String,r)]},decodeLength:function(e,t){return t+2+2*e.getUint16(t)}});class K{constructor(e,t){this.ClassID=e,this.ClassVersion=t}}const X=c({ClassID:W,ClassVersion:l},K),Y=a({isConstantLength:!0,encodedLength:function(e){return 1},encodeTo:function(e,t,n){return e.setUint8(t,0|n),t+1},decode:function(e,t){return e.getUint8(t)}});function Q(e,t){const n=t.encodeTo,r=t.decode,o=a({isConstantLength:!0,encodedLength:t.encodedLength,encodeTo:function(t,r,o){if("object"==typeof o&&o instanceof e)o=o.value;else if("string"==typeof o)o=e.getValue(o);else{if("number"!=typeof o)throw new TypeError("Unsupported type.");e.getName(o)}return n(t,r,o)},decode:function(t,n){const o=r(t,n);return new e(o)}});for(const t in e.values())Object.defineProperty(o,t,{get:function(){return e[t]},enumerable:!1,configurable:!0});return o}function J(e){return Q(e,Y)}const Z=J(x),$=c({DefLevel:l,PropertyIndex:l},N),ee=new TextEncoder,te=new TextDecoder;function ne(e){return ee.encode(e)}function re(e,t,n){const r=t;for(;n--;){const n=e.getUint8(t);if(t++,!(n<=127)){if(n<194)throw new Error("Invalid UTF8 sequence.");if(t++,!(n<=223||(t++,n<=239||(t++,n<=244))))throw new Error("Invalid UTF8 sequence.")}}return t-r}const oe=a({isConstantLength:!1,encodedLength:function(e){if("string"!=typeof e)throw new TypeError("Expected string.");return 2+ne(e).byteLength},encodeTo:function(e,t,n){const r=function(e){let t=0;for(let n=0;n<e.length;n++,t++){const t=e.charCodeAt(n);if(t>=55296&&t<=56319){n++;const t=e.charCodeAt(n);if(t<56320||t>57343)throw new TypeError("Expected valid unicode string.")}}return t}(n);if(r>65535)throw new Error("String too long for OcaString OCP.1 encoding.");e.setUint16(t,r),t+=2;const o=new Uint8Array(ne(n));return new Uint8Array(e.buffer,e.byteOffset).set(o,t),t+o.length},decodeFrom:function(e,t){const n=e.getUint16(t),r=re(e,t+=2,n),o=new Uint8Array(e.buffer,e.byteOffset+t,r);return[t+r,(s=o,te.decode(s))];var s},decodeLength:function(e,t){const n=e.getUint16(t);return(t+=2)+re(e,t,n)}});const se=q("OcaRoot",1,"",2,class{constructor(e,t){this.ono=e,this.device=t}get ObjectNumber(){return this.ono}get ClassVersion(){return this.constructor.ClassVersion}get ClassID(){return this.constructor.ClassID}get ClassName(){return this.constructor.ClassName}sendCommandRrq(e,t,n,r,o){const s=new i(this.ono,e,t,n,r);return this.device.send_command(s,o)}GetPropertyName(e){return this.get_properties().find_name(e)}GetPropertyID(e){const t=this.get_properties().find_property(e);if(t)return t.GetPropertyID()}static get_properties(){return null}get_properties(){return this.constructor.get_properties()}get __oca_properties__(){return this.get_properties()}GetPropertySync(){return new(this.constructor.GetPropertySync())(this)}Dispose(){}},[["GetClassIdentification",1,1,[],[X]],["GetLockable",1,2,[],[H]],["LockTotal",1,3,[],[]],["Unlock",1,4,[],[]],["GetRole",1,5,[],[oe]],["LockReadonly",1,6,[],[]]],[["ClassID",[W],1,1,!0,!0,null],["ClassVersion",[l],1,2,!0,!0,null],["ObjectNumber",[d],1,3,!0,!1,null],["Lockable",[H],1,4,!0,!1,null],["Role",[oe],1,5,!0,!1,null]],[["PropertyChanged",1,1,[$,(ie=1,a({isConstantLength:!1,encodedLength:function(e){if(!("object"==typeof e&&e instanceof DataView))throw new TypeError("Expected DataView.");return e.byteLength-ie},encodeTo:function(e,t,n){const r=n.byteLength,o=new Uint8Array(n.buffer,n.byteOffset,r);return new Uint8Array(e.buffer,e.byteOffset+t).set(o),t+r},decodeFrom:function(e,t){const n=e.byteLength-t-ie;return[t+n,new DataView(e.buffer,e.byteOffset+t,n)]},decodeLength:function(e,t){return t+(e.byteLength-t-ie)}})),Z]]]);var ie;const ae=q("OcaManager",2,"",2,se,[],[],[]),ce=a({isConstantLength:!1,encodedLength:function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),!(Array.isArray(e)||e instanceof Uint8Array))throw new TypeError("Expected Array or Uint8Array");const t=e.length;if(t>65535)throw new Error("Array too long for OcaBlob OCP.1 encoding.");return 2+t},encodeTo:function(e,t,n){n instanceof ArrayBuffer&&(n=new Uint8Array(n));const r=n.length;e.setUint16(t,r),t+=2;return new Uint8Array(e.buffer,e.byteOffset).set(n,t),t+r},decodeFrom:function(e,t){const n=e.getUint16(t);return[(t+=2)+n,new Uint8Array(e.buffer,e.byteOffset+t,n)]},decodeLength:function(e,t){return t+2+e.getUint16(t)}});function le(e){return a({isConstantLength:!0,encodedLength:function(t){return e},encodeTo:function(t,n,r){if(!(Array.isArray(r)||r instanceof Uint8Array))throw new TypeError("Expected Array or Uint8Array");if(r.length!==e)throw new Error("Length mismatch.");return new Uint8Array(t.buffer,t.byteOffset).set(r,n),n+e},decode:function(t,n){return new Uint8Array(t.buffer,t.byteOffset+n,e)}})}const ue=l,he=ue;function de(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ge(e){return e.isConstantLength?function(e){const t=e.encodedLength(void 0),n=e.encodeTo,r=e.decode;return a({isConstantLength:!1,encodedLength:function(e){if(!Array.isArray(e)&&!de(e))throw new TypeError("Expected array.");const n=e.length;if(n>65535)throw new Error("Array too long for OcaList OCP.1 encoding");return 2+n*t},encodeTo:function(e,t,r){const o=r.length;e.setUint16(t,o),t+=2;for(let s=0;s<o;s++)t=n(e,t,r[s]);return t},decodeFrom:function(e,n){const o=e.getUint16(n);n+=2;const s=new Array(o);for(let i=0;i<o;i++)s[i]=r(e,n),n+=t;return[n,s]},decodeLength:function(e,n){return n+(2+e.getUint16(n)*t)}})}(e):function(e){const t=e.encodedLength,n=e.encodeTo,r=e.decodeFrom,o=e.decodeLength;return a({isConstantLength:!1,encodedLength:function(e){if(!Array.isArray(e)&&!de(e))throw new TypeError("Expected array.");const n=e.length;if(n>65535)throw new Error("Array too long for OcaList OCP.1 encoding");let r=2;for(let o=0;o<n;o++)r+=t(e[o]);return r},encodeTo:function(e,t,r){const o=r.length;e.setUint16(t,o),t+=2;for(let s=0;s<o;s++)t=n(e,t,r[s]);return t},decodeFrom:function(e,t){const n=e.getUint16(t);t+=2;const o=new Array(n);for(let s=0;s<n;s++){let n;[t,n]=r(e,t),o[s]=n}return[t,o]},decodeLength:function(e,t){const n=e.getUint16(t);t+=2;for(let r=0;r<n;r++)t=o(e,t);return t}})}(e)}class Se{constructor(e,t,n,r){this.ObjectNumber=e,this.Name=t,this.ClassID=n,this.ClassVersion=r}}const fe=c({ObjectNumber:d,Name:oe,ClassID:W,ClassVersion:l},Se);class pe{constructor(e,t,n){this.Manufacturer=e,this.Name=t,this.Version=n}}const me=c({Manufacturer:oe,Name:oe,Version:oe},pe);class Oe{constructor(e,t,n){this.Reserved=e,this.MfrCode=t,this.ModelCode=n}}const ye=c({Reserved:le(1),MfrCode:le(3),ModelCode:le(4)},Oe);class be extends(G({PowerOn:0,InternalError:1,Upgrade:2,ExternalRequest:3})){}const Ce=J(be),we=q("OcaDeviceManager",3,"",2,ae,[["GetOcaVersion",3,1,[],[l]],["GetModelGUID",3,2,[],[ye]],["GetSerialNumber",3,3,[],[oe]],["GetDeviceName",3,4,[],[oe]],["SetDeviceName",3,5,[oe],[]],["GetModelDescription",3,6,[],[me]],["GetDeviceRole",3,7,[],[oe]],["SetDeviceRole",3,8,[oe],[]],["GetUserInventoryCode",3,9,[],[oe]],["SetUserInventoryCode",3,10,[oe],[]],["GetEnabled",3,11,[],[H]],["SetEnabled",3,12,[H],[]],["GetState",3,13,[],[he]],["SetResetKey",3,14,[le(16),ce],[]],["GetResetCause",3,15,[],[Ce]],["ClearResetCause",3,16,[],[]],["GetMessage",3,17,[],[oe]],["SetMessage",3,18,[oe],[]],["GetManagers",3,19,[],[ge(fe)]],["GetDeviceRevisionID",3,20,[],[oe]]],[["ModelGUID",[ye],3,1,!1,!1,null],["SerialNumber",[oe],3,2,!1,!1,null],["ModelDescription",[me],3,3,!1,!1,null],["DeviceName",[oe],3,4,!1,!1,null],["OcaVersion",[l],3,5,!1,!1,null],["DeviceRole",[oe],3,6,!1,!1,null],["UserInventoryCode",[oe],3,7,!1,!1,null],["Enabled",[H],3,8,!1,!1,null],["State",[he],3,9,!1,!1,null],["Busy",[H],3,10,!1,!1,null],["ResetCause",[Ce],3,11,!1,!1,null],["Message",[oe],3,12,!1,!1,null],["Managers",[ge(fe)],3,13,!1,!1,null],["DeviceRevisionID",[oe],3,14,!0,!1,null]],[]),Pe=q("OcaSecurityManager",3,"",2,ae,[["AddPreSharedKey",3,4,[oe,ce],[]],["ChangePreSharedKey",3,3,[oe,ce],[]],["DeletePreSharedKey",3,5,[oe],[]],["DisableControlSecurity",3,2,[],[]],["EnableControlSecurity",3,1,[],[]]],[["secureControlData",[H],3,1,!1,!1,null]],[]);class Ge extends(G({BootLoader:0})){}const ve=Q(Ge,l);class De{constructor(e,t,n,r){this.Major=e,this.Minor=t,this.Build=n,this.Component=r}}const _e=c({Major:d,Minor:d,Build:d,Component:ve},De),Te=q("OcaFirmwareManager",3,"",2,ae,[["GetComponentVersions",3,1,[],[ge(_e)]],["StartUpdateProcess",3,2,[],[]],["BeginActiveImageUpdate",3,3,[ve],[]],["AddImageData",3,4,[d,ce],[]],["VerifyImage",3,5,[ce],[]],["EndActiveImageUpdate",3,6,[],[]],["BeginPassiveComponentUpdate",3,7,[ve,ce,oe],[]],["EndUpdateProcess",3,8,[],[]]],[["ComponentVersions",[ge(_e)],3,1,!1,!1,null]],[]);class Ie{constructor(e,t){this.DefLevel=e,this.MethodIndex=t}}const Me=c({DefLevel:l,MethodIndex:l},Ie);class Ae{constructor(e,t){this.ONo=e,this.MethodID=t}}const Le=c({ONo:d,MethodID:Me},Ae);class Ee extends(G({Reliable:1,Fast:2})){}const ke=J(Ee);class xe extends(G({Normal:1,EventsDisabled:2})){}const Ue=J(xe),Ne=q("OcaSubscriptionManager",3,"",2,ae,[["RemoveSubscription",3,2,[S,Le],[]],["AddSubscription",3,1,[S,Le,ce,ke,ce],[]],["DisableNotifications",3,3,[],[]],["ReEnableNotifications",3,4,[],[]],["AddPropertyChangeSubscription",3,5,[d,$,Le,ce,ke,ce],[]],["RemovePropertyChangeSubscription",3,6,[d,$,Le],[]],["GetMaximumSubscriberContextLength",3,7,[],[l]]],[["State",[Ue],3,1,!1,!1,null]],[["NotificationsDisabled",3,1,[]],["SynchronizeState",3,2,[ge(d)]]]);class Re extends(G({None:0,Working:1,Standby:2,Off:3})){}const Fe=J(Re),Be=q("OcaPowerManager",3,"",2,ae,[["GetState",3,1,[],[Fe]],["SetState",3,2,[Fe],[]],["GetPowerSupplies",3,3,[],[ge(d)]],["GetActivePowerSupplies",3,4,[],[ge(d)]],["ExchangePowerSupply",3,5,[d,d,H],[]],["GetAutoState",3,6,[],[H]]],[["State",[Fe],3,1,!1,!1,null],["PowerSupplies",[ge(d)],3,2,!1,!1,null],["ActivePowerSupplies",[ge(d)],3,3,!1,!1,null],["AutoState",[H],3,4,!1,!1,null],["TargetState",[Fe],3,5,!0,!1,null]],[]),je=q("OcaNetworkManager",3,"",2,ae,[["GetNetworks",3,1,[],[ge(d)]],["GetStreamNetworks",3,2,[],[ge(d)]],["GetControlNetworks",3,3,[],[ge(d)]],["GetMediaTransportNetworks",3,4,[],[ge(d)]]],[["Networks",[ge(d)],3,1,!1,!1,null],["StreamNetworks",[ge(d)],3,2,!1,!1,null],["ControlNetworks",[ge(d)],3,3,!1,!1,null],["MediaTransportNetworks",[ge(d)],3,4,!1,!1,null]],[]);class Ve extends(G({None:0,Internal:1,Network:2,External:3})){}const ze=J(Ve),qe=q("OcaMediaClockManager",3,"",2,ae,[["GetClocks",3,1,[],[ge(d)]],["GetMediaClockTypesSupported",3,2,[],[ge(ze)]],["GetClock3s",3,3,[],[ge(d)]]],[["ClockSourceTypesSupported",[ge(ze)],3,1,!1,!1,["MediaClockTypesSupported"]],["Clocks",[ge(d)],3,2,!1,!1,null],["Clock3s",[ge(d)],3,3,!1,!1,null]],[]);class He{constructor(e,t){this.Library=e,this.ID=t}}const We=c({Library:d,ID:d},He);class Ke{constructor(e,t){this.Authority=e,this.ID=t}}const Xe=c({Authority:le(3),ID:d},Ke);class Ye{constructor(e,t){this.Type=e,this.ONo=t}}const Qe=c({Type:Xe,ONo:d},Ye),Je=q("OcaLibraryManager",3,"\b",2,ae,[["AddLibrary",3,1,[Xe],[Qe]],["DeleteLibrary",3,2,[d],[]],["GetLibraryCount",3,3,[Xe],[l]],["GetLibraryList",3,4,[Xe],[ge(Qe)]],["GetCurrentPatch",3,5,[],[We]],["ApplyPatch",3,6,[We],[]]],[["Libraries",[ge(Qe)],3,1,!1,!1,null],["CurrentPatch",[We],3,2,!1,!1,null]],[]),Ze=q("OcaAudioProcessingManager",3,"\t",2,ae,[],[],[]),$e="undefined"!=typeof BigInt,et=$e&&(BigInt(1)<<BigInt(64))-BigInt(1),tt=$e&&et>>BigInt(1),nt=$e&&-tt-BigInt(1),rt=$e&&(BigInt(1)<<BigInt(55))-BigInt(1);$e&&BigInt(1);function ot(){if(!$e)throw new Error("Missing BigInt support")}const st=a({isConstantLength:!0,encodedLength:function(e){return 8},encodeTo:function(e,t,n){if(ot(),!(n<=et&&n>=0))throw new TypeError("Uint64 out of range.");return e.setBigUint64(t,BigInt(n),!1),t+8},decode:function(e,t){ot();const n=e.getBigUint64(t,!1);return n<=Number.MAX_SAFE_INTEGER?Number(n):n}});class it{constructor(e,t,n){this.Negative=e,this.Seconds=t,this.Nanoseconds=n}}const at=c({Negative:H,Seconds:st,Nanoseconds:d},it),ct=q("OcaDeviceTimeManager",3,"\n",2,ae,[["GetDeviceTimeNTP",3,1,[],[st]],["SetDeviceTimeNTP",3,2,[st],[]],["GetTimeSources",3,3,[],[ge(d)]],["GetCurrentDeviceTimeSource",3,4,[],[d]],["SetCurrentDeviceTimeSource",3,5,[d],[]],["GetDeviceTimePTP",3,6,[],[at]],["SetDeviceTimePTP",3,7,[at],[]]],[["TimeSources",[ge(d)],3,1,!1,!1,null],["CurrentDeviceTimeSource",[d],3,2,!1,!1,null]],[]);function lt(e,t){const n=e.encodedLength,r=e.encodeTo,o=e.decodeFrom,s=e.decodeLength,i=t.encodedLength,c=t.encodeTo,l=t.decodeFrom,u=t.decodeLength;return a({isConstantLength:!1,encodedLength:function(e){if(!(e instanceof Map||e instanceof WeakMap))throw new TypeError("Expected Map or WeakMap");let t=2;return e.forEach((e,r)=>{t+=n(r),t+=i(e)}),t},encodeTo:function(e,t,n){return e.setUint16(t,n.size),t+=2,n.forEach((n,o)=>{t=r(e,t,o),t=c(e,t,n)}),t},decodeFrom:function(e,t){const n=new Map,r=e.getUint16(t);t+=2;for(let s=0;s<r;s++){let r,s;[t,r]=o(e,t),[t,s]=l(e,t),n.set(r,s)}if(n.size!==r)throw new Error("Key appeared twice in decoded Map.");return[t,n]},decodeLength:function(e,t){const n=e.getUint16(t);t+=2;for(let r=0;r<n;r++)t=s(e,t),t=u(e,t);return t}})}class ut extends(G({Absolute:1,Relative:2})){}const ht=J(ut);class dt{constructor(e,t,n,r,o,s,i,a,c){this.ID=e,this.Label=t,this.ProgramID=n,this.GroupID=r,this.TimeMode=o,this.TimeSourceONo=s,this.StartTime=i,this.Duration=a,this.ApplicationSpecificParameters=c}}const gt=c({ID:d,Label:oe,ProgramID:We,GroupID:l,TimeMode:ht,TimeSourceONo:d,StartTime:at,Duration:at,ApplicationSpecificParameters:ce},dt);class St extends(G({None:0,Prepare:1,Enable:2,Start:3,Stop:4,Abort:5,Disable:6,Clear:7})){}const ft=J(St);class pt extends(G({None:0,Enabled:1,Disabled:2})){}const mt=J(pt);class Ot extends(G({None:0,NotPrepared:1,Disabled:2,Enabled:3,Running:4,Completed:5,Failed:6,Stopped:7,Aborted:8})){}const yt=J(Ot);class bt{constructor(e,t,n){this.ID=e,this.State=t,this.ErrorCode=n}}const Ct=c({ID:d,State:yt,ErrorCode:l},bt),wt=q("OcaTaskManager",3,"\v",1,ae,[["Enable",3,1,[H],[]],["ControlAllTasks",3,2,[ft,ce],[]],["ControlTaskGroup",3,3,[l,ft,ce],[]],["ControlTask",3,4,[d,ft,ce],[]],["GetState",3,5,[],[mt]],["GetTaskStatuses",3,6,[],[Ct]],["GetTaskStatus",3,7,[d],[Ct]],["AddTask",3,8,[gt],[gt]],["GetTasks",3,9,[],[lt(d,gt)]],["GetTask",3,10,[d],[gt]],["SetTask",3,11,[d,gt],[]],["DeleteTask",3,12,[d],[]]],[["State",[mt],3,1,!1,!1,null],["Tasks",[lt(d,gt)],3,2,!1,!1,null]],[["TaskStateChanged",3,1,[d,We,Ct]]]),Pt=q("OcaCodingManager",3,"\f",1,ae,[["GetAvailableEncodingSchemes",3,1,[],[lt(l,oe)]],["GetAvailableDecodingSchemes",3,2,[],[lt(l,oe)]]],[["AvailableEncodingSchemes",[lt(l,oe)],3,1,!1,!1,null],["AvailableDecodingSchemes",[lt(l,oe)],3,2,!1,!1,null]],[]),Gt=q("OcaDiagnosticManager",3,"\r",1,ae,[["GetLockStatus",3,1,[d],[oe]]],[],[]),vt=a({isConstantLength:!0,encodedLength:function(e){return 4},encodeTo:function(e,t,n){return e.setFloat32(t,+n,!1),t+4},decode:function(e,t){return e.getFloat32(t,!1)}});class Dt extends(G({Input:1,Output:2})){}const _t=J(Dt);class Tt{constructor(e,t){this.Mode=e,this.Index=t}}const It=c({Mode:_t,Index:l},Tt);class Mt{constructor(e,t,n){this.Owner=e,this.ID=t,this.Name=n}}const At=c({Owner:d,ID:It,Name:oe},Mt),Lt=q("OcaWorker",2,"",2,se,[["GetEnabled",2,1,[],[H]],["SetEnabled",2,2,[H],[]],["AddPort",2,3,[oe,_t],[It]],["DeletePort",2,4,[It],[]],["GetPorts",2,5,[],[ge(At)]],["GetPortName",2,6,[It],[oe]],["SetPortName",2,7,[It,oe],[]],["GetLabel",2,8,[],[oe]],["SetLabel",2,9,[oe],[]],["GetOwner",2,10,[],[d]],["GetLatency",2,11,[],[vt]],["SetLatency",2,12,[vt],[]],["GetPath",2,13,[],[ge(oe),ge(d)]]],[["Enabled",[H],2,1,!1,!1,null],["Ports",[ge(At)],2,2,!1,!1,null],["Label",[oe],2,3,!1,!1,null],["Owner",[d],2,4,!1,!1,null],["Latency",[vt],2,5,!1,!1,null]],[]);class Et{constructor(e,t){this.ONo=e,this.ClassIdentification=t}}const kt=c({ONo:d,ClassIdentification:X},Et);class xt{constructor(e,t){this.MemberObjectIdentification=e,this.ContainerObjectNumber=t}}const Ut=c({MemberObjectIdentification:kt,ContainerObjectNumber:d},xt);class Nt{constructor(e,t){this.Authority=e,this.ID=t}}const Rt=c({Authority:le(3),ID:d},Nt);class Ft{constructor(e,t){this.TargetBlockType=e,this.ParData=t}}const Bt=c({TargetBlockType:d,ParData:ce},Ft);class jt{constructor(e,t,n,r,o){this.ONo=e,this.ClassIdentification=t,this.ContainerPath=n,this.Role=r,this.Label=o}}const Vt=c({ONo:d,ClassIdentification:X,ContainerPath:ge(d),Role:oe,Label:oe},jt),zt=ue;class qt{constructor(e,t){this.SourcePort=e,this.SinkPort=t}}const Ht=c({SourcePort:At,SinkPort:At},qt);class Wt extends(G({Exact:0,Substring:1,Contains:2,ExactCaseInsensitive:3,SubstringCaseInsensitive:4,ContainsCaseInsensitive:5})){}const Kt=J(Wt),Xt=q("OcaBlock",3,"",2,Lt,[["GetType",3,1,[],[d]],,["ConstructMemberUsingFactory",3,3,[d],[d]],["DeleteMember",3,4,[d],[]],["GetMembers",3,5,[],[ge(kt)]],["GetMembersRecursive",3,6,[],[ge(Ut)]],["AddSignalPath",3,7,[Ht],[l]],["DeleteSignalPath",3,8,[l],[]],["GetSignalPaths",3,9,[],[lt(l,Ht)]],["GetSignalPathsRecursive",3,10,[],[lt(l,Ht)]],["GetMostRecentParamSetIdentifier",3,11,[],[We]],["ApplyParamSet",3,12,[],[We]],["GetCurrentParamSetData",3,13,[],[Bt]],["StoreCurrentParamSetData",3,14,[We],[]],["GetGlobalType",3,15,[],[Rt]],["GetONoMap",3,16,[],[lt(d,d)]],["FindObjectsByRole",3,17,[oe,Kt,W,zt],[ge(Vt)]],["FindObjectsByRoleRecursive",3,18,[oe,Kt,W,zt],[ge(Vt)]],["FindObjectsByPath",3,20,[ge(oe),zt],[ge(Vt)]],["FindObjectsByLabelRecursive",3,19,[oe,Kt,W,zt],[ge(Vt)]]],[["Type",[d],3,1,!0,!1,null],["Members",[ge(kt)],3,2,!1,!1,null],["SignalPaths",[lt(l,Ht)],3,3,!1,!1,null],["MostRecentParamSetIdentifier",[We],3,4,!1,!1,null],["GlobalType",[Rt],3,5,!0,!1,null],["ONoMap",[lt(d,d)],3,6,!0,!1,null]],[]),Yt=q("OcaActuator",3,"",2,Lt,[],[],[]);class Qt extends(G({Muted:1,Unmuted:2})){}const Jt=J(Qt),Zt=q("OcaMute",4,"",2,Yt,[["GetState",4,1,[],[Jt]],["SetState",4,2,[Jt],[]]],[["State",[Jt],4,1,!1,!1,null]],[]);class $t extends(G({NonInverted:1,Inverted:2})){}const en=J($t),tn=q("OcaPolarity",4,"",2,Yt,[["GetState",4,1,[],[en]],["SetState",4,2,[en],[]]],[["State",[en],4,1,!1,!1,null]],[]),nn=q("OcaSwitch",4,"",2,Yt,[["GetPosition",4,1,[],[l,l,l]],["SetPosition",4,2,[l],[]],["GetPositionName",4,3,[l],[oe]],["SetPositionName",4,4,[l,oe],[]],["GetPositionNames",4,5,[],[ge(oe)]],["SetPositionNames",4,6,[ge(oe)],[]],["GetPositionEnabled",4,7,[l],[H]],["SetPositionEnabled",4,8,[l,H],[]],["GetPositionEnableds",4,9,[],[ge(H)]],["SetPositionEnableds",4,10,[ge(H)],[]]],[["Position",[l],4,1,!1,!1,null],["PositionNames",[ge(oe)],4,2,!1,!1,null],["PositionEnableds",[ge(H)],4,3,!1,!1,null]],[]),rn=q("OcaGain",4,"",2,Yt,[["GetGain",4,1,[],[vt,vt,vt]],["SetGain",4,2,[vt],[]]],[["Gain",[vt],4,1,!1,!1,null]],[]),on=q("OcaPanBalance",4,"",2,Yt,[["GetPosition",4,1,[],[vt,vt,vt]],["SetPosition",4,2,[vt],[]],["GetMidpointGain",4,3,[],[vt,vt,vt]],["SetMidpointGain",4,4,[vt],[]]],[["Position",[vt],4,1,!1,!1,null],["MidpointGain",[vt],4,2,!1,!1,null]],[]),sn=q("OcaDelay",4,"",2,Yt,[["GetDelayTime",4,1,[],[vt,vt,vt]],["SetDelayTime",4,2,[vt],[]]],[["DelayTime",[vt],4,1,!1,!1,null]],[]);class an extends(G({Time:1,Distance:2,Samples:3,Microseconds:4,Milliseconds:5,Centimeters:6,Inches:7,Feet:8})){}const cn=J(an);class ln{constructor(e,t){this.DelayValue=e,this.DelayUnit=t}}const un=c({DelayValue:vt,DelayUnit:cn},ln),hn=q("OcaDelayExtended",5,"",2,sn,[["GetDelayValue",5,1,[],[un,un,un]],["SetDelayValue",5,2,[un],[]],["GetDelayValueConverted",5,3,[cn],[un]]],[["DelayValue",[un],5,1,!1,!1,null]],[]),dn=q("OcaFrequencyActuator",4,"\b",2,Yt,[["GetFrequency",4,1,[],[vt,vt,vt]],["SetFrequency",4,2,[vt],[]]],[["Frequency",[vt],4,1,!1,!1,null]],[]),gn=l;class Sn extends(G({Butterworth:1,Bessel:2,Chebyshev:3,LinkwitzRiley:4})){}const fn=J(Sn);class pn extends(G({HiPass:1,LowPass:2,BandPass:3,BandReject:4,AllPass:5})){}const mn=J(pn),On=q("OcaFilterClassical",4,"\t",2,Yt,[["GetFrequency",4,1,[],[vt,vt,vt]],["SetFrequency",4,2,[vt],[]],["GetPassband",4,3,[],[mn]],["SetPassband",4,4,[mn],[]],["GetShape",4,5,[],[fn]],["SetShape",4,6,[fn],[]],["GetOrder",4,7,[],[l,l,l]],["SetOrder",4,8,[l],[]],["GetParameter",4,9,[],[vt,vt,vt]],["SetParameter",4,10,[vt],[]],["SetMultiple",4,11,[gn,vt,mn,fn,l,vt],[]]],[["Frequency",[vt],4,1,!1,!1,null],["Passband",[mn],4,2,!1,!1,null],["Shape",[fn],4,3,!1,!1,null],["Order",[l],4,4,!1,!1,null],["Parameter",[vt],4,5,!1,!1,null]],[]);class yn extends(G({None:0,PEQ:1,LowShelv:2,HighShelv:3,LowPass:4,HighPass:5,BandPass:6,AllPass:7,Notch:8,ToneControlLowFixed:9,ToneControlLowSliding:10,ToneControlHighFixed:11,ToneControlHighSliding:12})){}const bn=J(yn),Cn=q("OcaFilterParametric",4,"\n",2,Yt,[["GetFrequency",4,1,[],[vt,vt,vt]],["SetFrequency",4,2,[vt],[]],["GetShape",4,3,[],[bn]],["SetShape",4,4,[bn],[]],["GetWidthParameter",4,5,[],[vt,vt,vt]],["SetWidthParameter",4,6,[vt],[]],["GetInbandGain",4,7,[],[vt,vt,vt]],["SetInbandGain",4,8,[vt],[]],["GetShapeParameter",4,9,[],[vt,vt,vt]],["SetShapeParameter",4,10,[vt],[]],["SetMultiple",4,11,[gn,vt,bn,vt,vt,vt],[]]],[["Frequency",[vt],4,1,!1,!1,null],["Shape",[bn],4,2,!1,!1,null],["WidthParameter",[vt],4,3,!1,!1,["Q"]],["InbandGain",[vt],4,4,!1,!1,null],["ShapeParameter",[vt],4,5,!1,!1,null]],[]),wn=q("OcaFilterPolynomial",4,"\v",2,Yt,[["GetCoefficients",4,1,[],[ge(vt),ge(vt)]],["SetCoefficients",4,2,[ge(vt),ge(vt)],[]],["GetSampleRate",4,3,[],[vt,vt,vt]],["SetSampleRate",4,4,[vt],[]],["GetMaxOrder",4,5,[],[Y]]],[["A",[ge(vt)],4,1,!1,!1,null],["B",[ge(vt)],4,2,!1,!1,null],["SampleRate",[vt],4,3,!1,!1,null],["MaxOrder",[Y],4,4,!0,!1,null]],[]),Pn=q("OcaFilterFIR",4,"\f",2,Yt,[["GetLength",4,1,[],[d,d,d]],["GetCoefficients",4,2,[],[ge(vt)]],["SetCoefficients",4,3,[ge(vt)],[]],["GetSampleRate",4,4,[],[vt,vt,vt]],["SetSampleRate",4,5,[vt],[]]],[["Length",[d],4,1,!0,!1,null],["Coefficients",[ge(vt)],4,2,!1,!1,null],["SampleRate",[vt],4,3,!1,!1,null]],[]);class Gn{constructor(e,t,n){this.Frequency=e,this.Amplitude=t,this.Phase=n}}const vn=c({Frequency:ge(vt),Amplitude:ge(vt),Phase:ge(vt)},Gn),Dn=q("OcaFilterArbitraryCurve",4,"\r",2,Yt,[["GetTransferFunction",4,1,[],[vn]],["SetTransferFunction",4,2,[vn],[]],["GetSampleRate",4,3,[],[vt,vt,vt]],["SetSampleRate",4,4,[vt],[]],["GetTFMinLength",4,5,[],[l]],["GetTFMaxLength",4,6,[],[l]]],[["TransferFunction",[vn],4,1,!1,!1,null],["SampleRate",[vt],4,2,!1,!1,null],["TFMinLength",[l],4,3,!1,!1,null],["TFMaxLength",[l],4,4,!1,!1,null]],[]);class _n{constructor(e,t){this.Value=e,this.Ref=t}}const Tn=c({Value:vt,Ref:vt},_n);class In extends(G({None:0,Compress:1,Limit:2,Expand:3,Gate:4})){}const Mn=J(In);class An extends(G({None:0,RMS:1,Peak:2})){}const Ln=J(An);class En extends(G({dBu:0,dBV:1,V:2})){}const kn=J(En),xn=q("OcaDynamics",4,"",2,Yt,[["GetTriggered",4,1,[],[H]],["GetDynamicGain",4,2,[],[vt]],["GetFunction",4,3,[],[Mn]],["SetFunction",4,4,[Mn],[]],["GetRatio",4,5,[],[vt,vt,vt]],["SetRatio",4,6,[vt],[]],["GetThreshold",4,7,[],[Tn,vt,vt]],["SetThreshold",4,8,[Tn],[]],["GetThresholdPresentationUnits",4,9,[],[kn]],["SetThresholdPresentationUnits",4,10,[kn],[]],["GetDetectorLaw",4,11,[],[Ln]],["SetDetectorLaw",4,12,[Ln],[]],["GetAttackTime",4,13,[],[vt,vt,vt]],["SetAttackTime",4,14,[vt],[]],["GetReleaseTime",4,15,[],[vt,vt,vt]],["SetReleaseTime",4,16,[vt],[]],["GetHoldTime",4,17,[],[vt,vt,vt]],["SetHoldTime",4,18,[vt],[]],["GetDynamicGainFloor",4,19,[],[vt,vt,vt]],["SetDynamicGainFloor",4,20,[vt],[]],["GetDynamicGainCeiling",4,21,[],[vt,vt,vt]],["SetDynamicGainCeiling",4,22,[vt],[]],["GetKneeParameter",4,23,[],[vt,vt,vt]],["SetKneeParameter",4,24,[vt],[]],["GetSlope",4,25,[],[vt,vt,vt]],["SetSlope",4,26,[vt],[]],["SetMultiple",4,27,[gn,Mn,Tn,kn,Ln,vt,vt,vt,vt,vt,vt,vt],[]]],[["Triggered",[H],4,1,!1,!1,null],["DynamicGain",[vt],4,2,!1,!1,null],["Function",[Mn],4,3,!1,!1,null],["Ratio",[vt],4,4,!1,!1,null],["Threshold",[Tn],4,5,!1,!1,null],["ThresholdPresentationUnits",[kn],4,6,!1,!1,null],["DetectorLaw",[Ln],4,7,!1,!1,null],["AttackTime",[vt],4,8,!1,!1,null],["ReleaseTime",[vt],4,9,!1,!1,null],["HoldTime",[vt],4,10,!1,!1,null],["DynamicGainCeiling",[vt],4,11,!1,!1,null],["DynamicGainFloor",[vt],4,12,!1,!1,null],["KneeParameter",[vt],4,13,!1,!1,null],["Slope",[vt],4,14,!1,!1,null]],[]),Un=q("OcaDynamicsDetector",4,"",2,Yt,[["GetLaw",4,1,[],[Ln]],["SetLaw",4,2,[Ln],[]],["GetAttackTime",4,3,[],[vt,vt,vt]],["SetAttackTime",4,4,[vt],[]],["GetReleaseTime",4,5,[],[vt,vt,vt]],["SetReleaseTime",4,6,[vt],[]],["GetHoldTime",4,7,[],[vt,vt,vt]],["SetHoldTime",4,8,[vt],[]],["SetMultiple",4,9,[gn,Ln,vt,vt,vt],[]]],[["Law",[Ln],4,1,!1,!1,null],["AttackTime",[vt],4,2,!1,!1,null],["ReleaseTime",[vt],4,3,!1,!1,null],["HoldTime",[vt],4,4,!1,!1,null]],[]),Nn=q("OcaDynamicsCurve",4,"",2,Yt,[["GetNSegments",4,1,[],[Y,Y,Y]],["SetNSegments",4,2,[Y],[]],["GetThreshold",4,3,[],[ge(Tn),vt,vt]],["SetThreshold",4,4,[ge(Tn)],[]],["GetSlope",4,5,[],[ge(vt),ge(vt),ge(vt)]],["SetSlope",4,6,[ge(vt)],[]],["GetKneeParameter",4,7,[],[ge(vt),ge(vt),ge(vt)]],["SetKneeParameter",4,8,[ge(vt)],[]],["GetDynamicGainCeiling",4,9,[],[vt,vt,vt]],["SetDynamicGainCeiling",4,10,[vt],[]],["GetDynamicGainFloor",4,11,[],[vt,vt,vt]],["SetDynamicGainFloor",4,12,[vt],[]],["SetMultiple",4,13,[gn,Y,ge(Tn),ge(vt),ge(vt),vt,vt],[]]],[["NSegments",[Y],4,1,!1,!1,null],["Threshold",[ge(Tn)],4,2,!1,!1,null],["Slope",[ge(vt)],4,3,!1,!1,null],["KneeParameter",[ge(vt)],4,4,!1,!1,null],["DynamicGainFloor",[vt],4,5,!1,!1,null],["DynamicGainCeiling",[vt],4,6,!1,!1,null]],[]);class Rn extends(G({Linear:1,Logarithmic:2,None:0})){}const Fn=J(Rn);class Bn extends(G({None:0,DC:1,Sine:2,Square:3,Impulse:4,NoisePink:5,NoiseWhite:6,PolarityTest:7})){}const jn=J(Bn),Vn=q("OcaSignalGenerator",4,"",2,Yt,[["GetFrequency1",4,1,[],[vt,vt,vt]],["SetFrequency1",4,2,[vt],[]],["GetFrequency2",4,3,[],[vt,vt,vt]],["SetFrequency2",4,4,[vt],[]],["GetLevel",4,5,[],[vt,vt,vt]],["SetLevel",4,6,[vt],[]],["GetWaveform",4,7,[],[jn]],["SetWaveform",4,8,[jn],[]],["GetSweepType",4,9,[],[Fn]],["SetSweepType",4,10,[Fn],[]],["GetSweepTime",4,11,[],[vt,vt,vt]],["SetSweepTime",4,12,[vt],[]],["GetSweepRepeat",4,13,[],[H]],["SetSweepRepeat",4,14,[H],[]],["GetGenerating",4,15,[],[H]],["Start",4,16,[],[]],["Stop",4,17,[],[]],["SetMultiple",4,18,[gn,vt,vt,vt,jn,Fn,vt,H],[]]],[["Frequency1",[vt],4,1,!1,!1,null],["Frequency2",[vt],4,2,!1,!1,null],["Level",[vt],4,3,!1,!1,null],["Waveform",[jn],4,4,!1,!1,null],["SweepType",[Fn],4,5,!1,!1,null],["SweepTime",[vt],4,6,!1,!1,null],["SweepRepeat",[H],4,7,!1,!1,null],["Generating",[H],4,8,!1,!1,null]],[]),zn=q("OcaSignalInput",4,"",2,Yt,[],[],[]),qn=q("OcaSignalOutput",4,"",2,Yt,[],[],[]),Hn=q("OcaTemperatureActuator",4,"",2,Yt,[["GetTemperature",4,1,[],[vt,vt,vt]],["SetTemperature",4,2,[vt],[]]],[["Temperature",[vt],4,1,!1,!1,null]],[]),Wn=q("OcaIdentificationActuator",4,"",2,Yt,[["GetActive",4,1,[],[H]],["SetActive",4,2,[H],[]]],[["Active",[H],4,1,!1,!1,null]],[]),Kn=q("OcaSummingPoint",4,"",1,Yt,[],[],[]),Xn=q("OcaBasicActuator",4,"",2,Yt,[],[],[]),Yn=q("OcaBooleanActuator",5,"",2,Xn,[["GetSetting",5,1,[],[H]],["SetSetting",5,2,[H],[]]],[["Setting",[H],5,1,!1,!1,null]],[]),Qn=a({isConstantLength:!0,encodedLength:function(e){return 1},encodeTo:function(e,t,n){return e.setInt8(t,0|n),t+1},decode:function(e,t){return e.getInt8(t)}}),Jn=q("OcaInt8Actuator",5,"",2,Xn,[["GetSetting",5,1,[],[Qn,Qn,Qn]],["SetSetting",5,2,[Qn],[]]],[["Setting",[Qn],5,1,!1,!1,null]],[]),Zn=a({isConstantLength:!0,encodedLength:function(e){return 2},encodeTo:function(e,t,n){return e.setInt16(t,0|n,!1),t+2},decode:function(e,t){return e.getInt16(t,!1)}}),$n=q("OcaInt16Actuator",5,"",2,Xn,[["GetSetting",5,1,[],[Zn,Zn,Zn]],["SetSetting",5,2,[Zn],[]]],[["Setting",[Zn],5,1,!1,!1,null]],[]),er=a({isConstantLength:!0,encodedLength:function(e){return 4},encodeTo:function(e,t,n){return e.setInt32(t,0|n,!1),t+4},decode:function(e,t){return e.getInt32(t,!1)}}),tr=q("OcaInt32Actuator",5,"",2,Xn,[["GetSetting",5,1,[],[er,er,er]],["SetSetting",5,2,[er],[]]],[["Setting",[er],5,1,!1,!1,null]],[]);function nr(){if(!$e)throw new Error("Missing BigInt support")}const rr=a({isConstantLength:!0,encodedLength:function(e){return 8},encodeTo:function(e,t,n){if(nr(),!(n>=nt&&n<=tt))throw new TypeError("Int64 out of range.");return e.setBigInt64(t,BigInt(n),!1),t+8},decode:function(e,t){nr();const n=e.getBigInt64(t,!1);return n>=Number.MIN_SAFE_INTEGER&&n<=Number.MAX_SAFE_INTEGER?Number(n):n}}),or=q("OcaInt64Actuator",5,"",2,Xn,[["GetSetting",5,1,[],[rr,rr,rr]],["SetSetting",5,2,[rr],[]]],[["Setting",[rr],5,1,!1,!1,null]],[]),sr=q("OcaUint8Actuator",5,"",2,Xn,[["GetSetting",5,1,[],[Y,Y,Y]],["SetSetting",5,2,[Y],[]]],[["Setting",[Y],5,1,!1,!1,null]],[]),ir=q("OcaUint16Actuator",5,"",2,Xn,[["GetSetting",5,1,[],[l,l,l]],["SetSetting",5,2,[l],[]]],[["Setting",[l],5,1,!1,!1,null]],[]),ar=q("OcaUint32Actuator",5,"\b",2,Xn,[["GetSetting",5,1,[],[d,d,d]],["SetSetting",5,2,[d],[]]],[["Setting",[d],5,1,!1,!1,null]],[]),cr=q("OcaUint64Actuator",5,"\t",2,Xn,[["GetSetting",5,1,[],[st,st,st]],["SetSetting",5,2,[st],[]]],[["Setting",[st],5,1,!1,!1,null]],[]),lr=q("OcaFloat32Actuator",5,"\n",2,Xn,[["GetSetting",5,1,[],[vt,vt,vt]],["SetSetting",5,2,[vt],[]]],[["Setting",[vt],5,1,!1,!1,null]],[]),ur=a({isConstantLength:!0,encodedLength:function(e){return 8},encodeTo:function(e,t,n){return e.setFloat64(t,+n,!1),t+8},decode:function(e,t){return e.getFloat64(t,!1)}}),hr=q("OcaFloat64Actuator",5,"\v",2,Xn,[["GetSetting",5,1,[],[ur,ur,ur]],["SetSetting",5,2,[ur],[]]],[["Setting",[ur],5,1,!1,!1,null]],[]),dr=q("OcaStringActuator",5,"\f",2,Xn,[["GetSetting",5,1,[],[oe]],["SetSetting",5,2,[oe],[]],["GetMaxLen",5,3,[],[l]]],[["Setting",[oe],5,1,!1,!1,null],["MaxLen",[l],5,2,!0,!1,null]],[]);function gr(e){return e+7>>3}function Sr(e,t,n){const r=new Array(n),o=gr(n),s=new Uint8Array(e.buffer,e.byteOffset+t,o);for(let e=0;e<n;e++)r[e]=!!(s[e>>3]&128>>(7&e));return r}const fr=a({isConstantLength:!1,encodedLength:function(e){if(!Array.isArray(e))throw new TypeError("Expected Array.");const t=e.length;if(t>65535)throw new Error("Array too long for OcaBlob OCP.1 encoding.");return 2+(t+7>>3)},encodeTo:function(e,t,n){const r=n.length;return e.setUint16(t,r),function(e,t,n){const r=n.length,o=gr(r),s=new Uint8Array(e.buffer,e.byteOffset+t,o);for(let e=0,t=0;t<o;t++){let o=0;for(let t=0;t<8&&e<r;t++,e++)n[e]&&(o|=128>>t);s[t]=o}return t+o}(e,t+=2,n)},decodeFrom:function(e,t){const n=e.getUint16(t);return[(t+=2)+gr(n),Sr(e,t,n)]},decodeLength:function(e,t){return t+2+gr(e.getUint16(t))}}),pr=q("OcaBitstringActuator",5,"\r",2,Xn,[["GetNrBits",5,1,[],[l]],["GetBit",5,2,[l],[H]],["SetBit",5,3,[l,H],[]],["GetBitstring",5,4,[],[fr]],["SetBitstring",5,5,[fr],[]]],[["Bitstring",[fr],5,1,!1,!1,null]],[]);class mr extends(G({Unknown:0,Valid:1,Underrange:2,Overrange:3,Error:4})){}const Or=J(mr),yr=q("OcaSensor",3,"",2,Lt,[["GetReadingState",3,1,[],[Or]]],[["ReadingState",[Or],3,1,!1,!0,null]],[]),br=q("OcaLevelSensor",4,"",2,yr,[["GetReading",4,1,[],[vt,vt,vt]]],[["Reading",[vt],4,1,!1,!1,null]],[]);class Cr extends(G({VU:1,StandardVU:2,PPM1:3,PPM2:4,LKFS:5,RMS:6,Peak:7,ProprietaryValueBase:128})){}const wr=J(Cr),Pr=q("OcaAudioLevelSensor",5,"",2,br,[["GetLaw",5,1,[],[wr]],["SetLaw",5,2,[wr],[]]],[["Law",[wr],5,1,!1,!1,null]],[]),Gr=q("OcaTimeIntervalSensor",4,"",2,yr,[["GetReading",4,1,[],[vt,vt,vt]]],[["Reading",[vt],4,1,!1,!1,null]],[]),vr=q("OcaFrequencySensor",4,"",2,yr,[["GetReading",4,1,[],[vt,vt,vt]]],[["Reading",[vt],4,1,!1,!1,null]],[]),Dr=q("OcaTemperatureSensor",4,"",2,yr,[["GetReading",4,1,[],[vt,vt,vt]]],[["Reading",[vt],4,1,!1,!1,null]],[]),_r=q("OcaIdentificationSensor",4,"",2,yr,[],[],[["Identify",4,1,[]]]),Tr=q("OcaVoltageSensor",4,"",1,yr,[["GetReading",4,1,[],[vt,vt,vt]]],[["Reading",[vt],4,1,!1,!1,null]],[]),Ir=q("OcaCurrentSensor",4,"\b",1,yr,[["GetReading",4,1,[],[vt,vt,vt]]],[["Reading",[vt],4,1,!1,!1,null]],[]);class Mr{constructor(e,t){this.Magnitude=e,this.Phase=t}}const Ar=c({Magnitude:vt,Phase:vt},Mr),Lr=q("OcaImpedanceSensor",4,"\t",1,yr,[["GetReading",4,1,[],[Ar,Ar,Ar]]],[["Reading",[Ar],4,1,!1,!1,null]],[]),Er=q("OcaGainSensor",4,"\n",1,yr,[["GetReading",4,1,[],[vt,vt,vt]]],[["Reading",[vt],4,1,!1,!1,null]],[]),kr=q("OcaBasicSensor",4,"",2,yr,[],[],[]),xr=q("OcaBooleanSensor",5,"",2,kr,[["GetReading",5,1,[],[H]]],[["Reading",[H],5,1,!1,!1,null]],[]),Ur=q("OcaInt8Sensor",5,"",2,kr,[["GetReading",5,1,[],[Qn,Qn,Qn]]],[["Reading",[Qn],5,1,!1,!1,null]],[]),Nr=q("OcaInt16Sensor",5,"",2,kr,[["GetReading",5,1,[],[Zn,Zn,Zn]]],[["Reading",[Zn],5,1,!1,!1,null]],[]),Rr=q("OcaInt32Sensor",5,"",2,kr,[["GetReading",5,1,[],[er,er,er]]],[["Reading",[er],5,1,!1,!1,null]],[]),Fr=q("OcaInt64Sensor",5,"",2,kr,[["GetReading",5,1,[],[rr,rr,rr]]],[["Reading",[rr],5,1,!1,!1,null]],[]),Br=q("OcaUint8Sensor",5,"",2,kr,[["GetReading",5,1,[],[Y,Y,Y]]],[["Reading",[Y],5,1,!1,!1,null]],[]),jr=q("OcaUint16Sensor",5,"",2,kr,[["GetReading",5,1,[],[l,l,l]]],[["Reading",[l],5,1,!1,!1,null]],[]),Vr=q("OcaUint32Sensor",5,"\b",2,kr,[["GetReading",5,1,[],[d,d,d]]],[["Reading",[d],5,1,!1,!1,null]],[]),zr=q("OcaFloat32Sensor",5,"\n",2,kr,[["GetReading",5,1,[],[vt,vt,vt]]],[["Reading",[vt],5,1,!1,!1,null]],[]),qr=q("OcaFloat64Sensor",5,"\v",2,kr,[["GetReading",5,1,[],[ur,ur,ur]]],[["Reading",[ur],5,1,!1,!1,null]],[]),Hr=q("OcaStringSensor",5,"\f",2,kr,[["GetString",5,1,[],[oe]],["GetMaxLen",5,2,[],[l]],["SetMaxLen",5,3,[l],[]]],[["String",[oe],5,1,!1,!1,null],["MaxLen",[l],5,2,!1,!1,null]],[]),Wr=q("OcaBitstringSensor",5,"\r",2,kr,[["GetNrBits",5,1,[],[l]],["GetBit",5,2,[l],[Y]],["GetBitString",5,3,[],[fr]]],[["BitString",[fr],5,1,!1,!1,null]],[]),Kr=q("OcaUint64Sensor",5,"\t",2,kr,[["GetReading",5,1,[],[st,st,st]]],[["Reading",[st],5,1,!1,!1,null]],[]);class Xr{constructor(e,t){this.POno=e,this.ClassIdentification=t}}const Yr=c({POno:d,ClassIdentification:X},Xr);class Qr{constructor(e,t){this.Mode=e,this.Index=t}}const Jr=c({Mode:_t,Index:l},Qr);class Zr{constructor(e,t,n){this.Owner=e,this.ProtoID=t,this.Name=n}}const $r=c({Owner:d,ProtoID:Jr,Name:oe},Zr);class eo{constructor(e,t){this.SourceProtoPort=e,this.SinkProtoPort=t}}const to=c({SourceProtoPort:$r,SinkProtoPort:$r},eo),no=q("OcaBlockFactory",3,"",2,Lt,[["DefineProtoPort",3,1,[oe,_t],[Jr]],["UndefineProtoPort",3,2,[Jr],[]],["GetProtoPorts",3,3,[],[ge($r)]],,["DefineProtoMemberUsingFactory",3,5,[d],[d]],["UndefineProtoMember",3,6,[d],[]],["GetProtoMembers",3,7,[],[ge(Yr)]],["DefineProtoSignalPath",3,8,[to],[l]],["UndefineProtoSignalPath",3,9,[],[l]],["GetProtoSignalPaths",3,10,[],[lt(l,to)]],["GetGlobalType",3,11,[],[Rt]],["SetGlobalType",3,12,[Rt],[]]],[["ProtoPorts",[ge($r)],3,1,!1,!1,null],["ProtoMembers",[ge(Yr)],3,2,!1,!1,null],["ProtoSignalPaths",[lt(l,to)],3,3,!1,!1,null],["GlobalType",[Rt],3,4,!1,!1,null]],[]);function ro(e){return e.isConstantLength?function(e){const t=e.encodedLength(void 0),n=e.encodeTo,r=e.decode;return a({isConstantLength:!1,encodedLength:function(e){if(!Array.isArray(e)&&!de(e))throw new TypeError("Expected array.");const n=e.length;if(0===n)return 4;if(!Array.isArray(e[0])&&!de(e[0]))throw new TypeError("Expected array.");const r=e[0].length;if(n>65535||r>65535)throw new Error("Array too long for OcaList2D OCP.1 encoding");return 4+n*r*t},encodeTo:function(e,t,r){const o=r.length,s=0===o?0:r[0].length;e.setUint16(t,o),t+=2,e.setUint16(t,s),t+=2;for(let i=0;i<o;i++){const o=r[i];for(let r=0;r<s;r++)t=n(e,t,o[r])}return t},decodeFrom:function(e,n){const o=e.getUint16(n);n+=2;const s=e.getUint16(n);n+=2;const i=new Array(o).fill().map(()=>new Array(s));for(let a=0;a<o;a++){const o=i[a];for(let i=0;i<s;i++)o[i]=r(e,n),n+=t}return[n,i]},decodeLength:function(e,n){const r=e.getUint16(n);n+=2;const o=e.getUint16(n);return(n+=2)+r*o*t}})}(e):function(e){const t=e.encodedLength,n=e.encodeTo,r=e.decodeFrom,o=e.decodeLength;return a({isConstantLength:!1,encodedLength:function(e){if(!Array.isArray(e)&&!de(e))throw new TypeError("Expected array.");const n=e.length;if(0===n)return 4;if(!Array.isArray(e[0])&&!de(e[0]))throw new TypeError("Expected array.");const r=e[0].length;if(n>65535||r>65535)throw new Error("Array too long for OcaList2D OCP.1 encoding");let o=4;for(let s=0;s<n;s++){const n=e[s];for(let e=0;e<r;e++)o+=t(n[e])}return o},encodeTo:function(e,t,r){const o=r.length,s=0===o?0:r[0].length;e.setUint16(t,o),t+=2,e.setUint16(t,s),t+=2;for(let i=0;i<o;i++){const o=r[i];for(let r=0;r<s;r++)t=n(e,t,o[r])}return t},decodeFrom:function(e,t){const n=e.getUint16(t);t+=2;const o=e.getUint16(t);t+=2;const s=new Array(n).fill().map(()=>new Array(o));for(let i=0;i<n;i++){const n=s[i];for(let s=0;s<o;s++){let o;[t,o]=r(e,t),n[s]=o}}return[t,s]},decodeLength:function(e,t){const n=e.getUint16(t);t+=2;const r=e.getUint16(t);t+=2;for(let s=0;s<n;s++)for(let n=0;n<r;n++)t=o(e,t);return t}})}(e)}const oo=q("OcaMatrix",3,"",2,Lt,[["GetCurrentXY",3,1,[],[l,l]],["SetCurrentXY",3,2,[l,l],[]],["GetSize",3,3,[],[l,l,l,l,l,l]],["SetSize",3,4,[l,l],[]],["GetMembers",3,5,[],[ro(d)]],["SetMembers",3,6,[ro(d)],[]],["GetMember",3,7,[l,l],[d]],["SetMember",3,8,[l,l,d],[]],["GetProxy",3,9,[],[d]],["SetProxy",3,10,[d],[]],["GetPortsPerRow",3,11,[],[Y]],["SetPortsPerRow",3,12,[Y],[]],["GetPortsPerColumn",3,13,[],[Y]],["SetPortsPerColumn",3,14,[Y],[]],["SetCurrentXYLock",3,15,[l,l],[]],["UnlockCurrent",3,16,[],[]]],[["X",[l],3,1,!1,!1,null],["Y",[l],3,2,!1,!1,null],["xSize",[l],3,3,!1,!1,null],["ySize",[l],3,4,!1,!1,null],["Members",[ro(d)],3,5,!1,!1,null],["Proxy",[d],3,6,!1,!1,null],["PortsPerRow",[Y],3,7,!1,!1,null],["PortsPerColumn",[Y],3,8,!1,!1,null]],[]),so=q("OcaAgent",2,"",2,se,[["GetLabel",2,1,[],[oe]],["SetLabel",2,2,[oe],[]],["GetOwner",2,3,[],[d]],["GetPath",2,4,[],[ge(oe),ge(d)]]],[["Label",[oe],2,1,!1,!1,null],["Owner",[d],2,2,!1,!1,null]],[]);class io{constructor(e,t){this.HostID=e,this.ONo=t}}const ao=c({HostID:ce,ONo:d},io);class co{constructor(e,t,n){this.Index=e,this.ObjectPath=t,this.Online=n}}const lo=c({Index:l,ObjectPath:ao,Online:H},co);class uo{constructor(e,t){this.GroupIndex=e,this.CitizenIndex=t}}const ho=c({GroupIndex:l,CitizenIndex:l},uo);class go{constructor(e,t,n){this.Index=e,this.Name=t,this.ProxyONo=n}}const So=c({Index:l,Name:oe,ProxyONo:d},go);class fo extends(G({MasterSlave:1,PeerToPeer:2})){}const po=J(fo);class mo extends(G({citizenAdded:1,citizenDeleted:2,citizenConnectionLost:3,citizenConnectionReEstablished:4,citizenError:5,enrollment:6,unEnrollment:7})){}const Oo=J(mo),yo=q("OcaGrouper",3,"",2,so,[["AddGroup",3,1,[oe],[l,d]],["DeleteGroup",3,2,[l],[]],["GetGroupCount",3,3,[],[l]],["GetGroupList",3,4,[],[ge(So)]],["AddCitizen",3,5,[lo],[l]],["DeleteCitizen",3,6,[l],[]],["GetCitizenCount",3,7,[],[l]],["GetCitizenList",3,8,[],[ge(lo)]],["GetEnrollment",3,9,[ho],[H]],["SetEnrollment",3,10,[ho,H],[]],["GetGroupMemberList",3,11,[l],[ge(lo)]],["GetActuatorOrSensor",3,12,[],[H]],["SetActuatorOrSensor",3,13,[H],[]],["GetMode",3,14,[],[po]],["SetMode",3,15,[po],[]]],[["ActuatorOrSensor",[H],3,1,!1,!1,null],["Groups",[ge(So)],3,2,!1,!1,["GroupList"]],["Citizens",[ge(lo)],3,3,!1,!1,["CitizenList"]],["Enrollments",[ge(ho)],3,4,!1,!1,["EnrollmentList"]],["Mode",[po],3,5,!1,!1,null]],[["StatusChange",3,1,[l,l,Oo]]]);class bo extends(G({None:0,OcaBoolean:1,OcaInt8:2,OcaInt16:3,OcaInt32:4,OcaInt64:5,OcaUint8:6,OcaUint16:7,OcaUint32:8,OcaUint64:9,OcaFloat32:10,OcaFloat64:11,OcaString:12,OcaBitstring:13,OcaBlob:14,OcaBlobFixedLen:15,OcaBit:16})){}const Co=J(bo);class wo{constructor(e,t,n,r){this.PropertyID=e,this.BaseDataType=t,this.GetterMethodID=n,this.SetterMethodID=r}}const Po=c({PropertyID:$,BaseDataType:Co,GetterMethodID:Me,SetterMethodID:Me},wo);class Go{constructor(e,t){this.ONo=e,this.Descriptor=t}}const vo=c({ONo:d,Descriptor:Po},Go);class Do extends(G({Enable:1,Start:2,Halt:3})){}const _o=J(Do);class To extends(G({Linear:1,ReverseLinear:2,Sine:3,Exponential:4})){}const Io=J(To);class Mo extends(G({NotInitialized:1,Iniitialized:2,Scheduled:3,Enabled:4,Ramping:5})){}const Ao=J(Mo),Lo=q("OcaRamper",3,"",2,so,[["Control",3,1,[_o],[]],["GetState",3,2,[],[Ao]],["GetRampedProperty",3,3,[],[vo]],["SetRampedProperty",3,4,[vo],[]],["GetTimeMode",3,5,[],[ht]],["SetTimeMode",3,6,[ht],[]],["GetStartTime",3,7,[],[st]],["SetStartTime",3,8,[st],[]],["GetDuration",3,9,[],[vt,vt,vt]],["SetDuration",3,10,[vt],[]],["GetInterpolationLaw",3,11,[],[Io]],["SetInterpolationLaw",3,12,[Io],[]],["GetGoal",3,13,[],[ur]],["SetGoal",3,14,[ur],[]]],[["State",[Ao],3,1,!1,!1,null],["RampedProperty",[vo],3,2,!1,!1,null],["TimeMode",[ht],3,3,!1,!1,null],["StartTime",[st],3,4,!1,!1,null],["Duration",[vt],3,5,!1,!1,null],["InterpolationLaw",[Io],3,6,!1,!1,null],["Goal",[ur],3,7,!1,!1,null]],[]);class Eo extends(G({NotTriggered:0,Triggered:1})){}const ko=J(Eo);class xo extends(G({None:0,Equality:1,Inequality:2,GreaterThan:3,GreaterThanOrEqual:4,LessThan:5,LessThanOrEqual:6})){}const Uo=J(xo),No=q("OcaNumericObserver",3,"",2,so,[["GetLastObservation",3,1,[],[ur]],["GetState",3,2,[],[ko]],["GetObservedProperty",3,3,[],[vo]],["SetObservedProperty",3,4,[vo],[]],["GetThreshold",3,5,[],[ur]],["SetThreshold",3,6,[ur],[]],["GetOperator",3,7,[],[Uo]],["SetOperator",3,8,[Uo],[]],["GetTwoWay",3,9,[],[H]],["SetTwoWay",3,10,[H],[]],["GetHysteresis",3,11,[],[ur]],["SetHysteresis",3,12,[ur],[]],["GetPeriod",3,13,[],[vt]],["SetPeriod",3,14,[vt],[]]],[["State",[ko],3,1,!1,!1,null],["ObservedProperty",[vo],3,2,!1,!1,null],["Threshold",[ur],3,3,!1,!1,null],["Operator",[Uo],3,4,!1,!1,null],["TwoWay",[H],3,5,!1,!1,null],["Hysteresis",[ur],3,6,!1,!1,null],["Period",[vt],3,7,!1,!1,null]],[["Observation",3,1,[S,ur]]]);class Ro extends(G({None:0,ReadOnly:1,ReadExpand:2,Full:3})){}const Fo=J(Ro);class Bo{constructor(e,t,n,r,o,s){this.Name=e,this.VolType=t,this.Access=n,this.Version=r,this.Creator=o,this.UpDate=s}}const jo=c({Name:oe,VolType:Xe,Access:Fo,Version:d,Creator:oe,UpDate:at},Bo);class Vo{constructor(e,t){this.Metadata=e,this.Data=t}}const zo=c({Metadata:jo,Data:ce},Vo),qo=q("OcaLibrary",3,"",2,so,[["AddVolume",3,1,[zo],[d]],["ReplaceVolume",3,2,[d,zo],[]],["DeleteVolume",3,3,[d],[]],["GetVolume",3,4,[d],[zo]],["GetVolumeCount",3,5,[],[l]],["GetVolumes",3,6,[],[lt(d,zo)]],["GetAccess",3,7,[],[Fo]],["SetAccess",3,8,[Fo],[]]],[["VolumeType",[Xe],3,1,!1,!1,null],["Access",[Fo],3,2,!1,!1,null],["Volumes",[lt(d,zo)],3,3,!1,!1,null]],[["OcaLibVolChanged",3,1,[d,Z]]]);class Ho extends(G({Unspecified:1,Internal:2,External:3})){}const Wo=J(Ho);class Ko extends(G({Off:0,Unavailable:1,Available:2,Active:3})){}const Xo=J(Ko);class Yo extends(G({None:0,Mains:1,Battery:2,Phantom:3,Solar:4})){}const Qo=J(Yo),Jo=q("OcaPowerSupply",3,"",3,so,[["GetType",3,1,[],[Qo]],["GetModelInfo",3,2,[],[oe]],["GetState",3,3,[],[Xo]],["SetState",3,4,[Xo],[]],["GetCharging",3,5,[],[H]],["GetLoadFractionAvailable",3,6,[],[vt]],["GetStorageFractionAvailable",3,7,[],[vt]],["GetLocation",3,8,[],[Wo]]],[["Type",[Qo],3,1,!1,!1,null],["ModelInfo",[oe],3,2,!1,!1,null],["State",[Xo],3,3,!1,!1,null],["Charging",[H],3,4,!1,!1,null],["LoadFractionAvailable",[vt],3,5,!0,!1,null],["StorageFractionAvailable",[vt],3,6,!0,!1,null],["Location",[Wo],3,7,!0,!1,null]],[]),Zo=q("OcaEventHandler",3,"\b",2,so,[["OnEvent",3,1,[ce,S],[]]],[],[]),$o=q("OcaNumericObserverList",3,"\t",2,so,[["GetLastObservation",3,1,[],[ge(ur)]],["GetState",3,2,[],[ko]],["GetObservedProperties",3,3,[],[ge(vo)]],["SetObservedProperties",3,4,[ge(vo)],[]],["GetThreshold",3,5,[],[ur]],["SetThreshold",3,6,[ur],[]],["GetOperator",3,7,[],[Uo]],["SetOperator",3,8,[Uo],[]],["GetTwoWay",3,9,[],[H]],["SetTwoWay",3,10,[H],[]],["GetHysteresis",3,11,[],[ur]],["SetHysteresis",3,12,[ur],[]],["GetPeriod",3,13,[],[vt]],["SetPeriod",3,14,[vt],[]]],[["State",[ko],3,1,!1,!1,null],["ObservedProperties",[ge(vo)],3,2,!1,!1,null],["Threshold",[ur],3,3,!1,!1,null],["Operator",[Uo],3,4,!1,!1,null],["TwoWay",[H],3,5,!1,!1,null],["Hysteresis",[ur],3,6,!1,!1,null],["Period",[vt],3,7,!1,!1,null]],[["Observation",3,1,[S,ge(ur)]]]);class es extends(G({Unavailable:0,Available:1})){}const ts=J(es);class ns{constructor(e,t,n,r){this.NominalRate=e,this.PullRange=t,this.Accuracy=n,this.JitterMax=r}}const rs=c({NominalRate:vt,PullRange:vt,Accuracy:vt,JitterMax:vt},ns),os=q("OcaMediaClock3",3,"",1,so,[["GetAvailability",3,1,[],[ts]],["SetAvailability",3,2,[ts],[]],["GetCurrentRate",3,3,[],[rs,d]],["SetCurrentRate",3,4,[rs,d],[]],["GetOffset",3,5,[],[at]],["SetOffset",3,6,[at],[]],["GetSupportedRates",3,7,[],[lt(d,ge(rs))]]],[["Availability",[ts],3,1,!1,!1,null],["TimeSourceONo",[d],3,2,!1,!1,null],["Offset",[at],3,3,!1,!1,null],["CurrentRate",[rs],3,4,!1,!1,null],["SupportedRates",[lt(d,ge(rs))],3,5,!1,!1,null]],[]);class ss extends(G({Undefined:0,None:1,Private:2,NTP:3,SNTP:4,IEEE1588_2002:5,IEEE1588_2008:6,IEEE_AVB:7,AES11:8,Genlock:9})){}const is=J(ss);class as extends(G({Undefined:0,Local:1,Private:2,GPS:3,Galileo:4,GLONASS:5})){}const cs=J(as);class ls extends(G({Unavailable:0,Available:1})){}const us=J(ls);class hs extends(G({Undefined:0,Unsynchronized:1,Synchronizing:2,Synchronized:3})){}const ds=J(hs),gs=q("OcaTimeSource",3,"",1,so,[["GetAvailability",3,1,[],[us]],["GetProtocol",3,2,[],[is]],["SetProtocol",3,3,[is],[]],["GetParameters",3,4,[],[oe]],["SetParameters",3,5,[oe],[]],["GetReferenceType",3,6,[],[cs]],["SetReferenceType",3,7,[cs],[]],["GetReferenceID",3,8,[],[oe]],["SetReferenceID",3,9,[oe],[]],["GetSyncStatus",3,10,[],[ds]],["Reset",3,11,[],[]]],[["Availability",[us],3,1,!1,!1,null],["Protocol",[is],3,2,!1,!1,null],["Parameters",[oe],3,3,!1,!1,null],["ReferenceType",[cs],3,4,!1,!1,null],["ReferenceID",[oe],3,5,!1,!1,null],["SyncStatus",[ds],3,6,!1,!1,null]],[]);class Ss extends(G({Robotic:1,ItuAudioObjectBasedPolar:2,ItuAudioObjectBasedCartesian:3,ItuAudioSceneBasedPolar:4,ItuAudioSceneBasedCartesian:5,NAV:6,ProprietaryBase:128})){}const fs=J(Ss);class ps{constructor(e,t,n){this.CoordinateSystem=e,this.FieldFlags=t,this.Values=n}}const ms=c({CoordinateSystem:fs,FieldFlags:gn,Values:vt},ps),Os=q("OcaPhysicalPosition",3,"",1,so,[["GetCoordinateSystem",3,1,[],[fs]],["GetPositionDescriptorFieldFlags",3,2,[],[gn]],["GetPositionDescriptor",3,3,[],[ms,ms,ms]],["SetPositionDescriptor",3,4,[ms],[]]],[["CoordinateSystem",[fs],3,1,!0,!1,null],["PositionDescriptorFieldFlags",[gn],3,2,!0,!1,null],["PositionDescriptor",[ms],3,3,!1,!1,null]],[]);class ys extends(G({None:0,Prepare:1,Start:2,Pause:3,Stop:4,Reset:5})){}const bs=J(ys);class Cs extends(G({Unknown:0,NotReady:1,Readying:2,Ready:3,Running:4,Paused:5,Stopping:6,Stopped:7,Fault:8})){}const ws=J(Cs);class Ps{constructor(e,t){this.SystemInterfaceParameters=e,this.MyNetworkAddress=t}}const Gs=c({SystemInterfaceParameters:ce,MyNetworkAddress:ce},Ps),vs=q("OcaApplicationNetwork",2,"",1,se,[["GetLabel",2,1,[],[oe]],["SetLabel",2,2,[oe],[]],["GetOwner",2,3,[],[d]],["GetServiceID",2,4,[],[ce]],["SetServiceID",2,5,[ce],[]],["GetSystemInterfaces",2,6,[],[ge(Gs)]],["SetSystemInterfaces",2,7,[ge(Gs)],[]],["GetState",2,8,[],[ws]],["GetErrorCode",2,9,[],[l]],["Control",2,10,[bs],[]],["GetPath",2,11,[],[ge(oe),ge(d)]]],[["Label",[oe],2,1,!1,!0,null],["Owner",[d],2,2,!1,!0,null],["ServiceID",[ce],2,3,!1,!1,null],["SystemInterfaces",[ge(Gs)],2,4,!1,!1,null],["State",[ws],2,5,!1,!1,null],["ErrorCode",[l],2,6,!1,!1,null]],[]);class Ds extends(G({None:0,OCP01:1,OCP02:2,OCP03:3})){}const _s=J(Ds),Ts=q("OcaControlNetwork",3,"",1,vs,[["GetControlProtocol",3,1,[],[_s]]],[["Protocol",[_s],3,1,!1,!1,["ControlProtocol"]]],[]);class Is{constructor(e,t,n){this.CodingSchemeID=e,this.CodecParameters=t,this.ClockONo=n}}const Ms=c({CodingSchemeID:l,CodecParameters:oe,ClockONo:d},Is);class As extends(G({None:0,Unicast:1,Multicast:2})){}const Ls=J(As);class Es{constructor(e,t,n,r){this.Secure=e,this.StreamParameters=t,this.StreamCastMode=n,this.StreamChannelCount=r}}const ks=c({Secure:H,StreamParameters:ce,StreamCastMode:Ls,StreamChannelCount:l},Es);class xs extends(G({None:0,Start:1,Pause:2})){}const Us=J(xs),Ns=Y;class Rs extends(G({Stopped:0,SettingUp:1,Running:2,Paused:3,Fault:4})){}const Fs=J(Rs);class Bs{constructor(e,t,n){this.ConnectorID=e,this.State=t,this.ErrorCode=n}}const js=c({ConnectorID:l,State:Fs,ErrorCode:l},Bs);function Vs(e,t){const n=e.encodedLength,r=e.encodeTo,o=e.decodeFrom,s=e.decodeLength,i=t.encodedLength,c=t.encodeTo,l=t.decodeFrom,u=t.decodeLength;return a({isConstantLength:!1,encodedLength:function(e){if(!(e instanceof Map||e instanceof WeakMap))throw new TypeError("Expected Map or WeakMap");let t=2;return e.forEach((e,r)=>{t+=n(r)*e.size,e.forEach(e=>{t+=i(e)})}),t},encodeTo:function(e,t,n){const o=t;let s=0;return t+=2,n.forEach((n,o)=>{s+=n.size,n.forEach(n=>{t=r(e,t,o),t=c(e,t,n)})}),e.setUint16(o,s),t},decodeFrom:function(e,t){const n=new Map,r=e.getUint16(t);t+=2;for(let s=0;s<r;s++){let r,s;[t,r]=o(e,t),[t,s]=l(e,t);let i=n.get(r);i||n.set(r,i=new Set),i.add(s)}return[t,n]},decodeLength:function(e,t){const n=e.getUint16(t);t+=2;for(let r=0;r<n;r++)t=s(e,t),t=u(e,t);return t}})}class zs{constructor(e,t,n,r,o,s,i,a,c){this.IDInternal=e,this.IDExternal=t,this.Connection=n,this.AvailableCodings=r,this.PinCount=o,this.ChannelPinMap=s,this.AlignmentLevel=i,this.AlignmentGain=a,this.CurrentCoding=c}}const qs=c({IDInternal:l,IDExternal:oe,Connection:ks,AvailableCodings:ge(Ms),PinCount:l,ChannelPinMap:Vs(l,It),AlignmentLevel:vt,AlignmentGain:vt,CurrentCoding:Ms},zs);class Hs{constructor(e,t,n,r,o,s,i,a){this.IDInternal=e,this.IDExternal=t,this.Connection=n,this.AvailableCodings=r,this.PinCount=o,this.ChannelPinMap=s,this.AlignmentLevel=i,this.CurrentCoding=a}}const Ws=c({IDInternal:l,IDExternal:oe,Connection:ks,AvailableCodings:ge(Ms),PinCount:l,ChannelPinMap:lt(l,It),AlignmentLevel:vt,CurrentCoding:Ms},Hs);class Ks extends(G({None:0,AV3:1,AVBTP:2,Dante:3,Cobranet:4,AES67:5,SMPTEAudio:6,LiveWire:7,ExtensionPoint:65})){}const Xs=J(Ks),Ys=q("OcaMediaTransportNetwork",3,"",1,vs,[["GetMediaProtocol",3,1,[],[Xs]],["GetPorts",3,2,[],[ge(At)]],["GetPortName",3,3,[It],[oe]],["SetPortName",3,4,[It,oe],[]],["GetMaxSourceConnectors",3,5,[],[l]],["GetMaxSinkConnectors",3,6,[],[l]],["GetMaxPinsPerConnector",3,7,[],[l]],["GetMaxPortsPerPin",3,8,[],[l]],["GetSourceConnectors",3,9,[],[ge(Ws)]],["GetSourceConnector",3,10,[l],[Ws]],["GetSinkConnectors",3,11,[],[ge(qs)]],["GetSinkConnector",3,12,[l],[qs]],["GetConnectorsStatuses",3,13,[],[ge(js)]],["GetConnectorStatus",3,14,[l],[js]],["AddSourceConnector",3,15,[Ws,Fs],[Ws]],["AddSinkConnector",3,16,[js,qs],[qs]],["ControlConnector",3,17,[l,Us],[]],["SetSourceConnectorPinMap",3,18,[l,lt(l,It)],[]],["SetSinkConnectorPinMap",3,19,[l,Vs(l,It)],[]],["SetConnectorConnection",3,20,[l,ks],[]],["SetConnectorCoding",3,21,[l,Ms],[]],["SetConnectorAlignmentLevel",3,22,[l,vt],[]],["SetConnectorAlignmentGain",3,23,[l,vt],[]],["DeleteConnector",3,24,[l],[]],["GetAlignmentLevel",3,25,[],[vt,vt,vt]],["GetAlignmentGain",3,26,[],[vt,vt,vt]]],[["Protocol",[Xs],3,1,!1,!1,["MediaProtocol"]],["Ports",[ge(At)],3,2,!1,!1,null],["MaxSourceConnectors",[l],3,3,!1,!1,null],["MaxSinkConnectors",[l],3,4,!1,!1,null],["MaxPinsPerConnector",[l],3,5,!1,!1,null],["MaxPortsPerPin",[l],3,6,!1,!1,null],["AlignmentLevel",[vt],3,7,!1,!1,null],["AlignmentGain",[vt],3,8,!1,!1,null]],[["SourceConnectorChanged",3,1,[Ws,Z,Ns]],["SinkConnectorChanged",3,2,[qs,Z,Ns]],["ConnectorStatusChanged",3,3,[js]]]);class Qs extends(G({None:0,Source:1,Sink:2})){}const Js=J(Qs);class Zs extends(G({NotConnected:0,Connected:1,Muted:2})){}const $s=J(Zs),ei=q("OcaNetworkSignalChannel",3,"",2,Lt,[["AddToConnector",3,6,[d,l],[]],["GetConnectorPins",3,5,[],[lt(d,l)]],["GetIDAdvertised",3,1,[],[ce]],["GetNetwork",3,3,[],[d]],["GetRemoteChannelID",3,8,[],[ce]],["GetSourceOrSink",3,10,[],[Js]],["GetStatus",3,11,[],[$s]],["RemoveFromConnector",3,7,[d],[]],["SetIDAdvertised",3,2,[ce],[]],["SetNetwork",3,4,[d],[]],["SetRemoteChannelID",3,9,[ce],[]]],[["ConnectorPins",[lt(d,l)],3,3,!1,!1,null],["IDAdvertised",[ce],3,1,!1,!1,null],["Network",[d],3,2,!1,!1,null],["RemoteChannelID",[ce],3,4,!1,!1,null],["SourceOrSink",[Js],3,5,!1,!1,null],["Status",[$s],3,6,!1,!1,null]],[]);class ti extends(G({None:0,EthernetWired:1,EthernetWireless:2,USB:3,SerialP2P:4})){}const ni=J(ti);class ri{constructor(e,t){this.rxPacketErrors=e,this.txPacketErrors=t}}const oi=c({rxPacketErrors:d,txPacketErrors:d},ri);class si extends(G({Unknown:0,Ready:1,StartingUp:2,Stopped:3})){}const ii=J(si);class ai{constructor(e,t){this.SystemInterfaceHandle=e,this.MyNetworkAddress=t}}const ci=c({SystemInterfaceHandle:ce,MyNetworkAddress:ce},ai),li=q("OcaNetwork",3,"",2,so,[["GetLinkType",3,1,[],[ni]],["GetIDAdvertised",3,2,[],[ce]],["SetIDAdvertised",3,3,[ce],[]],["GetControlProtocol",3,4,[],[_s]],["GetMediaProtocol",3,5,[],[Xs]],["GetStatus",3,6,[],[ii]],["GetStatistics",3,7,[],[oi]],["ResetStatistics",3,8,[],[]],["GetSystemInterfaces",3,9,[],[ge(ci)]],["SetSystemInterfaces",3,10,[ge(ci)],[]],["GetMediaPorts",3,11,[],[ge(d)]],["Startup",3,12,[],[]],["Shutdown",3,13,[],[]]],[["LinkType",[ni],3,1,!0,!1,null],["IDAdvertised",[ce],3,2,!1,!1,null],["ControlProtocol",[_s],3,3,!1,!1,null],["MediaProtocol",[Xs],3,4,!1,!1,null],["Status",[ii],3,5,!1,!1,null],["SystemInterfaces",[ge(ci)],3,6,!1,!1,null],["MediaPorts",[ge(d)],3,7,!1,!1,null],["Statistics",[oi],3,8,!1,!1,null]],[]);class ui extends(G({Undefined:0,Locked:1,Synchronizing:2,FreeRun:3,Stopped:4})){}const hi=J(ui),di=q("OcaMediaClock",3,"",2,so,[["GetType",3,1,[],[ze]],["SetType",3,2,[ze],[]],["GetDomainID",3,3,[],[l]],["SetDomainID",3,4,[l],[]],["GetSupportedRates",3,5,[],[ge(rs)]],["GetCurrentRate",3,6,[],[rs]],["SetCurrentRate",3,7,[rs],[]],["GetLockState",3,8,[],[hi]]],[["Type",[ze],3,1,!1,!1,null],["DomainID",[l],3,2,!1,!1,null],["RatesSupported",[ge(rs)],3,3,!1,!1,null],["CurrentRate",[rs],3,4,!1,!1,null],["LockState",[hi],3,5,!1,!1,null]],[]),gi=q("OcaStreamNetwork",3,"\n",2,so,[["GetLinkType",3,1,[],[ni]],["GetIDAdvertised",3,2,[],[ce]],["SetIDAdvertised",3,3,[ce],[]],["GetControlProtocol",3,4,[],[_s]],["GetMediaProtocol",3,5,[],[Xs]],["GetStatus",3,6,[],[ii]],["GetStatistics",3,7,[],[oi]],["ResetStatistics",3,8,[],[]],["GetSystemInterfaces",3,9,[],[ge(ci)]],["SetSystemInterfaces",3,10,[ge(ci)],[]],["GetStreamConnectorsSource",3,11,[],[ge(d)]],["SetStreamConnectorsSource",3,12,[ge(d)],[]],["GetStreamConnectorsSink",3,13,[],[ge(d)]],["SetStreamConnectorsSink",3,14,[ge(d)],[]],["GetSignalChannelsSource",3,15,[],[ge(d)]],["SetSignalChannelsSource",3,16,[ge(d)],[]],["GetSignalChannelsSink",3,17,[],[ge(d)]],["SetSignalChannelsSink",3,18,[ge(d)],[]],["Startup",3,19,[],[]],["Shutdown",3,20,[],[]]],[["ControlProtocol",[_s],3,3,!1,!1,null],["IDAdvertised",[ce],3,2,!1,!1,null],["LinkType",[ni],3,1,!0,!1,null],["MediaProtocol",[Xs],3,4,!1,!1,null],["SignalChannelsSink",[ge(d)],3,10,!1,!1,null],["SignalChannelsSource",[ge(d)],3,9,!1,!1,null],["Statistics",[oi],3,11,!1,!1,null],["Status",[ii],3,5,!1,!1,null],["StreamConnectorsSink",[ge(d)],3,8,!1,!1,null],["StreamConnectorsSource",[ge(d)],3,7,!1,!1,null],["SystemInterfaces",[ge(ci)],3,6,!1,!1,null]],[]);class Si{constructor(e,t,n,r){this.HostID=e,this.NetworkAddress=t,this.NodeID=n,this.StreamConnectorID=r}}const fi=c({HostID:ce,NetworkAddress:ce,NodeID:ce,StreamConnectorID:ce},Si);class pi extends(G({NotConnected:0,Connected:1,Paused:2})){}const mi=J(pi);class Oi extends(G({None:0,Unicast:1,Multicast:2})){}const yi=J(Oi);class bi{constructor(e,t,n,r,o,s,i,a,c,l,u){this.ErrorNumber=e,this.IDAdvertised=t,this.Index=n,this.Label=r,this.LocalConnectorONo=o,this.Priority=s,this.RemoteConnectorIdentification=i,this.Secure=a,this.Status=c,this.StreamParameters=l,this.StreamType=u}}const Ci=c({ErrorNumber:l,IDAdvertised:ce,Index:l,Label:oe,LocalConnectorONo:d,Priority:l,RemoteConnectorIdentification:fi,Secure:H,Status:mi,StreamParameters:ce,StreamType:yi},bi);class wi extends(G({NotAvailable:0,Idle:1,Connected:2,Paused:3})){}const Pi=J(wi),Gi=q("OcaStreamConnector",3,"\v",2,so,[["ConnectStream",3,7,[Ci],[l]],["DisconnectStream",3,8,[l],[]],["GetIDAdvertised",3,3,[],[ce]],["GetOwnerNetwork",3,1,[],[d]],["GetPins",3,10,[],[lt(l,d)]],["GetSourceOrSink",3,5,[],[Js]],["GetStatus",3,11,[],[Pi]],["GetStreams",3,9,[],[lt(l,Ci)]],["SetIDAdvertised",3,4,[ce],[]],["SetOwnerNetwork",3,2,[d],[]],["SetSourceOrSink",3,6,[Js],[]]],[["IDAdvertised",[ce],3,2,!1,!1,null],["OwnerNetwork",[d],3,1,!1,!1,null],["Pins",[lt(l,d)],3,5,!1,!1,null],["SourceOrSink",[Js],3,3,!1,!1,null],["Status",[Pi],3,6,!1,!1,null],["Streams",[lt(l,Ci)],3,4,!1,!1,null]],[]);var vi=Object.freeze({__proto__:null,OcaRoot:se,OcaWorker:Lt,OcaActuator:Yt,OcaMute:Zt,OcaPolarity:tn,OcaSwitch:nn,OcaGain:rn,OcaPanBalance:on,OcaDelay:sn,OcaDelayExtended:hn,OcaFrequencyActuator:dn,OcaFilterClassical:On,OcaFilterParametric:Cn,OcaFilterPolynomial:wn,OcaFilterFIR:Pn,OcaFilterArbitraryCurve:Dn,OcaDynamics:xn,OcaDynamicsDetector:Un,OcaDynamicsCurve:Nn,OcaSignalGenerator:Vn,OcaSignalInput:zn,OcaSignalOutput:qn,OcaTemperatureActuator:Hn,OcaIdentificationActuator:Wn,OcaSummingPoint:Kn,OcaBasicActuator:Xn,OcaBooleanActuator:Yn,OcaInt8Actuator:Jn,OcaInt16Actuator:$n,OcaInt32Actuator:tr,OcaInt64Actuator:or,OcaUint8Actuator:sr,OcaUint16Actuator:ir,OcaUint32Actuator:ar,OcaUint64Actuator:cr,OcaFloat32Actuator:lr,OcaFloat64Actuator:hr,OcaStringActuator:dr,OcaBitstringActuator:pr,OcaSensor:yr,OcaLevelSensor:br,OcaAudioLevelSensor:Pr,OcaTimeIntervalSensor:Gr,OcaFrequencySensor:vr,OcaTemperatureSensor:Dr,OcaIdentificationSensor:_r,OcaVoltageSensor:Tr,OcaCurrentSensor:Ir,OcaImpedanceSensor:Lr,OcaGainSensor:Er,OcaBasicSensor:kr,OcaBooleanSensor:xr,OcaInt8Sensor:Ur,OcaInt16Sensor:Nr,OcaInt32Sensor:Rr,OcaInt64Sensor:Fr,OcaUint8Sensor:Br,OcaUint16Sensor:jr,OcaUint32Sensor:Vr,OcaFloat32Sensor:zr,OcaFloat64Sensor:qr,OcaStringSensor:Hr,OcaBitstringSensor:Wr,OcaUint64Sensor:Kr,OcaBlock:Xt,OcaBlockFactory:no,OcaMatrix:oo,OcaAgent:so,OcaGrouper:yo,OcaRamper:Lo,OcaNumericObserver:No,OcaLibrary:qo,OcaPowerSupply:Jo,OcaEventHandler:Zo,OcaNumericObserverList:$o,OcaMediaClock3:os,OcaTimeSource:gs,OcaPhysicalPosition:Os,OcaApplicationNetwork:vs,OcaControlNetwork:Ts,OcaMediaTransportNetwork:Ys,OcaManager:ae,OcaDeviceManager:we,OcaSecurityManager:Pe,OcaFirmwareManager:Te,OcaSubscriptionManager:Ne,OcaPowerManager:Be,OcaNetworkManager:je,OcaMediaClockManager:qe,OcaLibraryManager:Je,OcaAudioProcessingManager:Ze,OcaDeviceTimeManager:ct,OcaTaskManager:wt,OcaCodingManager:Pt,OcaDiagnosticManager:Gt,OcaNetworkSignalChannel:ei,OcaNetwork:li,OcaMediaClock:di,OcaStreamNetwork:gi,OcaStreamConnector:Gi});const Di={DeviceManager:1,SecurityManager:2,FirmwareManager:3,SubscriptionManager:4,PowerManager:5,NetworkManager:6,MediaClockManager:7,LibraryManager:8,AudioProcessingManager:9,DeviceTimeManager:10,TaskManager:11,CodingManager:12,DiagnosticManager:13};function _i(e){const t=e.EmitterONo,n=e.EventID;return[t,n.DefLevel,n.EventIndex].join(",")}const Ti={ONo:1055,MethodID:{DefLevel:1,MethodIndex:1}};class Ii extends n{constructor(e,...t){super(),this.objects=new Map,this.connection=e,e.on("error",e=>{this.emit("error",e)}),e.on("close",e=>{this.emit("close",e)}),this.modules=[],this.add_control_classes(Object.values(vi)),t.map(e=>this.add_control_classes(e)),this.DeviceManager=new we(Di.DeviceManager,this),this.SecurityManager=new Pe(Di.SecurityManager,this),this.FirmwareManager=new Te(Di.FirmwareManager,this),this.SubscriptionManager=new Ne(Di.SubscriptionManager,this),this.PowerManager=new Be(Di.PowerManager,this),this.NetworkManager=new je(Di.NetworkManager,this),this.MediaClockManager=new qe(Di.MediaClockManager,this),this.LibraryManager=new Je(Di.LibraryManager,this),this.AudioProcessingManager=new Ze(Di.AudioProcessingManager,this),this.DeviceTimeManager=new ct(Di.DeviceTimeManager,this),this.TaskManager=new wt(Di.TaskManager,this),this.CodingManager=new Pt(Di.CodingManager,this),this.DiagnosticManager=new Gt(Di.DiagnosticManager,this),this.Root=new Xt(100,this),this.subscriptions=new Map}close(){this.connection.close()}send_command(e,t){return this.connection.send_command(e,t)}_doSubscribe(e){return this.SubscriptionManager.AddSubscription(e,Ti,new Uint8Array(0),Ee.Reliable,new Uint8Array(0))}async add_subscription(n,r){const o=_i(n),s=this.subscriptions;{const e=s.get(o);if(e)return e.callbacks.add(r),!0}const i=n=>{const r=this.subscriptions.get(o);if(!r)return void e("Subscription lost.");r.callbacks.forEach((function(e){try{e(n)}catch(e){t(e)}}))};this.connection._addSubscriber(n,i);const a={callbacks:new Set([r]),callback:i};s.set(o,a);try{await this._doSubscribe(n)}catch(e){throw s.delete(o),e}}remove_subscription(e,t){const n=_i(e),r=this.subscriptions.get(n);if(!r)return Promise.reject("Callback not registered.");const o=r.callbacks;return o.delete(t),o.size?Promise.resolve(!0):(this.connection._removeSubscriber(e),this.subscriptions.delete(n),this.SubscriptionManager.RemoveSubscription(e,Ti))}find_best_class(e){for("object"==typeof e&&e.ClassID&&(e=e.ClassID);e.length;){const t=this.find_class_by_id(e);if(t)return t;e=e.substr(0,e.length-1)}return null}add_control_classes(e){if(Array.isArray(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[r.ClassID]=r}e=t}else if("object"!=typeof e)throw new Error("Unsupported module.");this.modules.push(e)}find_class_by_id(e){"object"==typeof e&&e.ClassID&&(e=e.ClassID);const t=this.modules;for(let n=t.length-1;n>=0;n--){const r=t[n][e];if(r)return r}return null}allocate(e,t){"object"==typeof t&&(t=t.valueOf());const n=this.objects;return n.has(t)||n.set(t,new e(t,this)),n.get(t)}resolve_object(e){if("MemberObjectIdentification"in e)return this.resolve_object(e.MemberObjectIdentification);if("ONo"in e&&"ClassIdentification"in e){const t=e.ONo,n=e.ClassIdentification;return this.allocate(this.find_best_class(n),t)}throw new TypeError("Expected OcaObjectIdentification or OcaBlockMember")}GetDeviceTree(){const e=t=>t.GetMembers().then(t=>{const n=[];t=t.map(this.resolve_object,this);for(let r=0;r<t.length;r++)n.push(Promise.resolve(t[r])),t[r].ClassID.startsWith(Xt.ClassID)&&n.push(e(t[r]));return Promise.all(n)});return e(this.Root)}get_device_tree(){return this.GetDeviceTree()}get_role_map(e){return this.get_device_tree().then((function(t){return function(e,t){const n=new Map;t||(t="/");const r=[],o=e=>{Array.isArray(e)?e.forEach(o):r.push(e.GetRole().then(t=>{n.set(e,t)}))};return e.forEach(o),Promise.all(r).then((function(){const r=new Map,o=(e,s)=>{const i=null!=s?s+t:"",a=new Map;e.forEach((function(e,t){if(Array.isArray(e))return;const r=n.get(e);if(a.has(r)){const t=a.get(r);Array.isArray(t)?t.push(e):a.set(r,[t,e])}else a.set(r,e)})),a.forEach((function(e,t){if(Array.isArray(e)){let n=1;for(let r=0;r<e.length;r++){const o=t+n;for(;a.has(o);)n++;a.set(o,e[r]),a.set(e[r],o)}a.delete(t)}else a.set(e,t)})),e.forEach((t,n)=>{if(Array.isArray(t))o(t,i+a.get(e[n-1]));else{const e=i+a.get(t);r.set(e,t)}})};return o(e,null),r}))}(t,e)}))}discover_all_fallback(){return this.GetDeviceTree().then(e=>{const t=[],n=function(e){for(let r=0;r<e.length;r++)Array.isArray(e[r])?n(e[r]):t.push(e[r])};return n(e),t})}discover_all(){return this.Root.GetMembersRecursive().then(e=>e.map(this.resolve_object,this)).catch(()=>this.discover_all_fallback())}set_keepalive_interval(e){this.connection.set_keepalive_interval(e)}}const Mi=Object.values(vi);class Ai extends(G({None:0,ParamSet:1,Patch:2,Program:3})){}class Li extends(G({Ampere:4,DegreeCelsius:2,Hertz:1,None:0,Ohm:5,Volt:3})){}var Ei=Object.freeze({__proto__:null,OcaApplicationNetworkCommand:ys,OcaApplicationNetworkState:Cs,OcaBaseDataType:bo,OcaBlockMember:xt,OcaClassAuthorityID:class{constructor(e,t,n){this.Sentinel=e,this.Reserved=t,this.OrganizationID=n}},OcaClassIdentification:K,OcaClassicalFilterShape:Sn,OcaComponent:Ge,OcaDBr:_n,OcaDelayUnit:an,OcaDelayValue:ln,OcaDeviceState:{Operational:1,Disabled:2,Error:4,Initializing:8,Updating:16,unused:32},OcaDynamicsFunction:In,OcaEnumItem:class{constructor(e){this.Value=e}},OcaEnumItem16:class{constructor(e){this.Value=e}},OcaEvent:g,OcaEventID:u,OcaFilterPassband:pn,OcaGlobalTypeIdentifier:Nt,OcaGrouperCitizen:co,OcaGrouperEnrollment:uo,OcaGrouperGroup:go,OcaGrouperMode:fo,OcaGrouperStatusChangeEventData:class{constructor(e,t,n,r){this.Event=e,this.groupIndex=t,this.citizenIndex=n,this.changeType=r}},OcaGrouperStatusChangeType:mo,OcaImpedance:Mr,OcaLevelDetectionLaw:An,OcaLevelMeterLaw:Cr,OcaLibAccess:Ro,OcaLibParamSetAssignment:class{constructor(e,t){this.ParamSetIdentifier=e,this.TargetBlockONo=t}},OcaLibVol:Vo,OcaLibVolChangedEventData:class{constructor(e,t,n){this.Event=e,this.VolumeID=t,this.ChangeType=n}},OcaLibVolData_ParamSet:Ft,OcaLibVolIdentifier:He,OcaLibVolMetadata:Bo,OcaLibVolStandardTypeID:Ai,OcaLibVolType:Ke,OcaLibraryIdentifier:Ye,OcaManagerDefaultObjectNumbers:Di,OcaManagerDescriptor:Se,OcaMediaClockAvailability:es,OcaMediaClockLockState:ui,OcaMediaClockRate:ns,OcaMediaClockType:Ve,OcaMediaCoding:Is,OcaMediaConnection:Es,OcaMediaConnectorCommand:xs,OcaMediaConnectorElement:{PinMap:1,Connection:2,Coding:4,AlignmentLevel:8,AlignmentGain:16},OcaMediaConnectorState:Rs,OcaMediaConnectorStatus:Bs,OcaMediaConnectorStatusChangedEventData:class{constructor(e,t){this.Event=e,this.ConnectorStatus=t}},OcaMediaSinkConnector:zs,OcaMediaSinkConnectorChangedEventData:class{constructor(e,t,n,r){this.Event=e,this.SinkConnector=t,this.ChangeType=n,this.ChangedElement=r}},OcaMediaSourceConnector:Hs,OcaMediaSourceConnectorChangedEventData:class{constructor(e,t,n,r){this.Event=e,this.SourceConnector=t,this.ChangeType=n,this.ChangedElement=r}},OcaMediaStreamCastMode:As,OcaMethod:Ae,OcaMethodID:Ie,OcaModelDescription:pe,OcaModelGUID:Oe,OcaMuteState:Qt,OcaNetworkControlProtocol:Ds,OcaNetworkLinkType:ti,OcaNetworkMediaProtocol:Ks,OcaNetworkMediaSourceOrSink:Qs,OcaNetworkSignalChannelStatus:Zs,OcaNetworkStatistics:ri,OcaNetworkStatus:si,OcaNetworkSystemInterfaceDescriptor:Ps,OcaNetworkSystemInterfaceID:ai,OcaNotificationDeliveryMode:Ee,OcaOPath:io,OcaObjectIdentification:Et,OcaObjectListEventData:class{constructor(e,t){this.Event=e,this.objectList=t}},OcaObjectSearchResult:jt,OcaObjectSearchResultFlags:{ONo:1,ClassIdentification:2,ContainerPath:4,Role:8,Label:16,unused:32},OcaObservationEventData:class{constructor(e,t){this.Event=e,this.Reading=t}},OcaObservationListEventData:class{constructor(e,t){this.Event=e,this.Reading=t}},OcaObserverState:Eo,OcaParametricEQShape:yn,OcaPilotToneDetectorSpec:class{constructor(e,t,n){this.Threshold=e,this.Frequency=t,this.PollInterval=n}},OcaPolarityState:$t,OcaPort:Mt,OcaPortID:Tt,OcaPortMode:Dt,OcaPositionCoordinateSystem:Ss,OcaPositionDescriptor:ps,OcaPowerState:Re,OcaPowerSupplyLocation:Ho,OcaPowerSupplyState:Ko,OcaPowerSupplyType:Yo,OcaPresentationUnit:En,OcaProperty:Go,OcaPropertyChangeType:x,OcaPropertyDescriptor:wo,OcaPropertyID:N,OcaProtoObjectIdentification:Xr,OcaProtoPort:Zr,OcaProtoPortID:Qr,OcaProtoSignalPath:eo,OcaRamperCommand:Do,OcaRamperInterpolationLaw:To,OcaRamperState:Mo,OcaRelationalOperator:xo,OcaResetCause:be,OcaSensorReadingState:mr,OcaSignalPath:qt,OcaStatus:v,OcaStream:bi,OcaStreamConnectorIdentification:Si,OcaStreamConnectorStatus:wi,OcaStreamStatus:pi,OcaStreamType:Oi,OcaStringComparisonType:Wt,OcaSubscriptionManagerState:xe,OcaSweepType:Rn,OcaTask:dt,OcaTaskCommand:St,OcaTaskManagerState:pt,OcaTaskState:Ot,OcaTaskStateChangedEventData:class{constructor(e,t,n){this.TaskID=e,this.ProgramID=t,this.Status=n}},OcaTaskStatus:bt,OcaTimeMode:ut,OcaTimePTP:it,OcaTimeProtocol:ss,OcaTimeReferenceType:as,OcaTimeSourceAvailability:ls,OcaTimeSourceSyncStatus:hs,OcaTransferFunction:Gn,OcaUnitOfMeasure:Li,OcaVersion:De,OcaWaveformType:Bn});class ki extends M{constructor(e,t){super(t),this.ws=e,e.binaryType="arraybuffer",e.addEventListener("message",e=>{this.read(e.data)}),e.addEventListener("close",()=>{this.emit("close")}),e.addEventListener("error",()=>{this.emit("error")})}write(e){this.ws.send(e),super.write(e)}static connect(e){return new Promise((t,n)=>{const r=new WebSocket(e.url),o=function(e){n(e)};r.addEventListener("open",()=>{r.removeEventListener("error",o),t(new this(r,e))}),r.addEventListener("error",o)})}cleanup(){if(super.cleanup(),this.ws){try{this.ws.close()}catch(e){}this.ws=null}}_now(){return performance.now()}}const xi={Connection:M,WebSocket:ki,Device:Ii,ControlClasses:vi,define_custom_class:function(e,t,n,r,o,s,i,a){if(n=String.fromCharCode.apply(String,n.split(".").map(e=>parseInt(e))),o){if("string"==typeof o)for(let e=0;e<Mi.length;e++)if(Mi[e].ClassName===o){o=Mi[e];break}}else{const e=n.substr(0,n.length-1);for(let t=0;t<Mi.length;t++)if(Mi[t].ClassID===e){o=Mi[t];break}}if("function"!=typeof o)throw new Error("Unknown parent class.");return q(e,t,n,r,o,s,i,a)}};var Ui=Object.freeze({__proto__:null,Connection:w,controller:xi,ClientConnection:M,Command:s,CommandRrq:i,decodeMessage:y,encodeMessage:function(e){Array.isArray(e)||(e=[e]);const t=function(e){let t=10;const n=e[0].messageType;for(let r=0;r<e.length;r++){const o=e[r];if(o.messageType!=n)throw new Error("Cannot combine different types in one message.");t+=o.encoded_length()}return t}(e),n=new ArrayBuffer(t);if(b(new DataView(n),0,e,0,e.length)!=t)throw new Error("Message length mismatch.");return n},error:t,log:function(...e){try{console.log(...e)}catch(e){}},KeepAlive:m,Notification:f,Response:p,RemoteDevice:Ii,Types:Ei,warn:e,WebSocketConnection:ki,RemoteControlClasses:vi});window.OCA=Ui}();
|
|
1
|
+
!function(){"use strict";function e(...e){try{console.warn(...e)}catch(e){}}function t(...e){try{console.error(...e)}catch(e){}}class n{constructor(){this.event_handlers=new Map}emit(e){const t=this.event_handlers.get(e),n=Array.prototype.slice.call(arguments,1);t&&t.forEach(e=>{try{e.apply(this,n)}catch(t){console.warn("ERROR when calling %o: %o",e,t)}})}on(e,t){let n=this.event_handlers.get(e);n||this.event_handlers.set(e,n=new Set),n.add(t)}addEventListener(e,t){this.on(e,t)}removeEventListener(e,t){const n=this.event_handlers.get(e);if(!n||!n.has(t))throw new Error("removeEventListeners(): not installed.");n.delete(t)}}class r{get messageType(){return this.constructor.messageType}}class o{get byteLength(){let e=this._byteLength;if(-1===e){const t=this.encoders,n=this.data;e=0;for(let r=0;r<t.length;r++)e+=t[r].encodedLength(n[r]);this._byteLength=e}return e}constructor(e,t){this.encoders=e,this.data=t,this._byteLength=-1}encodeTo(e,t){t|=0;const{encoders:n,data:r}=this;for(let o=0;o<n.length;o++)t=n[o].encodeTo(e,t,r[o]);return t}}class s extends r{constructor(e,t,n,r,o){super(),this.target=+e,this.method_level=0|t,this.method_index=0|n,this.param_count=0|r,this.parameters=o||null,this.handle=0}static get messageType(){return 0}encode_to(e,t){if(t|=0,e.setUint32(t,this.encoded_length()),t+=4,e.setUint32(t,this.handle),t+=4,e.setUint32(t,this.target),t+=4,e.setUint16(t,this.method_level),t+=2,e.setUint16(t,this.method_index),t+=2,e.setUint8(t,this.param_count),t++,this.param_count){const n=this.parameters;n instanceof o?t=n.encodeTo(e,t):(new Uint8Array(e.buffer).set(new Uint8Array(n),e.byteOffset+t),t+=n.byteLength)}return t}encoded_length(){return 17+(this.param_count?this.parameters.byteLength:0)}decode_from(e,t,n){let r=e.getUint32(t);if(t+=4,this.handle=e.getUint32(t),t+=4,this.target=e.getUint32(t),t+=4,this.method_level=e.getUint16(t),t+=2,this.method_index=e.getUint16(t),t+=2,this.param_count=e.getUint8(t),t++,r-=17,r<0)throw new Error("Bad Command Length.");if(r>0){if(!this.param_count)throw new Error("Expected no parameter bytes.");this.parameters=e.buffer.slice(e.byteOffset+t,e.byteOffset+t+r),t+=r}return t}response(e,t,n){return new Response(this.handle,e,t,n)}}class i extends s{static get messageType(){return 1}}function a(e){if(!e.isConstantLength)return e;const t=e.encodedLength(),n=e.decode,r=e.encodeTo;return{isConstantLength:!0,encodedLength:e.encodedLength,encodeTo:r,decode:n,decodeFrom:function(e,r){const o=n(e,r);return[r+t,o]},decodeLength:function(e,n){return n+t}}}function c(e,t){const n=Object.keys(e).length;return t||(t=class{constructor(...t){if(t.length===n){let n=0;for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this[r]=t[n++])}else{if(1!==t.length||"object"!=typeof t[0])throw new TypeError("Unexpected arguments.");{const n=t[0];for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(this[t]=n[t])}}}}),a({type:t,isConstantLength:!1,encodedLength:function(t){let n=0;for(const r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;n+=e[r].encodedLength(t[r])}return n},encodeTo:function(t,n,r){for(const o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;n=e[o].encodeTo(t,n,r[o])}return n},decodeFrom:function(n,r){const o=new Array(e.length);let s=0;for(const t in e){if(!Object.prototype.hasOwnProperty.call(e,t))continue;const i=e[t];let a;[r,a]=i.decodeFrom(n,r),o[s++]=a}return[r,new t(...o)]},decodeLength:function(t,n){for(const r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;n=e[r].decodeLength(t,n)}return n}})}const l=a({isConstantLength:!0,encodedLength:function(e){return 2},encodeTo:function(e,t,n){return e.setUint16(t,0|n,!1),t+2},decode:function(e,t){return e.getUint16(t,!1)}});class u{constructor(e,t){this.DefLevel=e,this.EventIndex=t}}const h=c({DefLevel:l,EventIndex:l},u),d=a({isConstantLength:!0,encodedLength:function(e){return 4},encodeTo:function(e,t,n){return e.setUint32(t,n,!1),t+4},decode:function(e,t){return e.getUint32(t,!1)}});class g{constructor(e,t){this.EmitterONo=e,this.EventID=t}}const S=c({EmitterONo:d,EventID:h},g);class f extends r{constructor(e,t,n,r,o,s,i){super(),this.target=e,this.method_level=0|t,this.method_index=0|n,this.context=r,this.event=o,this.param_count=0|s,this.parameters=i||null}static get messageType(){return 2}encode_to(e,t){e.setUint32(t,this.encoded_length()),t+=4,e.setUint32(t,this.target),t+=4,e.setUint16(t,this.method_level),t+=2,e.setUint16(t,this.method_index),t+=2,e.setUint8(t,this.param_count),t++;const n=this.context;if(n){const r=n.byteLength;e.setUint16(t,r),t+=2,r>0&&(new Uint8Array(e.buffer).set(new Uint8Array(this.context),e.byteOffset+t),t+=r)}else e.setUint16(t,0),t+=2;return e.setUint32(t,this.event.EmitterONo),t+=4,e.setUint16(t,this.event.EventID.DefLevel),t+=2,e.setUint16(t,this.event.EventID.EventIndex),t+=2,this.param_count>1&&(this.parameters instanceof o?t=this.parameters.encodeTo(e,t):(new Uint8Array(e.buffer).set(new Uint8Array(this.parameters),e.byteOffset+t),t+=this.parameters.byteLength)),t}encoded_length(){return 23+(this.param_count>1?this.parameters.byteLength:0)+(this.context?this.context.byteLength:0)}decode_from(e,t,n){let r=e.getUint32(t);t+=4,this.target=e.getUint32(t),t+=4,this.method_level=e.getUint16(t),t+=2,this.method_index=e.getUint16(t),t+=2,this.param_count=e.getUint8(t),t++;const o=e.getUint16(t);let s;if(t+=2,o?(this.context=e.buffer.slice(e.byteOffset+t,e.byteOffset+t+o),t+=o):this.context=null,[t,s]=S.decodeFrom(e,t),this.event=s,r-=23+o,r<0)throw new Error("Bad Notification Length.");return r>0&&(this.parameters=e.buffer.slice(e.byteOffset+t,e.byteOffset+t+r),t+=r),t}}class p extends r{constructor(e,t,n,r){super(),this.handle=e,this.status_code=0|t,this.param_count=0|n,this.parameters=r||null}static get messageType(){return 3}encoded_length(){return 10+(this.param_count?this.parameters.byteLength:0)}decode_from(e,t,n){let r=e.getUint32(t);if(t+=4,this.handle=e.getUint32(t),t+=4,this.status_code=e.getUint8(t),t++,this.param_count=e.getUint8(t),t++,r-=10,r<0)throw new Error("Bad Response length.");if(r>0){if(!this.param_count)throw new Error("Decoding response with parameterCount=0 but %o bytes of parameters",r);this.parameters=e.buffer.slice(e.byteOffset+t,e.byteOffset+t+r),t+=r}return t}encode_to(e,t){return e.setUint32(t,this.encoded_length()),t+=4,e.setUint32(t,this.handle),t+=4,e.setUint8(t,this.status_code),t++,e.setUint8(t,this.param_count),t++,this.param_count&&(this.parameters instanceof o?t=this.parameters.encodeTo(e,t):(new Uint8Array(e.buffer).set(new Uint8Array(this.parameters),e.byteOffset+t),t+=this.parameters.byteLength)),t}}class m extends r{static get messageType(){return 4}constructor(e){super(),this.time=e||0}decode_from(e,t,n){if(4==n)this.time=e.getUint32(t),t+=4;else{if(2!=n)throw new Error("Bad keepalive timeout length.");this.time=1e3*e.getUint16(t),t+=2}return t}encode_to(e,t){return this.time%1e3?(e.setUint32(t,this.time),t+=4):(e.setUint16(t,this.time/1e3),t+=2),t}encoded_length(){return this.time%1e3?4:2}}const O=[s,i,f,p,m];function y(e,t,n){if(e.byteLength<e.byteOffset+t+10)return-1;if(t|=0,59!=e.getUint8(t))throw new Error("Bad sync value.");t++,t+=2;const r=e.getUint32(t);t+=4;const o=e.getUint8(t);t++;const s=e.getUint16(t);t+=2;const i=e.byteOffset+t-9+r;if(i>e.byteLength)return-1;n.length=s;const a=O[o];if(void 0===a)throw new Error("Bad Message Type");if(a===m&&1!==s)throw new Error("Bad KeepAlive message count.");for(let r=0;r<s;r++)n[r]=new a,t=n[r].decode_from(e,t,i-e.byteOffset-t);if(t!=i)throw new Error("Decode error: "+t+" vs "+i);return t}function b(e,t,n,r,o){r||(r=0),o||(o=n.length);if(!(o-r<=65535))throw new Error("Too many PDUs.");e.setUint8(t,59);const s=t+=1;e.setUint16(t,1);const i=t+=2;t+=4,e.setUint8(t,n[r].messageType),t++,e.setUint16(t,o-r),t+=2;for(let s=r;s<o;s++)t=n[s].encode_to(e,t);return e.setUint32(i,t-s),t}class C{constructor(e,t){if(!(e<=4294967295))throw new TypeError("Invalid batch size.");this._pdus=[],this._batchSize=e,this._resultCallback=t,this._currentSize=0,this._currentCount=0,this._lastMessageType=-1,this._flushScheduled=!1,this._flushCb=()=>{this._flushScheduled=!1,null!==this._pdus&&this.flush()}}add(e){const t=this._currentSize,n=e.encoded_length(),r=e.messageType,o=this._lastMessageType===r&&4!==r&&this._currentCount<65535;let s=n;o||(s+=10),t&&t+s>this._batchSize&&(this.flush(),s=n+10),this._pdus.push(e),this._currentSize+=s,o?this._currentCount++:this._currentCount=1,this._lastMessageType=r,this._currentSize>this._batchSize?this.flush():1===this._pdus.length&&this.scheduleFlush()}scheduleFlush(){this._flushScheduled||(this._flushScheduled=!0,Promise.resolve().then(this._flushCb).catch(e=>{console.error(e)}))}flush(){if(!this._currentSize)return;const e=this._pdus,t=new ArrayBuffer(this._currentSize),n=new DataView(t),r=e.length;for(let t=0,o=0,s=0;t<r;t++){const i=e[t].messageType;t!==r-1&&t+1-o!=65535&&4!==i&&i===e[t+1].messageType||(s=b(n,s,e,o,t+1),o=t+1)}this._currentSize=0,this._lastMessageType=-1,this._currentCount=0,this._pdus.length=0,this._resultCallback(t)}dispose(){this._pdus=null}}class w extends n{constructor(e){e||(e={}),super();const t=this._now();this.options=e;const n=e.batch>=0?e.batch:65536;this._message_generator=new C(n,e=>this.write(e)),this.inbuf=null,this.inpos=0,this.last_rx_time=t,this.last_tx_time=t,this.rx_bytes=0,this.tx_bytes=0,this.keepalive_interval=-1,this._keepalive_interval_id=null;const r=()=>{this.removeEventListener("close",r),this.removeEventListener("error",r),this.cleanup()};this.on("close",r),this.on("error",r)}get is_reliable(){return!0}send(e){if(this.is_closed())throw new Error("Connection is closed.");this._message_generator.add(e)}tx_idle_time(){return this._now()-this.last_tx_time}rx_idle_time(){return this._now()-this.last_tx_time}read(e){if(this.rx_bytes+=e.byteLength,this.last_rx_time=this._now(),this.inbuf){const t=this.inbuf.byteLength-this.inpos,n=new Uint8Array(new ArrayBuffer(t+e.byteLength));n.set(new Uint8Array(this.inbuf,this.inpos)),n.set(new Uint8Array(e),t),this.inbuf=null,this.inpos=0,e=n.buffer}let t=0;const n=new DataView(e);try{do{const r=[],o=y(n,t,r);if(-1==o){this.inbuf=e,this.inpos=t;break}t=o,this.incoming(r)}while(t<e.byteLength)}catch(e){console.error(e),this.is_reliable&&(console.error("Error when handling incoming data. Closing connection."),this.close())}this._check_keepalive()}incoming(e){}write(e){this.last_tx_time=this._now(),this.tx_bytes+=e.byteLength}is_closed(){return null===this._message_generator}close(){this.emit("close")}error(e){this.emit("error",e)}cleanup(){if(this.is_closed())throw new Error("cleanup() called twice.");this.set_keepalive_interval(0),this._message_generator.dispose(),this._message_generator=null}_check_keepalive(){if(!(this.keepalive_interval>0))return;const e=this.keepalive_interval;this.rx_idle_time()>3*e?(this.emit("timeout"),this.error(new Error("Keepalive timeout."))):this.tx_idle_time()>.75*e&&(this.flush(),this.tx_idle_time()>.75*e&&this.send(new m(e)))}flush(){this._message_generator.flush()}set_keepalive_interval(e){const t=1e3*e;null!==this._keepalive_interval_id&&(clearInterval(this._keepalive_interval_id),this._keepalive_interval_id=null),this.keepalive_interval=t,this.is_closed()||(this.send(new m(t)),t>0&&(this._keepalive_interval_id=setInterval(()=>{this._check_keepalive()},t/2)))}}function P(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function G(e){let t=null;function n(n){if(null===t){t=new Map;for(const n in e)P(e,n)&&t.set(e[n],n)}return t.get(n)}let r=null;const o=class{constructor(t){if("string"==typeof t){if(!P(e,t))throw new Error("No such enum value.");return this.constructor[t]}if(null!==r&&r.has(t))return r.get(t);this.value=t,function(e,t){null===r&&(r=new Map),r.set(e,t)}(t,this)}get name(){return n(this.value)}valueOf(){return this.value}toString(){return this.name}static getName(e){const t=n(e);if(void 0===t)throw new Error("No such enum value.");return t}static getValue(t){const n=function(t){if(P(e,t))return e[t]}(t);if(void 0===n)throw new Error("No such enum value.");return n}static values(){return e}};for(const t in e)P(e,t)&&Object.defineProperty(o,t,{get:function(){return new this(e[t])},enumerable:!1,configurable:!0});return o}class v extends(G({OK:0,ProtocolVersionError:1,DeviceError:2,Locked:3,BadFormat:4,BadONo:5,ParameterError:6,ParameterOutOfRange:7,NotImplemented:8,InvalidRequest:9,ProcessingFailed:10,BadMethod:11,PartiallySucceeded:12,Timeout:13,BufferOverflow:14})){}class _{constructor(e,t){this.status=new v(e),this.cmd=t}static check_status(e,t){return e instanceof this&&e.status===t}toString(){return"RemoteError("+this.status+")"}}class D{constructor(e){this.values=e}item(e){return this.values[e]}get length(){return this.values.length}}class T{get handle(){return this.command.handle}constructor(e,t,n,r){this.resolve=e,this.reject=t,this.returnTypes=n,this.command=r,this.lastSent=0,this.retries=0}response(e){const{resolve:t,reject:n,returnTypes:r,command:o}=this;if(0!==e.status_code)n(new _(e.status_code,o));else if(r)try{const n=Math.min(e.param_count,r.length);if(0===n)t();else{const o=new Array(n),s=new DataView(e.parameters);for(let e=0,t=0;e<n;e++){let n;[t,n]=r[e].decodeFrom(s,t),o[e]=n}t(1===n?o[0]:new D(o))}}catch(e){n(e)}else t(e)}}function I(e){const t=e.EmitterONo,n=e.EventID;return[t,n.DefLevel,n.EventIndex].join(",")}class M extends w{constructor(e){super(e),this._pendingCommands=new Map,this._nextCommandHandle=0,this._subscribers=new Map}cleanup(){super.cleanup(),this._subscribers=null;const e=this._pendingCommands;this._pendingCommands=null;const t=new Error("closed");e.forEach((e,n)=>{e.reject(t)})}_addSubscriber(e,t){const n=I(e),r=this._subscribers;if(r.has(n))throw new Error("Subscriber already exists.");r.set(n,t)}_removeSubscriber(e){const t=I(e),n=this._subscribers;if(!n.has(t))throw new Error("Unknown subscriber.");n.delete(t)}_getNextCommandHandle(){let e;const t=this._pendingCommands;if(null===t)throw new Error("Connection not open.");do{e=this._nextCommandHandle,this._nextCommandHandle=e+1|0}while(t.has(e));return e}_estimate_next_tx_time(){return this._now()}send_command(e,t,n){const r=(n,r)=>{const o=this._getNextCommandHandle();e.handle=o;const s=new T(n,r,t,e);this._pendingCommands.set(o,s),s.lastSent=this._estimate_next_tx_time(),this.send(e)};if(!n)return new Promise(r);r(e=>n(!0,e),e=>n(!1,e))}_removePendingCommand(e){const t=this._pendingCommands,n=t.get(e);return n?(t.delete(e),n):null}incoming(e){for(let t=0;t<e.length;t++){if(null===this._pendingCommands)return;const n=e[t];if(n instanceof p){const e=this._removePendingCommand(n.handle);if(null===e){if(this.is_reliable)return void this.error(new Error("Unknown handle."));continue}e.response(n)}else if(n instanceof f){const e=this._subscribers,t=I(n.event),r=e.get(t);if(!r)continue;r(n)}else{if(!(n instanceof m))throw new Error("Unexpected PDU");if(!(n.time>0))throw new Error("Bad keepalive timeout.")}}}}class A{constructor(e,t,n){this.object=e,this.id=t,this.handlers=new Set,this.result=null,this.argumentTypes=n}GetOcaEvent(){return new g(this.object.ObjectNumber,this.id)}do_subscribe(){}do_unsubscribe(){}subscribe(e){return this.handlers.add(e),1===this.handlers.size?this.result=this.do_subscribe().then(()=>(this.result=null,!0)):null!==this.result?this.result:Promise.resolve(!0)}unsubscribe(e){return this.handlers.delete(e),this.handlers.size||this.do_unsubscribe().catch((function(){})),Promise.resolve(!0)}Dipose(){this.handlers.clear(),this.handlers.size&&this.do_unsubscribe().catch((function(){}))}}const L=new ArrayBuffer;class E extends A{constructor(e,n,r){super(e,n,r),this.callback=e=>{if(!this.handlers.size)return;const n=new Array(r.length),o=new DataView(e.parameters||L);for(let e=0,t=0;t<r.length;t++){let s;[e,s]=r[t].decodeFrom(o,e),n[t]=s}const s=this.object;this.handlers.forEach((function(e){try{e.apply(s,n)}catch(e){t(e)}}))}}do_subscribe(){return this.object.device.add_subscription(this.GetOcaEvent(),this.callback)}do_unsubscribe(e){return this.object.device.remove_subscription(this.GetOcaEvent(),this.callback)}}class k extends A{constructor(e,n,r){super(e,n,r),this.callback=(n,o,s)=>{if(n.DefLevel!==this.id.DefLevel||n.PropertyIndex!==this.id.PropertyIndex)return;const i=r[0].decodeFrom(o,0)[1];this.handlers.forEach((function(r){try{r.call(e,i,s,n)}catch(e){t(e)}}))}}do_subscribe(){return this.object.OnPropertyChanged.subscribe(this.callback)}do_unsubscribe(e){return this.object.OnPropertyChanged.unsubscribe(this.callback)}}class x extends(G({CurrentChanged:1,MinChanged:2,MaxChanged:3,ItemAdded:4,ItemChanged:5,ItemDeleted:6})){}class U{init(e){this.o=e,this.values=[],this.synchronized=!1,this.subscriptions=[]}sync(){if(this.synchronized)return Promise.resolve();let e=0;const t=[];return this.o.get_properties().forEach(n=>{const r=n.getter(this.o);if(!r)return;const o=n.event(this.o);if(o){const n=function(e,t,n){n===x.CurrentChanged&&(this.values[e]=t)}.bind(this,e);this.subscriptions.push(o.unsubscribe.bind(o,n)),t.push(o.subscribe(n).catch((function(){})))}t.push(r().then(function(e,t){t instanceof D&&(t=t.item(0)),this.values[e]=t}.bind(this,e),(function(){}))),e++}),Promise.all(t)}forEach(e,t){let n=0;t||(t=this),this.o.get_properties().forEach(r=>{r.getter(this.o)&&(e.call(t,this.values[n],r.name),n++)})}Dispose(){this.o=null,this.subscriptions.forEach(e=>e()),this.subscriptions=null}}class N{constructor(e,t){this.DefLevel=e,this.PropertyIndex=t}}class R{constructor(e,t,n){const r=new Map,o=[];this.by_name=r,this.parent=n,this.properties=o,this.level=t;for(let t=0;t<e.length;t++){const n=e[t];if(r.set(n.name,n),o[n.index]=n,n.aliases){const e=n.aliases;for(let t=0;t<e.length;t++)r.set(e[t],n)}}}find_property(e){if(e instanceof N){if(e.DefLevel==this.level)return this.properties[e.PropertyIndex];if(this.parent)return this.parent.find_property(e)}else{if("string"!=typeof e)throw new Error("Expected PropertyID");{const t=this.by_name.get(e);if(t)return t;if(this.parent)return this.parent.find_property(e)}}}find_name(e){const t=this.find_property(e);if(t)return t.name}forEach(e,t){const n=this.parent?this.parent.forEach(e,t):[],r=this.properties;for(let o=0;o<r.length;o++){const s=r[o];void 0!==s&&n.push(e.call(t,s))}return n}}class F{constructor(e,t,n,r,o,s,i){this.name=e,this.type=t,this.level=n,this.index=r,this.readonly=o,this.static=s,this.aliases=i}GetPropertyID(){return new N(this.level,this.index)}GetName(){return this.name}getter(e,t){let n=this.name,r=0;const o=this.aliases;if(this.static){const t=e.constructor[n];if(void 0!==t)return function(){return Promise.resolve(t)}}else{const r=e["Get"+n];if(r)return t?r:r.bind(e)}return o&&r<o.length&&(n=o[r++]),null}setter(e,t){if(this.readonly||this.static)return null;let n=this.name,r=0;const o=this.aliases;{const s=e["Set"+n];if(s)return t?s:s.bind(e);o&&r<o.length&&(n=o[r++])}return null}event(e){let t=this.name,n=0;const r=this.aliases;{const o=e["On"+t+"Changed"];if(o)return o;r&&n<r.length&&(t=r[n++])}return null}subscribe(e,n){const r=this.event(e),o=this.getter(e);return r&&r.subscribe(n).catch(t),o&&o().then(n,t),r||!!o}}function B(e,t){if(!t||!t.length)return;const[n,r,s,a,c]=t;e.prototype[n]=function(...e){const t=a.length;let n=null;t<e.length&&t+1===e.length&&"function"==typeof e[t]&&(n=e[t],e.length=t);const l=new i(this.ono,r,s,t,new o(a,e));return this.device.send_command(l,c,n)}}function j(e,t){const[n,r,o,s]=t;Object.defineProperty(e.prototype,"On"+n,{get:function(){const e="_On"+n,t=this[e];return t||(this[e]=new E(this,new u(r,o),s))}})}function V(e,t){t.static||"ObjectNumber"!==t.name&&Object.defineProperty(e.prototype,"On"+t.name+"Changed",{get:function(){const e="_On"+t.name+"Changed",n=this[e];return n||(this[e]=new k(this,new N(t.level,t.index),t.type))}})}function z(e){if("object"==typeof e&&e instanceof F)return e;if(Array.isArray(e))return"object"!=typeof e[1]&&(e[1]=function(e){throw new Error("Not implemented.")}(e[1])),new F(...e);throw new Error("Bad property.")}function q(e,t,n,r,o,s,i,a){let c=null,l=null;i=i.map(e=>z(e));const u=class extends o{static get ClassID(){return n}static get ClassVersion(){return r}static get ClassName(){return e}static get_properties(){return null===l&&(l=new R(i,t,o.get_properties())),l}static GetPropertySync(){return null===c&&(c=function(e){const t=Object.create(U.prototype),n=Object.create(e.prototype);let r=0;e.get_properties().forEach(e=>{const o=!!e.setter(n,!0);if(!e.getter(n,!0))return;const s={enumerable:!0,get:(i=r,function(){return this.values[i]})};var i,a;o&&(s.set=(a=e.setter(n,!0),function(e){return a.call(this.o,e),e})),Object.defineProperty(t,e.name,s),r++});const o=function(e){this.init(e)};return o.prototype=t,o}(this)),c}constructor(e,t){super(e,t);for(let e=0;e<i.length;e++){this["_On"+i[e].name+"Changed"]=null}for(let e=0;e<a.length;e++){this["_On"+a[e][0]]=null}}Dispose(){super.Dispose();for(let e=0;e<i.length;e++){const t=this["_On"+i[e].name+"Changed"];t&&t.Dispose()}for(let e=0;e<a.length;e++){const t=this["_On"+a[e][0]];t&&t.Dispose()}}};for(let e=0;e<s.length;e++)B(u,s[e]);for(let e=0;e<i.length;e++)V(u,i[e]);for(let e=0;e<a.length;e++)j(u,a[e]);return u}const H=a({isConstantLength:!0,encodedLength:function(e){return 1},encodeTo:function(e,t,n){return e.setUint8(t,n?1:0),t+1},decode:function(e,t){return 0!==e.getUint8(t)}}),W=a({isConstantLength:!1,encodedLength:function(e){if("string"!=typeof e)throw new TypeError("Expected string.");const t=e.length;if(t>65535)throw new Error("Array too long for String16 OCP.1 encoding.");return 2+2*t},encodeTo:function(e,t,n){const r=n.length;e.setUint16(t,r,!1),t+=2;for(let o=0;o<r;o++,t+=2)e.setUint16(t,n.charCodeAt(o),!1);return t},decodeFrom:function(e,t){const n=e.getUint16(t,!1);t+=2;const r=new Array(n);for(let o=0;o<n;o++,t+=2)r[o]=e.getUint16(t,!1);return[t,String.fromCharCode.apply(String,r)]},decodeLength:function(e,t){return t+2+2*e.getUint16(t)}});class K{constructor(e,t){this.ClassID=e,this.ClassVersion=t}}const X=c({ClassID:W,ClassVersion:l},K),Y=a({isConstantLength:!0,encodedLength:function(e){return 1},encodeTo:function(e,t,n){return e.setUint8(t,0|n),t+1},decode:function(e,t){return e.getUint8(t)}});function Q(e,t){const n=t.encodeTo,r=t.decode,o=a({isConstantLength:!0,encodedLength:t.encodedLength,encodeTo:function(t,r,o){if("object"==typeof o&&o instanceof e)o=o.value;else if("string"==typeof o)o=e.getValue(o);else{if("number"!=typeof o)throw new TypeError("Unsupported type.");e.getName(o)}return n(t,r,o)},decode:function(t,n){const o=r(t,n);return new e(o)}});for(const t in e.values())Object.defineProperty(o,t,{get:function(){return e[t]},enumerable:!1,configurable:!0});return o}function J(e){return Q(e,Y)}const Z=J(x),$=c({DefLevel:l,PropertyIndex:l},N),ee=new TextEncoder,te=new TextDecoder;function ne(e){return ee.encode(e)}function re(e,t,n){const r=t;for(;n--;){const n=e.getUint8(t);if(t++,!(n<=127)){if(n<194)throw new Error("Invalid UTF8 sequence.");if(t++,!(n<=223||(t++,n<=239||(t++,n<=244))))throw new Error("Invalid UTF8 sequence.")}}return t-r}const oe=a({isConstantLength:!1,encodedLength:function(e){if("string"!=typeof e)throw new TypeError("Expected string.");return 2+ne(e).byteLength},encodeTo:function(e,t,n){const r=function(e){let t=0;for(let n=0;n<e.length;n++,t++){const t=e.charCodeAt(n);if(t>=55296&&t<=56319){n++;const t=e.charCodeAt(n);if(t<56320||t>57343)throw new TypeError("Expected valid unicode string.")}}return t}(n);if(r>65535)throw new Error("String too long for OcaString OCP.1 encoding.");e.setUint16(t,r),t+=2;const o=new Uint8Array(ne(n));return new Uint8Array(e.buffer,e.byteOffset).set(o,t),t+o.length},decodeFrom:function(e,t){const n=e.getUint16(t),r=re(e,t+=2,n),o=new Uint8Array(e.buffer,e.byteOffset+t,r);return[t+r,(s=o,te.decode(s))];var s},decodeLength:function(e,t){const n=e.getUint16(t);return(t+=2)+re(e,t,n)}});const se=q("OcaRoot",1,"",2,class{constructor(e,t){this.ono=e,this.device=t}get ObjectNumber(){return this.ono}get ClassVersion(){return this.constructor.ClassVersion}get ClassID(){return this.constructor.ClassID}get ClassName(){return this.constructor.ClassName}sendCommandRrq(e,t,n,r,o){const s=new i(this.ono,e,t,n,r);return this.device.send_command(s,o)}GetPropertyName(e){return this.get_properties().find_name(e)}GetPropertyID(e){const t=this.get_properties().find_property(e);if(t)return t.GetPropertyID()}static get_properties(){return null}get_properties(){return this.constructor.get_properties()}get __oca_properties__(){return this.get_properties()}GetPropertySync(){return new(this.constructor.GetPropertySync())(this)}Dispose(){}},[["GetClassIdentification",1,1,[],[X]],["GetLockable",1,2,[],[H]],["LockTotal",1,3,[],[]],["Unlock",1,4,[],[]],["GetRole",1,5,[],[oe]],["LockReadonly",1,6,[],[]]],[["ClassID",[W],1,1,!0,!0,null],["ClassVersion",[l],1,2,!0,!0,null],["ObjectNumber",[d],1,3,!0,!1,null],["Lockable",[H],1,4,!0,!1,null],["Role",[oe],1,5,!0,!1,null]],[["PropertyChanged",1,1,[$,(ie=1,a({isConstantLength:!1,encodedLength:function(e){if(!("object"==typeof e&&e instanceof DataView))throw new TypeError("Expected DataView.");return e.byteLength-ie},encodeTo:function(e,t,n){const r=n.byteLength,o=new Uint8Array(n.buffer,n.byteOffset,r);return new Uint8Array(e.buffer,e.byteOffset+t).set(o),t+r},decodeFrom:function(e,t){const n=e.byteLength-t-ie;return[t+n,new DataView(e.buffer,e.byteOffset+t,n)]},decodeLength:function(e,t){return t+(e.byteLength-t-ie)}})),Z]]]);var ie;const ae=q("OcaManager",2,"",2,se,[],[],[]),ce=a({isConstantLength:!1,encodedLength:function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),!(Array.isArray(e)||e instanceof Uint8Array))throw new TypeError("Expected Array or Uint8Array");const t=e.length;if(t>65535)throw new Error("Array too long for OcaBlob OCP.1 encoding.");return 2+t},encodeTo:function(e,t,n){n instanceof ArrayBuffer&&(n=new Uint8Array(n));const r=n.length;e.setUint16(t,r),t+=2;return new Uint8Array(e.buffer,e.byteOffset).set(n,t),t+r},decodeFrom:function(e,t){const n=e.getUint16(t);return[(t+=2)+n,new Uint8Array(e.buffer,e.byteOffset+t,n)]},decodeLength:function(e,t){return t+2+e.getUint16(t)}});function le(e){return a({isConstantLength:!0,encodedLength:function(t){return e},encodeTo:function(t,n,r){if(!(Array.isArray(r)||r instanceof Uint8Array))throw new TypeError("Expected Array or Uint8Array");if(r.length!==e)throw new Error("Length mismatch.");return new Uint8Array(t.buffer,t.byteOffset).set(r,n),n+e},decode:function(t,n){return new Uint8Array(t.buffer,t.byteOffset+n,e)}})}const ue=l,he=ue;function de(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ge(e){return e.isConstantLength?function(e){const t=e.encodedLength(void 0),n=e.encodeTo,r=e.decode;return a({isConstantLength:!1,encodedLength:function(e){if(!Array.isArray(e)&&!de(e))throw new TypeError("Expected array.");const n=e.length;if(n>65535)throw new Error("Array too long for OcaList OCP.1 encoding");return 2+n*t},encodeTo:function(e,t,r){const o=r.length;e.setUint16(t,o),t+=2;for(let s=0;s<o;s++)t=n(e,t,r[s]);return t},decodeFrom:function(e,n){const o=e.getUint16(n);n+=2;const s=new Array(o);for(let i=0;i<o;i++)s[i]=r(e,n),n+=t;return[n,s]},decodeLength:function(e,n){return n+(2+e.getUint16(n)*t)}})}(e):function(e){const t=e.encodedLength,n=e.encodeTo,r=e.decodeFrom,o=e.decodeLength;return a({isConstantLength:!1,encodedLength:function(e){if(!Array.isArray(e)&&!de(e))throw new TypeError("Expected array.");const n=e.length;if(n>65535)throw new Error("Array too long for OcaList OCP.1 encoding");let r=2;for(let o=0;o<n;o++)r+=t(e[o]);return r},encodeTo:function(e,t,r){const o=r.length;e.setUint16(t,o),t+=2;for(let s=0;s<o;s++)t=n(e,t,r[s]);return t},decodeFrom:function(e,t){const n=e.getUint16(t);t+=2;const o=new Array(n);for(let s=0;s<n;s++){let n;[t,n]=r(e,t),o[s]=n}return[t,o]},decodeLength:function(e,t){const n=e.getUint16(t);t+=2;for(let r=0;r<n;r++)t=o(e,t);return t}})}(e)}class Se{constructor(e,t,n,r){this.ObjectNumber=e,this.Name=t,this.ClassID=n,this.ClassVersion=r}}const fe=c({ObjectNumber:d,Name:oe,ClassID:W,ClassVersion:l},Se);class pe{constructor(e,t,n){this.Manufacturer=e,this.Name=t,this.Version=n}}const me=c({Manufacturer:oe,Name:oe,Version:oe},pe);class Oe{constructor(e,t,n){this.Reserved=e,this.MfrCode=t,this.ModelCode=n}}const ye=c({Reserved:le(1),MfrCode:le(3),ModelCode:le(4)},Oe);class be extends(G({PowerOn:0,InternalError:1,Upgrade:2,ExternalRequest:3})){}const Ce=J(be),we=q("OcaDeviceManager",3,"",2,ae,[["GetOcaVersion",3,1,[],[l]],["GetModelGUID",3,2,[],[ye]],["GetSerialNumber",3,3,[],[oe]],["GetDeviceName",3,4,[],[oe]],["SetDeviceName",3,5,[oe],[]],["GetModelDescription",3,6,[],[me]],["GetDeviceRole",3,7,[],[oe]],["SetDeviceRole",3,8,[oe],[]],["GetUserInventoryCode",3,9,[],[oe]],["SetUserInventoryCode",3,10,[oe],[]],["GetEnabled",3,11,[],[H]],["SetEnabled",3,12,[H],[]],["GetState",3,13,[],[he]],["SetResetKey",3,14,[le(16),ce],[]],["GetResetCause",3,15,[],[Ce]],["ClearResetCause",3,16,[],[]],["GetMessage",3,17,[],[oe]],["SetMessage",3,18,[oe],[]],["GetManagers",3,19,[],[ge(fe)]],["GetDeviceRevisionID",3,20,[],[oe]]],[["ModelGUID",[ye],3,1,!1,!1,null],["SerialNumber",[oe],3,2,!1,!1,null],["ModelDescription",[me],3,3,!1,!1,null],["DeviceName",[oe],3,4,!1,!1,null],["OcaVersion",[l],3,5,!1,!1,null],["DeviceRole",[oe],3,6,!1,!1,null],["UserInventoryCode",[oe],3,7,!1,!1,null],["Enabled",[H],3,8,!1,!1,null],["State",[he],3,9,!1,!1,null],["Busy",[H],3,10,!1,!1,null],["ResetCause",[Ce],3,11,!1,!1,null],["Message",[oe],3,12,!1,!1,null],["Managers",[ge(fe)],3,13,!1,!1,null],["DeviceRevisionID",[oe],3,14,!0,!1,null]],[]),Pe=q("OcaSecurityManager",3,"",2,ae,[["AddPreSharedKey",3,4,[oe,ce],[]],["ChangePreSharedKey",3,3,[oe,ce],[]],["DeletePreSharedKey",3,5,[oe],[]],["DisableControlSecurity",3,2,[],[]],["EnableControlSecurity",3,1,[],[]]],[["secureControlData",[H],3,1,!1,!1,null]],[]);class Ge extends(G({BootLoader:0})){}const ve=Q(Ge,l);class _e{constructor(e,t,n,r){this.Major=e,this.Minor=t,this.Build=n,this.Component=r}}const De=c({Major:d,Minor:d,Build:d,Component:ve},_e),Te=q("OcaFirmwareManager",3,"",2,ae,[["GetComponentVersions",3,1,[],[ge(De)]],["StartUpdateProcess",3,2,[],[]],["BeginActiveImageUpdate",3,3,[ve],[]],["AddImageData",3,4,[d,ce],[]],["VerifyImage",3,5,[ce],[]],["EndActiveImageUpdate",3,6,[],[]],["BeginPassiveComponentUpdate",3,7,[ve,ce,oe],[]],["EndUpdateProcess",3,8,[],[]]],[["ComponentVersions",[ge(De)],3,1,!1,!1,null]],[]);class Ie{constructor(e,t){this.DefLevel=e,this.MethodIndex=t}}const Me=c({DefLevel:l,MethodIndex:l},Ie);class Ae{constructor(e,t){this.ONo=e,this.MethodID=t}}const Le=c({ONo:d,MethodID:Me},Ae);class Ee extends(G({Reliable:1,Fast:2})){}const ke=J(Ee);class xe extends(G({Normal:1,EventsDisabled:2})){}const Ue=J(xe),Ne=q("OcaSubscriptionManager",3,"",2,ae,[["RemoveSubscription",3,2,[S,Le],[]],["AddSubscription",3,1,[S,Le,ce,ke,ce],[]],["DisableNotifications",3,3,[],[]],["ReEnableNotifications",3,4,[],[]],["AddPropertyChangeSubscription",3,5,[d,$,Le,ce,ke,ce],[]],["RemovePropertyChangeSubscription",3,6,[d,$,Le],[]],["GetMaximumSubscriberContextLength",3,7,[],[l]]],[["State",[Ue],3,1,!1,!1,null]],[["NotificationsDisabled",3,1,[]],["SynchronizeState",3,2,[ge(d)]]]);class Re extends(G({None:0,Working:1,Standby:2,Off:3})){}const Fe=J(Re),Be=q("OcaPowerManager",3,"",2,ae,[["GetState",3,1,[],[Fe]],["SetState",3,2,[Fe],[]],["GetPowerSupplies",3,3,[],[ge(d)]],["GetActivePowerSupplies",3,4,[],[ge(d)]],["ExchangePowerSupply",3,5,[d,d,H],[]],["GetAutoState",3,6,[],[H]]],[["State",[Fe],3,1,!1,!1,null],["PowerSupplies",[ge(d)],3,2,!1,!1,null],["ActivePowerSupplies",[ge(d)],3,3,!1,!1,null],["AutoState",[H],3,4,!1,!1,null],["TargetState",[Fe],3,5,!1,!1,null]],[]),je=q("OcaNetworkManager",3,"",2,ae,[["GetNetworks",3,1,[],[ge(d)]],["GetStreamNetworks",3,2,[],[ge(d)]],["GetControlNetworks",3,3,[],[ge(d)]],["GetMediaTransportNetworks",3,4,[],[ge(d)]]],[["Networks",[ge(d)],3,1,!1,!1,null],["StreamNetworks",[ge(d)],3,2,!1,!1,null],["ControlNetworks",[ge(d)],3,3,!1,!1,null],["MediaTransportNetworks",[ge(d)],3,4,!1,!1,null]],[]);class Ve extends(G({None:0,Internal:1,Network:2,External:3})){}const ze=J(Ve),qe=q("OcaMediaClockManager",3,"",2,ae,[["GetClocks",3,1,[],[ge(d)]],["GetMediaClockTypesSupported",3,2,[],[ge(ze)]],["GetClock3s",3,3,[],[ge(d)]]],[["ClockSourceTypesSupported",[ge(ze)],3,1,!1,!1,["MediaClockTypesSupported"]],["Clocks",[ge(d)],3,2,!1,!1,null],["Clock3s",[ge(d)],3,3,!1,!1,null]],[]);class He{constructor(e,t){this.Library=e,this.ID=t}}const We=c({Library:d,ID:d},He);class Ke{constructor(e,t){this.Authority=e,this.ID=t}}const Xe=c({Authority:le(3),ID:d},Ke);class Ye{constructor(e,t){this.Type=e,this.ONo=t}}const Qe=c({Type:Xe,ONo:d},Ye),Je=q("OcaLibraryManager",3,"\b",2,ae,[["AddLibrary",3,1,[Xe],[Qe]],["DeleteLibrary",3,2,[d],[]],["GetLibraryCount",3,3,[Xe],[l]],["GetLibraryList",3,4,[Xe],[ge(Qe)]],["GetCurrentPatch",3,5,[],[We]],["ApplyPatch",3,6,[We],[]]],[["Libraries",[ge(Qe)],3,1,!1,!1,null],["CurrentPatch",[We],3,2,!1,!1,null]],[]),Ze=q("OcaAudioProcessingManager",3,"\t",2,ae,[],[],[]),$e="undefined"!=typeof BigInt,et=$e&&(BigInt(1)<<BigInt(64))-BigInt(1),tt=$e&&et>>BigInt(1),nt=$e&&-tt-BigInt(1),rt=$e&&(BigInt(1)<<BigInt(55))-BigInt(1);$e&&BigInt(1);function ot(){if(!$e)throw new Error("Missing BigInt support")}const st=a({isConstantLength:!0,encodedLength:function(e){return 8},encodeTo:function(e,t,n){if(ot(),!(n<=et&&n>=0))throw new TypeError("Uint64 out of range.");return e.setBigUint64(t,BigInt(n),!1),t+8},decode:function(e,t){ot();const n=e.getBigUint64(t,!1);return n<=Number.MAX_SAFE_INTEGER?Number(n):n}});class it{constructor(e,t,n){this.Negative=e,this.Seconds=t,this.Nanoseconds=n}}const at=c({Negative:H,Seconds:st,Nanoseconds:d},it),ct=q("OcaDeviceTimeManager",3,"\n",2,ae,[["GetDeviceTimeNTP",3,1,[],[st]],["SetDeviceTimeNTP",3,2,[st],[]],["GetTimeSources",3,3,[],[ge(d)]],["GetCurrentDeviceTimeSource",3,4,[],[d]],["SetCurrentDeviceTimeSource",3,5,[d],[]],["GetDeviceTimePTP",3,6,[],[at]],["SetDeviceTimePTP",3,7,[at],[]]],[["TimeSources",[ge(d)],3,1,!1,!1,null],["CurrentDeviceTimeSource",[d],3,2,!1,!1,null]],[]);function lt(e,t){const n=e.encodedLength,r=e.encodeTo,o=e.decodeFrom,s=e.decodeLength,i=t.encodedLength,c=t.encodeTo,l=t.decodeFrom,u=t.decodeLength;return a({isConstantLength:!1,encodedLength:function(e){if(!(e instanceof Map||e instanceof WeakMap))throw new TypeError("Expected Map or WeakMap");let t=2;return e.forEach((e,r)=>{t+=n(r),t+=i(e)}),t},encodeTo:function(e,t,n){return e.setUint16(t,n.size),t+=2,n.forEach((n,o)=>{t=r(e,t,o),t=c(e,t,n)}),t},decodeFrom:function(e,t){const n=new Map,r=e.getUint16(t);t+=2;for(let s=0;s<r;s++){let r,s;[t,r]=o(e,t),[t,s]=l(e,t),n.set(r,s)}if(n.size!==r)throw new Error("Key appeared twice in decoded Map.");return[t,n]},decodeLength:function(e,t){const n=e.getUint16(t);t+=2;for(let r=0;r<n;r++)t=s(e,t),t=u(e,t);return t}})}class ut extends(G({Absolute:1,Relative:2})){}const ht=J(ut);class dt{constructor(e,t,n,r,o,s,i,a,c){this.ID=e,this.Label=t,this.ProgramID=n,this.GroupID=r,this.TimeMode=o,this.TimeSourceONo=s,this.StartTime=i,this.Duration=a,this.ApplicationSpecificParameters=c}}const gt=c({ID:d,Label:oe,ProgramID:We,GroupID:l,TimeMode:ht,TimeSourceONo:d,StartTime:at,Duration:at,ApplicationSpecificParameters:ce},dt);class St extends(G({None:0,Prepare:1,Enable:2,Start:3,Stop:4,Abort:5,Disable:6,Clear:7})){}const ft=J(St);class pt extends(G({None:0,Enabled:1,Disabled:2})){}const mt=J(pt);class Ot extends(G({None:0,NotPrepared:1,Disabled:2,Enabled:3,Running:4,Completed:5,Failed:6,Stopped:7,Aborted:8})){}const yt=J(Ot);class bt{constructor(e,t,n){this.ID=e,this.State=t,this.ErrorCode=n}}const Ct=c({ID:d,State:yt,ErrorCode:l},bt),wt=q("OcaTaskManager",3,"\v",1,ae,[["Enable",3,1,[H],[]],["ControlAllTasks",3,2,[ft,ce],[]],["ControlTaskGroup",3,3,[l,ft,ce],[]],["ControlTask",3,4,[d,ft,ce],[]],["GetState",3,5,[],[mt]],["GetTaskStatuses",3,6,[],[Ct]],["GetTaskStatus",3,7,[d],[Ct]],["AddTask",3,8,[gt],[gt]],["GetTasks",3,9,[],[lt(d,gt)]],["GetTask",3,10,[d],[gt]],["SetTask",3,11,[d,gt],[]],["DeleteTask",3,12,[d],[]]],[["State",[mt],3,1,!1,!1,null],["Tasks",[lt(d,gt)],3,2,!1,!1,null]],[["TaskStateChanged",3,1,[d,We,Ct]]]),Pt=q("OcaCodingManager",3,"\f",1,ae,[["GetAvailableEncodingSchemes",3,1,[],[lt(l,oe)]],["GetAvailableDecodingSchemes",3,2,[],[lt(l,oe)]]],[["AvailableEncodingSchemes",[lt(l,oe)],3,1,!1,!1,null],["AvailableDecodingSchemes",[lt(l,oe)],3,2,!1,!1,null]],[]),Gt=q("OcaDiagnosticManager",3,"\r",1,ae,[["GetLockStatus",3,1,[d],[oe]]],[],[]),vt=a({isConstantLength:!0,encodedLength:function(e){return 4},encodeTo:function(e,t,n){return e.setFloat32(t,+n,!1),t+4},decode:function(e,t){return e.getFloat32(t,!1)}});class _t extends(G({Input:1,Output:2})){}const Dt=J(_t);class Tt{constructor(e,t){this.Mode=e,this.Index=t}}const It=c({Mode:Dt,Index:l},Tt);class Mt{constructor(e,t,n){this.Owner=e,this.ID=t,this.Name=n}}const At=c({Owner:d,ID:It,Name:oe},Mt),Lt=q("OcaWorker",2,"",2,se,[["GetEnabled",2,1,[],[H]],["SetEnabled",2,2,[H],[]],["AddPort",2,3,[oe,Dt],[It]],["DeletePort",2,4,[It],[]],["GetPorts",2,5,[],[ge(At)]],["GetPortName",2,6,[It],[oe]],["SetPortName",2,7,[It,oe],[]],["GetLabel",2,8,[],[oe]],["SetLabel",2,9,[oe],[]],["GetOwner",2,10,[],[d]],["GetLatency",2,11,[],[vt]],["SetLatency",2,12,[vt],[]],["GetPath",2,13,[],[ge(oe),ge(d)]]],[["Enabled",[H],2,1,!1,!1,null],["Ports",[ge(At)],2,2,!1,!1,null],["Label",[oe],2,3,!1,!1,null],["Owner",[d],2,4,!1,!1,null],["Latency",[vt],2,5,!1,!1,null]],[]);class Et{constructor(e,t){this.ONo=e,this.ClassIdentification=t}}const kt=c({ONo:d,ClassIdentification:X},Et);class xt{constructor(e,t){this.MemberObjectIdentification=e,this.ContainerObjectNumber=t}}const Ut=c({MemberObjectIdentification:kt,ContainerObjectNumber:d},xt);class Nt{constructor(e,t){this.Authority=e,this.ID=t}}const Rt=c({Authority:le(3),ID:d},Nt);class Ft{constructor(e,t){this.TargetBlockType=e,this.ParData=t}}const Bt=c({TargetBlockType:d,ParData:ce},Ft);class jt{constructor(e,t,n,r,o){this.ONo=e,this.ClassIdentification=t,this.ContainerPath=n,this.Role=r,this.Label=o}}const Vt=c({ONo:d,ClassIdentification:X,ContainerPath:ge(d),Role:oe,Label:oe},jt),zt=ue;class qt{constructor(e,t){this.SourcePort=e,this.SinkPort=t}}const Ht=c({SourcePort:At,SinkPort:At},qt);class Wt extends(G({Exact:0,Substring:1,Contains:2,ExactCaseInsensitive:3,SubstringCaseInsensitive:4,ContainsCaseInsensitive:5})){}const Kt=J(Wt),Xt=q("OcaBlock",3,"",2,Lt,[["GetType",3,1,[],[d]],,["ConstructMemberUsingFactory",3,3,[d],[d]],["DeleteMember",3,4,[d],[]],["GetMembers",3,5,[],[ge(kt)]],["GetMembersRecursive",3,6,[],[ge(Ut)]],["AddSignalPath",3,7,[Ht],[l]],["DeleteSignalPath",3,8,[l],[]],["GetSignalPaths",3,9,[],[lt(l,Ht)]],["GetSignalPathsRecursive",3,10,[],[lt(l,Ht)]],["GetMostRecentParamSetIdentifier",3,11,[],[We]],["ApplyParamSet",3,12,[],[We]],["GetCurrentParamSetData",3,13,[],[Bt]],["StoreCurrentParamSetData",3,14,[We],[]],["GetGlobalType",3,15,[],[Rt]],["GetONoMap",3,16,[],[lt(d,d)]],["FindObjectsByRole",3,17,[oe,Kt,W,zt],[ge(Vt)]],["FindObjectsByRoleRecursive",3,18,[oe,Kt,W,zt],[ge(Vt)]],["FindObjectsByPath",3,20,[ge(oe),zt],[ge(Vt)]],["FindObjectsByLabelRecursive",3,19,[oe,Kt,W,zt],[ge(Vt)]]],[["Type",[d],3,1,!0,!1,null],["Members",[ge(kt)],3,2,!1,!1,null],["SignalPaths",[lt(l,Ht)],3,3,!1,!1,null],["MostRecentParamSetIdentifier",[We],3,4,!1,!1,null],["GlobalType",[Rt],3,5,!0,!1,null],["ONoMap",[lt(d,d)],3,6,!0,!1,null]],[]),Yt=q("OcaActuator",3,"",2,Lt,[],[],[]);class Qt extends(G({Muted:1,Unmuted:2})){}const Jt=J(Qt),Zt=q("OcaMute",4,"",2,Yt,[["GetState",4,1,[],[Jt]],["SetState",4,2,[Jt],[]]],[["State",[Jt],4,1,!1,!1,null]],[]);class $t extends(G({NonInverted:1,Inverted:2})){}const en=J($t),tn=q("OcaPolarity",4,"",2,Yt,[["GetState",4,1,[],[en]],["SetState",4,2,[en],[]]],[["State",[en],4,1,!1,!1,null]],[]),nn=q("OcaSwitch",4,"",2,Yt,[["GetPosition",4,1,[],[l,l,l]],["SetPosition",4,2,[l],[]],["GetPositionName",4,3,[l],[oe]],["SetPositionName",4,4,[l,oe],[]],["GetPositionNames",4,5,[],[ge(oe)]],["SetPositionNames",4,6,[ge(oe)],[]],["GetPositionEnabled",4,7,[l],[H]],["SetPositionEnabled",4,8,[l,H],[]],["GetPositionEnableds",4,9,[],[ge(H)]],["SetPositionEnableds",4,10,[ge(H)],[]]],[["Position",[l],4,1,!1,!1,null],["PositionNames",[ge(oe)],4,2,!1,!1,null],["PositionEnableds",[ge(H)],4,3,!1,!1,null]],[]),rn=q("OcaGain",4,"",2,Yt,[["GetGain",4,1,[],[vt,vt,vt]],["SetGain",4,2,[vt],[]]],[["Gain",[vt],4,1,!1,!1,null]],[]),on=q("OcaPanBalance",4,"",2,Yt,[["GetPosition",4,1,[],[vt,vt,vt]],["SetPosition",4,2,[vt],[]],["GetMidpointGain",4,3,[],[vt,vt,vt]],["SetMidpointGain",4,4,[vt],[]]],[["Position",[vt],4,1,!1,!1,null],["MidpointGain",[vt],4,2,!1,!1,null]],[]),sn=q("OcaDelay",4,"",2,Yt,[["GetDelayTime",4,1,[],[vt,vt,vt]],["SetDelayTime",4,2,[vt],[]]],[["DelayTime",[vt],4,1,!1,!1,null]],[]);class an extends(G({Time:1,Distance:2,Samples:3,Microseconds:4,Milliseconds:5,Centimeters:6,Inches:7,Feet:8})){}const cn=J(an);class ln{constructor(e,t){this.DelayValue=e,this.DelayUnit=t}}const un=c({DelayValue:vt,DelayUnit:cn},ln),hn=q("OcaDelayExtended",5,"",2,sn,[["GetDelayValue",5,1,[],[un,un,un]],["SetDelayValue",5,2,[un],[]],["GetDelayValueConverted",5,3,[cn],[un]]],[["DelayValue",[un],5,1,!1,!1,null]],[]),dn=q("OcaFrequencyActuator",4,"\b",2,Yt,[["GetFrequency",4,1,[],[vt,vt,vt]],["SetFrequency",4,2,[vt],[]]],[["Frequency",[vt],4,1,!1,!1,null]],[]),gn=l;class Sn extends(G({Butterworth:1,Bessel:2,Chebyshev:3,LinkwitzRiley:4})){}const fn=J(Sn);class pn extends(G({HiPass:1,LowPass:2,BandPass:3,BandReject:4,AllPass:5})){}const mn=J(pn),On=q("OcaFilterClassical",4,"\t",2,Yt,[["GetFrequency",4,1,[],[vt,vt,vt]],["SetFrequency",4,2,[vt],[]],["GetPassband",4,3,[],[mn]],["SetPassband",4,4,[mn],[]],["GetShape",4,5,[],[fn]],["SetShape",4,6,[fn],[]],["GetOrder",4,7,[],[l,l,l]],["SetOrder",4,8,[l],[]],["GetParameter",4,9,[],[vt,vt,vt]],["SetParameter",4,10,[vt],[]],["SetMultiple",4,11,[gn,vt,mn,fn,l,vt],[]]],[["Frequency",[vt],4,1,!1,!1,null],["Passband",[mn],4,2,!1,!1,null],["Shape",[fn],4,3,!1,!1,null],["Order",[l],4,4,!1,!1,null],["Parameter",[vt],4,5,!1,!1,null]],[]);class yn extends(G({None:0,PEQ:1,LowShelv:2,HighShelv:3,LowPass:4,HighPass:5,BandPass:6,AllPass:7,Notch:8,ToneControlLowFixed:9,ToneControlLowSliding:10,ToneControlHighFixed:11,ToneControlHighSliding:12})){}const bn=J(yn),Cn=q("OcaFilterParametric",4,"\n",2,Yt,[["GetFrequency",4,1,[],[vt,vt,vt]],["SetFrequency",4,2,[vt],[]],["GetShape",4,3,[],[bn]],["SetShape",4,4,[bn],[]],["GetWidthParameter",4,5,[],[vt,vt,vt]],["SetWidthParameter",4,6,[vt],[]],["GetInbandGain",4,7,[],[vt,vt,vt]],["SetInbandGain",4,8,[vt],[]],["GetShapeParameter",4,9,[],[vt,vt,vt]],["SetShapeParameter",4,10,[vt],[]],["SetMultiple",4,11,[gn,vt,bn,vt,vt,vt],[]]],[["Frequency",[vt],4,1,!1,!1,null],["Shape",[bn],4,2,!1,!1,null],["WidthParameter",[vt],4,3,!1,!1,["Q"]],["InbandGain",[vt],4,4,!1,!1,null],["ShapeParameter",[vt],4,5,!1,!1,null]],[]),wn=q("OcaFilterPolynomial",4,"\v",2,Yt,[["GetCoefficients",4,1,[],[ge(vt),ge(vt)]],["SetCoefficients",4,2,[ge(vt),ge(vt)],[]],["GetSampleRate",4,3,[],[vt,vt,vt]],["SetSampleRate",4,4,[vt],[]],["GetMaxOrder",4,5,[],[Y]]],[["A",[ge(vt)],4,1,!1,!1,null],["B",[ge(vt)],4,2,!1,!1,null],["SampleRate",[vt],4,3,!1,!1,null],["MaxOrder",[Y],4,4,!0,!1,null]],[]),Pn=q("OcaFilterFIR",4,"\f",2,Yt,[["GetLength",4,1,[],[d,d,d]],["GetCoefficients",4,2,[],[ge(vt)]],["SetCoefficients",4,3,[ge(vt)],[]],["GetSampleRate",4,4,[],[vt,vt,vt]],["SetSampleRate",4,5,[vt],[]]],[["Length",[d],4,1,!1,!1,null],["Coefficients",[ge(vt)],4,2,!1,!1,null],["SampleRate",[vt],4,3,!1,!1,null]],[]);class Gn{constructor(e,t,n){this.Frequency=e,this.Amplitude=t,this.Phase=n}}const vn=c({Frequency:ge(vt),Amplitude:ge(vt),Phase:ge(vt)},Gn),_n=q("OcaFilterArbitraryCurve",4,"\r",2,Yt,[["GetTransferFunction",4,1,[],[vn]],["SetTransferFunction",4,2,[vn],[]],["GetSampleRate",4,3,[],[vt,vt,vt]],["SetSampleRate",4,4,[vt],[]],["GetTFMinLength",4,5,[],[l]],["GetTFMaxLength",4,6,[],[l]]],[["TransferFunction",[vn],4,1,!1,!1,null],["SampleRate",[vt],4,2,!1,!1,null],["TFMinLength",[l],4,3,!1,!1,null],["TFMaxLength",[l],4,4,!1,!1,null]],[]);class Dn{constructor(e,t){this.Value=e,this.Ref=t}}const Tn=c({Value:vt,Ref:vt},Dn);class In extends(G({None:0,Compress:1,Limit:2,Expand:3,Gate:4})){}const Mn=J(In);class An extends(G({None:0,RMS:1,Peak:2})){}const Ln=J(An);class En extends(G({dBu:0,dBV:1,V:2})){}const kn=J(En),xn=q("OcaDynamics",4,"",2,Yt,[["GetTriggered",4,1,[],[H]],["GetDynamicGain",4,2,[],[vt]],["GetFunction",4,3,[],[Mn]],["SetFunction",4,4,[Mn],[]],["GetRatio",4,5,[],[vt,vt,vt]],["SetRatio",4,6,[vt],[]],["GetThreshold",4,7,[],[Tn,vt,vt]],["SetThreshold",4,8,[Tn],[]],["GetThresholdPresentationUnits",4,9,[],[kn]],["SetThresholdPresentationUnits",4,10,[kn],[]],["GetDetectorLaw",4,11,[],[Ln]],["SetDetectorLaw",4,12,[Ln],[]],["GetAttackTime",4,13,[],[vt,vt,vt]],["SetAttackTime",4,14,[vt],[]],["GetReleaseTime",4,15,[],[vt,vt,vt]],["SetReleaseTime",4,16,[vt],[]],["GetHoldTime",4,17,[],[vt,vt,vt]],["SetHoldTime",4,18,[vt],[]],["GetDynamicGainFloor",4,19,[],[vt,vt,vt]],["SetDynamicGainFloor",4,20,[vt],[]],["GetDynamicGainCeiling",4,21,[],[vt,vt,vt]],["SetDynamicGainCeiling",4,22,[vt],[]],["GetKneeParameter",4,23,[],[vt,vt,vt]],["SetKneeParameter",4,24,[vt],[]],["GetSlope",4,25,[],[vt,vt,vt]],["SetSlope",4,26,[vt],[]],["SetMultiple",4,27,[gn,Mn,Tn,kn,Ln,vt,vt,vt,vt,vt,vt,vt],[]]],[["Triggered",[H],4,1,!1,!1,null],["DynamicGain",[vt],4,2,!1,!1,null],["Function",[Mn],4,3,!1,!1,null],["Ratio",[vt],4,4,!1,!1,null],["Threshold",[Tn],4,5,!1,!1,null],["ThresholdPresentationUnits",[kn],4,6,!1,!1,null],["DetectorLaw",[Ln],4,7,!1,!1,null],["AttackTime",[vt],4,8,!1,!1,null],["ReleaseTime",[vt],4,9,!1,!1,null],["HoldTime",[vt],4,10,!1,!1,null],["DynamicGainCeiling",[vt],4,11,!1,!1,null],["DynamicGainFloor",[vt],4,12,!1,!1,null],["KneeParameter",[vt],4,13,!1,!1,null],["Slope",[vt],4,14,!1,!1,null]],[]),Un=q("OcaDynamicsDetector",4,"",2,Yt,[["GetLaw",4,1,[],[Ln]],["SetLaw",4,2,[Ln],[]],["GetAttackTime",4,3,[],[vt,vt,vt]],["SetAttackTime",4,4,[vt],[]],["GetReleaseTime",4,5,[],[vt,vt,vt]],["SetReleaseTime",4,6,[vt],[]],["GetHoldTime",4,7,[],[vt,vt,vt]],["SetHoldTime",4,8,[vt],[]],["SetMultiple",4,9,[gn,Ln,vt,vt,vt],[]]],[["Law",[Ln],4,1,!1,!1,null],["AttackTime",[vt],4,2,!1,!1,null],["ReleaseTime",[vt],4,3,!1,!1,null],["HoldTime",[vt],4,4,!1,!1,null]],[]),Nn=q("OcaDynamicsCurve",4,"",2,Yt,[["GetNSegments",4,1,[],[Y,Y,Y]],["SetNSegments",4,2,[Y],[]],["GetThreshold",4,3,[],[ge(Tn),vt,vt]],["SetThreshold",4,4,[ge(Tn)],[]],["GetSlope",4,5,[],[ge(vt),ge(vt),ge(vt)]],["SetSlope",4,6,[ge(vt)],[]],["GetKneeParameter",4,7,[],[ge(vt),ge(vt),ge(vt)]],["SetKneeParameter",4,8,[ge(vt)],[]],["GetDynamicGainCeiling",4,9,[],[vt,vt,vt]],["SetDynamicGainCeiling",4,10,[vt],[]],["GetDynamicGainFloor",4,11,[],[vt,vt,vt]],["SetDynamicGainFloor",4,12,[vt],[]],["SetMultiple",4,13,[gn,Y,ge(Tn),ge(vt),ge(vt),vt,vt],[]]],[["NSegments",[Y],4,1,!1,!1,null],["Threshold",[ge(Tn)],4,2,!1,!1,null],["Slope",[ge(vt)],4,3,!1,!1,null],["KneeParameter",[ge(vt)],4,4,!1,!1,null],["DynamicGainFloor",[vt],4,5,!1,!1,null],["DynamicGainCeiling",[vt],4,6,!1,!1,null]],[]);class Rn extends(G({Linear:1,Logarithmic:2,None:0})){}const Fn=J(Rn);class Bn extends(G({None:0,DC:1,Sine:2,Square:3,Impulse:4,NoisePink:5,NoiseWhite:6,PolarityTest:7})){}const jn=J(Bn),Vn=q("OcaSignalGenerator",4,"",2,Yt,[["GetFrequency1",4,1,[],[vt,vt,vt]],["SetFrequency1",4,2,[vt],[]],["GetFrequency2",4,3,[],[vt,vt,vt]],["SetFrequency2",4,4,[vt],[]],["GetLevel",4,5,[],[vt,vt,vt]],["SetLevel",4,6,[vt],[]],["GetWaveform",4,7,[],[jn]],["SetWaveform",4,8,[jn],[]],["GetSweepType",4,9,[],[Fn]],["SetSweepType",4,10,[Fn],[]],["GetSweepTime",4,11,[],[vt,vt,vt]],["SetSweepTime",4,12,[vt],[]],["GetSweepRepeat",4,13,[],[H]],["SetSweepRepeat",4,14,[H],[]],["GetGenerating",4,15,[],[H]],["Start",4,16,[],[]],["Stop",4,17,[],[]],["SetMultiple",4,18,[gn,vt,vt,vt,jn,Fn,vt,H],[]]],[["Frequency1",[vt],4,1,!1,!1,null],["Frequency2",[vt],4,2,!1,!1,null],["Level",[vt],4,3,!1,!1,null],["Waveform",[jn],4,4,!1,!1,null],["SweepType",[Fn],4,5,!1,!1,null],["SweepTime",[vt],4,6,!1,!1,null],["SweepRepeat",[H],4,7,!1,!1,null],["Generating",[H],4,8,!1,!1,null]],[]),zn=q("OcaSignalInput",4,"",2,Yt,[],[],[]),qn=q("OcaSignalOutput",4,"",2,Yt,[],[],[]),Hn=q("OcaTemperatureActuator",4,"",2,Yt,[["GetTemperature",4,1,[],[vt,vt,vt]],["SetTemperature",4,2,[vt],[]]],[["Temperature",[vt],4,1,!1,!1,null]],[]),Wn=q("OcaIdentificationActuator",4,"",2,Yt,[["GetActive",4,1,[],[H]],["SetActive",4,2,[H],[]]],[["Active",[H],4,1,!1,!1,null]],[]),Kn=q("OcaSummingPoint",4,"",1,Yt,[],[],[]),Xn=q("OcaBasicActuator",4,"",2,Yt,[],[],[]),Yn=q("OcaBooleanActuator",5,"",2,Xn,[["GetSetting",5,1,[],[H]],["SetSetting",5,2,[H],[]]],[["Setting",[H],5,1,!1,!1,null]],[]),Qn=a({isConstantLength:!0,encodedLength:function(e){return 1},encodeTo:function(e,t,n){return e.setInt8(t,0|n),t+1},decode:function(e,t){return e.getInt8(t)}}),Jn=q("OcaInt8Actuator",5,"",2,Xn,[["GetSetting",5,1,[],[Qn,Qn,Qn]],["SetSetting",5,2,[Qn],[]]],[["Setting",[Qn],5,1,!1,!1,null]],[]),Zn=a({isConstantLength:!0,encodedLength:function(e){return 2},encodeTo:function(e,t,n){return e.setInt16(t,0|n,!1),t+2},decode:function(e,t){return e.getInt16(t,!1)}}),$n=q("OcaInt16Actuator",5,"",2,Xn,[["GetSetting",5,1,[],[Zn,Zn,Zn]],["SetSetting",5,2,[Zn],[]]],[["Setting",[Zn],5,1,!1,!1,null]],[]),er=a({isConstantLength:!0,encodedLength:function(e){return 4},encodeTo:function(e,t,n){return e.setInt32(t,0|n,!1),t+4},decode:function(e,t){return e.getInt32(t,!1)}}),tr=q("OcaInt32Actuator",5,"",2,Xn,[["GetSetting",5,1,[],[er,er,er]],["SetSetting",5,2,[er],[]]],[["Setting",[er],5,1,!1,!1,null]],[]);function nr(){if(!$e)throw new Error("Missing BigInt support")}const rr=a({isConstantLength:!0,encodedLength:function(e){return 8},encodeTo:function(e,t,n){if(nr(),!(n>=nt&&n<=tt))throw new TypeError("Int64 out of range.");return e.setBigInt64(t,BigInt(n),!1),t+8},decode:function(e,t){nr();const n=e.getBigInt64(t,!1);return n>=Number.MIN_SAFE_INTEGER&&n<=Number.MAX_SAFE_INTEGER?Number(n):n}}),or=q("OcaInt64Actuator",5,"",2,Xn,[["GetSetting",5,1,[],[rr,rr,rr]],["SetSetting",5,2,[rr],[]]],[["Setting",[rr],5,1,!1,!1,null]],[]),sr=q("OcaUint8Actuator",5,"",2,Xn,[["GetSetting",5,1,[],[Y,Y,Y]],["SetSetting",5,2,[Y],[]]],[["Setting",[Y],5,1,!1,!1,null]],[]),ir=q("OcaUint16Actuator",5,"",2,Xn,[["GetSetting",5,1,[],[l,l,l]],["SetSetting",5,2,[l],[]]],[["Setting",[l],5,1,!1,!1,null]],[]),ar=q("OcaUint32Actuator",5,"\b",2,Xn,[["GetSetting",5,1,[],[d,d,d]],["SetSetting",5,2,[d],[]]],[["Setting",[d],5,1,!1,!1,null]],[]),cr=q("OcaUint64Actuator",5,"\t",2,Xn,[["GetSetting",5,1,[],[st,st,st]],["SetSetting",5,2,[st],[]]],[["Setting",[st],5,1,!1,!1,null]],[]),lr=q("OcaFloat32Actuator",5,"\n",2,Xn,[["GetSetting",5,1,[],[vt,vt,vt]],["SetSetting",5,2,[vt],[]]],[["Setting",[vt],5,1,!1,!1,null]],[]),ur=a({isConstantLength:!0,encodedLength:function(e){return 8},encodeTo:function(e,t,n){return e.setFloat64(t,+n,!1),t+8},decode:function(e,t){return e.getFloat64(t,!1)}}),hr=q("OcaFloat64Actuator",5,"\v",2,Xn,[["GetSetting",5,1,[],[ur,ur,ur]],["SetSetting",5,2,[ur],[]]],[["Setting",[ur],5,1,!1,!1,null]],[]),dr=q("OcaStringActuator",5,"\f",2,Xn,[["GetSetting",5,1,[],[oe]],["SetSetting",5,2,[oe],[]],["GetMaxLen",5,3,[],[l]]],[["Setting",[oe],5,1,!1,!1,null],["MaxLen",[l],5,2,!0,!1,null]],[]);function gr(e){return e+7>>3}function Sr(e,t,n){const r=new Array(n),o=gr(n),s=new Uint8Array(e.buffer,e.byteOffset+t,o);for(let e=0;e<n;e++)r[e]=!!(s[e>>3]&128>>(7&e));return r}const fr=a({isConstantLength:!1,encodedLength:function(e){if(!Array.isArray(e))throw new TypeError("Expected Array.");const t=e.length;if(t>65535)throw new Error("Array too long for OcaBlob OCP.1 encoding.");return 2+(t+7>>3)},encodeTo:function(e,t,n){const r=n.length;return e.setUint16(t,r),function(e,t,n){const r=n.length,o=gr(r),s=new Uint8Array(e.buffer,e.byteOffset+t,o);for(let e=0,t=0;t<o;t++){let o=0;for(let t=0;t<8&&e<r;t++,e++)n[e]&&(o|=128>>t);s[t]=o}return t+o}(e,t+=2,n)},decodeFrom:function(e,t){const n=e.getUint16(t);return[(t+=2)+gr(n),Sr(e,t,n)]},decodeLength:function(e,t){return t+2+gr(e.getUint16(t))}}),pr=q("OcaBitstringActuator",5,"\r",2,Xn,[["GetNrBits",5,1,[],[l]],["GetBit",5,2,[l],[H]],["SetBit",5,3,[l,H],[]],["GetBitstring",5,4,[],[fr]],["SetBitstring",5,5,[fr],[]]],[["Bitstring",[fr],5,1,!1,!1,null]],[]);class mr extends(G({Unknown:0,Valid:1,Underrange:2,Overrange:3,Error:4})){}const Or=J(mr),yr=q("OcaSensor",3,"",2,Lt,[["GetReadingState",3,1,[],[Or]]],[["ReadingState",[Or],3,1,!1,!1,null]],[]),br=q("OcaLevelSensor",4,"",2,yr,[["GetReading",4,1,[],[vt,vt,vt]]],[["Reading",[vt],4,1,!1,!1,null]],[]);class Cr extends(G({VU:1,StandardVU:2,PPM1:3,PPM2:4,LKFS:5,RMS:6,Peak:7,ProprietaryValueBase:128})){}const wr=J(Cr),Pr=q("OcaAudioLevelSensor",5,"",2,br,[["GetLaw",5,1,[],[wr]],["SetLaw",5,2,[wr],[]]],[["Law",[wr],5,1,!1,!1,null]],[]),Gr=q("OcaTimeIntervalSensor",4,"",2,yr,[["GetReading",4,1,[],[vt,vt,vt]]],[["Reading",[vt],4,1,!1,!1,null]],[]),vr=q("OcaFrequencySensor",4,"",2,yr,[["GetReading",4,1,[],[vt,vt,vt]]],[["Reading",[vt],4,1,!1,!1,null]],[]),_r=q("OcaTemperatureSensor",4,"",2,yr,[["GetReading",4,1,[],[vt,vt,vt]]],[["Reading",[vt],4,1,!1,!1,null]],[]),Dr=q("OcaIdentificationSensor",4,"",2,yr,[],[],[["Identify",4,1,[]]]),Tr=q("OcaVoltageSensor",4,"",1,yr,[["GetReading",4,1,[],[vt,vt,vt]]],[["Reading",[vt],4,1,!1,!1,null]],[]),Ir=q("OcaCurrentSensor",4,"\b",1,yr,[["GetReading",4,1,[],[vt,vt,vt]]],[["Reading",[vt],4,1,!1,!1,null]],[]);class Mr{constructor(e,t){this.Magnitude=e,this.Phase=t}}const Ar=c({Magnitude:vt,Phase:vt},Mr),Lr=q("OcaImpedanceSensor",4,"\t",1,yr,[["GetReading",4,1,[],[Ar,Ar,Ar]]],[["Reading",[Ar],4,1,!1,!1,null]],[]),Er=q("OcaGainSensor",4,"\n",1,yr,[["GetReading",4,1,[],[vt,vt,vt]]],[["Reading",[vt],4,1,!1,!1,null]],[]),kr=q("OcaBasicSensor",4,"",2,yr,[],[],[]),xr=q("OcaBooleanSensor",5,"",2,kr,[["GetReading",5,1,[],[H]]],[["Reading",[H],5,1,!1,!1,null]],[]),Ur=q("OcaInt8Sensor",5,"",2,kr,[["GetReading",5,1,[],[Qn,Qn,Qn]]],[["Reading",[Qn],5,1,!1,!1,null]],[]),Nr=q("OcaInt16Sensor",5,"",2,kr,[["GetReading",5,1,[],[Zn,Zn,Zn]]],[["Reading",[Zn],5,1,!1,!1,null]],[]),Rr=q("OcaInt32Sensor",5,"",2,kr,[["GetReading",5,1,[],[er,er,er]]],[["Reading",[er],5,1,!1,!1,null]],[]),Fr=q("OcaInt64Sensor",5,"",2,kr,[["GetReading",5,1,[],[rr,rr,rr]]],[["Reading",[rr],5,1,!1,!1,null]],[]),Br=q("OcaUint8Sensor",5,"",2,kr,[["GetReading",5,1,[],[Y,Y,Y]]],[["Reading",[Y],5,1,!1,!1,null]],[]),jr=q("OcaUint16Sensor",5,"",2,kr,[["GetReading",5,1,[],[l,l,l]]],[["Reading",[l],5,1,!1,!1,null]],[]),Vr=q("OcaUint32Sensor",5,"\b",2,kr,[["GetReading",5,1,[],[d,d,d]]],[["Reading",[d],5,1,!1,!1,null]],[]),zr=q("OcaFloat32Sensor",5,"\n",2,kr,[["GetReading",5,1,[],[vt,vt,vt]]],[["Reading",[vt],5,1,!1,!1,null]],[]),qr=q("OcaFloat64Sensor",5,"\v",2,kr,[["GetReading",5,1,[],[ur,ur,ur]]],[["Reading",[ur],5,1,!1,!1,null]],[]),Hr=q("OcaStringSensor",5,"\f",2,kr,[["GetString",5,1,[],[oe]],["GetMaxLen",5,2,[],[l]],["SetMaxLen",5,3,[l],[]]],[["String",[oe],5,1,!1,!1,null],["MaxLen",[l],5,2,!1,!1,null]],[]),Wr=q("OcaBitstringSensor",5,"\r",2,kr,[["GetNrBits",5,1,[],[l]],["GetBit",5,2,[l],[Y]],["GetBitString",5,3,[],[fr]]],[["BitString",[fr],5,1,!1,!1,null]],[]),Kr=q("OcaUint64Sensor",5,"\t",2,kr,[["GetReading",5,1,[],[st,st,st]]],[["Reading",[st],5,1,!1,!1,null]],[]);class Xr{constructor(e,t){this.POno=e,this.ClassIdentification=t}}const Yr=c({POno:d,ClassIdentification:X},Xr);class Qr{constructor(e,t){this.Mode=e,this.Index=t}}const Jr=c({Mode:Dt,Index:l},Qr);class Zr{constructor(e,t,n){this.Owner=e,this.ProtoID=t,this.Name=n}}const $r=c({Owner:d,ProtoID:Jr,Name:oe},Zr);class eo{constructor(e,t){this.SourceProtoPort=e,this.SinkProtoPort=t}}const to=c({SourceProtoPort:$r,SinkProtoPort:$r},eo),no=q("OcaBlockFactory",3,"",2,Lt,[["DefineProtoPort",3,1,[oe,Dt],[Jr]],["UndefineProtoPort",3,2,[Jr],[]],["GetProtoPorts",3,3,[],[ge($r)]],,["DefineProtoMemberUsingFactory",3,5,[d],[d]],["UndefineProtoMember",3,6,[d],[]],["GetProtoMembers",3,7,[],[ge(Yr)]],["DefineProtoSignalPath",3,8,[to],[l]],["UndefineProtoSignalPath",3,9,[],[l]],["GetProtoSignalPaths",3,10,[],[lt(l,to)]],["GetGlobalType",3,11,[],[Rt]],["SetGlobalType",3,12,[Rt],[]]],[["ProtoPorts",[ge($r)],3,1,!1,!1,null],["ProtoMembers",[ge(Yr)],3,2,!1,!1,null],["ProtoSignalPaths",[lt(l,to)],3,3,!1,!1,null],["GlobalType",[Rt],3,4,!1,!1,null]],[]);function ro(e){return e.isConstantLength?function(e){const t=e.encodedLength(void 0),n=e.encodeTo,r=e.decode;return a({isConstantLength:!1,encodedLength:function(e){if(!Array.isArray(e)&&!de(e))throw new TypeError("Expected array.");const n=e.length;if(0===n)return 4;if(!Array.isArray(e[0])&&!de(e[0]))throw new TypeError("Expected array.");const r=e[0].length;if(n>65535||r>65535)throw new Error("Array too long for OcaList2D OCP.1 encoding");return 4+n*r*t},encodeTo:function(e,t,r){const o=r.length,s=0===o?0:r[0].length;e.setUint16(t,o),t+=2,e.setUint16(t,s),t+=2;for(let i=0;i<o;i++){const o=r[i];for(let r=0;r<s;r++)t=n(e,t,o[r])}return t},decodeFrom:function(e,n){const o=e.getUint16(n);n+=2;const s=e.getUint16(n);n+=2;const i=new Array(o).fill().map(()=>new Array(s));for(let a=0;a<o;a++){const o=i[a];for(let i=0;i<s;i++)o[i]=r(e,n),n+=t}return[n,i]},decodeLength:function(e,n){const r=e.getUint16(n);n+=2;const o=e.getUint16(n);return(n+=2)+r*o*t}})}(e):function(e){const t=e.encodedLength,n=e.encodeTo,r=e.decodeFrom,o=e.decodeLength;return a({isConstantLength:!1,encodedLength:function(e){if(!Array.isArray(e)&&!de(e))throw new TypeError("Expected array.");const n=e.length;if(0===n)return 4;if(!Array.isArray(e[0])&&!de(e[0]))throw new TypeError("Expected array.");const r=e[0].length;if(n>65535||r>65535)throw new Error("Array too long for OcaList2D OCP.1 encoding");let o=4;for(let s=0;s<n;s++){const n=e[s];for(let e=0;e<r;e++)o+=t(n[e])}return o},encodeTo:function(e,t,r){const o=r.length,s=0===o?0:r[0].length;e.setUint16(t,o),t+=2,e.setUint16(t,s),t+=2;for(let i=0;i<o;i++){const o=r[i];for(let r=0;r<s;r++)t=n(e,t,o[r])}return t},decodeFrom:function(e,t){const n=e.getUint16(t);t+=2;const o=e.getUint16(t);t+=2;const s=new Array(n).fill().map(()=>new Array(o));for(let i=0;i<n;i++){const n=s[i];for(let s=0;s<o;s++){let o;[t,o]=r(e,t),n[s]=o}}return[t,s]},decodeLength:function(e,t){const n=e.getUint16(t);t+=2;const r=e.getUint16(t);t+=2;for(let s=0;s<n;s++)for(let n=0;n<r;n++)t=o(e,t);return t}})}(e)}const oo=q("OcaMatrix",3,"",2,Lt,[["GetCurrentXY",3,1,[],[l,l]],["SetCurrentXY",3,2,[l,l],[]],["GetSize",3,3,[],[l,l,l,l,l,l]],["SetSize",3,4,[l,l],[]],["GetMembers",3,5,[],[ro(d)]],["SetMembers",3,6,[ro(d)],[]],["GetMember",3,7,[l,l],[d]],["SetMember",3,8,[l,l,d],[]],["GetProxy",3,9,[],[d]],["SetProxy",3,10,[d],[]],["GetPortsPerRow",3,11,[],[Y]],["SetPortsPerRow",3,12,[Y],[]],["GetPortsPerColumn",3,13,[],[Y]],["SetPortsPerColumn",3,14,[Y],[]],["SetCurrentXYLock",3,15,[l,l],[]],["UnlockCurrent",3,16,[],[]]],[["X",[l],3,1,!1,!1,null],["Y",[l],3,2,!1,!1,null],["xSize",[l],3,3,!1,!1,null],["ySize",[l],3,4,!1,!1,null],["Members",[ro(d)],3,5,!1,!1,null],["Proxy",[d],3,6,!1,!1,null],["PortsPerRow",[Y],3,7,!1,!1,null],["PortsPerColumn",[Y],3,8,!1,!1,null]],[]),so=q("OcaAgent",2,"",2,se,[["GetLabel",2,1,[],[oe]],["SetLabel",2,2,[oe],[]],["GetOwner",2,3,[],[d]],["GetPath",2,4,[],[ge(oe),ge(d)]]],[["Label",[oe],2,1,!1,!1,null],["Owner",[d],2,2,!1,!1,null]],[]);class io{constructor(e,t){this.HostID=e,this.ONo=t}}const ao=c({HostID:ce,ONo:d},io);class co{constructor(e,t,n){this.Index=e,this.ObjectPath=t,this.Online=n}}const lo=c({Index:l,ObjectPath:ao,Online:H},co);class uo{constructor(e,t){this.GroupIndex=e,this.CitizenIndex=t}}const ho=c({GroupIndex:l,CitizenIndex:l},uo);class go{constructor(e,t,n){this.Index=e,this.Name=t,this.ProxyONo=n}}const So=c({Index:l,Name:oe,ProxyONo:d},go);class fo extends(G({MasterSlave:1,PeerToPeer:2})){}const po=J(fo);class mo extends(G({citizenAdded:1,citizenDeleted:2,citizenConnectionLost:3,citizenConnectionReEstablished:4,citizenError:5,enrollment:6,unEnrollment:7})){}const Oo=J(mo),yo=q("OcaGrouper",3,"",2,so,[["AddGroup",3,1,[oe],[l,d]],["DeleteGroup",3,2,[l],[]],["GetGroupCount",3,3,[],[l]],["GetGroupList",3,4,[],[ge(So)]],["AddCitizen",3,5,[lo],[l]],["DeleteCitizen",3,6,[l],[]],["GetCitizenCount",3,7,[],[l]],["GetCitizenList",3,8,[],[ge(lo)]],["GetEnrollment",3,9,[ho],[H]],["SetEnrollment",3,10,[ho,H],[]],["GetGroupMemberList",3,11,[l],[ge(lo)]],["GetActuatorOrSensor",3,12,[],[H]],["SetActuatorOrSensor",3,13,[H],[]],["GetMode",3,14,[],[po]],["SetMode",3,15,[po],[]]],[["ActuatorOrSensor",[H],3,1,!1,!1,null],["Groups",[ge(So)],3,2,!1,!1,["GroupList"]],["Citizens",[ge(lo)],3,3,!1,!1,["CitizenList"]],["Enrollments",[ge(ho)],3,4,!1,!1,["EnrollmentList"]],["Mode",[po],3,5,!1,!1,null]],[["StatusChange",3,1,[l,l,Oo]]]);class bo extends(G({None:0,OcaBoolean:1,OcaInt8:2,OcaInt16:3,OcaInt32:4,OcaInt64:5,OcaUint8:6,OcaUint16:7,OcaUint32:8,OcaUint64:9,OcaFloat32:10,OcaFloat64:11,OcaString:12,OcaBitstring:13,OcaBlob:14,OcaBlobFixedLen:15,OcaBit:16})){}const Co=J(bo);class wo{constructor(e,t,n,r){this.PropertyID=e,this.BaseDataType=t,this.GetterMethodID=n,this.SetterMethodID=r}}const Po=c({PropertyID:$,BaseDataType:Co,GetterMethodID:Me,SetterMethodID:Me},wo);class Go{constructor(e,t){this.ONo=e,this.Descriptor=t}}const vo=c({ONo:d,Descriptor:Po},Go);class _o extends(G({Enable:1,Start:2,Halt:3})){}const Do=J(_o);class To extends(G({Linear:1,ReverseLinear:2,Sine:3,Exponential:4})){}const Io=J(To);class Mo extends(G({NotInitialized:1,Iniitialized:2,Scheduled:3,Enabled:4,Ramping:5})){}const Ao=J(Mo),Lo=q("OcaRamper",3,"",2,so,[["Control",3,1,[Do],[]],["GetState",3,2,[],[Ao]],["GetRampedProperty",3,3,[],[vo]],["SetRampedProperty",3,4,[vo],[]],["GetTimeMode",3,5,[],[ht]],["SetTimeMode",3,6,[ht],[]],["GetStartTime",3,7,[],[st]],["SetStartTime",3,8,[st],[]],["GetDuration",3,9,[],[vt,vt,vt]],["SetDuration",3,10,[vt],[]],["GetInterpolationLaw",3,11,[],[Io]],["SetInterpolationLaw",3,12,[Io],[]],["GetGoal",3,13,[],[ur]],["SetGoal",3,14,[ur],[]]],[["State",[Ao],3,1,!1,!1,null],["RampedProperty",[vo],3,2,!1,!1,null],["TimeMode",[ht],3,3,!1,!1,null],["StartTime",[st],3,4,!1,!1,null],["Duration",[vt],3,5,!1,!1,null],["InterpolationLaw",[Io],3,6,!1,!1,null],["Goal",[ur],3,7,!1,!1,null]],[]);class Eo extends(G({NotTriggered:0,Triggered:1})){}const ko=J(Eo);class xo extends(G({None:0,Equality:1,Inequality:2,GreaterThan:3,GreaterThanOrEqual:4,LessThan:5,LessThanOrEqual:6})){}const Uo=J(xo),No=q("OcaNumericObserver",3,"",2,so,[["GetLastObservation",3,1,[],[ur]],["GetState",3,2,[],[ko]],["GetObservedProperty",3,3,[],[vo]],["SetObservedProperty",3,4,[vo],[]],["GetThreshold",3,5,[],[ur]],["SetThreshold",3,6,[ur],[]],["GetOperator",3,7,[],[Uo]],["SetOperator",3,8,[Uo],[]],["GetTwoWay",3,9,[],[H]],["SetTwoWay",3,10,[H],[]],["GetHysteresis",3,11,[],[ur]],["SetHysteresis",3,12,[ur],[]],["GetPeriod",3,13,[],[vt]],["SetPeriod",3,14,[vt],[]]],[["State",[ko],3,1,!1,!1,null],["ObservedProperty",[vo],3,2,!1,!1,null],["Threshold",[ur],3,3,!1,!1,null],["Operator",[Uo],3,4,!1,!1,null],["TwoWay",[H],3,5,!1,!1,null],["Hysteresis",[ur],3,6,!1,!1,null],["Period",[vt],3,7,!1,!1,null]],[["Observation",3,1,[S,ur]]]);class Ro extends(G({None:0,ReadOnly:1,ReadExpand:2,Full:3})){}const Fo=J(Ro);class Bo{constructor(e,t,n,r,o,s){this.Name=e,this.VolType=t,this.Access=n,this.Version=r,this.Creator=o,this.UpDate=s}}const jo=c({Name:oe,VolType:Xe,Access:Fo,Version:d,Creator:oe,UpDate:at},Bo);class Vo{constructor(e,t){this.Metadata=e,this.Data=t}}const zo=c({Metadata:jo,Data:ce},Vo),qo=q("OcaLibrary",3,"",2,so,[["AddVolume",3,1,[zo],[d]],["ReplaceVolume",3,2,[d,zo],[]],["DeleteVolume",3,3,[d],[]],["GetVolume",3,4,[d],[zo]],["GetVolumeCount",3,5,[],[l]],["GetVolumes",3,6,[],[lt(d,zo)]],["GetAccess",3,7,[],[Fo]],["SetAccess",3,8,[Fo],[]]],[["VolumeType",[Xe],3,1,!1,!1,null],["Access",[Fo],3,2,!1,!1,null],["Volumes",[lt(d,zo)],3,3,!1,!1,null]],[["OcaLibVolChanged",3,1,[d,Z]]]);class Ho extends(G({Unspecified:1,Internal:2,External:3})){}const Wo=J(Ho);class Ko extends(G({Off:0,Unavailable:1,Available:2,Active:3})){}const Xo=J(Ko);class Yo extends(G({None:0,Mains:1,Battery:2,Phantom:3,Solar:4})){}const Qo=J(Yo),Jo=q("OcaPowerSupply",3,"",3,so,[["GetType",3,1,[],[Qo]],["GetModelInfo",3,2,[],[oe]],["GetState",3,3,[],[Xo]],["SetState",3,4,[Xo],[]],["GetCharging",3,5,[],[H]],["GetLoadFractionAvailable",3,6,[],[vt]],["GetStorageFractionAvailable",3,7,[],[vt]],["GetLocation",3,8,[],[Wo]]],[["Type",[Qo],3,1,!1,!1,null],["ModelInfo",[oe],3,2,!1,!1,null],["State",[Xo],3,3,!1,!1,null],["Charging",[H],3,4,!1,!1,null],["LoadFractionAvailable",[vt],3,5,!1,!1,null],["StorageFractionAvailable",[vt],3,6,!1,!1,null],["Location",[Wo],3,7,!0,!1,null]],[]),Zo=q("OcaEventHandler",3,"\b",2,so,[["OnEvent",3,1,[ce,S],[]]],[],[]),$o=q("OcaNumericObserverList",3,"\t",2,so,[["GetLastObservation",3,1,[],[ge(ur)]],["GetState",3,2,[],[ko]],["GetObservedProperties",3,3,[],[ge(vo)]],["SetObservedProperties",3,4,[ge(vo)],[]],["GetThreshold",3,5,[],[ur]],["SetThreshold",3,6,[ur],[]],["GetOperator",3,7,[],[Uo]],["SetOperator",3,8,[Uo],[]],["GetTwoWay",3,9,[],[H]],["SetTwoWay",3,10,[H],[]],["GetHysteresis",3,11,[],[ur]],["SetHysteresis",3,12,[ur],[]],["GetPeriod",3,13,[],[vt]],["SetPeriod",3,14,[vt],[]]],[["State",[ko],3,1,!1,!1,null],["ObservedProperties",[ge(vo)],3,2,!1,!1,null],["Threshold",[ur],3,3,!1,!1,null],["Operator",[Uo],3,4,!1,!1,null],["TwoWay",[H],3,5,!1,!1,null],["Hysteresis",[ur],3,6,!1,!1,null],["Period",[vt],3,7,!1,!1,null]],[["Observation",3,1,[S,ge(ur)]]]);class es extends(G({Unavailable:0,Available:1})){}const ts=J(es);class ns{constructor(e,t,n,r){this.NominalRate=e,this.PullRange=t,this.Accuracy=n,this.JitterMax=r}}const rs=c({NominalRate:vt,PullRange:vt,Accuracy:vt,JitterMax:vt},ns),os=q("OcaMediaClock3",3,"",1,so,[["GetAvailability",3,1,[],[ts]],["SetAvailability",3,2,[ts],[]],["GetCurrentRate",3,3,[],[rs,d]],["SetCurrentRate",3,4,[rs,d],[]],["GetOffset",3,5,[],[at]],["SetOffset",3,6,[at],[]],["GetSupportedRates",3,7,[],[lt(d,ge(rs))]]],[["Availability",[ts],3,1,!1,!1,null],["TimeSourceONo",[d],3,2,!1,!1,null],["Offset",[at],3,3,!1,!1,null],["CurrentRate",[rs],3,4,!1,!1,null],["SupportedRates",[lt(d,ge(rs))],3,5,!1,!1,null]],[]);class ss extends(G({Undefined:0,None:1,Private:2,NTP:3,SNTP:4,IEEE1588_2002:5,IEEE1588_2008:6,IEEE_AVB:7,AES11:8,Genlock:9})){}const is=J(ss);class as extends(G({Undefined:0,Local:1,Private:2,GPS:3,Galileo:4,GLONASS:5})){}const cs=J(as);class ls extends(G({Unavailable:0,Available:1})){}const us=J(ls);class hs extends(G({Undefined:0,Unsynchronized:1,Synchronizing:2,Synchronized:3})){}const ds=J(hs),gs=q("OcaTimeSource",3,"",1,so,[["GetAvailability",3,1,[],[us]],["GetProtocol",3,2,[],[is]],["SetProtocol",3,3,[is],[]],["GetParameters",3,4,[],[oe]],["SetParameters",3,5,[oe],[]],["GetReferenceType",3,6,[],[cs]],["SetReferenceType",3,7,[cs],[]],["GetReferenceID",3,8,[],[oe]],["SetReferenceID",3,9,[oe],[]],["GetSyncStatus",3,10,[],[ds]],["Reset",3,11,[],[]]],[["Availability",[us],3,1,!1,!1,null],["Protocol",[is],3,2,!1,!1,null],["Parameters",[oe],3,3,!1,!1,null],["ReferenceType",[cs],3,4,!1,!1,null],["ReferenceID",[oe],3,5,!1,!1,null],["SyncStatus",[ds],3,6,!1,!1,null]],[]);class Ss extends(G({Robotic:1,ItuAudioObjectBasedPolar:2,ItuAudioObjectBasedCartesian:3,ItuAudioSceneBasedPolar:4,ItuAudioSceneBasedCartesian:5,NAV:6,ProprietaryBase:128})){}const fs=J(Ss);class ps{constructor(e,t,n){this.CoordinateSystem=e,this.FieldFlags=t,this.Values=n}}const ms=c({CoordinateSystem:fs,FieldFlags:gn,Values:vt},ps),Os=q("OcaPhysicalPosition",3,"",1,so,[["GetCoordinateSystem",3,1,[],[fs]],["GetPositionDescriptorFieldFlags",3,2,[],[gn]],["GetPositionDescriptor",3,3,[],[ms,ms,ms]],["SetPositionDescriptor",3,4,[ms],[]]],[["CoordinateSystem",[fs],3,1,!0,!1,null],["PositionDescriptorFieldFlags",[gn],3,2,!0,!1,null],["PositionDescriptor",[ms],3,3,!1,!1,null]],[]);class ys extends(G({None:0,Prepare:1,Start:2,Pause:3,Stop:4,Reset:5})){}const bs=J(ys);class Cs extends(G({Unknown:0,NotReady:1,Readying:2,Ready:3,Running:4,Paused:5,Stopping:6,Stopped:7,Fault:8})){}const ws=J(Cs);class Ps{constructor(e,t){this.SystemInterfaceParameters=e,this.MyNetworkAddress=t}}const Gs=c({SystemInterfaceParameters:ce,MyNetworkAddress:ce},Ps),vs=q("OcaApplicationNetwork",2,"",1,se,[["GetLabel",2,1,[],[oe]],["SetLabel",2,2,[oe],[]],["GetOwner",2,3,[],[d]],["GetServiceID",2,4,[],[ce]],["SetServiceID",2,5,[ce],[]],["GetSystemInterfaces",2,6,[],[ge(Gs)]],["SetSystemInterfaces",2,7,[ge(Gs)],[]],["GetState",2,8,[],[ws]],["GetErrorCode",2,9,[],[l]],["Control",2,10,[bs],[]],["GetPath",2,11,[],[ge(oe),ge(d)]]],[["Label",[oe],2,1,!1,!0,null],["Owner",[d],2,2,!1,!0,null],["ServiceID",[ce],2,3,!1,!1,null],["SystemInterfaces",[ge(Gs)],2,4,!1,!1,null],["State",[ws],2,5,!1,!1,null],["ErrorCode",[l],2,6,!1,!1,null]],[]);class _s extends(G({None:0,OCP01:1,OCP02:2,OCP03:3})){}const Ds=J(_s),Ts=q("OcaControlNetwork",3,"",1,vs,[["GetControlProtocol",3,1,[],[Ds]]],[["Protocol",[Ds],3,1,!1,!1,["ControlProtocol"]]],[]);class Is{constructor(e,t,n){this.CodingSchemeID=e,this.CodecParameters=t,this.ClockONo=n}}const Ms=c({CodingSchemeID:l,CodecParameters:oe,ClockONo:d},Is);class As extends(G({None:0,Unicast:1,Multicast:2})){}const Ls=J(As);class Es{constructor(e,t,n,r){this.Secure=e,this.StreamParameters=t,this.StreamCastMode=n,this.StreamChannelCount=r}}const ks=c({Secure:H,StreamParameters:ce,StreamCastMode:Ls,StreamChannelCount:l},Es);class xs extends(G({None:0,Start:1,Pause:2})){}const Us=J(xs),Ns=Y;class Rs extends(G({Stopped:0,SettingUp:1,Running:2,Paused:3,Fault:4})){}const Fs=J(Rs);class Bs{constructor(e,t,n){this.ConnectorID=e,this.State=t,this.ErrorCode=n}}const js=c({ConnectorID:l,State:Fs,ErrorCode:l},Bs);function Vs(e,t){const n=e.encodedLength,r=e.encodeTo,o=e.decodeFrom,s=e.decodeLength,i=t.encodedLength,c=t.encodeTo,l=t.decodeFrom,u=t.decodeLength;return a({isConstantLength:!1,encodedLength:function(e){if(!(e instanceof Map||e instanceof WeakMap))throw new TypeError("Expected Map or WeakMap");let t=2;return e.forEach((e,r)=>{t+=n(r)*e.size,e.forEach(e=>{t+=i(e)})}),t},encodeTo:function(e,t,n){const o=t;let s=0;return t+=2,n.forEach((n,o)=>{s+=n.size,n.forEach(n=>{t=r(e,t,o),t=c(e,t,n)})}),e.setUint16(o,s),t},decodeFrom:function(e,t){const n=new Map,r=e.getUint16(t);t+=2;for(let s=0;s<r;s++){let r,s;[t,r]=o(e,t),[t,s]=l(e,t);let i=n.get(r);i||n.set(r,i=new Set),i.add(s)}return[t,n]},decodeLength:function(e,t){const n=e.getUint16(t);t+=2;for(let r=0;r<n;r++)t=s(e,t),t=u(e,t);return t}})}class zs{constructor(e,t,n,r,o,s,i,a,c){this.IDInternal=e,this.IDExternal=t,this.Connection=n,this.AvailableCodings=r,this.PinCount=o,this.ChannelPinMap=s,this.AlignmentLevel=i,this.AlignmentGain=a,this.CurrentCoding=c}}const qs=c({IDInternal:l,IDExternal:oe,Connection:ks,AvailableCodings:ge(Ms),PinCount:l,ChannelPinMap:Vs(l,It),AlignmentLevel:vt,AlignmentGain:vt,CurrentCoding:Ms},zs);class Hs{constructor(e,t,n,r,o,s,i,a){this.IDInternal=e,this.IDExternal=t,this.Connection=n,this.AvailableCodings=r,this.PinCount=o,this.ChannelPinMap=s,this.AlignmentLevel=i,this.CurrentCoding=a}}const Ws=c({IDInternal:l,IDExternal:oe,Connection:ks,AvailableCodings:ge(Ms),PinCount:l,ChannelPinMap:lt(l,It),AlignmentLevel:vt,CurrentCoding:Ms},Hs);class Ks extends(G({None:0,AV3:1,AVBTP:2,Dante:3,Cobranet:4,AES67:5,SMPTEAudio:6,LiveWire:7,ExtensionPoint:65})){}const Xs=J(Ks),Ys=q("OcaMediaTransportNetwork",3,"",1,vs,[["GetMediaProtocol",3,1,[],[Xs]],["GetPorts",3,2,[],[ge(At)]],["GetPortName",3,3,[It],[oe]],["SetPortName",3,4,[It,oe],[]],["GetMaxSourceConnectors",3,5,[],[l]],["GetMaxSinkConnectors",3,6,[],[l]],["GetMaxPinsPerConnector",3,7,[],[l]],["GetMaxPortsPerPin",3,8,[],[l]],["GetSourceConnectors",3,9,[],[ge(Ws)]],["GetSourceConnector",3,10,[l],[Ws]],["GetSinkConnectors",3,11,[],[ge(qs)]],["GetSinkConnector",3,12,[l],[qs]],["GetConnectorsStatuses",3,13,[],[ge(js)]],["GetConnectorStatus",3,14,[l],[js]],["AddSourceConnector",3,15,[Ws,Fs],[Ws]],["AddSinkConnector",3,16,[js,qs],[qs]],["ControlConnector",3,17,[l,Us],[]],["SetSourceConnectorPinMap",3,18,[l,lt(l,It)],[]],["SetSinkConnectorPinMap",3,19,[l,Vs(l,It)],[]],["SetConnectorConnection",3,20,[l,ks],[]],["SetConnectorCoding",3,21,[l,Ms],[]],["SetConnectorAlignmentLevel",3,22,[l,vt],[]],["SetConnectorAlignmentGain",3,23,[l,vt],[]],["DeleteConnector",3,24,[l],[]],["GetAlignmentLevel",3,25,[],[vt,vt,vt]],["GetAlignmentGain",3,26,[],[vt,vt,vt]]],[["Protocol",[Xs],3,1,!1,!1,["MediaProtocol"]],["Ports",[ge(At)],3,2,!1,!1,null],["MaxSourceConnectors",[l],3,3,!1,!1,null],["MaxSinkConnectors",[l],3,4,!1,!1,null],["MaxPinsPerConnector",[l],3,5,!1,!1,null],["MaxPortsPerPin",[l],3,6,!1,!1,null],["AlignmentLevel",[vt],3,7,!1,!1,null],["AlignmentGain",[vt],3,8,!1,!1,null]],[["SourceConnectorChanged",3,1,[Ws,Z,Ns]],["SinkConnectorChanged",3,2,[qs,Z,Ns]],["ConnectorStatusChanged",3,3,[js]]]);class Qs extends(G({None:0,Source:1,Sink:2})){}const Js=J(Qs);class Zs extends(G({NotConnected:0,Connected:1,Muted:2})){}const $s=J(Zs),ei=q("OcaNetworkSignalChannel",3,"",2,Lt,[["AddToConnector",3,6,[d,l],[]],["GetConnectorPins",3,5,[],[lt(d,l)]],["GetIDAdvertised",3,1,[],[ce]],["GetNetwork",3,3,[],[d]],["GetRemoteChannelID",3,8,[],[ce]],["GetSourceOrSink",3,10,[],[Js]],["GetStatus",3,11,[],[$s]],["RemoveFromConnector",3,7,[d],[]],["SetIDAdvertised",3,2,[ce],[]],["SetNetwork",3,4,[d],[]],["SetRemoteChannelID",3,9,[ce],[]]],[["ConnectorPins",[lt(d,l)],3,3,!1,!1,null],["IDAdvertised",[ce],3,1,!1,!1,null],["Network",[d],3,2,!1,!1,null],["RemoteChannelID",[ce],3,4,!1,!1,null],["SourceOrSink",[Js],3,5,!1,!1,null],["Status",[$s],3,6,!1,!1,null]],[]);class ti extends(G({None:0,EthernetWired:1,EthernetWireless:2,USB:3,SerialP2P:4})){}const ni=J(ti);class ri{constructor(e,t){this.rxPacketErrors=e,this.txPacketErrors=t}}const oi=c({rxPacketErrors:d,txPacketErrors:d},ri);class si extends(G({Unknown:0,Ready:1,StartingUp:2,Stopped:3})){}const ii=J(si);class ai{constructor(e,t){this.SystemInterfaceHandle=e,this.MyNetworkAddress=t}}const ci=c({SystemInterfaceHandle:ce,MyNetworkAddress:ce},ai),li=q("OcaNetwork",3,"",2,so,[["GetLinkType",3,1,[],[ni]],["GetIDAdvertised",3,2,[],[ce]],["SetIDAdvertised",3,3,[ce],[]],["GetControlProtocol",3,4,[],[Ds]],["GetMediaProtocol",3,5,[],[Xs]],["GetStatus",3,6,[],[ii]],["GetStatistics",3,7,[],[oi]],["ResetStatistics",3,8,[],[]],["GetSystemInterfaces",3,9,[],[ge(ci)]],["SetSystemInterfaces",3,10,[ge(ci)],[]],["GetMediaPorts",3,11,[],[ge(d)]],["Startup",3,12,[],[]],["Shutdown",3,13,[],[]]],[["LinkType",[ni],3,1,!0,!1,null],["IDAdvertised",[ce],3,2,!1,!1,null],["ControlProtocol",[Ds],3,3,!1,!1,null],["MediaProtocol",[Xs],3,4,!1,!1,null],["Status",[ii],3,5,!1,!1,null],["SystemInterfaces",[ge(ci)],3,6,!1,!1,null],["MediaPorts",[ge(d)],3,7,!1,!1,null],["Statistics",[oi],3,8,!1,!1,null]],[]);class ui extends(G({Undefined:0,Locked:1,Synchronizing:2,FreeRun:3,Stopped:4})){}const hi=J(ui),di=q("OcaMediaClock",3,"",2,so,[["GetType",3,1,[],[ze]],["SetType",3,2,[ze],[]],["GetDomainID",3,3,[],[l]],["SetDomainID",3,4,[l],[]],["GetSupportedRates",3,5,[],[ge(rs)]],["GetCurrentRate",3,6,[],[rs]],["SetCurrentRate",3,7,[rs],[]],["GetLockState",3,8,[],[hi]]],[["Type",[ze],3,1,!1,!1,null],["DomainID",[l],3,2,!1,!1,null],["RatesSupported",[ge(rs)],3,3,!1,!1,null],["CurrentRate",[rs],3,4,!1,!1,null],["LockState",[hi],3,5,!1,!1,null]],[]),gi=q("OcaStreamNetwork",3,"\n",2,so,[["GetLinkType",3,1,[],[ni]],["GetIDAdvertised",3,2,[],[ce]],["SetIDAdvertised",3,3,[ce],[]],["GetControlProtocol",3,4,[],[Ds]],["GetMediaProtocol",3,5,[],[Xs]],["GetStatus",3,6,[],[ii]],["GetStatistics",3,7,[],[oi]],["ResetStatistics",3,8,[],[]],["GetSystemInterfaces",3,9,[],[ge(ci)]],["SetSystemInterfaces",3,10,[ge(ci)],[]],["GetStreamConnectorsSource",3,11,[],[ge(d)]],["SetStreamConnectorsSource",3,12,[ge(d)],[]],["GetStreamConnectorsSink",3,13,[],[ge(d)]],["SetStreamConnectorsSink",3,14,[ge(d)],[]],["GetSignalChannelsSource",3,15,[],[ge(d)]],["SetSignalChannelsSource",3,16,[ge(d)],[]],["GetSignalChannelsSink",3,17,[],[ge(d)]],["SetSignalChannelsSink",3,18,[ge(d)],[]],["Startup",3,19,[],[]],["Shutdown",3,20,[],[]]],[["ControlProtocol",[Ds],3,3,!1,!1,null],["IDAdvertised",[ce],3,2,!1,!1,null],["LinkType",[ni],3,1,!0,!1,null],["MediaProtocol",[Xs],3,4,!1,!1,null],["SignalChannelsSink",[ge(d)],3,10,!1,!1,null],["SignalChannelsSource",[ge(d)],3,9,!1,!1,null],["Statistics",[oi],3,11,!1,!1,null],["Status",[ii],3,5,!1,!1,null],["StreamConnectorsSink",[ge(d)],3,8,!1,!1,null],["StreamConnectorsSource",[ge(d)],3,7,!1,!1,null],["SystemInterfaces",[ge(ci)],3,6,!1,!1,null]],[]);class Si{constructor(e,t,n,r){this.HostID=e,this.NetworkAddress=t,this.NodeID=n,this.StreamConnectorID=r}}const fi=c({HostID:ce,NetworkAddress:ce,NodeID:ce,StreamConnectorID:ce},Si);class pi extends(G({NotConnected:0,Connected:1,Paused:2})){}const mi=J(pi);class Oi extends(G({None:0,Unicast:1,Multicast:2})){}const yi=J(Oi);class bi{constructor(e,t,n,r,o,s,i,a,c,l,u){this.ErrorNumber=e,this.IDAdvertised=t,this.Index=n,this.Label=r,this.LocalConnectorONo=o,this.Priority=s,this.RemoteConnectorIdentification=i,this.Secure=a,this.Status=c,this.StreamParameters=l,this.StreamType=u}}const Ci=c({ErrorNumber:l,IDAdvertised:ce,Index:l,Label:oe,LocalConnectorONo:d,Priority:l,RemoteConnectorIdentification:fi,Secure:H,Status:mi,StreamParameters:ce,StreamType:yi},bi);class wi extends(G({NotAvailable:0,Idle:1,Connected:2,Paused:3})){}const Pi=J(wi),Gi=q("OcaStreamConnector",3,"\v",2,so,[["ConnectStream",3,7,[Ci],[l]],["DisconnectStream",3,8,[l],[]],["GetIDAdvertised",3,3,[],[ce]],["GetOwnerNetwork",3,1,[],[d]],["GetPins",3,10,[],[lt(l,d)]],["GetSourceOrSink",3,5,[],[Js]],["GetStatus",3,11,[],[Pi]],["GetStreams",3,9,[],[lt(l,Ci)]],["SetIDAdvertised",3,4,[ce],[]],["SetOwnerNetwork",3,2,[d],[]],["SetSourceOrSink",3,6,[Js],[]]],[["IDAdvertised",[ce],3,2,!1,!1,null],["OwnerNetwork",[d],3,1,!1,!1,null],["Pins",[lt(l,d)],3,5,!1,!1,null],["SourceOrSink",[Js],3,3,!1,!1,null],["Status",[Pi],3,6,!1,!1,null],["Streams",[lt(l,Ci)],3,4,!1,!1,null]],[]);var vi=Object.freeze({__proto__:null,OcaRoot:se,OcaWorker:Lt,OcaActuator:Yt,OcaMute:Zt,OcaPolarity:tn,OcaSwitch:nn,OcaGain:rn,OcaPanBalance:on,OcaDelay:sn,OcaDelayExtended:hn,OcaFrequencyActuator:dn,OcaFilterClassical:On,OcaFilterParametric:Cn,OcaFilterPolynomial:wn,OcaFilterFIR:Pn,OcaFilterArbitraryCurve:_n,OcaDynamics:xn,OcaDynamicsDetector:Un,OcaDynamicsCurve:Nn,OcaSignalGenerator:Vn,OcaSignalInput:zn,OcaSignalOutput:qn,OcaTemperatureActuator:Hn,OcaIdentificationActuator:Wn,OcaSummingPoint:Kn,OcaBasicActuator:Xn,OcaBooleanActuator:Yn,OcaInt8Actuator:Jn,OcaInt16Actuator:$n,OcaInt32Actuator:tr,OcaInt64Actuator:or,OcaUint8Actuator:sr,OcaUint16Actuator:ir,OcaUint32Actuator:ar,OcaUint64Actuator:cr,OcaFloat32Actuator:lr,OcaFloat64Actuator:hr,OcaStringActuator:dr,OcaBitstringActuator:pr,OcaSensor:yr,OcaLevelSensor:br,OcaAudioLevelSensor:Pr,OcaTimeIntervalSensor:Gr,OcaFrequencySensor:vr,OcaTemperatureSensor:_r,OcaIdentificationSensor:Dr,OcaVoltageSensor:Tr,OcaCurrentSensor:Ir,OcaImpedanceSensor:Lr,OcaGainSensor:Er,OcaBasicSensor:kr,OcaBooleanSensor:xr,OcaInt8Sensor:Ur,OcaInt16Sensor:Nr,OcaInt32Sensor:Rr,OcaInt64Sensor:Fr,OcaUint8Sensor:Br,OcaUint16Sensor:jr,OcaUint32Sensor:Vr,OcaFloat32Sensor:zr,OcaFloat64Sensor:qr,OcaStringSensor:Hr,OcaBitstringSensor:Wr,OcaUint64Sensor:Kr,OcaBlock:Xt,OcaBlockFactory:no,OcaMatrix:oo,OcaAgent:so,OcaGrouper:yo,OcaRamper:Lo,OcaNumericObserver:No,OcaLibrary:qo,OcaPowerSupply:Jo,OcaEventHandler:Zo,OcaNumericObserverList:$o,OcaMediaClock3:os,OcaTimeSource:gs,OcaPhysicalPosition:Os,OcaApplicationNetwork:vs,OcaControlNetwork:Ts,OcaMediaTransportNetwork:Ys,OcaManager:ae,OcaDeviceManager:we,OcaSecurityManager:Pe,OcaFirmwareManager:Te,OcaSubscriptionManager:Ne,OcaPowerManager:Be,OcaNetworkManager:je,OcaMediaClockManager:qe,OcaLibraryManager:Je,OcaAudioProcessingManager:Ze,OcaDeviceTimeManager:ct,OcaTaskManager:wt,OcaCodingManager:Pt,OcaDiagnosticManager:Gt,OcaNetworkSignalChannel:ei,OcaNetwork:li,OcaMediaClock:di,OcaStreamNetwork:gi,OcaStreamConnector:Gi});const _i={DeviceManager:1,SecurityManager:2,FirmwareManager:3,SubscriptionManager:4,PowerManager:5,NetworkManager:6,MediaClockManager:7,LibraryManager:8,AudioProcessingManager:9,DeviceTimeManager:10,TaskManager:11,CodingManager:12,DiagnosticManager:13};function Di(e){const t=e.EmitterONo,n=e.EventID;return[t,n.DefLevel,n.EventIndex].join(",")}const Ti={ONo:1055,MethodID:{DefLevel:1,MethodIndex:1}};class Ii extends n{constructor(e,...t){super(),this.objects=new Map,this.connection=e,e.on("error",e=>{this.emit("error",e)}),e.on("close",e=>{this.emit("close",e)}),this.modules=[],this.add_control_classes(Object.values(vi)),t.map(e=>this.add_control_classes(e)),this.DeviceManager=new we(_i.DeviceManager,this),this.SecurityManager=new Pe(_i.SecurityManager,this),this.FirmwareManager=new Te(_i.FirmwareManager,this),this.SubscriptionManager=new Ne(_i.SubscriptionManager,this),this.PowerManager=new Be(_i.PowerManager,this),this.NetworkManager=new je(_i.NetworkManager,this),this.MediaClockManager=new qe(_i.MediaClockManager,this),this.LibraryManager=new Je(_i.LibraryManager,this),this.AudioProcessingManager=new Ze(_i.AudioProcessingManager,this),this.DeviceTimeManager=new ct(_i.DeviceTimeManager,this),this.TaskManager=new wt(_i.TaskManager,this),this.CodingManager=new Pt(_i.CodingManager,this),this.DiagnosticManager=new Gt(_i.DiagnosticManager,this),this.Root=new Xt(100,this),this.subscriptions=new Map}close(){this.connection.close()}send_command(e,t,n){return this.connection.send_command(e,t,n)}_doSubscribe(e){return this.SubscriptionManager.AddSubscription(e,Ti,new Uint8Array(0),Ee.Reliable,new Uint8Array(0))}async add_subscription(n,r){const o=Di(n),s=this.subscriptions;{const e=s.get(o);if(e)return e.callbacks.add(r),!0}const i=n=>{const r=this.subscriptions.get(o);if(!r)return void e("Subscription lost.");r.callbacks.forEach((function(e){try{e(n)}catch(e){t(e)}}))};this.connection._addSubscriber(n,i);const a={callbacks:new Set([r]),callback:i};s.set(o,a);try{await this._doSubscribe(n)}catch(e){throw s.delete(o),e}}remove_subscription(e,t){const n=Di(e),r=this.subscriptions.get(n);if(!r)return Promise.reject("Callback not registered.");const o=r.callbacks;return o.delete(t),o.size?Promise.resolve(!0):(this.connection._removeSubscriber(e),this.subscriptions.delete(n),this.SubscriptionManager.RemoveSubscription(e,Ti))}find_best_class(e){for("object"==typeof e&&e.ClassID&&(e=e.ClassID);e.length;){const t=this.find_class_by_id(e);if(t)return t;e=e.substr(0,e.length-1)}return null}add_control_classes(e){if(Array.isArray(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[r.ClassID]=r}e=t}else if("object"!=typeof e)throw new Error("Unsupported module.");this.modules.push(e)}find_class_by_id(e){"object"==typeof e&&e.ClassID&&(e=e.ClassID);const t=this.modules;for(let n=t.length-1;n>=0;n--){const r=t[n][e];if(r)return r}return null}allocate(e,t){"object"==typeof t&&(t=t.valueOf());const n=this.objects;return n.has(t)||n.set(t,new e(t,this)),n.get(t)}resolve_object(e){if("MemberObjectIdentification"in e)return this.resolve_object(e.MemberObjectIdentification);if("ONo"in e&&"ClassIdentification"in e){const t=e.ONo,n=e.ClassIdentification;return this.allocate(this.find_best_class(n),t)}throw new TypeError("Expected OcaObjectIdentification or OcaBlockMember")}GetDeviceTree(){const e=t=>t.GetMembers().then(t=>{const n=[];t=t.map(this.resolve_object,this);for(let r=0;r<t.length;r++)n.push(Promise.resolve(t[r])),t[r].ClassID.startsWith(Xt.ClassID)&&n.push(e(t[r]));return Promise.all(n)});return e(this.Root)}get_device_tree(){return this.GetDeviceTree()}get_role_map(e){return this.get_device_tree().then((function(t){return function(e,t){const n=new Map;t||(t="/");const r=[],o=e=>{Array.isArray(e)?e.forEach(o):r.push(e.GetRole().then(t=>{n.set(e,t)}))};return e.forEach(o),Promise.all(r).then((function(){const r=new Map,o=(e,s)=>{const i=null!=s?s+t:"",a=new Map;e.forEach((function(e,t){if(Array.isArray(e))return;const r=n.get(e);if(a.has(r)){const t=a.get(r);Array.isArray(t)?t.push(e):a.set(r,[t,e])}else a.set(r,e)})),a.forEach((function(e,t){if(Array.isArray(e)){let n=1;for(let r=0;r<e.length;r++){const o=t+n;for(;a.has(o);)n++;a.set(o,e[r]),a.set(e[r],o)}a.delete(t)}else a.set(e,t)})),e.forEach((t,n)=>{if(Array.isArray(t))o(t,i+a.get(e[n-1]));else{const e=i+a.get(t);r.set(e,t)}})};return o(e,null),r}))}(t,e)}))}discover_all_fallback(){return this.GetDeviceTree().then(e=>{const t=[],n=function(e){for(let r=0;r<e.length;r++)Array.isArray(e[r])?n(e[r]):t.push(e[r])};return n(e),t})}discover_all(){return this.Root.GetMembersRecursive().then(e=>e.map(this.resolve_object,this)).catch(()=>this.discover_all_fallback())}set_keepalive_interval(e){this.connection.set_keepalive_interval(e)}}const Mi=Object.values(vi);class Ai extends(G({None:0,ParamSet:1,Patch:2,Program:3})){}class Li extends(G({Ampere:4,DegreeCelsius:2,Hertz:1,None:0,Ohm:5,Volt:3})){}var Ei=Object.freeze({__proto__:null,OcaApplicationNetworkCommand:ys,OcaApplicationNetworkState:Cs,OcaBaseDataType:bo,OcaBlockMember:xt,OcaClassAuthorityID:class{constructor(e,t,n){this.Sentinel=e,this.Reserved=t,this.OrganizationID=n}},OcaClassIdentification:K,OcaClassicalFilterShape:Sn,OcaComponent:Ge,OcaDBr:Dn,OcaDelayUnit:an,OcaDelayValue:ln,OcaDeviceState:{Operational:1,Disabled:2,Error:4,Initializing:8,Updating:16,unused:32},OcaDynamicsFunction:In,OcaEnumItem:class{constructor(e){this.Value=e}},OcaEnumItem16:class{constructor(e){this.Value=e}},OcaEvent:g,OcaEventID:u,OcaFilterPassband:pn,OcaGlobalTypeIdentifier:Nt,OcaGrouperCitizen:co,OcaGrouperEnrollment:uo,OcaGrouperGroup:go,OcaGrouperMode:fo,OcaGrouperStatusChangeEventData:class{constructor(e,t,n,r){this.Event=e,this.groupIndex=t,this.citizenIndex=n,this.changeType=r}},OcaGrouperStatusChangeType:mo,OcaImpedance:Mr,OcaLevelDetectionLaw:An,OcaLevelMeterLaw:Cr,OcaLibAccess:Ro,OcaLibParamSetAssignment:class{constructor(e,t){this.ParamSetIdentifier=e,this.TargetBlockONo=t}},OcaLibVol:Vo,OcaLibVolChangedEventData:class{constructor(e,t,n){this.Event=e,this.VolumeID=t,this.ChangeType=n}},OcaLibVolData_ParamSet:Ft,OcaLibVolIdentifier:He,OcaLibVolMetadata:Bo,OcaLibVolStandardTypeID:Ai,OcaLibVolType:Ke,OcaLibraryIdentifier:Ye,OcaManagerDefaultObjectNumbers:_i,OcaManagerDescriptor:Se,OcaMediaClockAvailability:es,OcaMediaClockLockState:ui,OcaMediaClockRate:ns,OcaMediaClockType:Ve,OcaMediaCoding:Is,OcaMediaConnection:Es,OcaMediaConnectorCommand:xs,OcaMediaConnectorElement:{PinMap:1,Connection:2,Coding:4,AlignmentLevel:8,AlignmentGain:16},OcaMediaConnectorState:Rs,OcaMediaConnectorStatus:Bs,OcaMediaConnectorStatusChangedEventData:class{constructor(e,t){this.Event=e,this.ConnectorStatus=t}},OcaMediaSinkConnector:zs,OcaMediaSinkConnectorChangedEventData:class{constructor(e,t,n,r){this.Event=e,this.SinkConnector=t,this.ChangeType=n,this.ChangedElement=r}},OcaMediaSourceConnector:Hs,OcaMediaSourceConnectorChangedEventData:class{constructor(e,t,n,r){this.Event=e,this.SourceConnector=t,this.ChangeType=n,this.ChangedElement=r}},OcaMediaStreamCastMode:As,OcaMethod:Ae,OcaMethodID:Ie,OcaModelDescription:pe,OcaModelGUID:Oe,OcaMuteState:Qt,OcaNetworkControlProtocol:_s,OcaNetworkLinkType:ti,OcaNetworkMediaProtocol:Ks,OcaNetworkMediaSourceOrSink:Qs,OcaNetworkSignalChannelStatus:Zs,OcaNetworkStatistics:ri,OcaNetworkStatus:si,OcaNetworkSystemInterfaceDescriptor:Ps,OcaNetworkSystemInterfaceID:ai,OcaNotificationDeliveryMode:Ee,OcaOPath:io,OcaObjectIdentification:Et,OcaObjectListEventData:class{constructor(e,t){this.Event=e,this.objectList=t}},OcaObjectSearchResult:jt,OcaObjectSearchResultFlags:{ONo:1,ClassIdentification:2,ContainerPath:4,Role:8,Label:16,unused:32},OcaObservationEventData:class{constructor(e,t){this.Event=e,this.Reading=t}},OcaObservationListEventData:class{constructor(e,t){this.Event=e,this.Reading=t}},OcaObserverState:Eo,OcaParametricEQShape:yn,OcaPilotToneDetectorSpec:class{constructor(e,t,n){this.Threshold=e,this.Frequency=t,this.PollInterval=n}},OcaPolarityState:$t,OcaPort:Mt,OcaPortID:Tt,OcaPortMode:_t,OcaPositionCoordinateSystem:Ss,OcaPositionDescriptor:ps,OcaPowerState:Re,OcaPowerSupplyLocation:Ho,OcaPowerSupplyState:Ko,OcaPowerSupplyType:Yo,OcaPresentationUnit:En,OcaProperty:Go,OcaPropertyChangeType:x,OcaPropertyDescriptor:wo,OcaPropertyID:N,OcaProtoObjectIdentification:Xr,OcaProtoPort:Zr,OcaProtoPortID:Qr,OcaProtoSignalPath:eo,OcaRamperCommand:_o,OcaRamperInterpolationLaw:To,OcaRamperState:Mo,OcaRelationalOperator:xo,OcaResetCause:be,OcaSensorReadingState:mr,OcaSignalPath:qt,OcaStatus:v,OcaStream:bi,OcaStreamConnectorIdentification:Si,OcaStreamConnectorStatus:wi,OcaStreamStatus:pi,OcaStreamType:Oi,OcaStringComparisonType:Wt,OcaSubscriptionManagerState:xe,OcaSweepType:Rn,OcaTask:dt,OcaTaskCommand:St,OcaTaskManagerState:pt,OcaTaskState:Ot,OcaTaskStateChangedEventData:class{constructor(e,t,n){this.TaskID=e,this.ProgramID=t,this.Status=n}},OcaTaskStatus:bt,OcaTimeMode:ut,OcaTimePTP:it,OcaTimeProtocol:ss,OcaTimeReferenceType:as,OcaTimeSourceAvailability:ls,OcaTimeSourceSyncStatus:hs,OcaTransferFunction:Gn,OcaUnitOfMeasure:Li,OcaVersion:_e,OcaWaveformType:Bn});class ki extends M{constructor(e,t){super(t),this.ws=e,e.binaryType="arraybuffer",e.addEventListener("message",e=>{this.read(e.data)}),e.addEventListener("close",()=>{this.emit("close")}),e.addEventListener("error",()=>{this.emit("error")})}write(e){this.ws.send(e),super.write(e)}static connect(e){return new Promise((t,n)=>{const r=new WebSocket(e.url),o=function(e){n(e)};r.addEventListener("open",()=>{r.removeEventListener("error",o),t(new this(r,e))}),r.addEventListener("error",o)})}cleanup(){if(super.cleanup(),this.ws){try{this.ws.close()}catch(e){}this.ws=null}}_now(){return performance.now()}}const xi={Connection:M,WebSocket:ki,Device:Ii,ControlClasses:vi,define_custom_class:function(e,t,n,r,o,s,i,a){if(n=String.fromCharCode.apply(String,n.split(".").map(e=>parseInt(e))),o){if("string"==typeof o)for(let e=0;e<Mi.length;e++)if(Mi[e].ClassName===o){o=Mi[e];break}}else{const e=n.substr(0,n.length-1);for(let t=0;t<Mi.length;t++)if(Mi[t].ClassID===e){o=Mi[t];break}}if("function"!=typeof o)throw new Error("Unknown parent class.");return q(e,t,n,r,o,s,i,a)}};var Ui=Object.freeze({__proto__:null,Connection:w,controller:xi,ClientConnection:M,Command:s,CommandRrq:i,decodeMessage:y,encodeMessage:function(e){Array.isArray(e)||(e=[e]);const t=function(e){let t=10;const n=e[0].messageType;for(let r=0;r<e.length;r++){const o=e[r];if(o.messageType!=n)throw new Error("Cannot combine different types in one message.");t+=o.encoded_length()}return t}(e),n=new ArrayBuffer(t);if(b(new DataView(n),0,e,0,e.length)!=t)throw new Error("Message length mismatch.");return n},error:t,log:function(...e){try{console.log(...e)}catch(e){}},KeepAlive:m,Notification:f,Response:p,RemoteDevice:Ii,Types:Ei,warn:e,WebSocketConnection:ki,RemoteControlClasses:vi});window.OCA=Ui}();
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@ export class MessageGenerator {
|
|
|
25
25
|
const messageType = pdu.messageType;
|
|
26
26
|
|
|
27
27
|
// Can we add to the current message?
|
|
28
|
-
|
|
28
|
+
const combine =
|
|
29
29
|
this._lastMessageType === messageType &&
|
|
30
30
|
messageType !== pduTypeKeepAlive &&
|
|
31
31
|
this._currentCount < 0xffff;
|
|
@@ -10,6 +10,11 @@ import { PropertyEvent } from '../property_event';
|
|
|
10
10
|
* @class OcaFilterFIR
|
|
11
11
|
*/
|
|
12
12
|
export declare class OcaFilterFIR extends OcaActuator {
|
|
13
|
+
/**
|
|
14
|
+
* This event is emitted whenever Length changes.
|
|
15
|
+
*/
|
|
16
|
+
OnLengthChanged: PropertyEvent<number>;
|
|
17
|
+
|
|
13
18
|
/**
|
|
14
19
|
* This event is emitted whenever Coefficients changes.
|
|
15
20
|
*/
|
|
@@ -23,7 +23,7 @@ export const OcaFilterFIR = make_control_class(
|
|
|
23
23
|
['SetSampleRate', 4, 5, [OcaFloat32], []],
|
|
24
24
|
],
|
|
25
25
|
[
|
|
26
|
-
['Length', [OcaUint32], 4, 1,
|
|
26
|
+
['Length', [OcaUint32], 4, 1, false, false, null],
|
|
27
27
|
['Coefficients', [OcaList(OcaFloat32)], 4, 2, false, false, null],
|
|
28
28
|
['SampleRate', [OcaFloat32], 4, 3, false, false, null],
|
|
29
29
|
],
|
|
@@ -75,6 +75,14 @@ export const OcaFilterFIR = make_control_class(
|
|
|
75
75
|
*
|
|
76
76
|
* @returns {Promise<void>}
|
|
77
77
|
*/
|
|
78
|
+
/**
|
|
79
|
+
* This event is emitted when the property Length changes in the remote object.
|
|
80
|
+
* The property ``Length`` is described in the AES70 standard as follows.
|
|
81
|
+
* Length of the filter, in samples. Readonly. Value is set when
|
|
82
|
+
* SetCoefficients(...) method executes.
|
|
83
|
+
*
|
|
84
|
+
* @member {PropertyEvent<number>} OcaFilterFIR#OnLengthChanged
|
|
85
|
+
*/
|
|
78
86
|
/**
|
|
79
87
|
* This event is emitted when the property Coefficients changes in the remote object.
|
|
80
88
|
* The property ``Coefficients`` is described in the AES70 standard as follows.
|
|
@@ -37,6 +37,11 @@ export declare class OcaPowerManager extends OcaManager {
|
|
|
37
37
|
*/
|
|
38
38
|
OnAutoStateChanged: PropertyEvent<boolean>;
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* This event is emitted whenever TargetState changes.
|
|
42
|
+
*/
|
|
43
|
+
OnTargetStateChanged: PropertyEvent<OcaPowerState>;
|
|
44
|
+
|
|
40
45
|
constructor(objectNumber: number, device: RemoteDevice);
|
|
41
46
|
|
|
42
47
|
/**
|
|
@@ -35,7 +35,7 @@ export const OcaPowerManager = make_control_class(
|
|
|
35
35
|
['PowerSupplies', [OcaList(OcaUint32)], 3, 2, false, false, null],
|
|
36
36
|
['ActivePowerSupplies', [OcaList(OcaUint32)], 3, 3, false, false, null],
|
|
37
37
|
['AutoState', [OcaBoolean], 3, 4, false, false, null],
|
|
38
|
-
['TargetState', [OcaPowerState], 3, 5,
|
|
38
|
+
['TargetState', [OcaPowerState], 3, 5, false, false, null],
|
|
39
39
|
],
|
|
40
40
|
[]
|
|
41
41
|
);
|
|
@@ -117,3 +117,11 @@ export const OcaPowerManager = make_control_class(
|
|
|
117
117
|
*
|
|
118
118
|
* @member {PropertyEvent<boolean>} OcaPowerManager#OnAutoStateChanged
|
|
119
119
|
*/
|
|
120
|
+
/**
|
|
121
|
+
* This event is emitted when the property TargetState changes in the remote object.
|
|
122
|
+
* The property ``TargetState`` is described in the AES70 standard as follows.
|
|
123
|
+
* Power state to which the device is transitioning. If no transition is
|
|
124
|
+
* in progress, has value None. Readonly.
|
|
125
|
+
*
|
|
126
|
+
* @member {PropertyEvent<OcaPowerState>} OcaPowerManager#OnTargetStateChanged
|
|
127
|
+
*/
|
|
@@ -33,6 +33,16 @@ export declare class OcaPowerSupply extends OcaAgent {
|
|
|
33
33
|
*/
|
|
34
34
|
OnChargingChanged: PropertyEvent<boolean>;
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* This event is emitted whenever LoadFractionAvailable changes.
|
|
38
|
+
*/
|
|
39
|
+
OnLoadFractionAvailableChanged: PropertyEvent<number>;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* This event is emitted whenever StorageFractionAvailable changes.
|
|
43
|
+
*/
|
|
44
|
+
OnStorageFractionAvailableChanged: PropertyEvent<number>;
|
|
45
|
+
|
|
36
46
|
constructor(objectNumber: number, device: RemoteDevice);
|
|
37
47
|
|
|
38
48
|
/**
|
|
@@ -33,8 +33,8 @@ export const OcaPowerSupply = make_control_class(
|
|
|
33
33
|
['ModelInfo', [OcaString], 3, 2, false, false, null],
|
|
34
34
|
['State', [OcaPowerSupplyState], 3, 3, false, false, null],
|
|
35
35
|
['Charging', [OcaBoolean], 3, 4, false, false, null],
|
|
36
|
-
['LoadFractionAvailable', [OcaFloat32], 3, 5,
|
|
37
|
-
['StorageFractionAvailable', [OcaFloat32], 3, 6,
|
|
36
|
+
['LoadFractionAvailable', [OcaFloat32], 3, 5, false, false, null],
|
|
37
|
+
['StorageFractionAvailable', [OcaFloat32], 3, 6, false, false, null],
|
|
38
38
|
['Location', [OcaPowerSupplyLocation], 3, 7, true, false, null],
|
|
39
39
|
],
|
|
40
40
|
[]
|
|
@@ -126,3 +126,21 @@ export const OcaPowerSupply = make_control_class(
|
|
|
126
126
|
*
|
|
127
127
|
* @member {PropertyEvent<boolean>} OcaPowerSupply#OnChargingChanged
|
|
128
128
|
*/
|
|
129
|
+
/**
|
|
130
|
+
* This event is emitted when the property LoadFractionAvailable changes in the remote object.
|
|
131
|
+
* The property ``LoadFractionAvailable`` is described in the AES70 standard as follows.
|
|
132
|
+
* Fraction of power supply's load capacity that is currently not being
|
|
133
|
+
* used. Readonly. Normal value range 0...1. A negative value indicates
|
|
134
|
+
* this data is not available.
|
|
135
|
+
*
|
|
136
|
+
* @member {PropertyEvent<number>} OcaPowerSupply#OnLoadFractionAvailableChanged
|
|
137
|
+
*/
|
|
138
|
+
/**
|
|
139
|
+
* This event is emitted when the property StorageFractionAvailable changes in the remote object.
|
|
140
|
+
* The property ``StorageFractionAvailable`` is described in the AES70 standard as follows.
|
|
141
|
+
* Fraction of power supply's energy storage that remains available. For
|
|
142
|
+
* battery supplies. Readonly. Normal value range 0...1. A negative value
|
|
143
|
+
* indicates this data is not available.
|
|
144
|
+
*
|
|
145
|
+
* @member {PropertyEvent<number>} OcaPowerSupply#OnStorageFractionAvailableChanged
|
|
146
|
+
*/
|
|
@@ -10,6 +10,11 @@ import { OcaSensorReadingState } from '../../types/OcaSensorReadingState';
|
|
|
10
10
|
* @class OcaSensor
|
|
11
11
|
*/
|
|
12
12
|
export declare class OcaSensor extends OcaWorker {
|
|
13
|
+
/**
|
|
14
|
+
* This event is emitted whenever ReadingState changes.
|
|
15
|
+
*/
|
|
16
|
+
OnReadingStateChanged: PropertyEvent<OcaSensorReadingState>;
|
|
17
|
+
|
|
13
18
|
constructor(objectNumber: number, device: RemoteDevice);
|
|
14
19
|
|
|
15
20
|
/**
|
|
@@ -14,7 +14,7 @@ export const OcaSensor = make_control_class(
|
|
|
14
14
|
2,
|
|
15
15
|
OcaWorker,
|
|
16
16
|
[['GetReadingState', 3, 1, [], [OcaSensorReadingState]]],
|
|
17
|
-
[['ReadingState', [OcaSensorReadingState], 3, 1, false,
|
|
17
|
+
[['ReadingState', [OcaSensorReadingState], 3, 1, false, false, null]],
|
|
18
18
|
[]
|
|
19
19
|
);
|
|
20
20
|
|
|
@@ -25,3 +25,11 @@ export const OcaSensor = make_control_class(
|
|
|
25
25
|
* @returns {Promise<OcaSensorReadingState>}
|
|
26
26
|
* A promise which resolves to a single value of type :class:`OcaSensorReadingState`.
|
|
27
27
|
*/
|
|
28
|
+
/**
|
|
29
|
+
* This event is emitted when the property ReadingState changes in the remote object.
|
|
30
|
+
* The property ``ReadingState`` is described in the AES70 standard as follows.
|
|
31
|
+
* Enum that describes whether current reading value is valid and if not,
|
|
32
|
+
* why not. Readonly.
|
|
33
|
+
*
|
|
34
|
+
* @member {PropertyEvent<OcaSensorReadingState>} OcaSensor#OnReadingStateChanged
|
|
35
|
+
*/
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { RemoteError } from './remote_error.js';
|
|
2
2
|
import { Connection } from '../connection.js';
|
|
3
3
|
import { Response } from '../OCP1/response.js';
|
|
4
|
-
import { encodeMessage } from '../OCP1/encode_message.js';
|
|
5
4
|
import { KeepAlive } from '../OCP1/keepalive.js';
|
|
6
5
|
import { Notification } from '../OCP1/notification.js';
|
|
7
6
|
import { Arguments } from './arguments.js';
|
|
@@ -119,8 +118,12 @@ export class ClientConnection extends Connection {
|
|
|
119
118
|
return handle;
|
|
120
119
|
}
|
|
121
120
|
|
|
122
|
-
|
|
123
|
-
return
|
|
121
|
+
_estimate_next_tx_time() {
|
|
122
|
+
return this._now();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
send_command(command, returnTypes, callback) {
|
|
126
|
+
const executor = (resolve, reject) => {
|
|
124
127
|
const handle = this._getNextCommandHandle();
|
|
125
128
|
|
|
126
129
|
command.handle = handle;
|
|
@@ -134,9 +137,18 @@ export class ClientConnection extends Connection {
|
|
|
134
137
|
|
|
135
138
|
this._pendingCommands.set(handle, pendingCommand);
|
|
136
139
|
|
|
137
|
-
pendingCommand.lastSent = this.
|
|
140
|
+
pendingCommand.lastSent = this._estimate_next_tx_time();
|
|
138
141
|
this.send(command);
|
|
139
|
-
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
if (callback) {
|
|
145
|
+
executor(
|
|
146
|
+
(result) => callback(true, result),
|
|
147
|
+
(error) => callback(false, error)
|
|
148
|
+
);
|
|
149
|
+
} else {
|
|
150
|
+
return new Promise(executor);
|
|
151
|
+
}
|
|
140
152
|
}
|
|
141
153
|
|
|
142
154
|
_removePendingCommand(handle) {
|
|
@@ -58,15 +58,35 @@ function implement_method(cls, method) {
|
|
|
58
58
|
|
|
59
59
|
const [name, level, index, argumentTypes, returnTypes] = method;
|
|
60
60
|
|
|
61
|
-
cls.prototype[name] = function () {
|
|
61
|
+
cls.prototype[name] = function (...args) {
|
|
62
|
+
const argumentCount = argumentTypes.length;
|
|
63
|
+
let callback = null;
|
|
64
|
+
|
|
65
|
+
// If there are too few arguments, this might mean
|
|
66
|
+
//
|
|
67
|
+
// - that some of them use the default encoding (e.g. 0)
|
|
68
|
+
// - that the method signature has change in the AES70 version
|
|
69
|
+
// used
|
|
70
|
+
//
|
|
71
|
+
// this is why we do not error here, yet.
|
|
72
|
+
if (argumentCount < args.length) {
|
|
73
|
+
if (
|
|
74
|
+
argumentCount + 1 === args.length &&
|
|
75
|
+
typeof args[argumentCount] === 'function'
|
|
76
|
+
) {
|
|
77
|
+
callback = args[argumentCount];
|
|
78
|
+
args.length = argumentCount;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
62
82
|
const cmd = new CommandRrq(
|
|
63
83
|
this.ono,
|
|
64
84
|
level,
|
|
65
85
|
index,
|
|
66
|
-
|
|
67
|
-
new EncodedArguments(argumentTypes,
|
|
86
|
+
argumentCount,
|
|
87
|
+
new EncodedArguments(argumentTypes, args)
|
|
68
88
|
);
|
|
69
|
-
return this.device.send_command(cmd, returnTypes);
|
|
89
|
+
return this.device.send_command(cmd, returnTypes, callback);
|
|
70
90
|
};
|
|
71
91
|
}
|
|
72
92
|
|
|
@@ -21,7 +21,6 @@ import * as RemoteControlClasses from './ControlClasses.js';
|
|
|
21
21
|
|
|
22
22
|
import { OcaManagerDefaultObjectNumbers } from '../types/OcaManagerDefaultObjectNumbers.js';
|
|
23
23
|
import { OcaNotificationDeliveryMode } from '../types/OcaNotificationDeliveryMode.js';
|
|
24
|
-
import { RemoteError } from './remote_error.js';
|
|
25
24
|
|
|
26
25
|
function eventToKey(event) {
|
|
27
26
|
const ono = event.EmitterONo;
|
|
@@ -248,8 +247,8 @@ export class RemoteDevice extends Events {
|
|
|
248
247
|
this.connection.close();
|
|
249
248
|
}
|
|
250
249
|
|
|
251
|
-
send_command(cmd, returnType) {
|
|
252
|
-
return this.connection.send_command(cmd, returnType);
|
|
250
|
+
send_command(cmd, returnType, callback) {
|
|
251
|
+
return this.connection.send_command(cmd, returnType, callback);
|
|
253
252
|
}
|
|
254
253
|
|
|
255
254
|
_doSubscribe(event) {
|
|
@@ -205,6 +205,10 @@ export class UDPConnection extends ClientConnection {
|
|
|
205
205
|
return performance.now();
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
+
_estimate_next_tx_time() {
|
|
209
|
+
return this._now() + (this.delay + 2) * this.q.length;
|
|
210
|
+
}
|
|
211
|
+
|
|
208
212
|
_write_out() {
|
|
209
213
|
if (!this.socket) return;
|
|
210
214
|
const q = this.q;
|
|
@@ -249,7 +253,7 @@ export class UDPConnection extends ClientConnection {
|
|
|
249
253
|
const failed = [];
|
|
250
254
|
|
|
251
255
|
for (const entry of pendingCommands) {
|
|
252
|
-
const [
|
|
256
|
+
const [, pendingCommand] = entry;
|
|
253
257
|
|
|
254
258
|
// All later commands are newer than the cutoff.
|
|
255
259
|
if (pendingCommand.lastSent > retryTime) break;
|
package/tests/device/locking.js
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Test } from './test.js';
|
|
2
|
+
|
|
3
|
+
class CheckCallbackMethod extends Test {
|
|
4
|
+
async run() {
|
|
5
|
+
const root = this.device.Root;
|
|
6
|
+
|
|
7
|
+
const result = await root.GetMembers();
|
|
8
|
+
|
|
9
|
+
const result2 = await new Promise((resolve, reject) => {
|
|
10
|
+
const tmp = root.GetMembers((ok, result) => {
|
|
11
|
+
(ok ? resolve : reject)(result);
|
|
12
|
+
});
|
|
13
|
+
if (tmp) {
|
|
14
|
+
console.error('got %o', tmp);
|
|
15
|
+
throw new Error('Unexpected return value.');
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
if (result.length !== result2.length)
|
|
20
|
+
throw new Error('Result mismatch.');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default [ CheckCallbackMethod ];
|
package/tests/device/test.js
CHANGED
|
@@ -44,16 +44,22 @@ export class Test {
|
|
|
44
44
|
{
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
close_device(device)
|
|
48
48
|
{
|
|
49
|
-
if (
|
|
49
|
+
if (device !== null)
|
|
50
50
|
{
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
device.connection.emit('test_done');
|
|
52
|
+
device.close();
|
|
53
|
+
device = null;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
cleanup()
|
|
58
|
+
{
|
|
59
|
+
this.close_device(this.device);
|
|
60
|
+
this.device = null;
|
|
61
|
+
}
|
|
62
|
+
|
|
57
63
|
static focus()
|
|
58
64
|
{
|
|
59
65
|
return false;
|
package/tests/device.js
CHANGED
|
@@ -13,6 +13,7 @@ import CheckTreeTests from './device/check_tree.js';
|
|
|
13
13
|
import KeepaliveTests from './device/keepalive.js';
|
|
14
14
|
import LockingTests from './device/locking.js';
|
|
15
15
|
import PropertyChangesTests from './device/property_changes.js';
|
|
16
|
+
import MethodCallbackTests from './device/method_callback.js';
|
|
16
17
|
|
|
17
18
|
if (argv.length < 3)
|
|
18
19
|
{
|
|
@@ -169,7 +170,8 @@ function get_runner(get_device)
|
|
|
169
170
|
CheckTreeTests,
|
|
170
171
|
//KeepaliveTests,
|
|
171
172
|
LockingTests,
|
|
172
|
-
PropertyChangesTests
|
|
173
|
+
PropertyChangesTests,
|
|
174
|
+
MethodCallbackTests
|
|
173
175
|
].flat();
|
|
174
176
|
|
|
175
177
|
// require('./device/property_changes'),
|
package/bin/connectMany.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { stdout, argv, exit } from 'process';
|
|
4
|
-
import { RemoteDevice } from '../src/controller/remote_device.js';
|
|
5
|
-
import { TCPConnection } from '../src/controller/tcp_connection.js';
|
|
6
|
-
import { format } from 'util';
|
|
7
|
-
|
|
8
|
-
if (argv.length < 4)
|
|
9
|
-
{
|
|
10
|
-
console.log('Usage: node print_tree.js <ip> <port>');
|
|
11
|
-
exit(1);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function delay(n) {
|
|
15
|
-
if (!n) return Promise.resolve();
|
|
16
|
-
return new Promise((resolve) => setTimeout(resolve, n));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const host = argv[2];
|
|
20
|
-
const port = parseInt(argv[3]);
|
|
21
|
-
const N = 1000;
|
|
22
|
-
|
|
23
|
-
const destinations = new Array(N).fill(0).map((_, index) => {
|
|
24
|
-
return { host: host, port: port + index };
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
async function connectAndDiscover(destination) {
|
|
28
|
-
const con = await TCPConnection.connect(destination);
|
|
29
|
-
|
|
30
|
-
const device = new RemoteDevice(con);
|
|
31
|
-
|
|
32
|
-
const objectTree = await device.get_device_tree();
|
|
33
|
-
|
|
34
|
-
device.close();
|
|
35
|
-
|
|
36
|
-
return objectTree;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async function run() {
|
|
40
|
-
for (let i = 0; i < destinations.length;) {
|
|
41
|
-
let tasks = [];
|
|
42
|
-
|
|
43
|
-
while (tasks.length < 5) {
|
|
44
|
-
tasks.push(connectAndDiscover(destinations[i++]));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
await Promise.all(tasks);
|
|
48
|
-
|
|
49
|
-
stdout.write(format('\r %d %% done.',
|
|
50
|
-
Math.floor(100 * i / destinations.length)));
|
|
51
|
-
|
|
52
|
-
await delay(50);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
run().then(
|
|
57
|
-
() => {
|
|
58
|
-
console.log('\nDone');
|
|
59
|
-
},
|
|
60
|
-
(err) => {
|
|
61
|
-
console.error(err);
|
|
62
|
-
exit(1);
|
|
63
|
-
}
|
|
64
|
-
);
|