aes70 1.3.4 → 1.3.6
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 +34 -0
- package/dist/AES70.es5.js +1 -1
- package/package.json +8 -3
- package/src/OCP1/encode_message.js +3 -6
- package/src/OCP1/message_generator.js +21 -21
- package/src/controller/ControlClasses/OcaLibrary.d.ts +3 -1
- package/src/controller/ControlClasses/OcaLibrary.js +3 -1
- package/src/controller/arguments.d.ts +1 -2
- package/src/controller/client_connection.js +39 -27
- package/src/controller/event.js +4 -1
- package/src/controller/remote_device.d.ts +1 -1
- package/src/controller/remote_device.js +47 -22
- package/src/controller/udp_connection.js +18 -20
- package/src/controller/websocket_connection.js +3 -1
- package/src/controller/websocket_connection_node.js +3 -1
package/Changelog
CHANGED
|
@@ -2,6 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes and version updates will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.3.6] - 2022-03-13
|
|
6
|
+
|
|
7
|
+
- Add conditional 'exports' entry for NodeJS and
|
|
8
|
+
'default' for browser environments
|
|
9
|
+
- Add wildcard 'exports' entry for files in './src'
|
|
10
|
+
- Add 'exports' entry for AES70.es5.js
|
|
11
|
+
- Fix handling of incoming notifications without
|
|
12
|
+
parameter data. This bug was triggered by the
|
|
13
|
+
OcaIdentificationSensor.Identify event.
|
|
14
|
+
|
|
15
|
+
## [1.3.5] - 2022-01-17
|
|
16
|
+
|
|
17
|
+
- Fix OcaLibrary.GetVolume() signature
|
|
18
|
+
|
|
19
|
+
## [1.3.4] - 2021-10-04
|
|
20
|
+
|
|
21
|
+
- Add OCP1 parser to exports as './OCP1'
|
|
22
|
+
|
|
23
|
+
## [1.3.3] - 2021-08-30
|
|
24
|
+
|
|
25
|
+
- Fix WebSocket connection under nodejs
|
|
26
|
+
- Add index.js to 'exports' as '.'
|
|
27
|
+
|
|
28
|
+
## [1.3.2] - 2021-08-12
|
|
29
|
+
|
|
30
|
+
- Fixed some keepalive and close handling errors in
|
|
31
|
+
UDPConnection
|
|
32
|
+
- Added new message generator implementation which
|
|
33
|
+
merges PDUs into larger messages
|
|
34
|
+
- Improve UDP command retry logic to handle situations
|
|
35
|
+
where many commands are queued in a burst. Previously,
|
|
36
|
+
command could time out while they were still buffered
|
|
37
|
+
- Add explicit 'exports' to package.json
|
|
38
|
+
|
|
5
39
|
## [1.3.0] - 2021-08-02
|
|
6
40
|
|
|
7
41
|
- Added TypeScript declaration files
|
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 T{constructor(e){this.values=e}item(e){return this.values[e]}get length(){return this.values.length}}class _{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 T(o))}}catch(e){n(e)}else t(e)}}class I 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)})}get_new_subscriber(e){let t;for(;this.subscribers.has(t=1+65535*Math.random()|0););return this.subscribers.set(t,e),{ONo:t,MethodID:{DefLevel:1,MethodIndex:1}}}remove_subscriber(e){const t=this.subscribers;null!=t&&t.delete(e.ONo)}_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 _(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;if(!e.has(n.target))continue;e.get(n.target)(n)}else{if(!(n instanceof m))throw new Error("Unexpected PDU");if(!(n.time>0))throw new Error("Bad keepalive timeout.")}}}}class M{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(){}))}}class A extends M{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);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 L extends M{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 E extends(G({CurrentChanged:1,MinChanged:2,MaxChanged:3,ItemAdded:4,ItemChanged:5,ItemDeleted:6})){}class k{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===E.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=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 x{constructor(e,t){this.DefLevel=e,this.PropertyIndex=t}}class N{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 x){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 U{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 x(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 R(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 F(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 A(this,new u(r,o),s))}})}function B(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 L(this,new x(t.level,t.index),t.type))}})}function j(e){if("object"==typeof e&&e instanceof U)return e;if(Array.isArray(e))return"object"!=typeof e[1]&&(e[1]=function(e){throw new Error("Not implemented.")}(e[1])),new U(...e);throw new Error("Bad property.")}function V(e,t,n,r,o,s,i,a){let c=null,l=null;i=i.map(e=>j(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 N(i,t,o.get_properties())),l}static GetPropertySync(){return null===c&&(c=function(e){const t=Object.create(k.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++)R(u,s[e]);for(let e=0;e<i.length;e++)B(u,i[e]);for(let e=0;e<a.length;e++)F(u,a[e]);return u}const z=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)}}),q=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 H{constructor(e,t){this.ClassID=e,this.ClassVersion=t}}const W=c({ClassID:q,ClassVersion:l},H),K=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 X(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 Y(e){return X(e,K)}const Q=Y(E),J=c({DefLevel:l,PropertyIndex:l},x),Z=new TextEncoder,$=new TextDecoder;function ee(e){return Z.encode(e)}function te(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 ne=a({isConstantLength:!1,encodedLength:function(e){if("string"!=typeof e)throw new TypeError("Expected string.");return 2+ee(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(ee(n));return new Uint8Array(e.buffer,e.byteOffset).set(o,t),t+o.length},decodeFrom:function(e,t){const n=e.getUint16(t),r=te(e,t+=2,n),o=new Uint8Array(e.buffer,e.byteOffset+t,r);return[t+r,(s=o,$.decode(s))];var s},decodeLength:function(e,t){const n=e.getUint16(t);return(t+=2)+te(e,t,n)}});const re=V("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,[],[W]],["GetLockable",1,2,[],[z]],["LockTotal",1,3,[],[]],["Unlock",1,4,[],[]],["GetRole",1,5,[],[ne]],["LockReadonly",1,6,[],[]]],[["ClassID",[q],1,1,!0,!0,null],["ClassVersion",[l],1,2,!0,!0,null],["ObjectNumber",[d],1,3,!0,!1,null],["Lockable",[z],1,4,!0,!1,null],["Role",[ne],1,5,!0,!1,null]],[["PropertyChanged",1,1,[J,(oe=1,a({isConstantLength:!1,encodedLength:function(e){if(!("object"==typeof e&&e instanceof DataView))throw new TypeError("Expected DataView.");return e.byteLength-oe},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-oe;return[t+n,new DataView(e.buffer,e.byteOffset+t,n)]},decodeLength:function(e,t){return t+(e.byteLength-t-oe)}})),Q]]]);var oe;const se=V("OcaManager",2,"",2,re,[],[],[]),ie=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 ae(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 ce=l,le=ce;function ue(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function he(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)&&!ue(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)&&!ue(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 de{constructor(e,t,n,r){this.ObjectNumber=e,this.Name=t,this.ClassID=n,this.ClassVersion=r}}const ge=c({ObjectNumber:d,Name:ne,ClassID:q,ClassVersion:l},de);class Se{constructor(e,t,n){this.Manufacturer=e,this.Name=t,this.Version=n}}const fe=c({Manufacturer:ne,Name:ne,Version:ne},Se);class pe{constructor(e,t,n){this.Reserved=e,this.MfrCode=t,this.ModelCode=n}}const me=c({Reserved:ae(1),MfrCode:ae(3),ModelCode:ae(4)},pe);class Oe extends(G({PowerOn:0,InternalError:1,Upgrade:2,ExternalRequest:3})){}const ye=Y(Oe),be=V("OcaDeviceManager",3,"",2,se,[["GetOcaVersion",3,1,[],[l]],["GetModelGUID",3,2,[],[me]],["GetSerialNumber",3,3,[],[ne]],["GetDeviceName",3,4,[],[ne]],["SetDeviceName",3,5,[ne],[]],["GetModelDescription",3,6,[],[fe]],["GetDeviceRole",3,7,[],[ne]],["SetDeviceRole",3,8,[ne],[]],["GetUserInventoryCode",3,9,[],[ne]],["SetUserInventoryCode",3,10,[ne],[]],["GetEnabled",3,11,[],[z]],["SetEnabled",3,12,[z],[]],["GetState",3,13,[],[le]],["SetResetKey",3,14,[ae(16),ie],[]],["GetResetCause",3,15,[],[ye]],["ClearResetCause",3,16,[],[]],["GetMessage",3,17,[],[ne]],["SetMessage",3,18,[ne],[]],["GetManagers",3,19,[],[he(ge)]],["GetDeviceRevisionID",3,20,[],[ne]]],[["ModelGUID",[me],3,1,!1,!1,null],["SerialNumber",[ne],3,2,!1,!1,null],["ModelDescription",[fe],3,3,!1,!1,null],["DeviceName",[ne],3,4,!1,!1,null],["OcaVersion",[l],3,5,!1,!1,null],["DeviceRole",[ne],3,6,!1,!1,null],["UserInventoryCode",[ne],3,7,!1,!1,null],["Enabled",[z],3,8,!1,!1,null],["State",[le],3,9,!1,!1,null],["Busy",[z],3,10,!1,!1,null],["ResetCause",[ye],3,11,!1,!1,null],["Message",[ne],3,12,!1,!1,null],["Managers",[he(ge)],3,13,!1,!1,null],["DeviceRevisionID",[ne],3,14,!0,!1,null]],[]),Ce=V("OcaSecurityManager",3,"",2,se,[["AddPreSharedKey",3,4,[ne,ie],[]],["ChangePreSharedKey",3,3,[ne,ie],[]],["DeletePreSharedKey",3,5,[ne],[]],["DisableControlSecurity",3,2,[],[]],["EnableControlSecurity",3,1,[],[]]],[["secureControlData",[z],3,1,!1,!1,null]],[]);class we extends(G({BootLoader:0})){}const Pe=X(we,l);class Ge{constructor(e,t,n,r){this.Major=e,this.Minor=t,this.Build=n,this.Component=r}}const ve=c({Major:d,Minor:d,Build:d,Component:Pe},Ge),De=V("OcaFirmwareManager",3,"",2,se,[["GetComponentVersions",3,1,[],[he(ve)]],["StartUpdateProcess",3,2,[],[]],["BeginActiveImageUpdate",3,3,[Pe],[]],["AddImageData",3,4,[d,ie],[]],["VerifyImage",3,5,[ie],[]],["EndActiveImageUpdate",3,6,[],[]],["BeginPassiveComponentUpdate",3,7,[Pe,ie,ne],[]],["EndUpdateProcess",3,8,[],[]]],[["ComponentVersions",[he(ve)],3,1,!1,!1,null]],[]);class Te{constructor(e,t){this.DefLevel=e,this.MethodIndex=t}}const _e=c({DefLevel:l,MethodIndex:l},Te);class Ie{constructor(e,t){this.ONo=e,this.MethodID=t}}const Me=c({ONo:d,MethodID:_e},Ie);class Ae extends(G({Reliable:1,Fast:2})){}const Le=Y(Ae);class Ee extends(G({Normal:1,EventsDisabled:2})){}const ke=Y(Ee),xe=V("OcaSubscriptionManager",3,"",2,se,[["RemoveSubscription",3,2,[S,Me],[]],["AddSubscription",3,1,[S,Me,ie,Le,ie],[]],["DisableNotifications",3,3,[],[]],["ReEnableNotifications",3,4,[],[]],["AddPropertyChangeSubscription",3,5,[d,J,Me,ie,Le,ie],[]],["RemovePropertyChangeSubscription",3,6,[d,J,Me],[]],["GetMaximumSubscriberContextLength",3,7,[],[l]]],[["State",[ke],3,1,!1,!1,null]],[["NotificationsDisabled",3,1,[]],["SynchronizeState",3,2,[he(d)]]]);class Ne extends(G({None:0,Working:1,Standby:2,Off:3})){}const Ue=Y(Ne),Re=V("OcaPowerManager",3,"",2,se,[["GetState",3,1,[],[Ue]],["SetState",3,2,[Ue],[]],["GetPowerSupplies",3,3,[],[he(d)]],["GetActivePowerSupplies",3,4,[],[he(d)]],["ExchangePowerSupply",3,5,[d,d,z],[]],["GetAutoState",3,6,[],[z]]],[["State",[Ue],3,1,!1,!1,null],["PowerSupplies",[he(d)],3,2,!1,!1,null],["ActivePowerSupplies",[he(d)],3,3,!1,!1,null],["AutoState",[z],3,4,!1,!1,null],["TargetState",[Ue],3,5,!0,!1,null]],[]),Fe=V("OcaNetworkManager",3,"",2,se,[["GetNetworks",3,1,[],[he(d)]],["GetStreamNetworks",3,2,[],[he(d)]],["GetControlNetworks",3,3,[],[he(d)]],["GetMediaTransportNetworks",3,4,[],[he(d)]]],[["Networks",[he(d)],3,1,!1,!1,null],["StreamNetworks",[he(d)],3,2,!1,!1,null],["ControlNetworks",[he(d)],3,3,!1,!1,null],["MediaTransportNetworks",[he(d)],3,4,!1,!1,null]],[]);class Be extends(G({None:0,Internal:1,Network:2,External:3})){}const je=Y(Be),Ve=V("OcaMediaClockManager",3,"",2,se,[["GetClocks",3,1,[],[he(d)]],["GetMediaClockTypesSupported",3,2,[],[he(je)]],["GetClock3s",3,3,[],[he(d)]]],[["ClockSourceTypesSupported",[he(je)],3,1,!1,!1,["MediaClockTypesSupported"]],["Clocks",[he(d)],3,2,!1,!1,null],["Clock3s",[he(d)],3,3,!1,!1,null]],[]);class ze{constructor(e,t){this.Library=e,this.ID=t}}const qe=c({Library:d,ID:d},ze);class He{constructor(e,t){this.Authority=e,this.ID=t}}const We=c({Authority:ae(3),ID:d},He);class Ke{constructor(e,t){this.Type=e,this.ONo=t}}const Xe=c({Type:We,ONo:d},Ke),Ye=V("OcaLibraryManager",3,"\b",2,se,[["AddLibrary",3,1,[We],[Xe]],["DeleteLibrary",3,2,[d],[]],["GetLibraryCount",3,3,[We],[l]],["GetLibraryList",3,4,[We],[he(Xe)]],["GetCurrentPatch",3,5,[],[qe]],["ApplyPatch",3,6,[qe],[]]],[["Libraries",[he(Xe)],3,1,!1,!1,null],["CurrentPatch",[qe],3,2,!1,!1,null]],[]),Qe=V("OcaAudioProcessingManager",3,"\t",2,se,[],[],[]),Je="undefined"!=typeof BigInt,Ze=Je&&(BigInt(1)<<BigInt(64))-BigInt(1),$e=Je&&Ze>>BigInt(1),et=Je&&-$e-BigInt(1),tt=Je&&(BigInt(1)<<BigInt(55))-BigInt(1);Je&&BigInt(1);function nt(){if(!Je)throw new Error("Missing BigInt support")}const rt=a({isConstantLength:!0,encodedLength:function(e){return 8},encodeTo:function(e,t,n){if(nt(),!(n<=Ze&&n>=0))throw new TypeError("Uint64 out of range.");return e.setBigUint64(t,BigInt(n),!1),t+8},decode:function(e,t){nt();const n=e.getBigUint64(t,!1);return n<=Number.MAX_SAFE_INTEGER?Number(n):n}});class ot{constructor(e,t,n){this.Negative=e,this.Seconds=t,this.Nanoseconds=n}}const st=c({Negative:z,Seconds:rt,Nanoseconds:d},ot),it=V("OcaDeviceTimeManager",3,"\n",2,se,[["GetDeviceTimeNTP",3,1,[],[rt]],["SetDeviceTimeNTP",3,2,[rt],[]],["GetTimeSources",3,3,[],[he(d)]],["GetCurrentDeviceTimeSource",3,4,[],[d]],["SetCurrentDeviceTimeSource",3,5,[d],[]],["GetDeviceTimePTP",3,6,[],[st]],["SetDeviceTimePTP",3,7,[st],[]]],[["TimeSources",[he(d)],3,1,!1,!1,null],["CurrentDeviceTimeSource",[d],3,2,!1,!1,null]],[]);function at(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 ct extends(G({Absolute:1,Relative:2})){}const lt=Y(ct);class ut{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 ht=c({ID:d,Label:ne,ProgramID:qe,GroupID:l,TimeMode:lt,TimeSourceONo:d,StartTime:st,Duration:st,ApplicationSpecificParameters:ie},ut);class dt extends(G({None:0,Prepare:1,Enable:2,Start:3,Stop:4,Abort:5,Disable:6,Clear:7})){}const gt=Y(dt);class St extends(G({None:0,Enabled:1,Disabled:2})){}const ft=Y(St);class pt extends(G({None:0,NotPrepared:1,Disabled:2,Enabled:3,Running:4,Completed:5,Failed:6,Stopped:7,Aborted:8})){}const mt=Y(pt);class Ot{constructor(e,t,n){this.ID=e,this.State=t,this.ErrorCode=n}}const yt=c({ID:d,State:mt,ErrorCode:l},Ot),bt=V("OcaTaskManager",3,"\v",1,se,[["Enable",3,1,[z],[]],["ControlAllTasks",3,2,[gt,ie],[]],["ControlTaskGroup",3,3,[l,gt,ie],[]],["ControlTask",3,4,[d,gt,ie],[]],["GetState",3,5,[],[ft]],["GetTaskStatuses",3,6,[],[yt]],["GetTaskStatus",3,7,[d],[yt]],["AddTask",3,8,[ht],[ht]],["GetTasks",3,9,[],[at(d,ht)]],["GetTask",3,10,[d],[ht]],["SetTask",3,11,[d,ht],[]],["DeleteTask",3,12,[d],[]]],[["State",[ft],3,1,!1,!1,null],["Tasks",[at(d,ht)],3,2,!1,!1,null]],[["TaskStateChanged",3,1,[d,qe,yt]]]),Ct=V("OcaCodingManager",3,"\f",1,se,[["GetAvailableEncodingSchemes",3,1,[],[at(l,ne)]],["GetAvailableDecodingSchemes",3,2,[],[at(l,ne)]]],[["AvailableEncodingSchemes",[at(l,ne)],3,1,!1,!1,null],["AvailableDecodingSchemes",[at(l,ne)],3,2,!1,!1,null]],[]),wt=V("OcaDiagnosticManager",3,"\r",1,se,[["GetLockStatus",3,1,[d],[ne]]],[],[]),Pt=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 Gt extends(G({Input:1,Output:2})){}const vt=Y(Gt);class Dt{constructor(e,t){this.Mode=e,this.Index=t}}const Tt=c({Mode:vt,Index:l},Dt);class _t{constructor(e,t,n){this.Owner=e,this.ID=t,this.Name=n}}const It=c({Owner:d,ID:Tt,Name:ne},_t),Mt=V("OcaWorker",2,"",2,re,[["GetEnabled",2,1,[],[z]],["SetEnabled",2,2,[z],[]],["AddPort",2,3,[ne,vt],[Tt]],["DeletePort",2,4,[Tt],[]],["GetPorts",2,5,[],[he(It)]],["GetPortName",2,6,[Tt],[ne]],["SetPortName",2,7,[Tt,ne],[]],["GetLabel",2,8,[],[ne]],["SetLabel",2,9,[ne],[]],["GetOwner",2,10,[],[d]],["GetLatency",2,11,[],[Pt]],["SetLatency",2,12,[Pt],[]],["GetPath",2,13,[],[he(ne),he(d)]]],[["Enabled",[z],2,1,!1,!1,null],["Ports",[he(It)],2,2,!1,!1,null],["Label",[ne],2,3,!1,!1,null],["Owner",[d],2,4,!1,!1,null],["Latency",[Pt],2,5,!1,!1,null]],[]);class At{constructor(e,t){this.ONo=e,this.ClassIdentification=t}}const Lt=c({ONo:d,ClassIdentification:W},At);class Et{constructor(e,t){this.MemberObjectIdentification=e,this.ContainerObjectNumber=t}}const kt=c({MemberObjectIdentification:Lt,ContainerObjectNumber:d},Et);class xt{constructor(e,t){this.Authority=e,this.ID=t}}const Nt=c({Authority:ae(3),ID:d},xt);class Ut{constructor(e,t){this.TargetBlockType=e,this.ParData=t}}const Rt=c({TargetBlockType:d,ParData:ie},Ut);class Ft{constructor(e,t,n,r,o){this.ONo=e,this.ClassIdentification=t,this.ContainerPath=n,this.Role=r,this.Label=o}}const Bt=c({ONo:d,ClassIdentification:W,ContainerPath:he(d),Role:ne,Label:ne},Ft),jt=ce;class Vt{constructor(e,t){this.SourcePort=e,this.SinkPort=t}}const zt=c({SourcePort:It,SinkPort:It},Vt);class qt extends(G({Exact:0,Substring:1,Contains:2,ExactCaseInsensitive:3,SubstringCaseInsensitive:4,ContainsCaseInsensitive:5})){}const Ht=Y(qt),Wt=V("OcaBlock",3,"",2,Mt,[["GetType",3,1,[],[d]],,["ConstructMemberUsingFactory",3,3,[d],[d]],["DeleteMember",3,4,[d],[]],["GetMembers",3,5,[],[he(Lt)]],["GetMembersRecursive",3,6,[],[he(kt)]],["AddSignalPath",3,7,[zt],[l]],["DeleteSignalPath",3,8,[l],[]],["GetSignalPaths",3,9,[],[at(l,zt)]],["GetSignalPathsRecursive",3,10,[],[at(l,zt)]],["GetMostRecentParamSetIdentifier",3,11,[],[qe]],["ApplyParamSet",3,12,[],[qe]],["GetCurrentParamSetData",3,13,[],[Rt]],["StoreCurrentParamSetData",3,14,[qe],[]],["GetGlobalType",3,15,[],[Nt]],["GetONoMap",3,16,[],[at(d,d)]],["FindObjectsByRole",3,17,[ne,Ht,q,jt],[he(Bt)]],["FindObjectsByRoleRecursive",3,18,[ne,Ht,q,jt],[he(Bt)]],["FindObjectsByPath",3,20,[he(ne),jt],[he(Bt)]],["FindObjectsByLabelRecursive",3,19,[ne,Ht,q,jt],[he(Bt)]]],[["Type",[d],3,1,!0,!1,null],["Members",[he(Lt)],3,2,!1,!1,null],["SignalPaths",[at(l,zt)],3,3,!1,!1,null],["MostRecentParamSetIdentifier",[qe],3,4,!1,!1,null],["GlobalType",[Nt],3,5,!0,!1,null],["ONoMap",[at(d,d)],3,6,!0,!1,null]],[]),Kt=V("OcaActuator",3,"",2,Mt,[],[],[]);class Xt extends(G({Muted:1,Unmuted:2})){}const Yt=Y(Xt),Qt=V("OcaMute",4,"",2,Kt,[["GetState",4,1,[],[Yt]],["SetState",4,2,[Yt],[]]],[["State",[Yt],4,1,!1,!1,null]],[]);class Jt extends(G({NonInverted:1,Inverted:2})){}const Zt=Y(Jt),$t=V("OcaPolarity",4,"",2,Kt,[["GetState",4,1,[],[Zt]],["SetState",4,2,[Zt],[]]],[["State",[Zt],4,1,!1,!1,null]],[]),en=V("OcaSwitch",4,"",2,Kt,[["GetPosition",4,1,[],[l,l,l]],["SetPosition",4,2,[l],[]],["GetPositionName",4,3,[l],[ne]],["SetPositionName",4,4,[l,ne],[]],["GetPositionNames",4,5,[],[he(ne)]],["SetPositionNames",4,6,[he(ne)],[]],["GetPositionEnabled",4,7,[l],[z]],["SetPositionEnabled",4,8,[l,z],[]],["GetPositionEnableds",4,9,[],[he(z)]],["SetPositionEnableds",4,10,[he(z)],[]]],[["Position",[l],4,1,!1,!1,null],["PositionNames",[he(ne)],4,2,!1,!1,null],["PositionEnableds",[he(z)],4,3,!1,!1,null]],[]),tn=V("OcaGain",4,"",2,Kt,[["GetGain",4,1,[],[Pt,Pt,Pt]],["SetGain",4,2,[Pt],[]]],[["Gain",[Pt],4,1,!1,!1,null]],[]),nn=V("OcaPanBalance",4,"",2,Kt,[["GetPosition",4,1,[],[Pt,Pt,Pt]],["SetPosition",4,2,[Pt],[]],["GetMidpointGain",4,3,[],[Pt,Pt,Pt]],["SetMidpointGain",4,4,[Pt],[]]],[["Position",[Pt],4,1,!1,!1,null],["MidpointGain",[Pt],4,2,!1,!1,null]],[]),rn=V("OcaDelay",4,"",2,Kt,[["GetDelayTime",4,1,[],[Pt,Pt,Pt]],["SetDelayTime",4,2,[Pt],[]]],[["DelayTime",[Pt],4,1,!1,!1,null]],[]);class on extends(G({Time:1,Distance:2,Samples:3,Microseconds:4,Milliseconds:5,Centimeters:6,Inches:7,Feet:8})){}const sn=Y(on);class an{constructor(e,t){this.DelayValue=e,this.DelayUnit=t}}const cn=c({DelayValue:Pt,DelayUnit:sn},an),ln=V("OcaDelayExtended",5,"",2,rn,[["GetDelayValue",5,1,[],[cn,cn,cn]],["SetDelayValue",5,2,[cn],[]],["GetDelayValueConverted",5,3,[sn],[cn]]],[["DelayValue",[cn],5,1,!1,!1,null]],[]),un=V("OcaFrequencyActuator",4,"\b",2,Kt,[["GetFrequency",4,1,[],[Pt,Pt,Pt]],["SetFrequency",4,2,[Pt],[]]],[["Frequency",[Pt],4,1,!1,!1,null]],[]),hn=l;class dn extends(G({Butterworth:1,Bessel:2,Chebyshev:3,LinkwitzRiley:4})){}const gn=Y(dn);class Sn extends(G({HiPass:1,LowPass:2,BandPass:3,BandReject:4,AllPass:5})){}const fn=Y(Sn),pn=V("OcaFilterClassical",4,"\t",2,Kt,[["GetFrequency",4,1,[],[Pt,Pt,Pt]],["SetFrequency",4,2,[Pt],[]],["GetPassband",4,3,[],[fn]],["SetPassband",4,4,[fn],[]],["GetShape",4,5,[],[gn]],["SetShape",4,6,[gn],[]],["GetOrder",4,7,[],[l,l,l]],["SetOrder",4,8,[l],[]],["GetParameter",4,9,[],[Pt,Pt,Pt]],["SetParameter",4,10,[Pt],[]],["SetMultiple",4,11,[hn,Pt,fn,gn,l,Pt],[]]],[["Frequency",[Pt],4,1,!1,!1,null],["Passband",[fn],4,2,!1,!1,null],["Shape",[gn],4,3,!1,!1,null],["Order",[l],4,4,!1,!1,null],["Parameter",[Pt],4,5,!1,!1,null]],[]);class mn 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 On=Y(mn),yn=V("OcaFilterParametric",4,"\n",2,Kt,[["GetFrequency",4,1,[],[Pt,Pt,Pt]],["SetFrequency",4,2,[Pt],[]],["GetShape",4,3,[],[On]],["SetShape",4,4,[On],[]],["GetWidthParameter",4,5,[],[Pt,Pt,Pt]],["SetWidthParameter",4,6,[Pt],[]],["GetInbandGain",4,7,[],[Pt,Pt,Pt]],["SetInbandGain",4,8,[Pt],[]],["GetShapeParameter",4,9,[],[Pt,Pt,Pt]],["SetShapeParameter",4,10,[Pt],[]],["SetMultiple",4,11,[hn,Pt,On,Pt,Pt,Pt],[]]],[["Frequency",[Pt],4,1,!1,!1,null],["Shape",[On],4,2,!1,!1,null],["WidthParameter",[Pt],4,3,!1,!1,["Q"]],["InbandGain",[Pt],4,4,!1,!1,null],["ShapeParameter",[Pt],4,5,!1,!1,null]],[]),bn=V("OcaFilterPolynomial",4,"\v",2,Kt,[["GetCoefficients",4,1,[],[he(Pt),he(Pt)]],["SetCoefficients",4,2,[he(Pt),he(Pt)],[]],["GetSampleRate",4,3,[],[Pt,Pt,Pt]],["SetSampleRate",4,4,[Pt],[]],["GetMaxOrder",4,5,[],[K]]],[["A",[he(Pt)],4,1,!1,!1,null],["B",[he(Pt)],4,2,!1,!1,null],["SampleRate",[Pt],4,3,!1,!1,null],["MaxOrder",[K],4,4,!0,!1,null]],[]),Cn=V("OcaFilterFIR",4,"\f",2,Kt,[["GetLength",4,1,[],[d,d,d]],["GetCoefficients",4,2,[],[he(Pt)]],["SetCoefficients",4,3,[he(Pt)],[]],["GetSampleRate",4,4,[],[Pt,Pt,Pt]],["SetSampleRate",4,5,[Pt],[]]],[["Length",[d],4,1,!0,!1,null],["Coefficients",[he(Pt)],4,2,!1,!1,null],["SampleRate",[Pt],4,3,!1,!1,null]],[]);class wn{constructor(e,t,n){this.Frequency=e,this.Amplitude=t,this.Phase=n}}const Pn=c({Frequency:he(Pt),Amplitude:he(Pt),Phase:he(Pt)},wn),Gn=V("OcaFilterArbitraryCurve",4,"\r",2,Kt,[["GetTransferFunction",4,1,[],[Pn]],["SetTransferFunction",4,2,[Pn],[]],["GetSampleRate",4,3,[],[Pt,Pt,Pt]],["SetSampleRate",4,4,[Pt],[]],["GetTFMinLength",4,5,[],[l]],["GetTFMaxLength",4,6,[],[l]]],[["TransferFunction",[Pn],4,1,!1,!1,null],["SampleRate",[Pt],4,2,!1,!1,null],["TFMinLength",[l],4,3,!1,!1,null],["TFMaxLength",[l],4,4,!1,!1,null]],[]);class vn{constructor(e,t){this.Value=e,this.Ref=t}}const Dn=c({Value:Pt,Ref:Pt},vn);class Tn extends(G({None:0,Compress:1,Limit:2,Expand:3,Gate:4})){}const _n=Y(Tn);class In extends(G({None:0,RMS:1,Peak:2})){}const Mn=Y(In);class An extends(G({dBu:0,dBV:1,V:2})){}const Ln=Y(An),En=V("OcaDynamics",4,"",2,Kt,[["GetTriggered",4,1,[],[z]],["GetDynamicGain",4,2,[],[Pt]],["GetFunction",4,3,[],[_n]],["SetFunction",4,4,[_n],[]],["GetRatio",4,5,[],[Pt,Pt,Pt]],["SetRatio",4,6,[Pt],[]],["GetThreshold",4,7,[],[Dn,Pt,Pt]],["SetThreshold",4,8,[Dn],[]],["GetThresholdPresentationUnits",4,9,[],[Ln]],["SetThresholdPresentationUnits",4,10,[Ln],[]],["GetDetectorLaw",4,11,[],[Mn]],["SetDetectorLaw",4,12,[Mn],[]],["GetAttackTime",4,13,[],[Pt,Pt,Pt]],["SetAttackTime",4,14,[Pt],[]],["GetReleaseTime",4,15,[],[Pt,Pt,Pt]],["SetReleaseTime",4,16,[Pt],[]],["GetHoldTime",4,17,[],[Pt,Pt,Pt]],["SetHoldTime",4,18,[Pt],[]],["GetDynamicGainFloor",4,19,[],[Pt,Pt,Pt]],["SetDynamicGainFloor",4,20,[Pt],[]],["GetDynamicGainCeiling",4,21,[],[Pt,Pt,Pt]],["SetDynamicGainCeiling",4,22,[Pt],[]],["GetKneeParameter",4,23,[],[Pt,Pt,Pt]],["SetKneeParameter",4,24,[Pt],[]],["GetSlope",4,25,[],[Pt,Pt,Pt]],["SetSlope",4,26,[Pt],[]],["SetMultiple",4,27,[hn,_n,Dn,Ln,Mn,Pt,Pt,Pt,Pt,Pt,Pt,Pt],[]]],[["Triggered",[z],4,1,!1,!1,null],["DynamicGain",[Pt],4,2,!1,!1,null],["Function",[_n],4,3,!1,!1,null],["Ratio",[Pt],4,4,!1,!1,null],["Threshold",[Dn],4,5,!1,!1,null],["ThresholdPresentationUnits",[Ln],4,6,!1,!1,null],["DetectorLaw",[Mn],4,7,!1,!1,null],["AttackTime",[Pt],4,8,!1,!1,null],["ReleaseTime",[Pt],4,9,!1,!1,null],["HoldTime",[Pt],4,10,!1,!1,null],["DynamicGainCeiling",[Pt],4,11,!1,!1,null],["DynamicGainFloor",[Pt],4,12,!1,!1,null],["KneeParameter",[Pt],4,13,!1,!1,null],["Slope",[Pt],4,14,!1,!1,null]],[]),kn=V("OcaDynamicsDetector",4,"",2,Kt,[["GetLaw",4,1,[],[Mn]],["SetLaw",4,2,[Mn],[]],["GetAttackTime",4,3,[],[Pt,Pt,Pt]],["SetAttackTime",4,4,[Pt],[]],["GetReleaseTime",4,5,[],[Pt,Pt,Pt]],["SetReleaseTime",4,6,[Pt],[]],["GetHoldTime",4,7,[],[Pt,Pt,Pt]],["SetHoldTime",4,8,[Pt],[]],["SetMultiple",4,9,[hn,Mn,Pt,Pt,Pt],[]]],[["Law",[Mn],4,1,!1,!1,null],["AttackTime",[Pt],4,2,!1,!1,null],["ReleaseTime",[Pt],4,3,!1,!1,null],["HoldTime",[Pt],4,4,!1,!1,null]],[]),xn=V("OcaDynamicsCurve",4,"",2,Kt,[["GetNSegments",4,1,[],[K,K,K]],["SetNSegments",4,2,[K],[]],["GetThreshold",4,3,[],[he(Dn),Pt,Pt]],["SetThreshold",4,4,[he(Dn)],[]],["GetSlope",4,5,[],[he(Pt),he(Pt),he(Pt)]],["SetSlope",4,6,[he(Pt)],[]],["GetKneeParameter",4,7,[],[he(Pt),he(Pt),he(Pt)]],["SetKneeParameter",4,8,[he(Pt)],[]],["GetDynamicGainCeiling",4,9,[],[Pt,Pt,Pt]],["SetDynamicGainCeiling",4,10,[Pt],[]],["GetDynamicGainFloor",4,11,[],[Pt,Pt,Pt]],["SetDynamicGainFloor",4,12,[Pt],[]],["SetMultiple",4,13,[hn,K,he(Dn),he(Pt),he(Pt),Pt,Pt],[]]],[["NSegments",[K],4,1,!1,!1,null],["Threshold",[he(Dn)],4,2,!1,!1,null],["Slope",[he(Pt)],4,3,!1,!1,null],["KneeParameter",[he(Pt)],4,4,!1,!1,null],["DynamicGainFloor",[Pt],4,5,!1,!1,null],["DynamicGainCeiling",[Pt],4,6,!1,!1,null]],[]);class Nn extends(G({Linear:1,Logarithmic:2,None:0})){}const Un=Y(Nn);class Rn extends(G({None:0,DC:1,Sine:2,Square:3,Impulse:4,NoisePink:5,NoiseWhite:6,PolarityTest:7})){}const Fn=Y(Rn),Bn=V("OcaSignalGenerator",4,"",2,Kt,[["GetFrequency1",4,1,[],[Pt,Pt,Pt]],["SetFrequency1",4,2,[Pt],[]],["GetFrequency2",4,3,[],[Pt,Pt,Pt]],["SetFrequency2",4,4,[Pt],[]],["GetLevel",4,5,[],[Pt,Pt,Pt]],["SetLevel",4,6,[Pt],[]],["GetWaveform",4,7,[],[Fn]],["SetWaveform",4,8,[Fn],[]],["GetSweepType",4,9,[],[Un]],["SetSweepType",4,10,[Un],[]],["GetSweepTime",4,11,[],[Pt,Pt,Pt]],["SetSweepTime",4,12,[Pt],[]],["GetSweepRepeat",4,13,[],[z]],["SetSweepRepeat",4,14,[z],[]],["GetGenerating",4,15,[],[z]],["Start",4,16,[],[]],["Stop",4,17,[],[]],["SetMultiple",4,18,[hn,Pt,Pt,Pt,Fn,Un,Pt,z],[]]],[["Frequency1",[Pt],4,1,!1,!1,null],["Frequency2",[Pt],4,2,!1,!1,null],["Level",[Pt],4,3,!1,!1,null],["Waveform",[Fn],4,4,!1,!1,null],["SweepType",[Un],4,5,!1,!1,null],["SweepTime",[Pt],4,6,!1,!1,null],["SweepRepeat",[z],4,7,!1,!1,null],["Generating",[z],4,8,!1,!1,null]],[]),jn=V("OcaSignalInput",4,"",2,Kt,[],[],[]),Vn=V("OcaSignalOutput",4,"",2,Kt,[],[],[]),zn=V("OcaTemperatureActuator",4,"",2,Kt,[["GetTemperature",4,1,[],[Pt,Pt,Pt]],["SetTemperature",4,2,[Pt],[]]],[["Temperature",[Pt],4,1,!1,!1,null]],[]),qn=V("OcaIdentificationActuator",4,"",2,Kt,[["GetActive",4,1,[],[z]],["SetActive",4,2,[z],[]]],[["Active",[z],4,1,!1,!1,null]],[]),Hn=V("OcaSummingPoint",4,"",1,Kt,[],[],[]),Wn=V("OcaBasicActuator",4,"",2,Kt,[],[],[]),Kn=V("OcaBooleanActuator",5,"",2,Wn,[["GetSetting",5,1,[],[z]],["SetSetting",5,2,[z],[]]],[["Setting",[z],5,1,!1,!1,null]],[]),Xn=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)}}),Yn=V("OcaInt8Actuator",5,"",2,Wn,[["GetSetting",5,1,[],[Xn,Xn,Xn]],["SetSetting",5,2,[Xn],[]]],[["Setting",[Xn],5,1,!1,!1,null]],[]),Qn=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)}}),Jn=V("OcaInt16Actuator",5,"",2,Wn,[["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 4},encodeTo:function(e,t,n){return e.setInt32(t,0|n,!1),t+4},decode:function(e,t){return e.getInt32(t,!1)}}),$n=V("OcaInt32Actuator",5,"",2,Wn,[["GetSetting",5,1,[],[Zn,Zn,Zn]],["SetSetting",5,2,[Zn],[]]],[["Setting",[Zn],5,1,!1,!1,null]],[]);function er(){if(!Je)throw new Error("Missing BigInt support")}const tr=a({isConstantLength:!0,encodedLength:function(e){return 8},encodeTo:function(e,t,n){if(er(),!(n>=et&&n<=$e))throw new TypeError("Int64 out of range.");return e.setBigInt64(t,BigInt(n),!1),t+8},decode:function(e,t){er();const n=e.getBigInt64(t,!1);return n>=Number.MIN_SAFE_INTEGER&&n<=Number.MAX_SAFE_INTEGER?Number(n):n}}),nr=V("OcaInt64Actuator",5,"",2,Wn,[["GetSetting",5,1,[],[tr,tr,tr]],["SetSetting",5,2,[tr],[]]],[["Setting",[tr],5,1,!1,!1,null]],[]),rr=V("OcaUint8Actuator",5,"",2,Wn,[["GetSetting",5,1,[],[K,K,K]],["SetSetting",5,2,[K],[]]],[["Setting",[K],5,1,!1,!1,null]],[]),or=V("OcaUint16Actuator",5,"",2,Wn,[["GetSetting",5,1,[],[l,l,l]],["SetSetting",5,2,[l],[]]],[["Setting",[l],5,1,!1,!1,null]],[]),sr=V("OcaUint32Actuator",5,"\b",2,Wn,[["GetSetting",5,1,[],[d,d,d]],["SetSetting",5,2,[d],[]]],[["Setting",[d],5,1,!1,!1,null]],[]),ir=V("OcaUint64Actuator",5,"\t",2,Wn,[["GetSetting",5,1,[],[rt,rt,rt]],["SetSetting",5,2,[rt],[]]],[["Setting",[rt],5,1,!1,!1,null]],[]),ar=V("OcaFloat32Actuator",5,"\n",2,Wn,[["GetSetting",5,1,[],[Pt,Pt,Pt]],["SetSetting",5,2,[Pt],[]]],[["Setting",[Pt],5,1,!1,!1,null]],[]),cr=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)}}),lr=V("OcaFloat64Actuator",5,"\v",2,Wn,[["GetSetting",5,1,[],[cr,cr,cr]],["SetSetting",5,2,[cr],[]]],[["Setting",[cr],5,1,!1,!1,null]],[]),ur=V("OcaStringActuator",5,"\f",2,Wn,[["GetSetting",5,1,[],[ne]],["SetSetting",5,2,[ne],[]],["GetMaxLen",5,3,[],[l]]],[["Setting",[ne],5,1,!1,!1,null],["MaxLen",[l],5,2,!0,!1,null]],[]);function hr(e){return e+7>>3}function dr(e,t,n){const r=new Array(n),o=hr(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 gr=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=hr(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)+hr(n),dr(e,t,n)]},decodeLength:function(e,t){return t+2+hr(e.getUint16(t))}}),Sr=V("OcaBitstringActuator",5,"\r",2,Wn,[["GetNrBits",5,1,[],[l]],["GetBit",5,2,[l],[z]],["SetBit",5,3,[l,z],[]],["GetBitstring",5,4,[],[gr]],["SetBitstring",5,5,[gr],[]]],[["Bitstring",[gr],5,1,!1,!1,null]],[]);class fr extends(G({Unknown:0,Valid:1,Underrange:2,Overrange:3,Error:4})){}const pr=Y(fr),mr=V("OcaSensor",3,"",2,Mt,[["GetReadingState",3,1,[],[pr]]],[["ReadingState",[pr],3,1,!1,!0,null]],[]),Or=V("OcaLevelSensor",4,"",2,mr,[["GetReading",4,1,[],[Pt,Pt,Pt]]],[["Reading",[Pt],4,1,!1,!1,null]],[]);class yr extends(G({VU:1,StandardVU:2,PPM1:3,PPM2:4,LKFS:5,RMS:6,Peak:7,ProprietaryValueBase:128})){}const br=Y(yr),Cr=V("OcaAudioLevelSensor",5,"",2,Or,[["GetLaw",5,1,[],[br]],["SetLaw",5,2,[br],[]]],[["Law",[br],5,1,!1,!1,null]],[]),wr=V("OcaTimeIntervalSensor",4,"",2,mr,[["GetReading",4,1,[],[Pt,Pt,Pt]]],[["Reading",[Pt],4,1,!1,!1,null]],[]),Pr=V("OcaFrequencySensor",4,"",2,mr,[["GetReading",4,1,[],[Pt,Pt,Pt]]],[["Reading",[Pt],4,1,!1,!1,null]],[]),Gr=V("OcaTemperatureSensor",4,"",2,mr,[["GetReading",4,1,[],[Pt,Pt,Pt]]],[["Reading",[Pt],4,1,!1,!1,null]],[]),vr=V("OcaIdentificationSensor",4,"",2,mr,[],[],[["Identify",4,1,[]]]),Dr=V("OcaVoltageSensor",4,"",1,mr,[["GetReading",4,1,[],[Pt,Pt,Pt]]],[["Reading",[Pt],4,1,!1,!1,null]],[]),Tr=V("OcaCurrentSensor",4,"\b",1,mr,[["GetReading",4,1,[],[Pt,Pt,Pt]]],[["Reading",[Pt],4,1,!1,!1,null]],[]);class _r{constructor(e,t){this.Magnitude=e,this.Phase=t}}const Ir=c({Magnitude:Pt,Phase:Pt},_r),Mr=V("OcaImpedanceSensor",4,"\t",1,mr,[["GetReading",4,1,[],[Ir,Ir,Ir]]],[["Reading",[Ir],4,1,!1,!1,null]],[]),Ar=V("OcaGainSensor",4,"\n",1,mr,[["GetReading",4,1,[],[Pt,Pt,Pt]]],[["Reading",[Pt],4,1,!1,!1,null]],[]),Lr=V("OcaBasicSensor",4,"",2,mr,[],[],[]),Er=V("OcaBooleanSensor",5,"",2,Lr,[["GetReading",5,1,[],[z]]],[["Reading",[z],5,1,!1,!1,null]],[]),kr=V("OcaInt8Sensor",5,"",2,Lr,[["GetReading",5,1,[],[Xn,Xn,Xn]]],[["Reading",[Xn],5,1,!1,!1,null]],[]),xr=V("OcaInt16Sensor",5,"",2,Lr,[["GetReading",5,1,[],[Qn,Qn,Qn]]],[["Reading",[Qn],5,1,!1,!1,null]],[]),Nr=V("OcaInt32Sensor",5,"",2,Lr,[["GetReading",5,1,[],[Zn,Zn,Zn]]],[["Reading",[Zn],5,1,!1,!1,null]],[]),Ur=V("OcaInt64Sensor",5,"",2,Lr,[["GetReading",5,1,[],[tr,tr,tr]]],[["Reading",[tr],5,1,!1,!1,null]],[]),Rr=V("OcaUint8Sensor",5,"",2,Lr,[["GetReading",5,1,[],[K,K,K]]],[["Reading",[K],5,1,!1,!1,null]],[]),Fr=V("OcaUint16Sensor",5,"",2,Lr,[["GetReading",5,1,[],[l,l,l]]],[["Reading",[l],5,1,!1,!1,null]],[]),Br=V("OcaUint32Sensor",5,"\b",2,Lr,[["GetReading",5,1,[],[d,d,d]]],[["Reading",[d],5,1,!1,!1,null]],[]),jr=V("OcaFloat32Sensor",5,"\n",2,Lr,[["GetReading",5,1,[],[Pt,Pt,Pt]]],[["Reading",[Pt],5,1,!1,!1,null]],[]),Vr=V("OcaFloat64Sensor",5,"\v",2,Lr,[["GetReading",5,1,[],[cr,cr,cr]]],[["Reading",[cr],5,1,!1,!1,null]],[]),zr=V("OcaStringSensor",5,"\f",2,Lr,[["GetString",5,1,[],[ne]],["GetMaxLen",5,2,[],[l]],["SetMaxLen",5,3,[l],[]]],[["String",[ne],5,1,!1,!1,null],["MaxLen",[l],5,2,!1,!1,null]],[]),qr=V("OcaBitstringSensor",5,"\r",2,Lr,[["GetNrBits",5,1,[],[l]],["GetBit",5,2,[l],[K]],["GetBitString",5,3,[],[gr]]],[["BitString",[gr],5,1,!1,!1,null]],[]),Hr=V("OcaUint64Sensor",5,"\t",2,Lr,[["GetReading",5,1,[],[rt,rt,rt]]],[["Reading",[rt],5,1,!1,!1,null]],[]);class Wr{constructor(e,t){this.POno=e,this.ClassIdentification=t}}const Kr=c({POno:d,ClassIdentification:W},Wr);class Xr{constructor(e,t){this.Mode=e,this.Index=t}}const Yr=c({Mode:vt,Index:l},Xr);class Qr{constructor(e,t,n){this.Owner=e,this.ProtoID=t,this.Name=n}}const Jr=c({Owner:d,ProtoID:Yr,Name:ne},Qr);class Zr{constructor(e,t){this.SourceProtoPort=e,this.SinkProtoPort=t}}const $r=c({SourceProtoPort:Jr,SinkProtoPort:Jr},Zr),eo=V("OcaBlockFactory",3,"",2,Mt,[["DefineProtoPort",3,1,[ne,vt],[Yr]],["UndefineProtoPort",3,2,[Yr],[]],["GetProtoPorts",3,3,[],[he(Jr)]],,["DefineProtoMemberUsingFactory",3,5,[d],[d]],["UndefineProtoMember",3,6,[d],[]],["GetProtoMembers",3,7,[],[he(Kr)]],["DefineProtoSignalPath",3,8,[$r],[l]],["UndefineProtoSignalPath",3,9,[],[l]],["GetProtoSignalPaths",3,10,[],[at(l,$r)]],["GetGlobalType",3,11,[],[Nt]],["SetGlobalType",3,12,[Nt],[]]],[["ProtoPorts",[he(Jr)],3,1,!1,!1,null],["ProtoMembers",[he(Kr)],3,2,!1,!1,null],["ProtoSignalPaths",[at(l,$r)],3,3,!1,!1,null],["GlobalType",[Nt],3,4,!1,!1,null]],[]);function to(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)&&!ue(e))throw new TypeError("Expected array.");const n=e.length;if(0===n)return 4;if(!Array.isArray(e[0])&&!ue(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)&&!ue(e))throw new TypeError("Expected array.");const n=e.length;if(0===n)return 4;if(!Array.isArray(e[0])&&!ue(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 no=V("OcaMatrix",3,"",2,Mt,[["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,[],[to(d)]],["SetMembers",3,6,[to(d)],[]],["GetMember",3,7,[l,l],[d]],["SetMember",3,8,[l,l,d],[]],["GetProxy",3,9,[],[d]],["SetProxy",3,10,[d],[]],["GetPortsPerRow",3,11,[],[K]],["SetPortsPerRow",3,12,[K],[]],["GetPortsPerColumn",3,13,[],[K]],["SetPortsPerColumn",3,14,[K],[]],["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",[to(d)],3,5,!1,!1,null],["Proxy",[d],3,6,!1,!1,null],["PortsPerRow",[K],3,7,!1,!1,null],["PortsPerColumn",[K],3,8,!1,!1,null]],[]),ro=V("OcaAgent",2,"",2,re,[["GetLabel",2,1,[],[ne]],["SetLabel",2,2,[ne],[]],["GetOwner",2,3,[],[d]],["GetPath",2,4,[],[he(ne),he(d)]]],[["Label",[ne],2,1,!1,!1,null],["Owner",[d],2,2,!1,!1,null]],[]);class oo{constructor(e,t){this.HostID=e,this.ONo=t}}const so=c({HostID:ie,ONo:d},oo);class io{constructor(e,t,n){this.Index=e,this.ObjectPath=t,this.Online=n}}const ao=c({Index:l,ObjectPath:so,Online:z},io);class co{constructor(e,t){this.GroupIndex=e,this.CitizenIndex=t}}const lo=c({GroupIndex:l,CitizenIndex:l},co);class uo{constructor(e,t,n){this.Index=e,this.Name=t,this.ProxyONo=n}}const ho=c({Index:l,Name:ne,ProxyONo:d},uo);class go extends(G({MasterSlave:1,PeerToPeer:2})){}const So=Y(go);class fo extends(G({citizenAdded:1,citizenDeleted:2,citizenConnectionLost:3,citizenConnectionReEstablished:4,citizenError:5,enrollment:6,unEnrollment:7})){}const po=Y(fo),mo=V("OcaGrouper",3,"",2,ro,[["AddGroup",3,1,[ne],[l,d]],["DeleteGroup",3,2,[l],[]],["GetGroupCount",3,3,[],[l]],["GetGroupList",3,4,[],[he(ho)]],["AddCitizen",3,5,[ao],[l]],["DeleteCitizen",3,6,[l],[]],["GetCitizenCount",3,7,[],[l]],["GetCitizenList",3,8,[],[he(ao)]],["GetEnrollment",3,9,[lo],[z]],["SetEnrollment",3,10,[lo,z],[]],["GetGroupMemberList",3,11,[l],[he(ao)]],["GetActuatorOrSensor",3,12,[],[z]],["SetActuatorOrSensor",3,13,[z],[]],["GetMode",3,14,[],[So]],["SetMode",3,15,[So],[]]],[["ActuatorOrSensor",[z],3,1,!1,!1,null],["Groups",[he(ho)],3,2,!1,!1,["GroupList"]],["Citizens",[he(ao)],3,3,!1,!1,["CitizenList"]],["Enrollments",[he(lo)],3,4,!1,!1,["EnrollmentList"]],["Mode",[So],3,5,!1,!1,null]],[["StatusChange",3,1,[l,l,po]]]);class Oo 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 yo=Y(Oo);class bo{constructor(e,t,n,r){this.PropertyID=e,this.BaseDataType=t,this.GetterMethodID=n,this.SetterMethodID=r}}const Co=c({PropertyID:J,BaseDataType:yo,GetterMethodID:_e,SetterMethodID:_e},bo);class wo{constructor(e,t){this.ONo=e,this.Descriptor=t}}const Po=c({ONo:d,Descriptor:Co},wo);class Go extends(G({Enable:1,Start:2,Halt:3})){}const vo=Y(Go);class Do extends(G({Linear:1,ReverseLinear:2,Sine:3,Exponential:4})){}const To=Y(Do);class _o extends(G({NotInitialized:1,Iniitialized:2,Scheduled:3,Enabled:4,Ramping:5})){}const Io=Y(_o),Mo=V("OcaRamper",3,"",2,ro,[["Control",3,1,[vo],[]],["GetState",3,2,[],[Io]],["GetRampedProperty",3,3,[],[Po]],["SetRampedProperty",3,4,[Po],[]],["GetTimeMode",3,5,[],[lt]],["SetTimeMode",3,6,[lt],[]],["GetStartTime",3,7,[],[rt]],["SetStartTime",3,8,[rt],[]],["GetDuration",3,9,[],[Pt,Pt,Pt]],["SetDuration",3,10,[Pt],[]],["GetInterpolationLaw",3,11,[],[To]],["SetInterpolationLaw",3,12,[To],[]],["GetGoal",3,13,[],[cr]],["SetGoal",3,14,[cr],[]]],[["State",[Io],3,1,!1,!1,null],["RampedProperty",[Po],3,2,!1,!1,null],["TimeMode",[lt],3,3,!1,!1,null],["StartTime",[rt],3,4,!1,!1,null],["Duration",[Pt],3,5,!1,!1,null],["InterpolationLaw",[To],3,6,!1,!1,null],["Goal",[cr],3,7,!1,!1,null]],[]);class Ao extends(G({NotTriggered:0,Triggered:1})){}const Lo=Y(Ao);class Eo extends(G({None:0,Equality:1,Inequality:2,GreaterThan:3,GreaterThanOrEqual:4,LessThan:5,LessThanOrEqual:6})){}const ko=Y(Eo),xo=V("OcaNumericObserver",3,"",2,ro,[["GetLastObservation",3,1,[],[cr]],["GetState",3,2,[],[Lo]],["GetObservedProperty",3,3,[],[Po]],["SetObservedProperty",3,4,[Po],[]],["GetThreshold",3,5,[],[cr]],["SetThreshold",3,6,[cr],[]],["GetOperator",3,7,[],[ko]],["SetOperator",3,8,[ko],[]],["GetTwoWay",3,9,[],[z]],["SetTwoWay",3,10,[z],[]],["GetHysteresis",3,11,[],[cr]],["SetHysteresis",3,12,[cr],[]],["GetPeriod",3,13,[],[Pt]],["SetPeriod",3,14,[Pt],[]]],[["State",[Lo],3,1,!1,!1,null],["ObservedProperty",[Po],3,2,!1,!1,null],["Threshold",[cr],3,3,!1,!1,null],["Operator",[ko],3,4,!1,!1,null],["TwoWay",[z],3,5,!1,!1,null],["Hysteresis",[cr],3,6,!1,!1,null],["Period",[Pt],3,7,!1,!1,null]],[["Observation",3,1,[S,cr]]]);class No extends(G({None:0,ReadOnly:1,ReadExpand:2,Full:3})){}const Uo=Y(No);class Ro{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 Fo=c({Name:ne,VolType:We,Access:Uo,Version:d,Creator:ne,UpDate:st},Ro);class Bo{constructor(e,t){this.Metadata=e,this.Data=t}}const jo=c({Metadata:Fo,Data:ie},Bo),Vo=V("OcaLibrary",3,"",2,ro,[["AddVolume",3,1,[jo],[d]],["ReplaceVolume",3,2,[d,jo],[]],["DeleteVolume",3,3,[d],[]],["GetVolume",3,4,[],[jo]],["GetVolumeCount",3,5,[],[l]],["GetVolumes",3,6,[],[at(d,jo)]],["GetAccess",3,7,[],[Uo]],["SetAccess",3,8,[Uo],[]]],[["VolumeType",[We],3,1,!1,!1,null],["Access",[Uo],3,2,!1,!1,null],["Volumes",[at(d,jo)],3,3,!1,!1,null]],[["OcaLibVolChanged",3,1,[d,Q]]]);class zo extends(G({Unspecified:1,Internal:2,External:3})){}const qo=Y(zo);class Ho extends(G({Off:0,Unavailable:1,Available:2,Active:3})){}const Wo=Y(Ho);class Ko extends(G({None:0,Mains:1,Battery:2,Phantom:3,Solar:4})){}const Xo=Y(Ko),Yo=V("OcaPowerSupply",3,"",3,ro,[["GetType",3,1,[],[Xo]],["GetModelInfo",3,2,[],[ne]],["GetState",3,3,[],[Wo]],["SetState",3,4,[Wo],[]],["GetCharging",3,5,[],[z]],["GetLoadFractionAvailable",3,6,[],[Pt]],["GetStorageFractionAvailable",3,7,[],[Pt]],["GetLocation",3,8,[],[qo]]],[["Type",[Xo],3,1,!1,!1,null],["ModelInfo",[ne],3,2,!1,!1,null],["State",[Wo],3,3,!1,!1,null],["Charging",[z],3,4,!1,!1,null],["LoadFractionAvailable",[Pt],3,5,!0,!1,null],["StorageFractionAvailable",[Pt],3,6,!0,!1,null],["Location",[qo],3,7,!0,!1,null]],[]),Qo=V("OcaEventHandler",3,"\b",2,ro,[["OnEvent",3,1,[ie,S],[]]],[],[]),Jo=V("OcaNumericObserverList",3,"\t",2,ro,[["GetLastObservation",3,1,[],[he(cr)]],["GetState",3,2,[],[Lo]],["GetObservedProperties",3,3,[],[he(Po)]],["SetObservedProperties",3,4,[he(Po)],[]],["GetThreshold",3,5,[],[cr]],["SetThreshold",3,6,[cr],[]],["GetOperator",3,7,[],[ko]],["SetOperator",3,8,[ko],[]],["GetTwoWay",3,9,[],[z]],["SetTwoWay",3,10,[z],[]],["GetHysteresis",3,11,[],[cr]],["SetHysteresis",3,12,[cr],[]],["GetPeriod",3,13,[],[Pt]],["SetPeriod",3,14,[Pt],[]]],[["State",[Lo],3,1,!1,!1,null],["ObservedProperties",[he(Po)],3,2,!1,!1,null],["Threshold",[cr],3,3,!1,!1,null],["Operator",[ko],3,4,!1,!1,null],["TwoWay",[z],3,5,!1,!1,null],["Hysteresis",[cr],3,6,!1,!1,null],["Period",[Pt],3,7,!1,!1,null]],[["Observation",3,1,[S,he(cr)]]]);class Zo extends(G({Unavailable:0,Available:1})){}const $o=Y(Zo);class es{constructor(e,t,n,r){this.NominalRate=e,this.PullRange=t,this.Accuracy=n,this.JitterMax=r}}const ts=c({NominalRate:Pt,PullRange:Pt,Accuracy:Pt,JitterMax:Pt},es),ns=V("OcaMediaClock3",3,"",1,ro,[["GetAvailability",3,1,[],[$o]],["SetAvailability",3,2,[$o],[]],["GetCurrentRate",3,3,[],[ts,d]],["SetCurrentRate",3,4,[ts,d],[]],["GetOffset",3,5,[],[st]],["SetOffset",3,6,[st],[]],["GetSupportedRates",3,7,[],[at(d,he(ts))]]],[["Availability",[$o],3,1,!1,!1,null],["TimeSourceONo",[d],3,2,!1,!1,null],["Offset",[st],3,3,!1,!1,null],["CurrentRate",[ts],3,4,!1,!1,null],["SupportedRates",[at(d,he(ts))],3,5,!1,!1,null]],[]);class rs 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 os=Y(rs);class ss extends(G({Undefined:0,Local:1,Private:2,GPS:3,Galileo:4,GLONASS:5})){}const is=Y(ss);class as extends(G({Unavailable:0,Available:1})){}const cs=Y(as);class ls extends(G({Undefined:0,Unsynchronized:1,Synchronizing:2,Synchronized:3})){}const us=Y(ls),hs=V("OcaTimeSource",3,"",1,ro,[["GetAvailability",3,1,[],[cs]],["GetProtocol",3,2,[],[os]],["SetProtocol",3,3,[os],[]],["GetParameters",3,4,[],[ne]],["SetParameters",3,5,[ne],[]],["GetReferenceType",3,6,[],[is]],["SetReferenceType",3,7,[is],[]],["GetReferenceID",3,8,[],[ne]],["SetReferenceID",3,9,[ne],[]],["GetSyncStatus",3,10,[],[us]],["Reset",3,11,[],[]]],[["Availability",[cs],3,1,!1,!1,null],["Protocol",[os],3,2,!1,!1,null],["Parameters",[ne],3,3,!1,!1,null],["ReferenceType",[is],3,4,!1,!1,null],["ReferenceID",[ne],3,5,!1,!1,null],["SyncStatus",[us],3,6,!1,!1,null]],[]);class ds extends(G({Robotic:1,ItuAudioObjectBasedPolar:2,ItuAudioObjectBasedCartesian:3,ItuAudioSceneBasedPolar:4,ItuAudioSceneBasedCartesian:5,NAV:6,ProprietaryBase:128})){}const gs=Y(ds);class Ss{constructor(e,t,n){this.CoordinateSystem=e,this.FieldFlags=t,this.Values=n}}const fs=c({CoordinateSystem:gs,FieldFlags:hn,Values:Pt},Ss),ps=V("OcaPhysicalPosition",3,"",1,ro,[["GetCoordinateSystem",3,1,[],[gs]],["GetPositionDescriptorFieldFlags",3,2,[],[hn]],["GetPositionDescriptor",3,3,[],[fs,fs,fs]],["SetPositionDescriptor",3,4,[fs],[]]],[["CoordinateSystem",[gs],3,1,!0,!1,null],["PositionDescriptorFieldFlags",[hn],3,2,!0,!1,null],["PositionDescriptor",[fs],3,3,!1,!1,null]],[]);class ms extends(G({None:0,Prepare:1,Start:2,Pause:3,Stop:4,Reset:5})){}const Os=Y(ms);class ys extends(G({Unknown:0,NotReady:1,Readying:2,Ready:3,Running:4,Paused:5,Stopping:6,Stopped:7,Fault:8})){}const bs=Y(ys);class Cs{constructor(e,t){this.SystemInterfaceParameters=e,this.MyNetworkAddress=t}}const ws=c({SystemInterfaceParameters:ie,MyNetworkAddress:ie},Cs),Ps=V("OcaApplicationNetwork",2,"",1,re,[["GetLabel",2,1,[],[ne]],["SetLabel",2,2,[ne],[]],["GetOwner",2,3,[],[d]],["GetServiceID",2,4,[],[ie]],["SetServiceID",2,5,[ie],[]],["GetSystemInterfaces",2,6,[],[he(ws)]],["SetSystemInterfaces",2,7,[he(ws)],[]],["GetState",2,8,[],[bs]],["GetErrorCode",2,9,[],[l]],["Control",2,10,[Os],[]],["GetPath",2,11,[],[he(ne),he(d)]]],[["Label",[ne],2,1,!1,!0,null],["Owner",[d],2,2,!1,!0,null],["ServiceID",[ie],2,3,!1,!1,null],["SystemInterfaces",[he(ws)],2,4,!1,!1,null],["State",[bs],2,5,!1,!1,null],["ErrorCode",[l],2,6,!1,!1,null]],[]);class Gs extends(G({None:0,OCP01:1,OCP02:2,OCP03:3})){}const vs=Y(Gs),Ds=V("OcaControlNetwork",3,"",1,Ps,[["GetControlProtocol",3,1,[],[vs]]],[["Protocol",[vs],3,1,!1,!1,["ControlProtocol"]]],[]);class Ts{constructor(e,t,n){this.CodingSchemeID=e,this.CodecParameters=t,this.ClockONo=n}}const _s=c({CodingSchemeID:l,CodecParameters:ne,ClockONo:d},Ts);class Is extends(G({None:0,Unicast:1,Multicast:2})){}const Ms=Y(Is);class As{constructor(e,t,n,r){this.Secure=e,this.StreamParameters=t,this.StreamCastMode=n,this.StreamChannelCount=r}}const Ls=c({Secure:z,StreamParameters:ie,StreamCastMode:Ms,StreamChannelCount:l},As);class Es extends(G({None:0,Start:1,Pause:2})){}const ks=Y(Es),xs=K;class Ns extends(G({Stopped:0,SettingUp:1,Running:2,Paused:3,Fault:4})){}const Us=Y(Ns);class Rs{constructor(e,t,n){this.ConnectorID=e,this.State=t,this.ErrorCode=n}}const Fs=c({ConnectorID:l,State:Us,ErrorCode:l},Rs);function Bs(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 js{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 Vs=c({IDInternal:l,IDExternal:ne,Connection:Ls,AvailableCodings:he(_s),PinCount:l,ChannelPinMap:Bs(l,Tt),AlignmentLevel:Pt,AlignmentGain:Pt,CurrentCoding:_s},js);class zs{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 qs=c({IDInternal:l,IDExternal:ne,Connection:Ls,AvailableCodings:he(_s),PinCount:l,ChannelPinMap:at(l,Tt),AlignmentLevel:Pt,CurrentCoding:_s},zs);class Hs extends(G({None:0,AV3:1,AVBTP:2,Dante:3,Cobranet:4,AES67:5,SMPTEAudio:6,LiveWire:7,ExtensionPoint:65})){}const Ws=Y(Hs),Ks=V("OcaMediaTransportNetwork",3,"",1,Ps,[["GetMediaProtocol",3,1,[],[Ws]],["GetPorts",3,2,[],[he(It)]],["GetPortName",3,3,[Tt],[ne]],["SetPortName",3,4,[Tt,ne],[]],["GetMaxSourceConnectors",3,5,[],[l]],["GetMaxSinkConnectors",3,6,[],[l]],["GetMaxPinsPerConnector",3,7,[],[l]],["GetMaxPortsPerPin",3,8,[],[l]],["GetSourceConnectors",3,9,[],[he(qs)]],["GetSourceConnector",3,10,[l],[qs]],["GetSinkConnectors",3,11,[],[he(Vs)]],["GetSinkConnector",3,12,[l],[Vs]],["GetConnectorsStatuses",3,13,[],[he(Fs)]],["GetConnectorStatus",3,14,[l],[Fs]],["AddSourceConnector",3,15,[qs,Us],[qs]],["AddSinkConnector",3,16,[Fs,Vs],[Vs]],["ControlConnector",3,17,[l,ks],[]],["SetSourceConnectorPinMap",3,18,[l,at(l,Tt)],[]],["SetSinkConnectorPinMap",3,19,[l,Bs(l,Tt)],[]],["SetConnectorConnection",3,20,[l,Ls],[]],["SetConnectorCoding",3,21,[l,_s],[]],["SetConnectorAlignmentLevel",3,22,[l,Pt],[]],["SetConnectorAlignmentGain",3,23,[l,Pt],[]],["DeleteConnector",3,24,[l],[]],["GetAlignmentLevel",3,25,[],[Pt,Pt,Pt]],["GetAlignmentGain",3,26,[],[Pt,Pt,Pt]]],[["Protocol",[Ws],3,1,!1,!1,["MediaProtocol"]],["Ports",[he(It)],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",[Pt],3,7,!1,!1,null],["AlignmentGain",[Pt],3,8,!1,!1,null]],[["SourceConnectorChanged",3,1,[qs,Q,xs]],["SinkConnectorChanged",3,2,[Vs,Q,xs]],["ConnectorStatusChanged",3,3,[Fs]]]);class Xs extends(G({None:0,Source:1,Sink:2})){}const Ys=Y(Xs);class Qs extends(G({NotConnected:0,Connected:1,Muted:2})){}const Js=Y(Qs),Zs=V("OcaNetworkSignalChannel",3,"",2,Mt,[["AddToConnector",3,6,[d,l],[]],["GetConnectorPins",3,5,[],[at(d,l)]],["GetIDAdvertised",3,1,[],[ie]],["GetNetwork",3,3,[],[d]],["GetRemoteChannelID",3,8,[],[ie]],["GetSourceOrSink",3,10,[],[Ys]],["GetStatus",3,11,[],[Js]],["RemoveFromConnector",3,7,[d],[]],["SetIDAdvertised",3,2,[ie],[]],["SetNetwork",3,4,[d],[]],["SetRemoteChannelID",3,9,[ie],[]]],[["ConnectorPins",[at(d,l)],3,3,!1,!1,null],["IDAdvertised",[ie],3,1,!1,!1,null],["Network",[d],3,2,!1,!1,null],["RemoteChannelID",[ie],3,4,!1,!1,null],["SourceOrSink",[Ys],3,5,!1,!1,null],["Status",[Js],3,6,!1,!1,null]],[]);class $s extends(G({None:0,EthernetWired:1,EthernetWireless:2,USB:3,SerialP2P:4})){}const ei=Y($s);class ti{constructor(e,t){this.rxPacketErrors=e,this.txPacketErrors=t}}const ni=c({rxPacketErrors:d,txPacketErrors:d},ti);class ri extends(G({Unknown:0,Ready:1,StartingUp:2,Stopped:3})){}const oi=Y(ri);class si{constructor(e,t){this.SystemInterfaceHandle=e,this.MyNetworkAddress=t}}const ii=c({SystemInterfaceHandle:ie,MyNetworkAddress:ie},si),ai=V("OcaNetwork",3,"",2,ro,[["GetLinkType",3,1,[],[ei]],["GetIDAdvertised",3,2,[],[ie]],["SetIDAdvertised",3,3,[ie],[]],["GetControlProtocol",3,4,[],[vs]],["GetMediaProtocol",3,5,[],[Ws]],["GetStatus",3,6,[],[oi]],["GetStatistics",3,7,[],[ni]],["ResetStatistics",3,8,[],[]],["GetSystemInterfaces",3,9,[],[he(ii)]],["SetSystemInterfaces",3,10,[he(ii)],[]],["GetMediaPorts",3,11,[],[he(d)]],["Startup",3,12,[],[]],["Shutdown",3,13,[],[]]],[["LinkType",[ei],3,1,!0,!1,null],["IDAdvertised",[ie],3,2,!1,!1,null],["ControlProtocol",[vs],3,3,!1,!1,null],["MediaProtocol",[Ws],3,4,!1,!1,null],["Status",[oi],3,5,!1,!1,null],["SystemInterfaces",[he(ii)],3,6,!1,!1,null],["MediaPorts",[he(d)],3,7,!1,!1,null],["Statistics",[ni],3,8,!1,!1,null]],[]);class ci extends(G({Undefined:0,Locked:1,Synchronizing:2,FreeRun:3,Stopped:4})){}const li=Y(ci),ui=V("OcaMediaClock",3,"",2,ro,[["GetType",3,1,[],[je]],["SetType",3,2,[je],[]],["GetDomainID",3,3,[],[l]],["SetDomainID",3,4,[l],[]],["GetSupportedRates",3,5,[],[he(ts)]],["GetCurrentRate",3,6,[],[ts]],["SetCurrentRate",3,7,[ts],[]],["GetLockState",3,8,[],[li]]],[["Type",[je],3,1,!1,!1,null],["DomainID",[l],3,2,!1,!1,null],["RatesSupported",[he(ts)],3,3,!1,!1,null],["CurrentRate",[ts],3,4,!1,!1,null],["LockState",[li],3,5,!1,!1,null]],[]),hi=V("OcaStreamNetwork",3,"\n",2,ro,[["GetLinkType",3,1,[],[ei]],["GetIDAdvertised",3,2,[],[ie]],["SetIDAdvertised",3,3,[ie],[]],["GetControlProtocol",3,4,[],[vs]],["GetMediaProtocol",3,5,[],[Ws]],["GetStatus",3,6,[],[oi]],["GetStatistics",3,7,[],[ni]],["ResetStatistics",3,8,[],[]],["GetSystemInterfaces",3,9,[],[he(ii)]],["SetSystemInterfaces",3,10,[he(ii)],[]],["GetStreamConnectorsSource",3,11,[],[he(d)]],["SetStreamConnectorsSource",3,12,[he(d)],[]],["GetStreamConnectorsSink",3,13,[],[he(d)]],["SetStreamConnectorsSink",3,14,[he(d)],[]],["GetSignalChannelsSource",3,15,[],[he(d)]],["SetSignalChannelsSource",3,16,[he(d)],[]],["GetSignalChannelsSink",3,17,[],[he(d)]],["SetSignalChannelsSink",3,18,[he(d)],[]],["Startup",3,19,[],[]],["Shutdown",3,20,[],[]]],[["ControlProtocol",[vs],3,3,!1,!1,null],["IDAdvertised",[ie],3,2,!1,!1,null],["LinkType",[ei],3,1,!0,!1,null],["MediaProtocol",[Ws],3,4,!1,!1,null],["SignalChannelsSink",[he(d)],3,10,!1,!1,null],["SignalChannelsSource",[he(d)],3,9,!1,!1,null],["Statistics",[ni],3,11,!1,!1,null],["Status",[oi],3,5,!1,!1,null],["StreamConnectorsSink",[he(d)],3,8,!1,!1,null],["StreamConnectorsSource",[he(d)],3,7,!1,!1,null],["SystemInterfaces",[he(ii)],3,6,!1,!1,null]],[]);class di{constructor(e,t,n,r){this.HostID=e,this.NetworkAddress=t,this.NodeID=n,this.StreamConnectorID=r}}const gi=c({HostID:ie,NetworkAddress:ie,NodeID:ie,StreamConnectorID:ie},di);class Si extends(G({NotConnected:0,Connected:1,Paused:2})){}const fi=Y(Si);class pi extends(G({None:0,Unicast:1,Multicast:2})){}const mi=Y(pi);class Oi{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 yi=c({ErrorNumber:l,IDAdvertised:ie,Index:l,Label:ne,LocalConnectorONo:d,Priority:l,RemoteConnectorIdentification:gi,Secure:z,Status:fi,StreamParameters:ie,StreamType:mi},Oi);class bi extends(G({NotAvailable:0,Idle:1,Connected:2,Paused:3})){}const Ci=Y(bi),wi=V("OcaStreamConnector",3,"\v",2,ro,[["ConnectStream",3,7,[yi],[l]],["DisconnectStream",3,8,[l],[]],["GetIDAdvertised",3,3,[],[ie]],["GetOwnerNetwork",3,1,[],[d]],["GetPins",3,10,[],[at(l,d)]],["GetSourceOrSink",3,5,[],[Ys]],["GetStatus",3,11,[],[Ci]],["GetStreams",3,9,[],[at(l,yi)]],["SetIDAdvertised",3,4,[ie],[]],["SetOwnerNetwork",3,2,[d],[]],["SetSourceOrSink",3,6,[Ys],[]]],[["IDAdvertised",[ie],3,2,!1,!1,null],["OwnerNetwork",[d],3,1,!1,!1,null],["Pins",[at(l,d)],3,5,!1,!1,null],["SourceOrSink",[Ys],3,3,!1,!1,null],["Status",[Ci],3,6,!1,!1,null],["Streams",[at(l,yi)],3,4,!1,!1,null]],[]);var Pi=Object.freeze({__proto__:null,OcaRoot:re,OcaWorker:Mt,OcaActuator:Kt,OcaMute:Qt,OcaPolarity:$t,OcaSwitch:en,OcaGain:tn,OcaPanBalance:nn,OcaDelay:rn,OcaDelayExtended:ln,OcaFrequencyActuator:un,OcaFilterClassical:pn,OcaFilterParametric:yn,OcaFilterPolynomial:bn,OcaFilterFIR:Cn,OcaFilterArbitraryCurve:Gn,OcaDynamics:En,OcaDynamicsDetector:kn,OcaDynamicsCurve:xn,OcaSignalGenerator:Bn,OcaSignalInput:jn,OcaSignalOutput:Vn,OcaTemperatureActuator:zn,OcaIdentificationActuator:qn,OcaSummingPoint:Hn,OcaBasicActuator:Wn,OcaBooleanActuator:Kn,OcaInt8Actuator:Yn,OcaInt16Actuator:Jn,OcaInt32Actuator:$n,OcaInt64Actuator:nr,OcaUint8Actuator:rr,OcaUint16Actuator:or,OcaUint32Actuator:sr,OcaUint64Actuator:ir,OcaFloat32Actuator:ar,OcaFloat64Actuator:lr,OcaStringActuator:ur,OcaBitstringActuator:Sr,OcaSensor:mr,OcaLevelSensor:Or,OcaAudioLevelSensor:Cr,OcaTimeIntervalSensor:wr,OcaFrequencySensor:Pr,OcaTemperatureSensor:Gr,OcaIdentificationSensor:vr,OcaVoltageSensor:Dr,OcaCurrentSensor:Tr,OcaImpedanceSensor:Mr,OcaGainSensor:Ar,OcaBasicSensor:Lr,OcaBooleanSensor:Er,OcaInt8Sensor:kr,OcaInt16Sensor:xr,OcaInt32Sensor:Nr,OcaInt64Sensor:Ur,OcaUint8Sensor:Rr,OcaUint16Sensor:Fr,OcaUint32Sensor:Br,OcaFloat32Sensor:jr,OcaFloat64Sensor:Vr,OcaStringSensor:zr,OcaBitstringSensor:qr,OcaUint64Sensor:Hr,OcaBlock:Wt,OcaBlockFactory:eo,OcaMatrix:no,OcaAgent:ro,OcaGrouper:mo,OcaRamper:Mo,OcaNumericObserver:xo,OcaLibrary:Vo,OcaPowerSupply:Yo,OcaEventHandler:Qo,OcaNumericObserverList:Jo,OcaMediaClock3:ns,OcaTimeSource:hs,OcaPhysicalPosition:ps,OcaApplicationNetwork:Ps,OcaControlNetwork:Ds,OcaMediaTransportNetwork:Ks,OcaManager:se,OcaDeviceManager:be,OcaSecurityManager:Ce,OcaFirmwareManager:De,OcaSubscriptionManager:xe,OcaPowerManager:Re,OcaNetworkManager:Fe,OcaMediaClockManager:Ve,OcaLibraryManager:Ye,OcaAudioProcessingManager:Qe,OcaDeviceTimeManager:it,OcaTaskManager:bt,OcaCodingManager:Ct,OcaDiagnosticManager:wt,OcaNetworkSignalChannel:Zs,OcaNetwork:ai,OcaMediaClock:ui,OcaStreamNetwork:hi,OcaStreamConnector:wi});const Gi={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 vi(e){const t=e.EmitterONo,n=e.EventID;return[t,n.DefLevel,n.EventIndex].join(",")}class Di 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(Pi)),t.map(e=>this.add_control_classes(e)),this.DeviceManager=new be(Gi.DeviceManager,this),this.SecurityManager=new Ce(Gi.SecurityManager,this),this.FirmwareManager=new De(Gi.FirmwareManager,this),this.SubscriptionManager=new xe(Gi.SubscriptionManager,this),this.PowerManager=new Re(Gi.PowerManager,this),this.NetworkManager=new Fe(Gi.NetworkManager,this),this.MediaClockManager=new Ve(Gi.MediaClockManager,this),this.LibraryManager=new Ye(Gi.LibraryManager,this),this.AudioProcessingManager=new Qe(Gi.AudioProcessingManager,this),this.DeviceTimeManager=new it(Gi.DeviceTimeManager,this),this.TaskManager=new bt(Gi.TaskManager,this),this.CodingManager=new Ct(Gi.CodingManager,this),this.DiagnosticManager=new wt(Gi.DiagnosticManager,this),this.Root=new Wt(100,this),this.subscriptions=new Map}close(){this.connection.close()}send_command(e,t){return this.connection.send_command(e,t)}add_subscription(n,r){const o=vi(n),s=this.subscriptions.get(o);if(s)return s.callbacks.add(r),Promise.resolve(!0);const i=n=>{const r=this.subscriptions.get(o);if(!r)return void e("Subscription lost.\n");r.callbacks.forEach((function(e){try{e(n)}catch(e){t(e)}}))},a=this.connection.get_new_subscriber(i);return this.subscriptions.set(o,{callbacks:new Set([r]),method:a,callback:i}),this.SubscriptionManager.AddSubscription(n,a,new Uint8Array(0),Ae.Reliable,new Uint8Array(0))}remove_subscription(e,t){const n=vi(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.remove_subscriber(r.method),this.subscriptions.delete(n),this.SubscriptionManager.RemoveSubscription(e,r.method))}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(Wt.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 Ti=Object.values(Pi);class _i extends(G({None:0,ParamSet:1,Patch:2,Program:3})){}class Ii extends(G({Ampere:4,DegreeCelsius:2,Hertz:1,None:0,Ohm:5,Volt:3})){}var Mi=Object.freeze({__proto__:null,OcaApplicationNetworkCommand:ms,OcaApplicationNetworkState:ys,OcaBaseDataType:Oo,OcaBlockMember:Et,OcaClassAuthorityID:class{constructor(e,t,n){this.Sentinel=e,this.Reserved=t,this.OrganizationID=n}},OcaClassIdentification:H,OcaClassicalFilterShape:dn,OcaComponent:we,OcaDBr:vn,OcaDelayUnit:on,OcaDelayValue:an,OcaDeviceState:{Operational:1,Disabled:2,Error:4,Initializing:8,Updating:16,unused:32},OcaDynamicsFunction:Tn,OcaEnumItem:class{constructor(e){this.Value=e}},OcaEnumItem16:class{constructor(e){this.Value=e}},OcaEvent:g,OcaEventID:u,OcaFilterPassband:Sn,OcaGlobalTypeIdentifier:xt,OcaGrouperCitizen:io,OcaGrouperEnrollment:co,OcaGrouperGroup:uo,OcaGrouperMode:go,OcaGrouperStatusChangeEventData:class{constructor(e,t,n,r){this.Event=e,this.groupIndex=t,this.citizenIndex=n,this.changeType=r}},OcaGrouperStatusChangeType:fo,OcaImpedance:_r,OcaLevelDetectionLaw:In,OcaLevelMeterLaw:yr,OcaLibAccess:No,OcaLibParamSetAssignment:class{constructor(e,t){this.ParamSetIdentifier=e,this.TargetBlockONo=t}},OcaLibVol:Bo,OcaLibVolChangedEventData:class{constructor(e,t,n){this.Event=e,this.VolumeID=t,this.ChangeType=n}},OcaLibVolData_ParamSet:Ut,OcaLibVolIdentifier:ze,OcaLibVolMetadata:Ro,OcaLibVolStandardTypeID:_i,OcaLibVolType:He,OcaLibraryIdentifier:Ke,OcaManagerDefaultObjectNumbers:Gi,OcaManagerDescriptor:de,OcaMediaClockAvailability:Zo,OcaMediaClockLockState:ci,OcaMediaClockRate:es,OcaMediaClockType:Be,OcaMediaCoding:Ts,OcaMediaConnection:As,OcaMediaConnectorCommand:Es,OcaMediaConnectorElement:{PinMap:1,Connection:2,Coding:4,AlignmentLevel:8,AlignmentGain:16},OcaMediaConnectorState:Ns,OcaMediaConnectorStatus:Rs,OcaMediaConnectorStatusChangedEventData:class{constructor(e,t){this.Event=e,this.ConnectorStatus=t}},OcaMediaSinkConnector:js,OcaMediaSinkConnectorChangedEventData:class{constructor(e,t,n,r){this.Event=e,this.SinkConnector=t,this.ChangeType=n,this.ChangedElement=r}},OcaMediaSourceConnector:zs,OcaMediaSourceConnectorChangedEventData:class{constructor(e,t,n,r){this.Event=e,this.SourceConnector=t,this.ChangeType=n,this.ChangedElement=r}},OcaMediaStreamCastMode:Is,OcaMethod:Ie,OcaMethodID:Te,OcaModelDescription:Se,OcaModelGUID:pe,OcaMuteState:Xt,OcaNetworkControlProtocol:Gs,OcaNetworkLinkType:$s,OcaNetworkMediaProtocol:Hs,OcaNetworkMediaSourceOrSink:Xs,OcaNetworkSignalChannelStatus:Qs,OcaNetworkStatistics:ti,OcaNetworkStatus:ri,OcaNetworkSystemInterfaceDescriptor:Cs,OcaNetworkSystemInterfaceID:si,OcaNotificationDeliveryMode:Ae,OcaOPath:oo,OcaObjectIdentification:At,OcaObjectListEventData:class{constructor(e,t){this.Event=e,this.objectList=t}},OcaObjectSearchResult:Ft,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:Ao,OcaParametricEQShape:mn,OcaPilotToneDetectorSpec:class{constructor(e,t,n){this.Threshold=e,this.Frequency=t,this.PollInterval=n}},OcaPolarityState:Jt,OcaPort:_t,OcaPortID:Dt,OcaPortMode:Gt,OcaPositionCoordinateSystem:ds,OcaPositionDescriptor:Ss,OcaPowerState:Ne,OcaPowerSupplyLocation:zo,OcaPowerSupplyState:Ho,OcaPowerSupplyType:Ko,OcaPresentationUnit:An,OcaProperty:wo,OcaPropertyChangeType:E,OcaPropertyDescriptor:bo,OcaPropertyID:x,OcaProtoObjectIdentification:Wr,OcaProtoPort:Qr,OcaProtoPortID:Xr,OcaProtoSignalPath:Zr,OcaRamperCommand:Go,OcaRamperInterpolationLaw:Do,OcaRamperState:_o,OcaRelationalOperator:Eo,OcaResetCause:Oe,OcaSensorReadingState:fr,OcaSignalPath:Vt,OcaStatus:v,OcaStream:Oi,OcaStreamConnectorIdentification:di,OcaStreamConnectorStatus:bi,OcaStreamStatus:Si,OcaStreamType:pi,OcaStringComparisonType:qt,OcaSubscriptionManagerState:Ee,OcaSweepType:Nn,OcaTask:ut,OcaTaskCommand:dt,OcaTaskManagerState:St,OcaTaskState:pt,OcaTaskStateChangedEventData:class{constructor(e,t,n){this.TaskID=e,this.ProgramID=t,this.Status=n}},OcaTaskStatus:Ot,OcaTimeMode:ct,OcaTimePTP:ot,OcaTimeProtocol:rs,OcaTimeReferenceType:ss,OcaTimeSourceAvailability:as,OcaTimeSourceSyncStatus:ls,OcaTransferFunction:wn,OcaUnitOfMeasure:Ii,OcaVersion:Ge,OcaWaveformType:Rn});class Ai extends I{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 Li={Connection:I,WebSocket:Ai,Device:Di,ControlClasses:Pi,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<Ti.length;e++)if(Ti[e].ClassName===o){o=Ti[e];break}}else{const e=n.substr(0,n.length-1);for(let t=0;t<Ti.length;t++)if(Ti[t].ClassID===e){o=Ti[t];break}}if("function"!=typeof o)throw new Error("Unknown parent class.");return V(e,t,n,r,o,s,i,a)}};var Ei=Object.freeze({__proto__:null,Connection:w,controller:Li,ClientConnection:I,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:Di,Types:Mi,warn:e,WebSocketConnection:Ai,RemoteControlClasses:Pi});window.OCA=Ei}();
|
|
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}();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aes70",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.6",
|
|
4
4
|
"description": "A controller library for the AES70 protocol.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -9,9 +9,14 @@
|
|
|
9
9
|
"browser:module": "src/index.browser.js",
|
|
10
10
|
"typings": "src/index.d.ts",
|
|
11
11
|
"exports": {
|
|
12
|
-
".":
|
|
12
|
+
".": {
|
|
13
|
+
"node": "./src/index.js",
|
|
14
|
+
"default": "./src/index.browser.js"
|
|
15
|
+
},
|
|
13
16
|
"./RemoteControlClasses": "./src/controller/ControlClasses.js",
|
|
14
|
-
"./OCP1": "./src/OCP1.js"
|
|
17
|
+
"./OCP1": "./src/OCP1.js",
|
|
18
|
+
"./AES70.es5.js": "./dist/AES70.es5.js",
|
|
19
|
+
"./*": "./src/*"
|
|
15
20
|
},
|
|
16
21
|
"bin": {
|
|
17
22
|
"printDevice": "bin/printDevice.js"
|
|
@@ -15,16 +15,13 @@ function calculateMessageLength(pdus) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export function encodeMessageTo(dst, pos, pdus, offset, end) {
|
|
18
|
-
if (!offset)
|
|
19
|
-
offset = 0;
|
|
18
|
+
if (!offset) offset = 0;
|
|
20
19
|
|
|
21
|
-
if (!end)
|
|
22
|
-
end = pdus.length;
|
|
20
|
+
if (!end) end = pdus.length;
|
|
23
21
|
|
|
24
22
|
const count = end - offset;
|
|
25
23
|
|
|
26
|
-
if (!(count <= 0xffff))
|
|
27
|
-
throw new Error('Too many PDUs.');
|
|
24
|
+
if (!(count <= 0xffff)) throw new Error('Too many PDUs.');
|
|
28
25
|
|
|
29
26
|
dst.setUint8(pos, 0x3b);
|
|
30
27
|
pos += 1;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
encodeMessageTo,
|
|
3
|
-
messageHeaderSize,
|
|
4
|
-
} from './encode_message.js';
|
|
1
|
+
import { encodeMessageTo, messageHeaderSize } from './encode_message.js';
|
|
5
2
|
|
|
6
3
|
const pduTypeKeepAlive = 4;
|
|
7
4
|
|
|
8
5
|
export class MessageGenerator {
|
|
9
6
|
constructor(batchSize, resultCallback) {
|
|
10
|
-
if (!(batchSize <= 0xffffffff))
|
|
11
|
-
throw new TypeError('Invalid batch size.');
|
|
7
|
+
if (!(batchSize <= 0xffffffff)) throw new TypeError('Invalid batch size.');
|
|
12
8
|
this._pdus = [];
|
|
13
9
|
this._batchSize = batchSize;
|
|
14
10
|
this._resultCallback = resultCallback;
|
|
@@ -19,7 +15,7 @@ export class MessageGenerator {
|
|
|
19
15
|
this._flushCb = () => {
|
|
20
16
|
this._flushScheduled = false;
|
|
21
17
|
if (this._pdus === null) return;
|
|
22
|
-
this.flush();
|
|
18
|
+
this.flush();
|
|
23
19
|
};
|
|
24
20
|
}
|
|
25
21
|
|
|
@@ -29,13 +25,13 @@ export class MessageGenerator {
|
|
|
29
25
|
const messageType = pdu.messageType;
|
|
30
26
|
|
|
31
27
|
// Can we add to the current message?
|
|
32
|
-
let combine =
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
let combine =
|
|
29
|
+
this._lastMessageType === messageType &&
|
|
30
|
+
messageType !== pduTypeKeepAlive &&
|
|
31
|
+
this._currentCount < 0xffff;
|
|
35
32
|
let additionalSize = encodedLength;
|
|
36
33
|
|
|
37
|
-
if (!combine)
|
|
38
|
-
additionalSize += messageHeaderSize;
|
|
34
|
+
if (!combine) additionalSize += messageHeaderSize;
|
|
39
35
|
|
|
40
36
|
// The resulting buffer would become too large, we flush now.
|
|
41
37
|
if (currentSize && currentSize + additionalSize > this._batchSize) {
|
|
@@ -47,7 +43,7 @@ export class MessageGenerator {
|
|
|
47
43
|
this._currentSize += additionalSize;
|
|
48
44
|
|
|
49
45
|
if (combine) {
|
|
50
|
-
this._currentCount
|
|
46
|
+
this._currentCount++;
|
|
51
47
|
} else {
|
|
52
48
|
this._currentCount = 1;
|
|
53
49
|
}
|
|
@@ -65,14 +61,15 @@ export class MessageGenerator {
|
|
|
65
61
|
scheduleFlush() {
|
|
66
62
|
if (this._flushScheduled) return;
|
|
67
63
|
this._flushScheduled = true;
|
|
68
|
-
Promise.resolve()
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
Promise.resolve()
|
|
65
|
+
.then(this._flushCb)
|
|
66
|
+
.catch((err) => {
|
|
67
|
+
console.error(err);
|
|
68
|
+
});
|
|
71
69
|
}
|
|
72
70
|
|
|
73
71
|
flush() {
|
|
74
|
-
if (!this._currentSize)
|
|
75
|
-
return;
|
|
72
|
+
if (!this._currentSize) return;
|
|
76
73
|
|
|
77
74
|
const pdus = this._pdus;
|
|
78
75
|
|
|
@@ -85,9 +82,12 @@ export class MessageGenerator {
|
|
|
85
82
|
const pdu = pdus[i];
|
|
86
83
|
const messageType = pdu.messageType;
|
|
87
84
|
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
|
|
85
|
+
if (
|
|
86
|
+
i === length - 1 ||
|
|
87
|
+
i + 1 - from === 0xffff ||
|
|
88
|
+
messageType === pduTypeKeepAlive ||
|
|
89
|
+
messageType !== pdus[i + 1].messageType
|
|
90
|
+
) {
|
|
91
91
|
pos = encodeMessageTo(dst, pos, pdus, from, i + 1);
|
|
92
92
|
from = i + 1;
|
|
93
93
|
}
|
|
@@ -77,10 +77,12 @@ export declare class OcaLibrary extends OcaAgent {
|
|
|
77
77
|
* Retrieves a library volume. The return value indicates whether the volume was successfully retrieved. Changed in version 2 because the definition of OcaLibVolMetaData, which is part of OcaLibVol, has changed.
|
|
78
78
|
*
|
|
79
79
|
* @method OcaLibrary#GetVolume
|
|
80
|
+
* @param {number} ID
|
|
81
|
+
*
|
|
80
82
|
* @returns {Promise<OcaLibVol>}
|
|
81
83
|
* A promise which resolves to a single value of type :class:`OcaLibVol`.
|
|
82
84
|
*/
|
|
83
|
-
GetVolume(): Promise<OcaLibVol>;
|
|
85
|
+
GetVolume(ID: number): Promise<OcaLibVol>;
|
|
84
86
|
|
|
85
87
|
/**
|
|
86
88
|
* Gets the count of volumes in this library. The return value indicates whether the count was successfully retrieved.
|
|
@@ -23,7 +23,7 @@ export const OcaLibrary = make_control_class(
|
|
|
23
23
|
['AddVolume', 3, 1, [OcaLibVol], [OcaUint32]],
|
|
24
24
|
['ReplaceVolume', 3, 2, [OcaUint32, OcaLibVol], []],
|
|
25
25
|
['DeleteVolume', 3, 3, [OcaUint32], []],
|
|
26
|
-
['GetVolume', 3, 4, [], [OcaLibVol]],
|
|
26
|
+
['GetVolume', 3, 4, [OcaUint32], [OcaLibVol]],
|
|
27
27
|
['GetVolumeCount', 3, 5, [], [OcaUint16]],
|
|
28
28
|
['GetVolumes', 3, 6, [], [OcaMap(OcaUint32, OcaLibVol)]],
|
|
29
29
|
['GetAccess', 3, 7, [], [OcaLibAccess]],
|
|
@@ -68,6 +68,8 @@ export const OcaLibrary = make_control_class(
|
|
|
68
68
|
* Retrieves a library volume. The return value indicates whether the volume was successfully retrieved. Changed in version 2 because the definition of OcaLibVolMetaData, which is part of OcaLibVol, has changed.
|
|
69
69
|
*
|
|
70
70
|
* @method OcaLibrary#GetVolume
|
|
71
|
+
* @param {number} ID
|
|
72
|
+
*
|
|
71
73
|
* @returns {Promise<OcaLibVol>}
|
|
72
74
|
* A promise which resolves to a single value of type :class:`OcaLibVol`.
|
|
73
75
|
*/
|
|
@@ -7,11 +7,10 @@ export declare class Arguments<ArgumentTypes extends unknown[]> {
|
|
|
7
7
|
*/
|
|
8
8
|
readonly values: ArgumentTypes;
|
|
9
9
|
|
|
10
|
-
constructor(values: ArgumentTypes)
|
|
10
|
+
constructor(values: ArgumentTypes);
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* The number of elements.
|
|
14
14
|
*/
|
|
15
15
|
get length(): number;
|
|
16
|
-
|
|
17
16
|
}
|
|
@@ -52,6 +52,13 @@ class PendingCommand {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
function eventToKey(event) {
|
|
56
|
+
const ono = event.EmitterONo;
|
|
57
|
+
const id = event.EventID;
|
|
58
|
+
|
|
59
|
+
return [ono, id.DefLevel, id.EventIndex].join(',');
|
|
60
|
+
}
|
|
61
|
+
|
|
55
62
|
/**
|
|
56
63
|
* Connection base class for clients (aka controllers).
|
|
57
64
|
*
|
|
@@ -63,12 +70,12 @@ export class ClientConnection extends Connection {
|
|
|
63
70
|
super(options);
|
|
64
71
|
this._pendingCommands = new Map();
|
|
65
72
|
this._nextCommandHandle = 0;
|
|
66
|
-
this.
|
|
73
|
+
this._subscribers = new Map();
|
|
67
74
|
}
|
|
68
75
|
|
|
69
76
|
cleanup() {
|
|
70
77
|
super.cleanup();
|
|
71
|
-
this.
|
|
78
|
+
this._subscribers = null;
|
|
72
79
|
|
|
73
80
|
const pendingCommands = this._pendingCommands;
|
|
74
81
|
this._pendingCommands = null;
|
|
@@ -78,23 +85,22 @@ export class ClientConnection extends Connection {
|
|
|
78
85
|
});
|
|
79
86
|
}
|
|
80
87
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
DefLevel: 1,
|
|
89
|
-
MethodIndex: 1,
|
|
90
|
-
},
|
|
91
|
-
};
|
|
88
|
+
_addSubscriber(event, callback) {
|
|
89
|
+
const key = eventToKey(event);
|
|
90
|
+
const subscribers = this._subscribers;
|
|
91
|
+
|
|
92
|
+
if (subscribers.has(key)) throw new Error('Subscriber already exists.');
|
|
93
|
+
|
|
94
|
+
subscribers.set(key, callback);
|
|
92
95
|
}
|
|
93
96
|
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
_removeSubscriber(event) {
|
|
98
|
+
const key = eventToKey(event);
|
|
99
|
+
const subscribers = this._subscribers;
|
|
100
|
+
|
|
101
|
+
if (!subscribers.has(key)) throw new Error('Unknown subscriber.');
|
|
102
|
+
|
|
103
|
+
subscribers.delete(key);
|
|
98
104
|
}
|
|
99
105
|
|
|
100
106
|
_getNextCommandHandle() {
|
|
@@ -107,7 +113,7 @@ export class ClientConnection extends Connection {
|
|
|
107
113
|
|
|
108
114
|
do {
|
|
109
115
|
handle = this._nextCommandHandle;
|
|
110
|
-
this._nextCommandHandle = (handle + 1)|0;
|
|
116
|
+
this._nextCommandHandle = (handle + 1) | 0;
|
|
111
117
|
} while (pendingCommands.has(handle));
|
|
112
118
|
|
|
113
119
|
return handle;
|
|
@@ -117,10 +123,14 @@ export class ClientConnection extends Connection {
|
|
|
117
123
|
return new Promise((resolve, reject) => {
|
|
118
124
|
const handle = this._getNextCommandHandle();
|
|
119
125
|
|
|
120
|
-
command.handle = handle
|
|
126
|
+
command.handle = handle;
|
|
121
127
|
|
|
122
128
|
const pendingCommand = new PendingCommand(
|
|
123
|
-
resolve,
|
|
129
|
+
resolve,
|
|
130
|
+
reject,
|
|
131
|
+
returnTypes,
|
|
132
|
+
command
|
|
133
|
+
);
|
|
124
134
|
|
|
125
135
|
this._pendingCommands.set(handle, pendingCommand);
|
|
126
136
|
|
|
@@ -133,8 +143,7 @@ export class ClientConnection extends Connection {
|
|
|
133
143
|
const pendingCommands = this._pendingCommands;
|
|
134
144
|
const pendingCommand = pendingCommands.get(handle);
|
|
135
145
|
|
|
136
|
-
if (!pendingCommand)
|
|
137
|
-
return null;
|
|
146
|
+
if (!pendingCommand) return null;
|
|
138
147
|
|
|
139
148
|
pendingCommands.delete(handle);
|
|
140
149
|
|
|
@@ -144,8 +153,7 @@ export class ClientConnection extends Connection {
|
|
|
144
153
|
incoming(pdus) {
|
|
145
154
|
for (let i = 0; i < pdus.length; i++) {
|
|
146
155
|
// Connection may have been closed while receiving a command
|
|
147
|
-
if (this._pendingCommands === null)
|
|
148
|
-
{
|
|
156
|
+
if (this._pendingCommands === null) {
|
|
149
157
|
return;
|
|
150
158
|
}
|
|
151
159
|
|
|
@@ -165,12 +173,16 @@ export class ClientConnection extends Connection {
|
|
|
165
173
|
|
|
166
174
|
pendingCommand.response(o);
|
|
167
175
|
} else if (o instanceof Notification) {
|
|
168
|
-
const subscribers = this.
|
|
169
|
-
|
|
176
|
+
const subscribers = this._subscribers;
|
|
177
|
+
const key = eventToKey(o.event);
|
|
178
|
+
|
|
179
|
+
const cb = subscribers.get(key);
|
|
180
|
+
|
|
181
|
+
if (!cb) {
|
|
170
182
|
// NOTE: this is legal
|
|
171
183
|
continue;
|
|
172
184
|
}
|
|
173
|
-
|
|
185
|
+
cb(o);
|
|
174
186
|
} else if (o instanceof KeepAlive) {
|
|
175
187
|
if (!(o.time > 0)) {
|
|
176
188
|
throw new Error('Bad keepalive timeout.');
|
package/src/controller/event.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { BaseEvent } from './base_event.js';
|
|
2
2
|
import { error } from '../log.js';
|
|
3
3
|
|
|
4
|
+
const emptyBuffer = new ArrayBuffer();
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* Class used to represent all events specified by the OCA standard.
|
|
6
8
|
*
|
|
@@ -13,7 +15,8 @@ export class Event extends BaseEvent {
|
|
|
13
15
|
if (!this.handlers.size) return;
|
|
14
16
|
|
|
15
17
|
const args = new Array(argumentTypes.length);
|
|
16
|
-
|
|
18
|
+
// Events without arguments have parameters = null
|
|
19
|
+
const data = new DataView(notification.parameters || emptyBuffer);
|
|
17
20
|
|
|
18
21
|
for (let pos = 0, i = 0; i < argumentTypes.length; i++) {
|
|
19
22
|
let tmp;
|
|
@@ -21,6 +21,7 @@ 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';
|
|
24
25
|
|
|
25
26
|
function eventToKey(event) {
|
|
26
27
|
const ono = event.EmitterONo;
|
|
@@ -105,6 +106,14 @@ function tree_to_rolemap(tree, s) {
|
|
|
105
106
|
});
|
|
106
107
|
}
|
|
107
108
|
|
|
109
|
+
const subscriberMethod = {
|
|
110
|
+
ONo: 1055,
|
|
111
|
+
MethodID: {
|
|
112
|
+
DefLevel: 1,
|
|
113
|
+
MethodIndex: 1,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
|
|
108
117
|
/**
|
|
109
118
|
* Controller class for a remote OCA device.
|
|
110
119
|
*
|
|
@@ -243,14 +252,27 @@ export class RemoteDevice extends Events {
|
|
|
243
252
|
return this.connection.send_command(cmd, returnType);
|
|
244
253
|
}
|
|
245
254
|
|
|
246
|
-
|
|
255
|
+
_doSubscribe(event) {
|
|
256
|
+
return this.SubscriptionManager.AddSubscription(
|
|
257
|
+
event,
|
|
258
|
+
subscriberMethod,
|
|
259
|
+
new Uint8Array(0),
|
|
260
|
+
OcaNotificationDeliveryMode.Reliable,
|
|
261
|
+
new Uint8Array(0)
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
async add_subscription(event, callback) {
|
|
247
266
|
const key = eventToKey(event);
|
|
267
|
+
const subscriptions = this.subscriptions;
|
|
248
268
|
|
|
249
|
-
|
|
269
|
+
{
|
|
270
|
+
const info = subscriptions.get(key);
|
|
250
271
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
272
|
+
if (info) {
|
|
273
|
+
info.callbacks.add(callback);
|
|
274
|
+
return true;
|
|
275
|
+
}
|
|
254
276
|
}
|
|
255
277
|
|
|
256
278
|
/* do the actual subscription */
|
|
@@ -258,7 +280,7 @@ export class RemoteDevice extends Events {
|
|
|
258
280
|
const cb = (o) => {
|
|
259
281
|
const S = this.subscriptions.get(key);
|
|
260
282
|
if (!S) {
|
|
261
|
-
warn('Subscription lost
|
|
283
|
+
warn('Subscription lost.');
|
|
262
284
|
return;
|
|
263
285
|
}
|
|
264
286
|
const a = S.callbacks;
|
|
@@ -271,38 +293,41 @@ export class RemoteDevice extends Events {
|
|
|
271
293
|
});
|
|
272
294
|
};
|
|
273
295
|
|
|
274
|
-
|
|
296
|
+
this.connection._addSubscriber(event, cb);
|
|
275
297
|
|
|
276
|
-
|
|
298
|
+
const info = {
|
|
277
299
|
callbacks: new Set([callback]),
|
|
278
|
-
method: method,
|
|
279
300
|
callback: cb,
|
|
280
|
-
}
|
|
301
|
+
};
|
|
281
302
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
303
|
+
subscriptions.set(key, info);
|
|
304
|
+
|
|
305
|
+
try {
|
|
306
|
+
await this._doSubscribe(event);
|
|
307
|
+
} catch (err) {
|
|
308
|
+
subscriptions.delete(key);
|
|
309
|
+
throw err;
|
|
310
|
+
}
|
|
289
311
|
}
|
|
290
312
|
|
|
291
313
|
remove_subscription(event, callback) {
|
|
292
314
|
const key = eventToKey(event);
|
|
293
315
|
|
|
294
|
-
const
|
|
316
|
+
const info = this.subscriptions.get(key);
|
|
295
317
|
|
|
296
|
-
if (!
|
|
318
|
+
if (!info) return Promise.reject('Callback not registered.');
|
|
297
319
|
|
|
298
|
-
const a =
|
|
320
|
+
const a = info.callbacks;
|
|
299
321
|
|
|
300
322
|
a.delete(callback);
|
|
301
323
|
|
|
302
324
|
if (!a.size) {
|
|
303
|
-
this.connection.
|
|
325
|
+
this.connection._removeSubscriber(event);
|
|
304
326
|
this.subscriptions.delete(key);
|
|
305
|
-
return this.SubscriptionManager.RemoveSubscription(
|
|
327
|
+
return this.SubscriptionManager.RemoveSubscription(
|
|
328
|
+
event,
|
|
329
|
+
subscriberMethod
|
|
330
|
+
);
|
|
306
331
|
}
|
|
307
332
|
|
|
308
333
|
return Promise.resolve(true);
|
|
@@ -25,8 +25,7 @@ async function waitForKeepalive(socket, options) {
|
|
|
25
25
|
|
|
26
26
|
pos = decodeMessage(new DataView(data.buffer), 0, pdus);
|
|
27
27
|
|
|
28
|
-
if (pdus.length !== 1)
|
|
29
|
-
throw new Error('Expected keepalive response.');
|
|
28
|
+
if (pdus.length !== 1) throw new Error('Expected keepalive response.');
|
|
30
29
|
|
|
31
30
|
socket.off('message', onMessage);
|
|
32
31
|
socket.off('error', reject);
|
|
@@ -43,8 +42,7 @@ async function waitForKeepalive(socket, options) {
|
|
|
43
42
|
for (let i = 0; i < 3; i++) {
|
|
44
43
|
socket.send(msg);
|
|
45
44
|
|
|
46
|
-
if (await Promise.race([
|
|
47
|
-
return;
|
|
45
|
+
if (await Promise.race([waiter, delay(t)])) return;
|
|
48
46
|
}
|
|
49
47
|
|
|
50
48
|
throw new Error('Failed to connect.');
|
|
@@ -101,8 +99,10 @@ export class UDPConnection extends ClientConnection {
|
|
|
101
99
|
this._write_out_id = -1;
|
|
102
100
|
this._write_out();
|
|
103
101
|
};
|
|
104
|
-
this._retry_id =
|
|
105
|
-
|
|
102
|
+
this._retry_id =
|
|
103
|
+
this.retry_interval > 0
|
|
104
|
+
? setInterval(() => this._retryCommands(), this.retry_interval)
|
|
105
|
+
: -1;
|
|
106
106
|
this.q = [];
|
|
107
107
|
socket.on('message', (data, rinfo) => {
|
|
108
108
|
try {
|
|
@@ -176,16 +176,13 @@ export class UDPConnection extends ClientConnection {
|
|
|
176
176
|
write(buf) {
|
|
177
177
|
this.q.push(buf);
|
|
178
178
|
|
|
179
|
-
if (this.tx_idle_time() >= this.delay)
|
|
180
|
-
|
|
181
|
-
else
|
|
182
|
-
this._schedule_write_out();
|
|
179
|
+
if (this.tx_idle_time() >= this.delay) this._write_out();
|
|
180
|
+
else this._schedule_write_out();
|
|
183
181
|
}
|
|
184
182
|
|
|
185
183
|
flush() {
|
|
186
184
|
super.flush();
|
|
187
|
-
if (this.tx_idle_time() > this.delay)
|
|
188
|
-
this._write_out();
|
|
185
|
+
if (this.tx_idle_time() > this.delay) this._write_out();
|
|
189
186
|
}
|
|
190
187
|
|
|
191
188
|
cleanup() {
|
|
@@ -219,8 +216,7 @@ export class UDPConnection extends ClientConnection {
|
|
|
219
216
|
this.socket.send(Buffer.from(buf));
|
|
220
217
|
super.write(buf);
|
|
221
218
|
|
|
222
|
-
if (q.length)
|
|
223
|
-
this._schedule_write_out();
|
|
219
|
+
if (q.length) this._schedule_write_out();
|
|
224
220
|
}
|
|
225
221
|
|
|
226
222
|
_schedule_write_out() {
|
|
@@ -233,10 +229,12 @@ export class UDPConnection extends ClientConnection {
|
|
|
233
229
|
}
|
|
234
230
|
|
|
235
231
|
// Already scheduled.
|
|
236
|
-
if (this._write_out_id !== -1)
|
|
237
|
-
return;
|
|
232
|
+
if (this._write_out_id !== -1) return;
|
|
238
233
|
|
|
239
|
-
this._write_out_id = setTimeout(
|
|
234
|
+
this._write_out_id = setTimeout(
|
|
235
|
+
this._write_out_callback,
|
|
236
|
+
delay - tx_idle_time
|
|
237
|
+
);
|
|
240
238
|
}
|
|
241
239
|
|
|
242
240
|
_retryCommands() {
|
|
@@ -251,7 +249,7 @@ export class UDPConnection extends ClientConnection {
|
|
|
251
249
|
const failed = [];
|
|
252
250
|
|
|
253
251
|
for (const entry of pendingCommands) {
|
|
254
|
-
const [
|
|
252
|
+
const [handle, pendingCommand] = entry;
|
|
255
253
|
|
|
256
254
|
// All later commands are newer than the cutoff.
|
|
257
255
|
if (pendingCommand.lastSent > retryTime) break;
|
|
@@ -265,13 +263,13 @@ export class UDPConnection extends ClientConnection {
|
|
|
265
263
|
if (failed.length) {
|
|
266
264
|
const timeoutError = new Error('Timeout.');
|
|
267
265
|
|
|
268
|
-
failed.forEach(([
|
|
266
|
+
failed.forEach(([handle, pendingCommand]) => {
|
|
269
267
|
pendingCommands.delete(handle);
|
|
270
268
|
pendingCommand.reject(timeoutError);
|
|
271
269
|
});
|
|
272
270
|
}
|
|
273
271
|
|
|
274
|
-
retries.forEach(([
|
|
272
|
+
retries.forEach(([handle, pendingCommand]) => {
|
|
275
273
|
pendingCommands.delete(handle);
|
|
276
274
|
pendingCommands.set(handle, pendingCommand);
|
|
277
275
|
this.send(pendingCommand.command);
|
|
@@ -54,7 +54,9 @@ export class WebSocketConnection extends ClientConnection {
|
|
|
54
54
|
cleanup() {
|
|
55
55
|
super.cleanup();
|
|
56
56
|
if (this.ws) {
|
|
57
|
-
try {
|
|
57
|
+
try {
|
|
58
|
+
this.ws.close();
|
|
59
|
+
} catch (err) {}
|
|
58
60
|
this.ws.removeAllListeners();
|
|
59
61
|
this.ws = null;
|
|
60
62
|
}
|