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