@placeos/ts-client 4.5.0 → 4.6.0
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/dist/api.d.ts +2 -0
- package/dist/assets/assets.class.d.ts +62 -0
- package/dist/assets/functions.d.ts +146 -0
- package/dist/assets/types.d.ts +1 -0
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +2150 -1873
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/api.ts +32 -0
- package/src/assets/assets.class.ts +123 -0
- package/src/assets/functions.ts +435 -0
- package/src/assets/types.ts +0 -0
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var bn=function(t,e){return bn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},bn(t,e)};function G(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");bn(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var Ze=function(){return Ze=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Ze.apply(this,arguments)};function Vi(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function Yi(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function u(_){try{l(r.next(_))}catch(m){o(m)}}function c(_){try{l(r.throw(_))}catch(m){o(m)}}function l(_){_.done?s(_.value):i(_.value).then(u,c)}l((r=r.apply(t,e||[])).next())})}function dr(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=u(0),o.throw=u(1),o.return=u(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(l){return function(_){return c([l,_])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(n=0)),n;)try{if(r=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,i=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){n.label=l[1];break}if(l[0]===6&&n.label<s[1]){n.label=s[1],s=l;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(l);break}s[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(_){l=[6,_],i=0}finally{r=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function qe(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Et(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(u){o={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return s}function It(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}function Me(t){return this instanceof Me?(this.v=t,this):new Me(t)}function Ji(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(a){return function(f){return Promise.resolve(f).then(a,m)}}function u(a,f){r[a]&&(i[a]=function(h){return new Promise(function(S,g){s.push([a,h,S,g])>1||c(a,h)})},f&&(i[a]=f(i[a])))}function c(a,f){try{l(r[a](f))}catch(h){p(s[0][3],h)}}function l(a){a.value instanceof Me?Promise.resolve(a.value.v).then(_,m):p(s[0][2],a)}function _(a){c("next",a)}function m(a){c("throw",a)}function p(a,f){a(f),s.shift(),s.length&&c(s[0][0],s[0][1])}}function Ki(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof qe=="function"?qe(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(o){return new Promise(function(u,c){o=t[s](o),i(u,c,o.done,o.value)})}}function i(s,o,u,c){Promise.resolve(c).then(function(l){s({value:l,done:u})},o)}}function R(t){return typeof t=="function"}function pr(t){var e=function(r){Error.call(r),r.stack=new Error().stack},n=t(e);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var mn=pr(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
|
|
2
2
|
`+n.map(function(r,i){return i+1+") "+r.toString()}).join(`
|
|
3
|
-
`):"",this.name="UnsubscriptionError",this.errors=n}});function Pt(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var be=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,r,i,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var u=Ie(s),c=u.next();!c.done;c=u.next()){var l=c.value;l.remove(this)}}catch(h){e={error:h}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(e)throw e.error}}else s.remove(this);var m=this.initialTeardown;if(R(m))try{m()}catch(h){o=h instanceof cn?h.errors:[h]}var _=this._finalizers;if(_){this._finalizers=null;try{for(var p=Ie(_),a=p.next();!a.done;a=p.next()){var f=a.value;try{zn(f)}catch(h){o=o??[],h instanceof cn?o=wt(wt([],At(o)),At(h.errors)):o.push(h)}}}catch(h){r={error:h}}finally{try{a&&!a.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}}if(o)throw new cn(o)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)zn(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}},t.prototype._hasParent=function(e){var n=this._parentage;return n===e||Array.isArray(n)&&n.includes(e)},t.prototype._addParent=function(e){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e},t.prototype._removeParent=function(e){var n=this._parentage;n===e?this._parentage=null:Array.isArray(n)&&Pt(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&Pt(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),ur=be.EMPTY;function cr(t){return t instanceof be||t&&"closed"in t&&R(t.remove)&&R(t.add)&&R(t.unsubscribe)}function zn(t){R(t)?t():t.unsubscribe()}var ji={Promise:void 0},Li={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,wt([t,e],At(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function ar(t){Li.setTimeout(function(){throw t})}function Bn(){}function St(t){t()}var Ut=function(t){G(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,cr(n)&&n.add(r)):r.destination=Bi,r}return e.create=function(n,r,i){return new dn(n,r,i)},e.prototype.next=function(n){this.isStopped||this._next(n)},e.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(n){this.destination.next(n)},e.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(be),Hi=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(r){vt(r)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(r){vt(r)}else vt(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){vt(n)}},t}(),dn=function(t){G(e,t);function e(n,r,i){var o=t.call(this)||this,s;return R(n)||!n?s={next:n??void 0,error:r??void 0,complete:i??void 0}:s=n,o.destination=new Hi(s),o}return e}(Ut);function vt(t){ar(t)}function zi(t){throw t}var Bi={closed:!0,next:Bn,error:zi,complete:Bn},gn=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function vn(t){return t}function Wi(t){return t.length===0?vn:t.length===1?t[0]:function(n){return t.reduce(function(r,i){return i(r)},n)}}var D=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(e,n,r){var i=this,o=Zi(e)?e:new dn(e,n,r);return St(function(){var s=i,u=s.operator,c=s.source;o.add(u?u.call(o,c):c?i._subscribe(o):i._trySubscribe(o))}),o},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},t.prototype.forEach=function(e,n){var r=this;return n=Wn(n),new n(function(i,o){var s=new dn({next:function(u){try{e(u)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});r.subscribe(s)})},t.prototype._subscribe=function(e){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(e)},t.prototype[gn]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return Wi(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=Wn(e),new e(function(r,i){var o;n.subscribe(function(s){return o=s},function(s){return i(s)},function(){return r(o)})})},t.create=function(e){return new t(e)},t}();function Wn(t){var e;return(e=t??ji.Promise)!==null&&e!==void 0?e:Promise}function Qi(t){return t&&R(t.next)&&R(t.error)&&R(t.complete)}function Zi(t){return t&&t instanceof Ut||Qi(t)&&cr(t)}function Vi(t){return R(t?.lift)}function re(t){return function(e){if(Vi(e))return e.lift(function(n){try{return t(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function K(t,e,n,r,i){return new Ki(t,e,n,r,i)}var Ki=function(t){G(e,t);function e(n,r,i,o,s,u){var c=t.call(this,n)||this;return c.onFinalize=s,c.shouldUnsubscribe=u,c._next=r?function(l){try{r(l)}catch(m){n.error(m)}}:t.prototype._next,c._error=o?function(l){try{o(l)}catch(m){n.error(m)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=i?function(){try{i()}catch(l){n.error(l)}finally{this.unsubscribe()}}:t.prototype._complete,c}return e.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},e}(Ut),Yi=sr(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),ge=function(t){G(e,t);function e(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return e.prototype.lift=function(n){var r=new pn(this,this);return r.operator=n,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new Yi},e.prototype.next=function(n){var r=this;St(function(){var i,o;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var s=Ie(r.currentObservers),u=s.next();!u.done;u=s.next()){var c=u.value;c.next(n)}}catch(l){i={error:l}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})},e.prototype.error=function(n){var r=this;St(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var i=r.observers;i.length;)i.shift().error(n)}})},e.prototype.complete=function(){var n=this;St(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},e.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},e.prototype._innerSubscribe=function(n){var r=this,i=this,o=i.hasError,s=i.isStopped,u=i.observers;return o||s?ur:(this.currentObservers=null,u.push(n),new be(function(){r.currentObservers=null,Pt(u,n)}))},e.prototype._checkFinalizedStatuses=function(n){var r=this,i=r.hasError,o=r.thrownError,s=r.isStopped;i?n.error(o):s&&n.complete()},e.prototype.asObservable=function(){var n=new D;return n.source=this,n},e.create=function(n,r){return new pn(n,r)},e}(D),pn=function(t){G(e,t);function e(n,r){var i=t.call(this)||this;return i.destination=n,i.source=r,i}return e.prototype.next=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.next)===null||i===void 0||i.call(r,n)},e.prototype.error=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.error)===null||i===void 0||i.call(r,n)},e.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},e.prototype._subscribe=function(n){var r,i;return(i=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&i!==void 0?i:ur},e}(ge),he=function(t){G(e,t);function e(n){var r=t.call(this)||this;return r._value=n,r}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(n){var r=t.prototype._subscribe.call(this,n);return!r.closed&&n.next(this._value),r},e.prototype.getValue=function(){var n=this,r=n.hasError,i=n.thrownError,o=n._value;if(r)throw i;return this._throwIfClosed(),o},e.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},e}(ge),bn={now:function(){return(bn.delegate||Date).now()},delegate:void 0},an=function(t){G(e,t);function e(n,r,i){n===void 0&&(n=1/0),r===void 0&&(r=1/0),i===void 0&&(i=bn);var o=t.call(this)||this;return o._bufferSize=n,o._windowTime=r,o._timestampProvider=i,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=r===1/0,o._bufferSize=Math.max(1,n),o._windowTime=Math.max(1,r),o}return e.prototype.next=function(n){var r=this,i=r.isStopped,o=r._buffer,s=r._infiniteTimeWindow,u=r._timestampProvider,c=r._windowTime;i||(o.push(n),!s&&o.push(u.now()+c)),this._trimBuffer(),t.prototype.next.call(this,n)},e.prototype._subscribe=function(n){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(n),i=this,o=i._infiniteTimeWindow,s=i._buffer,u=s.slice(),c=0;c<u.length&&!n.closed;c+=o?1:2)n.next(u[c]);return this._checkFinalizedStatuses(n),r},e.prototype._trimBuffer=function(){var n=this,r=n._bufferSize,i=n._timestampProvider,o=n._buffer,s=n._infiniteTimeWindow,u=(s?1:2)*r;if(r<1/0&&u<o.length&&o.splice(0,o.length-u),!s){for(var c=i.now(),l=0,m=1;m<o.length&&o[m]<=c;m+=2)l=m;l&&o.splice(0,l+1)}},e}(ge),Ji=function(t){G(e,t);function e(n,r){return t.call(this)||this}return e.prototype.schedule=function(n,r){return this},e}(be),Qn={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,wt([t,e],At(n)))},clearInterval:function(t){return clearInterval(t)},delegate:void 0},Gi=function(t){G(e,t);function e(n,r){var i=t.call(this,n,r)||this;return i.scheduler=n,i.work=r,i.pending=!1,i}return e.prototype.schedule=function(n,r){var i;if(r===void 0&&(r=0),this.closed)return this;this.state=n;var o=this.id,s=this.scheduler;return o!=null&&(this.id=this.recycleAsyncId(s,o,r)),this.pending=!0,this.delay=r,this.id=(i=this.id)!==null&&i!==void 0?i:this.requestAsyncId(s,this.id,r),this},e.prototype.requestAsyncId=function(n,r,i){return i===void 0&&(i=0),Qn.setInterval(n.flush.bind(n,this),i)},e.prototype.recycleAsyncId=function(n,r,i){if(i===void 0&&(i=0),i!=null&&this.delay===i&&this.pending===!1)return r;r!=null&&Qn.clearInterval(r)},e.prototype.execute=function(n,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var i=this._execute(n,r);if(i)return i;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(n,r){var i=!1,o;try{this.work(n)}catch(s){i=!0,o=s||new Error("Scheduled action threw falsy error")}if(i)return this.unsubscribe(),o},e.prototype.unsubscribe=function(){if(!this.closed){var n=this,r=n.id,i=n.scheduler,o=i.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Pt(o,this),r!=null&&(this.id=this.recycleAsyncId(i,r,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(Ji),Zn=function(){function t(e,n){n===void 0&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(e,n,r){return n===void 0&&(n=0),new this.schedulerActionCtor(this,e).schedule(r,n)},t.now=bn.now,t}(),Xi=function(t){G(e,t);function e(n,r){r===void 0&&(r=Zn.now);var i=t.call(this,n,r)||this;return i.actions=[],i._active=!1,i}return e.prototype.flush=function(n){var r=this.actions;if(this._active){r.push(n);return}var i;this._active=!0;do if(i=n.execute(n.state,n.delay))break;while(n=r.shift());if(this._active=!1,i){for(;n=r.shift();)n.unsubscribe();throw i}},e}(Zn),lr=new Xi(Gi),eo=lr,to=new D(function(t){return t.complete()});function no(t){return t&&R(t.schedule)}var hr=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function fr(t){return R(t?.then)}function dr(t){return R(t[gn])}function pr(t){return Symbol.asyncIterator&&R(t?.[Symbol.asyncIterator])}function mr(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function ro(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var _r=ro();function yr(t){return R(t?.[_r])}function gr(t){return Ni(this,arguments,function(){var n,r,i,o;return or(this,function(s){switch(s.label){case 0:n=t.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Te(n.read())];case 3:return r=s.sent(),i=r.value,o=r.done,o?[4,Te(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Te(i)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function vr(t){return R(t?.getReader)}function ie(t){if(t instanceof D)return t;if(t!=null){if(dr(t))return io(t);if(hr(t))return oo(t);if(fr(t))return so(t);if(pr(t))return br(t);if(yr(t))return uo(t);if(vr(t))return co(t)}throw mr(t)}function io(t){return new D(function(e){var n=t[gn]();if(R(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function oo(t){return new D(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function so(t){return new D(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,ar)})}function uo(t){return new D(function(e){var n,r;try{for(var i=Ie(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(u){n={error:u}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()})}function br(t){return new D(function(e){ao(t,e).catch(function(n){return e.error(n)})})}function co(t){return br(gr(t))}function ao(t,e){var n,r,i,o;return Ci(this,void 0,void 0,function(){var s,u;return or(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=Fi(t),c.label=1;case 1:return[4,n.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(s=r.value,e.next(s),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=c.sent(),i={error:u},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function _e(t,e,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var o=e.schedule(function(){n(),i?t.add(this.schedule(null,r)):this.unsubscribe()},r);if(t.add(o),!i)return o}function Sr(t,e){return e===void 0&&(e=0),re(function(n,r){n.subscribe(K(r,function(i){return _e(r,t,function(){return r.next(i)},e)},function(){return _e(r,t,function(){return r.complete()},e)},function(i){return _e(r,t,function(){return r.error(i)},e)}))})}function kr(t,e){return e===void 0&&(e=0),re(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function lo(t,e){return ie(t).pipe(kr(e),Sr(e))}function ho(t,e){return ie(t).pipe(kr(e),Sr(e))}function fo(t,e){return new D(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function po(t,e){return new D(function(n){var r;return _e(n,e,function(){r=t[_r](),_e(n,e,function(){var i,o,s;try{i=r.next(),o=i.value,s=i.done}catch(u){n.error(u);return}s?n.complete():n.next(o)},0,!0)}),function(){return R(r?.return)&&r.return()}})}function xr(t,e){if(!t)throw new Error("Iterable cannot be null");return new D(function(n){_e(n,e,function(){var r=t[Symbol.asyncIterator]();_e(n,e,function(){r.next().then(function(i){i.done?n.complete():n.next(i.value)})},0,!0)})})}function mo(t,e){return xr(gr(t),e)}function _o(t,e){if(t!=null){if(dr(t))return lo(t,e);if(hr(t))return fo(t,e);if(fr(t))return ho(t,e);if(pr(t))return xr(t,e);if(yr(t))return po(t,e);if(vr(t))return mo(t,e)}throw mr(t)}function yo(t,e){return e?_o(t,e):ie(t)}function $r(t,e){var n=R(t)?t:function(){return t},r=function(i){return i.error(n())};return new D(r)}function go(t){return t instanceof Date&&!isNaN(t)}function O(t,e){return re(function(n,r){var i=0;n.subscribe(K(r,function(o){r.next(t.call(e,o,i++))}))})}function vo(t,e,n,r,i,o,s,u){var c=[],l=0,m=0,_=!1,p=function(){_&&!c.length&&!l&&e.complete()},a=function(h){return l<r?f(h):c.push(h)},f=function(h){l++;var S=!1;ie(n(h,m++)).subscribe(K(e,function(g){e.next(g)},function(){S=!0},void 0,function(){if(S)try{l--;for(var g=function(){var k=c.shift();s||f(k)};c.length&&l<r;)g();p()}catch(k){e.error(k)}}))};return t.subscribe(K(e,a,function(){_=!0,p()})),function(){}}function Ar(t,e,n){return n===void 0&&(n=1/0),R(e)?Ar(function(r,i){return O(function(o,s){return e(r,o,i,s)})(ie(t(r,i)))},n):(typeof e=="number"&&(n=e),re(function(r,i){return vo(r,i,t,n)}))}function wr(t,e,n){t===void 0&&(t=0),n===void 0&&(n=eo);var r=-1;return e!=null&&(no(e)?n=e:r=e),new D(function(i){var o=go(t)?+t-n.now():t;o<0&&(o=0);var s=0;return n.schedule(function(){i.closed||(i.next(s++),0<=r?this.schedule(void 0,r):i.complete())},o)})}function bo(t,e){return re(function(n,r){var i=0;n.subscribe(K(r,function(o){return t.call(e,o,i++)&&r.next(o)}))})}function Pr(t){return t<=0?function(){return to}:re(function(e,n){var r=0;e.subscribe(K(n,function(i){++r<=t&&(n.next(i),t<=r&&n.complete())}))})}function So(t){return O(function(){return t})}function ko(t,e){return Ar(function(n,r){return ie(t(n,r)).pipe(Pr(1),So(n))})}function xo(t,e){e===void 0&&(e=lr);var n=wr(t,e);return ko(function(){return n})}function $o(t,e){return e===void 0&&(e=vn),t=t??Ao,re(function(n,r){var i,o=!0;n.subscribe(K(r,function(s){var u=e(s);(o||!t(i,u))&&(o=!1,i=u,r.next(s))}))})}function Ao(t,e){return t===e}function wo(t){t===void 0&&(t=1/0);var e;t&&typeof t=="object"?e=t:e={count:t};var n=e.count,r=n===void 0?1/0:n,i=e.delay,o=e.resetOnSuccess,s=o===void 0?!1:o;return r<=0?vn:re(function(u,c){var l=0,m,_=function(){var p=!1;m=u.subscribe(K(c,function(a){s&&(l=0),c.next(a)},void 0,function(a){if(l++<r){var f=function(){m?(m.unsubscribe(),m=null,_()):p=!0};if(i!=null){var h=typeof i=="number"?wr(i):ie(i(a,l)),S=K(c,function(){S.unsubscribe(),f()},function(){c.complete()});h.subscribe(S)}else f()}else c.error(a)})),p&&(m.unsubscribe(),m=null,_())};_()})}function Vn(t,e){return re(function(n,r){var i=null,o=0,s=!1,u=function(){return s&&!i&&r.complete()};n.subscribe(K(r,function(c){i?.unsubscribe();var l=0,m=o++;ie(t(c,m)).subscribe(i=K(r,function(_){return r.next(e?e(c,_,m,l++):_)},function(){i=null,u()}))},function(){s=!0,u()}))})}function Sn(t,e){e===void 0&&(e={});var n=e.selector,r=Ui(e,["selector"]);return new D(function(i){var o=new AbortController,s=o.signal,u=!0,c=r.signal;if(c)if(c.aborted)o.abort();else{var l=function(){s.aborted||o.abort()};c.addEventListener("abort",l),i.add(function(){return c.removeEventListener("abort",l)})}var m=Be(Be({},r),{signal:s}),_=function(p){u=!1,i.error(p)};return fetch(t,m).then(function(p){n?ie(n(p)).subscribe(K(i,void 0,function(){u=!1,i.complete()},_)):(u=!1,i.next(p),i.complete())}).catch(_),function(){u&&o.abort()}})}const te=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"],Kn=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];function bt(t){if(t>=Kn.length)throw new Error("Unable to parse base64 string.");const e=Kn[t];if(e===255)throw new Error("Unable to parse base64 string.");return e}function Tr(t){let e="",n,r=t.length;for(n=2;n<r;n+=3)e+=te[t[n-2]>>2],e+=te[(t[n-2]&3)<<4|t[n-1]>>4],e+=te[(t[n-1]&15)<<2|t[n]>>6],e+=te[t[n]&63];return n===r+1&&(e+=te[t[n-2]>>2],e+=te[(t[n-2]&3)<<4],e+="=="),n===r&&(e+=te[t[n-2]>>2],e+=te[(t[n-2]&3)<<4|t[n-1]>>4],e+=te[(t[n-1]&15)<<2],e+="="),e}function Po(t){if(t.length%4!==0)throw new Error("Unable to parse base64 string.");const e=t.indexOf("=");if(e!==-1&&e<t.length-2)throw new Error("Unable to parse base64 string.");let n=t.endsWith("==")?2:t.endsWith("=")?1:0,r=t.length,i=new Uint8Array(3*(r/4)),o;for(let s=0,u=0;s<r;s+=4,u+=3)o=bt(t.charCodeAt(s))<<18|bt(t.charCodeAt(s+1))<<12|bt(t.charCodeAt(s+2))<<6|bt(t.charCodeAt(s+3)),i[u]=o>>16,i[u+1]=o>>8&255,i[u+2]=o&255;return i.subarray(0,i.length-n)}function To(t,e=new TextEncoder){return Tr(e.encode(t))}var kt={exports:{}},Oo=kt.exports,Yn;function Eo(){return Yn||(Yn=1,function(t){(function(e,n){var r={};n(r);var i=r.default;for(var o in r)i[o]=r[o];t.exports=i})(Oo,function(e){e.__esModule=!0,e.digestLength=32,e.blockSize=64;var n=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function r(p,a,f,h,S){for(var g,k,x,B,U,T,ee,C,j,N,Le,He,gt;S>=64;){for(g=a[0],k=a[1],x=a[2],B=a[3],U=a[4],T=a[5],ee=a[6],C=a[7],N=0;N<16;N++)Le=h+N*4,p[N]=(f[Le]&255)<<24|(f[Le+1]&255)<<16|(f[Le+2]&255)<<8|f[Le+3]&255;for(N=16;N<64;N++)j=p[N-2],He=(j>>>17|j<<15)^(j>>>19|j<<13)^j>>>10,j=p[N-15],gt=(j>>>7|j<<25)^(j>>>18|j<<14)^j>>>3,p[N]=(He+p[N-7]|0)+(gt+p[N-16]|0);for(N=0;N<64;N++)He=(((U>>>6|U<<26)^(U>>>11|U<<21)^(U>>>25|U<<7))+(U&T^~U&ee)|0)+(C+(n[N]+p[N]|0)|0)|0,gt=((g>>>2|g<<30)^(g>>>13|g<<19)^(g>>>22|g<<10))+(g&k^g&x^k&x)|0,C=ee,ee=T,T=U,U=B+He|0,B=x,x=k,k=g,g=He+gt|0;a[0]+=g,a[1]+=k,a[2]+=x,a[3]+=B,a[4]+=U,a[5]+=T,a[6]+=ee,a[7]+=C,h+=64,S-=64}return h}var i=function(){function p(){this.digestLength=e.digestLength,this.blockSize=e.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return p.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},p.prototype.clean=function(){for(var a=0;a<this.buffer.length;a++)this.buffer[a]=0;for(var a=0;a<this.temp.length;a++)this.temp[a]=0;this.reset()},p.prototype.update=function(a,f){if(f===void 0&&(f=a.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var h=0;if(this.bytesHashed+=f,this.bufferLength>0){for(;this.bufferLength<64&&f>0;)this.buffer[this.bufferLength++]=a[h++],f--;this.bufferLength===64&&(r(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(f>=64&&(h=r(this.temp,this.state,a,h,f),f%=64);f>0;)this.buffer[this.bufferLength++]=a[h++],f--;return this},p.prototype.finish=function(a){if(!this.finished){var f=this.bytesHashed,h=this.bufferLength,S=f/536870912|0,g=f<<3,k=f%64<56?64:128;this.buffer[h]=128;for(var x=h+1;x<k-8;x++)this.buffer[x]=0;this.buffer[k-8]=S>>>24&255,this.buffer[k-7]=S>>>16&255,this.buffer[k-6]=S>>>8&255,this.buffer[k-5]=S>>>0&255,this.buffer[k-4]=g>>>24&255,this.buffer[k-3]=g>>>16&255,this.buffer[k-2]=g>>>8&255,this.buffer[k-1]=g>>>0&255,r(this.temp,this.state,this.buffer,0,k),this.finished=!0}for(var x=0;x<8;x++)a[x*4+0]=this.state[x]>>>24&255,a[x*4+1]=this.state[x]>>>16&255,a[x*4+2]=this.state[x]>>>8&255,a[x*4+3]=this.state[x]>>>0&255;return this},p.prototype.digest=function(){var a=new Uint8Array(this.digestLength);return this.finish(a),a},p.prototype._saveState=function(a){for(var f=0;f<this.state.length;f++)a[f]=this.state[f]},p.prototype._restoreState=function(a,f){for(var h=0;h<this.state.length;h++)this.state[h]=a[h];this.bytesHashed=f,this.finished=!1,this.bufferLength=0},p}();e.Hash=i;var o=function(){function p(a){this.inner=new i,this.outer=new i,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var f=new Uint8Array(this.blockSize);if(a.length>this.blockSize)new i().update(a).finish(f).clean();else for(var h=0;h<a.length;h++)f[h]=a[h];for(var h=0;h<f.length;h++)f[h]^=54;this.inner.update(f);for(var h=0;h<f.length;h++)f[h]^=106;this.outer.update(f),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var h=0;h<f.length;h++)f[h]=0}return p.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},p.prototype.clean=function(){for(var a=0;a<this.istate.length;a++)this.ostate[a]=this.istate[a]=0;this.inner.clean(),this.outer.clean()},p.prototype.update=function(a){return this.inner.update(a),this},p.prototype.finish=function(a){return this.outer.finished?this.outer.finish(a):(this.inner.finish(a),this.outer.update(a,this.digestLength).finish(a)),this},p.prototype.digest=function(){var a=new Uint8Array(this.digestLength);return this.finish(a),a},p}();e.HMAC=o;function s(p){var a=new i().update(p),f=a.digest();return a.clean(),f}e.hash=s,e.default=s;function u(p,a){var f=new o(p).update(a),h=f.digest();return f.clean(),h}e.hmac=u;function c(p,a,f,h){var S=h[0];if(S===0)throw new Error("hkdf: cannot expand more");a.reset(),S>1&&a.update(p),f&&a.update(f),a.update(h),a.finish(p),h[0]++}var l=new Uint8Array(e.digestLength);function m(p,a,f,h){a===void 0&&(a=l),h===void 0&&(h=32);for(var S=new Uint8Array([1]),g=u(a,p),k=new o(g),x=new Uint8Array(k.digestLength),B=x.length,U=new Uint8Array(h),T=0;T<h;T++)B===x.length&&(c(x,k,f,S),B=0),U[T]=x[B++];return k.clean(),x.fill(0),S.fill(0),U}e.hkdf=m;function _(p,a,f,h){for(var S=new o(p),g=S.digestLength,k=new Uint8Array(4),x=new Uint8Array(g),B=new Uint8Array(g),U=new Uint8Array(h),T=0;T*g<h;T++){var ee=T+1;k[0]=ee>>>24&255,k[1]=ee>>>16&255,k[2]=ee>>>8&255,k[3]=ee>>>0&255,S.reset(),S.update(a),S.update(k),S.finish(B);for(var C=0;C<g;C++)x[C]=B[C];for(var C=2;C<=f;C++){S.reset(),S.update(B).finish(B);for(var j=0;j<g;j++)x[j]^=B[j]}for(var C=0;C<g&&T*g+C<h;C++)U[T*g+C]=x[C]}for(var T=0;T<g;T++)x[T]=B[T]=0;for(var T=0;T<4;T++)k[T]=0;return S.clean(),U}e.pbkdf2=_})}(kt)),kt.exports}var Io=Eo();const Mo=new Int32Array(4);class W{static hashStr(e,n=!1){return this.onePassHasher.start().appendStr(e).end(n)}static hashAsciiStr(e,n=!1){return this.onePassHasher.start().appendAsciiStr(e).end(n)}static stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]);static buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);static hexChars="0123456789abcdef";static hexOut=[];static onePassHasher=new W;static _hex(e){const n=W.hexChars,r=W.hexOut;let i,o,s,u;for(u=0;u<4;u+=1)for(o=u*8,i=e[u],s=0;s<8;s+=2)r[o+1+s]=n.charAt(i&15),i>>>=4,r[o+0+s]=n.charAt(i&15),i>>>=4;return r.join("")}static _md5cycle(e,n){let r=e[0],i=e[1],o=e[2],s=e[3];r+=(i&o|~i&s)+n[0]-680876936|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&o)+n[1]-389564586|0,s=(s<<12|s>>>20)+r|0,o+=(s&r|~s&i)+n[2]+606105819|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&r)+n[3]-1044525330|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&s)+n[4]-176418897|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&o)+n[5]+1200080426|0,s=(s<<12|s>>>20)+r|0,o+=(s&r|~s&i)+n[6]-1473231341|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&r)+n[7]-45705983|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&s)+n[8]+1770035416|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&o)+n[9]-1958414417|0,s=(s<<12|s>>>20)+r|0,o+=(s&r|~s&i)+n[10]-42063|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&r)+n[11]-1990404162|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&s)+n[12]+1804603682|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&o)+n[13]-40341101|0,s=(s<<12|s>>>20)+r|0,o+=(s&r|~s&i)+n[14]-1502002290|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&r)+n[15]+1236535329|0,i=(i<<22|i>>>10)+o|0,r+=(i&s|o&~s)+n[1]-165796510|0,r=(r<<5|r>>>27)+i|0,s+=(r&o|i&~o)+n[6]-1069501632|0,s=(s<<9|s>>>23)+r|0,o+=(s&i|r&~i)+n[11]+643717713|0,o=(o<<14|o>>>18)+s|0,i+=(o&r|s&~r)+n[0]-373897302|0,i=(i<<20|i>>>12)+o|0,r+=(i&s|o&~s)+n[5]-701558691|0,r=(r<<5|r>>>27)+i|0,s+=(r&o|i&~o)+n[10]+38016083|0,s=(s<<9|s>>>23)+r|0,o+=(s&i|r&~i)+n[15]-660478335|0,o=(o<<14|o>>>18)+s|0,i+=(o&r|s&~r)+n[4]-405537848|0,i=(i<<20|i>>>12)+o|0,r+=(i&s|o&~s)+n[9]+568446438|0,r=(r<<5|r>>>27)+i|0,s+=(r&o|i&~o)+n[14]-1019803690|0,s=(s<<9|s>>>23)+r|0,o+=(s&i|r&~i)+n[3]-187363961|0,o=(o<<14|o>>>18)+s|0,i+=(o&r|s&~r)+n[8]+1163531501|0,i=(i<<20|i>>>12)+o|0,r+=(i&s|o&~s)+n[13]-1444681467|0,r=(r<<5|r>>>27)+i|0,s+=(r&o|i&~o)+n[2]-51403784|0,s=(s<<9|s>>>23)+r|0,o+=(s&i|r&~i)+n[7]+1735328473|0,o=(o<<14|o>>>18)+s|0,i+=(o&r|s&~r)+n[12]-1926607734|0,i=(i<<20|i>>>12)+o|0,r+=(i^o^s)+n[5]-378558|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^o)+n[8]-2022574463|0,s=(s<<11|s>>>21)+r|0,o+=(s^r^i)+n[11]+1839030562|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^r)+n[14]-35309556|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^s)+n[1]-1530992060|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^o)+n[4]+1272893353|0,s=(s<<11|s>>>21)+r|0,o+=(s^r^i)+n[7]-155497632|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^r)+n[10]-1094730640|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^s)+n[13]+681279174|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^o)+n[0]-358537222|0,s=(s<<11|s>>>21)+r|0,o+=(s^r^i)+n[3]-722521979|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^r)+n[6]+76029189|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^s)+n[9]-640364487|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^o)+n[12]-421815835|0,s=(s<<11|s>>>21)+r|0,o+=(s^r^i)+n[15]+530742520|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^r)+n[2]-995338651|0,i=(i<<23|i>>>9)+o|0,r+=(o^(i|~s))+n[0]-198630844|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~o))+n[7]+1126891415|0,s=(s<<10|s>>>22)+r|0,o+=(r^(s|~i))+n[14]-1416354905|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~r))+n[5]-57434055|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~s))+n[12]+1700485571|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~o))+n[3]-1894986606|0,s=(s<<10|s>>>22)+r|0,o+=(r^(s|~i))+n[10]-1051523|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~r))+n[1]-2054922799|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~s))+n[8]+1873313359|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~o))+n[15]-30611744|0,s=(s<<10|s>>>22)+r|0,o+=(r^(s|~i))+n[6]-1560198380|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~r))+n[13]+1309151649|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~s))+n[4]-145523070|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~o))+n[11]-1120210379|0,s=(s<<10|s>>>22)+r|0,o+=(r^(s|~i))+n[2]+718787259|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~r))+n[9]-343485551|0,i=(i<<21|i>>>11)+o|0,e[0]=r+e[0]|0,e[1]=i+e[1]|0,e[2]=o+e[2]|0,e[3]=s+e[3]|0}_dataLength=0;_bufferLength=0;_state=new Int32Array(4);_buffer=new ArrayBuffer(68);_buffer8;_buffer32;constructor(){this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(W.stateIdentity),this}appendStr(e){const n=this._buffer8,r=this._buffer32;let i=this._bufferLength,o,s;for(s=0;s<e.length;s+=1){if(o=e.charCodeAt(s),o<128)n[i++]=o;else if(o<2048)n[i++]=(o>>>6)+192,n[i++]=o&63|128;else if(o<55296||o>56319)n[i++]=(o>>>12)+224,n[i++]=o>>>6&63|128,n[i++]=o&63|128;else{if(o=(o-55296)*1024+(e.charCodeAt(++s)-56320)+65536,o>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");n[i++]=(o>>>18)+240,n[i++]=o>>>12&63|128,n[i++]=o>>>6&63|128,n[i++]=o&63|128}i>=64&&(this._dataLength+=64,W._md5cycle(this._state,r),i-=64,r[0]=r[16])}return this._bufferLength=i,this}appendAsciiStr(e){const n=this._buffer8,r=this._buffer32;let i=this._bufferLength,o,s=0;for(;;){for(o=Math.min(e.length-s,64-i);o--;)n[i++]=e.charCodeAt(s++);if(i<64)break;this._dataLength+=64,W._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}appendByteArray(e){const n=this._buffer8,r=this._buffer32;let i=this._bufferLength,o,s=0;for(;;){for(o=Math.min(e.length-s,64-i);o--;)n[i++]=e[s++];if(i<64)break;this._dataLength+=64,W._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}getState(){const e=this._state;return{buffer:String.fromCharCode.apply(null,Array.from(this._buffer8)),buflen:this._bufferLength,length:this._dataLength,state:[e[0],e[1],e[2],e[3]]}}setState(e){const n=e.buffer,r=e.state,i=this._state;let o;for(this._dataLength=e.length,this._bufferLength=e.buflen,i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],o=0;o<n.length;o+=1)this._buffer8[o]=n.charCodeAt(o)}end(e=!1){const n=this._bufferLength,r=this._buffer8,i=this._buffer32,o=(n>>2)+1;this._dataLength+=n;const s=this._dataLength*8;if(r[n]=128,r[n+1]=r[n+2]=r[n+3]=0,i.set(W.buffer32Identity.subarray(o),o),n>55&&(W._md5cycle(this._state,i),i.set(W.buffer32Identity)),s<=4294967295)i[14]=s;else{const u=s.toString(16).match(/(.*?)(.{0,8})$/);if(u===null)return e?Mo:"";const c=parseInt(u[2],16),l=parseInt(u[1],16)||0;i[14]=c,i[15]=l}return W._md5cycle(this._state,i),e?this._state:W._hex(this._state)}}if(W.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592")throw new Error("Md5 self test failed.");const Ro=36e5,Jn=Symbol.for("constructDateFrom");function Tt(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&Jn in t?t[Jn](e):t instanceof Date?new t.constructor(e):new Date(e)}function We(t,e){return Tt(t,t)}function Do(t,e,n){const r=We(t);if(isNaN(e))return Tt(t,NaN);const i=r.getDate(),o=Tt(t,r.getTime());o.setMonth(r.getMonth()+e+1,0);const s=o.getDate();return i>=s?o:(r.setFullYear(o.getFullYear(),o.getMonth(),i),r)}function Or(t,e,n){return Tt(t,+We(t)+e)}function qo(t,e,n){return Or(t,e*Ro)}function Uo(t,e,n){return Or(t,e*1e3)}function Co(t,e,n){return Do(t,e*12)}function Gn(t){return Math.trunc(+We(t)/1e3)}function No(t,e){return+We(t)<+We(e)}function d(t,e,n,r="debug",i){if(window.debug){const s=["color: #0288D1",`color:${i||"#009688"}`,"color: default"];n?mn()?console[r](`%c[PlaceOS]%c[${t}] %c${e}`,...s,n):console[r](`[PlaceOS][${t}] ${e}`,n):mn()?console[r](`%c[PlaceOS]%c[${t}] %c${e}`,...s):console[r](`[PlaceOS][${t}] ${e}`)}}function mn(){return!(document.documentMode||/Edge/.test(navigator.userAgent))}function kn(){const t=window.location?.hash?window.location?.hash.slice(1):window.location?.href.split("#")[1]||"";let e=window.location?.search?window.location?.search.slice(1):window.location?.href.split("?")[1]||"",n={};if(t)if(t.indexOf("?")>=0){const i=t.split("?");n=Oe(i[0]),e||(e=i[1])}else n=Oe(t);let r={};return e&&(r=Oe(e)),{...n,...r}}function Oe(t){const e={},n=t.split("&");for(const r of n){const i=r.split("=");i[1]&&(e[decodeURIComponent(i[0])]=decodeURIComponent(i[1]))}return e}const Xn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function Er(t=40){let e="";for(let n=0;n<t;n++)e+=Xn.charAt(Math.floor(Math.random()*Xn.length));return e}function ae(t){const e=(window.location?.hash||"").replace(new RegExp(`${t}[a-zA-Z0-9_+-.%=]*&?`,"g"),"").replace(/&&/g,"&").replace(/#&/g,"#").replace(/&$/g,"#"),n=(window.location?.search||"").replace(new RegExp(`${t}[a-zA-Z0-9_+-.%=]*&?`,"g"),"").replace(/&&/g,"&").replace(/\?&/g,"#").replace(/&$/g,"#");window.history?.replaceState&&window.history?.replaceState(null,"",`${window.location?.pathname}${e}${n}`)}function Qe(t,e=!1){const n=e?1e3:1024;if(t<n)return t+(e?" iB":" B");const r=Math.floor(Math.log(t)/Math.log(n)),i=(e?"kMGTPE":"KMGTPE").charAt(r-1)+(e?"iB":"B");return(t/Math.pow(n,r)).toFixed(2)+" "+i}function Ir(t){if(t.length===0)throw new Error("Input must not be of zero length");const e=t.split(","),n={};for(const r of e){const i=r.split(";");if(i.length!==2)throw new Error("Section could not be split on ';'");const o=i[0].replace(/<(.*)>/,"$1").trim(),s=i[1].replace(/rel="(.*)"/,"$1").trim();n[s]=o}return n}function Mr(t,e){for(const n in t)t.hasOwnProperty(n)&&e.indexOf(t[n])>=0&&delete t[n];return t}function Rr(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Dr(){return window.location!==window.parent.location}function qr(t=Date.now(),e=60*1e3){return Math.floor(t/e)}class Fo{abort(){d("Stub","Aborted")}}function H(t){let e="";if(t)for(const n in t)t.hasOwnProperty(n)&&t[n]!==void 0&&t[n]!==null&&(e+=`${e?"&":""}${n}=${encodeURIComponent(t[n])}`);return e}const ye={},ze={},ce={};function jo(){for(const t in ye)ye.hasOwnProperty(t)&&Se(t);for(const t in ze)ze.hasOwnProperty(t)&&Lo(t);for(const t in ce)ce.hasOwnProperty(t)&&Ho(t)}function ne(t,e,n=300){if(t&&e&&e instanceof Function)Se(t),ye[t]=setTimeout(()=>{e(),delete ye[t]},n);else throw new Error(t?"Cannot create named timeout without a name":"Cannot create a timeout without a callback")}function Se(t){ye[t]&&(clearTimeout(ye[t]),delete ye[t])}function Lo(t){ze[t]&&(clearInterval(ze[t]),delete ze[t])}function Ho(t){ce&&ce[t]&&(ce[t]instanceof be?ce[t].unsubscribe():ce[t](),delete ce[t])}const zo={id:"mock-authority",name:"localhost:4200",description:"",domain:"localhost:4200",login_url:"/login?continue={{url}}",logout_url:"/logout",session:!0,production:!1,config:{},version:"2.0.0"};let v={},w,L;const b={};let P="",ve="";const Me=new he(""),Ct=new he("");let xn="/api/engine/v2";const le=new he(!1),Bo=le.asObservable();let Ot=0;function fe(){return`${`${v.secure||window.location?.protocol.indexOf("https")>=0?"https:":"http:"}//${v.host||window.location?.host}`}${$n()}`}function $n(){return v.version==="ACA Engine"?"/control/api":xn}function Wo(){return!!v.token_header}function Ur(){return P}function Qo(){return v.redirect_uri}function Zo(t,e=!0){w.setItem(`${P}_x-api-key`,`${t}`),w.setItem("trusted",`${e}`),Cr("x-api-key",Co(new Date,5).valueOf())}function Ke(){return Mt("x-api-key",!1)||""}function Cr(t,e=qo(new Date,2).valueOf()){v.ignore_api_key&&t==="x-api-key"||(w.setItem(`${P}_expires_at`,`${e}`),w.setItem(`${P}_access_token`,t))}function Z(t=!0){if(v.mock)return"mock-token";if(!w)return"";if(Ke()&&!v.ignore_api_key)return"x-api-key";const e=w.getItem(`${P}_expires_at`)||"",n=Me.getValue();return No(+e,new Date)&&(d("Auth","Token expired. Requesting new token..."),jt(),b.load_authority||(Ot+=1,ne("re-authorise",()=>Pn().catch(r=>d("Auth",`Failed to get token: ${r}`)),200*Math.min(20,Ot))),!t)?"":n||w.getItem(`${P}_access_token`)||""}function Et(){return Ct.getValue()||w.getItem(`${P}_refresh_token`)||""}function It(){return v.host||window.location?.host}function Nr(){return!!Z()}function Fr(){return Me.pipe(O(t=>!!Nr()))}function Ze(){return L}function Vo(){return le.getValue()}function Nt(){return!!v.mock}function jr(){return!!v.secure}function Ko(){return Bo}function Ft(){return Mt("trust")==="true"||Mt("trusted")==="true"}function An(){return!!Ke()&&!v.ignore_api_key||Mt("fixed_device")==="true"}function Mt(t,e=!0){let r=kn()[t];if(w){const i=`${Ur()}_${t}`;r=r||w.getItem(i)||w.getItem(t)||"",e&&w.setItem(i,`${r}`)}return r}function Yo(t){return v=t||v,v.token_header=v.token_header??Dr(),window.AbortController||(window.AbortController=Fo),w=v.storage==="session"?sessionStorage:localStorage,P=W.hashStr(v.redirect_uri,!1),Tn()}function Jo(){v={},L=void 0,Me.next(""),Ct.next(""),le.next(!1),P="",ve="",xn="/api/engine/v2";for(const t in b)t in b&&delete b[t];jo()}function wn(){return d("Auth","Refreshing authorty."),L=void 0,Tn()}function jt(){d("Auth","Invalidating tokens."),w.removeItem(`${P}_access_token`),w.removeItem(`${P}_expires_at`),Me.getValue()&&Me.next("")}function Pn(t,e=L){return b.authorise||(b.authorise=new Promise((n,r)=>{if(!e)return delete b.authorise,r("Authority is not loaded");d("Auth","Authorising user...");const i=()=>{if(Z(!1))d("Auth","Valid token found."),delete b.authorise,n(Z());else{const o=[()=>{d("Auth","Successfully generated token."),n(Z()),delete b.authorise},()=>{d("Auth","Failed to generate token."),r("Failed to generate token"),setTimeout(()=>delete b.authorise,200)}];v&&v.auth_type==="password"?(d("Auth","Logging in with credentials."),us(v).then(...o),Ot=0):ve||Et()?(d("Auth",`Generating token with ${ve?"code":"refresh token"}`),Hr().then(...o),Ot=0):e.session?(d("Auth","Users has session. Authorising application..."),Xo(t).then(...o)):(d("Auth","No user session"),Lr(e),r("No user session"),setTimeout(()=>delete b.authorise,200))}};ts().then(i,i)})),b.authorise}function Go(){const t=L?L.logout_url:"/logout";fetch(t,{method:"GET",redirect:"manual",headers:{Authorization:"Bearer "+Z()}}).then(e=>{const n=e.headers.get("Location")||t;for(let r=0;r<w.length;r++){const i=w.key(r);i&&i.indexOf(P)>=0&&w.removeItem(i)}window.location?.assign(n)})}function Tn(t=0){return b.load_authority||(b.load_authority=new Promise(e=>{if(le.next(!1),v.mock){L=zo,d("Auth","System in mock mode"),le.next(!0),e();return}d("Auth",`Fixed: ${An()} | Trusted: ${Ft()}`),d("Auth","Loading authority...");const n=v.secure||window.location?.protocol.indexOf("https")>=0,r=i=>{d("Auth",`Failed to load authority(${i})`),le.next(!1),ne("load_authority",()=>{delete b.load_authority,Tn(t).then(o=>e())},300*Math.min(20,++t))};Sn(`${n?"https:":"http:"}//${It()}/auth/authority`,{credentials:"same-origin"}).subscribe(async i=>{if(!i.ok)return r(await i.text().catch(s=>s));L=await i.json(),xn=/[2-9]\.[0-9]+\.[0-9]+/g.test(L.version||"")?"/api/engine/v2":"/control/api",d("Auth","Loaded authority.",[],"group"),L&&(d("Auth",`Name: ${L.name}`),d("Auth",`Version: ${L.version}`),d("Auth",`Domain: ${L.domain}`),d("Auth",`Session: ${L.session}`),d("Auth",`Production: ${L.production}`),d("Auth",`Config Keys: ${Object.keys(L.config||{}).length}`)),d("Auth","",[],"groupEnd");const o=()=>{le.next(!0),d("Auth","Application set online."),e()};delete b.load_authority,Pn("").then(o,o)},r)})),b.load_authority}async function Xo(t){const e=rs(t);if(v.use_iframe)return es(e);window.location?.assign(e)}function es(t){return b.iframe_auth||(b.iframe_auth=new Promise((e,n)=>{d("Auth","Authorizing in an iFrame...");const r=document.createElement("iframe");r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.height="1px",r.style.width="1px",r.style.zIndex="-1",r.id="place-authorize",r.src=`${t}`;const i=o=>{if(o.origin===window.location?.origin&&o.data.type==="place-os"){const s=o.data;if(d("Auth","Received credentials from iFrame..."),document.body.removeChild(r),Se("iframe_auth"),window.removeEventListener("message",i),delete b.iframe_auth,s.token)return e(),On({access_token:s.token,...s});ve=s.code||"",Hr().then(u=>e(u),u=>n(u))}};ne("iframe_auth",()=>{d("Auth","Unable to resolve iFrame after 15 seconds..."),n()},15*1e3),window.addEventListener("message",i),r.onerror=o=>{d("Auth","iFrame error.",o),delete b.iframe_auth,n()},document.body.appendChild(r)})),b.iframe_auth}let er=!1;function Lr(t){if(v.handle_login!==!1&&!er){d("Auth","Redirecting to login page...");const e=t.login_url?.replace("{{url}}",encodeURIComponent(window.location?.href));throw setTimeout(()=>window.location?.assign(e),300),er=!0,new Error("Redirecting to login page...")}else d("Auth","Login being handled locally.");delete b.authorise}function ts(){return b.check_token||(b.check_token=new Promise(async(t,e)=>{Z()?(d("Auth","Valid token found."),t(Z())):(d("Auth","No token. Checking URL for auth credentials..."),await ns()?t(!0):e()),delete b.check_token})),b.check_token}function ns(){return b.check_params||(b.check_params=new Promise(t=>{d("Auth","Checking for auth parameters...");let e=kn();if((!e||Object.keys(e).length<=0)&&sessionStorage&&(e=JSON.parse(sessionStorage.getItem("ENGINE.auth.params")||"{}")),e&&(e.code||e.access_token||e.refresh_token)){e.code&&(ve=e.code,ae("code")),e.refresh_token&&(w.setItem(`${P}_refresh_token`,e.refresh_token),ae("refresh_token"));const n=w.getItem(`${P}_nonce`)||"",r=(e.state||"").split(";");ae("state"),ae("token_type");const i=r[0];n===i?(On(e),t(!!e.access_token)):t(!1)}else t(!1);ne("check_params_promise",()=>delete b.check_params,50)})),b.check_params}function rs(t){const e=cs();t=t?`${e};${t}`:e;const n=v?(v.auth_uri||"").indexOf("?")>=0:!1,r=(v?v.auth_uri:null)||"/auth/oauth/authorize",i=Ft()||v.auth_type==="auth_code"?"code":"token";let o=`${r}${n?"&":"?"}response_type=${encodeURIComponent(i)}&client_id=${encodeURIComponent(P)}&state=${encodeURIComponent(t)}&redirect_uri=${encodeURIComponent(v.redirect_uri)}&scope=${encodeURIComponent(v.scope)}`;if(v.auth_type==="auth_code"){const{challenge:s,verify:u}=is();sessionStorage.setItem(`${P}_challenge`,s),o+="&code_challenge_method=S256",o+=`&code_challenge=${u}`}return o}const tr="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split("");function is(t=43){const e=new Array(t).fill(0).map(()=>tr[Math.floor(Math.random()*tr.length)]).join(""),n=Po(To(e)),r=Tr(Io.hash(n)).split("=")[0].replace(/\//g,"_").replace(/\+/g,"-");return{challenge:e,verify:r}}function os(){let e=(v.token_uri||"/auth/token")+`?client_id=${encodeURIComponent(P)}`,n="";if(e+=`&redirect_uri=${encodeURIComponent(v.redirect_uri)}`,Et()){e+=`&refresh_token=${encodeURIComponent(Et())}`,e+="&grant_type=refresh_token";const r=e.split("?");e=r[0],n=r[1]}else{e+=`&code=${encodeURIComponent(ve)}`,e+="&grant_type=authorization_code";const r=sessionStorage.getItem(`${P}_challenge`);r&&(e+=`&code_verifier=${r}`,sessionStorage.removeItem(`${P}_challenge`)),ve=""}return[e,n]}function ss(t){const e=t.token_uri||"/auth/token",n=H({grant_type:"password",client_id:P,client_secret:t.client_secret,redirect_uri:t.redirect_uri,authority:L?.id,scope:t.scope,username:t.username,password:t.password});return`${e}?${n}`}function Hr(){return zr(...os())}function us(t){return zr(ss(t))}function zr(t,e=""){return b.generate_tokens||(b.generate_tokens=new Promise((n,r)=>{d("Auth","Generating new token...");const i=o=>{d("Auth","Error generating new tokens.",o),w.removeItem(`${P}_refresh_token`),Ct.next(""),r(),delete b.generate_tokens};Sn(t,{method:"POST",body:e,headers:{"Content-Type":"application/x-www-form-urlencoded"}}).subscribe(async o=>{if(!o.ok)return i(o);const s=await o.json();On(s),n(),delete b.generate_tokens},i)})),b.generate_tokens}function On(t){const e=Uo(new Date,Math.max(60,parseInt(t.expires_in,10)-300));d("Auth","Tokens generated storing..."),Ft()&&(t.access_token&&(w.setItem(`${P}_access_token`,t.access_token),ae("access_token")),t.refresh_token&&(w.setItem(`${P}_refresh_token`,t.refresh_token),ae("refresh_token"))),t.expires_in&&(w.setItem(`${P}_expires_at`,`${e.valueOf()}`),ae("expires_in")),le.next(!0),Me.next(t.access_token||""),Ct.next(t.refresh_token||"")}function cs(){const t=Er();return w.setItem(`${P}_nonce`,t),t}const Lt={};let Br=(t,e)=>{const n=new Error(`Mock endpoint not found: ${t} ${e}`);return n.status=404,d("HTTP(M)",`404 ${t}:`,e),$r(n)};function as(t){Br=t}function ls(t,e=Lt){Wr(t.method,t.path,e);const n=`${t.method}|${t.path}`,r=t.path.replace(/(http|https):\/\/[a-zA-Z0-9.-]*:?([0-9]*)?/g,"").replace(/^\//,"").split("/"),i={...t,path_parts:r,path_structure:r.map(o=>o[0]===":"?o.replace(":",""):"")};e[n]=i,d("HTTP(M)",`+ ${t.method} ${t.path}`)}function Wr(t,e,n=Lt){const r=`${t}|${e}`;n[r]&&(delete n[r],d("HTTP(M)",`- ${t} ${e}`))}function hs(t,e,n,r=Lt){const i=fs(t,e,r);if(i){const o=ds(e,i,n);return ps(i,o)}return Br(t,e)}function fs(t,e,n=Lt){const i=e.replace(/(http|https):\/\/[a-zA-Z0-9.-]*:?([0-9]*)?/g,"").replace(/^\//,"").split("?")[0].split("/"),o=Object.keys(n).reduce((s,u)=>(u.indexOf(`${t}|`)===0&&s.push(n[u]),s),[]);for(const s of o)if(s.path_structure.length===i.length){let u=!0;for(let c=0;c<s.path_structure.length;c++)if(!s.path_structure[c]&&s.path_parts[c]!==i[c]){u=!1;break}if(u)return s}return null}function ds(t,e,n){const r=t.replace(/(http|https):\/\/[a-zA-Z0-9.-]*:?([0-9]*)?/g,"").split("?"),i=r[0].replace(/^\//,""),o=r[1]||"",s=Oe(o),u=i.split("/"),c={};for(let m=0;m<e.path_structure.length;m++){const _=e.path_structure[m];_&&(c[_]=u[m])}const l={url:t,path:e.path,method:e.method,metadata:e.metadata,route_params:c,query_params:s,body:n};return d("HTTP(M)",`MATCHED ${l.method}:`,l),l}function ps(t,e){let n;try{n=t.callback?t.callback(e):t.metadata}catch(s){throw d("HTTP(M)",`ERROR ${e.method}:`,[e.url,s]),s}const r=t.delay_variance||100,i=t.delay||300,o=Math.floor(Math.random()*r-r/2)+i;return d("HTTP(M)",`RESP ${e.method}:`,[e.url,n]),yo([n]).pipe(xo(Math.max(200,o)))}const Qr={};function Zr(t,e=Qr){return e[t]||{}}function X(t,e,n=Je){return e||(e={response_type:"json"}),n("GET",t,{response_type:"json",...e})}function ke(t,e,n,r=Je){return n||(n={response_type:"json"}),r("POST",t,{body:e,response_type:"json",...n})}function Re(t,e,n,r=Je){return n||(n={response_type:"json"}),r("PUT",t,{body:e,response_type:"json",...n})}function Ye(t,e,n,r=Je){return n||(n={response_type:"json"}),r("PATCH",t,{body:e,response_type:"json",...n})}function De(t,e,n=Je){return e||(e={response_type:"void"}),n("DELETE",t,{response_type:"void",...e})}async function ms(t,e,n=Qr){if(t.headers){const r={};t.headers.forEach?t.headers.forEach((i,o)=>r[o.toLowerCase()]=i):Object.keys(t.headers).forEach(i=>r[i.toLowerCase()]=t.headers[i]),n[t.url||""]=r}switch(e){case"json":return await t.json().catch(()=>({}));case"text":return await t.text();case"void":return;default:return await t.json().catch(()=>({}))}}const Vr=()=>(jt(),wn().then(()=>Promise.resolve(),()=>new Promise(t=>{setTimeout(()=>{Vr().then(()=>t())},1e3)})));function Je(t,e,n,r=Nt,i=hs,o=ms){if(r()){const s=i(t,e,n?.body);if(s)return s}return n.headers=n.headers||{},!n.headers["Content-Type"]&&!n.headers["content-type"]&&(n.headers["Content-Type"]="application/json"),Fr().pipe(bo(s=>s),Pr(1),Vn(s=>{Z()==="x-api-key"?n.headers["X-API-Key"]=Ke():n.headers.Authorization=`Bearer ${Z()}`;const u={...n,method:t,credentials:"same-origin"};return["POST","PUT","PATCH"].includes(t)&&n.body!==void 0&&(u.body=typeof n.body=="string"?n.body:JSON.stringify(n.body)),Sn(e,u)}),Vn(s=>s.ok?o(s,n.response_type):$r(s)),wo({count:4,delay:(s,u)=>new D(c=>{if(s.status===511){Lr(Ze()),c.error(s);return}if(s.status!==401){c.error(s||{});return}d("HTTP","Auth error",s);const l=Math.pow(2,u-1)*1e3;Vr().then(()=>{c.next(l),c.complete()}).catch(()=>{c.error(s)})})}))}class F{id;name;created_at;updated_at;version;constructor(e={}){this.id=e.id||"",this.name=e.name||"",this.created_at=e.created_at||0,this.updated_at=e.updated_at||0,this.version=e.version||0}toJSON(){const e={...this};return e.version=this.version,delete e.created_at,Mr(e,[void 0,null,""])}}class Kr extends F{alert_dashboard_id;alert_dashboard_details;authority_id;description;enabled;conditions;severity;alert_type;debounce_period;constructor(e){super(e),this.authority_id=e.authority_id||"",this.description=e.description||"",this.enabled=e.enabled||!1,this.conditions=e.conditions||{time_dependents:[],comparisons:[]},this.severity=e.severity||"low",this.alert_type=e.alert_type||"threshold",this.debounce_period=e.debounce_period||0,this.alert_dashboard_id=e.alert_dashboard_id||"",this.alert_dashboard_details=e.alert_dashboard_details||void 0}}class Yr extends F{authority_id;description;enabled;constructor(e){super(e),this.authority_id=e.authority_id||"",this.description=e.description||"",this.enabled=e.enabled||!1}}const qe="alert_dashboards";function Ht(t){return new Yr(t)}function _s(t={}){return A({query_params:t,fn:Ht,path:qe})}function ys(t,e={}){return $({id:t,query_params:e,fn:Ht,path:qe})}function gs(t,e,n="patch"){return M({id:t,form_data:e,query_params:{},method:n,fn:Ht,path:qe})}function vs(t){return I({form_data:t,query_params:{},fn:Ht,path:qe})}function bs(t,e={}){return E({id:t,query_params:e,path:qe})}function Ss(t){return A({query_params:{},fn:Xe,path:`${qe}/${t}/alerts`})}const Ge="alerts";function Xe(t){return new Kr(t)}function ks(t={}){return A({query_params:t,fn:Xe,path:Ge})}function xs(t,e={}){return $({id:t,query_params:e,fn:Xe,path:Ge})}function $s(t,e,n="patch"){return M({id:t,form_data:e,query_params:{},method:n,fn:Xe,path:Ge})}function As(t){return I({form_data:t,query_params:{},fn:Xe,path:Ge})}function ws(t,e={}){return E({id:t,query_params:e,path:Ge})}class Jr extends F{uid;secret;owner_id;scopes;redirect_uri;skip_authorization;preserve_client_id;constructor(e={}){super(e),this.uid=e.uid||"",this.secret=e.secret||"",this.owner_id=e.owner_id||"",this.scopes=e.scopes||"",this.redirect_uri=e.redirect_uri||"",this.skip_authorization=e.skip_authorization||!1,this.preserve_client_id=e.preserve_client_id||!1}}function Ps(t){return Gr[t]||0}function Ts(t){return Xr[t]||0}let Gr={},Xr={},nr="";const zt=t=>t;function A(t){const{query_params:e,fn:n,path:r,endpoint:i}=t,o=H(e),s=`${i||fe()}${r?"/"+r:""}${o?"?"+o:""}`;return X(s).pipe(O(u=>{const c=Os(s,o,r);return{total:c.total||0,next:c.next?()=>A({query_params:c.next,fn:n,endpoint:i,path:r}):null,data:u&&u instanceof Array?u.map(l=>(n||zt)(l)):u&&!(u instanceof Array)&&u.results?u.results.map(l=>l):[]}}))}function $(t){const{query_params:e,id:n,path:r,fn:i,options:o}=t,s=H(e),u=`${fe()}/${r}/${n}${s?"?"+s:""}`;return X(u,o).pipe(O(c=>(i||zt)(c)))}function I(t){const{query_params:e,form_data:n,path:r,fn:i}=t,o=H(e),s=`${fe()}/${r}${o?"?"+o:""}`;return ke(s,n).pipe(O(c=>(i||zt)(c)))}function y(t){const{id:e,task_name:n,form_data:r,method:i,path:o,callback:s}=t,u=H(r),c=`${fe()}/${o}/${e}/${n}`;return(i==="post"||i==="put"||!i?(i==="put"?Re:ke)(c,r):(i==="del"?De:X)(`${c}${u?"?"+u:""}`,{response_type:"json"})).pipe(O(m=>(s||(_=>_))(m)))}function M(t){const{id:e,query_params:n,form_data:r,method:i,path:o,fn:s}=t,u=H({...n,version:r.version||0}),c=`${fe()}/${o}/${e}${u?"?"+u:""}`;return(i==="put"?Re:Ye)(c,r).pipe(O(l=>(s||zt)(l)))}function E(t){const{id:e,query_params:n,path:r}=t,i=H(n),o=`${fe()}/${r}/${e}${i?"?"+i:""}`;return De(o)}function Os(t,e,n){const r=Zr(t[0]==="/"?`${location.origin}${t}`:t),i={total:0,next:null};if(r&&r["x-total-count"]){const o=+(r["x-total-count"]||0);(e.length<2||e.length<12&&e.indexOf("offset=")>=0)&&(Gr[n]=o),Xr[n]=o,i.total=o}return r&&r.link&&(nr=Ir(r.link||"").next,i.next=Oe(nr.split("?")[1])),i}const et="oauth_apps";function Bt(t){return new Jr(t)}function Es(t={}){return A({query_params:t,fn:Bt,path:et})}function Is(t,e={}){return $({id:t,query_params:e,fn:Bt,path:et})}function Ms(t,e,n="patch"){return M({id:t,form_data:e,query_params:{},method:n,fn:Bt,path:et})}function Rs(t){return I({form_data:t,query_params:{},fn:Bt,path:et})}function Ds(t,e={}){return E({id:t,query_params:e,path:et})}var ei=(t=>(t[t.Certificate=0]="Certificate",t[t.NoAuth=1]="NoAuth",t[t.UserPassword=2]="UserPassword",t))(ei||{});class ti extends F{id;name;auth_type;description;host;port;tls;username;password;certificate;secret;filters;constructor(e={}){super(),this.id=e.id||"",this.name=e.name||"",this.auth_type=e.auth_type||2,this.description=e.description||"",this.host=e.host||"",this.port=e.port||1883,this.tls=e.tls||!1,this.username=e.username||"",this.password=e.password||"",this.certificate=e.certificate||"",this.secret=e.secret||"",this.filters=e.filters||[]}}const tt="brokers";function Wt(t){return new ti(t)}function qs(t={}){return A({query_params:t,fn:Wt,path:tt})}function Us(t,e={}){return $({id:t,query_params:e,fn:Wt,path:tt})}function Cs(t,e,n="patch"){return M({id:t,form_data:e,query_params:{},method:n,fn:Wt,path:tt})}function Ns(t){return I({form_data:t,query_params:{},fn:Wt,path:tt})}function Fs(t,e={}){return E({id:t,query_params:e,path:tt})}class ni{id;compiled_drivers;available_repositories;running_drivers;module_instances;unavailable_repositories;unavailable_drivers;hostname;cpu_count;core_cpu;total_cpu;memory_total;memory_usage;core_memory;memory_percentage;used_memory;total_memory;edge_nodes;run_counts;constructor(e={}){this.id=e.id||e.core_id||"",this.compiled_drivers=e.compiled_drivers||[],this.available_repositories=e.available_repositories||e.status?.available_repositories||[],this.running_drivers=e.running_drivers||e.status?.running_drivers||0,this.module_instances=e.module_instances||e.status?.module_instances||0,this.unavailable_repositories=e.unavailable_repositories||e.status?.unavailable_repositories||[],this.unavailable_drivers=e.unavailable_drivers||e.status?.unavailable_drivers||[],this.hostname=e.hostname||e.load?.local.hostname||"",this.cpu_count=e.cpu_count||e.load?.local.cpu_count||0,this.core_cpu=e.core_cpu||e.load?.local.core_cpu||0,this.total_cpu=e.total_cpu||e.load?.local.total_cpu||0,this.memory_total=e.memory_total||e.load?.local.memory_total||0,this.memory_usage=e.memory_usage||e.load?.local.memory_usage||0,this.core_memory=e.core_memory||e.load?.local.core_memory||0,this.run_counts=e.run_counts||e.status?.run_counts?.local||{modules:0,drivers:0},this.memory_percentage=+(this.memory_usage/this.memory_total*100).toFixed(4),this.used_memory=Qe(this.memory_usage*1024),this.total_memory=Qe(this.memory_total*1024);const n=e.load?.edge||{};this.edge_nodes=e.edge_nodes||Object.keys(n).map(r=>({id:r,...n[r],run_count:e.status?.run_count?.edge[r]||{}}))||[]}}class ri{cluster_id;id;modules;running;module_instances;last_exit_code;launch_count;launch_time;cpu_usage;memory_total;memory_usage;used_memory;total_memory;constructor(e,n={}){this.cluster_id=e,this.id=n.id||n.driver||"",this.modules=n.modules||[],this.running=n.running||!1,this.module_instances=n.module_instances||n.edge?.status?.module_instances||n.local?.status?.module_instances||0,this.last_exit_code=n.last_exit_code||n.edge?.status?.last_exit_code||n.local?.status?.last_exit_code||0,this.launch_count=n.launch_count||n.edge?.status?.launch_count||n.local?.status?.launch_count||0,this.launch_time=n.launch_time||n.edge?.status?.launch_time||n.local?.status?.launch_time||0,this.cpu_usage=n.cpu_usage||n.percentage_cpu||n.edge?.status?.percentage_cpu||n.local?.status?.percentage_cpu||0,this.memory_total=n.memory_total||n.edge?.status?.memory_total||n.local?.status?.memory_total||0,this.memory_usage=n.memory_usage||n.edge?.status?.memory_usage||n.local?.status?.memory_usage||0,this.used_memory=Qe(this.memory_usage*1024),this.total_memory=Qe(this.memory_total*1024)}}const Qt="cluster";function ii(t){return new ni(t)}function js(t={}){return A({query_params:t,fn:ii,path:Qt})}function Ls(t,e={}){return $({id:t,query_params:e,fn:ii,path:Qt})}function Hs(t,e={}){return $({id:t,query_params:e,fn:n=>n.map(r=>new ri(t,r)),path:Qt})}function zs(t,e){return E({id:t,query_params:{driver:e},path:Qt})}class oi extends F{domain;login_url;logout_url;description;config;internals;email_domains;constructor(e={}){super(e),this.description=e.description||"",this.domain=e.domain||"",this.login_url=e.login_url||"",this.logout_url=e.logout_url||"",this.config=e.config||{},this.internals=e.internals||{},this.email_domains=e.email_domains||[]}}const nt="domains";function Zt(t){return new oi(t)}function Bs(t={}){return A({query_params:t,fn:Zt,path:nt})}function Ws(t,e={}){return $({id:t,query_params:e,fn:Zt,path:nt})}function Qs(t,e,n="patch"){return M({id:t,form_data:e,query_params:{},method:n,fn:Zt,path:nt})}function Zs(t){return I({form_data:t,query_params:{},fn:Zt,path:nt})}function Vs(t,e={}){return E({id:t,query_params:e,path:nt})}var xe=(t=>(t[t.None=0]="None",t[t.Support=1]="Support",t[t.Admin=2]="Admin",t[t.NeverDisplay=3]="NeverDisplay",t))(xe||{});class de extends F{parent_id;updated_at;encryption_level;settings_string;keys;modified_by_id;get value(){return this.settings_string}constructor(e={}){super(e),this.parent_id=e.parent_id||"",this.updated_at=e.updated_at||Math.floor(new Date().getTime()/1e3),this.settings_string=e.settings_string||"",this.encryption_level=e.encryption_level||xe.None,this.keys=e.keys||[],this.modified_by_id=e.modified_by_id||""}}var Ve=(t=>(t[t.SSH=0]="SSH",t[t.Device=1]="Device",t[t.Service=2]="Service",t[t.Websocket=3]="Websocket",t[t.Logic=99]="Logic",t))(Ve||{});class En extends F{class_name;description;module_name;role;default_uri;default_port;repository_id;file_name;commit;ignore_connected;update_available;update_info;settings;constructor(e={}){super(e),this.description=e.description||"",this.module_name=e.module_name||"",this.role=e.role??Ve.Logic,this.default_uri=e.default_uri||"",this.default_port=e.default_port||1,this.ignore_connected=e.ignore_connected||!1,this.class_name=e.class_name||"",this.repository_id=e.repository_id||"",this.file_name=e.file_name||"",this.commit=e.commit||"",this.update_available=e.update_available||!1,this.update_info=e.update_info,this.settings=e.settings||[null,null,null,null],typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in xe)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new de({parent_id:this.id,encryption_level:+n}))}}const oe="drivers";function Vt(t){return new En(t)}function Ks(t={}){return A({query_params:t,fn:Vt,path:oe})}function Ys(t,e={}){return $({id:t,query_params:e,fn:Vt,path:oe})}function Js(t,e,n="patch"){return M({id:t,form_data:e,query_params:{},method:n,fn:Vt,path:oe})}function Gs(t){return I({form_data:t,query_params:{},fn:Vt,path:oe})}function Xs(t,e={}){return E({id:t,query_params:e,path:oe})}function eu(t){return y({id:t,task_name:"recompile",path:oe})}function tu(t){return y({id:t,task_name:"reload",path:oe})}function nu(t){return y({id:t,task_name:"compiled",method:"get",path:oe})}function ru(t){return y({id:t,task_name:"readme",method:"get",path:oe})}class si extends F{description;secret;x_api_key;online;last_seen;constructor(e={}){super(e),this.description=e.description||"",this.secret=e.secret||"",this.x_api_key=e.x_api_key||"",this.last_seen=(e.last_seen||0)*1e3||Date.now(),this.online=e.online||!1}toJSON(){const e=super.toJSON();return delete e.last_seen,e}}const Ue="edges";function Kt(t){return new si(t)}function iu(t={}){return A({query_params:t,fn:Kt,path:Ue})}function ou(t,e={}){return $({id:t,query_params:e,fn:Kt,path:Ue})}function su(t,e,n="patch"){return M({id:t,form_data:e,query_params:{},method:n,fn:Kt,path:Ue})}function uu(t){return I({form_data:t,query_params:{},fn:Kt,path:Ue})}function cu(t,e={}){return E({id:t,query_params:e,path:Ue})}function au(t,e={}){return y({id:t,task_name:"token",form_data:e,method:"get",path:Ue})}class ui extends F{type="ldap";authority_id;host;port;auth_method;uid;base;bind_dn;password;filter;constructor(e={}){super(e),this.authority_id=e.authority_id||"",this.host=e.host||"",this.port=e.port||636,this.auth_method=e.auth_method||"ssl",this.uid=e.uid||"",this.base=e.base||"",this.bind_dn=e.bind_dn||"",this.password=e.password||"",this.filter=e.filter||""}}const rt="ldap_auths";function Yt(t){return new ui(t)}function lu(t={}){return A({query_params:t,fn:Yt,path:rt})}function hu(t,e={}){return $({id:t,query_params:e,fn:Yt,path:rt})}function fu(t,e,n="patch"){return M({id:t,form_data:e,query_params:{},method:n,fn:Yt,path:rt})}function du(t){return I({form_data:t,query_params:{},fn:Yt,path:rt})}function pu(t,e={}){return E({id:t,query_params:e,path:rt})}class In{id;name;description;details;editors;schema;updated_at;modified_by_id;version;constructor(e={}){this.id=e.id||e.parent_id||"",this.name=e.name||"",this.description=e.description||"";try{this.details=(typeof e.details=="string"?JSON.parse(e.details):e.details)||{}}catch{this.details=e.details||{}}this.editors=e.editors||[],this.schema=e.schema||"",this.updated_at=(e.updated_at||0)*1e3||Date.now(),this.modified_by_id=e.modified_by_id||"",this.version=e.version||0}}class $e extends F{system_name;activated_count;description;debounce_period;important;enabled;enable_webhook;exec_enabled;webhook_secret;supported_methods;control_system_id;zone_id;trigger_id;playlists;get system_id(){return this.control_system_id}get actions(){const e=this._actions,n=(e.functions||[]).map(i=>({...i,args:{...i.args}})),r=(e.mailers||[]).map(i=>({...i,emails:[...i.emails]}));return{functions:n,mailers:r}}get conditions(){const e=this._conditions,n=(e.comparisons||[]).map(i=>({...i,left:typeof i.left=="object"?{...i.left}:i.left,right:typeof i.right=="object"?{...i.right}:i.right})),r=(e.time_dependents||[]).map(i=>({...i}));return{comparisons:n,time_dependents:r}}_actions;_conditions;constructor(e={}){super(e),this.description=e.description||"",this._actions=e.actions||{functions:[],mailers:[]},this._conditions=e.conditions||{comparisons:[],time_dependents:[]},this.debounce_period=e.debounce_period||0,this.important=e.important||!1,this.enabled=e.enabled||!1,this.webhook_secret=e.webhook_secret||"",this.control_system_id=e.system_id||e.control_system_id||"",this.zone_id=e.zone_id||"",this.system_name=e.system_name||(e.control_system?e.control_system.name:""),this.enable_webhook=e.enable_webhook||!1,this.exec_enabled=e.exec_enabled||!1,this.supported_methods=e.supported_methods||["POST"],this.activated_count=e.activated_count||e.trigger_count||0,this.playlists=e.playlists||[],this.trigger_id=e.trigger_id||""}}class Jt extends F{settings=[null,null,null,null];description;parent_id;triggers;tags;location;display_name;code;type;count;capacity;map_id;images;timezone;playlists;trigger_list=[];constructor(e={}){super(e),this.description=e.description||"",this.tags=e.tags||[],this.triggers=e.triggers||[],this.settings=e.settings||[null,null,null,null],this.parent_id=e.parent_id||"",this.location=e.location||"",this.display_name=e.display_name||"",this.code=e.code||"",this.type=e.type||"",this.count=e.count||0,this.capacity=e.capacity||0,this.map_id=e.map_id||"",this.timezone=e.timezone||"",this.images=e.images||[],this.playlists=e.playlists||[],typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in xe)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new de({parent_id:this.id,encryption_level:+n}));e.trigger_data&&e.trigger_data instanceof Array&&(this.trigger_list=e.trigger_data.map(n=>new $e(n)))}}class ci{zone;metadata;keys;constructor(e={}){this.zone=new Jt(e.zone),this.keys=e.keys||[],this.metadata={};const n=e.metadata||{};for(const r of this.keys)this.metadata[r]=new In(n[r])}}const Ae="metadata";function it(t){return new In(t)}function mu(t,e={}){return $({id:t,query_params:e,fn:n=>Object.keys(n).map(r=>it(n[r])),path:Ae})}function _u(t){const e=[...t],n=[];for(;e.length;){const r=e.pop();Array.isArray(r)?e.push(...r):n.push(r)}return n.reverse()}function yu(t,e={}){return y({id:t,task_name:"history",form_data:e,method:"get",callback:n=>_u(Object.keys(n).map(r=>n[r].map(i=>it(i)))),path:Ae})}function gu(t,e,n={}){return $({id:t,query_params:{...n,name:e},fn:r=>it(r[e]),path:Ae})}function vu(t,e,n="put"){return M({id:t,form_data:e,query_params:{},method:n,fn:it,path:Ae})}function bu(t){return I({form_data:t,query_params:{},fn:it,path:Ae})}function Su(t,e={}){return E({id:t,query_params:e,path:Ae})}function ku(t,e){return y({id:t,task_name:"children",form_data:e,method:"get",callback:n=>n.map(r=>new ci({...r,keys:Object.keys(r.metadata)})),path:Ae})}class Mn extends F{settings=[null,null,null,null];display_name;description;email;code;capacity;features;bookable;public;installed_ui_devices;support_url;timetable_url;camera_snapshot_url;camera_url;room_booking_url;map_id;modules;images;zones;timezone;module_list=[];signage;playlists;approval;orientation;constructor(e={}){super(e),this.display_name=e.display_name||"",this.description=e.description||"",this.email=e.email||"",this.code=e.code||"",this.capacity=e.capacity||0,this.features=e.features||[],this.bookable=e.bookable||!1,this.public=e.public??!1,this.installed_ui_devices=e.installed_ui_devices||0,this.support_url=e.support_url||"",this.camera_snapshot_url=e.camera_snapshot_url||"",this.camera_url=e.camera_url||"",this.timetable_url=e.timetable_url||"",this.room_booking_url=e.room_booking_url||"",this.map_id=e.map_id||"",this.modules=e.modules||[],this.images=e.images||[],this.zones=e.zones||[],this.settings=e.settings||[null,null,null,null],this.timezone=e.timezone||"",this.signage=e.signage||!1,this.playlists=e.playlists||[],this.orientation=e.orientation||"unspecified",this.approval=e.approval||!1,typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in xe)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new de({parent_id:this.id,encryption_level:+n}));e.module_data&&e.module_data instanceof Array&&(this.module_list=e.module_data.map(n=>new Rn(n)))}}class Rn extends F{connected;running;updated_at;edge_id;driver_id;driver;control_system_id;system;ip;tls;udp;port;makebreak;uri;custom_name;role;notes;ignore_connected;settings=[null,null,null,null];has_runtime_error;error_timestamp;get system_id(){return this.control_system_id}constructor(e={}){super(e),this.driver_id=e.driver_id||e.dependency_id||"",this.control_system_id=e.control_system_id||"",this.edge_id=e.edge_id||"",this.ip=e.ip||"",this.tls=e.tls||!1,this.udp=e.udp||!1,this.port=e.port||1,this.makebreak=e.makebreak||!1,this.uri=e.uri||"",this.custom_name=e.custom_name||"",this.role=e.role??Ve.Logic,this.notes=e.notes||"",this.ignore_connected=e.ignore_connected||!1,this.connected=e.connected,this.running=e.running||!1,this.updated_at=e.updated_at||0,this.system=new Mn(e.control_system||e.system),this.has_runtime_error=e.has_runtime_error||!1,this.error_timestamp=e.error_timestamp||0,this.driver=new En(e.dependency||e.driver),this.settings=e.settings||[null,null,null,null],typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in xe)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new de({parent_id:this.id,encryption_level:+n}))}toJSON(e=!1){const n=super.toJSON();return(n.role!==Ve.Logic&&!e||!n.control_system_id)&&delete n.control_system_id,delete n.driver,delete n.system,delete n.error_timestamp,delete n.has_runtime_error,n}}const Y="modules";function Gt(t){return new Rn(t)}function xu(t={}){return A({query_params:t,fn:Gt,path:Y})}function $u(t,e={}){return $({id:t,query_params:e,fn:Gt,path:Y})}function Au(t,e,n="patch"){return M({id:t,form_data:e,query_params:{},method:n,fn:Gt,path:Y})}function wu(t){return I({form_data:t,query_params:{},fn:Gt,path:Y})}function Pu(t,e={}){return E({id:t,query_params:e,path:Y})}function Tu(t){return y({id:t,task_name:"start",path:Y})}function Ou(t){return y({id:t,task_name:"stop",path:Y})}function Eu(t){return y({id:t,task_name:"state",method:"get",path:Y})}function Iu(t,e){return y({id:t,task_name:`state${e}`,method:"get",path:Y})}function Mu(t){return y({id:t,task_name:"load",method:"post",path:Y})}function Ru(t){return y({id:t,task_name:"settings",method:"get",callback:e=>e.map(n=>new de(n)),path:Y})}function Du(t){return y({id:t,task_name:"error",method:"get",path:Y})}class ai extends F{type="oauth";authority_id;client_id;client_secret;info_mappings;site;authorize_url;token_method;token_url;auth_scheme;scope;raw_info_url;authorize_params;ensure_matching;constructor(e={}){super(e),this.authority_id=e.authority_id||"",this.client_id=e.client_id||"",this.client_secret=e.client_secret||"",this.info_mappings=e.info_mappings||{},this.authorize_params=e.authorize_params||{},this.ensure_matching=e.ensure_matching||{},this.site=e.site||"",this.authorize_url=e.authorize_url||"oauth/authorize",this.token_method=e.token_method||"post",this.token_url=e.token_url||"oauth/token",this.auth_scheme=e.auth_scheme||"request_body",this.scope=e.scope||"",this.raw_info_url=e.raw_info_url||"",this.authorize_params=e.authorize_params||{},this.ensure_matching=e.ensure_matching||{}}}const ot="oauth_auths";function Xt(t){return new ai(t)}function qu(t={}){return A({query_params:t,fn:Xt,path:ot})}function Uu(t,e={}){return $({id:t,query_params:e,fn:Xt,path:ot})}function Cu(t,e,n="patch"){return M({id:t,form_data:e,query_params:{},method:n,fn:Xt,path:ot})}function Nu(t){return I({form_data:t,query_params:{},fn:Xt,path:ot})}function Fu(t,e={}){return E({id:t,query_params:e,path:ot})}var Dn=(t=>(t.Driver="driver",t.Interface="interface",t))(Dn||{});class li extends F{folder_name;description;uri;branch;commit_hash;repo_type;username;password;root_path;get type(){return this.repo_type}constructor(e={}){super(e),this.folder_name=e.folder_name||"",this.description=e.description||"",this.uri=e.uri||"",this.branch=e.branch||"",this.commit_hash=e.commit_hash||"",this.repo_type=e.repo_type||Dn.Driver,this.username=e.username||"",this.password=e.password||"",this.root_path=e.root_path||""}}const Q="repositories";function en(t){return new li(t)}function ju(t={}){return A({query_params:t,fn:en,path:Q})}function Lu(t,e={}){return $({id:t,query_params:e,fn:en,path:Q})}function Hu(t,e,n="patch"){return M({id:t,form_data:e,query_params:{},method:n,fn:en,path:Q})}function zu(t){return I({form_data:t,query_params:{},fn:en,path:Q})}function Bu(t,e={}){return E({id:t,query_params:e,path:Q})}function Wu(t={}){return $({id:"interfaces",query_params:t,path:Q})}function Qu(t){return $({id:"remote_default_branch",query_params:t,path:Q})}function Zu(t){return $({id:"remote_branches",query_params:t,path:Q})}function Vu(t){return $({id:"remote_commits",query_params:t,path:Q})}function Ku(t,e){return y({id:t,task_name:"drivers",form_data:e,method:"get",path:Q})}function Yu(t,e){return y({id:t,task_name:"commits",form_data:e,method:"get",path:Q})}function Ju(t){return y({id:t,task_name:"branches",method:"get",path:Q})}function Gu(t){return y({id:t,task_name:"default_branch",method:"get",path:Q})}function Xu(t,e){return y({id:t,task_name:"details",form_data:e,method:"get",path:Q})}function ec(t,e){return y({id:t,task_name:"pull",form_data:e,method:"post",path:Q})}class hi extends F{type="saml";authority_id;issuer;idp_sso_target_url_runtime_params;name_identifier_format;uid_attribute;assertion_consumer_service_url;idp_sso_target_url;idp_cert;idp_cert_fingerprint;attribute_service_name;attribute_statements;request_attributes;idp_slo_target_url;slo_default_relay_state;constructor(e={}){super(e),this.authority_id=e.authority_id||"",this.issuer=e.issuer||"",this.idp_sso_target_url_runtime_params=e.idp_sso_target_url_runtime_params||{},this.name_identifier_format=e.name_identifier_format||"",this.uid_attribute=e.uid_attribute||"",this.assertion_consumer_service_url=e.assertion_consumer_service_url||"",this.idp_sso_target_url=e.idp_sso_target_url||"",this.idp_cert=e.idp_cert||"",this.idp_cert_fingerprint=e.idp_cert_fingerprint||"",this.attribute_service_name=e.attribute_service_name||"",this.attribute_statements=e.attribute_statements||{},this.request_attributes=e.request_attributes||[],this.idp_slo_target_url=e.idp_slo_target_url||"",this.slo_default_relay_state=e.slo_default_relay_state||""}}const st="saml_auths";function tn(t){return new hi(t)}function tc(t={}){return A({query_params:t,fn:tn,path:st})}function nc(t,e={}){return $({id:t,query_params:e,fn:tn,path:st})}function rc(t,e,n="patch"){return M({id:t,form_data:e,query_params:{},method:n,fn:tn,path:st})}function ic(t){return I({form_data:t,query_params:{},fn:tn,path:st})}function oc(t,e={}){return E({id:t,query_params:e,path:st})}const Ce="settings";function ut(t){return new de(t)}function sc(t={}){return A({query_params:t,fn:ut,path:Ce})}function uc(t,e={}){return $({id:t,query_params:e,fn:ut,path:Ce})}function cc(t,e,n={},r="patch"){return M({id:t,form_data:e,query_params:n,method:r,fn:ut,path:Ce})}function ac(t,e={}){return I({form_data:t,query_params:e,fn:ut,path:Ce})}function lc(t,e={}){return E({id:t,query_params:e,path:Ce})}function hc(t,e={}){return y({id:t,task_name:"history",form_data:e,method:"get",callback:n=>n.map(r=>ut(r)),path:Ce})}const q="systems";function we(t){return new Mn(t)}function fc(t={}){return A({query_params:t,fn:we,path:q})}function dc(t={}){return A({query_params:t,fn:we,path:`${q}/with_emails`})}function pc(t,e={}){return $({id:t,query_params:e,fn:we,path:q})}function mc(t,e,n="patch"){return M({id:t,form_data:e,query_params:{},method:n,fn:we,path:q})}function _c(t){return I({form_data:t,query_params:{},fn:we,path:q})}function yc(t,e={}){return E({id:t,query_params:e,path:q})}function gc(t,e,n={}){return y({id:t,task_name:`module/${e}`,form_data:n,method:"put",callback:r=>we(r),path:q})}function vc(t,e){return y({id:t,task_name:`module/${e}`,form_data:{},method:"del",callback:n=>we(n),path:q})}function bc(t){return y({id:t,task_name:"start",form_data:{},path:q})}function Sc(t){return y({id:t,task_name:"stop",path:q})}function kc(t,e,n,r=1,i=[]){return y({id:t,task_name:`${n}_${r}/${encodeURIComponent(e)}`,form_data:i,path:q})}function xc(t,e,n=1){return y({id:t,task_name:`${e}_${n}`,method:"get",path:q})}function $c(t,e,n=1,r){return y({id:t,task_name:`${e}_${n}/${r}`,method:"get",path:q})}function Ac(t,e,n=1){return y({id:t,task_name:`functions/${e}_${n}`,method:"get",path:q})}function wc(t){return A({query_params:{},fn:e=>new Jt(e),path:`${q}/${t}/zones`})}function Pc(t){return A({query_params:{},fn:e=>new $e(e),path:`${q}/${t}/triggers`})}function Tc(t,e){return y({id:t,task_name:"triggers",form_data:e,method:"post",callback:n=>new $e(n),path:q})}function Oc(t,e){return y({id:t,task_name:`triggers/${e}`,method:"del",path:q})}function Ec(t){return y({id:t,task_name:"settings",method:"get",callback:e=>e.map(n=>new de(n)),path:q})}const Ne="triggers";function nn(t){return new $e(t)}function Ic(t={}){return A({query_params:t,fn:nn,path:Ne})}function Mc(t,e={}){return $({id:t,query_params:e,fn:nn,path:Ne})}function Rc(t,e,n="patch"){return M({id:t,form_data:e,query_params:{},method:n,fn:nn,path:Ne})}function Dc(t){return I({form_data:t,query_params:{},fn:nn,path:Ne})}function qc(t,e={}){return E({id:t,query_params:e,path:Ne})}function Uc(t){return y({id:t,task_name:"instances",form_data:{},method:"get",callback:e=>e.map(n=>new $e(n)),path:Ne})}var fi=(t=>(t.EQ="equal",t.NEQ="not_equal",t.GT="greater_than",t.GTE="greater_than_or_equal",t.LT="less_than",t.LTE="less_than_or_equal",t.AND="and",t.OR="or",t.XOR="exclusive_or",t))(fi||{}),di=(t=>(t.AT="at",t.CRON="cron",t))(di||{}),pi=(t=>(t[t.ExecuteBefore=0]="ExecuteBefore",t[t.ExecuteAfter=1]="ExecuteAfter",t[t.PayloadOnly=2]="PayloadOnly",t[t.IgnorePayload=3]="IgnorePayload",t))(pi||{});class mi extends F{email_digest;authority_id;email;phone;country;building;groups;image;metadata;login_name;staff_id;first_name;last_name;support;sys_admin;ui_theme;card_number;department;work_preferences;work_overrides;photo_upload_id;locatable;password="";confirm_password="";constructor(e={}){super(e),this.authority_id=e.authority_id||"",this.email=e.email||"",this.email_digest=e.email_digest||"",this.phone=e.phone||"",this.country=e.country||"",this.building=e.building||"",this.image=e.image||"",this.metadata=e.metadata||"",this.login_name=e.login_name||"",this.staff_id=e.staff_id||"",this.first_name=e.first_name||"",this.last_name=e.last_name||"",this.support=!!e.support,this.sys_admin=!!e.sys_admin,this.ui_theme=e.ui_theme||"",this.card_number=e.card_number||"",this.groups=e.groups||[],this.department=e.department||"",this.photo_upload_id=e.photo_upload_id||"",this.work_preferences=e.work_preferences||[],this.work_overrides=e.work_overrides||{},this.locatable=e.locatable??!0}}const Fe="users";function ct(t){return new mi(t)}function Cc(t={}){return A({query_params:t,fn:ct,path:Fe})}function Nc(t,e={}){return $({id:t,query_params:e,fn:ct,path:Fe})}function Fc(t={}){return $({id:"current",query_params:t,fn:ct,path:Fe})}function jc(t,e,n="patch"){return M({id:t,form_data:e,query_params:{},method:n,fn:ct,path:Fe})}function Lc(t){return I({form_data:t,query_params:{},fn:ct,path:Fe})}function Hc(t,e={}){return E({id:t,query_params:e,path:Fe})}const pe="zones";function rn(t){return new Jt(t)}function zc(t={}){return A({query_params:t,fn:rn,path:pe})}function Bc(t={}){return $({id:"tags",query_params:t,fn:e=>e,path:pe})}function Wc(t,e={}){return $({id:t,query_params:e,fn:rn,path:pe})}function Qc(t,e,n="patch"){return M({id:t,form_data:e,query_params:{},method:n,fn:rn,path:pe})}function Zc(t){return I({form_data:t,query_params:{},fn:rn,path:pe})}function Vc(t,e={}){return E({id:t,query_params:e,path:pe})}function Kc(t,e={}){return A({query_params:e,fn:n=>new $e(n),path:`${pe}/${t}/triggers`})}function Yc(t,e,n,r=1,i=[]){return y({id:t,task_name:`exec/${encodeURIComponent(n+"_"+r)}/${encodeURIComponent(e)}`,form_data:i,path:pe})}var qn=(t=>(t[t.Default=0]="Default",t[t.Cut=1]="Cut",t[t.CrossFade=2]="CrossFade",t[t.SlideTop=3]="SlideTop",t[t.SlideLeft=4]="SlideLeft",t[t.SlideRight=5]="SlideRight",t[t.SlideBottom=6]="SlideBottom",t))(qn||{});class _i{id;created_at;updated_at;name;description;authority_id;start_time;play_time;video_length;animation;media_type;orientation;media_uri;media_id;thumbnail_id;play_count;valid_from;valid_until;get media_url(){return this.media_id?`/api/engine/v2/uploads/${this.media_id}/url`:this.media_uri}get thumbnail_url(){return`/api/engine/v2/uploads/${this.thumbnail_id}/url`}constructor(e){this.id=e.id||"",this.created_at=e.created_at||Gn(Date.now()),this.updated_at=e.updated_at||Gn(Date.now()),this.name=e.name||"",this.description=e.description||"",this.authority_id=e.authority_id||"",this.start_time=e.start_time||0,this.play_time=e.play_time||0,this.video_length=e.video_length||0,this.animation=e.animation,this.media_type=e.media_type||"unknown",this.orientation=e.orientation||"unspecified",this.media_uri=e.media_uri||"",this.media_id=e.media_id||"",this.thumbnail_id=e.thumbnail_id||"",this.play_count=e.play_count||0,this.valid_from=e.valid_from,this.valid_until=e.valid_until}}class on{id;playlist_id;items;created_at;updated_at;user_id;user_name;user_email;approved;approved_by_id;approved_by_email;approved_by_name;constructor(e={}){this.id=e.id||"",this.playlist_id=e.playlist_id||"",this.created_at=e.created_at||0,this.updated_at=e.updated_at||0,this.items=e.items||[],this.approved=!!e.approved,this.approved_by_id=e.approved_by_id||"",this.approved_by_email=e.approved_by_email||"",this.approved_by_name=e.approved_by_name||"",this.user_id=e.user_id||"",this.user_name=e.user_name||"",this.user_email=e.user_email||""}}class yi{id;created_at;updated_at;name;description;authority_id;orientation;play_count;play_through_count;default_animation;random;enabled;default_duration;play_hours;play_at;play_cron;valid_from;valid_until;constructor(e){this.id=e.id||"",this.created_at=e.created_at||0,this.updated_at=e.updated_at||0,this.name=e.name||"",this.description=e.description||"",this.authority_id=e.authority_id||"",this.orientation=e.orientation||"",this.play_count=e.play_count||0,this.play_through_count=e.play_through_count||0,this.default_animation=e.default_animation||qn.Cut,this.random=e.random||!1,this.enabled=e.enabled??!0,this.default_duration=e.default_duration??15*1e3,this.valid_from=e.valid_from,this.valid_until=e.valid_until,this.play_hours=e.play_hours||"",this.play_at=e.play_at||"",this.play_cron=e.play_cron||""}}const gi="signage";function Jc(t,e={},n){return $({id:t,query_params:e,fn:r=>r,path:`${gi}`,options:n})}function Gc(t){return y({id:t,task_name:"metrics",form_data:{},method:"post",callback:e=>e,path:gi})}const at="signage/media";function sn(t){return new _i(t)}function Xc(t={}){return A({query_params:t,fn:sn,path:at})}function ea(t,e={}){return $({id:t,query_params:e,fn:sn,path:at})}function ta(t,e,n="patch"){return M({id:t,form_data:e,query_params:{},method:n,fn:sn,path:at})}function na(t){return I({form_data:t,query_params:{},fn:sn,path:at})}function ra(t,e={}){return E({id:t,query_params:e,path:at})}const se="signage/playlists";function un(t){return new yi(t)}function ia(t={}){return A({query_params:t,fn:un,path:se})}function oa(t,e={}){return $({id:t,query_params:e,fn:un,path:se})}function sa(t,e,n="patch"){return M({id:t,form_data:e,query_params:{},method:n,fn:un,path:se})}function ua(t){return I({form_data:t,query_params:{},fn:un,path:se})}function ca(t,e={}){return E({id:t,query_params:e,path:se})}function aa(t,e={}){return y({id:t,task_name:"media",form_data:e,method:"get",callback:n=>new on(n),path:se})}function la(t,e={}){return y({id:t,task_name:"media/revisions",form_data:e,method:"get",callback:n=>n.map(r=>new on(r)),path:se})}function ha(t){return y({id:t,task_name:"media/approve",method:"post",path:se})}function fa(t,e){return y({id:t,task_name:"media",form_data:e,method:"post",path:se,callback:n=>new on(n)})}class Un{id;question_id;survey_id;type;answer_json;constructor(e){this.id=e.id||0,this.question_id=e.question_id||0,this.survey_id=e.survey_id||0,this.type=e.type||"",this.answer_json=e.answer_json||{}}}const vi="/api/staff/v1/surveys/answers";function da(t={}){const e=H(t);return X(`${vi}${e?"?"+e:""}`).pipe(O(n=>n.map(r=>new Un(r))))}function pa(t){return ke(`${vi}`,t).pipe(O(e=>e.map(n=>new Un(n))))}class lt{id;survey_id;token;email;sent;constructor(e){this.id=e.id||0,this.survey_id=e.survey_id||0,this.token=e.token||"",this.email=e.email||"",this.sent=e.sent??!1}}const ht="/api/staff/v1/surveys/invitations";function ma(t={}){const e=H(t);return X(`${ht}${e?"?"+e:""}`).pipe(O(n=>n.map(r=>new lt(r))))}function _a(t,e={}){const n=H(e);return X(`${ht}/${t}${n?"?"+n:""}`).pipe(O(r=>new lt(r)))}function ya(t,e,n="patch"){return(n==="put"?Re:Ye)(`${ht}/${t}`,e).pipe(O(r=>new lt(r)))}function ga(t){return ke(`${ht}`,t).pipe(O(e=>new lt(e)))}function va(t,e={}){const n=H(e);return De(`${ht}/${t}${n?"?"+n:""}`)}class ft{id;title;description;type;options;required;max_rating;choices;tags;deleted;constructor(e){this.id=e.id||0,this.title=e.title||"",this.description=e.description||"",this.type=e.type||"",this.options=e.options||{},this.required=e.required||!1,this.max_rating=e.max_rating||0,this.choices=e.choices||[],this.tags=e.tags||[],this.deleted=e.deleted||!1}}const dt="/api/staff/v1/surveys/questions";function ba(t={}){const e=H(t);return X(`${dt}${e?"?"+e:""}`).pipe(O(n=>n.map(r=>new ft(r))))}function Sa(t,e={}){const n=H(e);return X(`${dt}/${t}${n?"?"+n:""}`).pipe(O(r=>new ft(r)))}function ka(t){return ke(`${dt}`,t).pipe(O(e=>new ft(e)))}function xa(t,e,n="patch"){return(n==="put"?Re:Ye)(`${dt}/${t}`,e).pipe(O(r=>new ft(r)))}function $a(t,e={}){const n=H(e);return De(`${dt}/${t}${n?"?"+n:""}`)}class pt{id;title;description;trigger;building_id;zone_id;pages;constructor(e){this.id=e.id||0,this.title=e.title||"",this.description=e.description||"",this.building_id=e.building_id||"",this.zone_id=e.zone_id||"",this.pages=e.pages||[],this.trigger=e.trigger||"NONE"}}const mt="/api/staff/v1/surveys";function Aa(t={}){const e=H(t);return X(`${mt}${e?"?"+e:""}`).pipe(O(n=>n.map(r=>new pt(r))))}function wa(t,e={}){const n=H(e);return X(`${mt}/${t}${n?"?"+n:""}`).pipe(O(r=>new pt(r)))}function Pa(t,e,n="patch"){return(n==="put"?Re:Ye)(`${mt}/${t}`,e).pipe(O(r=>new pt(r)))}function Ta(t){return ke(`${mt}`,t).pipe(O(e=>new pt(e)))}function Oa(t,e={}){const n=H(e);return De(`${mt}/${t}${n?"?"+n:""}`)}var Ea={url:"",deserializer:function(t){return JSON.parse(t.data)},serializer:function(t){return JSON.stringify(t)}},Ia="WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }",Ma=function(t){G(e,t);function e(n,r){var i=t.call(this)||this;if(i._socket=null,n instanceof D)i.destination=r,i.source=n;else{var o=i._config=Be({},Ea);if(i._output=new ge,typeof n=="string")o.url=n;else for(var s in n)n.hasOwnProperty(s)&&(o[s]=n[s]);if(!o.WebSocketCtor&&WebSocket)o.WebSocketCtor=WebSocket;else if(!o.WebSocketCtor)throw new Error("no WebSocket constructor can be found");i.destination=new an}return i}return e.prototype.lift=function(n){var r=new e(this._config,this.destination);return r.operator=n,r.source=this,r},e.prototype._resetState=function(){this._socket=null,this.source||(this.destination=new an),this._output=new ge},e.prototype.multiplex=function(n,r,i){var o=this;return new D(function(s){try{o.next(n())}catch(c){s.error(c)}var u=o.subscribe({next:function(c){try{i(c)&&s.next(c)}catch(l){s.error(l)}},error:function(c){return s.error(c)},complete:function(){return s.complete()}});return function(){try{o.next(r())}catch(c){s.error(c)}u.unsubscribe()}})},e.prototype._connectSocket=function(){var n=this,r=this._config,i=r.WebSocketCtor,o=r.protocol,s=r.url,u=r.binaryType,c=this._output,l=null;try{l=o?new i(s,o):new i(s),this._socket=l,u&&(this._socket.binaryType=u)}catch(_){c.error(_);return}var m=new be(function(){n._socket=null,l&&l.readyState===1&&l.close()});l.onopen=function(_){var p=n._socket;if(!p){l.close(),n._resetState();return}var a=n._config.openObserver;a&&a.next(_);var f=n.destination;n.destination=Ut.create(function(h){if(l.readyState===1)try{var S=n._config.serializer;l.send(S(h))}catch(g){n.destination.error(g)}},function(h){var S=n._config.closingObserver;S&&S.next(void 0),h&&h.code?l.close(h.code,h.reason):c.error(new TypeError(Ia)),n._resetState()},function(){var h=n._config.closingObserver;h&&h.next(void 0),l.close(),n._resetState()}),f&&f instanceof an&&m.add(f.subscribe(n.destination))},l.onerror=function(_){n._resetState(),c.error(_)},l.onclose=function(_){l===n._socket&&n._resetState();var p=n._config.closeObserver;p&&p.next(_),_.wasClean?c.complete():c.error(_)},l.onmessage=function(_){try{var p=n._config.deserializer;c.next(p(_))}catch(a){c.error(a)}}},e.prototype._subscribe=function(n){var r=this,i=this.source;return i?i.subscribe(n):(this._socket||this._connectSocket(),this._output.subscribe(n),n.add(function(){var o=r._socket;r._output.observers.length===0&&(o&&(o.readyState===1||o.readyState===0)&&o.close(),r._resetState())}),n)},e.prototype.unsubscribe=function(){var n=this._socket;n&&(n.readyState===1||n.readyState===0)&&n.close(),this._resetState(),t.prototype.unsubscribe.call(this)},e}(pn);function Ra(t){return new Ma(t)}var J=(t=>(t[t.PARSE_ERROR=0]="PARSE_ERROR",t[t.BAD_REQUEST=1]="BAD_REQUEST",t[t.ACCESS_DENIED=2]="ACCESS_DENIED",t[t.REQUEST_FAILED=3]="REQUEST_FAILED",t[t.UNKNOWN_CMD=4]="UNKNOWN_CMD",t[t.SYS_NOT_FOUND=5]="SYS_NOT_FOUND",t[t.MOD_NOT_FOUND=6]="MOD_NOT_FOUND",t[t.UNEXPECTED_FAILURE=7]="UNEXPECTED_FAILURE",t))(J||{}),Cn=(t=>(t.Info="info",t.Debug="debug",t.Warning="warn",t.Error="error",t.Fatal="fatal",t.Trace="trace",t))(Cn||{});class bi{constructor(e,n){this._system=e;const r=Object.getOwnPropertyNames(Object.getPrototypeOf(n)).filter(i=>i.startsWith("$"));for(const i in n)n.hasOwnProperty(i)&&n[i]!==void 0&&(n[i]instanceof Function?this.addMethod(i,n[i]):this.addProperty(i,n[i]));for(const i of r)n[i]instanceof Function&&this.addMethod(i,n[i])}call(e,n=[]){return this[`$${e}`]instanceof Function?this[`$${e}`](...n):null}listen(e){return!this[`_${e}`]&&!(this[`_${e}_obs`]instanceof D)&&!this[e]&&this.addProperty(e,null),this[`_${e}_obs`]}addMethod(e,n){e[0]!=="$"&&(e=`$${e}`),this[e]=n}addProperty(e,n){e[0]==="$"&&(e=e.replace("$","")),this[`_${e}`]=new he(n),this[`_${e}_obs`]=this[`_${e}`].asObservable(),Object.defineProperty(this,e,{get:()=>this[`_${e}`].getValue(),set:r=>this[`_${e}`].next(r)})}}class Si{constructor(e){for(const n in e)e.hasOwnProperty(n)&&e[n]&&e[n]instanceof Array&&e[n].forEach(r=>{this.addModule(n,r)})}addModule(e,n){this[e]||(this[e]=[]),this[e].push(new bi(this,n))}}const Rt={};function Da(t,e){return Rt[t]=new Si(e),Rt[t]}function ki(t){return Rt[t]}function qa(t){delete Rt[t]}const xi=15;let _t=0,V,$i=0;const z={},Nn={},Pe={},Ua={},me=new he(!1);Pe._place_os_status=me.asObservable();const Ai=new he([0,0]);Pe._place_os_sync=Ai.asObservable();let wi=Date.now(),Ee,Dt=0,ue=null,xt,Fn=0;const yt=10*1e3,jn=new ge;Pe._place_os_debug_events=jn.asObservable();function $t(){return fe().indexOf("/control/")>=0?"/control/websocket":`${$n()}/systems/control`}function Ln(){return me.getValue()}function Pi(){return Pe._place_os_status}function Ca(){return Pe._place_os_sync}function Ti(t,e=Nn,n=Pe){const r=`${t.sys}|${t.mod}_${t.index}|${t.name}`;return e[r]||(e[r]=new he(void 0),n[r]=e[r].asObservable()),n[r]}function Oi(t,e=Nn){const n=`${t.sys}|${t.mod}_${t.index}|${t.name}`;if(e[n])return e[n].getValue()}function _n(t,e=0,n=je){const r={id:++_t,cmd:"bind",...t};return n(r,e)}function Ei(t,e=0,n=je){const r={id:++_t,cmd:"unbind",...t};return n(r,e)}function Ii(t,e=yt,n=je){const r={id:++_t,cmd:"exec",...t};return n(r,e)}function Na(t,e=yt,n=je){const r={id:++_t,cmd:"debug",...t};return n(r,e)}function Fa(t,e=yt,n=je){const r={id:++_t,cmd:"ignore",...t};return n(r,e)}function je(t,e=yt,n=0){const r=`${t.cmd}|${t.sys}|${t.mod}${t.index}|${t.name}|${t.args}|${qr()}`;if(z[r])d("WS","Request already in progress. Waiting...",t);else{const i={...t,key:r};i.promise=new Promise((o,s)=>{const u=()=>{delete z[r],z[r]=null,je(t,e,n).then(c=>o(c),c=>s(c))};if(V&&Ln()){Nt()&&Qa(t,V,Ua),i.resolve=o,i.reject=s;const c=`${t.sys}, ${t.mod}_${t.index}, ${t.name}`;d("WS",`[${t.cmd.toUpperCase()}](${t.id}) ${c}`,t.args),V.next(t),e>0&&ne(`${r}`,()=>{s("Request timed out."),delete z[r],z[r]=null},e)}else ue?setTimeout(()=>u(),1e3):Hn().then(()=>u())}),z[r]=i}return z[r].promise}function Mi(t){if(t!=="pong"&&t instanceof Object){if(t.type==="notify"&&t.meta)Ha(t.meta,t.value);else if(t.type==="success")ja(t);else if(t.type==="debug"){d("WS",`[DEBUG] ${t.mod}${t.klass||""} →`,t.msg);const e=t.meta||{mod:"",index:""};jn.next({mod_id:t.mod||"<empty>",module:`${e.mod}_${e.index}`,class_name:t.klass||"<empty>",message:t.msg||"<empty>",level:t.level||Cn.Debug,time:Math.floor(new Date().getTime()/1e3)})}else t.type==="error"?La(t):t.cmd||d("WS","Invalid websocket message",t,"error");Se(`${t.id}`)}else t==="pong"&&(Fn=Date.now(),d("WS","Pong!"))}function ja(t){const e=Object.keys(z).map(n=>z[n]).find(n=>n?.id===t.id);d("WS",`[SUCCESS](${t.id})`),e&&e.resolve&&(e.resolve(t.value),delete z[e.key])}function La(t){let e="UNEXPECTED FAILURE";switch(t.code){case J.ACCESS_DENIED:e="ACCESS DENIED";break;case J.BAD_REQUEST:e="BAD REQUEST";break;case J.MOD_NOT_FOUND:e="MODULE NOT FOUND";break;case J.SYS_NOT_FOUND:e="SYSTEM NOT FOUND";break;case J.PARSE_ERROR:e="PARSE ERROR";break;case J.REQUEST_FAILED:e="REQUEST FAILED";break;case J.UNKNOWN_CMD:e="UNKNOWN COMMAND";break}d("WS",`[ERROR] ${e}(${t.id}): ${t.msg}`,void 0,"error");const n=Object.keys(z).map(r=>z[r]).filter(r=>r).find(r=>r.id===t.id);n&&n.reject&&(n.reject(t),Se(`${n.key}`),delete z[n.key])}function Ha(t,e,n=Nn,r=Pe){const i=`${t.sys}|${t.mod}_${t.index}|${t.name}`;n[i]||(n[i]=new he(null),r[i]=n[i].asObservable());const o=`${t.sys}, ${t.mod}_${t.index}, ${t.name}`;d("WS",`[NOTIFY] ${o} changed`,[n[i].getValue(),"→",e]),n[i].next(e)}function Hn(t=0){return ue==null&&(ue=new Promise(e=>{if(t>40)return location.reload();Dt++,wi=Date.now(),V=Nt()?Wa():za(),V?(d("WS(Debug)","Authority:",[Ze()]),d("WS","Connecting to websocket..."),V.subscribe(n=>{me.getValue()||(d("WS","Connection established."),e()),me.next(!0),Dt=0,ln(),Mi(n)},n=>{V=void 0,ue=null,ir(),ln(),Ba(n)},()=>{V=void 0,ue=null,ir(),d("WS","Connection closed by browser."),me.next(!1),qt()}),Ee&&clearInterval(Ee),Fn=Date.now(),rr(),Ee=setInterval(()=>rr(),xi*1e3),ln(),$i+=1,xt=setTimeout(()=>{d("WS","Unhealthy connection. Reconnecting..."),me.next(!1),ue=null,qt()},30*1e3)):(V?d("WS",`Waiting on auth(${t}). Retrying in ${1e3*Math.min(10,t+1)}ms...`,[!!Z(),!!Ze()],"info"):d("WS",`Failed to create websocket(${t}). Retrying in ${1e3*Math.min(10,t+1)}ms...`,void 0,"error"),setTimeout(()=>{ue=null,Hn(t).then(n=>e(n))},1e3*Math.min(10,++t)))})),ue}function za(){if(!Ze()||!Z())return null;const t=jr()||location.protocol.indexOf("https")>=0;let e=`ws${t?"s":""}://${It()}${$t()}${An()?"?fixed_device=true":""}`;const n=Z();let r=n==="x-api-key"?`api-key=${Ke()}`:`bearer_token=${n}`;return!Wo()&&!Rr()?(d("WS","Authenticating through cookie..."),r+=`;max-age=120;path=${$t()};`,r+=`${t?"secure;":""}samesite=strict`,document.cookie=r,d("WS","Cookies:",[document.cookie,r])):(d("WS","Authenticating through URL query parameter..."),e+=`${e.indexOf("?")>=0?"&":"?"}${r}`),d("WS",`Creating websocket connection to ws${t?"s":""}://${It()}${$t()}`),Ra({url:e,serializer:i=>typeof i=="object"?JSON.stringify(i):i,deserializer:i=>{let o=i.data;if(o==="pong")return o;try{return JSON.parse(i.data)}catch{return o}}})}function qt(){Ai.next([$i,Date.now()-wi]),V&&Ln()&&(V.complete(),Ee&&(clearInterval(Ee),Ee=void 0)),d("WS",`Reconnecting in ${Math.min(5e3,Dt*300||1e3)}ms...`),ne("reconnect",()=>Hn(),Math.min(5e3,(Dt+1)*300||1e3))}function rr(){if(Date.now()-Fn>4*xi*1e3)return qt();V?.next("ping")}function Ba(t){me.next(!1),d("WS","Websocket error:",t,void 0,"error"),t.status===401&&jt(),wn(),qt()}function ln(){xt&&(clearTimeout(xt),xt=void 0)}function Wa(){const t=new ge;return t.subscribe(e=>Mi(e)),t}function Qa(t,e,n){const r=`${t.sys}|${t.mod}_${t.index}|${t.name}`,i=ki(t.sys),o=i&&i[t.mod]?i[t.mod][t.index-1||0]:null;if(o){switch(t.cmd){case"bind":n[r]=o.listen(t.name).subscribe(s=>{setTimeout(()=>{e.next({type:"notify",value:s,meta:t})},Math.floor(Math.random()*100+50))});break;case"unbind":n[r]&&(n[r].unsubscribe(),delete n[r],Se(`${r}`));break}ne(`${t.id}-response`,()=>{const s={id:t.id,type:"success",value:t.cmd==="exec"?o.call(t.name,t.args):null};e.next(s)},10)}else ne(`${t.id}-error`,()=>e.next({id:t.id,type:"error",code:i?J.SYS_NOT_FOUND:J.MOD_NOT_FOUND}),10)}function ir(){for(const t in z)z[t]&&delete z[t]}class yn{constructor(e,n){this._module=e,this.name=n,Pi().pipe($o()).subscribe(r=>{r&&(this._stale_bindings||this._pending===1)?(d("VAR","Re-binding to status variable",this.binding()),this.rebind()):r||(Se(`rebind:${JSON.stringify(this.binding())}`),d("VAR","Binding dropped due to disconnection, re-binding when possible.",this.binding()),this._stale_bindings=this._binding_count||this._stale_bindings,this._binding_count=0)})}name;_pending=0;_binding_count=0;_stale_bindings=0;get count(){return this._binding_count}get value(){return Oi(this.binding())}listen(){return Ti(this.binding())}subscribe(e){return this.listen().subscribe(e)}bindThenSubscribe(e){const n=this.bind();return this.listen().subscribe({next:e,complete:()=>n(),error:()=>n()})}bind(){return(this._binding_count<=0&&this._stale_bindings<=0||this._pending===2)&&(this._pending=1,_n(this.binding()).then(()=>{this._binding_count++,this._pending=0}).catch(()=>null)),()=>this.unbind()}unbind(){this._binding_count===1&&this._pending===0?(this._pending=2,Ei(this.binding()).then(()=>{this._pending===2&&(this._pending=0),this._binding_count--})):this._binding_count=Math.max(this._binding_count-1,0)}async rebind(){!this._stale_bindings&&this._pending!==1||ne(`rebind:${JSON.stringify(this.binding())}`,async()=>{await _n(this.binding()),this._binding_count=this._stale_bindings||1,this._stale_bindings=0},100)}binding(){return{sys:this._module.system.id,mod:this._module.name,index:this._module.index,name:this.name}}}class Ri{constructor(e,n){this._system=e,this._id=n}_bindings={};get id(){return`${this.name}_${this.index}`}get system(){return this._system}get index(){const n=this._id.split("_").pop();return parseInt(n||"",10)||1}get name(){const e=this._id.split("_");return e.pop(),e.join("_")}binding(e){return this._bindings[e]||(this._bindings[e]=new yn(this,e)),this._bindings[e]}variable(e){return this._bindings[e]||(this._bindings[e]=new yn(this,e)),this._bindings[e]}execute(e,n,r=yt){return Ii({sys:this._system.id,mod:this.name,index:this.index,name:e,args:n},r)}}class Di{id;_module_list={};constructor(e){this.id=e}module(e,n=1){if(!e)throw new Error("Invalid module ID");const r=e.split("_");r.length>1&&Number.isInteger(+r[r.length-1])&&(n=+r[r.length-1],r.pop()),n<1&&(n=1);const i=r.join("_");for(this._module_list[i]||(this._module_list[i]=[]);this._module_list[i].length<n;)this._module_list[i].push(new Ri(this,`${i}_${this._module_list[i].length+1}`));return this._module_list[i][n-1]}}const hn={};function qi(t){return hn[t]||(hn[t]=new Di(t)),hn[t]}function Za(t,e,n=1){return qi(t).module(e,n)}exports.AuthType=ei;exports.EncryptionLevel=xe;exports.MediaAnimation=qn;exports.MockPlaceWebsocketModule=bi;exports.MockPlaceWebsocketSystem=Si;exports.PlaceAlert=Kr;exports.PlaceAlertDashboard=Yr;exports.PlaceApplication=Jr;exports.PlaceCluster=ni;exports.PlaceDomain=oi;exports.PlaceDriver=En;exports.PlaceDriverRole=Ve;exports.PlaceEdge=si;exports.PlaceErrorCodes=J;exports.PlaceLDAPSource=ui;exports.PlaceLogLevel=Cn;exports.PlaceMQTTBroker=ti;exports.PlaceMetadata=In;exports.PlaceModule=Rn;exports.PlaceModuleBinding=Ri;exports.PlaceOAuthSource=ai;exports.PlaceProcess=ri;exports.PlaceRepository=li;exports.PlaceRepositoryType=Dn;exports.PlaceResource=F;exports.PlaceSAMLSource=hi;exports.PlaceSettings=de;exports.PlaceSystem=Mn;exports.PlaceSystemBinding=Di;exports.PlaceTrigger=$e;exports.PlaceUser=mi;exports.PlaceVariableBinding=yn;exports.PlaceZone=Jt;exports.PlaceZoneMetadata=ci;exports.SignageMedia=_i;exports.SignagePlaylist=yi;exports.SignagePlaylistMedia=on;exports.Survey=pt;exports.SurveyAnswer=Un;exports.SurveyInvitation=lt;exports.SurveyQuestion=ft;exports.TriggerConditionOperator=fi;exports.TriggerTimeConditionType=di;exports.TriggerWebhookType=pi;exports.addAlert=As;exports.addAlertDashboard=vs;exports.addAnswer=pa;exports.addApplication=Rs;exports.addBroker=Ns;exports.addDomain=Zs;exports.addDriver=Gs;exports.addEdge=uu;exports.addInvitation=ga;exports.addLDAPSource=du;exports.addMetadata=bu;exports.addModule=wu;exports.addOAuthSource=Nu;exports.addQuestion=ka;exports.addRepository=zu;exports.addSAMLSource=ic;exports.addSettings=ac;exports.addSignageMedia=na;exports.addSignagePlaylist=ua;exports.addSurvey=Ta;exports.addSystem=_c;exports.addSystemModule=gc;exports.addSystemTrigger=Tc;exports.addTrigger=Dc;exports.addUser=Lc;exports.addZone=Zc;exports.apiEndpoint=fe;exports.apiKey=Ke;exports.approveSignagePlaylist=ha;exports.authorise=Pn;exports.authority=Ze;exports.bind=_n;exports.cleanObject=Mr;exports.cleanupAuth=Jo;exports.clientId=Ur;exports.connectionState=Ca;exports.consoleHasColours=mn;exports.convertPairStringToMap=Oe;exports.create=I;exports.currentUser=Fc;exports.debug=Na;exports.debug_events=jn;exports.del=De;exports.deregisterMockEndpoint=Wr;exports.deregisterSystem=qa;exports.driverReadme=ru;exports.execute=Ii;exports.executeOnSystem=kc;exports.executeOnZone=Yc;exports.functionList=Ac;exports.generateNonce=Er;exports.get=X;exports.getFragments=kn;exports.getModule=Za;exports.getSystem=qi;exports.hasToken=Nr;exports.host=It;exports.httpRoute=$n;exports.humanReadableByteCount=Qe;exports.ignore=Fa;exports.invalidateToken=jt;exports.isDriverCompiled=nu;exports.isFixedDevice=An;exports.isMobileSafari=Rr;exports.isMock=Nt;exports.isNestedFrame=Dr;exports.isOnline=Vo;exports.isSecure=jr;exports.isTrusted=Ft;exports.is_connected=Ln;exports.lastRequestTotal=Ts;exports.listChildMetadata=ku;exports.listDashboardAlerts=Ss;exports.listInterfaceRepositories=Wu;exports.listMetadata=mu;exports.listMetadataHistory=yu;exports.listRemoteRepositoryBranches=Zu;exports.listRemoteRepositoryCommits=Vu;exports.listRemoteRepositoryDefaultBranch=Qu;exports.listRepositoryBranches=Ju;exports.listRepositoryCommits=Yu;exports.listRepositoryDefaultBranch=Gu;exports.listRepositoryDriverDetails=Xu;exports.listRepositoryDrivers=Ku;exports.listSignagePlaylistMedia=aa;exports.listSignagePlaylistMediaRevisions=la;exports.listSystemTriggers=Pc;exports.listSystemZones=wc;exports.listTriggerInstances=Uc;exports.listZoneTags=Bc;exports.listZoneTriggers=Kc;exports.listen=Ti;exports.listenForToken=Fr;exports.loadModule=Mu;exports.log=d;exports.logout=Go;exports.lookupModuleState=Iu;exports.lookupSystemModuleState=$c;exports.mockSystem=ki;exports.moduleRuntimeError=Du;exports.moduleSettings=Ru;exports.moduleState=Eu;exports.onlineState=Ko;exports.parseLinkHeader=Ir;exports.patch=Ye;exports.post=ke;exports.pullRepositoryChanges=ec;exports.put=Re;exports.query=A;exports.queryAlertDashboards=_s;exports.queryAlerts=ks;exports.queryAnswers=da;exports.queryApplications=Es;exports.queryBrokers=qs;exports.queryClusters=js;exports.queryDomains=Bs;exports.queryDrivers=Ks;exports.queryEdges=iu;exports.queryInvitations=ma;exports.queryLDAPSources=lu;exports.queryModules=xu;exports.queryOAuthSources=qu;exports.queryProcesses=Hs;exports.queryQuestions=ba;exports.queryRepositories=ju;exports.querySAMLSources=tc;exports.querySettings=sc;exports.querySignageMedia=Xc;exports.querySignagePlaylists=ia;exports.querySurveys=Aa;exports.querySystems=fc;exports.querySystemsWithEmails=dc;exports.queryTriggers=Ic;exports.queryUsers=Cc;exports.queryZones=zc;exports.recompileDriver=eu;exports.redirectUri=Qo;exports.refreshAuthority=wn;exports.refreshToken=Et;exports.registerMockEndpoint=ls;exports.registerSystem=Da;exports.reloadDriver=tu;exports.remove=E;exports.removeAlert=ws;exports.removeAlertDashboard=bs;exports.removeApplication=Ds;exports.removeBroker=Fs;exports.removeDomain=Vs;exports.removeDriver=Xs;exports.removeEdge=cu;exports.removeFragment=ae;exports.removeInvitation=va;exports.removeLDAPSource=pu;exports.removeMetadata=Su;exports.removeModule=Pu;exports.removeOAuthSource=Fu;exports.removeQuestion=$a;exports.removeRepository=Bu;exports.removeSAMLSource=oc;exports.removeSettings=lc;exports.removeSignageMedia=ra;exports.removeSignagePlaylist=ca;exports.removeSurvey=Oa;exports.removeSystem=yc;exports.removeSystemModule=vc;exports.removeSystemTrigger=Oc;exports.removeTrigger=qc;exports.removeUser=Hc;exports.removeZone=Vc;exports.requestTotal=Ps;exports.responseHeaders=Zr;exports.retrieveEdgeToken=au;exports.setAPI_Key=Zo;exports.setMockNotFoundHandler=as;exports.setToken=Cr;exports.settingsHistory=hc;exports.setup=Yo;exports.show=$;exports.showAlert=xs;exports.showAlertDashboard=ys;exports.showApplication=Is;exports.showBroker=Us;exports.showCluster=Ls;exports.showDomain=Ws;exports.showDriver=Ys;exports.showEdge=ou;exports.showInvitation=_a;exports.showLDAPSource=hu;exports.showMetadata=gu;exports.showModule=$u;exports.showOAuthSource=Uu;exports.showQuestion=Sa;exports.showRepository=Lu;exports.showSAMLSource=nc;exports.showSettings=uc;exports.showSignage=Jc;exports.showSignageMedia=ea;exports.showSignageMetrics=Gc;exports.showSignagePlaylist=oa;exports.showSurvey=wa;exports.showSystem=pc;exports.showTrigger=Mc;exports.showUser=Nc;exports.showZone=Wc;exports.simplifiedTime=qr;exports.startModule=Tu;exports.startSystem=bc;exports.status=Pi;exports.stopModule=Ou;exports.stopSystem=Sc;exports.systemModuleState=xc;exports.systemSettings=Ec;exports.terminateProcess=zs;exports.token=Z;exports.unbind=Ei;exports.update=M;exports.updateAlert=$s;exports.updateAlertDashboard=gs;exports.updateApplication=Ms;exports.updateBroker=Cs;exports.updateDomain=Qs;exports.updateDriver=Js;exports.updateEdge=su;exports.updateInvitation=ya;exports.updateLDAPSource=fu;exports.updateMetadata=vu;exports.updateModule=Au;exports.updateOAuthSource=Cu;exports.updateQuestion=xa;exports.updateRepository=Hu;exports.updateSAMLSource=rc;exports.updateSettings=cc;exports.updateSignageMedia=ta;exports.updateSignagePlaylist=sa;exports.updateSignagePlaylistMedia=fa;exports.updateSurvey=Pa;exports.updateSystem=mc;exports.updateTrigger=Rc;exports.updateUser=jc;exports.updateZone=Qc;exports.value=Oi;exports.websocketRoute=$t;
|
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=n}});function Mt(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var ke=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,r,i,s;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var u=qe(o),c=u.next();!c.done;c=u.next()){var l=c.value;l.remove(this)}}catch(h){e={error:h}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(e)throw e.error}}else o.remove(this);var _=this.initialTeardown;if(R(_))try{_()}catch(h){s=h instanceof mn?h.errors:[h]}var m=this._finalizers;if(m){this._finalizers=null;try{for(var p=qe(m),a=p.next();!a.done;a=p.next()){var f=a.value;try{Kn(f)}catch(h){s=s??[],h instanceof mn?s=It(It([],Et(s)),Et(h.errors)):s.push(h)}}}catch(h){r={error:h}}finally{try{a&&!a.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}}if(s)throw new mn(s)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)Kn(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}},t.prototype._hasParent=function(e){var n=this._parentage;return n===e||Array.isArray(n)&&n.includes(e)},t.prototype._addParent=function(e){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e},t.prototype._removeParent=function(e){var n=this._parentage;n===e?this._parentage=null:Array.isArray(n)&&Mt(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&Mt(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),_r=ke.EMPTY;function mr(t){return t instanceof ke||t&&"closed"in t&&R(t.remove)&&R(t.add)&&R(t.unsubscribe)}function Kn(t){R(t)?t():t.unsubscribe()}var Gi={Promise:void 0},Xi={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,It([t,e],Et(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function yr(t){Xi.setTimeout(function(){throw t})}function Gn(){}function wt(t){t()}var Lt=function(t){G(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,mr(n)&&n.add(r)):r.destination=ns,r}return e.create=function(n,r,i){return new Sn(n,r,i)},e.prototype.next=function(n){this.isStopped||this._next(n)},e.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(n){this.destination.next(n)},e.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(ke),es=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(r){xt(r)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(r){xt(r)}else xt(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){xt(n)}},t}(),Sn=function(t){G(e,t);function e(n,r,i){var s=t.call(this)||this,o;return R(n)||!n?o={next:n??void 0,error:r??void 0,complete:i??void 0}:o=n,s.destination=new es(o),s}return e}(Lt);function xt(t){yr(t)}function ts(t){throw t}var ns={closed:!0,next:Gn,error:ts,complete:Gn},wn=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Pn(t){return t}function rs(t){return t.length===0?Pn:t.length===1?t[0]:function(n){return t.reduce(function(r,i){return i(r)},n)}}var D=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(e,n,r){var i=this,s=ss(e)?e:new Sn(e,n,r);return wt(function(){var o=i,u=o.operator,c=o.source;s.add(u?u.call(s,c):c?i._subscribe(s):i._trySubscribe(s))}),s},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},t.prototype.forEach=function(e,n){var r=this;return n=Xn(n),new n(function(i,s){var o=new Sn({next:function(u){try{e(u)}catch(c){s(c),o.unsubscribe()}},error:s,complete:i});r.subscribe(o)})},t.prototype._subscribe=function(e){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(e)},t.prototype[wn]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return rs(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=Xn(e),new e(function(r,i){var s;n.subscribe(function(o){return s=o},function(o){return i(o)},function(){return r(s)})})},t.create=function(e){return new t(e)},t}();function Xn(t){var e;return(e=t??Gi.Promise)!==null&&e!==void 0?e:Promise}function is(t){return t&&R(t.next)&&R(t.error)&&R(t.complete)}function ss(t){return t&&t instanceof Lt||is(t)&&mr(t)}function os(t){return R(t?.lift)}function ie(t){return function(e){if(os(e))return e.lift(function(n){try{return t(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function Y(t,e,n,r,i){return new us(t,e,n,r,i)}var us=function(t){G(e,t);function e(n,r,i,s,o,u){var c=t.call(this,n)||this;return c.onFinalize=o,c.shouldUnsubscribe=u,c._next=r?function(l){try{r(l)}catch(_){n.error(_)}}:t.prototype._next,c._error=s?function(l){try{s(l)}catch(_){n.error(_)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=i?function(){try{i()}catch(l){n.error(l)}finally{this.unsubscribe()}}:t.prototype._complete,c}return e.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},e}(Lt),cs=pr(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),be=function(t){G(e,t);function e(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return e.prototype.lift=function(n){var r=new kn(this,this);return r.operator=n,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new cs},e.prototype.next=function(n){var r=this;wt(function(){var i,s;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var o=qe(r.currentObservers),u=o.next();!u.done;u=o.next()){var c=u.value;c.next(n)}}catch(l){i={error:l}}finally{try{u&&!u.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}}})},e.prototype.error=function(n){var r=this;wt(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var i=r.observers;i.length;)i.shift().error(n)}})},e.prototype.complete=function(){var n=this;wt(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},e.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},e.prototype._innerSubscribe=function(n){var r=this,i=this,s=i.hasError,o=i.isStopped,u=i.observers;return s||o?_r:(this.currentObservers=null,u.push(n),new ke(function(){r.currentObservers=null,Mt(u,n)}))},e.prototype._checkFinalizedStatuses=function(n){var r=this,i=r.hasError,s=r.thrownError,o=r.isStopped;i?n.error(s):o&&n.complete()},e.prototype.asObservable=function(){var n=new D;return n.source=this,n},e.create=function(n,r){return new kn(n,r)},e}(D),kn=function(t){G(e,t);function e(n,r){var i=t.call(this)||this;return i.destination=n,i.source=r,i}return e.prototype.next=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.next)===null||i===void 0||i.call(r,n)},e.prototype.error=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.error)===null||i===void 0||i.call(r,n)},e.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},e.prototype._subscribe=function(n){var r,i;return(i=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&i!==void 0?i:_r},e}(be),fe=function(t){G(e,t);function e(n){var r=t.call(this)||this;return r._value=n,r}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(n){var r=t.prototype._subscribe.call(this,n);return!r.closed&&n.next(this._value),r},e.prototype.getValue=function(){var n=this,r=n.hasError,i=n.thrownError,s=n._value;if(r)throw i;return this._throwIfClosed(),s},e.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},e}(be),Tn={now:function(){return(Tn.delegate||Date).now()},delegate:void 0},yn=function(t){G(e,t);function e(n,r,i){n===void 0&&(n=1/0),r===void 0&&(r=1/0),i===void 0&&(i=Tn);var s=t.call(this)||this;return s._bufferSize=n,s._windowTime=r,s._timestampProvider=i,s._buffer=[],s._infiniteTimeWindow=!0,s._infiniteTimeWindow=r===1/0,s._bufferSize=Math.max(1,n),s._windowTime=Math.max(1,r),s}return e.prototype.next=function(n){var r=this,i=r.isStopped,s=r._buffer,o=r._infiniteTimeWindow,u=r._timestampProvider,c=r._windowTime;i||(s.push(n),!o&&s.push(u.now()+c)),this._trimBuffer(),t.prototype.next.call(this,n)},e.prototype._subscribe=function(n){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(n),i=this,s=i._infiniteTimeWindow,o=i._buffer,u=o.slice(),c=0;c<u.length&&!n.closed;c+=s?1:2)n.next(u[c]);return this._checkFinalizedStatuses(n),r},e.prototype._trimBuffer=function(){var n=this,r=n._bufferSize,i=n._timestampProvider,s=n._buffer,o=n._infiniteTimeWindow,u=(o?1:2)*r;if(r<1/0&&u<s.length&&s.splice(0,s.length-u),!o){for(var c=i.now(),l=0,_=1;_<s.length&&s[_]<=c;_+=2)l=_;l&&s.splice(0,l+1)}},e}(be),as=function(t){G(e,t);function e(n,r){return t.call(this)||this}return e.prototype.schedule=function(n,r){return this},e}(ke),er={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,It([t,e],Et(n)))},clearInterval:function(t){return clearInterval(t)},delegate:void 0},ls=function(t){G(e,t);function e(n,r){var i=t.call(this,n,r)||this;return i.scheduler=n,i.work=r,i.pending=!1,i}return e.prototype.schedule=function(n,r){var i;if(r===void 0&&(r=0),this.closed)return this;this.state=n;var s=this.id,o=this.scheduler;return s!=null&&(this.id=this.recycleAsyncId(o,s,r)),this.pending=!0,this.delay=r,this.id=(i=this.id)!==null&&i!==void 0?i:this.requestAsyncId(o,this.id,r),this},e.prototype.requestAsyncId=function(n,r,i){return i===void 0&&(i=0),er.setInterval(n.flush.bind(n,this),i)},e.prototype.recycleAsyncId=function(n,r,i){if(i===void 0&&(i=0),i!=null&&this.delay===i&&this.pending===!1)return r;r!=null&&er.clearInterval(r)},e.prototype.execute=function(n,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var i=this._execute(n,r);if(i)return i;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(n,r){var i=!1,s;try{this.work(n)}catch(o){i=!0,s=o||new Error("Scheduled action threw falsy error")}if(i)return this.unsubscribe(),s},e.prototype.unsubscribe=function(){if(!this.closed){var n=this,r=n.id,i=n.scheduler,s=i.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Mt(s,this),r!=null&&(this.id=this.recycleAsyncId(i,r,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(as),tr=function(){function t(e,n){n===void 0&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(e,n,r){return n===void 0&&(n=0),new this.schedulerActionCtor(this,e).schedule(r,n)},t.now=Tn.now,t}(),hs=function(t){G(e,t);function e(n,r){r===void 0&&(r=tr.now);var i=t.call(this,n,r)||this;return i.actions=[],i._active=!1,i}return e.prototype.flush=function(n){var r=this.actions;if(this._active){r.push(n);return}var i;this._active=!0;do if(i=n.execute(n.state,n.delay))break;while(n=r.shift());if(this._active=!1,i){for(;n=r.shift();)n.unsubscribe();throw i}},e}(tr),gr=new hs(ls),fs=gr,ds=new D(function(t){return t.complete()});function ps(t){return t&&R(t.schedule)}var vr=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function br(t){return R(t?.then)}function Sr(t){return R(t[wn])}function kr(t){return Symbol.asyncIterator&&R(t?.[Symbol.asyncIterator])}function Ar(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function _s(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var xr=_s();function $r(t){return R(t?.[xr])}function wr(t){return Ji(this,arguments,function(){var n,r,i,s;return dr(this,function(o){switch(o.label){case 0:n=t.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,Me(n.read())];case 3:return r=o.sent(),i=r.value,s=r.done,s?[4,Me(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,Me(i)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function Pr(t){return R(t?.getReader)}function se(t){if(t instanceof D)return t;if(t!=null){if(Sr(t))return ms(t);if(vr(t))return ys(t);if(br(t))return gs(t);if(kr(t))return Tr(t);if($r(t))return vs(t);if(Pr(t))return bs(t)}throw Ar(t)}function ms(t){return new D(function(e){var n=t[wn]();if(R(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function ys(t){return new D(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function gs(t){return new D(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,yr)})}function vs(t){return new D(function(e){var n,r;try{for(var i=qe(t),s=i.next();!s.done;s=i.next()){var o=s.value;if(e.next(o),e.closed)return}}catch(u){n={error:u}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()})}function Tr(t){return new D(function(e){Ss(t,e).catch(function(n){return e.error(n)})})}function bs(t){return Tr(wr(t))}function Ss(t,e){var n,r,i,s;return Yi(this,void 0,void 0,function(){var o,u;return dr(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=Ki(t),c.label=1;case 1:return[4,n.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(o=r.value,e.next(o),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=c.sent(),i={error:u},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(s=n.return)?[4,s.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function ge(t,e,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var s=e.schedule(function(){n(),i?t.add(this.schedule(null,r)):this.unsubscribe()},r);if(t.add(s),!i)return s}function Or(t,e){return e===void 0&&(e=0),ie(function(n,r){n.subscribe(Y(r,function(i){return ge(r,t,function(){return r.next(i)},e)},function(){return ge(r,t,function(){return r.complete()},e)},function(i){return ge(r,t,function(){return r.error(i)},e)}))})}function Er(t,e){return e===void 0&&(e=0),ie(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function ks(t,e){return se(t).pipe(Er(e),Or(e))}function As(t,e){return se(t).pipe(Er(e),Or(e))}function xs(t,e){return new D(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function $s(t,e){return new D(function(n){var r;return ge(n,e,function(){r=t[xr](),ge(n,e,function(){var i,s,o;try{i=r.next(),s=i.value,o=i.done}catch(u){n.error(u);return}o?n.complete():n.next(s)},0,!0)}),function(){return R(r?.return)&&r.return()}})}function Ir(t,e){if(!t)throw new Error("Iterable cannot be null");return new D(function(n){ge(n,e,function(){var r=t[Symbol.asyncIterator]();ge(n,e,function(){r.next().then(function(i){i.done?n.complete():n.next(i.value)})},0,!0)})})}function ws(t,e){return Ir(wr(t),e)}function Ps(t,e){if(t!=null){if(Sr(t))return ks(t,e);if(vr(t))return xs(t,e);if(br(t))return As(t,e);if(kr(t))return Ir(t,e);if($r(t))return $s(t,e);if(Pr(t))return ws(t,e)}throw Ar(t)}function Ts(t,e){return e?Ps(t,e):se(t)}function Mr(t,e){var n=R(t)?t:function(){return t},r=function(i){return i.error(n())};return new D(r)}function Os(t){return t instanceof Date&&!isNaN(t)}function O(t,e){return ie(function(n,r){var i=0;n.subscribe(Y(r,function(s){r.next(t.call(e,s,i++))}))})}function Es(t,e,n,r,i,s,o,u){var c=[],l=0,_=0,m=!1,p=function(){m&&!c.length&&!l&&e.complete()},a=function(h){return l<r?f(h):c.push(h)},f=function(h){l++;var S=!1;se(n(h,_++)).subscribe(Y(e,function(g){e.next(g)},function(){S=!0},void 0,function(){if(S)try{l--;for(var g=function(){var A=c.shift();o||f(A)};c.length&&l<r;)g();p()}catch(A){e.error(A)}}))};return t.subscribe(Y(e,a,function(){m=!0,p()})),function(){}}function Rr(t,e,n){return n===void 0&&(n=1/0),R(e)?Rr(function(r,i){return O(function(s,o){return e(r,s,i,o)})(se(t(r,i)))},n):(typeof e=="number"&&(n=e),ie(function(r,i){return Es(r,i,t,n)}))}function Dr(t,e,n){t===void 0&&(t=0),n===void 0&&(n=fs);var r=-1;return e!=null&&(ps(e)?n=e:r=e),new D(function(i){var s=Os(t)?+t-n.now():t;s<0&&(s=0);var o=0;return n.schedule(function(){i.closed||(i.next(o++),0<=r?this.schedule(void 0,r):i.complete())},s)})}function Is(t,e){return ie(function(n,r){var i=0;n.subscribe(Y(r,function(s){return t.call(e,s,i++)&&r.next(s)}))})}function qr(t){return t<=0?function(){return ds}:ie(function(e,n){var r=0;e.subscribe(Y(n,function(i){++r<=t&&(n.next(i),t<=r&&n.complete())}))})}function Ms(t){return O(function(){return t})}function Rs(t,e){return Rr(function(n,r){return se(t(n,r)).pipe(qr(1),Ms(n))})}function Ds(t,e){e===void 0&&(e=gr);var n=Dr(t,e);return Rs(function(){return n})}function qs(t,e){return e===void 0&&(e=Pn),t=t??Us,ie(function(n,r){var i,s=!0;n.subscribe(Y(r,function(o){var u=e(o);(s||!t(i,u))&&(s=!1,i=u,r.next(o))}))})}function Us(t,e){return t===e}function Cs(t){t===void 0&&(t=1/0);var e;t&&typeof t=="object"?e=t:e={count:t};var n=e.count,r=n===void 0?1/0:n,i=e.delay,s=e.resetOnSuccess,o=s===void 0?!1:s;return r<=0?Pn:ie(function(u,c){var l=0,_,m=function(){var p=!1;_=u.subscribe(Y(c,function(a){o&&(l=0),c.next(a)},void 0,function(a){if(l++<r){var f=function(){_?(_.unsubscribe(),_=null,m()):p=!0};if(i!=null){var h=typeof i=="number"?Dr(i):se(i(a,l)),S=Y(c,function(){S.unsubscribe(),f()},function(){c.complete()});h.subscribe(S)}else f()}else c.error(a)})),p&&(_.unsubscribe(),_=null,m())};m()})}function nr(t,e){return ie(function(n,r){var i=null,s=0,o=!1,u=function(){return o&&!i&&r.complete()};n.subscribe(Y(r,function(c){i?.unsubscribe();var l=0,_=s++;se(t(c,_)).subscribe(i=Y(r,function(m){return r.next(e?e(c,m,_,l++):m)},function(){i=null,u()}))},function(){o=!0,u()}))})}function On(t,e){e===void 0&&(e={});var n=e.selector,r=Vi(e,["selector"]);return new D(function(i){var s=new AbortController,o=s.signal,u=!0,c=r.signal;if(c)if(c.aborted)s.abort();else{var l=function(){o.aborted||s.abort()};c.addEventListener("abort",l),i.add(function(){return c.removeEventListener("abort",l)})}var _=Ze(Ze({},r),{signal:o}),m=function(p){u=!1,i.error(p)};return fetch(t,_).then(function(p){n?se(n(p)).subscribe(Y(i,void 0,function(){u=!1,i.complete()},m)):(u=!1,i.next(p),i.complete())}).catch(m),function(){u&&s.abort()}})}const ne=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"],rr=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];function $t(t){if(t>=rr.length)throw new Error("Unable to parse base64 string.");const e=rr[t];if(e===255)throw new Error("Unable to parse base64 string.");return e}function Ur(t){let e="",n,r=t.length;for(n=2;n<r;n+=3)e+=ne[t[n-2]>>2],e+=ne[(t[n-2]&3)<<4|t[n-1]>>4],e+=ne[(t[n-1]&15)<<2|t[n]>>6],e+=ne[t[n]&63];return n===r+1&&(e+=ne[t[n-2]>>2],e+=ne[(t[n-2]&3)<<4],e+="=="),n===r&&(e+=ne[t[n-2]>>2],e+=ne[(t[n-2]&3)<<4|t[n-1]>>4],e+=ne[(t[n-1]&15)<<2],e+="="),e}function Ns(t){if(t.length%4!==0)throw new Error("Unable to parse base64 string.");const e=t.indexOf("=");if(e!==-1&&e<t.length-2)throw new Error("Unable to parse base64 string.");let n=t.endsWith("==")?2:t.endsWith("=")?1:0,r=t.length,i=new Uint8Array(3*(r/4)),s;for(let o=0,u=0;o<r;o+=4,u+=3)s=$t(t.charCodeAt(o))<<18|$t(t.charCodeAt(o+1))<<12|$t(t.charCodeAt(o+2))<<6|$t(t.charCodeAt(o+3)),i[u]=s>>16,i[u+1]=s>>8&255,i[u+2]=s&255;return i.subarray(0,i.length-n)}function Fs(t,e=new TextEncoder){return Ur(e.encode(t))}var Pt={exports:{}},js=Pt.exports,ir;function Ls(){return ir||(ir=1,function(t){(function(e,n){var r={};n(r);var i=r.default;for(var s in r)i[s]=r[s];t.exports=i})(js,function(e){e.__esModule=!0,e.digestLength=32,e.blockSize=64;var n=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function r(p,a,f,h,S){for(var g,A,x,B,U,M,te,C,L,N,Be,We,At;S>=64;){for(g=a[0],A=a[1],x=a[2],B=a[3],U=a[4],M=a[5],te=a[6],C=a[7],N=0;N<16;N++)Be=h+N*4,p[N]=(f[Be]&255)<<24|(f[Be+1]&255)<<16|(f[Be+2]&255)<<8|f[Be+3]&255;for(N=16;N<64;N++)L=p[N-2],We=(L>>>17|L<<15)^(L>>>19|L<<13)^L>>>10,L=p[N-15],At=(L>>>7|L<<25)^(L>>>18|L<<14)^L>>>3,p[N]=(We+p[N-7]|0)+(At+p[N-16]|0);for(N=0;N<64;N++)We=(((U>>>6|U<<26)^(U>>>11|U<<21)^(U>>>25|U<<7))+(U&M^~U&te)|0)+(C+(n[N]+p[N]|0)|0)|0,At=((g>>>2|g<<30)^(g>>>13|g<<19)^(g>>>22|g<<10))+(g&A^g&x^A&x)|0,C=te,te=M,M=U,U=B+We|0,B=x,x=A,A=g,g=We+At|0;a[0]+=g,a[1]+=A,a[2]+=x,a[3]+=B,a[4]+=U,a[5]+=M,a[6]+=te,a[7]+=C,h+=64,S-=64}return h}var i=function(){function p(){this.digestLength=e.digestLength,this.blockSize=e.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return p.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},p.prototype.clean=function(){for(var a=0;a<this.buffer.length;a++)this.buffer[a]=0;for(var a=0;a<this.temp.length;a++)this.temp[a]=0;this.reset()},p.prototype.update=function(a,f){if(f===void 0&&(f=a.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var h=0;if(this.bytesHashed+=f,this.bufferLength>0){for(;this.bufferLength<64&&f>0;)this.buffer[this.bufferLength++]=a[h++],f--;this.bufferLength===64&&(r(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(f>=64&&(h=r(this.temp,this.state,a,h,f),f%=64);f>0;)this.buffer[this.bufferLength++]=a[h++],f--;return this},p.prototype.finish=function(a){if(!this.finished){var f=this.bytesHashed,h=this.bufferLength,S=f/536870912|0,g=f<<3,A=f%64<56?64:128;this.buffer[h]=128;for(var x=h+1;x<A-8;x++)this.buffer[x]=0;this.buffer[A-8]=S>>>24&255,this.buffer[A-7]=S>>>16&255,this.buffer[A-6]=S>>>8&255,this.buffer[A-5]=S>>>0&255,this.buffer[A-4]=g>>>24&255,this.buffer[A-3]=g>>>16&255,this.buffer[A-2]=g>>>8&255,this.buffer[A-1]=g>>>0&255,r(this.temp,this.state,this.buffer,0,A),this.finished=!0}for(var x=0;x<8;x++)a[x*4+0]=this.state[x]>>>24&255,a[x*4+1]=this.state[x]>>>16&255,a[x*4+2]=this.state[x]>>>8&255,a[x*4+3]=this.state[x]>>>0&255;return this},p.prototype.digest=function(){var a=new Uint8Array(this.digestLength);return this.finish(a),a},p.prototype._saveState=function(a){for(var f=0;f<this.state.length;f++)a[f]=this.state[f]},p.prototype._restoreState=function(a,f){for(var h=0;h<this.state.length;h++)this.state[h]=a[h];this.bytesHashed=f,this.finished=!1,this.bufferLength=0},p}();e.Hash=i;var s=function(){function p(a){this.inner=new i,this.outer=new i,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var f=new Uint8Array(this.blockSize);if(a.length>this.blockSize)new i().update(a).finish(f).clean();else for(var h=0;h<a.length;h++)f[h]=a[h];for(var h=0;h<f.length;h++)f[h]^=54;this.inner.update(f);for(var h=0;h<f.length;h++)f[h]^=106;this.outer.update(f),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var h=0;h<f.length;h++)f[h]=0}return p.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},p.prototype.clean=function(){for(var a=0;a<this.istate.length;a++)this.ostate[a]=this.istate[a]=0;this.inner.clean(),this.outer.clean()},p.prototype.update=function(a){return this.inner.update(a),this},p.prototype.finish=function(a){return this.outer.finished?this.outer.finish(a):(this.inner.finish(a),this.outer.update(a,this.digestLength).finish(a)),this},p.prototype.digest=function(){var a=new Uint8Array(this.digestLength);return this.finish(a),a},p}();e.HMAC=s;function o(p){var a=new i().update(p),f=a.digest();return a.clean(),f}e.hash=o,e.default=o;function u(p,a){var f=new s(p).update(a),h=f.digest();return f.clean(),h}e.hmac=u;function c(p,a,f,h){var S=h[0];if(S===0)throw new Error("hkdf: cannot expand more");a.reset(),S>1&&a.update(p),f&&a.update(f),a.update(h),a.finish(p),h[0]++}var l=new Uint8Array(e.digestLength);function _(p,a,f,h){a===void 0&&(a=l),h===void 0&&(h=32);for(var S=new Uint8Array([1]),g=u(a,p),A=new s(g),x=new Uint8Array(A.digestLength),B=x.length,U=new Uint8Array(h),M=0;M<h;M++)B===x.length&&(c(x,A,f,S),B=0),U[M]=x[B++];return A.clean(),x.fill(0),S.fill(0),U}e.hkdf=_;function m(p,a,f,h){for(var S=new s(p),g=S.digestLength,A=new Uint8Array(4),x=new Uint8Array(g),B=new Uint8Array(g),U=new Uint8Array(h),M=0;M*g<h;M++){var te=M+1;A[0]=te>>>24&255,A[1]=te>>>16&255,A[2]=te>>>8&255,A[3]=te>>>0&255,S.reset(),S.update(a),S.update(A),S.finish(B);for(var C=0;C<g;C++)x[C]=B[C];for(var C=2;C<=f;C++){S.reset(),S.update(B).finish(B);for(var L=0;L<g;L++)x[L]^=B[L]}for(var C=0;C<g&&M*g+C<h;C++)U[M*g+C]=x[C]}for(var M=0;M<g;M++)x[M]=B[M]=0;for(var M=0;M<4;M++)A[M]=0;return S.clean(),U}e.pbkdf2=m})}(Pt)),Pt.exports}var Hs=Ls();const zs=new Int32Array(4);class W{static hashStr(e,n=!1){return this.onePassHasher.start().appendStr(e).end(n)}static hashAsciiStr(e,n=!1){return this.onePassHasher.start().appendAsciiStr(e).end(n)}static stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]);static buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);static hexChars="0123456789abcdef";static hexOut=[];static onePassHasher=new W;static _hex(e){const n=W.hexChars,r=W.hexOut;let i,s,o,u;for(u=0;u<4;u+=1)for(s=u*8,i=e[u],o=0;o<8;o+=2)r[s+1+o]=n.charAt(i&15),i>>>=4,r[s+0+o]=n.charAt(i&15),i>>>=4;return r.join("")}static _md5cycle(e,n){let r=e[0],i=e[1],s=e[2],o=e[3];r+=(i&s|~i&o)+n[0]-680876936|0,r=(r<<7|r>>>25)+i|0,o+=(r&i|~r&s)+n[1]-389564586|0,o=(o<<12|o>>>20)+r|0,s+=(o&r|~o&i)+n[2]+606105819|0,s=(s<<17|s>>>15)+o|0,i+=(s&o|~s&r)+n[3]-1044525330|0,i=(i<<22|i>>>10)+s|0,r+=(i&s|~i&o)+n[4]-176418897|0,r=(r<<7|r>>>25)+i|0,o+=(r&i|~r&s)+n[5]+1200080426|0,o=(o<<12|o>>>20)+r|0,s+=(o&r|~o&i)+n[6]-1473231341|0,s=(s<<17|s>>>15)+o|0,i+=(s&o|~s&r)+n[7]-45705983|0,i=(i<<22|i>>>10)+s|0,r+=(i&s|~i&o)+n[8]+1770035416|0,r=(r<<7|r>>>25)+i|0,o+=(r&i|~r&s)+n[9]-1958414417|0,o=(o<<12|o>>>20)+r|0,s+=(o&r|~o&i)+n[10]-42063|0,s=(s<<17|s>>>15)+o|0,i+=(s&o|~s&r)+n[11]-1990404162|0,i=(i<<22|i>>>10)+s|0,r+=(i&s|~i&o)+n[12]+1804603682|0,r=(r<<7|r>>>25)+i|0,o+=(r&i|~r&s)+n[13]-40341101|0,o=(o<<12|o>>>20)+r|0,s+=(o&r|~o&i)+n[14]-1502002290|0,s=(s<<17|s>>>15)+o|0,i+=(s&o|~s&r)+n[15]+1236535329|0,i=(i<<22|i>>>10)+s|0,r+=(i&o|s&~o)+n[1]-165796510|0,r=(r<<5|r>>>27)+i|0,o+=(r&s|i&~s)+n[6]-1069501632|0,o=(o<<9|o>>>23)+r|0,s+=(o&i|r&~i)+n[11]+643717713|0,s=(s<<14|s>>>18)+o|0,i+=(s&r|o&~r)+n[0]-373897302|0,i=(i<<20|i>>>12)+s|0,r+=(i&o|s&~o)+n[5]-701558691|0,r=(r<<5|r>>>27)+i|0,o+=(r&s|i&~s)+n[10]+38016083|0,o=(o<<9|o>>>23)+r|0,s+=(o&i|r&~i)+n[15]-660478335|0,s=(s<<14|s>>>18)+o|0,i+=(s&r|o&~r)+n[4]-405537848|0,i=(i<<20|i>>>12)+s|0,r+=(i&o|s&~o)+n[9]+568446438|0,r=(r<<5|r>>>27)+i|0,o+=(r&s|i&~s)+n[14]-1019803690|0,o=(o<<9|o>>>23)+r|0,s+=(o&i|r&~i)+n[3]-187363961|0,s=(s<<14|s>>>18)+o|0,i+=(s&r|o&~r)+n[8]+1163531501|0,i=(i<<20|i>>>12)+s|0,r+=(i&o|s&~o)+n[13]-1444681467|0,r=(r<<5|r>>>27)+i|0,o+=(r&s|i&~s)+n[2]-51403784|0,o=(o<<9|o>>>23)+r|0,s+=(o&i|r&~i)+n[7]+1735328473|0,s=(s<<14|s>>>18)+o|0,i+=(s&r|o&~r)+n[12]-1926607734|0,i=(i<<20|i>>>12)+s|0,r+=(i^s^o)+n[5]-378558|0,r=(r<<4|r>>>28)+i|0,o+=(r^i^s)+n[8]-2022574463|0,o=(o<<11|o>>>21)+r|0,s+=(o^r^i)+n[11]+1839030562|0,s=(s<<16|s>>>16)+o|0,i+=(s^o^r)+n[14]-35309556|0,i=(i<<23|i>>>9)+s|0,r+=(i^s^o)+n[1]-1530992060|0,r=(r<<4|r>>>28)+i|0,o+=(r^i^s)+n[4]+1272893353|0,o=(o<<11|o>>>21)+r|0,s+=(o^r^i)+n[7]-155497632|0,s=(s<<16|s>>>16)+o|0,i+=(s^o^r)+n[10]-1094730640|0,i=(i<<23|i>>>9)+s|0,r+=(i^s^o)+n[13]+681279174|0,r=(r<<4|r>>>28)+i|0,o+=(r^i^s)+n[0]-358537222|0,o=(o<<11|o>>>21)+r|0,s+=(o^r^i)+n[3]-722521979|0,s=(s<<16|s>>>16)+o|0,i+=(s^o^r)+n[6]+76029189|0,i=(i<<23|i>>>9)+s|0,r+=(i^s^o)+n[9]-640364487|0,r=(r<<4|r>>>28)+i|0,o+=(r^i^s)+n[12]-421815835|0,o=(o<<11|o>>>21)+r|0,s+=(o^r^i)+n[15]+530742520|0,s=(s<<16|s>>>16)+o|0,i+=(s^o^r)+n[2]-995338651|0,i=(i<<23|i>>>9)+s|0,r+=(s^(i|~o))+n[0]-198630844|0,r=(r<<6|r>>>26)+i|0,o+=(i^(r|~s))+n[7]+1126891415|0,o=(o<<10|o>>>22)+r|0,s+=(r^(o|~i))+n[14]-1416354905|0,s=(s<<15|s>>>17)+o|0,i+=(o^(s|~r))+n[5]-57434055|0,i=(i<<21|i>>>11)+s|0,r+=(s^(i|~o))+n[12]+1700485571|0,r=(r<<6|r>>>26)+i|0,o+=(i^(r|~s))+n[3]-1894986606|0,o=(o<<10|o>>>22)+r|0,s+=(r^(o|~i))+n[10]-1051523|0,s=(s<<15|s>>>17)+o|0,i+=(o^(s|~r))+n[1]-2054922799|0,i=(i<<21|i>>>11)+s|0,r+=(s^(i|~o))+n[8]+1873313359|0,r=(r<<6|r>>>26)+i|0,o+=(i^(r|~s))+n[15]-30611744|0,o=(o<<10|o>>>22)+r|0,s+=(r^(o|~i))+n[6]-1560198380|0,s=(s<<15|s>>>17)+o|0,i+=(o^(s|~r))+n[13]+1309151649|0,i=(i<<21|i>>>11)+s|0,r+=(s^(i|~o))+n[4]-145523070|0,r=(r<<6|r>>>26)+i|0,o+=(i^(r|~s))+n[11]-1120210379|0,o=(o<<10|o>>>22)+r|0,s+=(r^(o|~i))+n[2]+718787259|0,s=(s<<15|s>>>17)+o|0,i+=(o^(s|~r))+n[9]-343485551|0,i=(i<<21|i>>>11)+s|0,e[0]=r+e[0]|0,e[1]=i+e[1]|0,e[2]=s+e[2]|0,e[3]=o+e[3]|0}_dataLength=0;_bufferLength=0;_state=new Int32Array(4);_buffer=new ArrayBuffer(68);_buffer8;_buffer32;constructor(){this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(W.stateIdentity),this}appendStr(e){const n=this._buffer8,r=this._buffer32;let i=this._bufferLength,s,o;for(o=0;o<e.length;o+=1){if(s=e.charCodeAt(o),s<128)n[i++]=s;else if(s<2048)n[i++]=(s>>>6)+192,n[i++]=s&63|128;else if(s<55296||s>56319)n[i++]=(s>>>12)+224,n[i++]=s>>>6&63|128,n[i++]=s&63|128;else{if(s=(s-55296)*1024+(e.charCodeAt(++o)-56320)+65536,s>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");n[i++]=(s>>>18)+240,n[i++]=s>>>12&63|128,n[i++]=s>>>6&63|128,n[i++]=s&63|128}i>=64&&(this._dataLength+=64,W._md5cycle(this._state,r),i-=64,r[0]=r[16])}return this._bufferLength=i,this}appendAsciiStr(e){const n=this._buffer8,r=this._buffer32;let i=this._bufferLength,s,o=0;for(;;){for(s=Math.min(e.length-o,64-i);s--;)n[i++]=e.charCodeAt(o++);if(i<64)break;this._dataLength+=64,W._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}appendByteArray(e){const n=this._buffer8,r=this._buffer32;let i=this._bufferLength,s,o=0;for(;;){for(s=Math.min(e.length-o,64-i);s--;)n[i++]=e[o++];if(i<64)break;this._dataLength+=64,W._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}getState(){const e=this._state;return{buffer:String.fromCharCode.apply(null,Array.from(this._buffer8)),buflen:this._bufferLength,length:this._dataLength,state:[e[0],e[1],e[2],e[3]]}}setState(e){const n=e.buffer,r=e.state,i=this._state;let s;for(this._dataLength=e.length,this._bufferLength=e.buflen,i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],s=0;s<n.length;s+=1)this._buffer8[s]=n.charCodeAt(s)}end(e=!1){const n=this._bufferLength,r=this._buffer8,i=this._buffer32,s=(n>>2)+1;this._dataLength+=n;const o=this._dataLength*8;if(r[n]=128,r[n+1]=r[n+2]=r[n+3]=0,i.set(W.buffer32Identity.subarray(s),s),n>55&&(W._md5cycle(this._state,i),i.set(W.buffer32Identity)),o<=4294967295)i[14]=o;else{const u=o.toString(16).match(/(.*?)(.{0,8})$/);if(u===null)return e?zs:"";const c=parseInt(u[2],16),l=parseInt(u[1],16)||0;i[14]=c,i[15]=l}return W._md5cycle(this._state,i),e?this._state:W._hex(this._state)}}if(W.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592")throw new Error("Md5 self test failed.");const Bs=36e5,sr=Symbol.for("constructDateFrom");function Rt(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&sr in t?t[sr](e):t instanceof Date?new t.constructor(e):new Date(e)}function Ve(t,e){return Rt(t,t)}function Ws(t,e,n){const r=Ve(t);if(isNaN(e))return Rt(t,NaN);const i=r.getDate(),s=Rt(t,r.getTime());s.setMonth(r.getMonth()+e+1,0);const o=s.getDate();return i>=o?s:(r.setFullYear(s.getFullYear(),s.getMonth(),i),r)}function Cr(t,e,n){return Rt(t,+Ve(t)+e)}function Qs(t,e,n){return Cr(t,e*Bs)}function Zs(t,e,n){return Cr(t,e*1e3)}function Vs(t,e,n){return Ws(t,e*12)}function or(t){return Math.trunc(+Ve(t)/1e3)}function Ys(t,e){return+Ve(t)<+Ve(e)}function d(t,e,n,r="debug",i){if(window.debug){const o=["color: #0288D1",`color:${i||"#009688"}`,"color: default"];n?An()?console[r](`%c[PlaceOS]%c[${t}] %c${e}`,...o,n):console[r](`[PlaceOS][${t}] ${e}`,n):An()?console[r](`%c[PlaceOS]%c[${t}] %c${e}`,...o):console[r](`[PlaceOS][${t}] ${e}`)}}function An(){return!(document.documentMode||/Edge/.test(navigator.userAgent))}function En(){const t=window.location?.hash?window.location?.hash.slice(1):window.location?.href.split("#")[1]||"";let e=window.location?.search?window.location?.search.slice(1):window.location?.href.split("?")[1]||"",n={};if(t)if(t.indexOf("?")>=0){const i=t.split("?");n=Re(i[0]),e||(e=i[1])}else n=Re(t);let r={};return e&&(r=Re(e)),{...n,...r}}function Re(t){const e={},n=t.split("&");for(const r of n){const i=r.split("=");i[1]&&(e[decodeURIComponent(i[0])]=decodeURIComponent(i[1]))}return e}const ur="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function Nr(t=40){let e="";for(let n=0;n<t;n++)e+=ur.charAt(Math.floor(Math.random()*ur.length));return e}function le(t){const e=(window.location?.hash||"").replace(new RegExp(`${t}[a-zA-Z0-9_+-.%=]*&?`,"g"),"").replace(/&&/g,"&").replace(/#&/g,"#").replace(/&$/g,"#"),n=(window.location?.search||"").replace(new RegExp(`${t}[a-zA-Z0-9_+-.%=]*&?`,"g"),"").replace(/&&/g,"&").replace(/\?&/g,"#").replace(/&$/g,"#");window.history?.replaceState&&window.history?.replaceState(null,"",`${window.location?.pathname}${e}${n}`)}function Ye(t,e=!1){const n=e?1e3:1024;if(t<n)return t+(e?" iB":" B");const r=Math.floor(Math.log(t)/Math.log(n)),i=(e?"kMGTPE":"KMGTPE").charAt(r-1)+(e?"iB":"B");return(t/Math.pow(n,r)).toFixed(2)+" "+i}function Fr(t){if(t.length===0)throw new Error("Input must not be of zero length");const e=t.split(","),n={};for(const r of e){const i=r.split(";");if(i.length!==2)throw new Error("Section could not be split on ';'");const s=i[0].replace(/<(.*)>/,"$1").trim(),o=i[1].replace(/rel="(.*)"/,"$1").trim();n[o]=s}return n}function jr(t,e){for(const n in t)t.hasOwnProperty(n)&&e.indexOf(t[n])>=0&&delete t[n];return t}function Lr(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Hr(){return window.location!==window.parent.location}function zr(t=Date.now(),e=60*1e3){return Math.floor(t/e)}class Js{abort(){d("Stub","Aborted")}}function F(t){let e="";if(t)for(const n in t)t.hasOwnProperty(n)&&t[n]!==void 0&&t[n]!==null&&(e+=`${e?"&":""}${n}=${encodeURIComponent(t[n])}`);return e}const ve={},Qe={},ae={};function Ks(){for(const t in ve)ve.hasOwnProperty(t)&&Ae(t);for(const t in Qe)Qe.hasOwnProperty(t)&&Gs(t);for(const t in ae)ae.hasOwnProperty(t)&&Xs(t)}function re(t,e,n=300){if(t&&e&&e instanceof Function)Ae(t),ve[t]=setTimeout(()=>{e(),delete ve[t]},n);else throw new Error(t?"Cannot create named timeout without a name":"Cannot create a timeout without a callback")}function Ae(t){ve[t]&&(clearTimeout(ve[t]),delete ve[t])}function Gs(t){Qe[t]&&(clearInterval(Qe[t]),delete Qe[t])}function Xs(t){ae&&ae[t]&&(ae[t]instanceof ke?ae[t].unsubscribe():ae[t](),delete ae[t])}const eo={id:"mock-authority",name:"localhost:4200",description:"",domain:"localhost:4200",login_url:"/login?continue={{url}}",logout_url:"/logout",session:!0,production:!1,config:{},version:"2.0.0"};let v={},P,H;const b={};let T="",Se="";const Ue=new fe(""),Ht=new fe("");let In="/api/engine/v2";const he=new fe(!1),to=he.asObservable();let Dt=0;function X(){return`${`${v.secure||window.location?.protocol.indexOf("https")>=0?"https:":"http:"}//${v.host||window.location?.host}`}${Mn()}`}function Mn(){return v.version==="ACA Engine"?"/control/api":In}function no(){return!!v.token_header}function Br(){return T}function ro(){return v.redirect_uri}function io(t,e=!0){P.setItem(`${T}_x-api-key`,`${t}`),P.setItem("trusted",`${e}`),Wr("x-api-key",Vs(new Date,5).valueOf())}function Ge(){return Ct("x-api-key",!1)||""}function Wr(t,e=Qs(new Date,2).valueOf()){v.ignore_api_key&&t==="x-api-key"||(P.setItem(`${T}_expires_at`,`${e}`),P.setItem(`${T}_access_token`,t))}function Z(t=!0){if(v.mock)return"mock-token";if(!P)return"";if(Ge()&&!v.ignore_api_key)return"x-api-key";const e=P.getItem(`${T}_expires_at`)||"",n=Ue.getValue();return Ys(+e,new Date)&&(d("Auth","Token expired. Requesting new token..."),Wt(),b.load_authority||(Dt+=1,re("re-authorise",()=>qn().catch(r=>d("Auth",`Failed to get token: ${r}`)),200*Math.min(20,Dt))),!t)?"":n||P.getItem(`${T}_access_token`)||""}function qt(){return Ht.getValue()||P.getItem(`${T}_refresh_token`)||""}function Ut(){return v.host||window.location?.host}function Qr(){return!!Z()}function Zr(){return Ue.pipe(O(t=>!!Qr()))}function Je(){return H}function so(){return he.getValue()}function zt(){return!!v.mock}function Vr(){return!!v.secure}function oo(){return to}function Bt(){return Ct("trust")==="true"||Ct("trusted")==="true"}function Rn(){return!!Ge()&&!v.ignore_api_key||Ct("fixed_device")==="true"}function Ct(t,e=!0){let r=En()[t];if(P){const i=`${Br()}_${t}`;r=r||P.getItem(i)||P.getItem(t)||"",e&&P.setItem(i,`${r}`)}return r}function uo(t){return v=t||v,v.token_header=v.token_header??Hr(),window.AbortController||(window.AbortController=Js),P=v.storage==="session"?sessionStorage:localStorage,T=W.hashStr(v.redirect_uri,!1),Un()}function co(){v={},H=void 0,Ue.next(""),Ht.next(""),he.next(!1),T="",Se="",In="/api/engine/v2";for(const t in b)t in b&&delete b[t];Ks()}function Dn(){return d("Auth","Refreshing authorty."),H=void 0,Un()}function Wt(){d("Auth","Invalidating tokens."),P.removeItem(`${T}_access_token`),P.removeItem(`${T}_expires_at`),Ue.getValue()&&Ue.next("")}function qn(t,e=H){return b.authorise||(b.authorise=new Promise((n,r)=>{if(!e)return delete b.authorise,r("Authority is not loaded");d("Auth","Authorising user...");const i=()=>{if(Z(!1))d("Auth","Valid token found."),delete b.authorise,n(Z());else{const s=[()=>{d("Auth","Successfully generated token."),n(Z()),delete b.authorise},()=>{d("Auth","Failed to generate token."),r("Failed to generate token"),setTimeout(()=>delete b.authorise,200)}];v&&v.auth_type==="password"?(d("Auth","Logging in with credentials."),vo(v).then(...s),Dt=0):Se||qt()?(d("Auth",`Generating token with ${Se?"code":"refresh token"}`),Jr().then(...s),Dt=0):e.session?(d("Auth","Users has session. Authorising application..."),lo(t).then(...s)):(d("Auth","No user session"),Yr(e),r("No user session"),setTimeout(()=>delete b.authorise,200))}};fo().then(i,i)})),b.authorise}function ao(){const t=H?H.logout_url:"/logout";fetch(t,{method:"GET",redirect:"manual",headers:{Authorization:"Bearer "+Z()}}).then(e=>{const n=e.headers.get("Location")||t;for(let r=0;r<P.length;r++){const i=P.key(r);i&&i.indexOf(T)>=0&&P.removeItem(i)}window.location?.assign(n)})}function Un(t=0){return b.load_authority||(b.load_authority=new Promise(e=>{if(he.next(!1),v.mock){H=eo,d("Auth","System in mock mode"),he.next(!0),e();return}d("Auth",`Fixed: ${Rn()} | Trusted: ${Bt()}`),d("Auth","Loading authority...");const n=v.secure||window.location?.protocol.indexOf("https")>=0,r=i=>{d("Auth",`Failed to load authority(${i})`),he.next(!1),re("load_authority",()=>{delete b.load_authority,Un(t).then(s=>e())},300*Math.min(20,++t))};On(`${n?"https:":"http:"}//${Ut()}/auth/authority`,{credentials:"same-origin"}).subscribe(async i=>{if(!i.ok)return r(await i.text().catch(o=>o));H=await i.json(),In=/[2-9]\.[0-9]+\.[0-9]+/g.test(H.version||"")?"/api/engine/v2":"/control/api",d("Auth","Loaded authority.",[],"group"),H&&(d("Auth",`Name: ${H.name}`),d("Auth",`Version: ${H.version}`),d("Auth",`Domain: ${H.domain}`),d("Auth",`Session: ${H.session}`),d("Auth",`Production: ${H.production}`),d("Auth",`Config Keys: ${Object.keys(H.config||{}).length}`)),d("Auth","",[],"groupEnd");const s=()=>{he.next(!0),d("Auth","Application set online."),e()};delete b.load_authority,qn("").then(s,s)},r)})),b.load_authority}async function lo(t){const e=_o(t);if(v.use_iframe)return ho(e);window.location?.assign(e)}function ho(t){return b.iframe_auth||(b.iframe_auth=new Promise((e,n)=>{d("Auth","Authorizing in an iFrame...");const r=document.createElement("iframe");r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.height="1px",r.style.width="1px",r.style.zIndex="-1",r.id="place-authorize",r.src=`${t}`;const i=s=>{if(s.origin===window.location?.origin&&s.data.type==="place-os"){const o=s.data;if(d("Auth","Received credentials from iFrame..."),document.body.removeChild(r),Ae("iframe_auth"),window.removeEventListener("message",i),delete b.iframe_auth,o.token)return e(),Cn({access_token:o.token,...o});Se=o.code||"",Jr().then(u=>e(u),u=>n(u))}};re("iframe_auth",()=>{d("Auth","Unable to resolve iFrame after 15 seconds..."),n()},15*1e3),window.addEventListener("message",i),r.onerror=s=>{d("Auth","iFrame error.",s),delete b.iframe_auth,n()},document.body.appendChild(r)})),b.iframe_auth}let cr=!1;function Yr(t){if(v.handle_login!==!1&&!cr){d("Auth","Redirecting to login page...");const e=t.login_url?.replace("{{url}}",encodeURIComponent(window.location?.href));throw setTimeout(()=>window.location?.assign(e),300),cr=!0,new Error("Redirecting to login page...")}else d("Auth","Login being handled locally.");delete b.authorise}function fo(){return b.check_token||(b.check_token=new Promise(async(t,e)=>{Z()?(d("Auth","Valid token found."),t(Z())):(d("Auth","No token. Checking URL for auth credentials..."),await po()?t(!0):e()),delete b.check_token})),b.check_token}function po(){return b.check_params||(b.check_params=new Promise(t=>{d("Auth","Checking for auth parameters...");let e=En();if((!e||Object.keys(e).length<=0)&&sessionStorage&&(e=JSON.parse(sessionStorage.getItem("ENGINE.auth.params")||"{}")),e&&(e.code||e.access_token||e.refresh_token)){e.code&&(Se=e.code,le("code")),e.refresh_token&&(P.setItem(`${T}_refresh_token`,e.refresh_token),le("refresh_token"));const n=P.getItem(`${T}_nonce`)||"",r=(e.state||"").split(";");le("state"),le("token_type");const i=r[0];n===i?(Cn(e),t(!!e.access_token)):t(!1)}else t(!1);re("check_params_promise",()=>delete b.check_params,50)})),b.check_params}function _o(t){const e=bo();t=t?`${e};${t}`:e;const n=v?(v.auth_uri||"").indexOf("?")>=0:!1,r=(v?v.auth_uri:null)||"/auth/oauth/authorize",i=Bt()||v.auth_type==="auth_code"?"code":"token";let s=`${r}${n?"&":"?"}response_type=${encodeURIComponent(i)}&client_id=${encodeURIComponent(T)}&state=${encodeURIComponent(t)}&redirect_uri=${encodeURIComponent(v.redirect_uri)}&scope=${encodeURIComponent(v.scope)}`;if(v.auth_type==="auth_code"){const{challenge:o,verify:u}=mo();sessionStorage.setItem(`${T}_challenge`,o),s+="&code_challenge_method=S256",s+=`&code_challenge=${u}`}return s}const ar="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split("");function mo(t=43){const e=new Array(t).fill(0).map(()=>ar[Math.floor(Math.random()*ar.length)]).join(""),n=Ns(Fs(e)),r=Ur(Hs.hash(n)).split("=")[0].replace(/\//g,"_").replace(/\+/g,"-");return{challenge:e,verify:r}}function yo(){let e=(v.token_uri||"/auth/token")+`?client_id=${encodeURIComponent(T)}`,n="";if(e+=`&redirect_uri=${encodeURIComponent(v.redirect_uri)}`,qt()){e+=`&refresh_token=${encodeURIComponent(qt())}`,e+="&grant_type=refresh_token";const r=e.split("?");e=r[0],n=r[1]}else{e+=`&code=${encodeURIComponent(Se)}`,e+="&grant_type=authorization_code";const r=sessionStorage.getItem(`${T}_challenge`);r&&(e+=`&code_verifier=${r}`,sessionStorage.removeItem(`${T}_challenge`)),Se=""}return[e,n]}function go(t){const e=t.token_uri||"/auth/token",n=F({grant_type:"password",client_id:T,client_secret:t.client_secret,redirect_uri:t.redirect_uri,authority:H?.id,scope:t.scope,username:t.username,password:t.password});return`${e}?${n}`}function Jr(){return Kr(...yo())}function vo(t){return Kr(go(t))}function Kr(t,e=""){return b.generate_tokens||(b.generate_tokens=new Promise((n,r)=>{d("Auth","Generating new token...");const i=s=>{d("Auth","Error generating new tokens.",s),P.removeItem(`${T}_refresh_token`),Ht.next(""),r(),delete b.generate_tokens};On(t,{method:"POST",body:e,headers:{"Content-Type":"application/x-www-form-urlencoded"}}).subscribe(async s=>{if(!s.ok)return i(s);const o=await s.json();Cn(o),n(),delete b.generate_tokens},i)})),b.generate_tokens}function Cn(t){const e=Zs(new Date,Math.max(60,parseInt(t.expires_in,10)-300));d("Auth","Tokens generated storing..."),Bt()&&(t.access_token&&(P.setItem(`${T}_access_token`,t.access_token),le("access_token")),t.refresh_token&&(P.setItem(`${T}_refresh_token`,t.refresh_token),le("refresh_token"))),t.expires_in&&(P.setItem(`${T}_expires_at`,`${e.valueOf()}`),le("expires_in")),he.next(!0),Ue.next(t.access_token||""),Ht.next(t.refresh_token||"")}function bo(){const t=Nr();return P.setItem(`${T}_nonce`,t),t}const Qt={};let Gr=(t,e)=>{const n=new Error(`Mock endpoint not found: ${t} ${e}`);return n.status=404,d("HTTP(M)",`404 ${t}:`,e),Mr(n)};function So(t){Gr=t}function ko(t,e=Qt){Xr(t.method,t.path,e);const n=`${t.method}|${t.path}`,r=t.path.replace(/(http|https):\/\/[a-zA-Z0-9.-]*:?([0-9]*)?/g,"").replace(/^\//,"").split("/"),i={...t,path_parts:r,path_structure:r.map(s=>s[0]===":"?s.replace(":",""):"")};e[n]=i,d("HTTP(M)",`+ ${t.method} ${t.path}`)}function Xr(t,e,n=Qt){const r=`${t}|${e}`;n[r]&&(delete n[r],d("HTTP(M)",`- ${t} ${e}`))}function Ao(t,e,n,r=Qt){const i=xo(t,e,r);if(i){const s=$o(e,i,n);return wo(i,s)}return Gr(t,e)}function xo(t,e,n=Qt){const i=e.replace(/(http|https):\/\/[a-zA-Z0-9.-]*:?([0-9]*)?/g,"").replace(/^\//,"").split("?")[0].split("/"),s=Object.keys(n).reduce((o,u)=>(u.indexOf(`${t}|`)===0&&o.push(n[u]),o),[]);for(const o of s)if(o.path_structure.length===i.length){let u=!0;for(let c=0;c<o.path_structure.length;c++)if(!o.path_structure[c]&&o.path_parts[c]!==i[c]){u=!1;break}if(u)return o}return null}function $o(t,e,n){const r=t.replace(/(http|https):\/\/[a-zA-Z0-9.-]*:?([0-9]*)?/g,"").split("?"),i=r[0].replace(/^\//,""),s=r[1]||"",o=Re(s),u=i.split("/"),c={};for(let _=0;_<e.path_structure.length;_++){const m=e.path_structure[_];m&&(c[m]=u[_])}const l={url:t,path:e.path,method:e.method,metadata:e.metadata,route_params:c,query_params:o,body:n};return d("HTTP(M)",`MATCHED ${l.method}:`,l),l}function wo(t,e){let n;try{n=t.callback?t.callback(e):t.metadata}catch(o){throw d("HTTP(M)",`ERROR ${e.method}:`,[e.url,o]),o}const r=t.delay_variance||100,i=t.delay||300,s=Math.floor(Math.random()*r-r/2)+i;return d("HTTP(M)",`RESP ${e.method}:`,[e.url,n]),Ts([n]).pipe(Ds(Math.max(200,s)))}const ei={};function ti(t,e=ei){return e[t]||{}}function ee(t,e,n=Xe){return e||(e={response_type:"json"}),n("GET",t,{response_type:"json",...e})}function de(t,e,n,r=Xe){return n||(n={response_type:"json"}),r("POST",t,{body:e,response_type:"json",...n})}function xe(t,e,n,r=Xe){return n||(n={response_type:"json"}),r("PUT",t,{body:e,response_type:"json",...n})}function Ce(t,e,n,r=Xe){return n||(n={response_type:"json"}),r("PATCH",t,{body:e,response_type:"json",...n})}function $e(t,e,n=Xe){return e||(e={response_type:"void"}),n("DELETE",t,{response_type:"void",...e})}async function Po(t,e,n=ei){if(t.headers){const r={};t.headers.forEach?t.headers.forEach((i,s)=>r[s.toLowerCase()]=i):Object.keys(t.headers).forEach(i=>r[i.toLowerCase()]=t.headers[i]),n[t.url||""]=r}switch(e){case"json":return await t.json().catch(()=>({}));case"text":return await t.text();case"void":return;default:return await t.json().catch(()=>({}))}}const ni=()=>(Wt(),Dn().then(()=>Promise.resolve(),()=>new Promise(t=>{setTimeout(()=>{ni().then(()=>t())},1e3)})));function Xe(t,e,n,r=zt,i=Ao,s=Po){if(r()){const o=i(t,e,n?.body);if(o)return o}return n.headers=n.headers||{},!n.headers["Content-Type"]&&!n.headers["content-type"]&&(n.headers["Content-Type"]="application/json"),Zr().pipe(Is(o=>o),qr(1),nr(o=>{Z()==="x-api-key"?n.headers["X-API-Key"]=Ge():n.headers.Authorization=`Bearer ${Z()}`;const u={...n,method:t,credentials:"same-origin"};return["POST","PUT","PATCH"].includes(t)&&n.body!==void 0&&(u.body=typeof n.body=="string"?n.body:JSON.stringify(n.body)),On(e,u)}),nr(o=>o.ok?s(o,n.response_type):Mr(o)),Cs({count:4,delay:(o,u)=>new D(c=>{if(o.status===511){Yr(Je()),c.error(o);return}if(o.status!==401){c.error(o||{});return}d("HTTP","Auth error",o);const l=Math.pow(2,u-1)*1e3;ni().then(()=>{c.next(l),c.complete()}).catch(()=>{c.error(o)})})}))}class j{id;name;created_at;updated_at;version;constructor(e={}){this.id=e.id||"",this.name=e.name||"",this.created_at=e.created_at||0,this.updated_at=e.updated_at||0,this.version=e.version||0}toJSON(){const e={...this};return e.version=this.version,delete e.created_at,jr(e,[void 0,null,""])}}class ri extends j{alert_dashboard_id;alert_dashboard_details;authority_id;description;enabled;conditions;severity;alert_type;debounce_period;constructor(e){super(e),this.authority_id=e.authority_id||"",this.description=e.description||"",this.enabled=e.enabled||!1,this.conditions=e.conditions||{time_dependents:[],comparisons:[]},this.severity=e.severity||"low",this.alert_type=e.alert_type||"threshold",this.debounce_period=e.debounce_period||0,this.alert_dashboard_id=e.alert_dashboard_id||"",this.alert_dashboard_details=e.alert_dashboard_details||void 0}}class ii extends j{authority_id;description;enabled;constructor(e){super(e),this.authority_id=e.authority_id||"",this.description=e.description||"",this.enabled=e.enabled||!1}}const Ne="alert_dashboards";function Zt(t){return new ii(t)}function To(t={}){return $({query_params:t,fn:Zt,path:Ne})}function Oo(t,e={}){return k({id:t,query_params:e,fn:Zt,path:Ne})}function Eo(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:Zt,path:Ne})}function Io(t){return E({form_data:t,query_params:{},fn:Zt,path:Ne})}function Mo(t,e={}){return w({id:t,query_params:e,path:Ne})}function Ro(t){return $({query_params:{},fn:tt,path:`${Ne}/${t}/alerts`})}const et="alerts";function tt(t){return new ri(t)}function Do(t={}){return $({query_params:t,fn:tt,path:et})}function qo(t,e={}){return k({id:t,query_params:e,fn:tt,path:et})}function Uo(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:tt,path:et})}function Co(t){return E({form_data:t,query_params:{},fn:tt,path:et})}function No(t,e={}){return w({id:t,query_params:e,path:et})}class si extends j{uid;secret;owner_id;scopes;redirect_uri;skip_authorization;preserve_client_id;constructor(e={}){super(e),this.uid=e.uid||"",this.secret=e.secret||"",this.owner_id=e.owner_id||"",this.scopes=e.scopes||"",this.redirect_uri=e.redirect_uri||"",this.skip_authorization=e.skip_authorization||!1,this.preserve_client_id=e.preserve_client_id||!1}}function Fo(t){return oi[t]||0}function jo(t){return ui[t]||0}let oi={},ui={},lr="";const Vt=t=>t;function $(t){const{query_params:e,fn:n,path:r,endpoint:i}=t,s=F(e),o=`${i||X()}${r?"/"+r:""}${s?"?"+s:""}`;return ee(o).pipe(O(u=>{const c=Lo(o,s,r);return{total:c.total||0,next:c.next?()=>$({query_params:c.next,fn:n,endpoint:i,path:r}):null,data:u&&u instanceof Array?u.map(l=>(n||Vt)(l)):u&&!(u instanceof Array)&&u.results?u.results.map(l=>l):[]}}))}function k(t){const{query_params:e,id:n,path:r,fn:i,options:s}=t,o=F(e),u=`${X()}/${r}/${n}${o?"?"+o:""}`;return ee(u,s).pipe(O(c=>(i||Vt)(c)))}function E(t){const{query_params:e,form_data:n,path:r,fn:i}=t,s=F(e),o=`${X()}/${r}${s?"?"+s:""}`;return de(o,n).pipe(O(c=>(i||Vt)(c)))}function y(t){const{id:e,task_name:n,form_data:r,method:i,path:s,callback:o}=t,u=F(r),c=`${X()}/${s}/${e}/${n}`;return(i==="post"||i==="put"||!i?(i==="put"?xe:de)(c,r):(i==="del"?$e:ee)(`${c}${u?"?"+u:""}`,{response_type:"json"})).pipe(O(_=>(o||(m=>m))(_)))}function I(t){const{id:e,query_params:n,form_data:r,method:i,path:s,fn:o}=t,u=F({...n,version:r.version||0}),c=`${X()}/${s}/${e}${u?"?"+u:""}`;return(i==="put"?xe:Ce)(c,r).pipe(O(l=>(o||Vt)(l)))}function w(t){const{id:e,query_params:n,path:r}=t,i=F(n),s=`${X()}/${r}/${e}${i?"?"+i:""}`;return $e(s)}function Lo(t,e,n){const r=ti(t[0]==="/"?`${location.origin}${t}`:t),i={total:0,next:null};if(r&&r["x-total-count"]){const s=+(r["x-total-count"]||0);(e.length<2||e.length<12&&e.indexOf("offset=")>=0)&&(oi[n]=s),ui[n]=s,i.total=s}return r&&r.link&&(lr=Fr(r.link||"").next,i.next=Re(lr.split("?")[1])),i}const nt="oauth_apps";function Yt(t){return new si(t)}function Ho(t={}){return $({query_params:t,fn:Yt,path:nt})}function zo(t,e={}){return k({id:t,query_params:e,fn:Yt,path:nt})}function Bo(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:Yt,path:nt})}function Wo(t){return E({form_data:t,query_params:{},fn:Yt,path:nt})}function Qo(t,e={}){return w({id:t,query_params:e,path:nt})}var ci=(t=>(t[t.Certificate=0]="Certificate",t[t.NoAuth=1]="NoAuth",t[t.UserPassword=2]="UserPassword",t))(ci||{});class ai extends j{id;name;auth_type;description;host;port;tls;username;password;certificate;secret;filters;constructor(e={}){super(),this.id=e.id||"",this.name=e.name||"",this.auth_type=e.auth_type||2,this.description=e.description||"",this.host=e.host||"",this.port=e.port||1883,this.tls=e.tls||!1,this.username=e.username||"",this.password=e.password||"",this.certificate=e.certificate||"",this.secret=e.secret||"",this.filters=e.filters||[]}}const rt="brokers";function Jt(t){return new ai(t)}function Zo(t={}){return $({query_params:t,fn:Jt,path:rt})}function Vo(t,e={}){return k({id:t,query_params:e,fn:Jt,path:rt})}function Yo(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:Jt,path:rt})}function Jo(t){return E({form_data:t,query_params:{},fn:Jt,path:rt})}function Ko(t,e={}){return w({id:t,query_params:e,path:rt})}class li{id;compiled_drivers;available_repositories;running_drivers;module_instances;unavailable_repositories;unavailable_drivers;hostname;cpu_count;core_cpu;total_cpu;memory_total;memory_usage;core_memory;memory_percentage;used_memory;total_memory;edge_nodes;run_counts;constructor(e={}){this.id=e.id||e.core_id||"",this.compiled_drivers=e.compiled_drivers||[],this.available_repositories=e.available_repositories||e.status?.available_repositories||[],this.running_drivers=e.running_drivers||e.status?.running_drivers||0,this.module_instances=e.module_instances||e.status?.module_instances||0,this.unavailable_repositories=e.unavailable_repositories||e.status?.unavailable_repositories||[],this.unavailable_drivers=e.unavailable_drivers||e.status?.unavailable_drivers||[],this.hostname=e.hostname||e.load?.local.hostname||"",this.cpu_count=e.cpu_count||e.load?.local.cpu_count||0,this.core_cpu=e.core_cpu||e.load?.local.core_cpu||0,this.total_cpu=e.total_cpu||e.load?.local.total_cpu||0,this.memory_total=e.memory_total||e.load?.local.memory_total||0,this.memory_usage=e.memory_usage||e.load?.local.memory_usage||0,this.core_memory=e.core_memory||e.load?.local.core_memory||0,this.run_counts=e.run_counts||e.status?.run_counts?.local||{modules:0,drivers:0},this.memory_percentage=+(this.memory_usage/this.memory_total*100).toFixed(4),this.used_memory=Ye(this.memory_usage*1024),this.total_memory=Ye(this.memory_total*1024);const n=e.load?.edge||{};this.edge_nodes=e.edge_nodes||Object.keys(n).map(r=>({id:r,...n[r],run_count:e.status?.run_count?.edge[r]||{}}))||[]}}class hi{cluster_id;id;modules;running;module_instances;last_exit_code;launch_count;launch_time;cpu_usage;memory_total;memory_usage;used_memory;total_memory;constructor(e,n={}){this.cluster_id=e,this.id=n.id||n.driver||"",this.modules=n.modules||[],this.running=n.running||!1,this.module_instances=n.module_instances||n.edge?.status?.module_instances||n.local?.status?.module_instances||0,this.last_exit_code=n.last_exit_code||n.edge?.status?.last_exit_code||n.local?.status?.last_exit_code||0,this.launch_count=n.launch_count||n.edge?.status?.launch_count||n.local?.status?.launch_count||0,this.launch_time=n.launch_time||n.edge?.status?.launch_time||n.local?.status?.launch_time||0,this.cpu_usage=n.cpu_usage||n.percentage_cpu||n.edge?.status?.percentage_cpu||n.local?.status?.percentage_cpu||0,this.memory_total=n.memory_total||n.edge?.status?.memory_total||n.local?.status?.memory_total||0,this.memory_usage=n.memory_usage||n.edge?.status?.memory_usage||n.local?.status?.memory_usage||0,this.used_memory=Ye(this.memory_usage*1024),this.total_memory=Ye(this.memory_total*1024)}}const Kt="cluster";function fi(t){return new li(t)}function Go(t={}){return $({query_params:t,fn:fi,path:Kt})}function Xo(t,e={}){return k({id:t,query_params:e,fn:fi,path:Kt})}function eu(t,e={}){return k({id:t,query_params:e,fn:n=>n.map(r=>new hi(t,r)),path:Kt})}function tu(t,e){return w({id:t,query_params:{driver:e},path:Kt})}class di extends j{domain;login_url;logout_url;description;config;internals;email_domains;constructor(e={}){super(e),this.description=e.description||"",this.domain=e.domain||"",this.login_url=e.login_url||"",this.logout_url=e.logout_url||"",this.config=e.config||{},this.internals=e.internals||{},this.email_domains=e.email_domains||[]}}const it="domains";function Gt(t){return new di(t)}function nu(t={}){return $({query_params:t,fn:Gt,path:it})}function ru(t,e={}){return k({id:t,query_params:e,fn:Gt,path:it})}function iu(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:Gt,path:it})}function su(t){return E({form_data:t,query_params:{},fn:Gt,path:it})}function ou(t,e={}){return w({id:t,query_params:e,path:it})}var we=(t=>(t[t.None=0]="None",t[t.Support=1]="Support",t[t.Admin=2]="Admin",t[t.NeverDisplay=3]="NeverDisplay",t))(we||{});class pe extends j{parent_id;updated_at;encryption_level;settings_string;keys;modified_by_id;get value(){return this.settings_string}constructor(e={}){super(e),this.parent_id=e.parent_id||"",this.updated_at=e.updated_at||Math.floor(new Date().getTime()/1e3),this.settings_string=e.settings_string||"",this.encryption_level=e.encryption_level||we.None,this.keys=e.keys||[],this.modified_by_id=e.modified_by_id||""}}var Ke=(t=>(t[t.SSH=0]="SSH",t[t.Device=1]="Device",t[t.Service=2]="Service",t[t.Websocket=3]="Websocket",t[t.Logic=99]="Logic",t))(Ke||{});class Nn extends j{class_name;description;module_name;role;default_uri;default_port;repository_id;file_name;commit;ignore_connected;update_available;update_info;settings;constructor(e={}){super(e),this.description=e.description||"",this.module_name=e.module_name||"",this.role=e.role??Ke.Logic,this.default_uri=e.default_uri||"",this.default_port=e.default_port||1,this.ignore_connected=e.ignore_connected||!1,this.class_name=e.class_name||"",this.repository_id=e.repository_id||"",this.file_name=e.file_name||"",this.commit=e.commit||"",this.update_available=e.update_available||!1,this.update_info=e.update_info,this.settings=e.settings||[null,null,null,null],typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in we)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new pe({parent_id:this.id,encryption_level:+n}))}}const oe="drivers";function Xt(t){return new Nn(t)}function uu(t={}){return $({query_params:t,fn:Xt,path:oe})}function cu(t,e={}){return k({id:t,query_params:e,fn:Xt,path:oe})}function au(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:Xt,path:oe})}function lu(t){return E({form_data:t,query_params:{},fn:Xt,path:oe})}function hu(t,e={}){return w({id:t,query_params:e,path:oe})}function fu(t){return y({id:t,task_name:"recompile",path:oe})}function du(t){return y({id:t,task_name:"reload",path:oe})}function pu(t){return y({id:t,task_name:"compiled",method:"get",path:oe})}function _u(t){return y({id:t,task_name:"readme",method:"get",path:oe})}class pi extends j{description;secret;x_api_key;online;last_seen;constructor(e={}){super(e),this.description=e.description||"",this.secret=e.secret||"",this.x_api_key=e.x_api_key||"",this.last_seen=(e.last_seen||0)*1e3||Date.now(),this.online=e.online||!1}toJSON(){const e=super.toJSON();return delete e.last_seen,e}}const Fe="edges";function en(t){return new pi(t)}function mu(t={}){return $({query_params:t,fn:en,path:Fe})}function yu(t,e={}){return k({id:t,query_params:e,fn:en,path:Fe})}function gu(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:en,path:Fe})}function vu(t){return E({form_data:t,query_params:{},fn:en,path:Fe})}function bu(t,e={}){return w({id:t,query_params:e,path:Fe})}function Su(t,e={}){return y({id:t,task_name:"token",form_data:e,method:"get",path:Fe})}class _i extends j{type="ldap";authority_id;host;port;auth_method;uid;base;bind_dn;password;filter;constructor(e={}){super(e),this.authority_id=e.authority_id||"",this.host=e.host||"",this.port=e.port||636,this.auth_method=e.auth_method||"ssl",this.uid=e.uid||"",this.base=e.base||"",this.bind_dn=e.bind_dn||"",this.password=e.password||"",this.filter=e.filter||""}}const st="ldap_auths";function tn(t){return new _i(t)}function ku(t={}){return $({query_params:t,fn:tn,path:st})}function Au(t,e={}){return k({id:t,query_params:e,fn:tn,path:st})}function xu(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:tn,path:st})}function $u(t){return E({form_data:t,query_params:{},fn:tn,path:st})}function wu(t,e={}){return w({id:t,query_params:e,path:st})}class Fn{id;name;description;details;editors;schema;updated_at;modified_by_id;version;constructor(e={}){this.id=e.id||e.parent_id||"",this.name=e.name||"",this.description=e.description||"";try{this.details=(typeof e.details=="string"?JSON.parse(e.details):e.details)||{}}catch{this.details=e.details||{}}this.editors=e.editors||[],this.schema=e.schema||"",this.updated_at=(e.updated_at||0)*1e3||Date.now(),this.modified_by_id=e.modified_by_id||"",this.version=e.version||0}}class Pe extends j{system_name;activated_count;description;debounce_period;important;enabled;enable_webhook;exec_enabled;webhook_secret;supported_methods;control_system_id;zone_id;trigger_id;playlists;get system_id(){return this.control_system_id}get actions(){const e=this._actions,n=(e.functions||[]).map(i=>({...i,args:{...i.args}})),r=(e.mailers||[]).map(i=>({...i,emails:[...i.emails]}));return{functions:n,mailers:r}}get conditions(){const e=this._conditions,n=(e.comparisons||[]).map(i=>({...i,left:typeof i.left=="object"?{...i.left}:i.left,right:typeof i.right=="object"?{...i.right}:i.right})),r=(e.time_dependents||[]).map(i=>({...i}));return{comparisons:n,time_dependents:r}}_actions;_conditions;constructor(e={}){super(e),this.description=e.description||"",this._actions=e.actions||{functions:[],mailers:[]},this._conditions=e.conditions||{comparisons:[],time_dependents:[]},this.debounce_period=e.debounce_period||0,this.important=e.important||!1,this.enabled=e.enabled||!1,this.webhook_secret=e.webhook_secret||"",this.control_system_id=e.system_id||e.control_system_id||"",this.zone_id=e.zone_id||"",this.system_name=e.system_name||(e.control_system?e.control_system.name:""),this.enable_webhook=e.enable_webhook||!1,this.exec_enabled=e.exec_enabled||!1,this.supported_methods=e.supported_methods||["POST"],this.activated_count=e.activated_count||e.trigger_count||0,this.playlists=e.playlists||[],this.trigger_id=e.trigger_id||""}}class nn extends j{settings=[null,null,null,null];description;parent_id;triggers;tags;location;display_name;code;type;count;capacity;map_id;images;timezone;playlists;trigger_list=[];constructor(e={}){super(e),this.description=e.description||"",this.tags=e.tags||[],this.triggers=e.triggers||[],this.settings=e.settings||[null,null,null,null],this.parent_id=e.parent_id||"",this.location=e.location||"",this.display_name=e.display_name||"",this.code=e.code||"",this.type=e.type||"",this.count=e.count||0,this.capacity=e.capacity||0,this.map_id=e.map_id||"",this.timezone=e.timezone||"",this.images=e.images||[],this.playlists=e.playlists||[],typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in we)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new pe({parent_id:this.id,encryption_level:+n}));e.trigger_data&&e.trigger_data instanceof Array&&(this.trigger_list=e.trigger_data.map(n=>new Pe(n)))}}class mi{zone;metadata;keys;constructor(e={}){this.zone=new nn(e.zone),this.keys=e.keys||[],this.metadata={};const n=e.metadata||{};for(const r of this.keys)this.metadata[r]=new Fn(n[r])}}const Te="metadata";function ot(t){return new Fn(t)}function Pu(t,e={}){return k({id:t,query_params:e,fn:n=>Object.keys(n).map(r=>ot(n[r])),path:Te})}function Tu(t){const e=[...t],n=[];for(;e.length;){const r=e.pop();Array.isArray(r)?e.push(...r):n.push(r)}return n.reverse()}function Ou(t,e={}){return y({id:t,task_name:"history",form_data:e,method:"get",callback:n=>Tu(Object.keys(n).map(r=>n[r].map(i=>ot(i)))),path:Te})}function Eu(t,e,n={}){return k({id:t,query_params:{...n,name:e},fn:r=>ot(r[e]),path:Te})}function Iu(t,e,n="put"){return I({id:t,form_data:e,query_params:{},method:n,fn:ot,path:Te})}function Mu(t){return E({form_data:t,query_params:{},fn:ot,path:Te})}function Ru(t,e={}){return w({id:t,query_params:e,path:Te})}function Du(t,e){return y({id:t,task_name:"children",form_data:e,method:"get",callback:n=>n.map(r=>new mi({...r,keys:Object.keys(r.metadata)})),path:Te})}class jn extends j{settings=[null,null,null,null];display_name;description;email;code;capacity;features;bookable;public;installed_ui_devices;support_url;timetable_url;camera_snapshot_url;camera_url;room_booking_url;map_id;modules;images;zones;timezone;module_list=[];signage;playlists;approval;orientation;constructor(e={}){super(e),this.display_name=e.display_name||"",this.description=e.description||"",this.email=e.email||"",this.code=e.code||"",this.capacity=e.capacity||0,this.features=e.features||[],this.bookable=e.bookable||!1,this.public=e.public??!1,this.installed_ui_devices=e.installed_ui_devices||0,this.support_url=e.support_url||"",this.camera_snapshot_url=e.camera_snapshot_url||"",this.camera_url=e.camera_url||"",this.timetable_url=e.timetable_url||"",this.room_booking_url=e.room_booking_url||"",this.map_id=e.map_id||"",this.modules=e.modules||[],this.images=e.images||[],this.zones=e.zones||[],this.settings=e.settings||[null,null,null,null],this.timezone=e.timezone||"",this.signage=e.signage||!1,this.playlists=e.playlists||[],this.orientation=e.orientation||"unspecified",this.approval=e.approval||!1,typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in we)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new pe({parent_id:this.id,encryption_level:+n}));e.module_data&&e.module_data instanceof Array&&(this.module_list=e.module_data.map(n=>new Ln(n)))}}class Ln extends j{connected;running;updated_at;edge_id;driver_id;driver;control_system_id;system;ip;tls;udp;port;makebreak;uri;custom_name;role;notes;ignore_connected;settings=[null,null,null,null];has_runtime_error;error_timestamp;get system_id(){return this.control_system_id}constructor(e={}){super(e),this.driver_id=e.driver_id||e.dependency_id||"",this.control_system_id=e.control_system_id||"",this.edge_id=e.edge_id||"",this.ip=e.ip||"",this.tls=e.tls||!1,this.udp=e.udp||!1,this.port=e.port||1,this.makebreak=e.makebreak||!1,this.uri=e.uri||"",this.custom_name=e.custom_name||"",this.role=e.role??Ke.Logic,this.notes=e.notes||"",this.ignore_connected=e.ignore_connected||!1,this.connected=e.connected,this.running=e.running||!1,this.updated_at=e.updated_at||0,this.system=new jn(e.control_system||e.system),this.has_runtime_error=e.has_runtime_error||!1,this.error_timestamp=e.error_timestamp||0,this.driver=new Nn(e.dependency||e.driver),this.settings=e.settings||[null,null,null,null],typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in we)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new pe({parent_id:this.id,encryption_level:+n}))}toJSON(e=!1){const n=super.toJSON();return(n.role!==Ke.Logic&&!e||!n.control_system_id)&&delete n.control_system_id,delete n.driver,delete n.system,delete n.error_timestamp,delete n.has_runtime_error,n}}const J="modules";function rn(t){return new Ln(t)}function qu(t={}){return $({query_params:t,fn:rn,path:J})}function Uu(t,e={}){return k({id:t,query_params:e,fn:rn,path:J})}function Cu(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:rn,path:J})}function Nu(t){return E({form_data:t,query_params:{},fn:rn,path:J})}function Fu(t,e={}){return w({id:t,query_params:e,path:J})}function ju(t){return y({id:t,task_name:"start",path:J})}function Lu(t){return y({id:t,task_name:"stop",path:J})}function Hu(t){return y({id:t,task_name:"state",method:"get",path:J})}function zu(t,e){return y({id:t,task_name:`state${e}`,method:"get",path:J})}function Bu(t){return y({id:t,task_name:"load",method:"post",path:J})}function Wu(t){return y({id:t,task_name:"settings",method:"get",callback:e=>e.map(n=>new pe(n)),path:J})}function Qu(t){return y({id:t,task_name:"error",method:"get",path:J})}class yi extends j{type="oauth";authority_id;client_id;client_secret;info_mappings;site;authorize_url;token_method;token_url;auth_scheme;scope;raw_info_url;authorize_params;ensure_matching;constructor(e={}){super(e),this.authority_id=e.authority_id||"",this.client_id=e.client_id||"",this.client_secret=e.client_secret||"",this.info_mappings=e.info_mappings||{},this.authorize_params=e.authorize_params||{},this.ensure_matching=e.ensure_matching||{},this.site=e.site||"",this.authorize_url=e.authorize_url||"oauth/authorize",this.token_method=e.token_method||"post",this.token_url=e.token_url||"oauth/token",this.auth_scheme=e.auth_scheme||"request_body",this.scope=e.scope||"",this.raw_info_url=e.raw_info_url||"",this.authorize_params=e.authorize_params||{},this.ensure_matching=e.ensure_matching||{}}}const ut="oauth_auths";function sn(t){return new yi(t)}function Zu(t={}){return $({query_params:t,fn:sn,path:ut})}function Vu(t,e={}){return k({id:t,query_params:e,fn:sn,path:ut})}function Yu(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:sn,path:ut})}function Ju(t){return E({form_data:t,query_params:{},fn:sn,path:ut})}function Ku(t,e={}){return w({id:t,query_params:e,path:ut})}var Hn=(t=>(t.Driver="driver",t.Interface="interface",t))(Hn||{});class gi extends j{folder_name;description;uri;branch;commit_hash;repo_type;username;password;root_path;get type(){return this.repo_type}constructor(e={}){super(e),this.folder_name=e.folder_name||"",this.description=e.description||"",this.uri=e.uri||"",this.branch=e.branch||"",this.commit_hash=e.commit_hash||"",this.repo_type=e.repo_type||Hn.Driver,this.username=e.username||"",this.password=e.password||"",this.root_path=e.root_path||""}}const Q="repositories";function on(t){return new gi(t)}function Gu(t={}){return $({query_params:t,fn:on,path:Q})}function Xu(t,e={}){return k({id:t,query_params:e,fn:on,path:Q})}function ec(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:on,path:Q})}function tc(t){return E({form_data:t,query_params:{},fn:on,path:Q})}function nc(t,e={}){return w({id:t,query_params:e,path:Q})}function rc(t={}){return k({id:"interfaces",query_params:t,path:Q})}function ic(t){return k({id:"remote_default_branch",query_params:t,path:Q})}function sc(t){return k({id:"remote_branches",query_params:t,path:Q})}function oc(t){return k({id:"remote_commits",query_params:t,path:Q})}function uc(t,e){return y({id:t,task_name:"drivers",form_data:e,method:"get",path:Q})}function cc(t,e){return y({id:t,task_name:"commits",form_data:e,method:"get",path:Q})}function ac(t){return y({id:t,task_name:"branches",method:"get",path:Q})}function lc(t){return y({id:t,task_name:"default_branch",method:"get",path:Q})}function hc(t,e){return y({id:t,task_name:"details",form_data:e,method:"get",path:Q})}function fc(t,e){return y({id:t,task_name:"pull",form_data:e,method:"post",path:Q})}class vi extends j{type="saml";authority_id;issuer;idp_sso_target_url_runtime_params;name_identifier_format;uid_attribute;assertion_consumer_service_url;idp_sso_target_url;idp_cert;idp_cert_fingerprint;attribute_service_name;attribute_statements;request_attributes;idp_slo_target_url;slo_default_relay_state;constructor(e={}){super(e),this.authority_id=e.authority_id||"",this.issuer=e.issuer||"",this.idp_sso_target_url_runtime_params=e.idp_sso_target_url_runtime_params||{},this.name_identifier_format=e.name_identifier_format||"",this.uid_attribute=e.uid_attribute||"",this.assertion_consumer_service_url=e.assertion_consumer_service_url||"",this.idp_sso_target_url=e.idp_sso_target_url||"",this.idp_cert=e.idp_cert||"",this.idp_cert_fingerprint=e.idp_cert_fingerprint||"",this.attribute_service_name=e.attribute_service_name||"",this.attribute_statements=e.attribute_statements||{},this.request_attributes=e.request_attributes||[],this.idp_slo_target_url=e.idp_slo_target_url||"",this.slo_default_relay_state=e.slo_default_relay_state||""}}const ct="saml_auths";function un(t){return new vi(t)}function dc(t={}){return $({query_params:t,fn:un,path:ct})}function pc(t,e={}){return k({id:t,query_params:e,fn:un,path:ct})}function _c(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:un,path:ct})}function mc(t){return E({form_data:t,query_params:{},fn:un,path:ct})}function yc(t,e={}){return w({id:t,query_params:e,path:ct})}const je="settings";function at(t){return new pe(t)}function gc(t={}){return $({query_params:t,fn:at,path:je})}function vc(t,e={}){return k({id:t,query_params:e,fn:at,path:je})}function bc(t,e,n={},r="patch"){return I({id:t,form_data:e,query_params:n,method:r,fn:at,path:je})}function Sc(t,e={}){return E({form_data:t,query_params:e,fn:at,path:je})}function kc(t,e={}){return w({id:t,query_params:e,path:je})}function Ac(t,e={}){return y({id:t,task_name:"history",form_data:e,method:"get",callback:n=>n.map(r=>at(r)),path:je})}const q="systems";function Oe(t){return new jn(t)}function xc(t={}){return $({query_params:t,fn:Oe,path:q})}function $c(t={}){return $({query_params:t,fn:Oe,path:`${q}/with_emails`})}function wc(t,e={}){return k({id:t,query_params:e,fn:Oe,path:q})}function Pc(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:Oe,path:q})}function Tc(t){return E({form_data:t,query_params:{},fn:Oe,path:q})}function Oc(t,e={}){return w({id:t,query_params:e,path:q})}function Ec(t,e,n={}){return y({id:t,task_name:`module/${e}`,form_data:n,method:"put",callback:r=>Oe(r),path:q})}function Ic(t,e){return y({id:t,task_name:`module/${e}`,form_data:{},method:"del",callback:n=>Oe(n),path:q})}function Mc(t){return y({id:t,task_name:"start",form_data:{},path:q})}function Rc(t){return y({id:t,task_name:"stop",path:q})}function Dc(t,e,n,r=1,i=[]){return y({id:t,task_name:`${n}_${r}/${encodeURIComponent(e)}`,form_data:i,path:q})}function qc(t,e,n=1){return y({id:t,task_name:`${e}_${n}`,method:"get",path:q})}function Uc(t,e,n=1,r){return y({id:t,task_name:`${e}_${n}/${r}`,method:"get",path:q})}function Cc(t,e,n=1){return y({id:t,task_name:`functions/${e}_${n}`,method:"get",path:q})}function Nc(t){return $({query_params:{},fn:e=>new nn(e),path:`${q}/${t}/zones`})}function Fc(t){return $({query_params:{},fn:e=>new Pe(e),path:`${q}/${t}/triggers`})}function jc(t,e){return y({id:t,task_name:"triggers",form_data:e,method:"post",callback:n=>new Pe(n),path:q})}function Lc(t,e){return y({id:t,task_name:`triggers/${e}`,method:"del",path:q})}function Hc(t){return y({id:t,task_name:"settings",method:"get",callback:e=>e.map(n=>new pe(n)),path:q})}const Le="triggers";function cn(t){return new Pe(t)}function zc(t={}){return $({query_params:t,fn:cn,path:Le})}function Bc(t,e={}){return k({id:t,query_params:e,fn:cn,path:Le})}function Wc(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:cn,path:Le})}function Qc(t){return E({form_data:t,query_params:{},fn:cn,path:Le})}function Zc(t,e={}){return w({id:t,query_params:e,path:Le})}function Vc(t){return y({id:t,task_name:"instances",form_data:{},method:"get",callback:e=>e.map(n=>new Pe(n)),path:Le})}var bi=(t=>(t.EQ="equal",t.NEQ="not_equal",t.GT="greater_than",t.GTE="greater_than_or_equal",t.LT="less_than",t.LTE="less_than_or_equal",t.AND="and",t.OR="or",t.XOR="exclusive_or",t))(bi||{}),Si=(t=>(t.AT="at",t.CRON="cron",t))(Si||{}),ki=(t=>(t[t.ExecuteBefore=0]="ExecuteBefore",t[t.ExecuteAfter=1]="ExecuteAfter",t[t.PayloadOnly=2]="PayloadOnly",t[t.IgnorePayload=3]="IgnorePayload",t))(ki||{});class Ai extends j{email_digest;authority_id;email;phone;country;building;groups;image;metadata;login_name;staff_id;first_name;last_name;support;sys_admin;ui_theme;card_number;department;work_preferences;work_overrides;photo_upload_id;locatable;password="";confirm_password="";constructor(e={}){super(e),this.authority_id=e.authority_id||"",this.email=e.email||"",this.email_digest=e.email_digest||"",this.phone=e.phone||"",this.country=e.country||"",this.building=e.building||"",this.image=e.image||"",this.metadata=e.metadata||"",this.login_name=e.login_name||"",this.staff_id=e.staff_id||"",this.first_name=e.first_name||"",this.last_name=e.last_name||"",this.support=!!e.support,this.sys_admin=!!e.sys_admin,this.ui_theme=e.ui_theme||"",this.card_number=e.card_number||"",this.groups=e.groups||[],this.department=e.department||"",this.photo_upload_id=e.photo_upload_id||"",this.work_preferences=e.work_preferences||[],this.work_overrides=e.work_overrides||{},this.locatable=e.locatable??!0}}const He="users";function lt(t){return new Ai(t)}function Yc(t={}){return $({query_params:t,fn:lt,path:He})}function Jc(t,e={}){return k({id:t,query_params:e,fn:lt,path:He})}function Kc(t={}){return k({id:"current",query_params:t,fn:lt,path:He})}function Gc(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:lt,path:He})}function Xc(t){return E({form_data:t,query_params:{},fn:lt,path:He})}function ea(t,e={}){return w({id:t,query_params:e,path:He})}const _e="zones";function an(t){return new nn(t)}function ta(t={}){return $({query_params:t,fn:an,path:_e})}function na(t={}){return k({id:"tags",query_params:t,fn:e=>e,path:_e})}function ra(t,e={}){return k({id:t,query_params:e,fn:an,path:_e})}function ia(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:an,path:_e})}function sa(t){return E({form_data:t,query_params:{},fn:an,path:_e})}function oa(t,e={}){return w({id:t,query_params:e,path:_e})}function ua(t,e={}){return $({query_params:e,fn:n=>new Pe(n),path:`${_e}/${t}/triggers`})}function ca(t,e,n,r=1,i=[]){return y({id:t,task_name:`exec/${encodeURIComponent(n+"_"+r)}/${encodeURIComponent(e)}`,form_data:i,path:_e})}var zn=(t=>(t[t.Default=0]="Default",t[t.Cut=1]="Cut",t[t.CrossFade=2]="CrossFade",t[t.SlideTop=3]="SlideTop",t[t.SlideLeft=4]="SlideLeft",t[t.SlideRight=5]="SlideRight",t[t.SlideBottom=6]="SlideBottom",t))(zn||{});class xi{id;created_at;updated_at;name;description;authority_id;start_time;play_time;video_length;animation;media_type;orientation;media_uri;media_id;thumbnail_id;play_count;valid_from;valid_until;get media_url(){return this.media_id?`/api/engine/v2/uploads/${this.media_id}/url`:this.media_uri}get thumbnail_url(){return`/api/engine/v2/uploads/${this.thumbnail_id}/url`}constructor(e){this.id=e.id||"",this.created_at=e.created_at||or(Date.now()),this.updated_at=e.updated_at||or(Date.now()),this.name=e.name||"",this.description=e.description||"",this.authority_id=e.authority_id||"",this.start_time=e.start_time||0,this.play_time=e.play_time||0,this.video_length=e.video_length||0,this.animation=e.animation,this.media_type=e.media_type||"unknown",this.orientation=e.orientation||"unspecified",this.media_uri=e.media_uri||"",this.media_id=e.media_id||"",this.thumbnail_id=e.thumbnail_id||"",this.play_count=e.play_count||0,this.valid_from=e.valid_from,this.valid_until=e.valid_until}}class ln{id;playlist_id;items;created_at;updated_at;user_id;user_name;user_email;approved;approved_by_id;approved_by_email;approved_by_name;constructor(e={}){this.id=e.id||"",this.playlist_id=e.playlist_id||"",this.created_at=e.created_at||0,this.updated_at=e.updated_at||0,this.items=e.items||[],this.approved=!!e.approved,this.approved_by_id=e.approved_by_id||"",this.approved_by_email=e.approved_by_email||"",this.approved_by_name=e.approved_by_name||"",this.user_id=e.user_id||"",this.user_name=e.user_name||"",this.user_email=e.user_email||""}}class $i{id;created_at;updated_at;name;description;authority_id;orientation;play_count;play_through_count;default_animation;random;enabled;default_duration;play_hours;play_at;play_cron;valid_from;valid_until;constructor(e){this.id=e.id||"",this.created_at=e.created_at||0,this.updated_at=e.updated_at||0,this.name=e.name||"",this.description=e.description||"",this.authority_id=e.authority_id||"",this.orientation=e.orientation||"",this.play_count=e.play_count||0,this.play_through_count=e.play_through_count||0,this.default_animation=e.default_animation||zn.Cut,this.random=e.random||!1,this.enabled=e.enabled??!0,this.default_duration=e.default_duration??15*1e3,this.valid_from=e.valid_from,this.valid_until=e.valid_until,this.play_hours=e.play_hours||"",this.play_at=e.play_at||"",this.play_cron=e.play_cron||""}}const wi="signage";function aa(t,e={},n){return k({id:t,query_params:e,fn:r=>r,path:`${wi}`,options:n})}function la(t){return y({id:t,task_name:"metrics",form_data:{},method:"post",callback:e=>e,path:wi})}const ht="signage/media";function hn(t){return new xi(t)}function ha(t={}){return $({query_params:t,fn:hn,path:ht})}function fa(t,e={}){return k({id:t,query_params:e,fn:hn,path:ht})}function da(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:hn,path:ht})}function pa(t){return E({form_data:t,query_params:{},fn:hn,path:ht})}function _a(t,e={}){return w({id:t,query_params:e,path:ht})}const ue="signage/playlists";function fn(t){return new $i(t)}function ma(t={}){return $({query_params:t,fn,path:ue})}function ya(t,e={}){return k({id:t,query_params:e,fn,path:ue})}function ga(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn,path:ue})}function va(t){return E({form_data:t,query_params:{},fn,path:ue})}function ba(t,e={}){return w({id:t,query_params:e,path:ue})}function Sa(t,e={}){return y({id:t,task_name:"media",form_data:e,method:"get",callback:n=>new ln(n),path:ue})}function ka(t,e={}){return y({id:t,task_name:"media/revisions",form_data:e,method:"get",callback:n=>n.map(r=>new ln(r)),path:ue})}function Aa(t){return y({id:t,task_name:"media/approve",method:"post",path:ue})}function xa(t,e){return y({id:t,task_name:"media",form_data:e,method:"post",path:ue,callback:n=>new ln(n)})}class Bn{id;question_id;survey_id;type;answer_json;constructor(e){this.id=e.id||0,this.question_id=e.question_id||0,this.survey_id=e.survey_id||0,this.type=e.type||"",this.answer_json=e.answer_json||{}}}const Pi="/api/staff/v1/surveys/answers";function $a(t={}){const e=F(t);return ee(`${Pi}${e?"?"+e:""}`).pipe(O(n=>n.map(r=>new Bn(r))))}function wa(t){return de(`${Pi}`,t).pipe(O(e=>e.map(n=>new Bn(n))))}class ft{id;survey_id;token;email;sent;constructor(e){this.id=e.id||0,this.survey_id=e.survey_id||0,this.token=e.token||"",this.email=e.email||"",this.sent=e.sent??!1}}const dt="/api/staff/v1/surveys/invitations";function Pa(t={}){const e=F(t);return ee(`${dt}${e?"?"+e:""}`).pipe(O(n=>n.map(r=>new ft(r))))}function Ta(t,e={}){const n=F(e);return ee(`${dt}/${t}${n?"?"+n:""}`).pipe(O(r=>new ft(r)))}function Oa(t,e,n="patch"){return(n==="put"?xe:Ce)(`${dt}/${t}`,e).pipe(O(r=>new ft(r)))}function Ea(t){return de(`${dt}`,t).pipe(O(e=>new ft(e)))}function Ia(t,e={}){const n=F(e);return $e(`${dt}/${t}${n?"?"+n:""}`)}class pt{id;title;description;type;options;required;max_rating;choices;tags;deleted;constructor(e){this.id=e.id||0,this.title=e.title||"",this.description=e.description||"",this.type=e.type||"",this.options=e.options||{},this.required=e.required||!1,this.max_rating=e.max_rating||0,this.choices=e.choices||[],this.tags=e.tags||[],this.deleted=e.deleted||!1}}const _t="/api/staff/v1/surveys/questions";function Ma(t={}){const e=F(t);return ee(`${_t}${e?"?"+e:""}`).pipe(O(n=>n.map(r=>new pt(r))))}function Ra(t,e={}){const n=F(e);return ee(`${_t}/${t}${n?"?"+n:""}`).pipe(O(r=>new pt(r)))}function Da(t){return de(`${_t}`,t).pipe(O(e=>new pt(e)))}function qa(t,e,n="patch"){return(n==="put"?xe:Ce)(`${_t}/${t}`,e).pipe(O(r=>new pt(r)))}function Ua(t,e={}){const n=F(e);return $e(`${_t}/${t}${n?"?"+n:""}`)}class mt{id;title;description;trigger;building_id;zone_id;pages;constructor(e){this.id=e.id||0,this.title=e.title||"",this.description=e.description||"",this.building_id=e.building_id||"",this.zone_id=e.zone_id||"",this.pages=e.pages||[],this.trigger=e.trigger||"NONE"}}const yt="/api/staff/v1/surveys";function Ca(t={}){const e=F(t);return ee(`${yt}${e?"?"+e:""}`).pipe(O(n=>n.map(r=>new mt(r))))}function Na(t,e={}){const n=F(e);return ee(`${yt}/${t}${n?"?"+n:""}`).pipe(O(r=>new mt(r)))}function Fa(t,e,n="patch"){return(n==="put"?xe:Ce)(`${yt}/${t}`,e).pipe(O(r=>new mt(r)))}function ja(t){return de(`${yt}`,t).pipe(O(e=>new mt(e)))}function La(t,e={}){const n=F(e);return $e(`${yt}/${t}${n?"?"+n:""}`)}class Ti{id;parent_category_id;name;description;hidden;created_at;updated_at;constructor(e){this.id=e.id||"",this.parent_category_id=e.parent_category_id||"",this.name=e.name||"",this.description=e.description||"",this.hidden=e.hidden||!1,this.created_at=e.created_at||0,this.updated_at=e.updated_at||0}}class Oi{id;purchase_order_number;invoice_number;supplier_details;purchase_date;unit_price;expected_service_start_date;expected_service_end_date;created_at;updated_at;constructor(e){this.id=e.id||"",this.purchase_order_number=e.purchase_order_number||"",this.invoice_number=e.invoice_number||"",this.supplier_details=e.supplier_details||{},this.purchase_date=e.purchase_date||0,this.unit_price=e.unit_price||0,this.expected_service_start_date=e.expected_service_start_date||0,this.expected_service_end_date=e.expected_service_end_date||0,this.created_at=e.created_at||0,this.updated_at=e.updated_at||0}}class Ei{id;category_id;name;brand;description;model_number;images;created_at;updated_at;constructor(e){this.id=e.id||"",this.category_id=e.category_id||"",this.name=e.name||"",this.brand=e.brand||"",this.description=e.description||"",this.model_number=e.model_number||"",this.images=e.images||[],this.created_at=e.created_at||0,this.updated_at=e.updated_at||0}}class Ii{id;parent_id;asset_type_id;purchase_order_id;zone_id;identifier;serial_number;other_data;barcode;name;client_ids;map_id;bookable;accessible;zones;place_groups;assigned_to;assigned_name;features;images;notes;security_system_groups;created_at;updated_at;constructor(e){this.id=e.id||"",this.parent_id=e.parent_id||"",this.asset_type_id=e.asset_type_id||"",this.purchase_order_id=e.purchase_order_id||"",this.zone_id=e.zone_id||"",this.identifier=e.identifier||"",this.serial_number=e.serial_number||"",this.other_data=e.other_data||{},this.barcode=e.barcode||"",this.name=e.name||"",this.client_ids=e.client_ids||{},this.map_id=e.map_id||"",this.bookable=e.bookable||!1,this.accessible=e.accessible||!1,this.zones=e.zones||[],this.place_groups=e.place_groups||[],this.assigned_to=e.assigned_to||"",this.assigned_name=e.assigned_name||"",this.features=e.features||[],this.images=e.images||[],this.notes=e.notes||"",this.security_system_groups=e.security_system_groups||[],this.created_at=e.created_at||0,this.updated_at=e.updated_at||0}}const me="assets";function Ee(t){return new Ii(t)}function Ha(t={}){return $({query_params:t,fn:Ee,path:me})}function za(t,e={}){return k({id:t,query_params:e,fn:Ee,path:me})}function Ba(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:Ee,path:me})}function Wa(t){return E({form_data:t,query_params:{},fn:Ee,path:me})}function Qa(t,e={}){return w({id:t,query_params:e,path:me})}function Za(t){return de(`${X()}${me}/bulk`,JSON.stringify(t),{}).pipe(O(e=>e.map(n=>Ee(n))))}function Va(t,e="patch"){return(e==="put"?xe:Ce)(`${X()}${me}/bulk`,JSON.stringify(t),{}).pipe(O(r=>r.map(i=>Ee(i))))}function Ya(t,e={}){const n=F(e);return $e(`${X()}${me}/bulk${n?"?"+n:""}`,{body:JSON.stringify(t)}).pipe(O(r=>r.map(i=>Ee(i))))}const gt="asset_types";function dn(t){return new Ei(t)}function Ja(t={}){return $({query_params:t,fn:dn,path:gt})}function Ka(t,e={}){return k({id:t,query_params:e,fn:dn,path:gt})}function Ga(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:dn,path:gt})}function Xa(t){return E({form_data:t,query_params:{},fn:dn,path:gt})}function el(t,e={}){return w({id:t,query_params:e,path:gt})}const vt="asset_categories";function pn(t){return new Ti(t)}function tl(t={}){return $({query_params:t,fn:pn,path:vt})}function nl(t,e={}){return k({id:t,query_params:e,fn:pn,path:vt})}function rl(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:pn,path:vt})}function il(t){return E({form_data:t,query_params:{},fn:pn,path:vt})}function sl(t,e={}){return w({id:t,query_params:e,path:vt})}const bt="asset_purchase_orders";function _n(t){return new Oi(t)}function ol(t={}){return $({query_params:t,fn:_n,path:bt})}function ul(t,e={}){return k({id:t,query_params:e,fn:_n,path:bt})}function cl(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:_n,path:bt})}function al(t){return E({form_data:t,query_params:{},fn:_n,path:bt})}function ll(t,e={}){return w({id:t,query_params:e,path:bt})}var hl={url:"",deserializer:function(t){return JSON.parse(t.data)},serializer:function(t){return JSON.stringify(t)}},fl="WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }",dl=function(t){G(e,t);function e(n,r){var i=t.call(this)||this;if(i._socket=null,n instanceof D)i.destination=r,i.source=n;else{var s=i._config=Ze({},hl);if(i._output=new be,typeof n=="string")s.url=n;else for(var o in n)n.hasOwnProperty(o)&&(s[o]=n[o]);if(!s.WebSocketCtor&&WebSocket)s.WebSocketCtor=WebSocket;else if(!s.WebSocketCtor)throw new Error("no WebSocket constructor can be found");i.destination=new yn}return i}return e.prototype.lift=function(n){var r=new e(this._config,this.destination);return r.operator=n,r.source=this,r},e.prototype._resetState=function(){this._socket=null,this.source||(this.destination=new yn),this._output=new be},e.prototype.multiplex=function(n,r,i){var s=this;return new D(function(o){try{s.next(n())}catch(c){o.error(c)}var u=s.subscribe({next:function(c){try{i(c)&&o.next(c)}catch(l){o.error(l)}},error:function(c){return o.error(c)},complete:function(){return o.complete()}});return function(){try{s.next(r())}catch(c){o.error(c)}u.unsubscribe()}})},e.prototype._connectSocket=function(){var n=this,r=this._config,i=r.WebSocketCtor,s=r.protocol,o=r.url,u=r.binaryType,c=this._output,l=null;try{l=s?new i(o,s):new i(o),this._socket=l,u&&(this._socket.binaryType=u)}catch(m){c.error(m);return}var _=new ke(function(){n._socket=null,l&&l.readyState===1&&l.close()});l.onopen=function(m){var p=n._socket;if(!p){l.close(),n._resetState();return}var a=n._config.openObserver;a&&a.next(m);var f=n.destination;n.destination=Lt.create(function(h){if(l.readyState===1)try{var S=n._config.serializer;l.send(S(h))}catch(g){n.destination.error(g)}},function(h){var S=n._config.closingObserver;S&&S.next(void 0),h&&h.code?l.close(h.code,h.reason):c.error(new TypeError(fl)),n._resetState()},function(){var h=n._config.closingObserver;h&&h.next(void 0),l.close(),n._resetState()}),f&&f instanceof yn&&_.add(f.subscribe(n.destination))},l.onerror=function(m){n._resetState(),c.error(m)},l.onclose=function(m){l===n._socket&&n._resetState();var p=n._config.closeObserver;p&&p.next(m),m.wasClean?c.complete():c.error(m)},l.onmessage=function(m){try{var p=n._config.deserializer;c.next(p(m))}catch(a){c.error(a)}}},e.prototype._subscribe=function(n){var r=this,i=this.source;return i?i.subscribe(n):(this._socket||this._connectSocket(),this._output.subscribe(n),n.add(function(){var s=r._socket;r._output.observers.length===0&&(s&&(s.readyState===1||s.readyState===0)&&s.close(),r._resetState())}),n)},e.prototype.unsubscribe=function(){var n=this._socket;n&&(n.readyState===1||n.readyState===0)&&n.close(),this._resetState(),t.prototype.unsubscribe.call(this)},e}(kn);function pl(t){return new dl(t)}var K=(t=>(t[t.PARSE_ERROR=0]="PARSE_ERROR",t[t.BAD_REQUEST=1]="BAD_REQUEST",t[t.ACCESS_DENIED=2]="ACCESS_DENIED",t[t.REQUEST_FAILED=3]="REQUEST_FAILED",t[t.UNKNOWN_CMD=4]="UNKNOWN_CMD",t[t.SYS_NOT_FOUND=5]="SYS_NOT_FOUND",t[t.MOD_NOT_FOUND=6]="MOD_NOT_FOUND",t[t.UNEXPECTED_FAILURE=7]="UNEXPECTED_FAILURE",t))(K||{}),Wn=(t=>(t.Info="info",t.Debug="debug",t.Warning="warn",t.Error="error",t.Fatal="fatal",t.Trace="trace",t))(Wn||{});class Mi{constructor(e,n){this._system=e;const r=Object.getOwnPropertyNames(Object.getPrototypeOf(n)).filter(i=>i.startsWith("$"));for(const i in n)n.hasOwnProperty(i)&&n[i]!==void 0&&(n[i]instanceof Function?this.addMethod(i,n[i]):this.addProperty(i,n[i]));for(const i of r)n[i]instanceof Function&&this.addMethod(i,n[i])}call(e,n=[]){return this[`$${e}`]instanceof Function?this[`$${e}`](...n):null}listen(e){return!this[`_${e}`]&&!(this[`_${e}_obs`]instanceof D)&&!this[e]&&this.addProperty(e,null),this[`_${e}_obs`]}addMethod(e,n){e[0]!=="$"&&(e=`$${e}`),this[e]=n}addProperty(e,n){e[0]==="$"&&(e=e.replace("$","")),this[`_${e}`]=new fe(n),this[`_${e}_obs`]=this[`_${e}`].asObservable(),Object.defineProperty(this,e,{get:()=>this[`_${e}`].getValue(),set:r=>this[`_${e}`].next(r)})}}class Ri{constructor(e){for(const n in e)e.hasOwnProperty(n)&&e[n]&&e[n]instanceof Array&&e[n].forEach(r=>{this.addModule(n,r)})}addModule(e,n){this[e]||(this[e]=[]),this[e].push(new Mi(this,n))}}const Nt={};function _l(t,e){return Nt[t]=new Ri(e),Nt[t]}function Di(t){return Nt[t]}function ml(t){delete Nt[t]}const qi=15;let St=0,V,Ui=0;const z={},Qn={},Ie={},yl={},ye=new fe(!1);Ie._place_os_status=ye.asObservable();const Ci=new fe([0,0]);Ie._place_os_sync=Ci.asObservable();let Ni=Date.now(),De,Ft=0,ce=null,Tt,Zn=0;const kt=10*1e3,Vn=new be;Ie._place_os_debug_events=Vn.asObservable();function Ot(){return X().indexOf("/control/")>=0?"/control/websocket":`${Mn()}/systems/control`}function Yn(){return ye.getValue()}function Fi(){return Ie._place_os_status}function gl(){return Ie._place_os_sync}function ji(t,e=Qn,n=Ie){const r=`${t.sys}|${t.mod}_${t.index}|${t.name}`;return e[r]||(e[r]=new fe(void 0),n[r]=e[r].asObservable()),n[r]}function Li(t,e=Qn){const n=`${t.sys}|${t.mod}_${t.index}|${t.name}`;if(e[n])return e[n].getValue()}function xn(t,e=0,n=ze){const r={id:++St,cmd:"bind",...t};return n(r,e)}function Hi(t,e=0,n=ze){const r={id:++St,cmd:"unbind",...t};return n(r,e)}function zi(t,e=kt,n=ze){const r={id:++St,cmd:"exec",...t};return n(r,e)}function vl(t,e=kt,n=ze){const r={id:++St,cmd:"debug",...t};return n(r,e)}function bl(t,e=kt,n=ze){const r={id:++St,cmd:"ignore",...t};return n(r,e)}function ze(t,e=kt,n=0){const r=`${t.cmd}|${t.sys}|${t.mod}${t.index}|${t.name}|${t.args}|${zr()}`;if(z[r])d("WS","Request already in progress. Waiting...",t);else{const i={...t,key:r};i.promise=new Promise((s,o)=>{const u=()=>{delete z[r],z[r]=null,ze(t,e,n).then(c=>s(c),c=>o(c))};if(V&&Yn()){zt()&&Pl(t,V,yl),i.resolve=s,i.reject=o;const c=`${t.sys}, ${t.mod}_${t.index}, ${t.name}`;d("WS",`[${t.cmd.toUpperCase()}](${t.id}) ${c}`,t.args),V.next(t),e>0&&re(`${r}`,()=>{o("Request timed out."),delete z[r],z[r]=null},e)}else ce?setTimeout(()=>u(),1e3):Jn().then(()=>u())}),z[r]=i}return z[r].promise}function Bi(t){if(t!=="pong"&&t instanceof Object){if(t.type==="notify"&&t.meta)Al(t.meta,t.value);else if(t.type==="success")Sl(t);else if(t.type==="debug"){d("WS",`[DEBUG] ${t.mod}${t.klass||""} →`,t.msg);const e=t.meta||{mod:"",index:""};Vn.next({mod_id:t.mod||"<empty>",module:`${e.mod}_${e.index}`,class_name:t.klass||"<empty>",message:t.msg||"<empty>",level:t.level||Wn.Debug,time:Math.floor(new Date().getTime()/1e3)})}else t.type==="error"?kl(t):t.cmd||d("WS","Invalid websocket message",t,"error");Ae(`${t.id}`)}else t==="pong"&&(Zn=Date.now(),d("WS","Pong!"))}function Sl(t){const e=Object.keys(z).map(n=>z[n]).find(n=>n?.id===t.id);d("WS",`[SUCCESS](${t.id})`),e&&e.resolve&&(e.resolve(t.value),delete z[e.key])}function kl(t){let e="UNEXPECTED FAILURE";switch(t.code){case K.ACCESS_DENIED:e="ACCESS DENIED";break;case K.BAD_REQUEST:e="BAD REQUEST";break;case K.MOD_NOT_FOUND:e="MODULE NOT FOUND";break;case K.SYS_NOT_FOUND:e="SYSTEM NOT FOUND";break;case K.PARSE_ERROR:e="PARSE ERROR";break;case K.REQUEST_FAILED:e="REQUEST FAILED";break;case K.UNKNOWN_CMD:e="UNKNOWN COMMAND";break}d("WS",`[ERROR] ${e}(${t.id}): ${t.msg}`,void 0,"error");const n=Object.keys(z).map(r=>z[r]).filter(r=>r).find(r=>r.id===t.id);n&&n.reject&&(n.reject(t),Ae(`${n.key}`),delete z[n.key])}function Al(t,e,n=Qn,r=Ie){const i=`${t.sys}|${t.mod}_${t.index}|${t.name}`;n[i]||(n[i]=new fe(null),r[i]=n[i].asObservable());const s=`${t.sys}, ${t.mod}_${t.index}, ${t.name}`;d("WS",`[NOTIFY] ${s} changed`,[n[i].getValue(),"→",e]),n[i].next(e)}function Jn(t=0){return ce==null&&(ce=new Promise(e=>{if(t>40)return location.reload();Ft++,Ni=Date.now(),V=zt()?wl():xl(),V?(d("WS(Debug)","Authority:",[Je()]),d("WS","Connecting to websocket..."),V.subscribe(n=>{ye.getValue()||(d("WS","Connection established."),e()),ye.next(!0),Ft=0,gn(),Bi(n)},n=>{V=void 0,ce=null,fr(),gn(),$l(n)},()=>{V=void 0,ce=null,fr(),d("WS","Connection closed by browser."),ye.next(!1),jt()}),De&&clearInterval(De),Zn=Date.now(),hr(),De=setInterval(()=>hr(),qi*1e3),gn(),Ui+=1,Tt=setTimeout(()=>{d("WS","Unhealthy connection. Reconnecting..."),ye.next(!1),ce=null,jt()},30*1e3)):(V?d("WS",`Waiting on auth(${t}). Retrying in ${1e3*Math.min(10,t+1)}ms...`,[!!Z(),!!Je()],"info"):d("WS",`Failed to create websocket(${t}). Retrying in ${1e3*Math.min(10,t+1)}ms...`,void 0,"error"),setTimeout(()=>{ce=null,Jn(t).then(n=>e(n))},1e3*Math.min(10,++t)))})),ce}function xl(){if(!Je()||!Z())return null;const t=Vr()||location.protocol.indexOf("https")>=0;let e=`ws${t?"s":""}://${Ut()}${Ot()}${Rn()?"?fixed_device=true":""}`;const n=Z();let r=n==="x-api-key"?`api-key=${Ge()}`:`bearer_token=${n}`;return!no()&&!Lr()?(d("WS","Authenticating through cookie..."),r+=`;max-age=120;path=${Ot()};`,r+=`${t?"secure;":""}samesite=strict`,document.cookie=r,d("WS","Cookies:",[document.cookie,r])):(d("WS","Authenticating through URL query parameter..."),e+=`${e.indexOf("?")>=0?"&":"?"}${r}`),d("WS",`Creating websocket connection to ws${t?"s":""}://${Ut()}${Ot()}`),pl({url:e,serializer:i=>typeof i=="object"?JSON.stringify(i):i,deserializer:i=>{let s=i.data;if(s==="pong")return s;try{return JSON.parse(i.data)}catch{return s}}})}function jt(){Ci.next([Ui,Date.now()-Ni]),V&&Yn()&&(V.complete(),De&&(clearInterval(De),De=void 0)),d("WS",`Reconnecting in ${Math.min(5e3,Ft*300||1e3)}ms...`),re("reconnect",()=>Jn(),Math.min(5e3,(Ft+1)*300||1e3))}function hr(){if(Date.now()-Zn>4*qi*1e3)return jt();V?.next("ping")}function $l(t){ye.next(!1),d("WS","Websocket error:",t,void 0,"error"),t.status===401&&Wt(),Dn(),jt()}function gn(){Tt&&(clearTimeout(Tt),Tt=void 0)}function wl(){const t=new be;return t.subscribe(e=>Bi(e)),t}function Pl(t,e,n){const r=`${t.sys}|${t.mod}_${t.index}|${t.name}`,i=Di(t.sys),s=i&&i[t.mod]?i[t.mod][t.index-1||0]:null;if(s){switch(t.cmd){case"bind":n[r]=s.listen(t.name).subscribe(o=>{setTimeout(()=>{e.next({type:"notify",value:o,meta:t})},Math.floor(Math.random()*100+50))});break;case"unbind":n[r]&&(n[r].unsubscribe(),delete n[r],Ae(`${r}`));break}re(`${t.id}-response`,()=>{const o={id:t.id,type:"success",value:t.cmd==="exec"?s.call(t.name,t.args):null};e.next(o)},10)}else re(`${t.id}-error`,()=>e.next({id:t.id,type:"error",code:i?K.SYS_NOT_FOUND:K.MOD_NOT_FOUND}),10)}function fr(){for(const t in z)z[t]&&delete z[t]}class $n{constructor(e,n){this._module=e,this.name=n,Fi().pipe(qs()).subscribe(r=>{r&&(this._stale_bindings||this._pending===1)?(d("VAR","Re-binding to status variable",this.binding()),this.rebind()):r||(Ae(`rebind:${JSON.stringify(this.binding())}`),d("VAR","Binding dropped due to disconnection, re-binding when possible.",this.binding()),this._stale_bindings=this._binding_count||this._stale_bindings,this._binding_count=0)})}name;_pending=0;_binding_count=0;_stale_bindings=0;get count(){return this._binding_count}get value(){return Li(this.binding())}listen(){return ji(this.binding())}subscribe(e){return this.listen().subscribe(e)}bindThenSubscribe(e){const n=this.bind();return this.listen().subscribe({next:e,complete:()=>n(),error:()=>n()})}bind(){return(this._binding_count<=0&&this._stale_bindings<=0||this._pending===2)&&(this._pending=1,xn(this.binding()).then(()=>{this._binding_count++,this._pending=0}).catch(()=>null)),()=>this.unbind()}unbind(){this._binding_count===1&&this._pending===0?(this._pending=2,Hi(this.binding()).then(()=>{this._pending===2&&(this._pending=0),this._binding_count--})):this._binding_count=Math.max(this._binding_count-1,0)}async rebind(){!this._stale_bindings&&this._pending!==1||re(`rebind:${JSON.stringify(this.binding())}`,async()=>{await xn(this.binding()),this._binding_count=this._stale_bindings||1,this._stale_bindings=0},100)}binding(){return{sys:this._module.system.id,mod:this._module.name,index:this._module.index,name:this.name}}}class Wi{constructor(e,n){this._system=e,this._id=n}_bindings={};get id(){return`${this.name}_${this.index}`}get system(){return this._system}get index(){const n=this._id.split("_").pop();return parseInt(n||"",10)||1}get name(){const e=this._id.split("_");return e.pop(),e.join("_")}binding(e){return this._bindings[e]||(this._bindings[e]=new $n(this,e)),this._bindings[e]}variable(e){return this._bindings[e]||(this._bindings[e]=new $n(this,e)),this._bindings[e]}execute(e,n,r=kt){return zi({sys:this._system.id,mod:this.name,index:this.index,name:e,args:n},r)}}class Qi{id;_module_list={};constructor(e){this.id=e}module(e,n=1){if(!e)throw new Error("Invalid module ID");const r=e.split("_");r.length>1&&Number.isInteger(+r[r.length-1])&&(n=+r[r.length-1],r.pop()),n<1&&(n=1);const i=r.join("_");for(this._module_list[i]||(this._module_list[i]=[]);this._module_list[i].length<n;)this._module_list[i].push(new Wi(this,`${i}_${this._module_list[i].length+1}`));return this._module_list[i][n-1]}}const vn={};function Zi(t){return vn[t]||(vn[t]=new Qi(t)),vn[t]}function Tl(t,e,n=1){return Zi(t).module(e,n)}exports.AuthType=ci;exports.EncryptionLevel=we;exports.MediaAnimation=zn;exports.MockPlaceWebsocketModule=Mi;exports.MockPlaceWebsocketSystem=Ri;exports.PlaceAlert=ri;exports.PlaceAlertDashboard=ii;exports.PlaceApplication=si;exports.PlaceAsset=Ii;exports.PlaceAssetCategory=Ti;exports.PlaceAssetPurchaseOrder=Oi;exports.PlaceAssetType=Ei;exports.PlaceCluster=li;exports.PlaceDomain=di;exports.PlaceDriver=Nn;exports.PlaceDriverRole=Ke;exports.PlaceEdge=pi;exports.PlaceErrorCodes=K;exports.PlaceLDAPSource=_i;exports.PlaceLogLevel=Wn;exports.PlaceMQTTBroker=ai;exports.PlaceMetadata=Fn;exports.PlaceModule=Ln;exports.PlaceModuleBinding=Wi;exports.PlaceOAuthSource=yi;exports.PlaceProcess=hi;exports.PlaceRepository=gi;exports.PlaceRepositoryType=Hn;exports.PlaceResource=j;exports.PlaceSAMLSource=vi;exports.PlaceSettings=pe;exports.PlaceSystem=jn;exports.PlaceSystemBinding=Qi;exports.PlaceTrigger=Pe;exports.PlaceUser=Ai;exports.PlaceVariableBinding=$n;exports.PlaceZone=nn;exports.PlaceZoneMetadata=mi;exports.SignageMedia=xi;exports.SignagePlaylist=$i;exports.SignagePlaylistMedia=ln;exports.Survey=mt;exports.SurveyAnswer=Bn;exports.SurveyInvitation=ft;exports.SurveyQuestion=pt;exports.TriggerConditionOperator=bi;exports.TriggerTimeConditionType=Si;exports.TriggerWebhookType=ki;exports.addAlert=Co;exports.addAlertDashboard=Io;exports.addAnswer=wa;exports.addApplication=Wo;exports.addAsset=Wa;exports.addAssetCategory=il;exports.addAssetPurchaseOrder=al;exports.addAssetType=Xa;exports.addAssets=Za;exports.addBroker=Jo;exports.addDomain=su;exports.addDriver=lu;exports.addEdge=vu;exports.addInvitation=Ea;exports.addLDAPSource=$u;exports.addMetadata=Mu;exports.addModule=Nu;exports.addOAuthSource=Ju;exports.addQuestion=Da;exports.addRepository=tc;exports.addSAMLSource=mc;exports.addSettings=Sc;exports.addSignageMedia=pa;exports.addSignagePlaylist=va;exports.addSurvey=ja;exports.addSystem=Tc;exports.addSystemModule=Ec;exports.addSystemTrigger=jc;exports.addTrigger=Qc;exports.addUser=Xc;exports.addZone=sa;exports.apiEndpoint=X;exports.apiKey=Ge;exports.approveSignagePlaylist=Aa;exports.authorise=qn;exports.authority=Je;exports.bind=xn;exports.cleanObject=jr;exports.cleanupAuth=co;exports.clientId=Br;exports.connectionState=gl;exports.consoleHasColours=An;exports.convertPairStringToMap=Re;exports.create=E;exports.currentUser=Kc;exports.debug=vl;exports.debug_events=Vn;exports.del=$e;exports.deregisterMockEndpoint=Xr;exports.deregisterSystem=ml;exports.driverReadme=_u;exports.execute=zi;exports.executeOnSystem=Dc;exports.executeOnZone=ca;exports.functionList=Cc;exports.generateNonce=Nr;exports.get=ee;exports.getFragments=En;exports.getModule=Tl;exports.getSystem=Zi;exports.hasToken=Qr;exports.host=Ut;exports.httpRoute=Mn;exports.humanReadableByteCount=Ye;exports.ignore=bl;exports.invalidateToken=Wt;exports.isDriverCompiled=pu;exports.isFixedDevice=Rn;exports.isMobileSafari=Lr;exports.isMock=zt;exports.isNestedFrame=Hr;exports.isOnline=so;exports.isSecure=Vr;exports.isTrusted=Bt;exports.is_connected=Yn;exports.lastRequestTotal=jo;exports.listChildMetadata=Du;exports.listDashboardAlerts=Ro;exports.listInterfaceRepositories=rc;exports.listMetadata=Pu;exports.listMetadataHistory=Ou;exports.listRemoteRepositoryBranches=sc;exports.listRemoteRepositoryCommits=oc;exports.listRemoteRepositoryDefaultBranch=ic;exports.listRepositoryBranches=ac;exports.listRepositoryCommits=cc;exports.listRepositoryDefaultBranch=lc;exports.listRepositoryDriverDetails=hc;exports.listRepositoryDrivers=uc;exports.listSignagePlaylistMedia=Sa;exports.listSignagePlaylistMediaRevisions=ka;exports.listSystemTriggers=Fc;exports.listSystemZones=Nc;exports.listTriggerInstances=Vc;exports.listZoneTags=na;exports.listZoneTriggers=ua;exports.listen=ji;exports.listenForToken=Zr;exports.loadModule=Bu;exports.log=d;exports.logout=ao;exports.lookupModuleState=zu;exports.lookupSystemModuleState=Uc;exports.mockSystem=Di;exports.moduleRuntimeError=Qu;exports.moduleSettings=Wu;exports.moduleState=Hu;exports.onlineState=oo;exports.parseLinkHeader=Fr;exports.patch=Ce;exports.post=de;exports.pullRepositoryChanges=fc;exports.put=xe;exports.query=$;exports.queryAlertDashboards=To;exports.queryAlerts=Do;exports.queryAnswers=$a;exports.queryApplications=Ho;exports.queryAssetCategories=tl;exports.queryAssetPurchaseOrders=ol;exports.queryAssetTypes=Ja;exports.queryAssets=Ha;exports.queryBrokers=Zo;exports.queryClusters=Go;exports.queryDomains=nu;exports.queryDrivers=uu;exports.queryEdges=mu;exports.queryInvitations=Pa;exports.queryLDAPSources=ku;exports.queryModules=qu;exports.queryOAuthSources=Zu;exports.queryProcesses=eu;exports.queryQuestions=Ma;exports.queryRepositories=Gu;exports.querySAMLSources=dc;exports.querySettings=gc;exports.querySignageMedia=ha;exports.querySignagePlaylists=ma;exports.querySurveys=Ca;exports.querySystems=xc;exports.querySystemsWithEmails=$c;exports.queryTriggers=zc;exports.queryUsers=Yc;exports.queryZones=ta;exports.recompileDriver=fu;exports.redirectUri=ro;exports.refreshAuthority=Dn;exports.refreshToken=qt;exports.registerMockEndpoint=ko;exports.registerSystem=_l;exports.reloadDriver=du;exports.remove=w;exports.removeAlert=No;exports.removeAlertDashboard=Mo;exports.removeApplication=Qo;exports.removeAsset=Qa;exports.removeAssetCategory=sl;exports.removeAssetPurchaseOrder=ll;exports.removeAssetType=el;exports.removeAssets=Ya;exports.removeBroker=Ko;exports.removeDomain=ou;exports.removeDriver=hu;exports.removeEdge=bu;exports.removeFragment=le;exports.removeInvitation=Ia;exports.removeLDAPSource=wu;exports.removeMetadata=Ru;exports.removeModule=Fu;exports.removeOAuthSource=Ku;exports.removeQuestion=Ua;exports.removeRepository=nc;exports.removeSAMLSource=yc;exports.removeSettings=kc;exports.removeSignageMedia=_a;exports.removeSignagePlaylist=ba;exports.removeSurvey=La;exports.removeSystem=Oc;exports.removeSystemModule=Ic;exports.removeSystemTrigger=Lc;exports.removeTrigger=Zc;exports.removeUser=ea;exports.removeZone=oa;exports.requestTotal=Fo;exports.responseHeaders=ti;exports.retrieveEdgeToken=Su;exports.setAPI_Key=io;exports.setMockNotFoundHandler=So;exports.setToken=Wr;exports.settingsHistory=Ac;exports.setup=uo;exports.show=k;exports.showAlert=qo;exports.showAlertDashboard=Oo;exports.showApplication=zo;exports.showAsset=za;exports.showAssetCategory=nl;exports.showAssetPurchaseOrder=ul;exports.showAssetType=Ka;exports.showBroker=Vo;exports.showCluster=Xo;exports.showDomain=ru;exports.showDriver=cu;exports.showEdge=yu;exports.showInvitation=Ta;exports.showLDAPSource=Au;exports.showMetadata=Eu;exports.showModule=Uu;exports.showOAuthSource=Vu;exports.showQuestion=Ra;exports.showRepository=Xu;exports.showSAMLSource=pc;exports.showSettings=vc;exports.showSignage=aa;exports.showSignageMedia=fa;exports.showSignageMetrics=la;exports.showSignagePlaylist=ya;exports.showSurvey=Na;exports.showSystem=wc;exports.showTrigger=Bc;exports.showUser=Jc;exports.showZone=ra;exports.simplifiedTime=zr;exports.startModule=ju;exports.startSystem=Mc;exports.status=Fi;exports.stopModule=Lu;exports.stopSystem=Rc;exports.systemModuleState=qc;exports.systemSettings=Hc;exports.terminateProcess=tu;exports.token=Z;exports.unbind=Hi;exports.update=I;exports.updateAlert=Uo;exports.updateAlertDashboard=Eo;exports.updateApplication=Bo;exports.updateAsset=Ba;exports.updateAssetCategory=rl;exports.updateAssetPurchaseOrder=cl;exports.updateAssetType=Ga;exports.updateAssets=Va;exports.updateBroker=Yo;exports.updateDomain=iu;exports.updateDriver=au;exports.updateEdge=gu;exports.updateInvitation=Oa;exports.updateLDAPSource=xu;exports.updateMetadata=Iu;exports.updateModule=Cu;exports.updateOAuthSource=Yu;exports.updateQuestion=qa;exports.updateRepository=ec;exports.updateSAMLSource=_c;exports.updateSettings=bc;exports.updateSignageMedia=da;exports.updateSignagePlaylist=ga;exports.updateSignagePlaylistMedia=xa;exports.updateSurvey=Fa;exports.updateSystem=Pc;exports.updateTrigger=Wc;exports.updateUser=Gc;exports.updateZone=ia;exports.value=Li;exports.websocketRoute=Ot;
|
|
4
4
|
//# sourceMappingURL=index.cjs.js.map
|