aes70 1.4.0 → 1.4.1

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.
Files changed (30) hide show
  1. package/Changelog +12 -0
  2. package/dist/AES70.es5.js +1 -1
  3. package/package.json +1 -1
  4. package/src/OCP1/FixedLengthArray.js +5 -0
  5. package/src/OCP1/OcaPositionDescriptor.js +2 -1
  6. package/src/connection.js +7 -5
  7. package/src/controller/ControlClasses/OcaBlock.d.ts +3 -3
  8. package/src/controller/ControlClasses/OcaBlock.js +3 -3
  9. package/src/controller/ControlClasses/OcaGrouper.d.ts +5 -5
  10. package/src/controller/ControlClasses/OcaGrouper.js +5 -5
  11. package/src/controller/ControlClasses/OcaMatrix.d.ts +9 -9
  12. package/src/controller/ControlClasses/OcaMatrix.js +9 -9
  13. package/src/controller/abstract_udp_connection.js +3 -3
  14. package/src/controller/node_udp.js +2 -2
  15. package/src/controller/websocket_connection.d.ts +17 -0
  16. package/src/controller/websocket_connection.js +4 -46
  17. package/src/controller/websocket_connection_base.d.ts +18 -0
  18. package/src/controller/websocket_connection_base.js +70 -0
  19. package/src/controller/websocket_connection_node.d.ts +18 -0
  20. package/src/controller/websocket_connection_node.js +5 -49
  21. package/src/types/OcaDeviceState.d.ts +0 -5
  22. package/src/types/OcaDeviceState.js +0 -8
  23. package/src/types/OcaObjectSearchResultFlags.d.ts +0 -5
  24. package/src/types/OcaObjectSearchResultFlags.js +0 -8
  25. package/src/types/OcaParameterMask.d.ts +1 -1
  26. package/src/types/OcaPositionDescriptor.d.ts +5 -5
  27. package/src/types/OcaPositionDescriptor.js +1 -1
  28. package/src/types/OcaPositionDescriptorFieldFlags.d.ts +1 -1
  29. package/src/types/OcaRamperState.d.ts +3 -3
  30. package/src/types/OcaRamperState.js +3 -3
package/Changelog CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  All notable changes and version updates will be documented in this file.
4
4
 
5
+ ## [1.4.1] - 2022-03-05
6
+
7
+ - Add typescript declarations for WebSocketConnection
8
+
9
+ - Raise an 'error' event on AES70 parsing errors in non-udp connections.
10
+
11
+ - Hand the error object from 'errors' events in WebSocketConnections to the
12
+ application
13
+
14
+ - Fixed the type of Values in OcaPositionDescriptors. It was previously
15
+ implemented as a Float32, while it should be Float32[6].
16
+
5
17
  ## [1.4] - 2022-12-07
6
18
 
7
19
  - Change the signature of events: Events are now emitted as specified in the
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}}}const c=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)}});function l(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}})}class u{constructor(e,t){this.DefLevel=e,this.EventIndex=t}}const h=l({DefLevel:c,EventIndex:c},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 f=l({EmitterONo:d,EventID:h},g);class S 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]=f.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 y=[s,i,S,p,m];function O(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=y[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}function C(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}class w{constructor(e,t){if(!(e<=4294967295))throw new TypeError("Invalid batch size.");this._pdus=[],this._batchSize=e,this._resultCallback=t,this._currentSize=0,this._currentCount=0,this._lastMessageType=-1,this._flushScheduled=!1,this._flushCb=()=>{this._flushScheduled=!1,null!==this._pdus&&this.flush()}}add(e){const t=this._currentSize,n=e.encoded_length(),r=e.messageType,o=this._lastMessageType===r&&4!==r&&this._currentCount<65535;let s=n;o||(s+=10),t&&t+s>this._batchSize&&(this.flush(),s=n+10),this._pdus.push(e),this._currentSize+=s,o?this._currentCount++:this._currentCount=1,this._lastMessageType=r,this._currentSize>this._batchSize?this.flush():1===this._pdus.length&&this.scheduleFlush()}scheduleFlush(){this._flushScheduled||(this._flushScheduled=!0,Promise.resolve().then(this._flushCb).catch(e=>{console.error(e)}))}flush(){if(!this._currentSize)return;const e=this._pdus,t=new ArrayBuffer(this._currentSize),n=new DataView(t),r=e.length;for(let t=0,o=0,s=0;t<r;t++){const i=e[t].messageType;t!==r-1&&t+1-o!=65535&&4!==i&&i===e[t+1].messageType||(s=b(n,s,e,o,t+1),o=t+1)}this._currentSize=0,this._lastMessageType=-1,this._currentCount=0,this._pdus.length=0,this._resultCallback(t)}dispose(){this._pdus=null}}class P 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 w(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=O(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 _(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)_(e,n)&&t.set(e[n],n)}return t.get(n)}let r=null;const o=class{constructor(t){if("string"==typeof t){if(!_(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(_(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)_(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 T{constructor(e,t){this.status=new v(e),this.cmd=t}static check_status(e,t){return e instanceof this&&e.status===t}toString(){return"RemoteError("+this.status+")"}}class D{constructor(e){this.values=e}item(e){return this.values[e]}get length(){return this.values.length}}class I{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 T(e.status_code,o));else if(r)try{const n=Math.min(e.param_count,r.length);if(0===n)t();else{const o=new Array(n),s=new DataView(e.parameters);for(let e=0,t=0;e<n;e++){let n;[t,n]=r[e].decodeFrom(s,t),o[e]=n}t(1===n?o[0]:new D(o))}}catch(e){n(e)}else t(e)}}function M(e){const t=e.EmitterONo,n=e.EventID;return[t,n.DefLevel,n.EventIndex].join(",")}class L extends P{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=M(e),r=this._subscribers;if(r.has(n))throw new Error("Subscriber already exists.");r.set(n,t)}_removeSubscriber(e){const t=M(e),n=this._subscribers;if(!n.has(t))throw new Error("Unknown subscriber.");n.delete(t)}_getNextCommandHandle(){let e;const t=this._pendingCommands;if(null===t)throw new Error("Connection not open.");do{e=this._nextCommandHandle,this._nextCommandHandle=e+1|0}while(t.has(e));return e}_estimate_next_tx_time(){return this._now()}send_command(e,t,n){const r=(n,r)=>{const o=this._getNextCommandHandle();e.handle=o;const s=new I(n,r,t,e);this._pendingCommands.set(o,s),s.lastSent=this._estimate_next_tx_time(),this.send(e)};if(!n)return new Promise(r);r(e=>n(!0,e),e=>n(!1,e))}_removePendingCommand(e){const t=this._pendingCommands,n=t.get(e);return n?(t.delete(e),n):null}incoming(e){for(let t=0;t<e.length;t++){if(null===this._pendingCommands)return;const n=e[t];if(n instanceof p){const e=this._removePendingCommand(n.handle);if(null===e){if(this.is_reliable)return void this.error(new Error("Unknown handle."));continue}e.response(n)}else if(n instanceof S){const e=this._subscribers,t=M(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.")}}}}const A=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 E(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 k=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)}}),x=c,U=x;function N(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function R(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)&&!N(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)&&!N(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)}const F=new TextEncoder,B=new TextDecoder;function j(e){return F.encode(e)}function V(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 z=a({isConstantLength:!1,encodedLength:function(e){if("string"!=typeof e)throw new TypeError("Expected string.");return 2+j(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(j(n));return new Uint8Array(e.buffer,e.byteOffset).set(o,t),t+o.length},decodeFrom:function(e,t){const n=e.getUint16(t),r=V(e,t+=2,n),o=new Uint8Array(e.buffer,e.byteOffset+t,r);return[t+r,(s=o,B.decode(s))];var s},decodeLength:function(e,t){const n=e.getUint16(t);return(t+=2)+V(e,t,n)}}),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,n,r){this.ObjectNumber=e,this.Name=t,this.ClassID=n,this.ClassVersion=r}}const W=l({ObjectNumber:d,Name:z,ClassID:q,ClassVersion:c},H);class K{constructor(e,t,n){this.Manufacturer=e,this.Name=t,this.Version=n}}const X=l({Manufacturer:z,Name:z,Version:z},K);class Y{constructor(e,t,n){this.Reserved=e,this.MfrCode=t,this.ModelCode=n}}const Q=l({Reserved:E(1),MfrCode:E(3),ModelCode:E(4)},Y),J=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 Z(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 $(e){return Z(e,J)}class ee extends(G({PowerOn:0,InternalError:1,Upgrade:2,ExternalRequest:3})){}const te=$(ee);class ne{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 re=new ArrayBuffer;class oe extends ne{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||re);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 se extends ne{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 ie extends(G({CurrentChanged:1,MinChanged:2,MaxChanged:3,ItemAdded:4,ItemChanged:5,ItemDeleted:6})){}class ae{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===ie.CurrentChanged&&(this.values[e]=t)}.bind(this,e);this.subscriptions.push(o.unsubscribe.bind(o,n)),t.push(o.subscribe(n).catch((function(){})))}t.push(r().then(function(e,t){t instanceof D&&(t=t.item(0)),this.values[e]=t}.bind(this,e),(function(){}))),e++}),Promise.all(t)}forEach(e,t){let n=0;t||(t=this),this.o.get_properties().forEach(r=>{r.getter(this.o)&&(e.call(t,this.values[n],r.name),n++)})}Dispose(){this.o=null,this.subscriptions.forEach(e=>e()),this.subscriptions=null}}class ce{constructor(e,t){this.DefLevel=e,this.PropertyIndex=t}}class le{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 ce){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 ue{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 ce(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 he(e,t){if(!t||!t.length)return;const[n,r,s,a,c]=t;e.prototype[n]=function(...e){const t=a.length;let n=null;t<e.length&&t+1===e.length&&"function"==typeof e[t]&&(n=e[t],e.length=t);const l=new i(this.ono,r,s,t,new o(a,e));return this.device.send_command(l,c,n)}}function de(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 oe(this,new u(r,o),s))}})}function ge(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 se(this,new ce(t.level,t.index),t.type))}})}function fe(e){if("object"==typeof e&&e instanceof ue)return e;if(Array.isArray(e))return"object"!=typeof e[1]&&(e[1]=function(e){throw new Error("Not implemented.")}(e[1])),new ue(...e);throw new Error("Bad property.")}function Se(e,t,n,r,o,s,i,a){let c=null,l=null;i=i.map(e=>fe(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 le(i,t,o.get_properties())),l}static GetPropertySync(){return null===c&&(c=function(e){const t=Object.create(ae.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++)he(u,s[e]);for(let e=0;e<i.length;e++)ge(u,i[e]);for(let e=0;e<a.length;e++)de(u,a[e]);return u}class pe{constructor(e,t){this.ClassID=e,this.ClassVersion=t}}const me=l({ClassID:q,ClassVersion:c},pe),ye=l({DefLevel:c,PropertyIndex:c},ce),Oe=$(ie);const be=function(...e){const t=e.length;return a({isConstantLength:!1,encodedLength:function(n){if(!Array.isArray(n)&&!N(n))throw new TypeError("Expected array.");if(n.length!==t)throw new Error("Length mismatch.");let r=0;for(let o=0;o<t;o++)r+=e[o].encodedLength(n[o]);return r},encodeTo:function(n,r,o){for(let s=0;s<t;s++)r=e[s].encodeTo(n,r,o[s]);return r},decodeFrom:function(n,r){const o=new Array(t);for(let s=0;s<t;s++){let t;[r,t]=e[s].decodeFrom(n,r),o[s]=t}return[r,o]},decodeLength:function(n,r){for(let o=0;o<t;o++)r=e[o].decodeLength(n,r);return r}})}(ye,(Ce=1,a({isConstantLength:!1,encodedLength:function(e){if(!("object"==typeof e&&e instanceof DataView))throw new TypeError("Expected DataView.");return e.byteLength-Ce},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-Ce;return[t+n,new DataView(e.buffer,e.byteOffset+t,n)]},decodeLength:function(e,t){return t+(e.byteLength-t-Ce)}})),Oe);var Ce;const we=Se("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,[],[me]],["GetLockable",1,2,[],[k]],["LockTotal",1,3,[],[]],["Unlock",1,4,[],[]],["GetRole",1,5,[],[z]],["LockReadonly",1,6,[],[]]],[["ClassID",[q],1,1,!0,!0,null],["ClassVersion",[c],1,2,!0,!0,null],["ObjectNumber",[d],1,3,!0,!1,null],["Lockable",[k],1,4,!0,!1,null],["Role",[z],1,5,!0,!1,null]],[["PropertyChanged",1,1,[be]]]),Pe=Se("OcaManager",2,"",2,we,[],[],[]),_e=Se("OcaDeviceManager",3,"",2,Pe,[["GetOcaVersion",3,1,[],[c]],["GetModelGUID",3,2,[],[Q]],["GetSerialNumber",3,3,[],[z]],["GetDeviceName",3,4,[],[z]],["SetDeviceName",3,5,[z],[]],["GetModelDescription",3,6,[],[X]],["GetDeviceRole",3,7,[],[z]],["SetDeviceRole",3,8,[z],[]],["GetUserInventoryCode",3,9,[],[z]],["SetUserInventoryCode",3,10,[z],[]],["GetEnabled",3,11,[],[k]],["SetEnabled",3,12,[k],[]],["GetState",3,13,[],[U]],["SetResetKey",3,14,[E(16),A],[]],["GetResetCause",3,15,[],[te]],["ClearResetCause",3,16,[],[]],["GetMessage",3,17,[],[z]],["SetMessage",3,18,[z],[]],["GetManagers",3,19,[],[R(W)]],["GetDeviceRevisionID",3,20,[],[z]]],[["ModelGUID",[Q],3,1,!1,!1,null],["SerialNumber",[z],3,2,!1,!1,null],["ModelDescription",[X],3,3,!1,!1,null],["DeviceName",[z],3,4,!1,!1,null],["OcaVersion",[c],3,5,!1,!1,null],["DeviceRole",[z],3,6,!1,!1,null],["UserInventoryCode",[z],3,7,!1,!1,null],["Enabled",[k],3,8,!1,!1,null],["State",[U],3,9,!1,!1,null],["Busy",[k],3,10,!1,!1,null],["ResetCause",[te],3,11,!1,!1,null],["Message",[z],3,12,!1,!1,null],["Managers",[R(W)],3,13,!1,!1,null],["DeviceRevisionID",[z],3,14,!0,!1,null]],[]),Ge=Se("OcaSecurityManager",3,"",2,Pe,[["AddPreSharedKey",3,4,[z,A],[]],["ChangePreSharedKey",3,3,[z,A],[]],["DeletePreSharedKey",3,5,[z],[]],["DisableControlSecurity",3,2,[],[]],["EnableControlSecurity",3,1,[],[]]],[["secureControlData",[k],3,1,!1,!1,null]],[]);class ve extends(G({BootLoader:0})){}const Te=Z(ve,c);class De{constructor(e,t,n,r){this.Major=e,this.Minor=t,this.Build=n,this.Component=r}}const Ie=l({Major:d,Minor:d,Build:d,Component:Te},De),Me=Se("OcaFirmwareManager",3,"",2,Pe,[["GetComponentVersions",3,1,[],[R(Ie)]],["StartUpdateProcess",3,2,[],[]],["BeginActiveImageUpdate",3,3,[Te],[]],["AddImageData",3,4,[d,A],[]],["VerifyImage",3,5,[A],[]],["EndActiveImageUpdate",3,6,[],[]],["BeginPassiveComponentUpdate",3,7,[Te,A,z],[]],["EndUpdateProcess",3,8,[],[]]],[["ComponentVersions",[R(Ie)],3,1,!1,!1,null]],[]);class Le{constructor(e,t){this.DefLevel=e,this.MethodIndex=t}}const Ae=l({DefLevel:c,MethodIndex:c},Le);class Ee{constructor(e,t){this.ONo=e,this.MethodID=t}}const ke=l({ONo:d,MethodID:Ae},Ee);class xe extends(G({Reliable:1,Fast:2})){}const Ue=$(xe);class Ne{constructor(e){this.objectList=e}}const Re=l({objectList:R(d)},Ne);class Fe extends(G({Normal:1,EventsDisabled:2})){}const Be=$(Fe),je=Se("OcaSubscriptionManager",3,"",2,Pe,[["RemoveSubscription",3,2,[f,ke],[]],["AddSubscription",3,1,[f,ke,A,Ue,A],[]],["DisableNotifications",3,3,[],[]],["ReEnableNotifications",3,4,[],[]],["AddPropertyChangeSubscription",3,5,[d,ye,ke,A,Ue,A],[]],["RemovePropertyChangeSubscription",3,6,[d,ye,ke],[]],["GetMaximumSubscriberContextLength",3,7,[],[c]]],[["State",[Be],3,1,!1,!1,null]],[["NotificationsDisabled",3,1,[]],["SynchronizeState",3,2,[Re]]]);class Ve extends(G({None:0,Working:1,Standby:2,Off:3})){}const ze=$(Ve),qe=Se("OcaPowerManager",3,"",2,Pe,[["GetState",3,1,[],[ze]],["SetState",3,2,[ze],[]],["GetPowerSupplies",3,3,[],[R(d)]],["GetActivePowerSupplies",3,4,[],[R(d)]],["ExchangePowerSupply",3,5,[d,d,k],[]],["GetAutoState",3,6,[],[k]]],[["State",[ze],3,1,!1,!1,null],["PowerSupplies",[R(d)],3,2,!1,!1,null],["ActivePowerSupplies",[R(d)],3,3,!1,!1,null],["AutoState",[k],3,4,!1,!1,null],["TargetState",[ze],3,5,!1,!1,null]],[]),He=Se("OcaNetworkManager",3,"",2,Pe,[["GetNetworks",3,1,[],[R(d)]],["GetStreamNetworks",3,2,[],[R(d)]],["GetControlNetworks",3,3,[],[R(d)]],["GetMediaTransportNetworks",3,4,[],[R(d)]]],[["Networks",[R(d)],3,1,!1,!1,null],["StreamNetworks",[R(d)],3,2,!1,!1,null],["ControlNetworks",[R(d)],3,3,!1,!1,null],["MediaTransportNetworks",[R(d)],3,4,!1,!1,null]],[]);class We extends(G({None:0,Internal:1,Network:2,External:3})){}const Ke=$(We),Xe=Se("OcaMediaClockManager",3,"",2,Pe,[["GetClocks",3,1,[],[R(d)]],["GetMediaClockTypesSupported",3,2,[],[R(Ke)]],["GetClock3s",3,3,[],[R(d)]]],[["ClockSourceTypesSupported",[R(Ke)],3,1,!1,!1,["MediaClockTypesSupported"]],["Clocks",[R(d)],3,2,!1,!1,null],["Clock3s",[R(d)],3,3,!1,!1,null]],[]);class Ye{constructor(e,t){this.Library=e,this.ID=t}}const Qe=l({Library:d,ID:d},Ye);class Je{constructor(e,t){this.Authority=e,this.ID=t}}const Ze=l({Authority:E(3),ID:d},Je);class $e{constructor(e,t){this.Type=e,this.ONo=t}}const et=l({Type:Ze,ONo:d},$e),tt=Se("OcaLibraryManager",3,"\b",2,Pe,[["AddLibrary",3,1,[Ze],[et]],["DeleteLibrary",3,2,[d],[]],["GetLibraryCount",3,3,[Ze],[c]],["GetLibraryList",3,4,[Ze],[R(et)]],["GetCurrentPatch",3,5,[],[Qe]],["ApplyPatch",3,6,[Qe],[]]],[["Libraries",[R(et)],3,1,!1,!1,null],["CurrentPatch",[Qe],3,2,!1,!1,null]],[]),nt=Se("OcaAudioProcessingManager",3,"\t",2,Pe,[],[],[]),rt="undefined"!=typeof BigInt,ot=rt&&(BigInt(1)<<BigInt(64))-BigInt(1),st=rt&&ot>>BigInt(1),it=rt&&-st-BigInt(1),at=rt&&(BigInt(1)<<BigInt(55))-BigInt(1);rt&&BigInt(1);function ct(){if(!rt)throw new Error("Missing BigInt support")}const lt=a({isConstantLength:!0,encodedLength:function(e){return 8},encodeTo:function(e,t,n){if(ct(),!(n<=ot&&n>=0))throw new TypeError("Uint64 out of range.");return e.setBigUint64(t,BigInt(n),!1),t+8},decode:function(e,t){ct();const n=e.getBigUint64(t,!1);return n<=Number.MAX_SAFE_INTEGER?Number(n):n}});class ut{constructor(e,t,n){this.Negative=e,this.Seconds=t,this.Nanoseconds=n}}const ht=l({Negative:k,Seconds:lt,Nanoseconds:d},ut),dt=Se("OcaDeviceTimeManager",3,"\n",2,Pe,[["GetDeviceTimeNTP",3,1,[],[lt]],["SetDeviceTimeNTP",3,2,[lt],[]],["GetTimeSources",3,3,[],[R(d)]],["GetCurrentDeviceTimeSource",3,4,[],[d]],["SetCurrentDeviceTimeSource",3,5,[d],[]],["GetDeviceTimePTP",3,6,[],[ht]],["SetDeviceTimePTP",3,7,[ht],[]]],[["TimeSources",[R(d)],3,1,!1,!1,null],["CurrentDeviceTimeSource",[d],3,2,!1,!1,null]],[]);function gt(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 ft extends(G({Absolute:1,Relative:2})){}const St=$(ft);class pt{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 mt=l({ID:d,Label:z,ProgramID:Qe,GroupID:c,TimeMode:St,TimeSourceONo:d,StartTime:ht,Duration:ht,ApplicationSpecificParameters:A},pt);class yt extends(G({None:0,Prepare:1,Enable:2,Start:3,Stop:4,Abort:5,Disable:6,Clear:7})){}const Ot=$(yt);class bt extends(G({None:0,Enabled:1,Disabled:2})){}const Ct=$(bt);class wt extends(G({None:0,NotPrepared:1,Disabled:2,Enabled:3,Running:4,Completed:5,Failed:6,Stopped:7,Aborted:8})){}const Pt=$(wt);class _t{constructor(e,t,n){this.ID=e,this.State=t,this.ErrorCode=n}}const Gt=l({ID:d,State:Pt,ErrorCode:c},_t);class vt{constructor(e,t,n){this.TaskID=e,this.ProgramID=t,this.Status=n}}const Tt=l({TaskID:d,ProgramID:Qe,Status:Gt},vt),Dt=Se("OcaTaskManager",3,"\v",1,Pe,[["Enable",3,1,[k],[]],["ControlAllTasks",3,2,[Ot,A],[]],["ControlTaskGroup",3,3,[c,Ot,A],[]],["ControlTask",3,4,[d,Ot,A],[]],["GetState",3,5,[],[Ct]],["GetTaskStatuses",3,6,[],[Gt]],["GetTaskStatus",3,7,[d],[Gt]],["AddTask",3,8,[mt],[mt]],["GetTasks",3,9,[],[gt(d,mt)]],["GetTask",3,10,[d],[mt]],["SetTask",3,11,[d,mt],[]],["DeleteTask",3,12,[d],[]]],[["State",[Ct],3,1,!1,!1,null],["Tasks",[gt(d,mt)],3,2,!1,!1,null]],[["TaskStateChanged",3,1,[Tt]]]),It=Se("OcaCodingManager",3,"\f",1,Pe,[["GetAvailableEncodingSchemes",3,1,[],[gt(c,z)]],["GetAvailableDecodingSchemes",3,2,[],[gt(c,z)]]],[["AvailableEncodingSchemes",[gt(c,z)],3,1,!1,!1,null],["AvailableDecodingSchemes",[gt(c,z)],3,2,!1,!1,null]],[]),Mt=Se("OcaDiagnosticManager",3,"\r",1,Pe,[["GetLockStatus",3,1,[d],[z]]],[],[]);class Lt{constructor(e,t){this.ONo=e,this.ClassIdentification=t}}const At=l({ONo:d,ClassIdentification:me},Lt);class Et{constructor(e,t){this.MemberObjectIdentification=e,this.ContainerObjectNumber=t}}const kt=l({MemberObjectIdentification:At,ContainerObjectNumber:d},Et);class xt{constructor(e,t){this.Authority=e,this.ID=t}}const Ut=l({Authority:E(3),ID:d},xt);class Nt{constructor(e,t){this.TargetBlockType=e,this.ParData=t}}const Rt=l({TargetBlockType:d,ParData:A},Nt);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=l({ONo:d,ClassIdentification:me,ContainerPath:R(d),Role:z,Label:z},Ft),jt=x;class Vt extends(G({Input:1,Output:2})){}const zt=$(Vt);class qt{constructor(e,t){this.Mode=e,this.Index=t}}const Ht=l({Mode:zt,Index:c},qt);class Wt{constructor(e,t,n){this.Owner=e,this.ID=t,this.Name=n}}const Kt=l({Owner:d,ID:Ht,Name:z},Wt);class Xt{constructor(e,t){this.SourcePort=e,this.SinkPort=t}}const Yt=l({SourcePort:Kt,SinkPort:Kt},Xt);class Qt extends(G({Exact:0,Substring:1,Contains:2,ExactCaseInsensitive:3,SubstringCaseInsensitive:4,ContainsCaseInsensitive:5})){}const Jt=$(Qt),Zt=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)}}),$t=Se("OcaWorker",2,"",2,we,[["GetEnabled",2,1,[],[k]],["SetEnabled",2,2,[k],[]],["AddPort",2,3,[z,zt],[Ht]],["DeletePort",2,4,[Ht],[]],["GetPorts",2,5,[],[R(Kt)]],["GetPortName",2,6,[Ht],[z]],["SetPortName",2,7,[Ht,z],[]],["GetLabel",2,8,[],[z]],["SetLabel",2,9,[z],[]],["GetOwner",2,10,[],[d]],["GetLatency",2,11,[],[Zt]],["SetLatency",2,12,[Zt],[]],["GetPath",2,13,[],[R(z),R(d)]]],[["Enabled",[k],2,1,!1,!1,null],["Ports",[R(Kt)],2,2,!1,!1,null],["Label",[z],2,3,!1,!1,null],["Owner",[d],2,4,!1,!1,null],["Latency",[Zt],2,5,!1,!1,null]],[]),en=Se("OcaBlock",3,"",2,$t,[["GetType",3,1,[],[d]],["ConstructMemberUsingFactory",3,3,[d],[d]],["DeleteMember",3,4,[d],[]],["GetMembers",3,5,[],[R(At)]],["GetMembersRecursive",3,6,[],[R(kt)]],["AddSignalPath",3,7,[Yt],[c]],["DeleteSignalPath",3,8,[c],[]],["GetSignalPaths",3,9,[],[gt(c,Yt)]],["GetSignalPathsRecursive",3,10,[],[gt(c,Yt)]],["GetMostRecentParamSetIdentifier",3,11,[],[Qe]],["ApplyParamSet",3,12,[],[Qe]],["GetCurrentParamSetData",3,13,[],[Rt]],["StoreCurrentParamSetData",3,14,[Qe],[]],["GetGlobalType",3,15,[],[Ut]],["GetONoMap",3,16,[],[gt(d,d)]],["FindObjectsByRole",3,17,[z,Jt,q,jt],[R(Bt)]],["FindObjectsByRoleRecursive",3,18,[z,Jt,q,jt],[R(Bt)]],["FindObjectsByPath",3,20,[R(z),jt],[R(Bt)]],["FindObjectsByLabelRecursive",3,19,[z,Jt,q,jt],[R(Bt)]]],[["Type",[d],3,1,!0,!1,null],["Members",[R(At)],3,2,!1,!1,null],["SignalPaths",[gt(c,Yt)],3,3,!1,!1,null],["MostRecentParamSetIdentifier",[Qe],3,4,!1,!1,null],["GlobalType",[Ut],3,5,!0,!1,null],["ONoMap",[gt(d,d)],3,6,!0,!1,null]],[]),tn=Se("OcaActuator",3,"",2,$t,[],[],[]);class nn extends(G({Muted:1,Unmuted:2})){}const rn=$(nn),on=Se("OcaMute",4,"",2,tn,[["GetState",4,1,[],[rn]],["SetState",4,2,[rn],[]]],[["State",[rn],4,1,!1,!1,null]],[]);class sn extends(G({NonInverted:1,Inverted:2})){}const an=$(sn),cn=Se("OcaPolarity",4,"",2,tn,[["GetState",4,1,[],[an]],["SetState",4,2,[an],[]]],[["State",[an],4,1,!1,!1,null]],[]),ln=Se("OcaSwitch",4,"",2,tn,[["GetPosition",4,1,[],[c,c,c]],["SetPosition",4,2,[c],[]],["GetPositionName",4,3,[c],[z]],["SetPositionName",4,4,[c,z],[]],["GetPositionNames",4,5,[],[R(z)]],["SetPositionNames",4,6,[R(z)],[]],["GetPositionEnabled",4,7,[c],[k]],["SetPositionEnabled",4,8,[c,k],[]],["GetPositionEnableds",4,9,[],[R(k)]],["SetPositionEnableds",4,10,[R(k)],[]]],[["Position",[c],4,1,!1,!1,null],["PositionNames",[R(z)],4,2,!1,!1,null],["PositionEnableds",[R(k)],4,3,!1,!1,null]],[]),un=Se("OcaGain",4,"",2,tn,[["GetGain",4,1,[],[Zt,Zt,Zt]],["SetGain",4,2,[Zt],[]]],[["Gain",[Zt],4,1,!1,!1,null]],[]),hn=Se("OcaPanBalance",4,"",2,tn,[["GetPosition",4,1,[],[Zt,Zt,Zt]],["SetPosition",4,2,[Zt],[]],["GetMidpointGain",4,3,[],[Zt,Zt,Zt]],["SetMidpointGain",4,4,[Zt],[]]],[["Position",[Zt],4,1,!1,!1,null],["MidpointGain",[Zt],4,2,!1,!1,null]],[]),dn=Se("OcaDelay",4,"",2,tn,[["GetDelayTime",4,1,[],[Zt,Zt,Zt]],["SetDelayTime",4,2,[Zt],[]]],[["DelayTime",[Zt],4,1,!1,!1,null]],[]);class gn extends(G({Time:1,Distance:2,Samples:3,Microseconds:4,Milliseconds:5,Centimeters:6,Inches:7,Feet:8})){}const fn=$(gn);class Sn{constructor(e,t){this.DelayValue=e,this.DelayUnit=t}}const pn=l({DelayValue:Zt,DelayUnit:fn},Sn),mn=Se("OcaDelayExtended",5,"",2,dn,[["GetDelayValue",5,1,[],[pn,pn,pn]],["SetDelayValue",5,2,[pn],[]],["GetDelayValueConverted",5,3,[fn],[pn]]],[["DelayValue",[pn],5,1,!1,!1,null]],[]),yn=Se("OcaFrequencyActuator",4,"\b",2,tn,[["GetFrequency",4,1,[],[Zt,Zt,Zt]],["SetFrequency",4,2,[Zt],[]]],[["Frequency",[Zt],4,1,!1,!1,null]],[]);class On extends(G({Butterworth:1,Bessel:2,Chebyshev:3,LinkwitzRiley:4})){}const bn=$(On);class Cn extends(G({HiPass:1,LowPass:2,BandPass:3,BandReject:4,AllPass:5})){}const wn=$(Cn),Pn=x,_n=Se("OcaFilterClassical",4,"\t",2,tn,[["GetFrequency",4,1,[],[Zt,Zt,Zt]],["SetFrequency",4,2,[Zt],[]],["GetPassband",4,3,[],[wn]],["SetPassband",4,4,[wn],[]],["GetShape",4,5,[],[bn]],["SetShape",4,6,[bn],[]],["GetOrder",4,7,[],[c,c,c]],["SetOrder",4,8,[c],[]],["GetParameter",4,9,[],[Zt,Zt,Zt]],["SetParameter",4,10,[Zt],[]],["SetMultiple",4,11,[Pn,Zt,wn,bn,c,Zt],[]]],[["Frequency",[Zt],4,1,!1,!1,null],["Passband",[wn],4,2,!1,!1,null],["Shape",[bn],4,3,!1,!1,null],["Order",[c],4,4,!1,!1,null],["Parameter",[Zt],4,5,!1,!1,null]],[]);class Gn 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 vn=$(Gn),Tn=Se("OcaFilterParametric",4,"\n",2,tn,[["GetFrequency",4,1,[],[Zt,Zt,Zt]],["SetFrequency",4,2,[Zt],[]],["GetShape",4,3,[],[vn]],["SetShape",4,4,[vn],[]],["GetWidthParameter",4,5,[],[Zt,Zt,Zt]],["SetWidthParameter",4,6,[Zt],[]],["GetInbandGain",4,7,[],[Zt,Zt,Zt]],["SetInbandGain",4,8,[Zt],[]],["GetShapeParameter",4,9,[],[Zt,Zt,Zt]],["SetShapeParameter",4,10,[Zt],[]],["SetMultiple",4,11,[Pn,Zt,vn,Zt,Zt,Zt],[]]],[["Frequency",[Zt],4,1,!1,!1,null],["Shape",[vn],4,2,!1,!1,null],["WidthParameter",[Zt],4,3,!1,!1,["Q"]],["InbandGain",[Zt],4,4,!1,!1,null],["ShapeParameter",[Zt],4,5,!1,!1,null]],[]),Dn=Se("OcaFilterPolynomial",4,"\v",2,tn,[["GetCoefficients",4,1,[],[R(Zt),R(Zt)]],["SetCoefficients",4,2,[R(Zt),R(Zt)],[]],["GetSampleRate",4,3,[],[Zt,Zt,Zt]],["SetSampleRate",4,4,[Zt],[]],["GetMaxOrder",4,5,[],[J]]],[["A",[R(Zt)],4,1,!1,!1,null],["B",[R(Zt)],4,2,!1,!1,null],["SampleRate",[Zt],4,3,!1,!1,null],["MaxOrder",[J],4,4,!0,!1,null]],[]),In=Se("OcaFilterFIR",4,"\f",2,tn,[["GetLength",4,1,[],[d,d,d]],["GetCoefficients",4,2,[],[R(Zt)]],["SetCoefficients",4,3,[R(Zt)],[]],["GetSampleRate",4,4,[],[Zt,Zt,Zt]],["SetSampleRate",4,5,[Zt],[]]],[["Length",[d],4,1,!1,!1,null],["Coefficients",[R(Zt)],4,2,!1,!1,null],["SampleRate",[Zt],4,3,!1,!1,null]],[]);class Mn{constructor(e,t,n){this.Frequency=e,this.Amplitude=t,this.Phase=n}}const Ln=l({Frequency:R(Zt),Amplitude:R(Zt),Phase:R(Zt)},Mn),An=Se("OcaFilterArbitraryCurve",4,"\r",2,tn,[["GetTransferFunction",4,1,[],[Ln]],["SetTransferFunction",4,2,[Ln],[]],["GetSampleRate",4,3,[],[Zt,Zt,Zt]],["SetSampleRate",4,4,[Zt],[]],["GetTFMinLength",4,5,[],[c]],["GetTFMaxLength",4,6,[],[c]]],[["TransferFunction",[Ln],4,1,!1,!1,null],["SampleRate",[Zt],4,2,!1,!1,null],["TFMinLength",[c],4,3,!1,!1,null],["TFMaxLength",[c],4,4,!1,!1,null]],[]);class En{constructor(e,t){this.Value=e,this.Ref=t}}const kn=l({Value:Zt,Ref:Zt},En);class xn extends(G({None:0,Compress:1,Limit:2,Expand:3,Gate:4})){}const Un=$(xn);class Nn extends(G({None:0,RMS:1,Peak:2})){}const Rn=$(Nn);class Fn extends(G({dBu:0,dBV:1,V:2})){}const Bn=$(Fn),jn=Se("OcaDynamics",4,"",2,tn,[["GetTriggered",4,1,[],[k]],["GetDynamicGain",4,2,[],[Zt]],["GetFunction",4,3,[],[Un]],["SetFunction",4,4,[Un],[]],["GetRatio",4,5,[],[Zt,Zt,Zt]],["SetRatio",4,6,[Zt],[]],["GetThreshold",4,7,[],[kn,Zt,Zt]],["SetThreshold",4,8,[kn],[]],["GetThresholdPresentationUnits",4,9,[],[Bn]],["SetThresholdPresentationUnits",4,10,[Bn],[]],["GetDetectorLaw",4,11,[],[Rn]],["SetDetectorLaw",4,12,[Rn],[]],["GetAttackTime",4,13,[],[Zt,Zt,Zt]],["SetAttackTime",4,14,[Zt],[]],["GetReleaseTime",4,15,[],[Zt,Zt,Zt]],["SetReleaseTime",4,16,[Zt],[]],["GetHoldTime",4,17,[],[Zt,Zt,Zt]],["SetHoldTime",4,18,[Zt],[]],["GetDynamicGainFloor",4,19,[],[Zt,Zt,Zt]],["SetDynamicGainFloor",4,20,[Zt],[]],["GetDynamicGainCeiling",4,21,[],[Zt,Zt,Zt]],["SetDynamicGainCeiling",4,22,[Zt],[]],["GetKneeParameter",4,23,[],[Zt,Zt,Zt]],["SetKneeParameter",4,24,[Zt],[]],["GetSlope",4,25,[],[Zt,Zt,Zt]],["SetSlope",4,26,[Zt],[]],["SetMultiple",4,27,[Pn,Un,kn,Bn,Rn,Zt,Zt,Zt,Zt,Zt,Zt,Zt],[]]],[["Triggered",[k],4,1,!1,!1,null],["DynamicGain",[Zt],4,2,!1,!1,null],["Function",[Un],4,3,!1,!1,null],["Ratio",[Zt],4,4,!1,!1,null],["Threshold",[kn],4,5,!1,!1,null],["ThresholdPresentationUnits",[Bn],4,6,!1,!1,null],["DetectorLaw",[Rn],4,7,!1,!1,null],["AttackTime",[Zt],4,8,!1,!1,null],["ReleaseTime",[Zt],4,9,!1,!1,null],["HoldTime",[Zt],4,10,!1,!1,null],["DynamicGainCeiling",[Zt],4,11,!1,!1,null],["DynamicGainFloor",[Zt],4,12,!1,!1,null],["KneeParameter",[Zt],4,13,!1,!1,null],["Slope",[Zt],4,14,!1,!1,null]],[]),Vn=Se("OcaDynamicsDetector",4,"",2,tn,[["GetLaw",4,1,[],[Rn]],["SetLaw",4,2,[Rn],[]],["GetAttackTime",4,3,[],[Zt,Zt,Zt]],["SetAttackTime",4,4,[Zt],[]],["GetReleaseTime",4,5,[],[Zt,Zt,Zt]],["SetReleaseTime",4,6,[Zt],[]],["GetHoldTime",4,7,[],[Zt,Zt,Zt]],["SetHoldTime",4,8,[Zt],[]],["SetMultiple",4,9,[Pn,Rn,Zt,Zt,Zt],[]]],[["Law",[Rn],4,1,!1,!1,null],["AttackTime",[Zt],4,2,!1,!1,null],["ReleaseTime",[Zt],4,3,!1,!1,null],["HoldTime",[Zt],4,4,!1,!1,null]],[]),zn=Se("OcaDynamicsCurve",4,"",2,tn,[["GetNSegments",4,1,[],[J,J,J]],["SetNSegments",4,2,[J],[]],["GetThreshold",4,3,[],[R(kn),Zt,Zt]],["SetThreshold",4,4,[R(kn)],[]],["GetSlope",4,5,[],[R(Zt),R(Zt),R(Zt)]],["SetSlope",4,6,[R(Zt)],[]],["GetKneeParameter",4,7,[],[R(Zt),R(Zt),R(Zt)]],["SetKneeParameter",4,8,[R(Zt)],[]],["GetDynamicGainCeiling",4,9,[],[Zt,Zt,Zt]],["SetDynamicGainCeiling",4,10,[Zt],[]],["GetDynamicGainFloor",4,11,[],[Zt,Zt,Zt]],["SetDynamicGainFloor",4,12,[Zt],[]],["SetMultiple",4,13,[Pn,J,R(kn),R(Zt),R(Zt),Zt,Zt],[]]],[["NSegments",[J],4,1,!1,!1,null],["Threshold",[R(kn)],4,2,!1,!1,null],["Slope",[R(Zt)],4,3,!1,!1,null],["KneeParameter",[R(Zt)],4,4,!1,!1,null],["DynamicGainFloor",[Zt],4,5,!1,!1,null],["DynamicGainCeiling",[Zt],4,6,!1,!1,null]],[]);class qn extends(G({Linear:1,Logarithmic:2,None:0})){}const Hn=$(qn);class Wn extends(G({None:0,DC:1,Sine:2,Square:3,Impulse:4,NoisePink:5,NoiseWhite:6,PolarityTest:7})){}const Kn=$(Wn),Xn=Se("OcaSignalGenerator",4,"",2,tn,[["GetFrequency1",4,1,[],[Zt,Zt,Zt]],["SetFrequency1",4,2,[Zt],[]],["GetFrequency2",4,3,[],[Zt,Zt,Zt]],["SetFrequency2",4,4,[Zt],[]],["GetLevel",4,5,[],[Zt,Zt,Zt]],["SetLevel",4,6,[Zt],[]],["GetWaveform",4,7,[],[Kn]],["SetWaveform",4,8,[Kn],[]],["GetSweepType",4,9,[],[Hn]],["SetSweepType",4,10,[Hn],[]],["GetSweepTime",4,11,[],[Zt,Zt,Zt]],["SetSweepTime",4,12,[Zt],[]],["GetSweepRepeat",4,13,[],[k]],["SetSweepRepeat",4,14,[k],[]],["GetGenerating",4,15,[],[k]],["Start",4,16,[],[]],["Stop",4,17,[],[]],["SetMultiple",4,18,[Pn,Zt,Zt,Zt,Kn,Hn,Zt,k],[]]],[["Frequency1",[Zt],4,1,!1,!1,null],["Frequency2",[Zt],4,2,!1,!1,null],["Level",[Zt],4,3,!1,!1,null],["Waveform",[Kn],4,4,!1,!1,null],["SweepType",[Hn],4,5,!1,!1,null],["SweepTime",[Zt],4,6,!1,!1,null],["SweepRepeat",[k],4,7,!1,!1,null],["Generating",[k],4,8,!1,!1,null]],[]),Yn=Se("OcaSignalInput",4,"",2,tn,[],[],[]),Qn=Se("OcaSignalOutput",4,"",2,tn,[],[],[]),Jn=Se("OcaTemperatureActuator",4,"",2,tn,[["GetTemperature",4,1,[],[Zt,Zt,Zt]],["SetTemperature",4,2,[Zt],[]]],[["Temperature",[Zt],4,1,!1,!1,null]],[]),Zn=Se("OcaIdentificationActuator",4,"",2,tn,[["GetActive",4,1,[],[k]],["SetActive",4,2,[k],[]]],[["Active",[k],4,1,!1,!1,null]],[]),$n=Se("OcaSummingPoint",4,"",1,tn,[],[],[]),er=Se("OcaBasicActuator",4,"",2,tn,[],[],[]),tr=Se("OcaBooleanActuator",5,"",2,er,[["GetSetting",5,1,[],[k]],["SetSetting",5,2,[k],[]]],[["Setting",[k],5,1,!1,!1,null]],[]),nr=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)}}),rr=Se("OcaInt8Actuator",5,"",2,er,[["GetSetting",5,1,[],[nr,nr,nr]],["SetSetting",5,2,[nr],[]]],[["Setting",[nr],5,1,!1,!1,null]],[]),or=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)}}),sr=Se("OcaInt16Actuator",5,"",2,er,[["GetSetting",5,1,[],[or,or,or]],["SetSetting",5,2,[or],[]]],[["Setting",[or],5,1,!1,!1,null]],[]),ir=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)}}),ar=Se("OcaInt32Actuator",5,"",2,er,[["GetSetting",5,1,[],[ir,ir,ir]],["SetSetting",5,2,[ir],[]]],[["Setting",[ir],5,1,!1,!1,null]],[]);function cr(){if(!rt)throw new Error("Missing BigInt support")}const lr=a({isConstantLength:!0,encodedLength:function(e){return 8},encodeTo:function(e,t,n){if(cr(),!(n>=it&&n<=st))throw new TypeError("Int64 out of range.");return e.setBigInt64(t,BigInt(n),!1),t+8},decode:function(e,t){cr();const n=e.getBigInt64(t,!1);return n>=Number.MIN_SAFE_INTEGER&&n<=Number.MAX_SAFE_INTEGER?Number(n):n}}),ur=Se("OcaInt64Actuator",5,"",2,er,[["GetSetting",5,1,[],[lr,lr,lr]],["SetSetting",5,2,[lr],[]]],[["Setting",[lr],5,1,!1,!1,null]],[]),hr=Se("OcaUint8Actuator",5,"",2,er,[["GetSetting",5,1,[],[J,J,J]],["SetSetting",5,2,[J],[]]],[["Setting",[J],5,1,!1,!1,null]],[]),dr=Se("OcaUint16Actuator",5,"",2,er,[["GetSetting",5,1,[],[c,c,c]],["SetSetting",5,2,[c],[]]],[["Setting",[c],5,1,!1,!1,null]],[]),gr=Se("OcaUint32Actuator",5,"\b",2,er,[["GetSetting",5,1,[],[d,d,d]],["SetSetting",5,2,[d],[]]],[["Setting",[d],5,1,!1,!1,null]],[]),fr=Se("OcaUint64Actuator",5,"\t",2,er,[["GetSetting",5,1,[],[lt,lt,lt]],["SetSetting",5,2,[lt],[]]],[["Setting",[lt],5,1,!1,!1,null]],[]),Sr=Se("OcaFloat32Actuator",5,"\n",2,er,[["GetSetting",5,1,[],[Zt,Zt,Zt]],["SetSetting",5,2,[Zt],[]]],[["Setting",[Zt],5,1,!1,!1,null]],[]),pr=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)}}),mr=Se("OcaFloat64Actuator",5,"\v",2,er,[["GetSetting",5,1,[],[pr,pr,pr]],["SetSetting",5,2,[pr],[]]],[["Setting",[pr],5,1,!1,!1,null]],[]),yr=Se("OcaStringActuator",5,"\f",2,er,[["GetSetting",5,1,[],[z]],["SetSetting",5,2,[z],[]],["GetMaxLen",5,3,[],[c]]],[["Setting",[z],5,1,!1,!1,null],["MaxLen",[c],5,2,!0,!1,null]],[]);function Or(e){return e+7>>3}function br(e,t,n){const r=new Array(n),o=Or(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 Cr=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=Or(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)+Or(n),br(e,t,n)]},decodeLength:function(e,t){return t+2+Or(e.getUint16(t))}}),wr=Se("OcaBitstringActuator",5,"\r",2,er,[["GetNrBits",5,1,[],[c]],["GetBit",5,2,[c],[k]],["SetBit",5,3,[c,k],[]],["GetBitstring",5,4,[],[Cr]],["SetBitstring",5,5,[Cr],[]]],[["Bitstring",[Cr],5,1,!1,!1,null]],[]);class Pr extends(G({Unknown:0,Valid:1,Underrange:2,Overrange:3,Error:4})){}const _r=$(Pr),Gr=Se("OcaSensor",3,"",2,$t,[["GetReadingState",3,1,[],[_r]]],[["ReadingState",[_r],3,1,!1,!1,null]],[]),vr=Se("OcaLevelSensor",4,"",2,Gr,[["GetReading",4,1,[],[Zt,Zt,Zt]]],[["Reading",[Zt],4,1,!1,!1,null]],[]);class Tr extends(G({VU:1,StandardVU:2,PPM1:3,PPM2:4,LKFS:5,RMS:6,Peak:7,ProprietaryValueBase:128})){}const Dr=$(Tr),Ir=Se("OcaAudioLevelSensor",5,"",2,vr,[["GetLaw",5,1,[],[Dr]],["SetLaw",5,2,[Dr],[]]],[["Law",[Dr],5,1,!1,!1,null]],[]),Mr=Se("OcaTimeIntervalSensor",4,"",2,Gr,[["GetReading",4,1,[],[Zt,Zt,Zt]]],[["Reading",[Zt],4,1,!1,!1,null]],[]),Lr=Se("OcaFrequencySensor",4,"",2,Gr,[["GetReading",4,1,[],[Zt,Zt,Zt]]],[["Reading",[Zt],4,1,!1,!1,null]],[]),Ar=Se("OcaTemperatureSensor",4,"",2,Gr,[["GetReading",4,1,[],[Zt,Zt,Zt]]],[["Reading",[Zt],4,1,!1,!1,null]],[]),Er=Se("OcaIdentificationSensor",4,"",2,Gr,[],[],[["Identify",4,1,[]]]),kr=Se("OcaVoltageSensor",4,"",1,Gr,[["GetReading",4,1,[],[Zt,Zt,Zt]]],[["Reading",[Zt],4,1,!1,!1,null]],[]),xr=Se("OcaCurrentSensor",4,"\b",1,Gr,[["GetReading",4,1,[],[Zt,Zt,Zt]]],[["Reading",[Zt],4,1,!1,!1,null]],[]);class Ur{constructor(e,t){this.Magnitude=e,this.Phase=t}}const Nr=l({Magnitude:Zt,Phase:Zt},Ur),Rr=Se("OcaImpedanceSensor",4,"\t",1,Gr,[["GetReading",4,1,[],[Nr,Nr,Nr]]],[["Reading",[Nr],4,1,!1,!1,null]],[]),Fr=Se("OcaGainSensor",4,"\n",1,Gr,[["GetReading",4,1,[],[Zt,Zt,Zt]]],[["Reading",[Zt],4,1,!1,!1,null]],[]),Br=Se("OcaBasicSensor",4,"",2,Gr,[],[],[]),jr=Se("OcaBooleanSensor",5,"",2,Br,[["GetReading",5,1,[],[k]]],[["Reading",[k],5,1,!1,!1,null]],[]),Vr=Se("OcaInt8Sensor",5,"",2,Br,[["GetReading",5,1,[],[nr,nr,nr]]],[["Reading",[nr],5,1,!1,!1,null]],[]),zr=Se("OcaInt16Sensor",5,"",2,Br,[["GetReading",5,1,[],[or,or,or]]],[["Reading",[or],5,1,!1,!1,null]],[]),qr=Se("OcaInt32Sensor",5,"",2,Br,[["GetReading",5,1,[],[ir,ir,ir]]],[["Reading",[ir],5,1,!1,!1,null]],[]),Hr=Se("OcaInt64Sensor",5,"",2,Br,[["GetReading",5,1,[],[lr,lr,lr]]],[["Reading",[lr],5,1,!1,!1,null]],[]),Wr=Se("OcaUint8Sensor",5,"",2,Br,[["GetReading",5,1,[],[J,J,J]]],[["Reading",[J],5,1,!1,!1,null]],[]),Kr=Se("OcaUint16Sensor",5,"",2,Br,[["GetReading",5,1,[],[c,c,c]]],[["Reading",[c],5,1,!1,!1,null]],[]),Xr=Se("OcaUint32Sensor",5,"\b",2,Br,[["GetReading",5,1,[],[d,d,d]]],[["Reading",[d],5,1,!1,!1,null]],[]),Yr=Se("OcaFloat32Sensor",5,"\n",2,Br,[["GetReading",5,1,[],[Zt,Zt,Zt]]],[["Reading",[Zt],5,1,!1,!1,null]],[]),Qr=Se("OcaFloat64Sensor",5,"\v",2,Br,[["GetReading",5,1,[],[pr,pr,pr]]],[["Reading",[pr],5,1,!1,!1,null]],[]),Jr=Se("OcaStringSensor",5,"\f",2,Br,[["GetString",5,1,[],[z]],["GetMaxLen",5,2,[],[c]],["SetMaxLen",5,3,[c],[]]],[["String",[z],5,1,!1,!1,null],["MaxLen",[c],5,2,!1,!1,null]],[]),Zr=Se("OcaBitstringSensor",5,"\r",2,Br,[["GetNrBits",5,1,[],[c]],["GetBit",5,2,[c],[J]],["GetBitString",5,3,[],[Cr]]],[["BitString",[Cr],5,1,!1,!1,null]],[]),$r=Se("OcaUint64Sensor",5,"\t",2,Br,[["GetReading",5,1,[],[lt,lt,lt]]],[["Reading",[lt],5,1,!1,!1,null]],[]);class eo{constructor(e,t){this.POno=e,this.ClassIdentification=t}}const to=l({POno:d,ClassIdentification:me},eo);class no{constructor(e,t){this.Mode=e,this.Index=t}}const ro=l({Mode:zt,Index:c},no);class oo{constructor(e,t,n){this.Owner=e,this.ProtoID=t,this.Name=n}}const so=l({Owner:d,ProtoID:ro,Name:z},oo);class io{constructor(e,t){this.SourceProtoPort=e,this.SinkProtoPort=t}}const ao=l({SourceProtoPort:so,SinkProtoPort:so},io),co=Se("OcaBlockFactory",3,"",2,$t,[["DefineProtoPort",3,1,[z,zt],[ro]],["UndefineProtoPort",3,2,[ro],[]],["GetProtoPorts",3,3,[],[R(so)]],["DefineProtoMemberUsingFactory",3,5,[d],[d]],["UndefineProtoMember",3,6,[d],[]],["GetProtoMembers",3,7,[],[R(to)]],["DefineProtoSignalPath",3,8,[ao],[c]],["UndefineProtoSignalPath",3,9,[],[c]],["GetProtoSignalPaths",3,10,[],[gt(c,ao)]],["GetGlobalType",3,11,[],[Ut]],["SetGlobalType",3,12,[Ut],[]]],[["ProtoPorts",[R(so)],3,1,!1,!1,null],["ProtoMembers",[R(to)],3,2,!1,!1,null],["ProtoSignalPaths",[gt(c,ao)],3,3,!1,!1,null],["GlobalType",[Ut],3,4,!1,!1,null]],[]);function lo(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)&&!N(e))throw new TypeError("Expected array.");const n=e.length;if(0===n)return 4;if(!Array.isArray(e[0])&&!N(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)&&!N(e))throw new TypeError("Expected array.");const n=e.length;if(0===n)return 4;if(!Array.isArray(e[0])&&!N(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 uo=Se("OcaMatrix",3,"",2,$t,[["GetCurrentXY",3,1,[],[c,c]],["SetCurrentXY",3,2,[c,c],[]],["GetSize",3,3,[],[c,c,c,c,c,c]],["SetSize",3,4,[c,c],[]],["GetMembers",3,5,[],[lo(d)]],["SetMembers",3,6,[lo(d)],[]],["GetMember",3,7,[c,c],[d]],["SetMember",3,8,[c,c,d],[]],["GetProxy",3,9,[],[d]],["SetProxy",3,10,[d],[]],["GetPortsPerRow",3,11,[],[J]],["SetPortsPerRow",3,12,[J],[]],["GetPortsPerColumn",3,13,[],[J]],["SetPortsPerColumn",3,14,[J],[]],["SetCurrentXYLock",3,15,[c,c],[]],["UnlockCurrent",3,16,[],[]]],[["X",[c],3,1,!1,!1,null],["Y",[c],3,2,!1,!1,null],["xSize",[c],3,3,!1,!1,null],["ySize",[c],3,4,!1,!1,null],["Members",[lo(d)],3,5,!1,!1,null],["Proxy",[d],3,6,!1,!1,null],["PortsPerRow",[J],3,7,!1,!1,null],["PortsPerColumn",[J],3,8,!1,!1,null]],[]),ho=Se("OcaAgent",2,"",2,we,[["GetLabel",2,1,[],[z]],["SetLabel",2,2,[z],[]],["GetOwner",2,3,[],[d]],["GetPath",2,4,[],[R(z),R(d)]]],[["Label",[z],2,1,!1,!1,null],["Owner",[d],2,2,!1,!1,null]],[]);class go{constructor(e,t){this.HostID=e,this.ONo=t}}const fo=l({HostID:A,ONo:d},go);class So{constructor(e,t,n){this.Index=e,this.ObjectPath=t,this.Online=n}}const po=l({Index:c,ObjectPath:fo,Online:k},So);class mo{constructor(e,t){this.GroupIndex=e,this.CitizenIndex=t}}const yo=l({GroupIndex:c,CitizenIndex:c},mo);class Oo{constructor(e,t,n){this.Index=e,this.Name=t,this.ProxyONo=n}}const bo=l({Index:c,Name:z,ProxyONo:d},Oo);class Co extends(G({MasterSlave:1,PeerToPeer:2})){}const wo=$(Co);class Po extends(G({citizenAdded:1,citizenDeleted:2,citizenConnectionLost:3,citizenConnectionReEstablished:4,citizenError:5,enrollment:6,unEnrollment:7})){}const _o=$(Po);class Go{constructor(e,t,n){this.groupIndex=e,this.citizenIndex=t,this.changeType=n}}const vo=l({groupIndex:c,citizenIndex:c,changeType:_o},Go),To=Se("OcaGrouper",3,"",2,ho,[["AddGroup",3,1,[z],[c,d]],["DeleteGroup",3,2,[c],[]],["GetGroupCount",3,3,[],[c]],["GetGroupList",3,4,[],[R(bo)]],["AddCitizen",3,5,[po],[c]],["DeleteCitizen",3,6,[c],[]],["GetCitizenCount",3,7,[],[c]],["GetCitizenList",3,8,[],[R(po)]],["GetEnrollment",3,9,[yo],[k]],["SetEnrollment",3,10,[yo,k],[]],["GetGroupMemberList",3,11,[c],[R(po)]],["GetActuatorOrSensor",3,12,[],[k]],["SetActuatorOrSensor",3,13,[k],[]],["GetMode",3,14,[],[wo]],["SetMode",3,15,[wo],[]]],[["ActuatorOrSensor",[k],3,1,!1,!1,null],["Groups",[R(bo)],3,2,!1,!1,["GroupList"]],["Citizens",[R(po)],3,3,!1,!1,["CitizenList"]],["Enrollments",[R(yo)],3,4,!1,!1,["EnrollmentList"]],["Mode",[wo],3,5,!1,!1,null]],[["StatusChange",3,1,[vo]]]);class Do 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 Io=$(Do);class Mo{constructor(e,t,n,r){this.PropertyID=e,this.BaseDataType=t,this.GetterMethodID=n,this.SetterMethodID=r}}const Lo=l({PropertyID:ye,BaseDataType:Io,GetterMethodID:Ae,SetterMethodID:Ae},Mo);class Ao{constructor(e,t){this.ONo=e,this.Descriptor=t}}const Eo=l({ONo:d,Descriptor:Lo},Ao);class ko extends(G({Enable:1,Start:2,Halt:3})){}const xo=$(ko);class Uo extends(G({Linear:1,ReverseLinear:2,Sine:3,Exponential:4})){}const No=$(Uo);class Ro extends(G({NotInitialized:1,Iniitialized:2,Scheduled:3,Enabled:4,Ramping:5})){}const Fo=$(Ro),Bo=Se("OcaRamper",3,"",2,ho,[["Control",3,1,[xo],[]],["GetState",3,2,[],[Fo]],["GetRampedProperty",3,3,[],[Eo]],["SetRampedProperty",3,4,[Eo],[]],["GetTimeMode",3,5,[],[St]],["SetTimeMode",3,6,[St],[]],["GetStartTime",3,7,[],[lt]],["SetStartTime",3,8,[lt],[]],["GetDuration",3,9,[],[Zt,Zt,Zt]],["SetDuration",3,10,[Zt],[]],["GetInterpolationLaw",3,11,[],[No]],["SetInterpolationLaw",3,12,[No],[]],["GetGoal",3,13,[],[pr]],["SetGoal",3,14,[pr],[]]],[["State",[Fo],3,1,!1,!1,null],["RampedProperty",[Eo],3,2,!1,!1,null],["TimeMode",[St],3,3,!1,!1,null],["StartTime",[lt],3,4,!1,!1,null],["Duration",[Zt],3,5,!1,!1,null],["InterpolationLaw",[No],3,6,!1,!1,null],["Goal",[pr],3,7,!1,!1,null]],[]);class jo{constructor(e){this.Reading=e}}const Vo=l({Reading:pr},jo);class zo extends(G({NotTriggered:0,Triggered:1})){}const qo=$(zo);class Ho extends(G({None:0,Equality:1,Inequality:2,GreaterThan:3,GreaterThanOrEqual:4,LessThan:5,LessThanOrEqual:6})){}const Wo=$(Ho),Ko=Se("OcaNumericObserver",3,"",2,ho,[["GetLastObservation",3,1,[],[pr]],["GetState",3,2,[],[qo]],["GetObservedProperty",3,3,[],[Eo]],["SetObservedProperty",3,4,[Eo],[]],["GetThreshold",3,5,[],[pr]],["SetThreshold",3,6,[pr],[]],["GetOperator",3,7,[],[Wo]],["SetOperator",3,8,[Wo],[]],["GetTwoWay",3,9,[],[k]],["SetTwoWay",3,10,[k],[]],["GetHysteresis",3,11,[],[pr]],["SetHysteresis",3,12,[pr],[]],["GetPeriod",3,13,[],[Zt]],["SetPeriod",3,14,[Zt],[]]],[["State",[qo],3,1,!1,!1,null],["ObservedProperty",[Eo],3,2,!1,!1,null],["Threshold",[pr],3,3,!1,!1,null],["Operator",[Wo],3,4,!1,!1,null],["TwoWay",[k],3,5,!1,!1,null],["Hysteresis",[pr],3,6,!1,!1,null],["Period",[Zt],3,7,!1,!1,null]],[["Observation",3,1,[Vo]]]);class Xo extends(G({None:0,ReadOnly:1,ReadExpand:2,Full:3})){}const Yo=$(Xo);class Qo{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=l({Name:z,VolType:Ze,Access:Yo,Version:d,Creator:z,UpDate:ht},Qo);class Zo{constructor(e,t){this.Metadata=e,this.Data=t}}const $o=l({Metadata:Jo,Data:A},Zo);class es{constructor(e,t){this.VolumeID=e,this.ChangeType=t}}const ts=l({VolumeID:d,ChangeType:Oe},es),ns=Se("OcaLibrary",3,"",2,ho,[["AddVolume",3,1,[$o],[d]],["ReplaceVolume",3,2,[d,$o],[]],["DeleteVolume",3,3,[d],[]],["GetVolume",3,4,[d],[$o]],["GetVolumeCount",3,5,[],[c]],["GetVolumes",3,6,[],[gt(d,$o)]],["GetAccess",3,7,[],[Yo]],["SetAccess",3,8,[Yo],[]]],[["VolumeType",[Ze],3,1,!1,!1,null],["Access",[Yo],3,2,!1,!1,null],["Volumes",[gt(d,$o)],3,3,!1,!1,null]],[["OcaLibVolChanged",3,1,[ts]]]);class rs extends(G({Unspecified:1,Internal:2,External:3})){}const os=$(rs);class ss extends(G({Off:0,Unavailable:1,Available:2,Active:3})){}const is=$(ss);class as extends(G({None:0,Mains:1,Battery:2,Phantom:3,Solar:4})){}const cs=$(as),ls=Se("OcaPowerSupply",3,"",3,ho,[["GetType",3,1,[],[cs]],["GetModelInfo",3,2,[],[z]],["GetState",3,3,[],[is]],["SetState",3,4,[is],[]],["GetCharging",3,5,[],[k]],["GetLoadFractionAvailable",3,6,[],[Zt]],["GetStorageFractionAvailable",3,7,[],[Zt]],["GetLocation",3,8,[],[os]]],[["Type",[cs],3,1,!1,!1,null],["ModelInfo",[z],3,2,!1,!1,null],["State",[is],3,3,!1,!1,null],["Charging",[k],3,4,!1,!1,null],["LoadFractionAvailable",[Zt],3,5,!1,!1,null],["StorageFractionAvailable",[Zt],3,6,!1,!1,null],["Location",[os],3,7,!0,!1,null]],[]),us=Se("OcaEventHandler",3,"\b",2,ho,[["OnEvent",3,1,[A,f],[]]],[],[]);class hs{constructor(e){this.Reading=e}}const ds=l({Reading:R(pr)},hs),gs=Se("OcaNumericObserverList",3,"\t",2,ho,[["GetLastObservation",3,1,[],[R(pr)]],["GetState",3,2,[],[qo]],["GetObservedProperties",3,3,[],[R(Eo)]],["SetObservedProperties",3,4,[R(Eo)],[]],["GetThreshold",3,5,[],[pr]],["SetThreshold",3,6,[pr],[]],["GetOperator",3,7,[],[Wo]],["SetOperator",3,8,[Wo],[]],["GetTwoWay",3,9,[],[k]],["SetTwoWay",3,10,[k],[]],["GetHysteresis",3,11,[],[pr]],["SetHysteresis",3,12,[pr],[]],["GetPeriod",3,13,[],[Zt]],["SetPeriod",3,14,[Zt],[]]],[["State",[qo],3,1,!1,!1,null],["ObservedProperties",[R(Eo)],3,2,!1,!1,null],["Threshold",[pr],3,3,!1,!1,null],["Operator",[Wo],3,4,!1,!1,null],["TwoWay",[k],3,5,!1,!1,null],["Hysteresis",[pr],3,6,!1,!1,null],["Period",[Zt],3,7,!1,!1,null]],[["Observation",3,1,[ds]]]);class fs extends(G({Unavailable:0,Available:1})){}const Ss=$(fs);class ps{constructor(e,t,n,r){this.NominalRate=e,this.PullRange=t,this.Accuracy=n,this.JitterMax=r}}const ms=l({NominalRate:Zt,PullRange:Zt,Accuracy:Zt,JitterMax:Zt},ps),ys=Se("OcaMediaClock3",3,"",1,ho,[["GetAvailability",3,1,[],[Ss]],["SetAvailability",3,2,[Ss],[]],["GetCurrentRate",3,3,[],[ms,d]],["SetCurrentRate",3,4,[ms,d],[]],["GetOffset",3,5,[],[ht]],["SetOffset",3,6,[ht],[]],["GetSupportedRates",3,7,[],[gt(d,R(ms))]]],[["Availability",[Ss],3,1,!1,!1,null],["TimeSourceONo",[d],3,2,!1,!1,null],["Offset",[ht],3,3,!1,!1,null],["CurrentRate",[ms],3,4,!1,!1,null],["SupportedRates",[gt(d,R(ms))],3,5,!1,!1,null]],[]);class Os 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 bs=$(Os);class Cs extends(G({Undefined:0,Local:1,Private:2,GPS:3,Galileo:4,GLONASS:5})){}const ws=$(Cs);class Ps extends(G({Unavailable:0,Available:1})){}const _s=$(Ps);class Gs extends(G({Undefined:0,Unsynchronized:1,Synchronizing:2,Synchronized:3})){}const vs=$(Gs),Ts=Se("OcaTimeSource",3,"",1,ho,[["GetAvailability",3,1,[],[_s]],["GetProtocol",3,2,[],[bs]],["SetProtocol",3,3,[bs],[]],["GetParameters",3,4,[],[z]],["SetParameters",3,5,[z],[]],["GetReferenceType",3,6,[],[ws]],["SetReferenceType",3,7,[ws],[]],["GetReferenceID",3,8,[],[z]],["SetReferenceID",3,9,[z],[]],["GetSyncStatus",3,10,[],[vs]],["Reset",3,11,[],[]]],[["Availability",[_s],3,1,!1,!1,null],["Protocol",[bs],3,2,!1,!1,null],["Parameters",[z],3,3,!1,!1,null],["ReferenceType",[ws],3,4,!1,!1,null],["ReferenceID",[z],3,5,!1,!1,null],["SyncStatus",[vs],3,6,!1,!1,null]],[]);class Ds extends(G({Robotic:1,ItuAudioObjectBasedPolar:2,ItuAudioObjectBasedCartesian:3,ItuAudioSceneBasedPolar:4,ItuAudioSceneBasedCartesian:5,NAV:6,ProprietaryBase:128})){}const Is=$(Ds),Ms=x;class Ls{constructor(e,t,n){this.CoordinateSystem=e,this.FieldFlags=t,this.Values=n}}const As=l({CoordinateSystem:Is,FieldFlags:Ms,Values:Zt},Ls),Es=Se("OcaPhysicalPosition",3,"",1,ho,[["GetCoordinateSystem",3,1,[],[Is]],["GetPositionDescriptorFieldFlags",3,2,[],[Ms]],["GetPositionDescriptor",3,3,[],[As,As,As]],["SetPositionDescriptor",3,4,[As],[]]],[["CoordinateSystem",[Is],3,1,!0,!1,null],["PositionDescriptorFieldFlags",[Ms],3,2,!0,!1,null],["PositionDescriptor",[As],3,3,!1,!1,null]],[]);class ks extends(G({None:0,Prepare:1,Start:2,Pause:3,Stop:4,Reset:5})){}const xs=$(ks);class Us extends(G({Unknown:0,NotReady:1,Readying:2,Ready:3,Running:4,Paused:5,Stopping:6,Stopped:7,Fault:8})){}const Ns=$(Us);class Rs{constructor(e,t){this.SystemInterfaceParameters=e,this.MyNetworkAddress=t}}const Fs=l({SystemInterfaceParameters:A,MyNetworkAddress:A},Rs),Bs=Se("OcaApplicationNetwork",2,"",1,we,[["GetLabel",2,1,[],[z]],["SetLabel",2,2,[z],[]],["GetOwner",2,3,[],[d]],["GetServiceID",2,4,[],[A]],["SetServiceID",2,5,[A],[]],["GetSystemInterfaces",2,6,[],[R(Fs)]],["SetSystemInterfaces",2,7,[R(Fs)],[]],["GetState",2,8,[],[Ns]],["GetErrorCode",2,9,[],[c]],["Control",2,10,[xs],[]],["GetPath",2,11,[],[R(z),R(d)]]],[["Label",[z],2,1,!1,!0,null],["Owner",[d],2,2,!1,!0,null],["ServiceID",[A],2,3,!1,!1,null],["SystemInterfaces",[R(Fs)],2,4,!1,!1,null],["State",[Ns],2,5,!1,!1,null],["ErrorCode",[c],2,6,!1,!1,null]],[]);class js extends(G({None:0,OCP01:1,OCP02:2,OCP03:3})){}const Vs=$(js),zs=Se("OcaControlNetwork",3,"",1,Bs,[["GetControlProtocol",3,1,[],[Vs]]],[["Protocol",[Vs],3,1,!1,!1,["ControlProtocol"]]],[]);class qs{constructor(e,t,n){this.CodingSchemeID=e,this.CodecParameters=t,this.ClockONo=n}}const Hs=l({CodingSchemeID:c,CodecParameters:z,ClockONo:d},qs);class Ws extends(G({None:0,Unicast:1,Multicast:2})){}const Ks=$(Ws);class Xs{constructor(e,t,n,r){this.Secure=e,this.StreamParameters=t,this.StreamCastMode=n,this.StreamChannelCount=r}}const Ys=l({Secure:k,StreamParameters:A,StreamCastMode:Ks,StreamChannelCount:c},Xs);class Qs extends(G({None:0,Start:1,Pause:2})){}const Js=$(Qs);class Zs extends(G({Stopped:0,SettingUp:1,Running:2,Paused:3,Fault:4})){}const $s=$(Zs);class ei{constructor(e,t,n){this.ConnectorID=e,this.State=t,this.ErrorCode=n}}const ti=l({ConnectorID:c,State:$s,ErrorCode:c},ei);class ni{constructor(e){this.ConnectorStatus=e}}const ri=l({ConnectorStatus:ti},ni);function oi(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 si{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 ii=l({IDInternal:c,IDExternal:z,Connection:Ys,AvailableCodings:R(Hs),PinCount:c,ChannelPinMap:oi(c,Ht),AlignmentLevel:Zt,AlignmentGain:Zt,CurrentCoding:Hs},si),ai=x;class ci{constructor(e,t,n){this.SinkConnector=e,this.ChangeType=t,this.ChangedElement=n}}const li=l({SinkConnector:ii,ChangeType:Oe,ChangedElement:ai},ci);class ui{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 hi=l({IDInternal:c,IDExternal:z,Connection:Ys,AvailableCodings:R(Hs),PinCount:c,ChannelPinMap:gt(c,Ht),AlignmentLevel:Zt,CurrentCoding:Hs},ui);class di{constructor(e,t,n){this.SourceConnector=e,this.ChangeType=t,this.ChangedElement=n}}const gi=l({SourceConnector:hi,ChangeType:Oe,ChangedElement:ai},di);class fi extends(G({None:0,AV3:1,AVBTP:2,Dante:3,Cobranet:4,AES67:5,SMPTEAudio:6,LiveWire:7,ExtensionPoint:65})){}const Si=$(fi),pi=Se("OcaMediaTransportNetwork",3,"",1,Bs,[["GetMediaProtocol",3,1,[],[Si]],["GetPorts",3,2,[],[R(Kt)]],["GetPortName",3,3,[Ht],[z]],["SetPortName",3,4,[Ht,z],[]],["GetMaxSourceConnectors",3,5,[],[c]],["GetMaxSinkConnectors",3,6,[],[c]],["GetMaxPinsPerConnector",3,7,[],[c]],["GetMaxPortsPerPin",3,8,[],[c]],["GetSourceConnectors",3,9,[],[R(hi)]],["GetSourceConnector",3,10,[c],[hi]],["GetSinkConnectors",3,11,[],[R(ii)]],["GetSinkConnector",3,12,[c],[ii]],["GetConnectorsStatuses",3,13,[],[R(ti)]],["GetConnectorStatus",3,14,[c],[ti]],["AddSourceConnector",3,15,[hi,$s],[hi]],["AddSinkConnector",3,16,[ti,ii],[ii]],["ControlConnector",3,17,[c,Js],[]],["SetSourceConnectorPinMap",3,18,[c,gt(c,Ht)],[]],["SetSinkConnectorPinMap",3,19,[c,oi(c,Ht)],[]],["SetConnectorConnection",3,20,[c,Ys],[]],["SetConnectorCoding",3,21,[c,Hs],[]],["SetConnectorAlignmentLevel",3,22,[c,Zt],[]],["SetConnectorAlignmentGain",3,23,[c,Zt],[]],["DeleteConnector",3,24,[c],[]],["GetAlignmentLevel",3,25,[],[Zt,Zt,Zt]],["GetAlignmentGain",3,26,[],[Zt,Zt,Zt]]],[["Protocol",[Si],3,1,!1,!1,["MediaProtocol"]],["Ports",[R(Kt)],3,2,!1,!1,null],["MaxSourceConnectors",[c],3,3,!1,!1,null],["MaxSinkConnectors",[c],3,4,!1,!1,null],["MaxPinsPerConnector",[c],3,5,!1,!1,null],["MaxPortsPerPin",[c],3,6,!1,!1,null],["AlignmentLevel",[Zt],3,7,!1,!1,null],["AlignmentGain",[Zt],3,8,!1,!1,null]],[["SourceConnectorChanged",3,1,[gi]],["SinkConnectorChanged",3,2,[li]],["ConnectorStatusChanged",3,3,[ri]]]);class mi extends(G({None:0,Source:1,Sink:2})){}const yi=$(mi);class Oi extends(G({NotConnected:0,Connected:1,Muted:2})){}const bi=$(Oi),Ci=Se("OcaNetworkSignalChannel",3,"",2,$t,[["AddToConnector",3,6,[d,c],[]],["GetConnectorPins",3,5,[],[gt(d,c)]],["GetIDAdvertised",3,1,[],[A]],["GetNetwork",3,3,[],[d]],["GetRemoteChannelID",3,8,[],[A]],["GetSourceOrSink",3,10,[],[yi]],["GetStatus",3,11,[],[bi]],["RemoveFromConnector",3,7,[d],[]],["SetIDAdvertised",3,2,[A],[]],["SetNetwork",3,4,[d],[]],["SetRemoteChannelID",3,9,[A],[]]],[["ConnectorPins",[gt(d,c)],3,3,!1,!1,null],["IDAdvertised",[A],3,1,!1,!1,null],["Network",[d],3,2,!1,!1,null],["RemoteChannelID",[A],3,4,!1,!1,null],["SourceOrSink",[yi],3,5,!1,!1,null],["Status",[bi],3,6,!1,!1,null]],[]);class wi extends(G({None:0,EthernetWired:1,EthernetWireless:2,USB:3,SerialP2P:4})){}const Pi=$(wi);class _i{constructor(e,t){this.rxPacketErrors=e,this.txPacketErrors=t}}const Gi=l({rxPacketErrors:d,txPacketErrors:d},_i);class vi extends(G({Unknown:0,Ready:1,StartingUp:2,Stopped:3})){}const Ti=$(vi);class Di{constructor(e,t){this.SystemInterfaceHandle=e,this.MyNetworkAddress=t}}const Ii=l({SystemInterfaceHandle:A,MyNetworkAddress:A},Di),Mi=Se("OcaNetwork",3,"",2,ho,[["GetLinkType",3,1,[],[Pi]],["GetIDAdvertised",3,2,[],[A]],["SetIDAdvertised",3,3,[A],[]],["GetControlProtocol",3,4,[],[Vs]],["GetMediaProtocol",3,5,[],[Si]],["GetStatus",3,6,[],[Ti]],["GetStatistics",3,7,[],[Gi]],["ResetStatistics",3,8,[],[]],["GetSystemInterfaces",3,9,[],[R(Ii)]],["SetSystemInterfaces",3,10,[R(Ii)],[]],["GetMediaPorts",3,11,[],[R(d)]],["Startup",3,12,[],[]],["Shutdown",3,13,[],[]]],[["LinkType",[Pi],3,1,!0,!1,null],["IDAdvertised",[A],3,2,!1,!1,null],["ControlProtocol",[Vs],3,3,!1,!1,null],["MediaProtocol",[Si],3,4,!1,!1,null],["Status",[Ti],3,5,!1,!1,null],["SystemInterfaces",[R(Ii)],3,6,!1,!1,null],["MediaPorts",[R(d)],3,7,!1,!1,null],["Statistics",[Gi],3,8,!1,!1,null]],[]);class Li extends(G({Undefined:0,Locked:1,Synchronizing:2,FreeRun:3,Stopped:4})){}const Ai=$(Li),Ei=Se("OcaMediaClock",3,"",2,ho,[["GetType",3,1,[],[Ke]],["SetType",3,2,[Ke],[]],["GetDomainID",3,3,[],[c]],["SetDomainID",3,4,[c],[]],["GetSupportedRates",3,5,[],[R(ms)]],["GetCurrentRate",3,6,[],[ms]],["SetCurrentRate",3,7,[ms],[]],["GetLockState",3,8,[],[Ai]]],[["Type",[Ke],3,1,!1,!1,null],["DomainID",[c],3,2,!1,!1,null],["RatesSupported",[R(ms)],3,3,!1,!1,null],["CurrentRate",[ms],3,4,!1,!1,null],["LockState",[Ai],3,5,!1,!1,null]],[]),ki=Se("OcaStreamNetwork",3,"\n",2,ho,[["GetLinkType",3,1,[],[Pi]],["GetIDAdvertised",3,2,[],[A]],["SetIDAdvertised",3,3,[A],[]],["GetControlProtocol",3,4,[],[Vs]],["GetMediaProtocol",3,5,[],[Si]],["GetStatus",3,6,[],[Ti]],["GetStatistics",3,7,[],[Gi]],["ResetStatistics",3,8,[],[]],["GetSystemInterfaces",3,9,[],[R(Ii)]],["SetSystemInterfaces",3,10,[R(Ii)],[]],["GetStreamConnectorsSource",3,11,[],[R(d)]],["SetStreamConnectorsSource",3,12,[R(d)],[]],["GetStreamConnectorsSink",3,13,[],[R(d)]],["SetStreamConnectorsSink",3,14,[R(d)],[]],["GetSignalChannelsSource",3,15,[],[R(d)]],["SetSignalChannelsSource",3,16,[R(d)],[]],["GetSignalChannelsSink",3,17,[],[R(d)]],["SetSignalChannelsSink",3,18,[R(d)],[]],["Startup",3,19,[],[]],["Shutdown",3,20,[],[]]],[["ControlProtocol",[Vs],3,3,!1,!1,null],["IDAdvertised",[A],3,2,!1,!1,null],["LinkType",[Pi],3,1,!0,!1,null],["MediaProtocol",[Si],3,4,!1,!1,null],["SignalChannelsSink",[R(d)],3,10,!1,!1,null],["SignalChannelsSource",[R(d)],3,9,!1,!1,null],["Statistics",[Gi],3,11,!1,!1,null],["Status",[Ti],3,5,!1,!1,null],["StreamConnectorsSink",[R(d)],3,8,!1,!1,null],["StreamConnectorsSource",[R(d)],3,7,!1,!1,null],["SystemInterfaces",[R(Ii)],3,6,!1,!1,null]],[]);class xi{constructor(e,t,n,r){this.HostID=e,this.NetworkAddress=t,this.NodeID=n,this.StreamConnectorID=r}}const Ui=l({HostID:A,NetworkAddress:A,NodeID:A,StreamConnectorID:A},xi);class Ni extends(G({NotConnected:0,Connected:1,Paused:2})){}const Ri=$(Ni);class Fi extends(G({None:0,Unicast:1,Multicast:2})){}const Bi=$(Fi);class ji{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 Vi=l({ErrorNumber:c,IDAdvertised:A,Index:c,Label:z,LocalConnectorONo:d,Priority:c,RemoteConnectorIdentification:Ui,Secure:k,Status:Ri,StreamParameters:A,StreamType:Bi},ji);class zi extends(G({NotAvailable:0,Idle:1,Connected:2,Paused:3})){}const qi=$(zi),Hi=Se("OcaStreamConnector",3,"\v",2,ho,[["ConnectStream",3,7,[Vi],[c]],["DisconnectStream",3,8,[c],[]],["GetIDAdvertised",3,3,[],[A]],["GetOwnerNetwork",3,1,[],[d]],["GetPins",3,10,[],[gt(c,d)]],["GetSourceOrSink",3,5,[],[yi]],["GetStatus",3,11,[],[qi]],["GetStreams",3,9,[],[gt(c,Vi)]],["SetIDAdvertised",3,4,[A],[]],["SetOwnerNetwork",3,2,[d],[]],["SetSourceOrSink",3,6,[yi],[]]],[["IDAdvertised",[A],3,2,!1,!1,null],["OwnerNetwork",[d],3,1,!1,!1,null],["Pins",[gt(c,d)],3,5,!1,!1,null],["SourceOrSink",[yi],3,3,!1,!1,null],["Status",[qi],3,6,!1,!1,null],["Streams",[gt(c,Vi)],3,4,!1,!1,null]],[]);var Wi=Object.freeze({__proto__:null,OcaRoot:we,OcaWorker:$t,OcaActuator:tn,OcaMute:on,OcaPolarity:cn,OcaSwitch:ln,OcaGain:un,OcaPanBalance:hn,OcaDelay:dn,OcaDelayExtended:mn,OcaFrequencyActuator:yn,OcaFilterClassical:_n,OcaFilterParametric:Tn,OcaFilterPolynomial:Dn,OcaFilterFIR:In,OcaFilterArbitraryCurve:An,OcaDynamics:jn,OcaDynamicsDetector:Vn,OcaDynamicsCurve:zn,OcaSignalGenerator:Xn,OcaSignalInput:Yn,OcaSignalOutput:Qn,OcaTemperatureActuator:Jn,OcaIdentificationActuator:Zn,OcaSummingPoint:$n,OcaBasicActuator:er,OcaBooleanActuator:tr,OcaInt8Actuator:rr,OcaInt16Actuator:sr,OcaInt32Actuator:ar,OcaInt64Actuator:ur,OcaUint8Actuator:hr,OcaUint16Actuator:dr,OcaUint32Actuator:gr,OcaUint64Actuator:fr,OcaFloat32Actuator:Sr,OcaFloat64Actuator:mr,OcaStringActuator:yr,OcaBitstringActuator:wr,OcaSensor:Gr,OcaLevelSensor:vr,OcaAudioLevelSensor:Ir,OcaTimeIntervalSensor:Mr,OcaFrequencySensor:Lr,OcaTemperatureSensor:Ar,OcaIdentificationSensor:Er,OcaVoltageSensor:kr,OcaCurrentSensor:xr,OcaImpedanceSensor:Rr,OcaGainSensor:Fr,OcaBasicSensor:Br,OcaBooleanSensor:jr,OcaInt8Sensor:Vr,OcaInt16Sensor:zr,OcaInt32Sensor:qr,OcaInt64Sensor:Hr,OcaUint8Sensor:Wr,OcaUint16Sensor:Kr,OcaUint32Sensor:Xr,OcaFloat32Sensor:Yr,OcaFloat64Sensor:Qr,OcaStringSensor:Jr,OcaBitstringSensor:Zr,OcaUint64Sensor:$r,OcaBlock:en,OcaBlockFactory:co,OcaMatrix:uo,OcaAgent:ho,OcaGrouper:To,OcaRamper:Bo,OcaNumericObserver:Ko,OcaLibrary:ns,OcaPowerSupply:ls,OcaEventHandler:us,OcaNumericObserverList:gs,OcaMediaClock3:ys,OcaTimeSource:Ts,OcaPhysicalPosition:Es,OcaApplicationNetwork:Bs,OcaControlNetwork:zs,OcaMediaTransportNetwork:pi,OcaManager:Pe,OcaDeviceManager:_e,OcaSecurityManager:Ge,OcaFirmwareManager:Me,OcaSubscriptionManager:je,OcaPowerManager:qe,OcaNetworkManager:He,OcaMediaClockManager:Xe,OcaLibraryManager:tt,OcaAudioProcessingManager:nt,OcaDeviceTimeManager:dt,OcaTaskManager:Dt,OcaCodingManager:It,OcaDiagnosticManager:Mt,OcaNetworkSignalChannel:Ci,OcaNetwork:Mi,OcaMediaClock:Ei,OcaStreamNetwork:ki,OcaStreamConnector:Hi});const Ki={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 Xi(e){const t=e.EmitterONo,n=e.EventID;return[t,n.DefLevel,n.EventIndex].join(",")}const Yi={ONo:1055,MethodID:{DefLevel:1,MethodIndex:1}};class Qi 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(Wi)),t.map(e=>this.add_control_classes(e)),this.DeviceManager=new _e(Ki.DeviceManager,this),this.SecurityManager=new Ge(Ki.SecurityManager,this),this.FirmwareManager=new Me(Ki.FirmwareManager,this),this.SubscriptionManager=new je(Ki.SubscriptionManager,this),this.PowerManager=new qe(Ki.PowerManager,this),this.NetworkManager=new He(Ki.NetworkManager,this),this.MediaClockManager=new Xe(Ki.MediaClockManager,this),this.LibraryManager=new tt(Ki.LibraryManager,this),this.AudioProcessingManager=new nt(Ki.AudioProcessingManager,this),this.DeviceTimeManager=new dt(Ki.DeviceTimeManager,this),this.TaskManager=new Dt(Ki.TaskManager,this),this.CodingManager=new It(Ki.CodingManager,this),this.DiagnosticManager=new Mt(Ki.DiagnosticManager,this),this.Root=new en(100,this),this.subscriptions=new Map}close(){this.connection.close()}send_command(e,t,n){return this.connection.send_command(e,t,n)}_doSubscribe(e){return this.SubscriptionManager.AddSubscription(e,Yi,new Uint8Array(0),xe.Reliable,new Uint8Array(0))}async add_subscription(n,r){const o=Xi(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=Xi(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,Yi))}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(en.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 Ji=Object.values(Wi);class Zi extends(G({None:0,ParamSet:1,Patch:2,Program:3})){}class $i extends(G({Ampere:4,DegreeCelsius:2,Hertz:1,None:0,Ohm:5,Volt:3})){}var ea=Object.freeze({__proto__:null,OcaApplicationNetworkCommand:ks,OcaApplicationNetworkState:Us,OcaBaseDataType:Do,OcaBlockMember:Et,OcaClassAuthorityID:class{constructor(e,t,n){this.Sentinel=e,this.Reserved=t,this.OrganizationID=n}},OcaClassIdentification:pe,OcaClassicalFilterShape:On,OcaComponent:ve,OcaDBr:En,OcaDelayUnit:gn,OcaDelayValue:Sn,OcaDeviceState:{Operational:1,Disabled:2,Error:4,Initializing:8,Updating:16,unused:32},OcaDynamicsFunction:xn,OcaEnumItem:class{constructor(e){this.Value=e}},OcaEnumItem16:class{constructor(e){this.Value=e}},OcaEvent:g,OcaEventID:u,OcaFilterPassband:Cn,OcaGlobalTypeIdentifier:xt,OcaGrouperCitizen:So,OcaGrouperEnrollment:mo,OcaGrouperGroup:Oo,OcaGrouperMode:Co,OcaGrouperStatusChangeEventData:Go,OcaGrouperStatusChangeType:Po,OcaImpedance:Ur,OcaLevelDetectionLaw:Nn,OcaLevelMeterLaw:Tr,OcaLibAccess:Xo,OcaLibParamSetAssignment:class{constructor(e,t){this.ParamSetIdentifier=e,this.TargetBlockONo=t}},OcaLibVol:Zo,OcaLibVolChangedEventData:es,OcaLibVolData_ParamSet:Nt,OcaLibVolIdentifier:Ye,OcaLibVolMetadata:Qo,OcaLibVolStandardTypeID:Zi,OcaLibVolType:Je,OcaLibraryIdentifier:$e,OcaManagerDefaultObjectNumbers:Ki,OcaManagerDescriptor:H,OcaMediaClockAvailability:fs,OcaMediaClockLockState:Li,OcaMediaClockRate:ps,OcaMediaClockType:We,OcaMediaCoding:qs,OcaMediaConnection:Xs,OcaMediaConnectorCommand:Qs,OcaMediaConnectorElement:{PinMap:1,Connection:2,Coding:4,AlignmentLevel:8,AlignmentGain:16},OcaMediaConnectorState:Zs,OcaMediaConnectorStatus:ei,OcaMediaConnectorStatusChangedEventData:ni,OcaMediaSinkConnector:si,OcaMediaSinkConnectorChangedEventData:ci,OcaMediaSourceConnector:ui,OcaMediaSourceConnectorChangedEventData:di,OcaMediaStreamCastMode:Ws,OcaMethod:Ee,OcaMethodID:Le,OcaModelDescription:K,OcaModelGUID:Y,OcaMuteState:nn,OcaNetworkControlProtocol:js,OcaNetworkLinkType:wi,OcaNetworkMediaProtocol:fi,OcaNetworkMediaSourceOrSink:mi,OcaNetworkSignalChannelStatus:Oi,OcaNetworkStatistics:_i,OcaNetworkStatus:vi,OcaNetworkSystemInterfaceDescriptor:Rs,OcaNetworkSystemInterfaceID:Di,OcaNotificationDeliveryMode:xe,OcaOPath:go,OcaObjectIdentification:Lt,OcaObjectListEventData:Ne,OcaObjectSearchResult:Ft,OcaObjectSearchResultFlags:{ONo:1,ClassIdentification:2,ContainerPath:4,Role:8,Label:16,unused:32},OcaObservationEventData:jo,OcaObservationListEventData:hs,OcaObserverState:zo,OcaParametricEQShape:Gn,OcaPilotToneDetectorSpec:class{constructor(e,t,n){this.Threshold=e,this.Frequency=t,this.PollInterval=n}},OcaPolarityState:sn,OcaPort:Wt,OcaPortID:qt,OcaPortMode:Vt,OcaPositionCoordinateSystem:Ds,OcaPositionDescriptor:Ls,OcaPowerState:Ve,OcaPowerSupplyLocation:rs,OcaPowerSupplyState:ss,OcaPowerSupplyType:as,OcaPresentationUnit:Fn,OcaProperty:Ao,OcaPropertyChangeType:ie,OcaPropertyDescriptor:Mo,OcaPropertyID:ce,OcaProtoObjectIdentification:eo,OcaProtoPort:oo,OcaProtoPortID:no,OcaProtoSignalPath:io,OcaRamperCommand:ko,OcaRamperInterpolationLaw:Uo,OcaRamperState:Ro,OcaRelationalOperator:Ho,OcaResetCause:ee,OcaSensorReadingState:Pr,OcaSignalPath:Xt,OcaStatus:v,OcaStream:ji,OcaStreamConnectorIdentification:xi,OcaStreamConnectorStatus:zi,OcaStreamStatus:Ni,OcaStreamType:Fi,OcaStringComparisonType:Qt,OcaSubscriptionManagerState:Fe,OcaSweepType:qn,OcaTask:pt,OcaTaskCommand:yt,OcaTaskManagerState:bt,OcaTaskState:wt,OcaTaskStateChangedEventData:vt,OcaTaskStatus:_t,OcaTimeMode:ft,OcaTimePTP:ut,OcaTimeProtocol:Os,OcaTimeReferenceType:Cs,OcaTimeSourceAvailability:Ps,OcaTimeSourceSyncStatus:Gs,OcaTransferFunction:Mn,OcaUnitOfMeasure:$i,OcaVersion:De,OcaWaveformType:Wn});class ta extends L{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()}}function na(e){return new Promise(t=>setTimeout(t,e))}const ra={Connection:L,WebSocket:ta,Device:Qi,ControlClasses:Wi,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<Ji.length;e++)if(Ji[e].ClassName===o){o=Ji[e];break}}else{const e=n.substr(0,n.length-1);for(let t=0;t<Ji.length;t++)if(Ji[t].ClassID===e){o=Ji[t];break}}if("function"!=typeof o)throw new Error("Unknown parent class.");return Se(e,t,n,r,o,s,i,a)}};var oa=Object.freeze({__proto__:null,Connection:P,controller:ra,ClientConnection:L,Command:s,CommandRrq:i,decodeMessage:O,encodeMessage:C,error:t,log:function(...e){try{console.log(...e)}catch(e){}},KeepAlive:m,Notification:S,Response:p,RemoteDevice:Qi,Types:ea,warn:e,WebSocketConnection:ta,RemoteControlClasses:Wi,AbstractUDPConnection:class extends L{constructor(e,t){t.batch>=0||(t.batch=128),super(t),this.socket=e,this.delay=t.delay>=0?t.delay:5,this.retry_interval=t.retry_interval>=0?t.retry_interval:250,this.retry_count=t.retry_count>=0?t.retry_count:3,this._write_out_id=-1,this._write_out_callback=()=>{this._write_out_id=-1,this._write_out()},this._retry_id=this.retry_interval>0?setInterval(()=>this._retryCommands(),this.retry_interval):-1,this.q=[],e.onmessage=e=>{try{this.read(e)}catch(e){console.warn("Failed to parse incoming AES70 packet: %o",e)}null!==this.inbuf&&this.close()},e.onerror=e=>this.error(e),this.set_keepalive_interval(1)}get is_reliable(){return!1}static async connect(e,t){const n=await e.connect(t.host,t.port,t.type);return await async function(e,t){const n=e.receiveMessage().then(e=>{const t=[];let n=0;if(n=O(new DataView(e),0,t),1!==t.length)throw new Error("Expected keepalive response.");return!0}),r=C(new m(1e3)),o=5*(t.retry_interval||250);for(let t=0;t<3;t++)if(e.send(r),await Promise.race([n,na(o)]))return;throw new Error("Failed to connect.")}(n,t),new this(n,t)}write(e){this.q.push(e),this.tx_idle_time()>=this.delay?this._write_out():this._schedule_write_out()}flush(){super.flush(),this.tx_idle_time()>this.delay&&this._write_out()}cleanup(){super.cleanup(),this.socket&&(this.socket.close(),this.socket=null),-1!==this._write_out_id&&(clearTimeout(this._write_out_id),this._write_out_id=-1),-1!==this._retry_id&&(clearInterval(this._retry_id),this._retry_id=-1)}_estimate_next_tx_time(){return this._now()+(this.delay+2)*this.q.length}_write_out(){if(!this.socket)return;const e=this.q;if(!e.length)return;const t=e.shift();this.socket.send(t),super.write(t),e.length&&this._schedule_write_out()}_schedule_write_out(){const e=this.tx_idle_time(),t=this.delay;e>=t?this._write_out():-1===this._write_out_id&&(this._write_out_id=setTimeout(this._write_out_callback,t-e))}_retryCommands(){const e=this._now(),t=e-this.retry_interval,n=this.retry_interval/this.delay*5-this.q.length,r=this._pendingCommands,o=[],s=[];for(const e of r){const[,r]=e;if(r.lastSent>t)break;r.retries>=this.retry_count?s.push(e):o.length<n&&o.push(e)}if(s.length){const e=new Error("Timeout.");s.forEach(([t,n])=>{r.delete(t),n.reject(e)})}o.forEach(([t,n])=>{r.delete(t),r.set(t,n),this.send(n.command),n.lastSent=e,n.retries++})}}});window.OCA=oa}();
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}}}const c=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)}});function l(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}})}class u{constructor(e,t){this.DefLevel=e,this.EventIndex=t}}const h=l({DefLevel:c,EventIndex:c},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 f=l({EmitterONo:d,EventID:h},g);class p 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]=f.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 S 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 y=[s,i,p,S,m];function O(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=y[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}function w(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}class C{constructor(e,t){if(!(e<=4294967295))throw new TypeError("Invalid batch size.");this._pdus=[],this._batchSize=e,this._resultCallback=t,this._currentSize=0,this._currentCount=0,this._lastMessageType=-1,this._flushScheduled=!1,this._flushCb=()=>{this._flushScheduled=!1,null!==this._pdus&&this.flush()}}add(e){const t=this._currentSize,n=e.encoded_length(),r=e.messageType,o=this._lastMessageType===r&&4!==r&&this._currentCount<65535;let s=n;o||(s+=10),t&&t+s>this._batchSize&&(this.flush(),s=n+10),this._pdus.push(e),this._currentSize+=s,o?this._currentCount++:this._currentCount=1,this._lastMessageType=r,this._currentSize>this._batchSize?this.flush():1===this._pdus.length&&this.scheduleFlush()}scheduleFlush(){this._flushScheduled||(this._flushScheduled=!0,Promise.resolve().then(this._flushCb).catch(e=>{console.error(e)}))}flush(){if(!this._currentSize)return;const e=this._pdus,t=new ArrayBuffer(this._currentSize),n=new DataView(t),r=e.length;for(let t=0,o=0,s=0;t<r;t++){const i=e[t].messageType;t!==r-1&&t+1-o!=65535&&4!==i&&i===e[t+1].messageType||(s=b(n,s,e,o,t+1),o=t+1)}this._currentSize=0,this._lastMessageType=-1,this._currentCount=0,this._pdus.length=0,this._resultCallback(t)}dispose(){this._pdus=null}}class P 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=O(n,t,r);if(-1==o){this.inbuf=e,this.inpos=t;break}t=o,this.incoming(r)}while(t<e.byteLength)}catch(e){if(this.is_reliable)return void this.emit("error",e);console.error(e)}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 _(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)_(e,n)&&t.set(e[n],n)}return t.get(n)}let r=null;const o=class{constructor(t){if("string"==typeof t){if(!_(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(_(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)_(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 T{constructor(e,t){this.status=new v(e),this.cmd=t}static check_status(e,t){return e instanceof this&&e.status===t}toString(){return"RemoteError("+this.status+")"}}class D{constructor(e){this.values=e}item(e){return this.values[e]}get length(){return this.values.length}}class I{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 T(e.status_code,o));else if(r)try{const n=Math.min(e.param_count,r.length);if(0===n)t();else{const o=new Array(n),s=new DataView(e.parameters);for(let e=0,t=0;e<n;e++){let n;[t,n]=r[e].decodeFrom(s,t),o[e]=n}t(1===n?o[0]:new D(o))}}catch(e){n(e)}else t(e)}}function M(e){const t=e.EmitterONo,n=e.EventID;return[t,n.DefLevel,n.EventIndex].join(",")}class L extends P{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=M(e),r=this._subscribers;if(r.has(n))throw new Error("Subscriber already exists.");r.set(n,t)}_removeSubscriber(e){const t=M(e),n=this._subscribers;if(!n.has(t))throw new Error("Unknown subscriber.");n.delete(t)}_getNextCommandHandle(){let e;const t=this._pendingCommands;if(null===t)throw new Error("Connection not open.");do{e=this._nextCommandHandle,this._nextCommandHandle=e+1|0}while(t.has(e));return e}_estimate_next_tx_time(){return this._now()}send_command(e,t,n){const r=(n,r)=>{const o=this._getNextCommandHandle();e.handle=o;const s=new I(n,r,t,e);this._pendingCommands.set(o,s),s.lastSent=this._estimate_next_tx_time(),this.send(e)};if(!n)return new Promise(r);r(e=>n(!0,e),e=>n(!1,e))}_removePendingCommand(e){const t=this._pendingCommands,n=t.get(e);return n?(t.delete(e),n):null}incoming(e){for(let t=0;t<e.length;t++){if(null===this._pendingCommands)return;const n=e[t];if(n instanceof S){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 p){const e=this._subscribers,t=M(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.")}}}}const A=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 E(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 k=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)}}),x=c,U=x;function N(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function R(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)&&!N(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)&&!N(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)}const F=new TextEncoder,B=new TextDecoder;function j(e){return F.encode(e)}function V(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 z=a({isConstantLength:!1,encodedLength:function(e){if("string"!=typeof e)throw new TypeError("Expected string.");return 2+j(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(j(n));return new Uint8Array(e.buffer,e.byteOffset).set(o,t),t+o.length},decodeFrom:function(e,t){const n=e.getUint16(t),r=V(e,t+=2,n),o=new Uint8Array(e.buffer,e.byteOffset+t,r);return[t+r,(s=o,B.decode(s))];var s},decodeLength:function(e,t){const n=e.getUint16(t);return(t+=2)+V(e,t,n)}}),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,n,r){this.ObjectNumber=e,this.Name=t,this.ClassID=n,this.ClassVersion=r}}const W=l({ObjectNumber:d,Name:z,ClassID:q,ClassVersion:c},H);class K{constructor(e,t,n){this.Manufacturer=e,this.Name=t,this.Version=n}}const X=l({Manufacturer:z,Name:z,Version:z},K);class Y{constructor(e,t,n){this.Reserved=e,this.MfrCode=t,this.ModelCode=n}}const Q=l({Reserved:E(1),MfrCode:E(3),ModelCode:E(4)},Y),J=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 Z(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 $(e){return Z(e,J)}class ee extends(G({PowerOn:0,InternalError:1,Upgrade:2,ExternalRequest:3})){}const te=$(ee);class ne{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 re=new ArrayBuffer;class oe extends ne{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||re);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 se extends ne{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 ie extends(G({CurrentChanged:1,MinChanged:2,MaxChanged:3,ItemAdded:4,ItemChanged:5,ItemDeleted:6})){}class ae{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===ie.CurrentChanged&&(this.values[e]=t)}.bind(this,e);this.subscriptions.push(o.unsubscribe.bind(o,n)),t.push(o.subscribe(n).catch((function(){})))}t.push(r().then(function(e,t){t instanceof D&&(t=t.item(0)),this.values[e]=t}.bind(this,e),(function(){}))),e++}),Promise.all(t)}forEach(e,t){let n=0;t||(t=this),this.o.get_properties().forEach(r=>{r.getter(this.o)&&(e.call(t,this.values[n],r.name),n++)})}Dispose(){this.o=null,this.subscriptions.forEach(e=>e()),this.subscriptions=null}}class ce{constructor(e,t){this.DefLevel=e,this.PropertyIndex=t}}class le{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 ce){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 ue{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 ce(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 he(e,t){if(!t||!t.length)return;const[n,r,s,a,c]=t;e.prototype[n]=function(...e){const t=a.length;let n=null;t<e.length&&t+1===e.length&&"function"==typeof e[t]&&(n=e[t],e.length=t);const l=new i(this.ono,r,s,t,new o(a,e));return this.device.send_command(l,c,n)}}function de(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 oe(this,new u(r,o),s))}})}function ge(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 se(this,new ce(t.level,t.index),t.type))}})}function fe(e){if("object"==typeof e&&e instanceof ue)return e;if(Array.isArray(e))return"object"!=typeof e[1]&&(e[1]=function(e){throw new Error("Not implemented.")}(e[1])),new ue(...e);throw new Error("Bad property.")}function pe(e,t,n,r,o,s,i,a){let c=null,l=null;i=i.map(e=>fe(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 le(i,t,o.get_properties())),l}static GetPropertySync(){return null===c&&(c=function(e){const t=Object.create(ae.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++)he(u,s[e]);for(let e=0;e<i.length;e++)ge(u,i[e]);for(let e=0;e<a.length;e++)de(u,a[e]);return u}class Se{constructor(e,t){this.ClassID=e,this.ClassVersion=t}}const me=l({ClassID:q,ClassVersion:c},Se),ye=l({DefLevel:c,PropertyIndex:c},ce),Oe=$(ie);function be(...e){const t=e.length;return a({isConstantLength:!1,encodedLength:function(n){if(!Array.isArray(n)&&!N(n))throw new TypeError("Expected array.");if(n.length!==t)throw new Error("Length mismatch.");let r=0;for(let o=0;o<t;o++)r+=e[o].encodedLength(n[o]);return r},encodeTo:function(n,r,o){for(let s=0;s<t;s++)r=e[s].encodeTo(n,r,o[s]);return r},decodeFrom:function(n,r){const o=new Array(t);for(let s=0;s<t;s++){let t;[r,t]=e[s].decodeFrom(n,r),o[s]=t}return[r,o]},decodeLength:function(n,r){for(let o=0;o<t;o++)r=e[o].decodeLength(n,r);return r}})}const we=be(ye,(Ce=1,a({isConstantLength:!1,encodedLength:function(e){if(!("object"==typeof e&&e instanceof DataView))throw new TypeError("Expected DataView.");return e.byteLength-Ce},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-Ce;return[t+n,new DataView(e.buffer,e.byteOffset+t,n)]},decodeLength:function(e,t){return t+(e.byteLength-t-Ce)}})),Oe);var Ce;const Pe=pe("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,[],[me]],["GetLockable",1,2,[],[k]],["LockTotal",1,3,[],[]],["Unlock",1,4,[],[]],["GetRole",1,5,[],[z]],["LockReadonly",1,6,[],[]]],[["ClassID",[q],1,1,!0,!0,null],["ClassVersion",[c],1,2,!0,!0,null],["ObjectNumber",[d],1,3,!0,!1,null],["Lockable",[k],1,4,!0,!1,null],["Role",[z],1,5,!0,!1,null]],[["PropertyChanged",1,1,[we]]]),_e=pe("OcaManager",2,"",2,Pe,[],[],[]),Ge=pe("OcaDeviceManager",3,"",2,_e,[["GetOcaVersion",3,1,[],[c]],["GetModelGUID",3,2,[],[Q]],["GetSerialNumber",3,3,[],[z]],["GetDeviceName",3,4,[],[z]],["SetDeviceName",3,5,[z],[]],["GetModelDescription",3,6,[],[X]],["GetDeviceRole",3,7,[],[z]],["SetDeviceRole",3,8,[z],[]],["GetUserInventoryCode",3,9,[],[z]],["SetUserInventoryCode",3,10,[z],[]],["GetEnabled",3,11,[],[k]],["SetEnabled",3,12,[k],[]],["GetState",3,13,[],[U]],["SetResetKey",3,14,[E(16),A],[]],["GetResetCause",3,15,[],[te]],["ClearResetCause",3,16,[],[]],["GetMessage",3,17,[],[z]],["SetMessage",3,18,[z],[]],["GetManagers",3,19,[],[R(W)]],["GetDeviceRevisionID",3,20,[],[z]]],[["ModelGUID",[Q],3,1,!1,!1,null],["SerialNumber",[z],3,2,!1,!1,null],["ModelDescription",[X],3,3,!1,!1,null],["DeviceName",[z],3,4,!1,!1,null],["OcaVersion",[c],3,5,!1,!1,null],["DeviceRole",[z],3,6,!1,!1,null],["UserInventoryCode",[z],3,7,!1,!1,null],["Enabled",[k],3,8,!1,!1,null],["State",[U],3,9,!1,!1,null],["Busy",[k],3,10,!1,!1,null],["ResetCause",[te],3,11,!1,!1,null],["Message",[z],3,12,!1,!1,null],["Managers",[R(W)],3,13,!1,!1,null],["DeviceRevisionID",[z],3,14,!0,!1,null]],[]),ve=pe("OcaSecurityManager",3,"",2,_e,[["AddPreSharedKey",3,4,[z,A],[]],["ChangePreSharedKey",3,3,[z,A],[]],["DeletePreSharedKey",3,5,[z],[]],["DisableControlSecurity",3,2,[],[]],["EnableControlSecurity",3,1,[],[]]],[["secureControlData",[k],3,1,!1,!1,null]],[]);class Te extends(G({BootLoader:0})){}const De=Z(Te,c);class Ie{constructor(e,t,n,r){this.Major=e,this.Minor=t,this.Build=n,this.Component=r}}const Me=l({Major:d,Minor:d,Build:d,Component:De},Ie),Le=pe("OcaFirmwareManager",3,"",2,_e,[["GetComponentVersions",3,1,[],[R(Me)]],["StartUpdateProcess",3,2,[],[]],["BeginActiveImageUpdate",3,3,[De],[]],["AddImageData",3,4,[d,A],[]],["VerifyImage",3,5,[A],[]],["EndActiveImageUpdate",3,6,[],[]],["BeginPassiveComponentUpdate",3,7,[De,A,z],[]],["EndUpdateProcess",3,8,[],[]]],[["ComponentVersions",[R(Me)],3,1,!1,!1,null]],[]);class Ae{constructor(e,t){this.DefLevel=e,this.MethodIndex=t}}const Ee=l({DefLevel:c,MethodIndex:c},Ae);class ke{constructor(e,t){this.ONo=e,this.MethodID=t}}const xe=l({ONo:d,MethodID:Ee},ke);class Ue extends(G({Reliable:1,Fast:2})){}const Ne=$(Ue);class Re{constructor(e){this.objectList=e}}const Fe=l({objectList:R(d)},Re);class Be extends(G({Normal:1,EventsDisabled:2})){}const je=$(Be),Ve=pe("OcaSubscriptionManager",3,"",2,_e,[["RemoveSubscription",3,2,[f,xe],[]],["AddSubscription",3,1,[f,xe,A,Ne,A],[]],["DisableNotifications",3,3,[],[]],["ReEnableNotifications",3,4,[],[]],["AddPropertyChangeSubscription",3,5,[d,ye,xe,A,Ne,A],[]],["RemovePropertyChangeSubscription",3,6,[d,ye,xe],[]],["GetMaximumSubscriberContextLength",3,7,[],[c]]],[["State",[je],3,1,!1,!1,null]],[["NotificationsDisabled",3,1,[]],["SynchronizeState",3,2,[Fe]]]);class ze extends(G({None:0,Working:1,Standby:2,Off:3})){}const qe=$(ze),He=pe("OcaPowerManager",3,"",2,_e,[["GetState",3,1,[],[qe]],["SetState",3,2,[qe],[]],["GetPowerSupplies",3,3,[],[R(d)]],["GetActivePowerSupplies",3,4,[],[R(d)]],["ExchangePowerSupply",3,5,[d,d,k],[]],["GetAutoState",3,6,[],[k]]],[["State",[qe],3,1,!1,!1,null],["PowerSupplies",[R(d)],3,2,!1,!1,null],["ActivePowerSupplies",[R(d)],3,3,!1,!1,null],["AutoState",[k],3,4,!1,!1,null],["TargetState",[qe],3,5,!1,!1,null]],[]),We=pe("OcaNetworkManager",3,"",2,_e,[["GetNetworks",3,1,[],[R(d)]],["GetStreamNetworks",3,2,[],[R(d)]],["GetControlNetworks",3,3,[],[R(d)]],["GetMediaTransportNetworks",3,4,[],[R(d)]]],[["Networks",[R(d)],3,1,!1,!1,null],["StreamNetworks",[R(d)],3,2,!1,!1,null],["ControlNetworks",[R(d)],3,3,!1,!1,null],["MediaTransportNetworks",[R(d)],3,4,!1,!1,null]],[]);class Ke extends(G({None:0,Internal:1,Network:2,External:3})){}const Xe=$(Ke),Ye=pe("OcaMediaClockManager",3,"",2,_e,[["GetClocks",3,1,[],[R(d)]],["GetMediaClockTypesSupported",3,2,[],[R(Xe)]],["GetClock3s",3,3,[],[R(d)]]],[["ClockSourceTypesSupported",[R(Xe)],3,1,!1,!1,["MediaClockTypesSupported"]],["Clocks",[R(d)],3,2,!1,!1,null],["Clock3s",[R(d)],3,3,!1,!1,null]],[]);class Qe{constructor(e,t){this.Library=e,this.ID=t}}const Je=l({Library:d,ID:d},Qe);class Ze{constructor(e,t){this.Authority=e,this.ID=t}}const $e=l({Authority:E(3),ID:d},Ze);class et{constructor(e,t){this.Type=e,this.ONo=t}}const tt=l({Type:$e,ONo:d},et),nt=pe("OcaLibraryManager",3,"\b",2,_e,[["AddLibrary",3,1,[$e],[tt]],["DeleteLibrary",3,2,[d],[]],["GetLibraryCount",3,3,[$e],[c]],["GetLibraryList",3,4,[$e],[R(tt)]],["GetCurrentPatch",3,5,[],[Je]],["ApplyPatch",3,6,[Je],[]]],[["Libraries",[R(tt)],3,1,!1,!1,null],["CurrentPatch",[Je],3,2,!1,!1,null]],[]),rt=pe("OcaAudioProcessingManager",3,"\t",2,_e,[],[],[]),ot="undefined"!=typeof BigInt,st=ot&&(BigInt(1)<<BigInt(64))-BigInt(1),it=ot&&st>>BigInt(1),at=ot&&-it-BigInt(1),ct=ot&&(BigInt(1)<<BigInt(55))-BigInt(1);ot&&BigInt(1);function lt(){if(!ot)throw new Error("Missing BigInt support")}const ut=a({isConstantLength:!0,encodedLength:function(e){return 8},encodeTo:function(e,t,n){if(lt(),!(n<=st&&n>=0))throw new TypeError("Uint64 out of range.");return e.setBigUint64(t,BigInt(n),!1),t+8},decode:function(e,t){lt();const n=e.getBigUint64(t,!1);return n<=Number.MAX_SAFE_INTEGER?Number(n):n}});class ht{constructor(e,t,n){this.Negative=e,this.Seconds=t,this.Nanoseconds=n}}const dt=l({Negative:k,Seconds:ut,Nanoseconds:d},ht),gt=pe("OcaDeviceTimeManager",3,"\n",2,_e,[["GetDeviceTimeNTP",3,1,[],[ut]],["SetDeviceTimeNTP",3,2,[ut],[]],["GetTimeSources",3,3,[],[R(d)]],["GetCurrentDeviceTimeSource",3,4,[],[d]],["SetCurrentDeviceTimeSource",3,5,[d],[]],["GetDeviceTimePTP",3,6,[],[dt]],["SetDeviceTimePTP",3,7,[dt],[]]],[["TimeSources",[R(d)],3,1,!1,!1,null],["CurrentDeviceTimeSource",[d],3,2,!1,!1,null]],[]);function ft(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 pt extends(G({Absolute:1,Relative:2})){}const St=$(pt);class mt{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 yt=l({ID:d,Label:z,ProgramID:Je,GroupID:c,TimeMode:St,TimeSourceONo:d,StartTime:dt,Duration:dt,ApplicationSpecificParameters:A},mt);class Ot extends(G({None:0,Prepare:1,Enable:2,Start:3,Stop:4,Abort:5,Disable:6,Clear:7})){}const bt=$(Ot);class wt extends(G({None:0,Enabled:1,Disabled:2})){}const Ct=$(wt);class Pt extends(G({None:0,NotPrepared:1,Disabled:2,Enabled:3,Running:4,Completed:5,Failed:6,Stopped:7,Aborted:8})){}const _t=$(Pt);class Gt{constructor(e,t,n){this.ID=e,this.State=t,this.ErrorCode=n}}const vt=l({ID:d,State:_t,ErrorCode:c},Gt);class Tt{constructor(e,t,n){this.TaskID=e,this.ProgramID=t,this.Status=n}}const Dt=l({TaskID:d,ProgramID:Je,Status:vt},Tt),It=pe("OcaTaskManager",3,"\v",1,_e,[["Enable",3,1,[k],[]],["ControlAllTasks",3,2,[bt,A],[]],["ControlTaskGroup",3,3,[c,bt,A],[]],["ControlTask",3,4,[d,bt,A],[]],["GetState",3,5,[],[Ct]],["GetTaskStatuses",3,6,[],[vt]],["GetTaskStatus",3,7,[d],[vt]],["AddTask",3,8,[yt],[yt]],["GetTasks",3,9,[],[ft(d,yt)]],["GetTask",3,10,[d],[yt]],["SetTask",3,11,[d,yt],[]],["DeleteTask",3,12,[d],[]]],[["State",[Ct],3,1,!1,!1,null],["Tasks",[ft(d,yt)],3,2,!1,!1,null]],[["TaskStateChanged",3,1,[Dt]]]),Mt=pe("OcaCodingManager",3,"\f",1,_e,[["GetAvailableEncodingSchemes",3,1,[],[ft(c,z)]],["GetAvailableDecodingSchemes",3,2,[],[ft(c,z)]]],[["AvailableEncodingSchemes",[ft(c,z)],3,1,!1,!1,null],["AvailableDecodingSchemes",[ft(c,z)],3,2,!1,!1,null]],[]),Lt=pe("OcaDiagnosticManager",3,"\r",1,_e,[["GetLockStatus",3,1,[d],[z]]],[],[]);class At{constructor(e,t){this.ONo=e,this.ClassIdentification=t}}const Et=l({ONo:d,ClassIdentification:me},At);class kt{constructor(e,t){this.MemberObjectIdentification=e,this.ContainerObjectNumber=t}}const xt=l({MemberObjectIdentification:Et,ContainerObjectNumber:d},kt);class Ut{constructor(e,t){this.Authority=e,this.ID=t}}const Nt=l({Authority:E(3),ID:d},Ut);class Rt{constructor(e,t){this.TargetBlockType=e,this.ParData=t}}const Ft=l({TargetBlockType:d,ParData:A},Rt);class Bt{constructor(e,t,n,r,o){this.ONo=e,this.ClassIdentification=t,this.ContainerPath=n,this.Role=r,this.Label=o}}const jt=l({ONo:d,ClassIdentification:me,ContainerPath:R(d),Role:z,Label:z},Bt),Vt=x;class zt extends(G({Input:1,Output:2})){}const qt=$(zt);class Ht{constructor(e,t){this.Mode=e,this.Index=t}}const Wt=l({Mode:qt,Index:c},Ht);class Kt{constructor(e,t,n){this.Owner=e,this.ID=t,this.Name=n}}const Xt=l({Owner:d,ID:Wt,Name:z},Kt);class Yt{constructor(e,t){this.SourcePort=e,this.SinkPort=t}}const Qt=l({SourcePort:Xt,SinkPort:Xt},Yt);class Jt extends(G({Exact:0,Substring:1,Contains:2,ExactCaseInsensitive:3,SubstringCaseInsensitive:4,ContainsCaseInsensitive:5})){}const Zt=$(Jt),$t=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)}}),en=pe("OcaWorker",2,"",2,Pe,[["GetEnabled",2,1,[],[k]],["SetEnabled",2,2,[k],[]],["AddPort",2,3,[z,qt],[Wt]],["DeletePort",2,4,[Wt],[]],["GetPorts",2,5,[],[R(Xt)]],["GetPortName",2,6,[Wt],[z]],["SetPortName",2,7,[Wt,z],[]],["GetLabel",2,8,[],[z]],["SetLabel",2,9,[z],[]],["GetOwner",2,10,[],[d]],["GetLatency",2,11,[],[$t]],["SetLatency",2,12,[$t],[]],["GetPath",2,13,[],[R(z),R(d)]]],[["Enabled",[k],2,1,!1,!1,null],["Ports",[R(Xt)],2,2,!1,!1,null],["Label",[z],2,3,!1,!1,null],["Owner",[d],2,4,!1,!1,null],["Latency",[$t],2,5,!1,!1,null]],[]),tn=pe("OcaBlock",3,"",2,en,[["GetType",3,1,[],[d]],["ConstructMemberUsingFactory",3,3,[d],[d]],["DeleteMember",3,4,[d],[]],["GetMembers",3,5,[],[R(Et)]],["GetMembersRecursive",3,6,[],[R(xt)]],["AddSignalPath",3,7,[Qt],[c]],["DeleteSignalPath",3,8,[c],[]],["GetSignalPaths",3,9,[],[ft(c,Qt)]],["GetSignalPathsRecursive",3,10,[],[ft(c,Qt)]],["GetMostRecentParamSetIdentifier",3,11,[],[Je]],["ApplyParamSet",3,12,[],[Je]],["GetCurrentParamSetData",3,13,[],[Ft]],["StoreCurrentParamSetData",3,14,[Je],[]],["GetGlobalType",3,15,[],[Nt]],["GetONoMap",3,16,[],[ft(d,d)]],["FindObjectsByRole",3,17,[z,Zt,q,Vt],[R(jt)]],["FindObjectsByRoleRecursive",3,18,[z,Zt,q,Vt],[R(jt)]],["FindObjectsByPath",3,20,[R(z),Vt],[R(jt)]],["FindObjectsByLabelRecursive",3,19,[z,Zt,q,Vt],[R(jt)]]],[["Type",[d],3,1,!0,!1,null],["Members",[R(Et)],3,2,!1,!1,null],["SignalPaths",[ft(c,Qt)],3,3,!1,!1,null],["MostRecentParamSetIdentifier",[Je],3,4,!1,!1,null],["GlobalType",[Nt],3,5,!0,!1,null],["ONoMap",[ft(d,d)],3,6,!0,!1,null]],[]),nn=pe("OcaActuator",3,"",2,en,[],[],[]);class rn extends(G({Muted:1,Unmuted:2})){}const on=$(rn),sn=pe("OcaMute",4,"",2,nn,[["GetState",4,1,[],[on]],["SetState",4,2,[on],[]]],[["State",[on],4,1,!1,!1,null]],[]);class an extends(G({NonInverted:1,Inverted:2})){}const cn=$(an),ln=pe("OcaPolarity",4,"",2,nn,[["GetState",4,1,[],[cn]],["SetState",4,2,[cn],[]]],[["State",[cn],4,1,!1,!1,null]],[]),un=pe("OcaSwitch",4,"",2,nn,[["GetPosition",4,1,[],[c,c,c]],["SetPosition",4,2,[c],[]],["GetPositionName",4,3,[c],[z]],["SetPositionName",4,4,[c,z],[]],["GetPositionNames",4,5,[],[R(z)]],["SetPositionNames",4,6,[R(z)],[]],["GetPositionEnabled",4,7,[c],[k]],["SetPositionEnabled",4,8,[c,k],[]],["GetPositionEnableds",4,9,[],[R(k)]],["SetPositionEnableds",4,10,[R(k)],[]]],[["Position",[c],4,1,!1,!1,null],["PositionNames",[R(z)],4,2,!1,!1,null],["PositionEnableds",[R(k)],4,3,!1,!1,null]],[]),hn=pe("OcaGain",4,"",2,nn,[["GetGain",4,1,[],[$t,$t,$t]],["SetGain",4,2,[$t],[]]],[["Gain",[$t],4,1,!1,!1,null]],[]),dn=pe("OcaPanBalance",4,"",2,nn,[["GetPosition",4,1,[],[$t,$t,$t]],["SetPosition",4,2,[$t],[]],["GetMidpointGain",4,3,[],[$t,$t,$t]],["SetMidpointGain",4,4,[$t],[]]],[["Position",[$t],4,1,!1,!1,null],["MidpointGain",[$t],4,2,!1,!1,null]],[]),gn=pe("OcaDelay",4,"",2,nn,[["GetDelayTime",4,1,[],[$t,$t,$t]],["SetDelayTime",4,2,[$t],[]]],[["DelayTime",[$t],4,1,!1,!1,null]],[]);class fn extends(G({Time:1,Distance:2,Samples:3,Microseconds:4,Milliseconds:5,Centimeters:6,Inches:7,Feet:8})){}const pn=$(fn);class Sn{constructor(e,t){this.DelayValue=e,this.DelayUnit=t}}const mn=l({DelayValue:$t,DelayUnit:pn},Sn),yn=pe("OcaDelayExtended",5,"",2,gn,[["GetDelayValue",5,1,[],[mn,mn,mn]],["SetDelayValue",5,2,[mn],[]],["GetDelayValueConverted",5,3,[pn],[mn]]],[["DelayValue",[mn],5,1,!1,!1,null]],[]),On=pe("OcaFrequencyActuator",4,"\b",2,nn,[["GetFrequency",4,1,[],[$t,$t,$t]],["SetFrequency",4,2,[$t],[]]],[["Frequency",[$t],4,1,!1,!1,null]],[]);class bn extends(G({Butterworth:1,Bessel:2,Chebyshev:3,LinkwitzRiley:4})){}const wn=$(bn);class Cn extends(G({HiPass:1,LowPass:2,BandPass:3,BandReject:4,AllPass:5})){}const Pn=$(Cn),_n=x,Gn=pe("OcaFilterClassical",4,"\t",2,nn,[["GetFrequency",4,1,[],[$t,$t,$t]],["SetFrequency",4,2,[$t],[]],["GetPassband",4,3,[],[Pn]],["SetPassband",4,4,[Pn],[]],["GetShape",4,5,[],[wn]],["SetShape",4,6,[wn],[]],["GetOrder",4,7,[],[c,c,c]],["SetOrder",4,8,[c],[]],["GetParameter",4,9,[],[$t,$t,$t]],["SetParameter",4,10,[$t],[]],["SetMultiple",4,11,[_n,$t,Pn,wn,c,$t],[]]],[["Frequency",[$t],4,1,!1,!1,null],["Passband",[Pn],4,2,!1,!1,null],["Shape",[wn],4,3,!1,!1,null],["Order",[c],4,4,!1,!1,null],["Parameter",[$t],4,5,!1,!1,null]],[]);class vn 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 Tn=$(vn),Dn=pe("OcaFilterParametric",4,"\n",2,nn,[["GetFrequency",4,1,[],[$t,$t,$t]],["SetFrequency",4,2,[$t],[]],["GetShape",4,3,[],[Tn]],["SetShape",4,4,[Tn],[]],["GetWidthParameter",4,5,[],[$t,$t,$t]],["SetWidthParameter",4,6,[$t],[]],["GetInbandGain",4,7,[],[$t,$t,$t]],["SetInbandGain",4,8,[$t],[]],["GetShapeParameter",4,9,[],[$t,$t,$t]],["SetShapeParameter",4,10,[$t],[]],["SetMultiple",4,11,[_n,$t,Tn,$t,$t,$t],[]]],[["Frequency",[$t],4,1,!1,!1,null],["Shape",[Tn],4,2,!1,!1,null],["WidthParameter",[$t],4,3,!1,!1,["Q"]],["InbandGain",[$t],4,4,!1,!1,null],["ShapeParameter",[$t],4,5,!1,!1,null]],[]),In=pe("OcaFilterPolynomial",4,"\v",2,nn,[["GetCoefficients",4,1,[],[R($t),R($t)]],["SetCoefficients",4,2,[R($t),R($t)],[]],["GetSampleRate",4,3,[],[$t,$t,$t]],["SetSampleRate",4,4,[$t],[]],["GetMaxOrder",4,5,[],[J]]],[["A",[R($t)],4,1,!1,!1,null],["B",[R($t)],4,2,!1,!1,null],["SampleRate",[$t],4,3,!1,!1,null],["MaxOrder",[J],4,4,!0,!1,null]],[]),Mn=pe("OcaFilterFIR",4,"\f",2,nn,[["GetLength",4,1,[],[d,d,d]],["GetCoefficients",4,2,[],[R($t)]],["SetCoefficients",4,3,[R($t)],[]],["GetSampleRate",4,4,[],[$t,$t,$t]],["SetSampleRate",4,5,[$t],[]]],[["Length",[d],4,1,!1,!1,null],["Coefficients",[R($t)],4,2,!1,!1,null],["SampleRate",[$t],4,3,!1,!1,null]],[]);class Ln{constructor(e,t,n){this.Frequency=e,this.Amplitude=t,this.Phase=n}}const An=l({Frequency:R($t),Amplitude:R($t),Phase:R($t)},Ln),En=pe("OcaFilterArbitraryCurve",4,"\r",2,nn,[["GetTransferFunction",4,1,[],[An]],["SetTransferFunction",4,2,[An],[]],["GetSampleRate",4,3,[],[$t,$t,$t]],["SetSampleRate",4,4,[$t],[]],["GetTFMinLength",4,5,[],[c]],["GetTFMaxLength",4,6,[],[c]]],[["TransferFunction",[An],4,1,!1,!1,null],["SampleRate",[$t],4,2,!1,!1,null],["TFMinLength",[c],4,3,!1,!1,null],["TFMaxLength",[c],4,4,!1,!1,null]],[]);class kn{constructor(e,t){this.Value=e,this.Ref=t}}const xn=l({Value:$t,Ref:$t},kn);class Un extends(G({None:0,Compress:1,Limit:2,Expand:3,Gate:4})){}const Nn=$(Un);class Rn extends(G({None:0,RMS:1,Peak:2})){}const Fn=$(Rn);class Bn extends(G({dBu:0,dBV:1,V:2})){}const jn=$(Bn),Vn=pe("OcaDynamics",4,"",2,nn,[["GetTriggered",4,1,[],[k]],["GetDynamicGain",4,2,[],[$t]],["GetFunction",4,3,[],[Nn]],["SetFunction",4,4,[Nn],[]],["GetRatio",4,5,[],[$t,$t,$t]],["SetRatio",4,6,[$t],[]],["GetThreshold",4,7,[],[xn,$t,$t]],["SetThreshold",4,8,[xn],[]],["GetThresholdPresentationUnits",4,9,[],[jn]],["SetThresholdPresentationUnits",4,10,[jn],[]],["GetDetectorLaw",4,11,[],[Fn]],["SetDetectorLaw",4,12,[Fn],[]],["GetAttackTime",4,13,[],[$t,$t,$t]],["SetAttackTime",4,14,[$t],[]],["GetReleaseTime",4,15,[],[$t,$t,$t]],["SetReleaseTime",4,16,[$t],[]],["GetHoldTime",4,17,[],[$t,$t,$t]],["SetHoldTime",4,18,[$t],[]],["GetDynamicGainFloor",4,19,[],[$t,$t,$t]],["SetDynamicGainFloor",4,20,[$t],[]],["GetDynamicGainCeiling",4,21,[],[$t,$t,$t]],["SetDynamicGainCeiling",4,22,[$t],[]],["GetKneeParameter",4,23,[],[$t,$t,$t]],["SetKneeParameter",4,24,[$t],[]],["GetSlope",4,25,[],[$t,$t,$t]],["SetSlope",4,26,[$t],[]],["SetMultiple",4,27,[_n,Nn,xn,jn,Fn,$t,$t,$t,$t,$t,$t,$t],[]]],[["Triggered",[k],4,1,!1,!1,null],["DynamicGain",[$t],4,2,!1,!1,null],["Function",[Nn],4,3,!1,!1,null],["Ratio",[$t],4,4,!1,!1,null],["Threshold",[xn],4,5,!1,!1,null],["ThresholdPresentationUnits",[jn],4,6,!1,!1,null],["DetectorLaw",[Fn],4,7,!1,!1,null],["AttackTime",[$t],4,8,!1,!1,null],["ReleaseTime",[$t],4,9,!1,!1,null],["HoldTime",[$t],4,10,!1,!1,null],["DynamicGainCeiling",[$t],4,11,!1,!1,null],["DynamicGainFloor",[$t],4,12,!1,!1,null],["KneeParameter",[$t],4,13,!1,!1,null],["Slope",[$t],4,14,!1,!1,null]],[]),zn=pe("OcaDynamicsDetector",4,"",2,nn,[["GetLaw",4,1,[],[Fn]],["SetLaw",4,2,[Fn],[]],["GetAttackTime",4,3,[],[$t,$t,$t]],["SetAttackTime",4,4,[$t],[]],["GetReleaseTime",4,5,[],[$t,$t,$t]],["SetReleaseTime",4,6,[$t],[]],["GetHoldTime",4,7,[],[$t,$t,$t]],["SetHoldTime",4,8,[$t],[]],["SetMultiple",4,9,[_n,Fn,$t,$t,$t],[]]],[["Law",[Fn],4,1,!1,!1,null],["AttackTime",[$t],4,2,!1,!1,null],["ReleaseTime",[$t],4,3,!1,!1,null],["HoldTime",[$t],4,4,!1,!1,null]],[]),qn=pe("OcaDynamicsCurve",4,"",2,nn,[["GetNSegments",4,1,[],[J,J,J]],["SetNSegments",4,2,[J],[]],["GetThreshold",4,3,[],[R(xn),$t,$t]],["SetThreshold",4,4,[R(xn)],[]],["GetSlope",4,5,[],[R($t),R($t),R($t)]],["SetSlope",4,6,[R($t)],[]],["GetKneeParameter",4,7,[],[R($t),R($t),R($t)]],["SetKneeParameter",4,8,[R($t)],[]],["GetDynamicGainCeiling",4,9,[],[$t,$t,$t]],["SetDynamicGainCeiling",4,10,[$t],[]],["GetDynamicGainFloor",4,11,[],[$t,$t,$t]],["SetDynamicGainFloor",4,12,[$t],[]],["SetMultiple",4,13,[_n,J,R(xn),R($t),R($t),$t,$t],[]]],[["NSegments",[J],4,1,!1,!1,null],["Threshold",[R(xn)],4,2,!1,!1,null],["Slope",[R($t)],4,3,!1,!1,null],["KneeParameter",[R($t)],4,4,!1,!1,null],["DynamicGainFloor",[$t],4,5,!1,!1,null],["DynamicGainCeiling",[$t],4,6,!1,!1,null]],[]);class Hn extends(G({Linear:1,Logarithmic:2,None:0})){}const Wn=$(Hn);class Kn extends(G({None:0,DC:1,Sine:2,Square:3,Impulse:4,NoisePink:5,NoiseWhite:6,PolarityTest:7})){}const Xn=$(Kn),Yn=pe("OcaSignalGenerator",4,"",2,nn,[["GetFrequency1",4,1,[],[$t,$t,$t]],["SetFrequency1",4,2,[$t],[]],["GetFrequency2",4,3,[],[$t,$t,$t]],["SetFrequency2",4,4,[$t],[]],["GetLevel",4,5,[],[$t,$t,$t]],["SetLevel",4,6,[$t],[]],["GetWaveform",4,7,[],[Xn]],["SetWaveform",4,8,[Xn],[]],["GetSweepType",4,9,[],[Wn]],["SetSweepType",4,10,[Wn],[]],["GetSweepTime",4,11,[],[$t,$t,$t]],["SetSweepTime",4,12,[$t],[]],["GetSweepRepeat",4,13,[],[k]],["SetSweepRepeat",4,14,[k],[]],["GetGenerating",4,15,[],[k]],["Start",4,16,[],[]],["Stop",4,17,[],[]],["SetMultiple",4,18,[_n,$t,$t,$t,Xn,Wn,$t,k],[]]],[["Frequency1",[$t],4,1,!1,!1,null],["Frequency2",[$t],4,2,!1,!1,null],["Level",[$t],4,3,!1,!1,null],["Waveform",[Xn],4,4,!1,!1,null],["SweepType",[Wn],4,5,!1,!1,null],["SweepTime",[$t],4,6,!1,!1,null],["SweepRepeat",[k],4,7,!1,!1,null],["Generating",[k],4,8,!1,!1,null]],[]),Qn=pe("OcaSignalInput",4,"",2,nn,[],[],[]),Jn=pe("OcaSignalOutput",4,"",2,nn,[],[],[]),Zn=pe("OcaTemperatureActuator",4,"",2,nn,[["GetTemperature",4,1,[],[$t,$t,$t]],["SetTemperature",4,2,[$t],[]]],[["Temperature",[$t],4,1,!1,!1,null]],[]),$n=pe("OcaIdentificationActuator",4,"",2,nn,[["GetActive",4,1,[],[k]],["SetActive",4,2,[k],[]]],[["Active",[k],4,1,!1,!1,null]],[]),er=pe("OcaSummingPoint",4,"",1,nn,[],[],[]),tr=pe("OcaBasicActuator",4,"",2,nn,[],[],[]),nr=pe("OcaBooleanActuator",5,"",2,tr,[["GetSetting",5,1,[],[k]],["SetSetting",5,2,[k],[]]],[["Setting",[k],5,1,!1,!1,null]],[]),rr=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)}}),or=pe("OcaInt8Actuator",5,"",2,tr,[["GetSetting",5,1,[],[rr,rr,rr]],["SetSetting",5,2,[rr],[]]],[["Setting",[rr],5,1,!1,!1,null]],[]),sr=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)}}),ir=pe("OcaInt16Actuator",5,"",2,tr,[["GetSetting",5,1,[],[sr,sr,sr]],["SetSetting",5,2,[sr],[]]],[["Setting",[sr],5,1,!1,!1,null]],[]),ar=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)}}),cr=pe("OcaInt32Actuator",5,"",2,tr,[["GetSetting",5,1,[],[ar,ar,ar]],["SetSetting",5,2,[ar],[]]],[["Setting",[ar],5,1,!1,!1,null]],[]);function lr(){if(!ot)throw new Error("Missing BigInt support")}const ur=a({isConstantLength:!0,encodedLength:function(e){return 8},encodeTo:function(e,t,n){if(lr(),!(n>=at&&n<=it))throw new TypeError("Int64 out of range.");return e.setBigInt64(t,BigInt(n),!1),t+8},decode:function(e,t){lr();const n=e.getBigInt64(t,!1);return n>=Number.MIN_SAFE_INTEGER&&n<=Number.MAX_SAFE_INTEGER?Number(n):n}}),hr=pe("OcaInt64Actuator",5,"",2,tr,[["GetSetting",5,1,[],[ur,ur,ur]],["SetSetting",5,2,[ur],[]]],[["Setting",[ur],5,1,!1,!1,null]],[]),dr=pe("OcaUint8Actuator",5,"",2,tr,[["GetSetting",5,1,[],[J,J,J]],["SetSetting",5,2,[J],[]]],[["Setting",[J],5,1,!1,!1,null]],[]),gr=pe("OcaUint16Actuator",5,"",2,tr,[["GetSetting",5,1,[],[c,c,c]],["SetSetting",5,2,[c],[]]],[["Setting",[c],5,1,!1,!1,null]],[]),fr=pe("OcaUint32Actuator",5,"\b",2,tr,[["GetSetting",5,1,[],[d,d,d]],["SetSetting",5,2,[d],[]]],[["Setting",[d],5,1,!1,!1,null]],[]),pr=pe("OcaUint64Actuator",5,"\t",2,tr,[["GetSetting",5,1,[],[ut,ut,ut]],["SetSetting",5,2,[ut],[]]],[["Setting",[ut],5,1,!1,!1,null]],[]),Sr=pe("OcaFloat32Actuator",5,"\n",2,tr,[["GetSetting",5,1,[],[$t,$t,$t]],["SetSetting",5,2,[$t],[]]],[["Setting",[$t],5,1,!1,!1,null]],[]),mr=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)}}),yr=pe("OcaFloat64Actuator",5,"\v",2,tr,[["GetSetting",5,1,[],[mr,mr,mr]],["SetSetting",5,2,[mr],[]]],[["Setting",[mr],5,1,!1,!1,null]],[]),Or=pe("OcaStringActuator",5,"\f",2,tr,[["GetSetting",5,1,[],[z]],["SetSetting",5,2,[z],[]],["GetMaxLen",5,3,[],[c]]],[["Setting",[z],5,1,!1,!1,null],["MaxLen",[c],5,2,!0,!1,null]],[]);function br(e){return e+7>>3}function wr(e,t,n){const r=new Array(n),o=br(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 Cr=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=br(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)+br(n),wr(e,t,n)]},decodeLength:function(e,t){return t+2+br(e.getUint16(t))}}),Pr=pe("OcaBitstringActuator",5,"\r",2,tr,[["GetNrBits",5,1,[],[c]],["GetBit",5,2,[c],[k]],["SetBit",5,3,[c,k],[]],["GetBitstring",5,4,[],[Cr]],["SetBitstring",5,5,[Cr],[]]],[["Bitstring",[Cr],5,1,!1,!1,null]],[]);class _r extends(G({Unknown:0,Valid:1,Underrange:2,Overrange:3,Error:4})){}const Gr=$(_r),vr=pe("OcaSensor",3,"",2,en,[["GetReadingState",3,1,[],[Gr]]],[["ReadingState",[Gr],3,1,!1,!1,null]],[]),Tr=pe("OcaLevelSensor",4,"",2,vr,[["GetReading",4,1,[],[$t,$t,$t]]],[["Reading",[$t],4,1,!1,!1,null]],[]);class Dr extends(G({VU:1,StandardVU:2,PPM1:3,PPM2:4,LKFS:5,RMS:6,Peak:7,ProprietaryValueBase:128})){}const Ir=$(Dr),Mr=pe("OcaAudioLevelSensor",5,"",2,Tr,[["GetLaw",5,1,[],[Ir]],["SetLaw",5,2,[Ir],[]]],[["Law",[Ir],5,1,!1,!1,null]],[]),Lr=pe("OcaTimeIntervalSensor",4,"",2,vr,[["GetReading",4,1,[],[$t,$t,$t]]],[["Reading",[$t],4,1,!1,!1,null]],[]),Ar=pe("OcaFrequencySensor",4,"",2,vr,[["GetReading",4,1,[],[$t,$t,$t]]],[["Reading",[$t],4,1,!1,!1,null]],[]),Er=pe("OcaTemperatureSensor",4,"",2,vr,[["GetReading",4,1,[],[$t,$t,$t]]],[["Reading",[$t],4,1,!1,!1,null]],[]),kr=pe("OcaIdentificationSensor",4,"",2,vr,[],[],[["Identify",4,1,[]]]),xr=pe("OcaVoltageSensor",4,"",1,vr,[["GetReading",4,1,[],[$t,$t,$t]]],[["Reading",[$t],4,1,!1,!1,null]],[]),Ur=pe("OcaCurrentSensor",4,"\b",1,vr,[["GetReading",4,1,[],[$t,$t,$t]]],[["Reading",[$t],4,1,!1,!1,null]],[]);class Nr{constructor(e,t){this.Magnitude=e,this.Phase=t}}const Rr=l({Magnitude:$t,Phase:$t},Nr),Fr=pe("OcaImpedanceSensor",4,"\t",1,vr,[["GetReading",4,1,[],[Rr,Rr,Rr]]],[["Reading",[Rr],4,1,!1,!1,null]],[]),Br=pe("OcaGainSensor",4,"\n",1,vr,[["GetReading",4,1,[],[$t,$t,$t]]],[["Reading",[$t],4,1,!1,!1,null]],[]),jr=pe("OcaBasicSensor",4,"",2,vr,[],[],[]),Vr=pe("OcaBooleanSensor",5,"",2,jr,[["GetReading",5,1,[],[k]]],[["Reading",[k],5,1,!1,!1,null]],[]),zr=pe("OcaInt8Sensor",5,"",2,jr,[["GetReading",5,1,[],[rr,rr,rr]]],[["Reading",[rr],5,1,!1,!1,null]],[]),qr=pe("OcaInt16Sensor",5,"",2,jr,[["GetReading",5,1,[],[sr,sr,sr]]],[["Reading",[sr],5,1,!1,!1,null]],[]),Hr=pe("OcaInt32Sensor",5,"",2,jr,[["GetReading",5,1,[],[ar,ar,ar]]],[["Reading",[ar],5,1,!1,!1,null]],[]),Wr=pe("OcaInt64Sensor",5,"",2,jr,[["GetReading",5,1,[],[ur,ur,ur]]],[["Reading",[ur],5,1,!1,!1,null]],[]),Kr=pe("OcaUint8Sensor",5,"",2,jr,[["GetReading",5,1,[],[J,J,J]]],[["Reading",[J],5,1,!1,!1,null]],[]),Xr=pe("OcaUint16Sensor",5,"",2,jr,[["GetReading",5,1,[],[c,c,c]]],[["Reading",[c],5,1,!1,!1,null]],[]),Yr=pe("OcaUint32Sensor",5,"\b",2,jr,[["GetReading",5,1,[],[d,d,d]]],[["Reading",[d],5,1,!1,!1,null]],[]),Qr=pe("OcaFloat32Sensor",5,"\n",2,jr,[["GetReading",5,1,[],[$t,$t,$t]]],[["Reading",[$t],5,1,!1,!1,null]],[]),Jr=pe("OcaFloat64Sensor",5,"\v",2,jr,[["GetReading",5,1,[],[mr,mr,mr]]],[["Reading",[mr],5,1,!1,!1,null]],[]),Zr=pe("OcaStringSensor",5,"\f",2,jr,[["GetString",5,1,[],[z]],["GetMaxLen",5,2,[],[c]],["SetMaxLen",5,3,[c],[]]],[["String",[z],5,1,!1,!1,null],["MaxLen",[c],5,2,!1,!1,null]],[]),$r=pe("OcaBitstringSensor",5,"\r",2,jr,[["GetNrBits",5,1,[],[c]],["GetBit",5,2,[c],[J]],["GetBitString",5,3,[],[Cr]]],[["BitString",[Cr],5,1,!1,!1,null]],[]),eo=pe("OcaUint64Sensor",5,"\t",2,jr,[["GetReading",5,1,[],[ut,ut,ut]]],[["Reading",[ut],5,1,!1,!1,null]],[]);class to{constructor(e,t){this.POno=e,this.ClassIdentification=t}}const no=l({POno:d,ClassIdentification:me},to);class ro{constructor(e,t){this.Mode=e,this.Index=t}}const oo=l({Mode:qt,Index:c},ro);class so{constructor(e,t,n){this.Owner=e,this.ProtoID=t,this.Name=n}}const io=l({Owner:d,ProtoID:oo,Name:z},so);class ao{constructor(e,t){this.SourceProtoPort=e,this.SinkProtoPort=t}}const co=l({SourceProtoPort:io,SinkProtoPort:io},ao),lo=pe("OcaBlockFactory",3,"",2,en,[["DefineProtoPort",3,1,[z,qt],[oo]],["UndefineProtoPort",3,2,[oo],[]],["GetProtoPorts",3,3,[],[R(io)]],["DefineProtoMemberUsingFactory",3,5,[d],[d]],["UndefineProtoMember",3,6,[d],[]],["GetProtoMembers",3,7,[],[R(no)]],["DefineProtoSignalPath",3,8,[co],[c]],["UndefineProtoSignalPath",3,9,[],[c]],["GetProtoSignalPaths",3,10,[],[ft(c,co)]],["GetGlobalType",3,11,[],[Nt]],["SetGlobalType",3,12,[Nt],[]]],[["ProtoPorts",[R(io)],3,1,!1,!1,null],["ProtoMembers",[R(no)],3,2,!1,!1,null],["ProtoSignalPaths",[ft(c,co)],3,3,!1,!1,null],["GlobalType",[Nt],3,4,!1,!1,null]],[]);function uo(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)&&!N(e))throw new TypeError("Expected array.");const n=e.length;if(0===n)return 4;if(!Array.isArray(e[0])&&!N(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)&&!N(e))throw new TypeError("Expected array.");const n=e.length;if(0===n)return 4;if(!Array.isArray(e[0])&&!N(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 ho=pe("OcaMatrix",3,"",2,en,[["GetCurrentXY",3,1,[],[c,c]],["SetCurrentXY",3,2,[c,c],[]],["GetSize",3,3,[],[c,c,c,c,c,c]],["SetSize",3,4,[c,c],[]],["GetMembers",3,5,[],[uo(d)]],["SetMembers",3,6,[uo(d)],[]],["GetMember",3,7,[c,c],[d]],["SetMember",3,8,[c,c,d],[]],["GetProxy",3,9,[],[d]],["SetProxy",3,10,[d],[]],["GetPortsPerRow",3,11,[],[J]],["SetPortsPerRow",3,12,[J],[]],["GetPortsPerColumn",3,13,[],[J]],["SetPortsPerColumn",3,14,[J],[]],["SetCurrentXYLock",3,15,[c,c],[]],["UnlockCurrent",3,16,[],[]]],[["X",[c],3,1,!1,!1,null],["Y",[c],3,2,!1,!1,null],["xSize",[c],3,3,!1,!1,null],["ySize",[c],3,4,!1,!1,null],["Members",[uo(d)],3,5,!1,!1,null],["Proxy",[d],3,6,!1,!1,null],["PortsPerRow",[J],3,7,!1,!1,null],["PortsPerColumn",[J],3,8,!1,!1,null]],[]),go=pe("OcaAgent",2,"",2,Pe,[["GetLabel",2,1,[],[z]],["SetLabel",2,2,[z],[]],["GetOwner",2,3,[],[d]],["GetPath",2,4,[],[R(z),R(d)]]],[["Label",[z],2,1,!1,!1,null],["Owner",[d],2,2,!1,!1,null]],[]);class fo{constructor(e,t){this.HostID=e,this.ONo=t}}const po=l({HostID:A,ONo:d},fo);class So{constructor(e,t,n){this.Index=e,this.ObjectPath=t,this.Online=n}}const mo=l({Index:c,ObjectPath:po,Online:k},So);class yo{constructor(e,t){this.GroupIndex=e,this.CitizenIndex=t}}const Oo=l({GroupIndex:c,CitizenIndex:c},yo);class bo{constructor(e,t,n){this.Index=e,this.Name=t,this.ProxyONo=n}}const wo=l({Index:c,Name:z,ProxyONo:d},bo);class Co extends(G({MasterSlave:1,PeerToPeer:2})){}const Po=$(Co);class _o extends(G({citizenAdded:1,citizenDeleted:2,citizenConnectionLost:3,citizenConnectionReEstablished:4,citizenError:5,enrollment:6,unEnrollment:7})){}const Go=$(_o);class vo{constructor(e,t,n){this.groupIndex=e,this.citizenIndex=t,this.changeType=n}}const To=l({groupIndex:c,citizenIndex:c,changeType:Go},vo),Do=pe("OcaGrouper",3,"",2,go,[["AddGroup",3,1,[z],[c,d]],["DeleteGroup",3,2,[c],[]],["GetGroupCount",3,3,[],[c]],["GetGroupList",3,4,[],[R(wo)]],["AddCitizen",3,5,[mo],[c]],["DeleteCitizen",3,6,[c],[]],["GetCitizenCount",3,7,[],[c]],["GetCitizenList",3,8,[],[R(mo)]],["GetEnrollment",3,9,[Oo],[k]],["SetEnrollment",3,10,[Oo,k],[]],["GetGroupMemberList",3,11,[c],[R(mo)]],["GetActuatorOrSensor",3,12,[],[k]],["SetActuatorOrSensor",3,13,[k],[]],["GetMode",3,14,[],[Po]],["SetMode",3,15,[Po],[]]],[["ActuatorOrSensor",[k],3,1,!1,!1,null],["Groups",[R(wo)],3,2,!1,!1,["GroupList"]],["Citizens",[R(mo)],3,3,!1,!1,["CitizenList"]],["Enrollments",[R(Oo)],3,4,!1,!1,["EnrollmentList"]],["Mode",[Po],3,5,!1,!1,null]],[["StatusChange",3,1,[To]]]);class Io 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 Mo=$(Io);class Lo{constructor(e,t,n,r){this.PropertyID=e,this.BaseDataType=t,this.GetterMethodID=n,this.SetterMethodID=r}}const Ao=l({PropertyID:ye,BaseDataType:Mo,GetterMethodID:Ee,SetterMethodID:Ee},Lo);class Eo{constructor(e,t){this.ONo=e,this.Descriptor=t}}const ko=l({ONo:d,Descriptor:Ao},Eo);class xo extends(G({Enable:1,Start:2,Halt:3})){}const Uo=$(xo);class No extends(G({Linear:1,ReverseLinear:2,Sine:3,Exponential:4})){}const Ro=$(No);class Fo extends(G({NotInitialized:1,Iniitialized:2,Scheduled:3,Enabled:4,Ramping:5})){}const Bo=$(Fo),jo=pe("OcaRamper",3,"",2,go,[["Control",3,1,[Uo],[]],["GetState",3,2,[],[Bo]],["GetRampedProperty",3,3,[],[ko]],["SetRampedProperty",3,4,[ko],[]],["GetTimeMode",3,5,[],[St]],["SetTimeMode",3,6,[St],[]],["GetStartTime",3,7,[],[ut]],["SetStartTime",3,8,[ut],[]],["GetDuration",3,9,[],[$t,$t,$t]],["SetDuration",3,10,[$t],[]],["GetInterpolationLaw",3,11,[],[Ro]],["SetInterpolationLaw",3,12,[Ro],[]],["GetGoal",3,13,[],[mr]],["SetGoal",3,14,[mr],[]]],[["State",[Bo],3,1,!1,!1,null],["RampedProperty",[ko],3,2,!1,!1,null],["TimeMode",[St],3,3,!1,!1,null],["StartTime",[ut],3,4,!1,!1,null],["Duration",[$t],3,5,!1,!1,null],["InterpolationLaw",[Ro],3,6,!1,!1,null],["Goal",[mr],3,7,!1,!1,null]],[]);class Vo{constructor(e){this.Reading=e}}const zo=l({Reading:mr},Vo);class qo extends(G({NotTriggered:0,Triggered:1})){}const Ho=$(qo);class Wo extends(G({None:0,Equality:1,Inequality:2,GreaterThan:3,GreaterThanOrEqual:4,LessThan:5,LessThanOrEqual:6})){}const Ko=$(Wo),Xo=pe("OcaNumericObserver",3,"",2,go,[["GetLastObservation",3,1,[],[mr]],["GetState",3,2,[],[Ho]],["GetObservedProperty",3,3,[],[ko]],["SetObservedProperty",3,4,[ko],[]],["GetThreshold",3,5,[],[mr]],["SetThreshold",3,6,[mr],[]],["GetOperator",3,7,[],[Ko]],["SetOperator",3,8,[Ko],[]],["GetTwoWay",3,9,[],[k]],["SetTwoWay",3,10,[k],[]],["GetHysteresis",3,11,[],[mr]],["SetHysteresis",3,12,[mr],[]],["GetPeriod",3,13,[],[$t]],["SetPeriod",3,14,[$t],[]]],[["State",[Ho],3,1,!1,!1,null],["ObservedProperty",[ko],3,2,!1,!1,null],["Threshold",[mr],3,3,!1,!1,null],["Operator",[Ko],3,4,!1,!1,null],["TwoWay",[k],3,5,!1,!1,null],["Hysteresis",[mr],3,6,!1,!1,null],["Period",[$t],3,7,!1,!1,null]],[["Observation",3,1,[zo]]]);class Yo extends(G({None:0,ReadOnly:1,ReadExpand:2,Full:3})){}const Qo=$(Yo);class Jo{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 Zo=l({Name:z,VolType:$e,Access:Qo,Version:d,Creator:z,UpDate:dt},Jo);class $o{constructor(e,t){this.Metadata=e,this.Data=t}}const es=l({Metadata:Zo,Data:A},$o);class ts{constructor(e,t){this.VolumeID=e,this.ChangeType=t}}const ns=l({VolumeID:d,ChangeType:Oe},ts),rs=pe("OcaLibrary",3,"",2,go,[["AddVolume",3,1,[es],[d]],["ReplaceVolume",3,2,[d,es],[]],["DeleteVolume",3,3,[d],[]],["GetVolume",3,4,[d],[es]],["GetVolumeCount",3,5,[],[c]],["GetVolumes",3,6,[],[ft(d,es)]],["GetAccess",3,7,[],[Qo]],["SetAccess",3,8,[Qo],[]]],[["VolumeType",[$e],3,1,!1,!1,null],["Access",[Qo],3,2,!1,!1,null],["Volumes",[ft(d,es)],3,3,!1,!1,null]],[["OcaLibVolChanged",3,1,[ns]]]);class os extends(G({Unspecified:1,Internal:2,External:3})){}const ss=$(os);class is extends(G({Off:0,Unavailable:1,Available:2,Active:3})){}const as=$(is);class cs extends(G({None:0,Mains:1,Battery:2,Phantom:3,Solar:4})){}const ls=$(cs),us=pe("OcaPowerSupply",3,"",3,go,[["GetType",3,1,[],[ls]],["GetModelInfo",3,2,[],[z]],["GetState",3,3,[],[as]],["SetState",3,4,[as],[]],["GetCharging",3,5,[],[k]],["GetLoadFractionAvailable",3,6,[],[$t]],["GetStorageFractionAvailable",3,7,[],[$t]],["GetLocation",3,8,[],[ss]]],[["Type",[ls],3,1,!1,!1,null],["ModelInfo",[z],3,2,!1,!1,null],["State",[as],3,3,!1,!1,null],["Charging",[k],3,4,!1,!1,null],["LoadFractionAvailable",[$t],3,5,!1,!1,null],["StorageFractionAvailable",[$t],3,6,!1,!1,null],["Location",[ss],3,7,!0,!1,null]],[]),hs=pe("OcaEventHandler",3,"\b",2,go,[["OnEvent",3,1,[A,f],[]]],[],[]);class ds{constructor(e){this.Reading=e}}const gs=l({Reading:R(mr)},ds),fs=pe("OcaNumericObserverList",3,"\t",2,go,[["GetLastObservation",3,1,[],[R(mr)]],["GetState",3,2,[],[Ho]],["GetObservedProperties",3,3,[],[R(ko)]],["SetObservedProperties",3,4,[R(ko)],[]],["GetThreshold",3,5,[],[mr]],["SetThreshold",3,6,[mr],[]],["GetOperator",3,7,[],[Ko]],["SetOperator",3,8,[Ko],[]],["GetTwoWay",3,9,[],[k]],["SetTwoWay",3,10,[k],[]],["GetHysteresis",3,11,[],[mr]],["SetHysteresis",3,12,[mr],[]],["GetPeriod",3,13,[],[$t]],["SetPeriod",3,14,[$t],[]]],[["State",[Ho],3,1,!1,!1,null],["ObservedProperties",[R(ko)],3,2,!1,!1,null],["Threshold",[mr],3,3,!1,!1,null],["Operator",[Ko],3,4,!1,!1,null],["TwoWay",[k],3,5,!1,!1,null],["Hysteresis",[mr],3,6,!1,!1,null],["Period",[$t],3,7,!1,!1,null]],[["Observation",3,1,[gs]]]);class ps extends(G({Unavailable:0,Available:1})){}const Ss=$(ps);class ms{constructor(e,t,n,r){this.NominalRate=e,this.PullRange=t,this.Accuracy=n,this.JitterMax=r}}const ys=l({NominalRate:$t,PullRange:$t,Accuracy:$t,JitterMax:$t},ms),Os=pe("OcaMediaClock3",3,"",1,go,[["GetAvailability",3,1,[],[Ss]],["SetAvailability",3,2,[Ss],[]],["GetCurrentRate",3,3,[],[ys,d]],["SetCurrentRate",3,4,[ys,d],[]],["GetOffset",3,5,[],[dt]],["SetOffset",3,6,[dt],[]],["GetSupportedRates",3,7,[],[ft(d,R(ys))]]],[["Availability",[Ss],3,1,!1,!1,null],["TimeSourceONo",[d],3,2,!1,!1,null],["Offset",[dt],3,3,!1,!1,null],["CurrentRate",[ys],3,4,!1,!1,null],["SupportedRates",[ft(d,R(ys))],3,5,!1,!1,null]],[]);class bs 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 ws=$(bs);class Cs extends(G({Undefined:0,Local:1,Private:2,GPS:3,Galileo:4,GLONASS:5})){}const Ps=$(Cs);class _s extends(G({Unavailable:0,Available:1})){}const Gs=$(_s);class vs extends(G({Undefined:0,Unsynchronized:1,Synchronizing:2,Synchronized:3})){}const Ts=$(vs),Ds=pe("OcaTimeSource",3,"",1,go,[["GetAvailability",3,1,[],[Gs]],["GetProtocol",3,2,[],[ws]],["SetProtocol",3,3,[ws],[]],["GetParameters",3,4,[],[z]],["SetParameters",3,5,[z],[]],["GetReferenceType",3,6,[],[Ps]],["SetReferenceType",3,7,[Ps],[]],["GetReferenceID",3,8,[],[z]],["SetReferenceID",3,9,[z],[]],["GetSyncStatus",3,10,[],[Ts]],["Reset",3,11,[],[]]],[["Availability",[Gs],3,1,!1,!1,null],["Protocol",[ws],3,2,!1,!1,null],["Parameters",[z],3,3,!1,!1,null],["ReferenceType",[Ps],3,4,!1,!1,null],["ReferenceID",[z],3,5,!1,!1,null],["SyncStatus",[Ts],3,6,!1,!1,null]],[]);class Is extends(G({Robotic:1,ItuAudioObjectBasedPolar:2,ItuAudioObjectBasedCartesian:3,ItuAudioSceneBasedPolar:4,ItuAudioSceneBasedCartesian:5,NAV:6,ProprietaryBase:128})){}const Ms=$(Is);const Ls=x;class As{constructor(e,t,n){this.CoordinateSystem=e,this.FieldFlags=t,this.Values=n}}const Es=l({CoordinateSystem:Ms,FieldFlags:Ls,Values:(ks=$t,xs=6,be(...new Array(xs).fill(ks)))},As);var ks,xs;const Us=pe("OcaPhysicalPosition",3,"",1,go,[["GetCoordinateSystem",3,1,[],[Ms]],["GetPositionDescriptorFieldFlags",3,2,[],[Ls]],["GetPositionDescriptor",3,3,[],[Es,Es,Es]],["SetPositionDescriptor",3,4,[Es],[]]],[["CoordinateSystem",[Ms],3,1,!0,!1,null],["PositionDescriptorFieldFlags",[Ls],3,2,!0,!1,null],["PositionDescriptor",[Es],3,3,!1,!1,null]],[]);class Ns extends(G({None:0,Prepare:1,Start:2,Pause:3,Stop:4,Reset:5})){}const Rs=$(Ns);class Fs extends(G({Unknown:0,NotReady:1,Readying:2,Ready:3,Running:4,Paused:5,Stopping:6,Stopped:7,Fault:8})){}const Bs=$(Fs);class js{constructor(e,t){this.SystemInterfaceParameters=e,this.MyNetworkAddress=t}}const Vs=l({SystemInterfaceParameters:A,MyNetworkAddress:A},js),zs=pe("OcaApplicationNetwork",2,"",1,Pe,[["GetLabel",2,1,[],[z]],["SetLabel",2,2,[z],[]],["GetOwner",2,3,[],[d]],["GetServiceID",2,4,[],[A]],["SetServiceID",2,5,[A],[]],["GetSystemInterfaces",2,6,[],[R(Vs)]],["SetSystemInterfaces",2,7,[R(Vs)],[]],["GetState",2,8,[],[Bs]],["GetErrorCode",2,9,[],[c]],["Control",2,10,[Rs],[]],["GetPath",2,11,[],[R(z),R(d)]]],[["Label",[z],2,1,!1,!0,null],["Owner",[d],2,2,!1,!0,null],["ServiceID",[A],2,3,!1,!1,null],["SystemInterfaces",[R(Vs)],2,4,!1,!1,null],["State",[Bs],2,5,!1,!1,null],["ErrorCode",[c],2,6,!1,!1,null]],[]);class qs extends(G({None:0,OCP01:1,OCP02:2,OCP03:3})){}const Hs=$(qs),Ws=pe("OcaControlNetwork",3,"",1,zs,[["GetControlProtocol",3,1,[],[Hs]]],[["Protocol",[Hs],3,1,!1,!1,["ControlProtocol"]]],[]);class Ks{constructor(e,t,n){this.CodingSchemeID=e,this.CodecParameters=t,this.ClockONo=n}}const Xs=l({CodingSchemeID:c,CodecParameters:z,ClockONo:d},Ks);class Ys extends(G({None:0,Unicast:1,Multicast:2})){}const Qs=$(Ys);class Js{constructor(e,t,n,r){this.Secure=e,this.StreamParameters=t,this.StreamCastMode=n,this.StreamChannelCount=r}}const Zs=l({Secure:k,StreamParameters:A,StreamCastMode:Qs,StreamChannelCount:c},Js);class $s extends(G({None:0,Start:1,Pause:2})){}const ei=$($s);class ti extends(G({Stopped:0,SettingUp:1,Running:2,Paused:3,Fault:4})){}const ni=$(ti);class ri{constructor(e,t,n){this.ConnectorID=e,this.State=t,this.ErrorCode=n}}const oi=l({ConnectorID:c,State:ni,ErrorCode:c},ri);class si{constructor(e){this.ConnectorStatus=e}}const ii=l({ConnectorStatus:oi},si);function ai(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 ci{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 li=l({IDInternal:c,IDExternal:z,Connection:Zs,AvailableCodings:R(Xs),PinCount:c,ChannelPinMap:ai(c,Wt),AlignmentLevel:$t,AlignmentGain:$t,CurrentCoding:Xs},ci),ui=x;class hi{constructor(e,t,n){this.SinkConnector=e,this.ChangeType=t,this.ChangedElement=n}}const di=l({SinkConnector:li,ChangeType:Oe,ChangedElement:ui},hi);class gi{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 fi=l({IDInternal:c,IDExternal:z,Connection:Zs,AvailableCodings:R(Xs),PinCount:c,ChannelPinMap:ft(c,Wt),AlignmentLevel:$t,CurrentCoding:Xs},gi);class pi{constructor(e,t,n){this.SourceConnector=e,this.ChangeType=t,this.ChangedElement=n}}const Si=l({SourceConnector:fi,ChangeType:Oe,ChangedElement:ui},pi);class mi extends(G({None:0,AV3:1,AVBTP:2,Dante:3,Cobranet:4,AES67:5,SMPTEAudio:6,LiveWire:7,ExtensionPoint:65})){}const yi=$(mi),Oi=pe("OcaMediaTransportNetwork",3,"",1,zs,[["GetMediaProtocol",3,1,[],[yi]],["GetPorts",3,2,[],[R(Xt)]],["GetPortName",3,3,[Wt],[z]],["SetPortName",3,4,[Wt,z],[]],["GetMaxSourceConnectors",3,5,[],[c]],["GetMaxSinkConnectors",3,6,[],[c]],["GetMaxPinsPerConnector",3,7,[],[c]],["GetMaxPortsPerPin",3,8,[],[c]],["GetSourceConnectors",3,9,[],[R(fi)]],["GetSourceConnector",3,10,[c],[fi]],["GetSinkConnectors",3,11,[],[R(li)]],["GetSinkConnector",3,12,[c],[li]],["GetConnectorsStatuses",3,13,[],[R(oi)]],["GetConnectorStatus",3,14,[c],[oi]],["AddSourceConnector",3,15,[fi,ni],[fi]],["AddSinkConnector",3,16,[oi,li],[li]],["ControlConnector",3,17,[c,ei],[]],["SetSourceConnectorPinMap",3,18,[c,ft(c,Wt)],[]],["SetSinkConnectorPinMap",3,19,[c,ai(c,Wt)],[]],["SetConnectorConnection",3,20,[c,Zs],[]],["SetConnectorCoding",3,21,[c,Xs],[]],["SetConnectorAlignmentLevel",3,22,[c,$t],[]],["SetConnectorAlignmentGain",3,23,[c,$t],[]],["DeleteConnector",3,24,[c],[]],["GetAlignmentLevel",3,25,[],[$t,$t,$t]],["GetAlignmentGain",3,26,[],[$t,$t,$t]]],[["Protocol",[yi],3,1,!1,!1,["MediaProtocol"]],["Ports",[R(Xt)],3,2,!1,!1,null],["MaxSourceConnectors",[c],3,3,!1,!1,null],["MaxSinkConnectors",[c],3,4,!1,!1,null],["MaxPinsPerConnector",[c],3,5,!1,!1,null],["MaxPortsPerPin",[c],3,6,!1,!1,null],["AlignmentLevel",[$t],3,7,!1,!1,null],["AlignmentGain",[$t],3,8,!1,!1,null]],[["SourceConnectorChanged",3,1,[Si]],["SinkConnectorChanged",3,2,[di]],["ConnectorStatusChanged",3,3,[ii]]]);class bi extends(G({None:0,Source:1,Sink:2})){}const wi=$(bi);class Ci extends(G({NotConnected:0,Connected:1,Muted:2})){}const Pi=$(Ci),_i=pe("OcaNetworkSignalChannel",3,"",2,en,[["AddToConnector",3,6,[d,c],[]],["GetConnectorPins",3,5,[],[ft(d,c)]],["GetIDAdvertised",3,1,[],[A]],["GetNetwork",3,3,[],[d]],["GetRemoteChannelID",3,8,[],[A]],["GetSourceOrSink",3,10,[],[wi]],["GetStatus",3,11,[],[Pi]],["RemoveFromConnector",3,7,[d],[]],["SetIDAdvertised",3,2,[A],[]],["SetNetwork",3,4,[d],[]],["SetRemoteChannelID",3,9,[A],[]]],[["ConnectorPins",[ft(d,c)],3,3,!1,!1,null],["IDAdvertised",[A],3,1,!1,!1,null],["Network",[d],3,2,!1,!1,null],["RemoteChannelID",[A],3,4,!1,!1,null],["SourceOrSink",[wi],3,5,!1,!1,null],["Status",[Pi],3,6,!1,!1,null]],[]);class Gi extends(G({None:0,EthernetWired:1,EthernetWireless:2,USB:3,SerialP2P:4})){}const vi=$(Gi);class Ti{constructor(e,t){this.rxPacketErrors=e,this.txPacketErrors=t}}const Di=l({rxPacketErrors:d,txPacketErrors:d},Ti);class Ii extends(G({Unknown:0,Ready:1,StartingUp:2,Stopped:3})){}const Mi=$(Ii);class Li{constructor(e,t){this.SystemInterfaceHandle=e,this.MyNetworkAddress=t}}const Ai=l({SystemInterfaceHandle:A,MyNetworkAddress:A},Li),Ei=pe("OcaNetwork",3,"",2,go,[["GetLinkType",3,1,[],[vi]],["GetIDAdvertised",3,2,[],[A]],["SetIDAdvertised",3,3,[A],[]],["GetControlProtocol",3,4,[],[Hs]],["GetMediaProtocol",3,5,[],[yi]],["GetStatus",3,6,[],[Mi]],["GetStatistics",3,7,[],[Di]],["ResetStatistics",3,8,[],[]],["GetSystemInterfaces",3,9,[],[R(Ai)]],["SetSystemInterfaces",3,10,[R(Ai)],[]],["GetMediaPorts",3,11,[],[R(d)]],["Startup",3,12,[],[]],["Shutdown",3,13,[],[]]],[["LinkType",[vi],3,1,!0,!1,null],["IDAdvertised",[A],3,2,!1,!1,null],["ControlProtocol",[Hs],3,3,!1,!1,null],["MediaProtocol",[yi],3,4,!1,!1,null],["Status",[Mi],3,5,!1,!1,null],["SystemInterfaces",[R(Ai)],3,6,!1,!1,null],["MediaPorts",[R(d)],3,7,!1,!1,null],["Statistics",[Di],3,8,!1,!1,null]],[]);class ki extends(G({Undefined:0,Locked:1,Synchronizing:2,FreeRun:3,Stopped:4})){}const xi=$(ki),Ui=pe("OcaMediaClock",3,"",2,go,[["GetType",3,1,[],[Xe]],["SetType",3,2,[Xe],[]],["GetDomainID",3,3,[],[c]],["SetDomainID",3,4,[c],[]],["GetSupportedRates",3,5,[],[R(ys)]],["GetCurrentRate",3,6,[],[ys]],["SetCurrentRate",3,7,[ys],[]],["GetLockState",3,8,[],[xi]]],[["Type",[Xe],3,1,!1,!1,null],["DomainID",[c],3,2,!1,!1,null],["RatesSupported",[R(ys)],3,3,!1,!1,null],["CurrentRate",[ys],3,4,!1,!1,null],["LockState",[xi],3,5,!1,!1,null]],[]),Ni=pe("OcaStreamNetwork",3,"\n",2,go,[["GetLinkType",3,1,[],[vi]],["GetIDAdvertised",3,2,[],[A]],["SetIDAdvertised",3,3,[A],[]],["GetControlProtocol",3,4,[],[Hs]],["GetMediaProtocol",3,5,[],[yi]],["GetStatus",3,6,[],[Mi]],["GetStatistics",3,7,[],[Di]],["ResetStatistics",3,8,[],[]],["GetSystemInterfaces",3,9,[],[R(Ai)]],["SetSystemInterfaces",3,10,[R(Ai)],[]],["GetStreamConnectorsSource",3,11,[],[R(d)]],["SetStreamConnectorsSource",3,12,[R(d)],[]],["GetStreamConnectorsSink",3,13,[],[R(d)]],["SetStreamConnectorsSink",3,14,[R(d)],[]],["GetSignalChannelsSource",3,15,[],[R(d)]],["SetSignalChannelsSource",3,16,[R(d)],[]],["GetSignalChannelsSink",3,17,[],[R(d)]],["SetSignalChannelsSink",3,18,[R(d)],[]],["Startup",3,19,[],[]],["Shutdown",3,20,[],[]]],[["ControlProtocol",[Hs],3,3,!1,!1,null],["IDAdvertised",[A],3,2,!1,!1,null],["LinkType",[vi],3,1,!0,!1,null],["MediaProtocol",[yi],3,4,!1,!1,null],["SignalChannelsSink",[R(d)],3,10,!1,!1,null],["SignalChannelsSource",[R(d)],3,9,!1,!1,null],["Statistics",[Di],3,11,!1,!1,null],["Status",[Mi],3,5,!1,!1,null],["StreamConnectorsSink",[R(d)],3,8,!1,!1,null],["StreamConnectorsSource",[R(d)],3,7,!1,!1,null],["SystemInterfaces",[R(Ai)],3,6,!1,!1,null]],[]);class Ri{constructor(e,t,n,r){this.HostID=e,this.NetworkAddress=t,this.NodeID=n,this.StreamConnectorID=r}}const Fi=l({HostID:A,NetworkAddress:A,NodeID:A,StreamConnectorID:A},Ri);class Bi extends(G({NotConnected:0,Connected:1,Paused:2})){}const ji=$(Bi);class Vi extends(G({None:0,Unicast:1,Multicast:2})){}const zi=$(Vi);class qi{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 Hi=l({ErrorNumber:c,IDAdvertised:A,Index:c,Label:z,LocalConnectorONo:d,Priority:c,RemoteConnectorIdentification:Fi,Secure:k,Status:ji,StreamParameters:A,StreamType:zi},qi);class Wi extends(G({NotAvailable:0,Idle:1,Connected:2,Paused:3})){}const Ki=$(Wi),Xi=pe("OcaStreamConnector",3,"\v",2,go,[["ConnectStream",3,7,[Hi],[c]],["DisconnectStream",3,8,[c],[]],["GetIDAdvertised",3,3,[],[A]],["GetOwnerNetwork",3,1,[],[d]],["GetPins",3,10,[],[ft(c,d)]],["GetSourceOrSink",3,5,[],[wi]],["GetStatus",3,11,[],[Ki]],["GetStreams",3,9,[],[ft(c,Hi)]],["SetIDAdvertised",3,4,[A],[]],["SetOwnerNetwork",3,2,[d],[]],["SetSourceOrSink",3,6,[wi],[]]],[["IDAdvertised",[A],3,2,!1,!1,null],["OwnerNetwork",[d],3,1,!1,!1,null],["Pins",[ft(c,d)],3,5,!1,!1,null],["SourceOrSink",[wi],3,3,!1,!1,null],["Status",[Ki],3,6,!1,!1,null],["Streams",[ft(c,Hi)],3,4,!1,!1,null]],[]);var Yi=Object.freeze({__proto__:null,OcaRoot:Pe,OcaWorker:en,OcaActuator:nn,OcaMute:sn,OcaPolarity:ln,OcaSwitch:un,OcaGain:hn,OcaPanBalance:dn,OcaDelay:gn,OcaDelayExtended:yn,OcaFrequencyActuator:On,OcaFilterClassical:Gn,OcaFilterParametric:Dn,OcaFilterPolynomial:In,OcaFilterFIR:Mn,OcaFilterArbitraryCurve:En,OcaDynamics:Vn,OcaDynamicsDetector:zn,OcaDynamicsCurve:qn,OcaSignalGenerator:Yn,OcaSignalInput:Qn,OcaSignalOutput:Jn,OcaTemperatureActuator:Zn,OcaIdentificationActuator:$n,OcaSummingPoint:er,OcaBasicActuator:tr,OcaBooleanActuator:nr,OcaInt8Actuator:or,OcaInt16Actuator:ir,OcaInt32Actuator:cr,OcaInt64Actuator:hr,OcaUint8Actuator:dr,OcaUint16Actuator:gr,OcaUint32Actuator:fr,OcaUint64Actuator:pr,OcaFloat32Actuator:Sr,OcaFloat64Actuator:yr,OcaStringActuator:Or,OcaBitstringActuator:Pr,OcaSensor:vr,OcaLevelSensor:Tr,OcaAudioLevelSensor:Mr,OcaTimeIntervalSensor:Lr,OcaFrequencySensor:Ar,OcaTemperatureSensor:Er,OcaIdentificationSensor:kr,OcaVoltageSensor:xr,OcaCurrentSensor:Ur,OcaImpedanceSensor:Fr,OcaGainSensor:Br,OcaBasicSensor:jr,OcaBooleanSensor:Vr,OcaInt8Sensor:zr,OcaInt16Sensor:qr,OcaInt32Sensor:Hr,OcaInt64Sensor:Wr,OcaUint8Sensor:Kr,OcaUint16Sensor:Xr,OcaUint32Sensor:Yr,OcaFloat32Sensor:Qr,OcaFloat64Sensor:Jr,OcaStringSensor:Zr,OcaBitstringSensor:$r,OcaUint64Sensor:eo,OcaBlock:tn,OcaBlockFactory:lo,OcaMatrix:ho,OcaAgent:go,OcaGrouper:Do,OcaRamper:jo,OcaNumericObserver:Xo,OcaLibrary:rs,OcaPowerSupply:us,OcaEventHandler:hs,OcaNumericObserverList:fs,OcaMediaClock3:Os,OcaTimeSource:Ds,OcaPhysicalPosition:Us,OcaApplicationNetwork:zs,OcaControlNetwork:Ws,OcaMediaTransportNetwork:Oi,OcaManager:_e,OcaDeviceManager:Ge,OcaSecurityManager:ve,OcaFirmwareManager:Le,OcaSubscriptionManager:Ve,OcaPowerManager:He,OcaNetworkManager:We,OcaMediaClockManager:Ye,OcaLibraryManager:nt,OcaAudioProcessingManager:rt,OcaDeviceTimeManager:gt,OcaTaskManager:It,OcaCodingManager:Mt,OcaDiagnosticManager:Lt,OcaNetworkSignalChannel:_i,OcaNetwork:Ei,OcaMediaClock:Ui,OcaStreamNetwork:Ni,OcaStreamConnector:Xi});const Qi={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 Ji(e){const t=e.EmitterONo,n=e.EventID;return[t,n.DefLevel,n.EventIndex].join(",")}const Zi={ONo:1055,MethodID:{DefLevel:1,MethodIndex:1}};class $i 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(Yi)),t.map(e=>this.add_control_classes(e)),this.DeviceManager=new Ge(Qi.DeviceManager,this),this.SecurityManager=new ve(Qi.SecurityManager,this),this.FirmwareManager=new Le(Qi.FirmwareManager,this),this.SubscriptionManager=new Ve(Qi.SubscriptionManager,this),this.PowerManager=new He(Qi.PowerManager,this),this.NetworkManager=new We(Qi.NetworkManager,this),this.MediaClockManager=new Ye(Qi.MediaClockManager,this),this.LibraryManager=new nt(Qi.LibraryManager,this),this.AudioProcessingManager=new rt(Qi.AudioProcessingManager,this),this.DeviceTimeManager=new gt(Qi.DeviceTimeManager,this),this.TaskManager=new It(Qi.TaskManager,this),this.CodingManager=new Mt(Qi.CodingManager,this),this.DiagnosticManager=new Lt(Qi.DiagnosticManager,this),this.Root=new tn(100,this),this.subscriptions=new Map}close(){this.connection.close()}send_command(e,t,n){return this.connection.send_command(e,t,n)}_doSubscribe(e){return this.SubscriptionManager.AddSubscription(e,Zi,new Uint8Array(0),Ue.Reliable,new Uint8Array(0))}async add_subscription(n,r){const o=Ji(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=Ji(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,Zi))}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(tn.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 ea=Object.values(Yi);class ta extends(G({None:0,ParamSet:1,Patch:2,Program:3})){}class na extends(G({Ampere:4,DegreeCelsius:2,Hertz:1,None:0,Ohm:5,Volt:3})){}var ra=Object.freeze({__proto__:null,OcaApplicationNetworkCommand:Ns,OcaApplicationNetworkState:Fs,OcaBaseDataType:Io,OcaBlockMember:kt,OcaClassAuthorityID:class{constructor(e,t,n){this.Sentinel=e,this.Reserved=t,this.OrganizationID=n}},OcaClassIdentification:Se,OcaClassicalFilterShape:bn,OcaComponent:Te,OcaDBr:kn,OcaDelayUnit:fn,OcaDelayValue:Sn,OcaDeviceState:{Operational:1,Disabled:2,Error:4,Initializing:8,Updating:16},OcaDynamicsFunction:Un,OcaEnumItem:class{constructor(e){this.Value=e}},OcaEnumItem16:class{constructor(e){this.Value=e}},OcaEvent:g,OcaEventID:u,OcaFilterPassband:Cn,OcaGlobalTypeIdentifier:Ut,OcaGrouperCitizen:So,OcaGrouperEnrollment:yo,OcaGrouperGroup:bo,OcaGrouperMode:Co,OcaGrouperStatusChangeEventData:vo,OcaGrouperStatusChangeType:_o,OcaImpedance:Nr,OcaLevelDetectionLaw:Rn,OcaLevelMeterLaw:Dr,OcaLibAccess:Yo,OcaLibParamSetAssignment:class{constructor(e,t){this.ParamSetIdentifier=e,this.TargetBlockONo=t}},OcaLibVol:$o,OcaLibVolChangedEventData:ts,OcaLibVolData_ParamSet:Rt,OcaLibVolIdentifier:Qe,OcaLibVolMetadata:Jo,OcaLibVolStandardTypeID:ta,OcaLibVolType:Ze,OcaLibraryIdentifier:et,OcaManagerDefaultObjectNumbers:Qi,OcaManagerDescriptor:H,OcaMediaClockAvailability:ps,OcaMediaClockLockState:ki,OcaMediaClockRate:ms,OcaMediaClockType:Ke,OcaMediaCoding:Ks,OcaMediaConnection:Js,OcaMediaConnectorCommand:$s,OcaMediaConnectorElement:{PinMap:1,Connection:2,Coding:4,AlignmentLevel:8,AlignmentGain:16},OcaMediaConnectorState:ti,OcaMediaConnectorStatus:ri,OcaMediaConnectorStatusChangedEventData:si,OcaMediaSinkConnector:ci,OcaMediaSinkConnectorChangedEventData:hi,OcaMediaSourceConnector:gi,OcaMediaSourceConnectorChangedEventData:pi,OcaMediaStreamCastMode:Ys,OcaMethod:ke,OcaMethodID:Ae,OcaModelDescription:K,OcaModelGUID:Y,OcaMuteState:rn,OcaNetworkControlProtocol:qs,OcaNetworkLinkType:Gi,OcaNetworkMediaProtocol:mi,OcaNetworkMediaSourceOrSink:bi,OcaNetworkSignalChannelStatus:Ci,OcaNetworkStatistics:Ti,OcaNetworkStatus:Ii,OcaNetworkSystemInterfaceDescriptor:js,OcaNetworkSystemInterfaceID:Li,OcaNotificationDeliveryMode:Ue,OcaOPath:fo,OcaObjectIdentification:At,OcaObjectListEventData:Re,OcaObjectSearchResult:Bt,OcaObjectSearchResultFlags:{ONo:1,ClassIdentification:2,ContainerPath:4,Role:8,Label:16},OcaObservationEventData:Vo,OcaObservationListEventData:ds,OcaObserverState:qo,OcaParametricEQShape:vn,OcaPilotToneDetectorSpec:class{constructor(e,t,n){this.Threshold=e,this.Frequency=t,this.PollInterval=n}},OcaPolarityState:an,OcaPort:Kt,OcaPortID:Ht,OcaPortMode:zt,OcaPositionCoordinateSystem:Is,OcaPositionDescriptor:As,OcaPowerState:ze,OcaPowerSupplyLocation:os,OcaPowerSupplyState:is,OcaPowerSupplyType:cs,OcaPresentationUnit:Bn,OcaProperty:Eo,OcaPropertyChangeType:ie,OcaPropertyDescriptor:Lo,OcaPropertyID:ce,OcaProtoObjectIdentification:to,OcaProtoPort:so,OcaProtoPortID:ro,OcaProtoSignalPath:ao,OcaRamperCommand:xo,OcaRamperInterpolationLaw:No,OcaRamperState:Fo,OcaRelationalOperator:Wo,OcaResetCause:ee,OcaSensorReadingState:_r,OcaSignalPath:Yt,OcaStatus:v,OcaStream:qi,OcaStreamConnectorIdentification:Ri,OcaStreamConnectorStatus:Wi,OcaStreamStatus:Bi,OcaStreamType:Vi,OcaStringComparisonType:Jt,OcaSubscriptionManagerState:Be,OcaSweepType:Hn,OcaTask:mt,OcaTaskCommand:Ot,OcaTaskManagerState:wt,OcaTaskState:Pt,OcaTaskStateChangedEventData:Tt,OcaTaskStatus:Gt,OcaTimeMode:pt,OcaTimePTP:ht,OcaTimeProtocol:bs,OcaTimeReferenceType:Cs,OcaTimeSourceAvailability:_s,OcaTimeSourceSyncStatus:vs,OcaTransferFunction:Ln,OcaUnitOfMeasure:na,OcaVersion:Ie,OcaWaveformType:Kn});class oa extends L{constructor(e,t){super(t),this.ws=e,e.binaryType="arraybuffer",e.addEventListener("message",e=>{try{this.read(e.data)}catch(e){this.emit("error",e)}}),e.addEventListener("close",()=>{this.emit("close")}),e.addEventListener("error",e=>{this.emit("error",e)})}write(e){this.ws.send(e),super.write(e)}static connect(e,t){return new Promise((n,r)=>{const o=new e(t.url),s=function(e){r(e)};o.addEventListener("open",()=>{o.removeEventListener("error",s),n(new this(o,t))}),o.addEventListener("error",s)})}cleanup(){if(super.cleanup(),this.ws){try{this.ws.close()}catch(e){}this.ws=null}}}class sa extends oa{static connect(e){return super.connect(WebSocket,e)}_now(){return performance.now()}}function ia(e){return new Promise(t=>setTimeout(t,e))}const aa={Connection:L,WebSocket:sa,Device:$i,ControlClasses:Yi,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<ea.length;e++)if(ea[e].ClassName===o){o=ea[e];break}}else{const e=n.substr(0,n.length-1);for(let t=0;t<ea.length;t++)if(ea[t].ClassID===e){o=ea[t];break}}if("function"!=typeof o)throw new Error("Unknown parent class.");return pe(e,t,n,r,o,s,i,a)}};var ca=Object.freeze({__proto__:null,Connection:P,controller:aa,ClientConnection:L,Command:s,CommandRrq:i,decodeMessage:O,encodeMessage:w,error:t,log:function(...e){try{console.log(...e)}catch(e){}},KeepAlive:m,Notification:p,Response:S,RemoteDevice:$i,Types:ra,warn:e,WebSocketConnection:sa,RemoteControlClasses:Yi,AbstractUDPConnection:class extends L{constructor(e,t){t.batch>=0||(t.batch=128),super(t),this.socket=e,this.delay=t.delay>=0?t.delay:5,this.retry_interval=t.retry_interval>=0?t.retry_interval:250,this.retry_count=t.retry_count>=0?t.retry_count:3,this._write_out_id=-1,this._write_out_callback=()=>{this._write_out_id=-1,this._write_out()},this._retry_id=this.retry_interval>0?setInterval(()=>this._retryCommands(),this.retry_interval):-1,this.q=[],e.onmessage=e=>{try{this.read(e)}catch(e){console.warn("Failed to parse incoming AES70 packet: %o",e)}null!==this.inbuf&&this.close()},e.onerror=e=>this.error(e),this.set_keepalive_interval(1)}get is_reliable(){return!1}static async connect(e,t){const n=await e.connect(t.host,t.port,t.type);return await async function(e,t){const n=e.receiveMessage().then(e=>{const t=[],n=O(new DataView(e),0,t);if(1!==t.length)throw new Error("Expected keepalive response.");if(n!==e.byteLength)throw new Error("Trailing data in initial keepalive pdu.");return!0}),r=w(new m(1e3)),o=5*(t.retry_interval||250);for(let t=0;t<3;t++)if(e.send(r),await Promise.race([n,ia(o)]))return;throw new Error("Failed to connect.")}(n,t),new this(n,t)}write(e){this.q.push(e),this.tx_idle_time()>=this.delay?this._write_out():this._schedule_write_out()}flush(){super.flush(),this.tx_idle_time()>this.delay&&this._write_out()}cleanup(){super.cleanup(),this.socket&&(this.socket.close(),this.socket=null),-1!==this._write_out_id&&(clearTimeout(this._write_out_id),this._write_out_id=-1),-1!==this._retry_id&&(clearInterval(this._retry_id),this._retry_id=-1)}_estimate_next_tx_time(){return this._now()+(this.delay+2)*this.q.length}_write_out(){if(!this.socket)return;const e=this.q;if(!e.length)return;const t=e.shift();this.socket.send(t),super.write(t),e.length&&this._schedule_write_out()}_schedule_write_out(){const e=this.tx_idle_time(),t=this.delay;e>=t?this._write_out():-1===this._write_out_id&&(this._write_out_id=setTimeout(this._write_out_callback,t-e))}_retryCommands(){const e=this._now(),t=e-this.retry_interval,n=this.retry_interval/this.delay*5-this.q.length,r=this._pendingCommands,o=[],s=[];for(const e of r){const[,r]=e;if(r.lastSent>t)break;r.retries>=this.retry_count?s.push(e):o.length<n&&o.push(e)}if(s.length){const e=new Error("Timeout.");s.forEach(([t,n])=>{r.delete(t),n.reject(e)})}o.forEach(([t,n])=>{r.delete(t),r.set(t,n),this.send(n.command),n.lastSent=e,n.retries++})}}});window.OCA=ca}();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aes70",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "A controller library for the AES70 protocol.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -0,0 +1,5 @@
1
+ import { Tuple } from './Tuple.js';
2
+
3
+ export function FixedLengthArray(Type, Length) {
4
+ return Tuple(...new Array(Length).fill(Type));
5
+ }
@@ -1,6 +1,7 @@
1
1
  /*
2
2
  * This file has been generated.
3
3
  */
4
+ import { FixedLengthArray } from './FixedLengthArray.js';
4
5
  import { OcaFloat32 } from './OcaFloat32.js';
5
6
  import { OcaPositionCoordinateSystem } from './OcaPositionCoordinateSystem.js';
6
7
  import { OcaPositionDescriptorFieldFlags } from './OcaPositionDescriptorFieldFlags.js';
@@ -12,7 +13,7 @@ export const OcaPositionDescriptor = Struct(
12
13
  {
13
14
  CoordinateSystem: OcaPositionCoordinateSystem,
14
15
  FieldFlags: OcaPositionDescriptorFieldFlags,
15
- Values: OcaFloat32,
16
+ Values: FixedLengthArray(OcaFloat32, 6),
16
17
  },
17
18
  type
18
19
  );
package/src/connection.js CHANGED
@@ -102,11 +102,13 @@ export class Connection extends Events
102
102
  this.incoming(ret);
103
103
  } while (pos < buf.byteLength);
104
104
  } catch (e) {
105
- console.error(e);
106
- if (this.is_reliable)
107
- {
108
- console.error("Error when handling incoming data. Closing connection.");
109
- this.close();
105
+ // If this is a reliably connection we close it. If not,
106
+ // we print decoding errors and throw away the packet.
107
+ if (this.is_reliable) {
108
+ this.emit('error', e);
109
+ return;
110
+ } else {
111
+ console.error(e);
110
112
  }
111
113
  }
112
114
 
@@ -19,9 +19,9 @@ import { OcaWorker } from './OcaWorker';
19
19
  * can contain workers. - It can contain agents. - It can contain data networks.
20
20
  * - It can contain application networks. - It has a signal flow topology. We
21
21
  * refer to an object inside a block as a **member** of that block. We refer to
22
- * the block which contains an object as the object's **container.****1**
23
- * Normally, a block contains a set of members that together function as a
24
- * processing unit -- for example, a crossover channel or mixer strip.
22
+ * the block which contains an object as the object's **container.1** Normally,
23
+ * a block contains a set of members that together function as a processing unit
24
+ * -- for example, a crossover channel or mixer strip.
25
25
  * @extends OcaWorker
26
26
  * @class OcaBlock
27
27
  */
@@ -21,9 +21,9 @@ import { OcaWorker } from './OcaWorker.js';
21
21
  * can contain workers. - It can contain agents. - It can contain data networks.
22
22
  * - It can contain application networks. - It has a signal flow topology. We
23
23
  * refer to an object inside a block as a **member** of that block. We refer to
24
- * the block which contains an object as the object's **container.****1**
25
- * Normally, a block contains a set of members that together function as a
26
- * processing unit -- for example, a crossover channel or mixer strip.
24
+ * the block which contains an object as the object's **container.1** Normally,
25
+ * a block contains a set of members that together function as a processing unit
26
+ * -- for example, a crossover channel or mixer strip.
27
27
  * @extends OcaWorker
28
28
  * @class OcaBlock
29
29
  */
@@ -97,11 +97,11 @@ import { OcaAgent } from './OcaAgent';
97
97
  * which aggregate values are computed.
98
98
  *
99
99
  *
100
- * ** ****Scope of the OcaGrouper Class** Many aspects of groupers will vary
101
- * from product to product. **OcaGrouper** is an abstract class that defines
102
- * common concepts and terms for groupers, a canonical control interface, and
103
- * most aspects of membership management . However it but stops short of
104
- * specifying actual semantics. Implementations will need to define (at least):
100
+ * ** Scope of the OcaGrouper Class** Many aspects of groupers will vary from
101
+ * product to product. **OcaGrouper** is an abstract class that defines common
102
+ * concepts and terms for groupers, a canonical control interface, and most
103
+ * aspects of membership management . However it but stops short of specifying
104
+ * actual semantics. Implementations will need to define (at least):
105
105
  *
106
106
  * - Saturation rules
107
107
  *
@@ -94,11 +94,11 @@ import { OcaAgent } from './OcaAgent.js';
94
94
  * which aggregate values are computed.
95
95
  *
96
96
  *
97
- * ** ****Scope of the OcaGrouper Class** Many aspects of groupers will vary
98
- * from product to product. **OcaGrouper** is an abstract class that defines
99
- * common concepts and terms for groupers, a canonical control interface, and
100
- * most aspects of membership management . However it but stops short of
101
- * specifying actual semantics. Implementations will need to define (at least):
97
+ * ** Scope of the OcaGrouper Class** Many aspects of groupers will vary from
98
+ * product to product. **OcaGrouper** is an abstract class that defines common
99
+ * concepts and terms for groupers, a canonical control interface, and most
100
+ * aspects of membership management . However it but stops short of specifying
101
+ * actual semantics. Implementations will need to define (at least):
102
102
  *
103
103
  * - Saturation rules
104
104
  *
@@ -37,15 +37,15 @@ import { OcaWorker } from './OcaWorker';
37
37
  * whose property value is to be changed. 2. Controller calls the matrix proxy's
38
38
  * **Set** method for the target property. This action causes the **OcaMatrix**
39
39
  * instance to: - decode the posted x :sub:`1` and y :sub:`1` values into a list
40
- * of target member ONos, as follows: If x :sub:`1` > 0 and y :sub:`1` > 0, the
41
- * list will be the single ONo of the addressed cell. If x :sub:`1` = 0 and y
42
- * :sub:`1` > 0, the list will be the list of ONos of the cells in row y
43
- * :sub:`1` . If x :sub:`1` > 0 and y :sub:`1` = 0, the list will be the list of
44
- * ONos of the cells in column x :sub:`1`. If x :sub:`1` = 0 and y :sub:`1` = 0,
45
- * the list will be the list of ONos of all cells of the matrix. - call the
46
- * given **Set** method for each target member in the ONo list. - aggregate the
47
- * **OcaResult** from each **Set** call into a consolidated **OcaResult**. -
48
- * unlock the **OcaMatrix** instance.
40
+ * of target member ONos, as follows: If x :sub:`1` ``>`` 0 and y :sub:`1` ``>``
41
+ * 0, the list will be the single ONo of the addressed cell. If x :sub:`1` = 0
42
+ * and y :sub:`1` ``>`` 0, the list will be the list of ONos of the cells in row
43
+ * y :sub:`1` . If x :sub:`1` ``>`` 0 and y :sub:`1` = 0, the list will be the
44
+ * list of ONos of the cells in column x :sub:`1`. If x :sub:`1` = 0 and y
45
+ * :sub:`1` = 0, the list will be the list of ONos of all cells of the matrix. -
46
+ * call the given **Set** method for each target member in the ONo list. -
47
+ * aggregate the **OcaResult** from each **Set** call into a consolidated
48
+ * **OcaResult**. - unlock the **OcaMatrix** instance.
49
49
  * @extends OcaWorker
50
50
  * @class OcaMatrix
51
51
  */
@@ -39,15 +39,15 @@ import { OcaWorker } from './OcaWorker.js';
39
39
  * whose property value is to be changed. 2. Controller calls the matrix proxy's
40
40
  * **Set** method for the target property. This action causes the **OcaMatrix**
41
41
  * instance to: - decode the posted x :sub:`1` and y :sub:`1` values into a list
42
- * of target member ONos, as follows: If x :sub:`1` > 0 and y :sub:`1` > 0, the
43
- * list will be the single ONo of the addressed cell. If x :sub:`1` = 0 and y
44
- * :sub:`1` > 0, the list will be the list of ONos of the cells in row y
45
- * :sub:`1` . If x :sub:`1` > 0 and y :sub:`1` = 0, the list will be the list of
46
- * ONos of the cells in column x :sub:`1`. If x :sub:`1` = 0 and y :sub:`1` = 0,
47
- * the list will be the list of ONos of all cells of the matrix. - call the
48
- * given **Set** method for each target member in the ONo list. - aggregate the
49
- * **OcaResult** from each **Set** call into a consolidated **OcaResult**. -
50
- * unlock the **OcaMatrix** instance.
42
+ * of target member ONos, as follows: If x :sub:`1` ``>`` 0 and y :sub:`1` ``>``
43
+ * 0, the list will be the single ONo of the addressed cell. If x :sub:`1` = 0
44
+ * and y :sub:`1` ``>`` 0, the list will be the list of ONos of the cells in row
45
+ * y :sub:`1` . If x :sub:`1` ``>`` 0 and y :sub:`1` = 0, the list will be the
46
+ * list of ONos of the cells in column x :sub:`1`. If x :sub:`1` = 0 and y
47
+ * :sub:`1` = 0, the list will be the list of ONos of all cells of the matrix. -
48
+ * call the given **Set** method for each target member in the ONo list. -
49
+ * aggregate the **OcaResult** from each **Set** call into a consolidated
50
+ * **OcaResult**. - unlock the **OcaMatrix** instance.
51
51
  * @extends OcaWorker
52
52
  * @class OcaMatrix
53
53
  */
@@ -12,11 +12,11 @@ function delay(n) {
12
12
  async function waitForKeepalive(socket, options) {
13
13
  const waiter = socket.receiveMessage().then((buffer) => {
14
14
  const pdus = [];
15
- let pos = 0;
16
-
17
- pos = decodeMessage(new DataView(buffer), 0, pdus);
15
+ const pos = decodeMessage(new DataView(buffer), 0, pdus);
18
16
 
19
17
  if (pdus.length !== 1) throw new Error('Expected keepalive response.');
18
+ if (pos !== buffer.byteLength)
19
+ throw new Error('Trailing data in initial keepalive pdu.');
20
20
 
21
21
  return true;
22
22
  });
@@ -1,11 +1,11 @@
1
1
  /* eslint-env node */
2
2
 
3
3
  import { createSocket } from 'dgram';
4
- import { isIPv4, isIPv6 } from 'net';
4
+ import { isIP } from 'net';
5
5
  import { lookup } from 'dns';
6
6
 
7
7
  function lookup_address(host) {
8
- if (isIPv4(host)) return Promise.resolve(host);
8
+ if (isIP(host)) return Promise.resolve(host);
9
9
 
10
10
  return new Promise((resolve, reject) => {
11
11
  lookup(host, { family: 4 }, (err, address) => {
@@ -0,0 +1,17 @@
1
+ import {
2
+ WebSocketConnectionBase,
3
+ IWebSocketConnectionBaseOptions,
4
+ } from './websocket_connection_base';
5
+
6
+ export type WebSocketConnectionOptions = IWebSocketConnectionBaseOptions;
7
+
8
+ export class WebSocketConnection extends WebSocketConnectionBase {
9
+ constructor(ws: WebSocket, options: WebSocketConnectionOptions);
10
+ static connectWebSocket(
11
+ WebSocket: typeof WebSocket,
12
+ options: WebSocketConnectionOptions
13
+ ): Promise<WebSocket>;
14
+ static connect(
15
+ options: WebSocketConnectionOptions
16
+ ): Promise<WebSocketConnection>;
17
+ }
@@ -1,30 +1,9 @@
1
- import { ClientConnection } from './client_connection.js';
1
+ import { WebSocketConnectionBase } from './websocket_connection_base.js';
2
2
 
3
3
  /**
4
- * :class:`ClientConnection` subclass which implements OCP.1 with WebSocket
5
- * transport.
4
+ * Connection which implements OCP.1 with WebSocket transport.
6
5
  */
7
- export class WebSocketConnection extends ClientConnection {
8
- constructor(ws, options) {
9
- super(options);
10
- this.ws = ws;
11
- ws.binaryType = 'arraybuffer';
12
- ws.addEventListener('message', (ev) => {
13
- this.read(ev.data);
14
- });
15
- ws.addEventListener('close', () => {
16
- this.emit('close');
17
- });
18
- ws.addEventListener('error', () => {
19
- this.emit('error');
20
- });
21
- }
22
-
23
- write(buf) {
24
- this.ws.send(buf);
25
- super.write(buf);
26
- }
27
-
6
+ export class WebSocketConnection extends WebSocketConnectionBase {
28
7
  /**
29
8
  * Connect to the given endpoint.
30
9
  *
@@ -35,28 +14,7 @@ export class WebSocketConnection extends ClientConnection {
35
14
  * The connection.
36
15
  */
37
16
  static connect(options) {
38
- return new Promise((resolve, reject) => {
39
- const ws = new WebSocket(options.url);
40
- const on_error = function (e) {
41
- reject(e);
42
- };
43
-
44
- ws.addEventListener('open', () => {
45
- ws.removeEventListener('error', on_error);
46
- resolve(new this(ws, options));
47
- });
48
- ws.addEventListener('error', on_error);
49
- });
50
- }
51
-
52
- cleanup() {
53
- super.cleanup();
54
- if (this.ws) {
55
- try {
56
- this.ws.close();
57
- } catch (err) {}
58
- this.ws = null;
59
- }
17
+ return super.connect(WebSocket, options);
60
18
  }
61
19
 
62
20
  _now() {
@@ -0,0 +1,18 @@
1
+ import {
2
+ IClientConnectionOptions,
3
+ ClientConnection,
4
+ } from './client_connection';
5
+
6
+ export interface IWebSocketConnectionBaseOptions
7
+ extends IClientConnectionOptions {
8
+ url: string;
9
+ }
10
+
11
+ /**
12
+ * :class:`ClientConnection` subclass which implements OCP.1 with WebSocket
13
+ * transport. This is a generic base class used both by NodeJS and in the
14
+ * Browser.
15
+ */
16
+ export class WebSocketConnectionBase extends ClientConnection {
17
+ write(buf: ArrayBuffer): void;
18
+ }
@@ -0,0 +1,70 @@
1
+ import { ClientConnection } from './client_connection.js';
2
+
3
+ /**
4
+ * :class:`ClientConnection` subclass which implements OCP.1 with WebSocket
5
+ * transport. This is a generic base class used both by NodeJS and in the
6
+ * Browser.
7
+ */
8
+ export class WebSocketConnectionBase extends ClientConnection {
9
+ constructor(ws, options) {
10
+ super(options);
11
+ this.ws = ws;
12
+ ws.binaryType = 'arraybuffer';
13
+ ws.addEventListener('message', (ev) => {
14
+ try {
15
+ this.read(ev.data);
16
+ } catch (e) {
17
+ this.emit('error', e);
18
+ }
19
+ });
20
+ ws.addEventListener('close', () => {
21
+ this.emit('close');
22
+ });
23
+ ws.addEventListener('error', (e) => {
24
+ this.emit('error', e);
25
+ });
26
+ }
27
+
28
+ write(buf) {
29
+ this.ws.send(buf);
30
+ super.write(buf);
31
+ }
32
+
33
+ /**
34
+ * Connect to the given endpoint.
35
+ *
36
+ * @param {Function} WebSocket
37
+ * WebSocket implementation.
38
+ * @param {object} options
39
+ * @param {String} options.url
40
+ * Endpoint WebSocket url.
41
+ * @returns {Promise<WebSocket>}
42
+ * The connection.
43
+ */
44
+ static connect(WebSocket, options) {
45
+ return new Promise((resolve, reject) => {
46
+ const ws = new WebSocket(options.url);
47
+ const on_error = function (e) {
48
+ reject(e);
49
+ };
50
+
51
+ ws.addEventListener('open', () => {
52
+ ws.removeEventListener('error', on_error);
53
+ resolve(new this(ws, options));
54
+ });
55
+ ws.addEventListener('error', on_error);
56
+ });
57
+ }
58
+
59
+ cleanup() {
60
+ super.cleanup();
61
+ if (this.ws) {
62
+ try {
63
+ this.ws.close();
64
+ } catch (err) {
65
+ // ignore error
66
+ }
67
+ this.ws = null;
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,18 @@
1
+ import {
2
+ WebSocketConnectionBase,
3
+ IWebSocketConnectionBaseOptions,
4
+ } from './websocket_connection_base';
5
+ import WebSocket from 'ws';
6
+
7
+ export type WebSocketConnectionOptions = IWebSocketConnectionBaseOptions;
8
+
9
+ export class WebSocketConnection extends WebSocketConnectionBase {
10
+ constructor(ws: WebSocket, options: WebSocketConnectionOptions);
11
+ static connectWebSocket(
12
+ WebSocket: typeof WebSocket,
13
+ options: WebSocketConnectionOptions
14
+ ): Promise<WebSocket>;
15
+ static connect(
16
+ options: WebSocketConnectionOptions
17
+ ): Promise<WebSocketConnection>;
18
+ }
@@ -2,64 +2,20 @@
2
2
 
3
3
  import WebSocket from 'ws';
4
4
  import { performance } from 'perf_hooks';
5
-
6
- import { ClientConnection } from './client_connection.js';
5
+ import { WebSocketConnectionBase } from './websocket_connection_base.js';
7
6
 
8
7
  /**
9
- * :class:`ClientConnection` subclass which implements OCP.1 with WebSocket
10
- * transport.
8
+ * Connection which implements OCP.1 with WebSocket transport.
11
9
  */
12
- export class WebSocketConnection extends ClientConnection {
13
- constructor(ws, options) {
14
- super(options);
15
- this.ws = ws;
16
- ws.binaryType = 'arraybuffer';
17
- ws.addEventListener('message', (ev) => {
18
- this.read(ev.data);
19
- });
20
- ws.addEventListener('close', () => {
21
- this.emit('close');
22
- });
23
- ws.addEventListener('error', () => {
24
- this.emit('error');
25
- });
26
- }
27
-
28
- write(buf) {
29
- this.ws.send(buf);
30
- super.write(buf);
31
- }
32
-
10
+ export class WebSocketConnection extends WebSocketConnectionBase {
33
11
  /**
34
12
  * Connect to the given endpoint.
35
13
  *
36
14
  * @param {String} options.url - Endpoint WebSocket url.
37
15
  * @returns {Promise<WebSocketConnection>} - The connection.
38
16
  */
39
- static connect(options) {
40
- return new Promise((resolve, reject) => {
41
- const ws = new WebSocket(options.url);
42
- const on_error = function (e) {
43
- reject(e);
44
- };
45
-
46
- ws.addEventListener('open', () => {
47
- ws.removeEventListener('error', on_error);
48
- resolve(new this(ws, options));
49
- });
50
- ws.addEventListener('error', on_error);
51
- });
52
- }
53
-
54
- cleanup() {
55
- super.cleanup();
56
- if (this.ws) {
57
- try {
58
- this.ws.close();
59
- } catch (err) {}
60
- this.ws.removeAllListeners();
61
- this.ws = null;
62
- }
17
+ static async connect(options) {
18
+ return super.connect(WebSocket, options);
63
19
  }
64
20
 
65
21
  _now() {
@@ -34,11 +34,6 @@ export declare const OcaDeviceState: {
34
34
  * Entry with value ``16``.
35
35
  */
36
36
  Updating: number;
37
-
38
- /**
39
- * Entry with value ``32``.
40
- */
41
- unused: number;
42
37
  };
43
38
 
44
39
  export declare type IOcaDeviceState = number;
@@ -15,7 +15,6 @@ export const OcaDeviceState = {
15
15
  Error: 4,
16
16
  Initializing: 8,
17
17
  Updating: 16,
18
- unused: 32,
19
18
  };
20
19
 
21
20
  /**
@@ -53,10 +52,3 @@ export const OcaDeviceState = {
53
52
  * @memberof OcaDeviceState
54
53
  * @static
55
54
  */
56
- /**
57
- * Entry with value ``32``.
58
- * @type {number}
59
- * @member unused
60
- * @memberof OcaDeviceState
61
- * @static
62
- */
@@ -31,11 +31,6 @@ export declare const OcaObjectSearchResultFlags: {
31
31
  * Entry with value ``16``.
32
32
  */
33
33
  Label: number;
34
-
35
- /**
36
- * Entry with value ``32``.
37
- */
38
- unused: number;
39
34
  };
40
35
 
41
36
  export declare type IOcaObjectSearchResultFlags = number;
@@ -12,7 +12,6 @@ export const OcaObjectSearchResultFlags = {
12
12
  ContainerPath: 4,
13
13
  Role: 8,
14
14
  Label: 16,
15
- unused: 32,
16
15
  };
17
16
 
18
17
  /**
@@ -50,10 +49,3 @@ export const OcaObjectSearchResultFlags = {
50
49
  * @memberof OcaObjectSearchResultFlags
51
50
  * @static
52
51
  */
53
- /**
54
- * Entry with value ``32``.
55
- * @type {number}
56
- * @member unused
57
- * @memberof OcaObjectSearchResultFlags
58
- * @static
59
- */
@@ -8,6 +8,6 @@
8
8
  * @enum {number}
9
9
  * @readonly
10
10
  */
11
- export declare const OcaParameterMask: {};
11
+ export declare const OcaParameterMask: Record<string, never>;
12
12
 
13
13
  export declare type IOcaParameterMask = number;
@@ -25,9 +25,9 @@ export declare interface IOcaPositionDescriptor {
25
25
 
26
26
  /**
27
27
  * The coordinates
28
- * @type number
28
+ * @type number[]
29
29
  */
30
- Values: number;
30
+ Values: number[];
31
31
  }
32
32
 
33
33
  export declare class OcaPositionDescriptor implements IOcaPositionDescriptor {
@@ -72,7 +72,7 @@ export declare class OcaPositionDescriptor implements IOcaPositionDescriptor {
72
72
  constructor(
73
73
  CoordinateSystem: OcaPositionCoordinateSystem,
74
74
  FieldFlags: OcaPositionDescriptorFieldFlags,
75
- Values: number
75
+ Values: number[]
76
76
  );
77
77
 
78
78
  /**
@@ -89,7 +89,7 @@ export declare class OcaPositionDescriptor implements IOcaPositionDescriptor {
89
89
 
90
90
  /**
91
91
  * The coordinates
92
- * @type number
92
+ * @type number[]
93
93
  */
94
- Values: number;
94
+ Values: number[];
95
95
  }
@@ -54,7 +54,7 @@ export class OcaPositionDescriptor {
54
54
  this.FieldFlags = FieldFlags;
55
55
  /**
56
56
  * The coordinates
57
- * @type number
57
+ * @type number[]
58
58
  */
59
59
  this.Values = Values;
60
60
  }
@@ -8,6 +8,6 @@
8
8
  * @enum {number}
9
9
  * @readonly
10
10
  */
11
- export declare const OcaPositionDescriptorFieldFlags: {};
11
+ export declare const OcaPositionDescriptorFieldFlags: Record<string, never>;
12
12
 
13
13
  export declare type IOcaPositionDescriptorFieldFlags = number;
@@ -10,9 +10,9 @@
10
10
  * AND ** TargetProperty** has been set to a valid value; AND ** Goal** has
11
11
  * been set; AND ** Duration** has been set.
12
12
  *
13
- * - A ramper becomes **Scheduled** when It is **Initialized**; AND
14
- * **T****start** and **TimeMode** have been set; AND (T :sub:`start` +
15
- * **Duration**) is in the future.
13
+ * - A ramper becomes **Scheduled** when It is **Initialized**; AND **Tstart**
14
+ * and **TimeMode** have been set; AND (T :sub:`start` + **Duration**) is in
15
+ * the future.
16
16
  *
17
17
  * - A ramper becomes **Enabled** when it is **Scheduled** AND receives an
18
18
  * *Enable* command.
@@ -12,9 +12,9 @@ import { Enum } from './Enum.js';
12
12
  * AND ** TargetProperty** has been set to a valid value; AND ** Goal** has
13
13
  * been set; AND ** Duration** has been set.
14
14
  *
15
- * - A ramper becomes **Scheduled** when It is **Initialized**; AND
16
- * **T****start** and **TimeMode** have been set; AND (T :sub:`start` +
17
- * **Duration**) is in the future.
15
+ * - A ramper becomes **Scheduled** when It is **Initialized**; AND **Tstart**
16
+ * and **TimeMode** have been set; AND (T :sub:`start` + **Duration**) is in
17
+ * the future.
18
18
  *
19
19
  * - A ramper becomes **Enabled** when it is **Scheduled** AND receives an
20
20
  * *Enable* command.