@placeos/ts-client 4.8.1 → 4.8.3
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/domains/functions.d.ts +3 -4
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +207 -207
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/signage/interfaces.d.ts +4 -0
- package/package.json +1 -1
- package/src/domains/functions.ts +3 -4
- package/src/signage/interfaces.ts +6 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var Pn=function(t,e){return Pn=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])},Pn(t,e)};function ne(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Pn(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var Xe=function(){return Xe=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},Xe.apply(this,arguments)};function ss(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 os(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(y){o(y)}}function c(_){try{l(r.throw(_))}catch(y){o(y)}}function l(_){_.done?s(_.value):i(_.value).then(u,c)}l((r=r.apply(t,e||[])).next())})}function kr(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 Fe(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
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var Pn=function(t,e){return Pn=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])},Pn(t,e)};function ne(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Pn(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var Xe=function(){return Xe=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},Xe.apply(this,arguments)};function ss(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 os(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(y){o(y)}}function c(_){try{l(r.throw(_))}catch(y){o(y)}}function l(_){_.done?s(_.value):i(_.value).then(u,c)}l((r=r.apply(t,e||[])).next())})}function kr(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 Fe(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 Ut(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 Dt(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 De(t){return this instanceof De?(this.v=t,this):new De(t)}function us(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,y)}}function u(a,f){r[a]&&(i[a]=function(h){return new Promise(function($,S){s.push([a,h,$,S])>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 De?Promise.resolve(a.value.v).then(_,y):p(s[0][2],a)}function _(a){c("next",a)}function y(a){c("throw",a)}function p(a,f){a(f),s.shift(),s.length&&c(s[0][0],s[0][1])}}function cs(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 Fe=="function"?Fe(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 D(t){return typeof t=="function"}function Mn(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 $n=Mn(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 Nt(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Pe=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=Fe(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(D(_))try{_()}catch(h){s=h instanceof $n?h.errors:[h]}var y=this._finalizers;if(y){this._finalizers=null;try{for(var p=Fe(y),a=p.next();!a.done;a=p.next()){var f=a.value;try{or(f)}catch(h){s=s??[],h instanceof $n?s=Ct(Ct([],Dt(s)),Dt(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 $n(s)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)or(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)&&Nt(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&Nt(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),$r=Pe.EMPTY;function Ar(t){return t instanceof Pe||t&&"closed"in t&&D(t.remove)&&D(t.add)&&D(t.unsubscribe)}function or(t){D(t)?t():t.unsubscribe()}var as={Promise:void 0},ls={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,Ct([t,e],Dt(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function xr(t){ls.setTimeout(function(){throw t})}function ur(){}function It(t){t()}var Vt=function(t){ne(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,Ar(n)&&n.add(r)):r.destination=ds,r}return e.create=function(n,r,i){return new Tn(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}(Pe),hs=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){Et(r)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(r){Et(r)}else Et(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){Et(n)}},t}(),Tn=function(t){ne(e,t);function e(n,r,i){var s=t.call(this)||this,o;return D(n)||!n?o={next:n??void 0,error:r??void 0,complete:i??void 0}:o=n,s.destination=new hs(o),s}return e}(Vt);function Et(t){xr(t)}function fs(t){throw t}var ds={closed:!0,next:ur,error:fs,complete:ur},Rn=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Un(t){return t}function ps(t){return t.length===0?Un:t.length===1?t[0]:function(n){return t.reduce(function(r,i){return i(r)},n)}}var N=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=ms(e)?e:new Tn(e,n,r);return It(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=cr(n),new n(function(i,s){var o=new Tn({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[Rn]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return ps(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=cr(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 cr(t){var e;return(e=t??as.Promise)!==null&&e!==void 0?e:Promise}function _s(t){return t&&D(t.next)&&D(t.error)&&D(t.complete)}function ms(t){return t&&t instanceof Vt||_s(t)&&Ar(t)}function ys(t){return D(t?.lift)}function ue(t){return function(e){if(ys(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 ee(t,e,n,r,i){return new gs(t,e,n,r,i)}var gs=function(t){ne(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}(Vt),vs=Mn(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),xe=function(t){ne(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 On(this,this);return r.operator=n,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new vs},e.prototype.next=function(n){var r=this;It(function(){var i,s;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var o=Fe(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;It(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;It(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 Pe(function(){r.currentObservers=null,Nt(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 N;return n.source=this,n},e.create=function(n,r){return new On(n,r)},e}(N),On=function(t){ne(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}(xe),ye=function(t){ne(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}(xe),Dn={now:function(){return(Dn.delegate||Date).now()},delegate:void 0},An=function(t){ne(e,t);function e(n,r,i){n===void 0&&(n=1/0),r===void 0&&(r=1/0),i===void 0&&(i=Dn);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}(xe),bs=function(t){ne(e,t);function e(n,r){return t.call(this)||this}return e.prototype.schedule=function(n,r){return this},e}(Pe),ar={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,Ct([t,e],Dt(n)))},clearInterval:function(t){return clearInterval(t)},delegate:void 0},Ss=function(t){ne(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),ar.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&&ar.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,Nt(s,this),r!=null&&(this.id=this.recycleAsyncId(i,r,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(bs),lr=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=Dn.now,t}(),ks=function(t){ne(e,t);function e(n,r){r===void 0&&(r=lr.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}(lr),wr=new ks(Ss),$s=wr,As=new N(function(t){return t.complete()});function xs(t){return t&&D(t.schedule)}var Pr=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function Tr(t){return D(t?.then)}function Or(t){return D(t[Rn])}function Er(t){return Symbol.asyncIterator&&D(t?.[Symbol.asyncIterator])}function qr(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 ws(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Ir=ws();function Mr(t){return D(t?.[Ir])}function Rr(t){return us(this,arguments,function(){var n,r,i,s;return kr(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,De(n.read())];case 3:return r=o.sent(),i=r.value,s=r.done,s?[4,De(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,De(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 Ur(t){return D(t?.getReader)}function ce(t){if(t instanceof N)return t;if(t!=null){if(Or(t))return Ps(t);if(Pr(t))return Ts(t);if(Tr(t))return Os(t);if(Er(t))return Dr(t);if(Mr(t))return Es(t);if(Ur(t))return qs(t)}throw qr(t)}function Ps(t){return new N(function(e){var n=t[Rn]();if(D(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Ts(t){return new N(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function Os(t){return new N(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,xr)})}function Es(t){return new N(function(e){var n,r;try{for(var i=Fe(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 Dr(t){return new N(function(e){Is(t,e).catch(function(n){return e.error(n)})})}function qs(t){return Dr(Rr(t))}function Is(t,e){var n,r,i,s;return os(this,void 0,void 0,function(){var o,u;return kr(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=cs(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 $e(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 Cr(t,e){return e===void 0&&(e=0),ue(function(n,r){n.subscribe(ee(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 Nr(t,e){return e===void 0&&(e=0),ue(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function Ms(t,e){return ce(t).pipe(Nr(e),Cr(e))}function Rs(t,e){return ce(t).pipe(Nr(e),Cr(e))}function Us(t,e){return new N(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function Ds(t,e){return new N(function(n){var r;return $e(n,e,function(){r=t[Ir](),$e(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 D(r?.return)&&r.return()}})}function Fr(t,e){if(!t)throw new Error("Iterable cannot be null");return new N(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 Cs(t,e){return Fr(Rr(t),e)}function Ns(t,e){if(t!=null){if(Or(t))return Ms(t,e);if(Pr(t))return Us(t,e);if(Tr(t))return Rs(t,e);if(Er(t))return Fr(t,e);if(Mr(t))return Ds(t,e);if(Ur(t))return Cs(t,e)}throw qr(t)}function Fs(t,e){return e?Ns(t,e):ce(t)}function Lr(t,e){var n=D(t)?t:function(){return t},r=function(i){return i.error(n())};return new N(r)}var Ls=Mn(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function js(t,e){return new Promise(function(n,r){var i=!1,s;t.subscribe({next:function(o){s=o,i=!0},error:r,complete:function(){i?n(s):r(new Ls)}})})}function Hs(t){return t instanceof Date&&!isNaN(t)}function v(t,e){return ue(function(n,r){var i=0;n.subscribe(ee(r,function(s){r.next(t.call(e,s,i++))}))})}function zs(t,e,n,r,i,s,o,u){var c=[],l=0,_=0,y=!1,p=function(){y&&!c.length&&!l&&e.complete()},a=function(h){return l<r?f(h):c.push(h)},f=function(h){l++;var $=!1;ce(n(h,_++)).subscribe(ee(e,function(S){e.next(S)},function(){$=!0},void 0,function(){if($)try{l--;for(var S=function(){var w=c.shift();o||f(w)};c.length&&l<r;)S();p()}catch(w){e.error(w)}}))};return t.subscribe(ee(e,a,function(){y=!0,p()})),function(){}}function jr(t,e,n){return n===void 0&&(n=1/0),D(e)?jr(function(r,i){return v(function(s,o){return e(r,s,i,o)})(ce(t(r,i)))},n):(typeof e=="number"&&(n=e),ue(function(r,i){return zs(r,i,t,n)}))}function Cn(t,e,n){t===void 0&&(t=0),n===void 0&&(n=$s);var r=-1;return e!=null&&(xs(e)?n=e:r=e),new N(function(i){var s=Hs(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 Ws(t,e){return ue(function(n,r){var i=0;n.subscribe(ee(r,function(s){return t.call(e,s,i++)&&r.next(s)}))})}function Hr(t){return t<=0?function(){return As}:ue(function(e,n){var r=0;e.subscribe(ee(n,function(i){++r<=t&&(n.next(i),t<=r&&n.complete())}))})}function Bs(t){return v(function(){return t})}function Qs(t,e){return jr(function(n,r){return ce(t(n,r)).pipe(Hr(1),Bs(n))})}function Vs(t,e){e===void 0&&(e=wr);var n=Cn(t,e);return Qs(function(){return n})}function Zs(t,e){return e===void 0&&(e=Un),t=t??Gs,ue(function(n,r){var i,s=!0;n.subscribe(ee(r,function(o){var u=e(o);(s||!t(i,u))&&(s=!1,i=u,r.next(o))}))})}function Gs(t,e){return t===e}function Ks(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?Un:ue(function(u,c){var l=0,_,y=function(){var p=!1;_=u.subscribe(ee(c,function(a){o&&(l=0),c.next(a)},void 0,function(a){if(l++<r){var f=function(){_?(_.unsubscribe(),_=null,y()):p=!0};if(i!=null){var h=typeof i=="number"?Cn(i):ce(i(a,l)),$=ee(c,function(){$.unsubscribe(),f()},function(){c.complete()});h.subscribe($)}else f()}else c.error(a)})),p&&(_.unsubscribe(),_=null,y())};y()})}function hr(t,e){return ue(function(n,r){var i=null,s=0,o=!1,u=function(){return o&&!i&&r.complete()};n.subscribe(ee(r,function(c){i?.unsubscribe();var l=0,_=s++;ce(t(c,_)).subscribe(i=ee(r,function(y){return r.next(e?e(c,y,_,l++):y)},function(){i=null,u()}))},function(){o=!0,u()}))})}function Nn(t,e){e===void 0&&(e={});var n=e.selector,r=ss(e,["selector"]);return new N(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 _=Xe(Xe({},r),{signal:o}),y=function(p){u=!1,i.error(p)};return fetch(t,_).then(function(p){n?ce(n(p)).subscribe(ee(i,void 0,function(){u=!1,i.complete()},y)):(u=!1,i.next(p),i.complete())}).catch(y),function(){u&&s.abort()}})}const se=["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","+","/"],fr=[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 qt(t){if(t>=fr.length)throw new Error("Unable to parse base64 string.");const e=fr[t];if(e===255)throw new Error("Unable to parse base64 string.");return e}function zr(t){let e="",n,r=t.length;for(n=2;n<r;n+=3)e+=se[t[n-2]>>2],e+=se[(t[n-2]&3)<<4|t[n-1]>>4],e+=se[(t[n-1]&15)<<2|t[n]>>6],e+=se[t[n]&63];return n===r+1&&(e+=se[t[n-2]>>2],e+=se[(t[n-2]&3)<<4],e+="=="),n===r&&(e+=se[t[n-2]>>2],e+=se[(t[n-2]&3)<<4|t[n-1]>>4],e+=se[(t[n-1]&15)<<2],e+="="),e}function Ys(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=qt(t.charCodeAt(o))<<18|qt(t.charCodeAt(o+1))<<12|qt(t.charCodeAt(o+2))<<6|qt(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 Js(t,e=new TextEncoder){return zr(e.encode(t))}var Mt={exports:{}},Xs=Mt.exports,dr;function eo(){return dr||(dr=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})(Xs,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,$){for(var S,w,P,V,F,M,re,L,W,j,Ke,Ye,Ot;$>=64;){for(S=a[0],w=a[1],P=a[2],V=a[3],F=a[4],M=a[5],re=a[6],L=a[7],j=0;j<16;j++)Ke=h+j*4,p[j]=(f[Ke]&255)<<24|(f[Ke+1]&255)<<16|(f[Ke+2]&255)<<8|f[Ke+3]&255;for(j=16;j<64;j++)W=p[j-2],Ye=(W>>>17|W<<15)^(W>>>19|W<<13)^W>>>10,W=p[j-15],Ot=(W>>>7|W<<25)^(W>>>18|W<<14)^W>>>3,p[j]=(Ye+p[j-7]|0)+(Ot+p[j-16]|0);for(j=0;j<64;j++)Ye=(((F>>>6|F<<26)^(F>>>11|F<<21)^(F>>>25|F<<7))+(F&M^~F&re)|0)+(L+(n[j]+p[j]|0)|0)|0,Ot=((S>>>2|S<<30)^(S>>>13|S<<19)^(S>>>22|S<<10))+(S&w^S&P^w&P)|0,L=re,re=M,M=F,F=V+Ye|0,V=P,P=w,w=S,S=Ye+Ot|0;a[0]+=S,a[1]+=w,a[2]+=P,a[3]+=V,a[4]+=F,a[5]+=M,a[6]+=re,a[7]+=L,h+=64,$-=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,$=f/536870912|0,S=f<<3,w=f%64<56?64:128;this.buffer[h]=128;for(var P=h+1;P<w-8;P++)this.buffer[P]=0;this.buffer[w-8]=$>>>24&255,this.buffer[w-7]=$>>>16&255,this.buffer[w-6]=$>>>8&255,this.buffer[w-5]=$>>>0&255,this.buffer[w-4]=S>>>24&255,this.buffer[w-3]=S>>>16&255,this.buffer[w-2]=S>>>8&255,this.buffer[w-1]=S>>>0&255,r(this.temp,this.state,this.buffer,0,w),this.finished=!0}for(var P=0;P<8;P++)a[P*4+0]=this.state[P]>>>24&255,a[P*4+1]=this.state[P]>>>16&255,a[P*4+2]=this.state[P]>>>8&255,a[P*4+3]=this.state[P]>>>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 $=h[0];if($===0)throw new Error("hkdf: cannot expand more");a.reset(),$>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 $=new Uint8Array([1]),S=u(a,p),w=new s(S),P=new Uint8Array(w.digestLength),V=P.length,F=new Uint8Array(h),M=0;M<h;M++)V===P.length&&(c(P,w,f,$),V=0),F[M]=P[V++];return w.clean(),P.fill(0),$.fill(0),F}e.hkdf=_;function y(p,a,f,h){for(var $=new s(p),S=$.digestLength,w=new Uint8Array(4),P=new Uint8Array(S),V=new Uint8Array(S),F=new Uint8Array(h),M=0;M*S<h;M++){var re=M+1;w[0]=re>>>24&255,w[1]=re>>>16&255,w[2]=re>>>8&255,w[3]=re>>>0&255,$.reset(),$.update(a),$.update(w),$.finish(V);for(var L=0;L<S;L++)P[L]=V[L];for(var L=2;L<=f;L++){$.reset(),$.update(V).finish(V);for(var W=0;W<S;W++)P[W]^=V[W]}for(var L=0;L<S&&M*S+L<h;L++)F[M*S+L]=P[L]}for(var M=0;M<S;M++)P[M]=V[M]=0;for(var M=0;M<4;M++)w[M]=0;return $.clean(),F}e.pbkdf2=y})}(Mt)),Mt.exports}var to=eo();const no=new Int32Array(4);class Z{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 Z;static _hex(e){const n=Z.hexChars,r=Z.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(Z.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,Z._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,Z._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,Z._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(Z.buffer32Identity.subarray(s),s),n>55&&(Z._md5cycle(this._state,i),i.set(Z.buffer32Identity)),o<=4294967295)i[14]=o;else{const u=o.toString(16).match(/(.*?)(.{0,8})$/);if(u===null)return e?no:"";const c=parseInt(u[2],16),l=parseInt(u[1],16)||0;i[14]=c,i[15]=l}return Z._md5cycle(this._state,i),e?this._state:Z._hex(this._state)}}if(Z.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592")throw new Error("Md5 self test failed.");const ro=36e5,pr=Symbol.for("constructDateFrom");function Ft(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&pr in t?t[pr](e):t instanceof Date?new t.constructor(e):new Date(e)}function et(t,e){return Ft(t,t)}function io(t,e,n){const r=et(t);if(isNaN(e))return Ft(t,NaN);const i=r.getDate(),s=Ft(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 Wr(t,e,n){return Ft(t,+et(t)+e)}function so(t,e,n){return Wr(t,e*ro)}function oo(t,e,n){return Wr(t,e*1e3)}function uo(t,e,n){return io(t,e*12)}function _r(t){return Math.trunc(+et(t)/1e3)}function co(t,e){return+et(t)<+et(e)}function d(t,e,n,r="debug",i){if(window.debug){const o=["color: #0288D1",`color:${i||"#009688"}`,"color: default"];n?En()?console[r](`%c[PlaceOS]%c[${t}] %c${e}`,...o,n):console[r](`[PlaceOS][${t}] ${e}`,n):En()?console[r](`%c[PlaceOS]%c[${t}] %c${e}`,...o):console[r](`[PlaceOS][${t}] ${e}`)}}function En(){return!(document.documentMode||/Edge/.test(navigator.userAgent))}function Fn(){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=Ce(i[0]),e||(e=i[1])}else n=Ce(t);let r={};return e&&(r=Ce(e)),{...n,...r}}function Ce(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 mr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function Br(t=40){let e="";for(let n=0;n<t;n++)e+=mr.charAt(Math.floor(Math.random()*mr.length));return e}function _e(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 tt(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 Qr(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 Vr(t,e){for(const n in t)t.hasOwnProperty(n)&&e.indexOf(t[n])>=0&&delete t[n];return t}function Zr(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Gr(){return window.location!==window.parent.location}function Kr(t=Date.now(),e=60*1e3){return Math.floor(t/e)}class ao{abort(){d("Stub","Aborted")}}function R(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 Ae={},Je={},pe={};function lo(){for(const t in Ae)Ae.hasOwnProperty(t)&&Te(t);for(const t in Je)Je.hasOwnProperty(t)&&ho(t);for(const t in pe)pe.hasOwnProperty(t)&&fo(t)}function oe(t,e,n=300){if(t&&e&&e instanceof Function)Te(t),Ae[t]=setTimeout(()=>{e(),delete Ae[t]},n);else throw new Error(t?"Cannot create named timeout without a name":"Cannot create a timeout without a callback")}function Te(t){Ae[t]&&(clearTimeout(Ae[t]),delete Ae[t])}function ho(t){Je[t]&&(clearInterval(Je[t]),delete Je[t])}function fo(t){pe&&pe[t]&&(pe[t]instanceof Pe?pe[t].unsubscribe():pe[t](),delete pe[t])}const po={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 g={},q=localStorage,H;const k={};let I="",we="";const Le=new ye(""),Zt=new ye("");let Ln="/api/engine/v2";const me=new ye(!1),_o=me.asObservable();let Lt=0;function Yr(t){if(!t||t.startsWith("http://")||t.startsWith("https://"))return t;const e=H?.domain;return e?`${g.secure||window.location?.protocol.indexOf("https")>=0?"https:":"http:"}//${e}${t}`:t}function A(){return`${`${g.secure||window.location?.protocol.indexOf("https")>=0?"https:":"http:"}//${g.host||window.location?.host}`}${jn()}`}function jn(){return g.version==="ACA Engine"?"/control/api":Ln}function mo(){return!!g.token_header}function Jr(){return I}function yo(){return g.redirect_uri}function go(t,e=!0){q.setItem(`${I}_x-api-key`,`${t}`),q.setItem("trusted",`${e}`),Xr("x-api-key",uo(new Date,5).valueOf())}function it(){return zt("x-api-key",!1)||""}function Xr(t,e=so(new Date,2).valueOf()){g.ignore_api_key&&t==="x-api-key"||(q.setItem(`${I}_expires_at`,`${e}`),q.setItem(`${I}_access_token`,t))}function K(t=!0){if(g.mock)return"mock-token";if(!q)return"";if(it()&&!g.ignore_api_key)return"x-api-key";const e=q.getItem(`${I}_expires_at`)||"",n=Le.getValue();return co(+e,new Date)&&(d("Auth","Token expired. Requesting new token..."),Yt(),k.load_authority||(Lt+=1,oe("re-authorise",async()=>{delete k.authorise,await Wn().catch(r=>d("Auth",`Failed to get token: ${r}`))},200*Math.min(20,Lt))),!t)?"":n||q.getItem(`${I}_access_token`)||""}function jt(){return Zt.getValue()||q.getItem(`${I}_refresh_token`)||""}function Ht(){return g.host||window.location?.host}function ei(){return!!K()}function ti(){return Le.pipe(v(t=>!!ei()))}function nt(){return H}function vo(){return me.getValue()}function Gt(){return!!g.mock}function ni(){return!!g.secure}function bo(){return _o}function Kt(){return zt("trust")==="true"||zt("trusted")==="true"}function Hn(){return!!it()&&!g.ignore_api_key||zt("fixed_device")==="true"}function zt(t,e=!0){let r=Fn()[t];if(q){const i=`${Jr()}_${t}`;r=r||q.getItem(i)||q.getItem(t)||"",e&&q.setItem(i,`${r}`)}return r}async function So(t){return g=t||g,g.token_header=g.token_header??Gr(),window.AbortController||(window.AbortController=ao),q=g.storage==="session"?sessionStorage:localStorage,I=Z.hashStr(g.redirect_uri,!1),g.delay&&g.delay>0&&await js(Cn(g.delay)),Bn()}function ko(t){q=t==="session"?sessionStorage:localStorage}function $o(){g={},H=void 0,Le.next(""),Zt.next(""),me.next(!1),I="",we="",Ln="/api/engine/v2";for(const t in k)t in k&&delete k[t];lo()}function zn(){return d("Auth","Refreshing authorty."),H=void 0,Bn()}function Yt(){d("Auth","Invalidating tokens."),q.removeItem(`${I}_access_token`),q.removeItem(`${I}_expires_at`),Le.getValue()&&Le.next("")}function Wn(t,e=H){return k.authorise||(k.authorise=new Promise((n,r)=>{if(!e)return delete k.authorise,r("Authority is not loaded");d("Auth","Authorising user...");const i=()=>{if(K(!1))d("Auth","Valid token found."),delete k.authorise,n(K());else{const s=[()=>{d("Auth","Successfully generated token."),n(K()),delete k.authorise},()=>{d("Auth","Failed to generate token."),r("Failed to generate token"),setTimeout(()=>delete k.authorise,200)}];g&&g.auth_type==="password"?(d("Auth","Logging in with credentials."),Mo(g).then(...s),Lt=0):we||jt()?(d("Auth",`Generating token with ${we?"code":"refresh token"}`),ii().then(...s),Lt=0):e.session?(d("Auth","Users has session. Authorising application..."),xo(t).then(...s)):(d("Auth","No user session"),ri(e),r("No user session"),setTimeout(()=>delete k.authorise,200))}};Po().then(i,i)})),k.authorise}function Ao(){const t=Yr(H?H.logout_url:"/logout");fetch(t,{method:"GET",redirect:"manual",headers:{Authorization:"Bearer "+K()}}).then(e=>{const n=e.headers.get("Location")||t;for(let r=0;r<q.length;r++){const i=q.key(r);i&&i.indexOf(I)>=0&&q.removeItem(i)}window.location?.assign(n)})}function Bn(t=0){return k.load_authority||(k.load_authority=new Promise(e=>{if(me.next(!1),g.mock){H=po,d("Auth","System in mock mode"),me.next(!0),e();return}d("Auth",`Fixed: ${Hn()} | Trusted: ${Kt()}`),d("Auth","Loading authority...");const n=g.secure||window.location?.protocol.indexOf("https")>=0,r=i=>{d("Auth",`Failed to load authority(${i})`),me.next(!1),oe("load_authority",()=>{delete k.load_authority,Bn(t).then(s=>e())},300*Math.min(20,++t))};Nn(`${n?"https:":"http:"}//${Ht()}/auth/authority`,{credentials:"same-origin"}).subscribe(async i=>{if(!i.ok)return r(await i.text().catch(o=>o));H=await i.json(),Ln=/[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=()=>{me.next(!0),d("Auth","Application set online."),e()};delete k.load_authority,Wn("").then(s,s)},r)})),k.load_authority}async function xo(t){const e=Oo(t);if(g.use_iframe)return wo(e);window.location?.assign(e)}function wo(t){return k.iframe_auth||(k.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),Te("iframe_auth"),window.removeEventListener("message",i),delete k.iframe_auth,o.token)return e(),Qn({access_token:o.token,...o});we=o.code||"",ii().then(u=>e(u),u=>n(u))}};oe("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 k.iframe_auth,n()},document.body.appendChild(r)})),k.iframe_auth}let yr=!1;function ri(t){if(g.handle_login!==!1&&!yr){d("Auth","Redirecting to login page...");const e=Yr(t.login_url?.replace("{{url}}",encodeURIComponent(window.location?.href)));throw setTimeout(()=>window.location?.assign(e),300),yr=!0,new Error("Redirecting to login page...")}else d("Auth","Login being handled locally.");delete k.authorise}function Po(){return k.check_token||(k.check_token=new Promise(async(t,e)=>{K()?(d("Auth","Valid token found."),t(K())):(d("Auth","No token. Checking URL for auth credentials..."),await To()?t(!0):e()),delete k.check_token})),k.check_token}function To(){return k.check_params||(k.check_params=new Promise(t=>{d("Auth","Checking for auth parameters...");let e=Fn();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&&(we=e.code,_e("code")),e.refresh_token&&(q.setItem(`${I}_refresh_token`,e.refresh_token),_e("refresh_token"));const n=q.getItem(`${I}_nonce`)||"",r=(e.state||"").split(";");_e("state"),_e("token_type");const i=r[0];n===i?(Qn(e),t(!!e.access_token)):t(!1)}else t(!1);oe("check_params_promise",()=>delete k.check_params,50)})),k.check_params}function Oo(t){const e=Ro();t=t?`${e};${t}`:e;const n=g?(g.auth_uri||"").indexOf("?")>=0:!1,r=(g?g.auth_uri:null)||"/auth/oauth/authorize",i=Kt()||g.auth_type==="auth_code"?"code":"token";let s=`${r}${n?"&":"?"}response_type=${encodeURIComponent(i)}&client_id=${encodeURIComponent(I)}&state=${encodeURIComponent(t)}&redirect_uri=${encodeURIComponent(g.redirect_uri)}&scope=${encodeURIComponent(g.scope)}`;if(g.auth_type==="auth_code"){const{challenge:o,verify:u}=Eo();sessionStorage.setItem(`${I}_challenge`,o),s+="&code_challenge_method=S256",s+=`&code_challenge=${u}`}return s}const gr="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split("");function Eo(t=43){const e=new Array(t).fill(0).map(()=>gr[Math.floor(Math.random()*gr.length)]).join(""),n=Ys(Js(e)),r=zr(to.hash(n)).split("=")[0].replace(/\//g,"_").replace(/\+/g,"-");return{challenge:e,verify:r}}function qo(){let e=(g.token_uri||"/auth/token")+`?client_id=${encodeURIComponent(I)}`,n="";if(e+=`&redirect_uri=${encodeURIComponent(g.redirect_uri)}`,jt()){e+=`&refresh_token=${encodeURIComponent(jt())}`,e+="&grant_type=refresh_token";const r=e.split("?");e=r[0],n=r[1]}else{e+=`&code=${encodeURIComponent(we)}`,e+="&grant_type=authorization_code";const r=sessionStorage.getItem(`${I}_challenge`);r&&(e+=`&code_verifier=${r}`,sessionStorage.removeItem(`${I}_challenge`)),we=""}return[e,n]}function Io(t){const e=t.token_uri||"/auth/token",n=R({grant_type:"password",client_id:I,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 ii(){return si(...qo())}function Mo(t){return si(Io(t))}function si(t,e=""){return k.generate_tokens||(k.generate_tokens=new Promise((n,r)=>{d("Auth","Generating new token...");const i=s=>{d("Auth","Error generating new tokens.",s),q.removeItem(`${I}_refresh_token`),Zt.next(""),r(),delete k.generate_tokens};Nn(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();Qn(o),n(),delete k.generate_tokens},i)})),k.generate_tokens}function Qn(t){const e=oo(new Date,Math.max(60,parseInt(t.expires_in,10)-300));d("Auth","Tokens generated storing..."),Kt()&&(t.access_token&&(q.setItem(`${I}_access_token`,t.access_token),_e("access_token")),t.refresh_token&&(q.setItem(`${I}_refresh_token`,t.refresh_token),_e("refresh_token"))),t.expires_in&&(q.setItem(`${I}_expires_at`,`${e.valueOf()}`),_e("expires_in")),me.next(!0),Le.next(t.access_token||""),Zt.next(t.refresh_token||"")}function Ro(){const t=Br();return q.setItem(`${I}_nonce`,t),t}const Jt={};let oi=(t,e)=>{const n=new Error(`Mock endpoint not found: ${t} ${e}`);return n.status=404,d("HTTP(M)",`404 ${t}:`,e),Lr(n)};function Uo(t){oi=t}function Do(t,e=Jt){ui(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 ui(t,e,n=Jt){const r=`${t}|${e}`;n[r]&&(delete n[r],d("HTTP(M)",`- ${t} ${e}`))}function Co(t,e,n,r=Jt){const i=No(t,e,r);if(i){const s=Fo(e,i,n);return Lo(i,s)}return oi(t,e)}function No(t,e,n=Jt){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 Fo(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=Ce(s),u=i.split("/"),c={};for(let _=0;_<e.path_structure.length;_++){const y=e.path_structure[_];y&&(c[y]=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 Lo(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]),Fs([n]).pipe(Vs(Math.max(200,s)))}const ci={};function ai(t,e=ci){return e[t]||{}}function C(t,e,n=st){return e||(e={response_type:"json"}),n("GET",t,{response_type:"json",...e})}function G(t,e,n,r=st){return n||(n={response_type:"json"}),r("POST",t,{body:e,response_type:"json",...n})}function Oe(t,e,n,r=st){return n||(n={response_type:"json"}),r("PUT",t,{body:e,response_type:"json",...n})}function je(t,e,n,r=st){return n||(n={response_type:"json"}),r("PATCH",t,{body:e,response_type:"json",...n})}function ge(t,e,n=st){return e||(e={response_type:"void"}),n("DELETE",t,{response_type:"void",...e})}async function jo(t,e,n=ci){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 li=()=>(Yt(),zn().then(()=>Promise.resolve(),()=>new Promise(t=>{setTimeout(()=>{li().then(()=>t())},1e3)})));function st(t,e,n,r=Gt,i=Co,s=jo){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"),ti().pipe(Ws(o=>o),Hr(1),hr(o=>{K()==="x-api-key"?n.headers["X-API-Key"]=it():n.headers.Authorization=`Bearer ${K()}`;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)),Nn(e,u)}),hr(o=>o.ok?s(o,n.response_type):Lr(o)),Ks({count:4,delay:(o,u)=>new N(c=>{if(o.status===511){ri(nt()),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;li().then(()=>{c.next(l),c.complete()}).catch(()=>{c.error(o)})})}))}class z{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,Vr(e,[void 0,null,""])}}class hi extends z{alert_dashboard_id;alert_dashboard_details;authority_id;description;enabled;conditions;severity;alert_type;debounce_period;any_match;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,this.any_match=e.any_match||!1}}class fi extends z{authority_id;description;enabled;constructor(e){super(e),this.authority_id=e.authority_id||"",this.description=e.description||"",this.enabled=e.enabled||!1}}const He="alert_dashboards";function Xt(t){return new fi(t)}function Ho(t={}){return x({query_params:t,fn:Xt,path:He})}function zo(t){return b({id:t,query_params:{},fn:Xt,path:He})}function Wo(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:Xt,path:He})}function Bo(t){return O({form_data:t,query_params:{},fn:Xt,path:He})}function Qo(t){return T({id:t,query_params:{},path:He})}function Vo(t){return x({query_params:{},fn:ut,path:`${He}/${t}/alerts`})}const ot="alerts";function ut(t){return new hi(t)}function Zo(t={}){return x({query_params:t,fn:ut,path:ot})}function Go(t,e={}){return b({id:t,query_params:e,fn:ut,path:ot})}function Ko(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:ut,path:ot})}function Yo(t){return O({form_data:t,query_params:{},fn:ut,path:ot})}function Jo(t){return T({id:t,query_params:{},path:ot})}class di extends z{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 Xo(t){return pi[t]||0}function eu(t){return _i[t]||0}let pi={},_i={},vr="";const en=t=>t;function x(t){const{query_params:e,fn:n,path:r,endpoint:i}=t,s=R(e),o=`${i||A()}${r?"/"+r:""}${s?"?"+s:""}`;return C(o).pipe(v(u=>{const c=tu(o,s,r);return{total:c.total||0,next:c.next?()=>x({query_params:c.next,fn:n,endpoint:i,path:r}):null,data:u&&u instanceof Array?u.map(l=>(n||en)(l)):u&&!(u instanceof Array)&&u.results?u.results.map(l=>l):[]}}))}function b(t){const{query_params:e,id:n,path:r,fn:i,options:s}=t,o=R(e),u=`${A()}/${r}/${n}${o?"?"+o:""}`;return C(u,s).pipe(v(c=>(i||en)(c)))}function O(t){const{query_params:e,form_data:n,path:r,fn:i}=t,s=R(e),o=`${A()}/${r}${s?"?"+s:""}`;return G(o,n).pipe(v(c=>(i||en)(c)))}function m(t){const{id:e,task_name:n,form_data:r,method:i,path:s,callback:o}=t,u=R(r),c=`${A()}/${s}/${e}/${n}`;return(i==="post"||i==="put"||!i?(i==="put"?Oe:G)(c,r):(i==="del"?ge:C)(`${c}${u?"?"+u:""}`,{response_type:"json"})).pipe(v(_=>(o||(y=>y))(_)))}function E(t){const{id:e,query_params:n,form_data:r,method:i,path:s,fn:o}=t,u=R({...n,version:r.version||0}),c=`${A()}/${s}/${e}${u?"?"+u:""}`;return(i==="put"?Oe:je)(c,r).pipe(v(l=>(o||en)(l)))}function T(t){const{id:e,query_params:n,path:r}=t,i=R(n),s=`${A()}/${r}/${e}${i?"?"+i:""}`;return ge(s)}function tu(t,e,n){const r=ai(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)&&(pi[n]=s),_i[n]=s,i.total=s}return r&&r.link&&(vr=Qr(r.link||"").next,i.next=Ce(vr.split("?")[1])),i}const ct="oauth_apps";function tn(t){return new di(t)}function nu(t={}){return x({query_params:t,fn:tn,path:ct})}function ru(t){return b({id:t,query_params:{},fn:tn,path:ct})}function iu(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:tn,path:ct})}function su(t){return O({form_data:t,query_params:{},fn:tn,path:ct})}function ou(t){return T({id:t,query_params:{},path:ct})}var mi=(t=>(t[t.Certificate=0]="Certificate",t[t.NoAuth=1]="NoAuth",t[t.UserPassword=2]="UserPassword",t))(mi||{});class yi extends z{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 at="brokers";function nn(t){return new yi(t)}function uu(t={}){return x({query_params:t,fn:nn,path:at})}function cu(t,e={}){return b({id:t,query_params:e,fn:nn,path:at})}function au(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:nn,path:at})}function lu(t){return O({form_data:t,query_params:{},fn:nn,path:at})}function hu(t,e={}){return T({id:t,query_params:e,path:at})}class gi{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=tt(this.memory_usage*1024),this.total_memory=tt(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 vi{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=tt(this.memory_usage*1024),this.total_memory=tt(this.memory_total*1024)}}const ze="cluster";function bi(t){return new gi(t)}function fu(t={}){return x({query_params:t,fn:bi,path:ze})}function du(t,e={}){return b({id:t,query_params:e,fn:bi,path:ze})}function pu(t,e={}){return b({id:t,query_params:e,fn:n=>n.map(r=>new vi(t,r)),path:ze})}function _u(t,e){return T({id:t,query_params:e,path:ze})}function mu(){const t=`${A()}${ze}/rebalance`;return G(t,{}).pipe(v(()=>{}))}function yu(){const t=`${A()}${ze}/versions`;return C(t).pipe(v(e=>e))}class Si extends z{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 We="domains";function lt(t){return new Si(t)}function gu(t={}){return x({query_params:t,fn:lt,path:We})}function vu(t){return b({id:t,query_params:{},fn:lt,path:We})}function bu(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:lt,path:We})}function Su(t){return O({form_data:t,query_params:{},fn:lt,path:We})}function ku(t){return T({id:t,query_params:{},path:We})}function $u(t){const e=`${A()}${We}/lookup/${encodeURIComponent(t)}`;return C(e).pipe(v(n=>lt(n)))}var Ee=(t=>(t[t.None=0]="None",t[t.Support=1]="Support",t[t.Admin=2]="Admin",t[t.NeverDisplay=3]="NeverDisplay",t))(Ee||{});class ve extends z{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||Ee.None,this.keys=e.keys||[],this.modified_by_id=e.modified_by_id||""}}var rt=(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))(rt||{});class Vn extends z{class_name;description;module_name;role;default_uri;default_port;repository_id;file_name;commit;ignore_connected;update_available;update_info;alert_level;settings;constructor(e={}){super(e),this.description=e.description||"",this.module_name=e.module_name||"",this.role=e.role??rt.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.alert_level=e.alert_level||"medium",this.settings=e.settings||[null,null,null,null],typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in Ee)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new ve({parent_id:this.id,encryption_level:+n}))}}const ae="drivers";function rn(t){return new Vn(t)}function Au(t={}){return x({query_params:t,fn:rn,path:ae})}function xu(t,e={}){return b({id:t,query_params:e,fn:rn,path:ae})}function wu(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:rn,path:ae})}function Pu(t){return O({form_data:t,query_params:{},fn:rn,path:ae})}function Tu(t){return T({id:t,query_params:{},path:ae})}function Ou(t){return m({id:t,task_name:"recompile",path:ae})}function Eu(t){return m({id:t,task_name:"reload",path:ae})}function qu(t){return m({id:t,task_name:"compiled",method:"get",path:ae})}function Iu(t){return m({id:t,task_name:"readme",method:"get",path:ae})}class ki extends z{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 qe="edges";function sn(t){return new ki(t)}function Mu(t={}){return x({query_params:t,fn:sn,path:qe})}function Ru(t){return b({id:t,query_params:{},fn:sn,path:qe})}function Uu(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:sn,path:qe})}function Du(t){return O({form_data:t,query_params:{},fn:sn,path:qe})}function Cu(t){return T({id:t,query_params:{},path:qe})}function Nu(t){return m({id:t,task_name:"token",form_data:{},method:"get",path:qe})}function Fu(){const t=A(),e=t.startsWith("https")?"wss:":"ws:",n=t.startsWith("https")?"https:":"http:";return t.replace(n,e)+`${qe}/control`}class $i extends z{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 ht="ldap_auths";function on(t){return new $i(t)}function Lu(t={}){return x({query_params:t,fn:on,path:ht})}function ju(t){return b({id:t,query_params:{},fn:on,path:ht})}function Hu(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:on,path:ht})}function zu(t){return O({form_data:t,query_params:{},fn:on,path:ht})}function Wu(t){return T({id:t,query_params:{},path:ht})}class Zn{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 le extends z{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;any_match;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||"",this.any_match=e.any_match||!1}}class un extends z{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 Ee)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new ve({parent_id:this.id,encryption_level:+n}));e.trigger_data&&e.trigger_data instanceof Array&&(this.trigger_list=e.trigger_data.map(n=>new le(n)))}}class Ai{zone;metadata;keys;constructor(e={}){this.zone=new un(e.zone),this.keys=e.keys||[],this.metadata={};const n=e.metadata||{};for(const r of this.keys)this.metadata[r]=new Zn(n[r])}}const Ie="metadata";function ft(t){return new Zn(t)}function Bu(t,e={}){return b({id:t,query_params:e,fn:n=>Object.keys(n).map(r=>ft(n[r])),path:Ie})}function Qu(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 Vu(t,e={}){return m({id:t,task_name:"history",form_data:e,method:"get",callback:n=>Qu(Object.keys(n).map(r=>n[r].map(i=>ft(i)))),path:Ie})}function Zu(t,e){return b({id:t,query_params:{name:e},fn:n=>ft(n[e]),path:Ie})}function Gu(t,e,n="put"){return E({id:t,form_data:e,query_params:{},method:n,fn:ft,path:Ie})}function Ku(t){return O({form_data:t,query_params:{},fn:ft,path:Ie})}function Yu(t,e){return T({id:t,query_params:e,path:Ie})}function Ju(t,e){return m({id:t,task_name:"children",form_data:e,method:"get",callback:n=>n.map(r=>new Ai({...r,keys:Object.keys(r.metadata)})),path:Ie})}class Gn extends z{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_snapshot_urls;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_snapshot_urls=e.camera_snapshot_urls||[],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 Ee)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new ve({parent_id:this.id,encryption_level:+n}));e.module_data&&e.module_data instanceof Array&&(this.module_list=e.module_data.map(n=>new Kn(n)))}}class Kn extends z{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;alert_level;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??rt.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 Gn(e.control_system||e.system),this.has_runtime_error=e.has_runtime_error||!1,this.error_timestamp=e.error_timestamp||0,this.driver=new Vn(e.dependency||e.driver),this.settings=e.settings||[null,null,null,null],this.alert_level=e.alert_level||"medium",typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in Ee)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new ve({parent_id:this.id,encryption_level:+n}))}toJSON(e=!1){const n=super.toJSON();return(n.role!==rt.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 cn(t){return new Kn(t)}function Xu(t={}){return x({query_params:t,fn:cn,path:Y})}function ec(t,e={}){return b({id:t,query_params:e,fn:cn,path:Y})}function tc(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:cn,path:Y})}function nc(t){return O({form_data:t,query_params:{},fn:cn,path:Y})}function rc(t){return T({id:t,query_params:{},path:Y})}function ic(t){return m({id:t,task_name:"start",path:Y})}function sc(t){return m({id:t,task_name:"stop",path:Y})}function oc(t){return m({id:t,task_name:"state",method:"get",path:Y})}function uc(t,e){return m({id:t,task_name:`state/${e}`,method:"get",path:Y})}function cc(t){return m({id:t,task_name:"load",method:"post",path:Y})}function ac(t){return m({id:t,task_name:"settings",method:"get",callback:e=>e.map(n=>new ve(n)),path:Y})}function lc(t){return m({id:t,task_name:"error",method:"get",path:Y})}function hc(t,e,n=[]){return m({id:t,task_name:`exec/${encodeURIComponent(e)}`,form_data:n,path:Y})}class xi extends z{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 dt="oauth_auths";function an(t){return new xi(t)}function fc(t={}){return x({query_params:t,fn:an,path:dt})}function dc(t){return b({id:t,query_params:{},fn:an,path:dt})}function pc(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:an,path:dt})}function _c(t){return O({form_data:t,query_params:{},fn:an,path:dt})}function mc(t){return T({id:t,query_params:{},path:dt})}var Yn=(t=>(t.Driver="driver",t.Interface="interface",t))(Yn||{});class wi extends z{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||Yn.Driver,this.username=e.username||"",this.password=e.password||"",this.root_path=e.root_path||""}}const Q="repositories";function ln(t){return new wi(t)}function yc(t={}){return x({query_params:t,fn:ln,path:Q})}function gc(t){return b({id:t,query_params:{},fn:ln,path:Q})}function vc(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:ln,path:Q})}function bc(t){return O({form_data:t,query_params:{},fn:ln,path:Q})}function Sc(t){return T({id:t,query_params:{},path:Q})}function kc(){return b({id:"interfaces",query_params:{},path:Q})}function $c(t){return b({id:"remote_default_branch",query_params:t,path:Q})}function Ac(t){return b({id:"remote_branches",query_params:t,path:Q})}function xc(t){return b({id:"remote_commits",query_params:t,path:Q})}function wc(t,e){return m({id:t,task_name:"drivers",form_data:e,method:"get",path:Q})}function Pc(t,e){return m({id:t,task_name:"commits",form_data:e,method:"get",path:Q})}function Tc(t){return m({id:t,task_name:"branches",method:"get",path:Q})}function Oc(t){return m({id:t,task_name:"default_branch",method:"get",path:Q})}function Ec(t,e){return m({id:t,task_name:"details",form_data:e,method:"get",path:Q})}function qc(t,e){return m({id:t,task_name:"pull",form_data:e,method:"post",path:Q})}function Ic(t,e){return m({id:t,task_name:"folders",form_data:e,method:"get",path:Q})}class Pi extends z{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 pt="saml_auths";function hn(t){return new Pi(t)}function Mc(t={}){return x({query_params:t,fn:hn,path:pt})}function Rc(t){return b({id:t,query_params:{},fn:hn,path:pt})}function Uc(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:hn,path:pt})}function Dc(t){return O({form_data:t,query_params:{},fn:hn,path:pt})}function Cc(t){return T({id:t,query_params:{},path:pt})}const Be="settings";function _t(t){return new ve(t)}function Nc(t={}){return x({query_params:t,fn:_t,path:Be})}function Fc(t){return b({id:t,query_params:{},fn:_t,path:Be})}function Lc(t,e,n={},r="patch"){return E({id:t,form_data:e,query_params:n,method:r,fn:_t,path:Be})}function jc(t,e={}){return O({form_data:t,query_params:e,fn:_t,path:Be})}function Hc(t){return T({id:t,query_params:{},path:Be})}function zc(t,e={}){return m({id:t,task_name:"history",form_data:e,method:"get",callback:n=>n.map(r=>_t(r)),path:Be})}const U="systems";function Me(t){return new Gn(t)}function Wc(t={}){return x({query_params:t,fn:Me,path:U})}function Bc(t){return x({query_params:t,fn:Me,path:`${U}/with_emails`})}function Qc(t,e={}){return b({id:t,query_params:e,fn:Me,path:U})}function Vc(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:Me,path:U})}function Zc(t){return O({form_data:t,query_params:{},fn:Me,path:U})}function Gc(t){return T({id:t,query_params:{},path:U})}function Kc(t,e,n={}){return m({id:t,task_name:`module/${e}`,form_data:n,method:"put",callback:r=>Me(r),path:U})}function Yc(t,e){return m({id:t,task_name:`module/${e}`,form_data:{},method:"del",callback:n=>Me(n),path:U})}function Jc(t,e={}){return m({id:t,task_name:"start",form_data:e,path:U})}function Xc(t,e={}){return m({id:t,task_name:"stop",form_data:e,path:U})}function ea(t,e,n,r=1,i=[]){return m({id:t,task_name:`${n}_${r}/${encodeURIComponent(e)}`,form_data:i,path:U})}function ta(t,e,n=1){return m({id:t,task_name:`${e}_${n}`,method:"get",path:U})}function na(t,e,n=1,r){return m({id:t,task_name:`${e}_${n}/${r}`,method:"get",path:U})}function ra(t,e,n=1){return m({id:t,task_name:`functions/${e}_${n}`,method:"get",path:U})}function ia(t){return x({query_params:{},fn:e=>new un(e),path:`${U}/${t}/zones`})}function sa(t,e={}){return x({query_params:e,fn:n=>new le(n),path:`${U}/${t}/triggers`})}function oa(t,e){return m({id:t,task_name:"triggers",form_data:e,method:"post",callback:n=>new le(n),path:U})}function ua(t,e){return m({id:t,task_name:`triggers/${e}`,method:"del",path:U})}function ca(t){return m({id:t,task_name:"settings",method:"get",callback:e=>e.map(n=>new ve(n)),path:U})}function aa(t={}){const e=A(),n=e.startsWith("https")?"wss:":"ws:",r=e.startsWith("https")?"https:":"http:";let i=e.replace(r,n)+`${U}/control`;return t.fixed_device&&(i+=`?fixed_device=${encodeURIComponent(String(t.fixed_device))}`),i}function la(t,e={}){return m({id:t,task_name:"metadata",form_data:e,method:"get",path:U})}function ha(t,e,n={}){return m({id:t,task_name:`triggers/${encodeURIComponent(e)}`,form_data:n,method:"get",callback:r=>new le(r),path:U})}function fa(t,e,n,r="patch"){return m({id:t,task_name:`triggers/${encodeURIComponent(e)}`,form_data:n,method:r,callback:i=>new le(i),path:U})}const Qe="triggers";function fn(t){return new le(t)}function da(t={}){return x({query_params:t,fn,path:Qe})}function pa(t,e={}){return b({id:t,query_params:e,fn,path:Qe})}function _a(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn,path:Qe})}function ma(t){return O({form_data:t,query_params:{},fn,path:Qe})}function ya(t){return T({id:t,query_params:{},path:Qe})}function ga(t){return m({id:t,task_name:"instances",form_data:{},method:"get",callback:e=>e.map(n=>new le(n)),path:Qe})}var Ti=(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))(Ti||{}),Oi=(t=>(t.AT="at",t.CRON="cron",t))(Oi||{}),Ei=(t=>(t[t.ExecuteBefore=0]="ExecuteBefore",t[t.ExecuteAfter=1]="ExecuteAfter",t[t.PayloadOnly=2]="PayloadOnly",t[t.IgnorePayload=3]="IgnorePayload",t))(Ei||{});class qi extends z{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 J="users";function Ve(t){return new qi(t)}function va(t={}){return x({query_params:t,fn:Ve,path:J})}function ba(t,e={}){return b({id:t,query_params:e,fn:Ve,path:J})}function Sa(t={}){return b({id:"current",query_params:t,fn:Ve,path:J})}function ka(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:Ve,path:J})}function $a(t){return O({form_data:t,query_params:{},fn:Ve,path:J})}function Aa(t,e={}){return T({id:t,query_params:e,path:J})}function xa(t){const e=R(t),n=`${A()}${J}/groups${e?"?"+e:""}`;return C(n).pipe(v(r=>r))}function wa(t){const e=R(t),n=`${A()}${J}/metadata/search${e?"?"+e:""}`;return C(n).pipe(v(r=>r))}function Pa(){const t=`${A()}${J}/resource_token`;return G(t,{}).pipe(v(e=>e))}function Ta(t,e={}){return m({id:t,task_name:"metadata",form_data:e,method:"get",path:J})}function Oa(t){const e=`${A()}${J}/${encodeURIComponent(t)}/resource_token`;return ge(e,{response_type:"void"})}function Ea(t){const e=`${A()}${J}/${encodeURIComponent(t)}/resource_token`;return G(e,{}).pipe(v(n=>n))}function qa(t){return m({id:t,task_name:"revive",form_data:{},method:"post",callback:e=>Ve(e),path:J})}const he="zones";function dn(t){return new un(t)}function Ia(t={}){return x({query_params:t,fn:dn,path:he})}function Ma(t={}){return b({id:"tags",query_params:t,fn:e=>e,path:he})}function Ra(t,e={}){return b({id:t,query_params:e,fn:dn,path:he})}function Ua(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:dn,path:he})}function Da(t){return O({form_data:t,query_params:{},fn:dn,path:he})}function Ca(t){return T({id:t,query_params:{},path:he})}function Na(t,e={}){return x({query_params:e,fn:n=>new le(n),path:`${he}/${t}/triggers`})}function Fa(t,e,n,r=1,i=[]){return m({id:t,task_name:`exec/${encodeURIComponent(n+"_"+r)}/${encodeURIComponent(e)}`,form_data:i,path:he})}function La(t,e={}){return m({id:t,task_name:"metadata",form_data:e,method:"get",path:he})}var Jn=(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))(Jn||{});class Ii{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;plugin_id;plugin_params;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||_r(Date.now()),this.updated_at=e.updated_at||_r(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.plugin_id=e.plugin_id||"",this.plugin_params=e.plugin_params||{},this.play_count=e.play_count||0,this.valid_from=e.valid_from,this.valid_until=e.valid_until}}class pn{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 Mi{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||Jn.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||""}}class Ri{id;created_at;updated_at;name;description;uri;playback_type;authority_id;enabled;params;defaults;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.uri=e.uri||"",this.playback_type=e.playback_type||"static",this.authority_id=e.authority_id||"",this.enabled=e.enabled??!0,this.params=e.params||{},this.defaults=e.defaults||{}}}const Ui="signage";function ja(t,e={},n){return b({id:t,query_params:e,fn:r=>r,path:`${Ui}`,options:n})}function Ha(t){return m({id:t,task_name:"metrics",form_data:{},method:"post",callback:e=>e,path:Ui})}const Ze="signage/media";function _n(t){return new Ii(t)}function za(t={}){return x({query_params:t,fn:_n,path:Ze})}function Wa(t,e={}){return b({id:t,query_params:e,fn:_n,path:Ze})}function Ba(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:_n,path:Ze})}function Qa(t){return O({form_data:t,query_params:{},fn:_n,path:Ze})}function Va(t,e={}){return T({id:t,query_params:e,path:Ze})}function Za(t){return`${A()}/${Ze}/${t}/thumbnail`}const fe="signage/playlists";function mn(t){return new Mi(t)}function Ga(t={}){return x({query_params:t,fn:mn,path:fe})}function Ka(t,e={}){return b({id:t,query_params:e,fn:mn,path:fe})}function Ya(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:mn,path:fe})}function Ja(t){return O({form_data:t,query_params:{},fn:mn,path:fe})}function Xa(t,e={}){return T({id:t,query_params:e,path:fe})}function el(t,e={}){return m({id:t,task_name:"media",form_data:e,method:"get",callback:n=>new pn(n),path:fe})}function tl(t,e={}){return m({id:t,task_name:"media/revisions",form_data:e,method:"get",callback:n=>n.map(r=>new pn(r)),path:fe})}function nl(t){return m({id:t,task_name:"media/approve",method:"post",path:fe})}function rl(t,e){return m({id:t,task_name:"media",form_data:e,method:"post",path:fe,callback:n=>new pn(n)})}const mt="signage/plugins";function yn(t){return new Ri(t)}function il(t={}){return x({query_params:t,fn:yn,path:mt})}function sl(t,e={}){return b({id:t,query_params:e,fn:yn,path:mt})}function ol(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:yn,path:mt})}function ul(t){return O({form_data:t,query_params:{},fn:yn,path:mt})}function cl(t,e={}){return T({id:t,query_params:e,path:mt})}class Xn{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 Di="/api/staff/v1/surveys/answers";function al(t={}){const e=R(t);return C(`${Di}${e?"?"+e:""}`).pipe(v(n=>n.map(r=>new Xn(r))))}function ll(t){return G(`${Di}`,t).pipe(v(e=>e.map(n=>new Xn(n))))}class yt{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 gt="/api/staff/v1/surveys/invitations";function hl(t={}){const e=R(t);return C(`${gt}${e?"?"+e:""}`).pipe(v(n=>n.map(r=>new yt(r))))}function fl(t,e={}){const n=R(e);return C(`${gt}/${t}${n?"?"+n:""}`).pipe(v(r=>new yt(r)))}function dl(t,e,n="patch"){return(n==="put"?Oe:je)(`${gt}/${t}`,e).pipe(v(r=>new yt(r)))}function pl(t){return G(`${gt}`,t).pipe(v(e=>new yt(e)))}function _l(t,e={}){const n=R(e);return ge(`${gt}/${t}${n?"?"+n:""}`)}class vt{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 bt="/api/staff/v1/surveys/questions";function ml(t={}){const e=R(t);return C(`${bt}${e?"?"+e:""}`).pipe(v(n=>n.map(r=>new vt(r))))}function yl(t,e={}){const n=R(e);return C(`${bt}/${t}${n?"?"+n:""}`).pipe(v(r=>new vt(r)))}function gl(t){return G(`${bt}`,t).pipe(v(e=>new vt(e)))}function vl(t,e,n="patch"){return(n==="put"?Oe:je)(`${bt}/${t}`,e).pipe(v(r=>new vt(r)))}function bl(t,e={}){const n=R(e);return ge(`${bt}/${t}${n?"?"+n:""}`)}class St{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 kt="/api/staff/v1/surveys";function Sl(t={}){const e=R(t);return C(`${kt}${e?"?"+e:""}`).pipe(v(n=>n.map(r=>new St(r))))}function kl(t,e={}){const n=R(e);return C(`${kt}/${t}${n?"?"+n:""}`).pipe(v(r=>new St(r)))}function $l(t,e,n="patch"){return(n==="put"?Oe:je)(`${kt}/${t}`,e).pipe(v(r=>new St(r)))}function Al(t){return G(`${kt}`,t).pipe(v(e=>new St(e)))}function xl(t,e={}){const n=R(e);return ge(`${kt}/${t}${n?"?"+n:""}`)}class Ci{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 Ni{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 Fi{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 Li{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 be="assets";function Re(t){return new Li(t)}function wl(t={}){return x({query_params:t,fn:Re,path:be})}function Pl(t,e={}){return b({id:t,query_params:e,fn:Re,path:be})}function Tl(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:Re,path:be})}function Ol(t){return O({form_data:t,query_params:{},fn:Re,path:be})}function El(t,e={}){return T({id:t,query_params:e,path:be})}function ql(t){return G(`${A()}${be}/bulk`,JSON.stringify(t),{}).pipe(v(e=>e.map(n=>Re(n))))}function Il(t,e="patch"){return(e==="put"?Oe:je)(`${A()}${be}/bulk`,JSON.stringify(t),{}).pipe(v(r=>r.map(i=>Re(i))))}function Ml(t,e={}){const n=R(e);return ge(`${A()}${be}/bulk${n?"?"+n:""}`,{body:JSON.stringify(t)}).pipe(v(r=>r.map(i=>Re(i))))}const $t="asset_types";function gn(t){return new Fi(t)}function Rl(t={}){return x({query_params:t,fn:gn,path:$t})}function Ul(t,e={}){return b({id:t,query_params:e,fn:gn,path:$t})}function Dl(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:gn,path:$t})}function Cl(t){return O({form_data:t,query_params:{},fn:gn,path:$t})}function Nl(t,e={}){return T({id:t,query_params:e,path:$t})}const At="asset_categories";function vn(t){return new Ci(t)}function Fl(t={}){return x({query_params:t,fn:vn,path:At})}function Ll(t,e={}){return b({id:t,query_params:e,fn:vn,path:At})}function jl(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:vn,path:At})}function Hl(t){return O({form_data:t,query_params:{},fn:vn,path:At})}function zl(t,e={}){return T({id:t,query_params:e,path:At})}const xt="asset_purchase_orders";function bn(t){return new Ni(t)}function Wl(t={}){return x({query_params:t,fn:bn,path:xt})}function Bl(t,e={}){return b({id:t,query_params:e,fn:bn,path:xt})}function Ql(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:bn,path:xt})}function Vl(t){return O({form_data:t,query_params:{},fn:bn,path:xt})}function Zl(t,e={}){return T({id:t,query_params:e,path:xt})}class ji{id;name;uri;description;user_id;user_email;user_name;redirect_count;enabled;valid_from;valid_until;authority_id;created_at;updated_at;constructor(e){this.id=e.id||"",this.name=e.name||"",this.uri=e.uri||"",this.description=e.description||"",this.user_id=e.user_id||"",this.user_email=e.user_email||"",this.user_name=e.user_name||"",this.redirect_count=e.redirect_count||0,this.enabled=e.enabled??!0,this.valid_from=e.valid_from||"",this.valid_until=e.valid_until||"",this.authority_id=e.authority_id||"",this.created_at=e.created_at||0,this.updated_at=e.updated_at||0}}const ie="short_url";function Sn(t){return new ji(t)}function Gl(t={}){return x({query_params:t,fn:Sn,path:ie})}function Kl(t,e={}){return b({id:t,query_params:e,fn:Sn,path:ie})}function Yl(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:Sn,path:ie})}function Jl(t){return O({form_data:t,query_params:{},fn:Sn,path:ie})}function Xl(t,e={}){return T({id:t,query_params:e,path:ie})}function eh(t){return`${A()}${ie}/${encodeURIComponent(t)}/redirect`}function th(t){return C(`${A()}${ie}/${encodeURIComponent(t)}/qr_code.svg`,{response_type:"text"})}function nh(t,e={}){const n=R(e);return`${A()}${ie}/${encodeURIComponent(t)}/qr_code.png${n?"?"+n:""}`}function rh(t){const{format:e="svg",...n}=t,r={...n,format:e},i=R(r);return`${A()}${ie}/qr_code${i?"?"+i:""}`}function ih(t){const e={...t,format:"svg"},n=R(e);return C(`${A()}${ie}/qr_code${n?"?"+n:""}`,{response_type:"text"})}class Hi{id;storage_type;bucket_name;region;access_key;access_secret;authority_id;endpoint;is_default;ext_filter;mime_filter;created_at;updated_at;constructor(e){this.id=e.id||"",this.storage_type=e.storage_type||null,this.bucket_name=e.bucket_name||"",this.region=e.region||"",this.access_key=e.access_key||"",this.access_secret=e.access_secret||"",this.authority_id=e.authority_id||"",this.endpoint=e.endpoint||"",this.is_default=e.is_default??!1,this.ext_filter=e.ext_filter||[],this.mime_filter=e.mime_filter||[],this.created_at=e.created_at||0,this.updated_at=e.updated_at||0}}const wt="storages";function kn(t){return new Hi(t)}function sh(t={}){return x({query_params:t,fn:kn,path:wt})}function oh(t,e={}){return b({id:t,query_params:e,fn:kn,path:wt})}function uh(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:kn,path:wt})}function ch(t){return O({form_data:t,query_params:{},fn:kn,path:wt})}function ah(t,e={}){return T({id:t,query_params:e,path:wt})}const Se="webrtc";function lh(t={}){const e=R(t),n=`${A()}${Se}/rooms${e?"?"+e:""}`;return C(n).pipe(v(r=>r))}function hh(t){const e=`${A()}${Se}/room/${encodeURIComponent(t)}`;return C(e).pipe(v(n=>n))}function fh(t){const e=`${A()}${Se}/members/${encodeURIComponent(t)}`;return C(e).pipe(v(n=>n))}function dh(t,e){const n=`${A()}${Se}/guest_entry/${encodeURIComponent(t)}`;return G(n,e).pipe(v(()=>{}))}function ph(){const t=`${A()}${Se}/guest/exit`;return G(t,{}).pipe(v(()=>{}))}function _h(t,e,n){const r=`${A()}${Se}/kick/${encodeURIComponent(t)}/${encodeURIComponent(e)}`;return G(r,n).pipe(v(()=>{}))}function mh(t,e,n){const r=`${A()}${Se}/transfer/${encodeURIComponent(t)}/${encodeURIComponent(e)}`;return G(r,n||{}).pipe(v(()=>{}))}function yh(){const t=A(),e=t.startsWith("https")?"wss:":"ws:",n=t.startsWith("https")?"https:":"http:";return t.replace(n,e)+`${Se}/signaller`}var gh={url:"",deserializer:function(t){return JSON.parse(t.data)},serializer:function(t){return JSON.stringify(t)}},vh="WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }",bh=function(t){ne(e,t);function e(n,r){var i=t.call(this)||this;if(i._socket=null,n instanceof N)i.destination=r,i.source=n;else{var s=i._config=Xe({},gh);if(i._output=new xe,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 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 xe},e.prototype.multiplex=function(n,r,i){var s=this;return new N(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(y){c.error(y);return}var _=new Pe(function(){n._socket=null,l&&l.readyState===1&&l.close()});l.onopen=function(y){var p=n._socket;if(!p){l.close(),n._resetState();return}var a=n._config.openObserver;a&&a.next(y);var f=n.destination;n.destination=Vt.create(function(h){if(l.readyState===1)try{var $=n._config.serializer;l.send($(h))}catch(S){n.destination.error(S)}},function(h){var $=n._config.closingObserver;$&&$.next(void 0),h&&h.code?l.close(h.code,h.reason):c.error(new TypeError(vh)),n._resetState()},function(){var h=n._config.closingObserver;h&&h.next(void 0),l.close(),n._resetState()}),f&&f instanceof An&&_.add(f.subscribe(n.destination))},l.onerror=function(y){n._resetState(),c.error(y)},l.onclose=function(y){l===n._socket&&n._resetState();var p=n._config.closeObserver;p&&p.next(y),y.wasClean?c.complete():c.error(y)},l.onmessage=function(y){try{var p=n._config.deserializer;c.next(p(y))}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}(On);function Sh(t){return new bh(t)}var te=(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))(te||{}),er=(t=>(t.Info="info",t.Debug="debug",t.Warning="warn",t.Error="error",t.Fatal="fatal",t.Trace="trace",t))(er||{});class zi{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 N)&&!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 ye(n),this[`_${e}_obs`]=this[`_${e}`].asObservable(),Object.defineProperty(this,e,{get:()=>this[`_${e}`].getValue(),set:r=>this[`_${e}`].next(r)})}}class Wi{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 zi(this,n))}}const Wt={};function kh(t,e){return Wt[t]=new Wi(e),Wt[t]}function Bi(t){return Wt[t]}function $h(t){delete Wt[t]}const Qi=15;let Pt=0,X,Vi=0;const B={},tr={},Ue={},Ah={},ke=new ye(!1);Ue._place_os_status=ke.asObservable();const Zi=new ye([0,0]);Ue._place_os_sync=Zi.asObservable();let Gi=Date.now(),Ne,Bt=0,de=null,Rt,nr=0;const Tt=10*1e3,rr=new xe;Ue._place_os_debug_events=rr.asObservable();function Ut(){return A().indexOf("/control/")>=0?"/control/websocket":`${jn()}/systems/control`}function ir(){return ke.getValue()}function Ki(){return Ue._place_os_status}function xh(){return Ue._place_os_sync}function Yi(t,e=tr,n=Ue){const r=`${t.sys}|${t.mod}_${t.index}|${t.name}`;return e[r]||(e[r]=new ye(void 0),n[r]=e[r].asObservable()),n[r]}function Ji(t,e=tr){const n=`${t.sys}|${t.mod}_${t.index}|${t.name}`;if(e[n])return e[n].getValue()}function qn(t,e=0,n=Ge){const r={id:++Pt,cmd:"bind",...t};return n(r,e)}function Xi(t,e=0,n=Ge){const r={id:++Pt,cmd:"unbind",...t};return n(r,e)}function es(t,e=Tt,n=Ge){const r={id:++Pt,cmd:"exec",...t};return n(r,e)}function wh(t,e=Tt,n=Ge){const r={id:++Pt,cmd:"debug",...t};return n(r,e)}function Ph(t,e=Tt,n=Ge){const r={id:++Pt,cmd:"ignore",...t};return n(r,e)}function Ge(t,e=Tt,n=0){const r=`${t.cmd}|${t.sys}|${t.mod}${t.index}|${t.name}|${t.args}|${Kr()}`;if(B[r])d("WS","Request already in progress. Waiting...",t);else{const i={...t,key:r};i.promise=new Promise((s,o)=>{const u=()=>{delete B[r],B[r]=null,Ge(t,e,n).then(c=>s(c),c=>o(c))};if(X&&ir()){Gt()&&Rh(t,X,Ah),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),X.next(t),e>0&&oe(`${r}`,()=>{o("Request timed out."),delete B[r],B[r]=null},e)}else de?setTimeout(()=>u(),1e3):sr().then(()=>u())}),B[r]=i}return B[r].promise}function ts(t){if(t!=="pong"&&t instanceof Object){if(t.type==="notify"&&t.meta)Eh(t.meta,t.value);else if(t.type==="success")Th(t);else if(t.type==="debug"){d("WS",`[DEBUG] ${t.mod}${t.klass||""} →`,t.msg);const e=t.meta||{mod:"",index:""};rr.next({mod_id:t.mod||"<empty>",module:`${e.mod}_${e.index}`,class_name:t.klass||"<empty>",message:t.msg||"<empty>",level:t.level||er.Debug,time:Math.floor(new Date().getTime()/1e3)})}else t.type==="error"?Oh(t):t.cmd||d("WS","Invalid websocket message",t,"error");Te(`${t.id}`)}else t==="pong"&&(nr=Date.now(),d("WS","Pong!"))}function Th(t){const e=Object.keys(B).map(n=>B[n]).find(n=>n?.id===t.id);d("WS",`[SUCCESS](${t.id})`),e&&e.resolve&&(e.resolve(t.value),delete B[e.key])}function Oh(t){let e="UNEXPECTED FAILURE";switch(t.code){case te.ACCESS_DENIED:e="ACCESS DENIED";break;case te.BAD_REQUEST:e="BAD REQUEST";break;case te.MOD_NOT_FOUND:e="MODULE NOT FOUND";break;case te.SYS_NOT_FOUND:e="SYSTEM NOT FOUND";break;case te.PARSE_ERROR:e="PARSE ERROR";break;case te.REQUEST_FAILED:e="REQUEST FAILED";break;case te.UNKNOWN_CMD:e="UNKNOWN COMMAND";break}d("WS",`[ERROR] ${e}(${t.id}): ${t.msg}`,void 0,"error");const n=Object.keys(B).map(r=>B[r]).filter(r=>r).find(r=>r.id===t.id);n&&n.reject&&(n.reject(t),Te(`${n.key}`),delete B[n.key])}function Eh(t,e,n=tr,r=Ue){const i=`${t.sys}|${t.mod}_${t.index}|${t.name}`;n[i]||(n[i]=new ye(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 sr(t=0){return de==null&&(de=new Promise(e=>{if(t>40)return location.reload();Bt++,Gi=Date.now(),X=Gt()?Mh():qh(),X?(d("WS(Debug)","Authority:",[nt()]),d("WS","Connecting to websocket..."),X.subscribe(n=>{ke.getValue()||(d("WS","Connection established."),e()),ke.next(!0),Bt=0,xn(),ts(n)},n=>{X=void 0,de=null,Sr(),xn(),Ih(n)},()=>{X=void 0,de=null,Sr(),d("WS","Connection closed by browser."),ke.next(!1),Qt()}),Ne&&clearInterval(Ne),nr=Date.now(),br(),Ne=setInterval(()=>br(),Qi*1e3),xn(),Vi+=1,Rt=setTimeout(()=>{d("WS","Unhealthy connection. Reconnecting..."),ke.next(!1),de=null,Qt()},30*1e3)):(X?d("WS",`Waiting on auth(${t}). Retrying in ${1e3*Math.min(10,t+1)}ms...`,[!!K(),!!nt()],"info"):d("WS",`Failed to create websocket(${t}). Retrying in ${1e3*Math.min(10,t+1)}ms...`,void 0,"error"),setTimeout(()=>{de=null,sr(t).then(n=>e(n))},1e3*Math.min(10,++t)))})),de}function qh(){if(!nt()||!K())return null;const t=ni()||location.protocol.indexOf("https")>=0;let e=`ws${t?"s":""}://${Ht()}${Ut()}${Hn()?"?fixed_device=true":""}`;const n=K();let r=n==="x-api-key"?`api-key=${it()}`:`bearer_token=${n}`;return!mo()&&!Zr()?(d("WS","Authenticating through cookie..."),r+=`;max-age=120;path=${Ut()};`,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":""}://${Ht()}${Ut()}`),Sh({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 Qt(){Zi.next([Vi,Date.now()-Gi]),X&&ir()&&(X.complete(),Ne&&(clearInterval(Ne),Ne=void 0)),d("WS",`Reconnecting in ${Math.min(5e3,Bt*300||1e3)}ms...`),oe("reconnect",()=>sr(),Math.min(5e3,(Bt+1)*300||1e3))}function br(){if(Date.now()-nr>4*Qi*1e3)return Qt();X?.next("ping")}function Ih(t){ke.next(!1),d("WS","Websocket error:",t,void 0,"error"),t.status===401&&Yt(),zn(),Qt()}function xn(){Rt&&(clearTimeout(Rt),Rt=void 0)}function Mh(){const t=new xe;return t.subscribe(e=>ts(e)),t}function Rh(t,e,n){const r=`${t.sys}|${t.mod}_${t.index}|${t.name}`,i=Bi(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],Te(`${r}`));break}oe(`${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 oe(`${t.id}-error`,()=>e.next({id:t.id,type:"error",code:i?te.SYS_NOT_FOUND:te.MOD_NOT_FOUND}),10)}function Sr(){for(const t in B)B[t]&&delete B[t]}class In{constructor(e,n){this._module=e,this.name=n,Ki().pipe(Zs()).subscribe(r=>{r&&(this._stale_bindings||this._pending===1)?(d("VAR","Re-binding to status variable",this.binding()),this.rebind()):r||(Te(`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 Ji(this.binding())}listen(){return Yi(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,qn(this.binding()).then(()=>{this._binding_count++,this._pending=0}).catch(()=>null)),()=>this.unbind()}unbind(){this._binding_count===1&&this._pending===0?(this._pending=2,Xi(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||oe(`rebind:${JSON.stringify(this.binding())}`,async()=>{await qn(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 ns{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 In(this,e)),this._bindings[e]}variable(e){return this._bindings[e]||(this._bindings[e]=new In(this,e)),this._bindings[e]}execute(e,n,r=Tt){return es({sys:this._system.id,mod:this.name,index:this.index,name:e,args:n},r)}}class rs{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 ns(this,`${i}_${this._module_list[i].length+1}`));return this._module_list[i][n-1]}}const wn={};function is(t){return wn[t]||(wn[t]=new rs(t)),wn[t]}function Uh(t,e,n=1){return is(t).module(e,n)}exports.AuthType=mi;exports.EncryptionLevel=Ee;exports.MediaAnimation=Jn;exports.MockPlaceWebsocketModule=zi;exports.MockPlaceWebsocketSystem=Wi;exports.PlaceAlert=hi;exports.PlaceAlertDashboard=fi;exports.PlaceApplication=di;exports.PlaceAsset=Li;exports.PlaceAssetCategory=Ci;exports.PlaceAssetPurchaseOrder=Ni;exports.PlaceAssetType=Fi;exports.PlaceCluster=gi;exports.PlaceDomain=Si;exports.PlaceDriver=Vn;exports.PlaceDriverRole=rt;exports.PlaceEdge=ki;exports.PlaceErrorCodes=te;exports.PlaceLDAPSource=$i;exports.PlaceLogLevel=er;exports.PlaceMQTTBroker=yi;exports.PlaceMetadata=Zn;exports.PlaceModule=Kn;exports.PlaceModuleBinding=ns;exports.PlaceOAuthSource=xi;exports.PlaceProcess=vi;exports.PlaceRepository=wi;exports.PlaceRepositoryType=Yn;exports.PlaceResource=z;exports.PlaceSAMLSource=Pi;exports.PlaceSettings=ve;exports.PlaceShortUrl=ji;exports.PlaceStorage=Hi;exports.PlaceSystem=Gn;exports.PlaceSystemBinding=rs;exports.PlaceTrigger=le;exports.PlaceUser=qi;exports.PlaceVariableBinding=In;exports.PlaceZone=un;exports.PlaceZoneMetadata=Ai;exports.SignageMedia=Ii;exports.SignagePlaylist=Mi;exports.SignagePlaylistMedia=pn;exports.SignagePlugin=Ri;exports.Survey=St;exports.SurveyAnswer=Xn;exports.SurveyInvitation=yt;exports.SurveyQuestion=vt;exports.TriggerConditionOperator=Ti;exports.TriggerTimeConditionType=Oi;exports.TriggerWebhookType=Ei;exports.addAlert=Yo;exports.addAlertDashboard=Bo;exports.addAnswer=ll;exports.addApplication=su;exports.addAsset=Ol;exports.addAssetCategory=Hl;exports.addAssetPurchaseOrder=Vl;exports.addAssetType=Cl;exports.addAssets=ql;exports.addBroker=lu;exports.addDomain=Su;exports.addDriver=Pu;exports.addEdge=Du;exports.addInvitation=pl;exports.addLDAPSource=zu;exports.addMetadata=Ku;exports.addModule=nc;exports.addOAuthSource=_c;exports.addQuestion=gl;exports.addRepository=bc;exports.addSAMLSource=Dc;exports.addSettings=jc;exports.addShortUrl=Jl;exports.addSignageMedia=Qa;exports.addSignagePlaylist=Ja;exports.addSignagePlugin=ul;exports.addStorage=ch;exports.addSurvey=Al;exports.addSystem=Zc;exports.addSystemModule=Kc;exports.addSystemTrigger=oa;exports.addTrigger=ma;exports.addUser=$a;exports.addZone=Da;exports.apiEndpoint=A;exports.apiKey=it;exports.approveSignagePlaylist=nl;exports.authorise=Wn;exports.authority=nt;exports.bind=qn;exports.cleanObject=Vr;exports.cleanupAuth=$o;exports.clientId=Jr;exports.clusterRebalance=mu;exports.clusterVersions=yu;exports.connectionState=xh;exports.consoleHasColours=En;exports.convertPairStringToMap=Ce;exports.create=O;exports.currentUser=Sa;exports.currentUserResourceToken=Pa;exports.debug=wh;exports.debug_events=rr;exports.del=ge;exports.deregisterMockEndpoint=ui;exports.deregisterSystem=$h;exports.driverReadme=Iu;exports.edgeControlUrl=Fu;exports.execute=es;exports.executeOnModule=hc;exports.executeOnSystem=ea;exports.executeOnZone=Fa;exports.functionList=ra;exports.generateNonce=Br;exports.generateQrCode=ih;exports.get=C;exports.getFragments=Fn;exports.getModule=Uh;exports.getShortUrlQrCodeSvg=th;exports.getSystem=is;exports.hasToken=ei;exports.host=Ht;exports.httpRoute=jn;exports.humanReadableByteCount=tt;exports.ignore=Ph;exports.invalidateToken=Yt;exports.isDriverCompiled=qu;exports.isFixedDevice=Hn;exports.isMobileSafari=Zr;exports.isMock=Gt;exports.isNestedFrame=Gr;exports.isOnline=vo;exports.isSecure=ni;exports.isTrusted=Kt;exports.is_connected=ir;exports.lastRequestTotal=eu;exports.listChildMetadata=Ju;exports.listDashboardAlerts=Vo;exports.listInterfaceRepositories=kc;exports.listMetadata=Bu;exports.listMetadataHistory=Vu;exports.listRemoteRepositoryBranches=Ac;exports.listRemoteRepositoryCommits=xc;exports.listRemoteRepositoryDefaultBranch=$c;exports.listRepositoryBranches=Tc;exports.listRepositoryCommits=Pc;exports.listRepositoryDefaultBranch=Oc;exports.listRepositoryDriverDetails=Ec;exports.listRepositoryDrivers=wc;exports.listRepositoryFolders=Ic;exports.listSignagePlaylistMedia=el;exports.listSignagePlaylistMediaRevisions=tl;exports.listSystemTriggers=sa;exports.listSystemZones=ia;exports.listTriggerInstances=ga;exports.listZoneTags=Ma;exports.listZoneTriggers=Na;exports.listen=Yi;exports.listenForToken=ti;exports.loadModule=cc;exports.log=d;exports.logout=Ao;exports.lookupDomainByEmail=$u;exports.lookupModuleState=uc;exports.lookupSystemModuleState=na;exports.mediaThumbnail=Za;exports.mockSystem=Bi;exports.moduleRuntimeError=lc;exports.moduleSettings=ac;exports.moduleState=oc;exports.onlineState=bo;exports.parseLinkHeader=Qr;exports.patch=je;exports.post=G;exports.pullRepositoryChanges=qc;exports.put=Oe;exports.qrCodeUrl=rh;exports.query=x;exports.queryAlertDashboards=Ho;exports.queryAlerts=Zo;exports.queryAnswers=al;exports.queryApplications=nu;exports.queryAssetCategories=Fl;exports.queryAssetPurchaseOrders=Wl;exports.queryAssetTypes=Rl;exports.queryAssets=wl;exports.queryBrokers=uu;exports.queryClusters=fu;exports.queryDomains=gu;exports.queryDrivers=Au;exports.queryEdges=Mu;exports.queryInvitations=hl;exports.queryLDAPSources=Lu;exports.queryModules=Xu;exports.queryOAuthSources=fc;exports.queryProcesses=pu;exports.queryQuestions=ml;exports.queryRepositories=yc;exports.querySAMLSources=Mc;exports.querySettings=Nc;exports.queryShortUrls=Gl;exports.querySignageMedia=za;exports.querySignagePlaylists=Ga;exports.querySignagePlugins=il;exports.queryStorages=sh;exports.querySurveys=Sl;exports.querySystems=Wc;exports.querySystemsWithEmails=Bc;exports.queryTriggers=da;exports.queryUserGroups=xa;exports.queryUsers=va;exports.queryWebrtcRooms=lh;exports.queryZones=Ia;exports.recompileDriver=Ou;exports.redirectUri=yo;exports.refreshAuthority=zn;exports.refreshToken=jt;exports.registerMockEndpoint=Do;exports.registerSystem=kh;exports.reloadDriver=Eu;exports.remove=T;exports.removeAlert=Jo;exports.removeAlertDashboard=Qo;exports.removeApplication=ou;exports.removeAsset=El;exports.removeAssetCategory=zl;exports.removeAssetPurchaseOrder=Zl;exports.removeAssetType=Nl;exports.removeAssets=Ml;exports.removeBroker=hu;exports.removeDomain=ku;exports.removeDriver=Tu;exports.removeEdge=Cu;exports.removeFragment=_e;exports.removeInvitation=_l;exports.removeLDAPSource=Wu;exports.removeMetadata=Yu;exports.removeModule=rc;exports.removeOAuthSource=mc;exports.removeQuestion=bl;exports.removeRepository=Sc;exports.removeSAMLSource=Cc;exports.removeSettings=Hc;exports.removeShortUrl=Xl;exports.removeSignageMedia=Va;exports.removeSignagePlaylist=Xa;exports.removeSignagePlugin=cl;exports.removeStorage=ah;exports.removeSurvey=xl;exports.removeSystem=Gc;exports.removeSystemModule=Yc;exports.removeSystemTrigger=ua;exports.removeTrigger=ya;exports.removeUser=Aa;exports.removeUserResourceToken=Oa;exports.removeZone=Ca;exports.requestTotal=Xo;exports.responseHeaders=ai;exports.retrieveEdgeToken=Nu;exports.reviveUser=qa;exports.searchUserMetadata=wa;exports.setAPI_Key=go;exports.setMockNotFoundHandler=Uo;exports.setStorage=ko;exports.setToken=Xr;exports.settingsHistory=zc;exports.setup=So;exports.shortUrlQrCodePngUrl=nh;exports.shortUrlRedirectUrl=eh;exports.show=b;exports.showAlert=Go;exports.showAlertDashboard=zo;exports.showApplication=ru;exports.showAsset=Pl;exports.showAssetCategory=Ll;exports.showAssetPurchaseOrder=Bl;exports.showAssetType=Ul;exports.showBroker=cu;exports.showCluster=du;exports.showDomain=vu;exports.showDriver=xu;exports.showEdge=Ru;exports.showInvitation=fl;exports.showLDAPSource=ju;exports.showMetadata=Zu;exports.showModule=ec;exports.showOAuthSource=dc;exports.showQuestion=yl;exports.showRepository=gc;exports.showSAMLSource=Rc;exports.showSettings=Fc;exports.showShortUrl=Kl;exports.showSignage=ja;exports.showSignageMedia=Wa;exports.showSignageMetrics=Ha;exports.showSignagePlaylist=Ka;exports.showSignagePlugin=sl;exports.showStorage=oh;exports.showSurvey=kl;exports.showSystem=Qc;exports.showSystemTrigger=ha;exports.showTrigger=pa;exports.showUser=ba;exports.showWebrtcRoom=hh;exports.showZone=Ra;exports.simplifiedTime=Kr;exports.startModule=ic;exports.startSystem=Jc;exports.status=Ki;exports.stopModule=sc;exports.stopSystem=Xc;exports.systemControlUrl=aa;exports.systemMetadata=la;exports.systemModuleState=ta;exports.systemSettings=ca;exports.terminateProcess=_u;exports.token=K;exports.unbind=Xi;exports.update=E;exports.updateAlert=Ko;exports.updateAlertDashboard=Wo;exports.updateApplication=iu;exports.updateAsset=Tl;exports.updateAssetCategory=jl;exports.updateAssetPurchaseOrder=Ql;exports.updateAssetType=Dl;exports.updateAssets=Il;exports.updateBroker=au;exports.updateDomain=bu;exports.updateDriver=wu;exports.updateEdge=Uu;exports.updateInvitation=dl;exports.updateLDAPSource=Hu;exports.updateMetadata=Gu;exports.updateModule=tc;exports.updateOAuthSource=pc;exports.updateQuestion=vl;exports.updateRepository=vc;exports.updateSAMLSource=Uc;exports.updateSettings=Lc;exports.updateShortUrl=Yl;exports.updateSignageMedia=Ba;exports.updateSignagePlaylist=Ya;exports.updateSignagePlaylistMedia=rl;exports.updateSignagePlugin=ol;exports.updateStorage=uh;exports.updateSurvey=$l;exports.updateSystem=Vc;exports.updateSystemTrigger=fa;exports.updateTrigger=_a;exports.updateUser=ka;exports.updateZone=Ua;exports.userMetadata=Ta;exports.userResourceToken=Ea;exports.value=Ji;exports.webrtcGuestEntry=dh;exports.webrtcGuestExit=ph;exports.webrtcKickUser=_h;exports.webrtcSessionMembers=fh;exports.webrtcSignallerUrl=yh;exports.webrtcTransferUser=mh;exports.websocketRoute=Ut;exports.zoneMetadata=La;
|
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=n}});function Ct(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Pe=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=Fe(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(D(_))try{_()}catch(h){s=h instanceof $n?h.errors:[h]}var y=this._finalizers;if(y){this._finalizers=null;try{for(var p=Fe(y),a=p.next();!a.done;a=p.next()){var f=a.value;try{or(f)}catch(h){s=s??[],h instanceof $n?s=Dt(Dt([],Ut(s)),Ut(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 $n(s)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)or(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)&&Ct(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&Ct(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),$r=Pe.EMPTY;function Ar(t){return t instanceof Pe||t&&"closed"in t&&D(t.remove)&&D(t.add)&&D(t.unsubscribe)}function or(t){D(t)?t():t.unsubscribe()}var as={Promise:void 0},ls={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,Dt([t,e],Ut(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function xr(t){ls.setTimeout(function(){throw t})}function ur(){}function qt(t){t()}var Qt=function(t){ne(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,Ar(n)&&n.add(r)):r.destination=ds,r}return e.create=function(n,r,i){return new Tn(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}(Pe),hs=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){Ot(r)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(r){Ot(r)}else Ot(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){Ot(n)}},t}(),Tn=function(t){ne(e,t);function e(n,r,i){var s=t.call(this)||this,o;return D(n)||!n?o={next:n??void 0,error:r??void 0,complete:i??void 0}:o=n,s.destination=new hs(o),s}return e}(Qt);function Ot(t){xr(t)}function fs(t){throw t}var ds={closed:!0,next:ur,error:fs,complete:ur},Rn=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Un(t){return t}function ps(t){return t.length===0?Un:t.length===1?t[0]:function(n){return t.reduce(function(r,i){return i(r)},n)}}var N=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=ms(e)?e:new Tn(e,n,r);return qt(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=cr(n),new n(function(i,s){var o=new Tn({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[Rn]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return ps(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=cr(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 cr(t){var e;return(e=t??as.Promise)!==null&&e!==void 0?e:Promise}function _s(t){return t&&D(t.next)&&D(t.error)&&D(t.complete)}function ms(t){return t&&t instanceof Qt||_s(t)&&Ar(t)}function ys(t){return D(t?.lift)}function ue(t){return function(e){if(ys(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 ee(t,e,n,r,i){return new gs(t,e,n,r,i)}var gs=function(t){ne(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}(Qt),vs=Mn(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),xe=function(t){ne(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 On(this,this);return r.operator=n,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new vs},e.prototype.next=function(n){var r=this;qt(function(){var i,s;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var o=Fe(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;qt(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;qt(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 Pe(function(){r.currentObservers=null,Ct(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 N;return n.source=this,n},e.create=function(n,r){return new On(n,r)},e}(N),On=function(t){ne(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}(xe),ye=function(t){ne(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}(xe),Dn={now:function(){return(Dn.delegate||Date).now()},delegate:void 0},An=function(t){ne(e,t);function e(n,r,i){n===void 0&&(n=1/0),r===void 0&&(r=1/0),i===void 0&&(i=Dn);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}(xe),bs=function(t){ne(e,t);function e(n,r){return t.call(this)||this}return e.prototype.schedule=function(n,r){return this},e}(Pe),ar={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,Dt([t,e],Ut(n)))},clearInterval:function(t){return clearInterval(t)},delegate:void 0},Ss=function(t){ne(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),ar.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&&ar.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,Ct(s,this),r!=null&&(this.id=this.recycleAsyncId(i,r,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(bs),lr=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=Dn.now,t}(),ks=function(t){ne(e,t);function e(n,r){r===void 0&&(r=lr.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}(lr),wr=new ks(Ss),$s=wr,As=new N(function(t){return t.complete()});function xs(t){return t&&D(t.schedule)}var Pr=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function Tr(t){return D(t?.then)}function Or(t){return D(t[Rn])}function Er(t){return Symbol.asyncIterator&&D(t?.[Symbol.asyncIterator])}function qr(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 ws(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Ir=ws();function Mr(t){return D(t?.[Ir])}function Rr(t){return us(this,arguments,function(){var n,r,i,s;return kr(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,De(n.read())];case 3:return r=o.sent(),i=r.value,s=r.done,s?[4,De(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,De(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 Ur(t){return D(t?.getReader)}function ce(t){if(t instanceof N)return t;if(t!=null){if(Or(t))return Ps(t);if(Pr(t))return Ts(t);if(Tr(t))return Os(t);if(Er(t))return Dr(t);if(Mr(t))return Es(t);if(Ur(t))return qs(t)}throw qr(t)}function Ps(t){return new N(function(e){var n=t[Rn]();if(D(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Ts(t){return new N(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function Os(t){return new N(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,xr)})}function Es(t){return new N(function(e){var n,r;try{for(var i=Fe(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 Dr(t){return new N(function(e){Is(t,e).catch(function(n){return e.error(n)})})}function qs(t){return Dr(Rr(t))}function Is(t,e){var n,r,i,s;return os(this,void 0,void 0,function(){var o,u;return kr(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=cs(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 $e(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 Cr(t,e){return e===void 0&&(e=0),ue(function(n,r){n.subscribe(ee(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 Nr(t,e){return e===void 0&&(e=0),ue(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function Ms(t,e){return ce(t).pipe(Nr(e),Cr(e))}function Rs(t,e){return ce(t).pipe(Nr(e),Cr(e))}function Us(t,e){return new N(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function Ds(t,e){return new N(function(n){var r;return $e(n,e,function(){r=t[Ir](),$e(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 D(r?.return)&&r.return()}})}function Fr(t,e){if(!t)throw new Error("Iterable cannot be null");return new N(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 Cs(t,e){return Fr(Rr(t),e)}function Ns(t,e){if(t!=null){if(Or(t))return Ms(t,e);if(Pr(t))return Us(t,e);if(Tr(t))return Rs(t,e);if(Er(t))return Fr(t,e);if(Mr(t))return Ds(t,e);if(Ur(t))return Cs(t,e)}throw qr(t)}function Fs(t,e){return e?Ns(t,e):ce(t)}function Lr(t,e){var n=D(t)?t:function(){return t},r=function(i){return i.error(n())};return new N(r)}var Ls=Mn(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function js(t,e){return new Promise(function(n,r){var i=!1,s;t.subscribe({next:function(o){s=o,i=!0},error:r,complete:function(){i?n(s):r(new Ls)}})})}function Hs(t){return t instanceof Date&&!isNaN(t)}function v(t,e){return ue(function(n,r){var i=0;n.subscribe(ee(r,function(s){r.next(t.call(e,s,i++))}))})}function zs(t,e,n,r,i,s,o,u){var c=[],l=0,_=0,y=!1,p=function(){y&&!c.length&&!l&&e.complete()},a=function(h){return l<r?f(h):c.push(h)},f=function(h){l++;var $=!1;ce(n(h,_++)).subscribe(ee(e,function(S){e.next(S)},function(){$=!0},void 0,function(){if($)try{l--;for(var S=function(){var w=c.shift();o||f(w)};c.length&&l<r;)S();p()}catch(w){e.error(w)}}))};return t.subscribe(ee(e,a,function(){y=!0,p()})),function(){}}function jr(t,e,n){return n===void 0&&(n=1/0),D(e)?jr(function(r,i){return v(function(s,o){return e(r,s,i,o)})(ce(t(r,i)))},n):(typeof e=="number"&&(n=e),ue(function(r,i){return zs(r,i,t,n)}))}function Cn(t,e,n){t===void 0&&(t=0),n===void 0&&(n=$s);var r=-1;return e!=null&&(xs(e)?n=e:r=e),new N(function(i){var s=Hs(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 Ws(t,e){return ue(function(n,r){var i=0;n.subscribe(ee(r,function(s){return t.call(e,s,i++)&&r.next(s)}))})}function Hr(t){return t<=0?function(){return As}:ue(function(e,n){var r=0;e.subscribe(ee(n,function(i){++r<=t&&(n.next(i),t<=r&&n.complete())}))})}function Bs(t){return v(function(){return t})}function Qs(t,e){return jr(function(n,r){return ce(t(n,r)).pipe(Hr(1),Bs(n))})}function Vs(t,e){e===void 0&&(e=wr);var n=Cn(t,e);return Qs(function(){return n})}function Zs(t,e){return e===void 0&&(e=Un),t=t??Gs,ue(function(n,r){var i,s=!0;n.subscribe(ee(r,function(o){var u=e(o);(s||!t(i,u))&&(s=!1,i=u,r.next(o))}))})}function Gs(t,e){return t===e}function Ks(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?Un:ue(function(u,c){var l=0,_,y=function(){var p=!1;_=u.subscribe(ee(c,function(a){o&&(l=0),c.next(a)},void 0,function(a){if(l++<r){var f=function(){_?(_.unsubscribe(),_=null,y()):p=!0};if(i!=null){var h=typeof i=="number"?Cn(i):ce(i(a,l)),$=ee(c,function(){$.unsubscribe(),f()},function(){c.complete()});h.subscribe($)}else f()}else c.error(a)})),p&&(_.unsubscribe(),_=null,y())};y()})}function hr(t,e){return ue(function(n,r){var i=null,s=0,o=!1,u=function(){return o&&!i&&r.complete()};n.subscribe(ee(r,function(c){i?.unsubscribe();var l=0,_=s++;ce(t(c,_)).subscribe(i=ee(r,function(y){return r.next(e?e(c,y,_,l++):y)},function(){i=null,u()}))},function(){o=!0,u()}))})}function Nn(t,e){e===void 0&&(e={});var n=e.selector,r=ss(e,["selector"]);return new N(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 _=Xe(Xe({},r),{signal:o}),y=function(p){u=!1,i.error(p)};return fetch(t,_).then(function(p){n?ce(n(p)).subscribe(ee(i,void 0,function(){u=!1,i.complete()},y)):(u=!1,i.next(p),i.complete())}).catch(y),function(){u&&s.abort()}})}const se=["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","+","/"],fr=[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 Et(t){if(t>=fr.length)throw new Error("Unable to parse base64 string.");const e=fr[t];if(e===255)throw new Error("Unable to parse base64 string.");return e}function zr(t){let e="",n,r=t.length;for(n=2;n<r;n+=3)e+=se[t[n-2]>>2],e+=se[(t[n-2]&3)<<4|t[n-1]>>4],e+=se[(t[n-1]&15)<<2|t[n]>>6],e+=se[t[n]&63];return n===r+1&&(e+=se[t[n-2]>>2],e+=se[(t[n-2]&3)<<4],e+="=="),n===r&&(e+=se[t[n-2]>>2],e+=se[(t[n-2]&3)<<4|t[n-1]>>4],e+=se[(t[n-1]&15)<<2],e+="="),e}function Ys(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=Et(t.charCodeAt(o))<<18|Et(t.charCodeAt(o+1))<<12|Et(t.charCodeAt(o+2))<<6|Et(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 Js(t,e=new TextEncoder){return zr(e.encode(t))}var It={exports:{}},Xs=It.exports,dr;function eo(){return dr||(dr=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})(Xs,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,$){for(var S,w,P,V,F,M,re,L,W,j,Ke,Ye,Tt;$>=64;){for(S=a[0],w=a[1],P=a[2],V=a[3],F=a[4],M=a[5],re=a[6],L=a[7],j=0;j<16;j++)Ke=h+j*4,p[j]=(f[Ke]&255)<<24|(f[Ke+1]&255)<<16|(f[Ke+2]&255)<<8|f[Ke+3]&255;for(j=16;j<64;j++)W=p[j-2],Ye=(W>>>17|W<<15)^(W>>>19|W<<13)^W>>>10,W=p[j-15],Tt=(W>>>7|W<<25)^(W>>>18|W<<14)^W>>>3,p[j]=(Ye+p[j-7]|0)+(Tt+p[j-16]|0);for(j=0;j<64;j++)Ye=(((F>>>6|F<<26)^(F>>>11|F<<21)^(F>>>25|F<<7))+(F&M^~F&re)|0)+(L+(n[j]+p[j]|0)|0)|0,Tt=((S>>>2|S<<30)^(S>>>13|S<<19)^(S>>>22|S<<10))+(S&w^S&P^w&P)|0,L=re,re=M,M=F,F=V+Ye|0,V=P,P=w,w=S,S=Ye+Tt|0;a[0]+=S,a[1]+=w,a[2]+=P,a[3]+=V,a[4]+=F,a[5]+=M,a[6]+=re,a[7]+=L,h+=64,$-=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,$=f/536870912|0,S=f<<3,w=f%64<56?64:128;this.buffer[h]=128;for(var P=h+1;P<w-8;P++)this.buffer[P]=0;this.buffer[w-8]=$>>>24&255,this.buffer[w-7]=$>>>16&255,this.buffer[w-6]=$>>>8&255,this.buffer[w-5]=$>>>0&255,this.buffer[w-4]=S>>>24&255,this.buffer[w-3]=S>>>16&255,this.buffer[w-2]=S>>>8&255,this.buffer[w-1]=S>>>0&255,r(this.temp,this.state,this.buffer,0,w),this.finished=!0}for(var P=0;P<8;P++)a[P*4+0]=this.state[P]>>>24&255,a[P*4+1]=this.state[P]>>>16&255,a[P*4+2]=this.state[P]>>>8&255,a[P*4+3]=this.state[P]>>>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 $=h[0];if($===0)throw new Error("hkdf: cannot expand more");a.reset(),$>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 $=new Uint8Array([1]),S=u(a,p),w=new s(S),P=new Uint8Array(w.digestLength),V=P.length,F=new Uint8Array(h),M=0;M<h;M++)V===P.length&&(c(P,w,f,$),V=0),F[M]=P[V++];return w.clean(),P.fill(0),$.fill(0),F}e.hkdf=_;function y(p,a,f,h){for(var $=new s(p),S=$.digestLength,w=new Uint8Array(4),P=new Uint8Array(S),V=new Uint8Array(S),F=new Uint8Array(h),M=0;M*S<h;M++){var re=M+1;w[0]=re>>>24&255,w[1]=re>>>16&255,w[2]=re>>>8&255,w[3]=re>>>0&255,$.reset(),$.update(a),$.update(w),$.finish(V);for(var L=0;L<S;L++)P[L]=V[L];for(var L=2;L<=f;L++){$.reset(),$.update(V).finish(V);for(var W=0;W<S;W++)P[W]^=V[W]}for(var L=0;L<S&&M*S+L<h;L++)F[M*S+L]=P[L]}for(var M=0;M<S;M++)P[M]=V[M]=0;for(var M=0;M<4;M++)w[M]=0;return $.clean(),F}e.pbkdf2=y})}(It)),It.exports}var to=eo();const no=new Int32Array(4);class Z{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 Z;static _hex(e){const n=Z.hexChars,r=Z.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(Z.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,Z._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,Z._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,Z._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(Z.buffer32Identity.subarray(s),s),n>55&&(Z._md5cycle(this._state,i),i.set(Z.buffer32Identity)),o<=4294967295)i[14]=o;else{const u=o.toString(16).match(/(.*?)(.{0,8})$/);if(u===null)return e?no:"";const c=parseInt(u[2],16),l=parseInt(u[1],16)||0;i[14]=c,i[15]=l}return Z._md5cycle(this._state,i),e?this._state:Z._hex(this._state)}}if(Z.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592")throw new Error("Md5 self test failed.");const ro=36e5,pr=Symbol.for("constructDateFrom");function Nt(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&pr in t?t[pr](e):t instanceof Date?new t.constructor(e):new Date(e)}function et(t,e){return Nt(t,t)}function io(t,e,n){const r=et(t);if(isNaN(e))return Nt(t,NaN);const i=r.getDate(),s=Nt(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 Wr(t,e,n){return Nt(t,+et(t)+e)}function so(t,e,n){return Wr(t,e*ro)}function oo(t,e,n){return Wr(t,e*1e3)}function uo(t,e,n){return io(t,e*12)}function _r(t){return Math.trunc(+et(t)/1e3)}function co(t,e){return+et(t)<+et(e)}function d(t,e,n,r="debug",i){if(window.debug){const o=["color: #0288D1",`color:${i||"#009688"}`,"color: default"];n?En()?console[r](`%c[PlaceOS]%c[${t}] %c${e}`,...o,n):console[r](`[PlaceOS][${t}] ${e}`,n):En()?console[r](`%c[PlaceOS]%c[${t}] %c${e}`,...o):console[r](`[PlaceOS][${t}] ${e}`)}}function En(){return!(document.documentMode||/Edge/.test(navigator.userAgent))}function Fn(){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=Ce(i[0]),e||(e=i[1])}else n=Ce(t);let r={};return e&&(r=Ce(e)),{...n,...r}}function Ce(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 mr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function Br(t=40){let e="";for(let n=0;n<t;n++)e+=mr.charAt(Math.floor(Math.random()*mr.length));return e}function _e(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 tt(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 Qr(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 Vr(t,e){for(const n in t)t.hasOwnProperty(n)&&e.indexOf(t[n])>=0&&delete t[n];return t}function Zr(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Gr(){return window.location!==window.parent.location}function Kr(t=Date.now(),e=60*1e3){return Math.floor(t/e)}class ao{abort(){d("Stub","Aborted")}}function R(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 Ae={},Je={},pe={};function lo(){for(const t in Ae)Ae.hasOwnProperty(t)&&Te(t);for(const t in Je)Je.hasOwnProperty(t)&&ho(t);for(const t in pe)pe.hasOwnProperty(t)&&fo(t)}function oe(t,e,n=300){if(t&&e&&e instanceof Function)Te(t),Ae[t]=setTimeout(()=>{e(),delete Ae[t]},n);else throw new Error(t?"Cannot create named timeout without a name":"Cannot create a timeout without a callback")}function Te(t){Ae[t]&&(clearTimeout(Ae[t]),delete Ae[t])}function ho(t){Je[t]&&(clearInterval(Je[t]),delete Je[t])}function fo(t){pe&&pe[t]&&(pe[t]instanceof Pe?pe[t].unsubscribe():pe[t](),delete pe[t])}const po={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 g={},q=localStorage,H;const k={};let I="",we="";const Le=new ye(""),Vt=new ye("");let Ln="/api/engine/v2";const me=new ye(!1),_o=me.asObservable();let Ft=0;function Yr(t){if(!t||t.startsWith("http://")||t.startsWith("https://"))return t;const e=H?.domain;return e?`${g.secure||window.location?.protocol.indexOf("https")>=0?"https:":"http:"}//${e}${t}`:t}function A(){return`${`${g.secure||window.location?.protocol.indexOf("https")>=0?"https:":"http:"}//${g.host||window.location?.host}`}${jn()}`}function jn(){return g.version==="ACA Engine"?"/control/api":Ln}function mo(){return!!g.token_header}function Jr(){return I}function yo(){return g.redirect_uri}function go(t,e=!0){q.setItem(`${I}_x-api-key`,`${t}`),q.setItem("trusted",`${e}`),Xr("x-api-key",uo(new Date,5).valueOf())}function it(){return Ht("x-api-key",!1)||""}function Xr(t,e=so(new Date,2).valueOf()){g.ignore_api_key&&t==="x-api-key"||(q.setItem(`${I}_expires_at`,`${e}`),q.setItem(`${I}_access_token`,t))}function K(t=!0){if(g.mock)return"mock-token";if(!q)return"";if(it()&&!g.ignore_api_key)return"x-api-key";const e=q.getItem(`${I}_expires_at`)||"",n=Le.getValue();return co(+e,new Date)&&(d("Auth","Token expired. Requesting new token..."),Kt(),k.load_authority||(Ft+=1,oe("re-authorise",async()=>{delete k.authorise,await Wn().catch(r=>d("Auth",`Failed to get token: ${r}`))},200*Math.min(20,Ft))),!t)?"":n||q.getItem(`${I}_access_token`)||""}function Lt(){return Vt.getValue()||q.getItem(`${I}_refresh_token`)||""}function jt(){return g.host||window.location?.host}function ei(){return!!K()}function ti(){return Le.pipe(v(t=>!!ei()))}function nt(){return H}function vo(){return me.getValue()}function Zt(){return!!g.mock}function ni(){return!!g.secure}function bo(){return _o}function Gt(){return Ht("trust")==="true"||Ht("trusted")==="true"}function Hn(){return!!it()&&!g.ignore_api_key||Ht("fixed_device")==="true"}function Ht(t,e=!0){let r=Fn()[t];if(q){const i=`${Jr()}_${t}`;r=r||q.getItem(i)||q.getItem(t)||"",e&&q.setItem(i,`${r}`)}return r}async function So(t){return g=t||g,g.token_header=g.token_header??Gr(),window.AbortController||(window.AbortController=ao),q=g.storage==="session"?sessionStorage:localStorage,I=Z.hashStr(g.redirect_uri,!1),g.delay&&g.delay>0&&await js(Cn(g.delay)),Bn()}function ko(t){q=t==="session"?sessionStorage:localStorage}function $o(){g={},H=void 0,Le.next(""),Vt.next(""),me.next(!1),I="",we="",Ln="/api/engine/v2";for(const t in k)t in k&&delete k[t];lo()}function zn(){return d("Auth","Refreshing authorty."),H=void 0,Bn()}function Kt(){d("Auth","Invalidating tokens."),q.removeItem(`${I}_access_token`),q.removeItem(`${I}_expires_at`),Le.getValue()&&Le.next("")}function Wn(t,e=H){return k.authorise||(k.authorise=new Promise((n,r)=>{if(!e)return delete k.authorise,r("Authority is not loaded");d("Auth","Authorising user...");const i=()=>{if(K(!1))d("Auth","Valid token found."),delete k.authorise,n(K());else{const s=[()=>{d("Auth","Successfully generated token."),n(K()),delete k.authorise},()=>{d("Auth","Failed to generate token."),r("Failed to generate token"),setTimeout(()=>delete k.authorise,200)}];g&&g.auth_type==="password"?(d("Auth","Logging in with credentials."),Mo(g).then(...s),Ft=0):we||Lt()?(d("Auth",`Generating token with ${we?"code":"refresh token"}`),ii().then(...s),Ft=0):e.session?(d("Auth","Users has session. Authorising application..."),xo(t).then(...s)):(d("Auth","No user session"),ri(e),r("No user session"),setTimeout(()=>delete k.authorise,200))}};Po().then(i,i)})),k.authorise}function Ao(){const t=Yr(H?H.logout_url:"/logout");fetch(t,{method:"GET",redirect:"manual",headers:{Authorization:"Bearer "+K()}}).then(e=>{const n=e.headers.get("Location")||t;for(let r=0;r<q.length;r++){const i=q.key(r);i&&i.indexOf(I)>=0&&q.removeItem(i)}window.location?.assign(n)})}function Bn(t=0){return k.load_authority||(k.load_authority=new Promise(e=>{if(me.next(!1),g.mock){H=po,d("Auth","System in mock mode"),me.next(!0),e();return}d("Auth",`Fixed: ${Hn()} | Trusted: ${Gt()}`),d("Auth","Loading authority...");const n=g.secure||window.location?.protocol.indexOf("https")>=0,r=i=>{d("Auth",`Failed to load authority(${i})`),me.next(!1),oe("load_authority",()=>{delete k.load_authority,Bn(t).then(s=>e())},300*Math.min(20,++t))};Nn(`${n?"https:":"http:"}//${jt()}/auth/authority`,{credentials:"same-origin"}).subscribe(async i=>{if(!i.ok)return r(await i.text().catch(o=>o));H=await i.json(),Ln=/[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=()=>{me.next(!0),d("Auth","Application set online."),e()};delete k.load_authority,Wn("").then(s,s)},r)})),k.load_authority}async function xo(t){const e=Oo(t);if(g.use_iframe)return wo(e);window.location?.assign(e)}function wo(t){return k.iframe_auth||(k.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),Te("iframe_auth"),window.removeEventListener("message",i),delete k.iframe_auth,o.token)return e(),Qn({access_token:o.token,...o});we=o.code||"",ii().then(u=>e(u),u=>n(u))}};oe("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 k.iframe_auth,n()},document.body.appendChild(r)})),k.iframe_auth}let yr=!1;function ri(t){if(g.handle_login!==!1&&!yr){d("Auth","Redirecting to login page...");const e=Yr(t.login_url?.replace("{{url}}",encodeURIComponent(window.location?.href)));throw setTimeout(()=>window.location?.assign(e),300),yr=!0,new Error("Redirecting to login page...")}else d("Auth","Login being handled locally.");delete k.authorise}function Po(){return k.check_token||(k.check_token=new Promise(async(t,e)=>{K()?(d("Auth","Valid token found."),t(K())):(d("Auth","No token. Checking URL for auth credentials..."),await To()?t(!0):e()),delete k.check_token})),k.check_token}function To(){return k.check_params||(k.check_params=new Promise(t=>{d("Auth","Checking for auth parameters...");let e=Fn();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&&(we=e.code,_e("code")),e.refresh_token&&(q.setItem(`${I}_refresh_token`,e.refresh_token),_e("refresh_token"));const n=q.getItem(`${I}_nonce`)||"",r=(e.state||"").split(";");_e("state"),_e("token_type");const i=r[0];n===i?(Qn(e),t(!!e.access_token)):t(!1)}else t(!1);oe("check_params_promise",()=>delete k.check_params,50)})),k.check_params}function Oo(t){const e=Ro();t=t?`${e};${t}`:e;const n=g?(g.auth_uri||"").indexOf("?")>=0:!1,r=(g?g.auth_uri:null)||"/auth/oauth/authorize",i=Gt()||g.auth_type==="auth_code"?"code":"token";let s=`${r}${n?"&":"?"}response_type=${encodeURIComponent(i)}&client_id=${encodeURIComponent(I)}&state=${encodeURIComponent(t)}&redirect_uri=${encodeURIComponent(g.redirect_uri)}&scope=${encodeURIComponent(g.scope)}`;if(g.auth_type==="auth_code"){const{challenge:o,verify:u}=Eo();sessionStorage.setItem(`${I}_challenge`,o),s+="&code_challenge_method=S256",s+=`&code_challenge=${u}`}return s}const gr="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split("");function Eo(t=43){const e=new Array(t).fill(0).map(()=>gr[Math.floor(Math.random()*gr.length)]).join(""),n=Ys(Js(e)),r=zr(to.hash(n)).split("=")[0].replace(/\//g,"_").replace(/\+/g,"-");return{challenge:e,verify:r}}function qo(){let e=(g.token_uri||"/auth/token")+`?client_id=${encodeURIComponent(I)}`,n="";if(e+=`&redirect_uri=${encodeURIComponent(g.redirect_uri)}`,Lt()){e+=`&refresh_token=${encodeURIComponent(Lt())}`,e+="&grant_type=refresh_token";const r=e.split("?");e=r[0],n=r[1]}else{e+=`&code=${encodeURIComponent(we)}`,e+="&grant_type=authorization_code";const r=sessionStorage.getItem(`${I}_challenge`);r&&(e+=`&code_verifier=${r}`,sessionStorage.removeItem(`${I}_challenge`)),we=""}return[e,n]}function Io(t){const e=t.token_uri||"/auth/token",n=R({grant_type:"password",client_id:I,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 ii(){return si(...qo())}function Mo(t){return si(Io(t))}function si(t,e=""){return k.generate_tokens||(k.generate_tokens=new Promise((n,r)=>{d("Auth","Generating new token...");const i=s=>{d("Auth","Error generating new tokens.",s),q.removeItem(`${I}_refresh_token`),Vt.next(""),r(),delete k.generate_tokens};Nn(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();Qn(o),n(),delete k.generate_tokens},i)})),k.generate_tokens}function Qn(t){const e=oo(new Date,Math.max(60,parseInt(t.expires_in,10)-300));d("Auth","Tokens generated storing..."),Gt()&&(t.access_token&&(q.setItem(`${I}_access_token`,t.access_token),_e("access_token")),t.refresh_token&&(q.setItem(`${I}_refresh_token`,t.refresh_token),_e("refresh_token"))),t.expires_in&&(q.setItem(`${I}_expires_at`,`${e.valueOf()}`),_e("expires_in")),me.next(!0),Le.next(t.access_token||""),Vt.next(t.refresh_token||"")}function Ro(){const t=Br();return q.setItem(`${I}_nonce`,t),t}const Yt={};let oi=(t,e)=>{const n=new Error(`Mock endpoint not found: ${t} ${e}`);return n.status=404,d("HTTP(M)",`404 ${t}:`,e),Lr(n)};function Uo(t){oi=t}function Do(t,e=Yt){ui(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 ui(t,e,n=Yt){const r=`${t}|${e}`;n[r]&&(delete n[r],d("HTTP(M)",`- ${t} ${e}`))}function Co(t,e,n,r=Yt){const i=No(t,e,r);if(i){const s=Fo(e,i,n);return Lo(i,s)}return oi(t,e)}function No(t,e,n=Yt){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 Fo(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=Ce(s),u=i.split("/"),c={};for(let _=0;_<e.path_structure.length;_++){const y=e.path_structure[_];y&&(c[y]=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 Lo(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]),Fs([n]).pipe(Vs(Math.max(200,s)))}const ci={};function ai(t,e=ci){return e[t]||{}}function C(t,e,n=st){return e||(e={response_type:"json"}),n("GET",t,{response_type:"json",...e})}function G(t,e,n,r=st){return n||(n={response_type:"json"}),r("POST",t,{body:e,response_type:"json",...n})}function Oe(t,e,n,r=st){return n||(n={response_type:"json"}),r("PUT",t,{body:e,response_type:"json",...n})}function je(t,e,n,r=st){return n||(n={response_type:"json"}),r("PATCH",t,{body:e,response_type:"json",...n})}function ge(t,e,n=st){return e||(e={response_type:"void"}),n("DELETE",t,{response_type:"void",...e})}async function jo(t,e,n=ci){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 li=()=>(Kt(),zn().then(()=>Promise.resolve(),()=>new Promise(t=>{setTimeout(()=>{li().then(()=>t())},1e3)})));function st(t,e,n,r=Zt,i=Co,s=jo){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"),ti().pipe(Ws(o=>o),Hr(1),hr(o=>{K()==="x-api-key"?n.headers["X-API-Key"]=it():n.headers.Authorization=`Bearer ${K()}`;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)),Nn(e,u)}),hr(o=>o.ok?s(o,n.response_type):Lr(o)),Ks({count:4,delay:(o,u)=>new N(c=>{if(o.status===511){ri(nt()),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;li().then(()=>{c.next(l),c.complete()}).catch(()=>{c.error(o)})})}))}class z{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,Vr(e,[void 0,null,""])}}class hi extends z{alert_dashboard_id;alert_dashboard_details;authority_id;description;enabled;conditions;severity;alert_type;debounce_period;any_match;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,this.any_match=e.any_match||!1}}class fi extends z{authority_id;description;enabled;constructor(e){super(e),this.authority_id=e.authority_id||"",this.description=e.description||"",this.enabled=e.enabled||!1}}const He="alert_dashboards";function Jt(t){return new fi(t)}function Ho(t={}){return x({query_params:t,fn:Jt,path:He})}function zo(t){return b({id:t,query_params:{},fn:Jt,path:He})}function Wo(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:Jt,path:He})}function Bo(t){return O({form_data:t,query_params:{},fn:Jt,path:He})}function Qo(t){return T({id:t,query_params:{},path:He})}function Vo(t){return x({query_params:{},fn:ut,path:`${He}/${t}/alerts`})}const ot="alerts";function ut(t){return new hi(t)}function Zo(t={}){return x({query_params:t,fn:ut,path:ot})}function Go(t,e={}){return b({id:t,query_params:e,fn:ut,path:ot})}function Ko(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:ut,path:ot})}function Yo(t){return O({form_data:t,query_params:{},fn:ut,path:ot})}function Jo(t){return T({id:t,query_params:{},path:ot})}class di extends z{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 Xo(t){return pi[t]||0}function eu(t){return _i[t]||0}let pi={},_i={},vr="";const Xt=t=>t;function x(t){const{query_params:e,fn:n,path:r,endpoint:i}=t,s=R(e),o=`${i||A()}${r?"/"+r:""}${s?"?"+s:""}`;return C(o).pipe(v(u=>{const c=tu(o,s,r);return{total:c.total||0,next:c.next?()=>x({query_params:c.next,fn:n,endpoint:i,path:r}):null,data:u&&u instanceof Array?u.map(l=>(n||Xt)(l)):u&&!(u instanceof Array)&&u.results?u.results.map(l=>l):[]}}))}function b(t){const{query_params:e,id:n,path:r,fn:i,options:s}=t,o=R(e),u=`${A()}/${r}/${n}${o?"?"+o:""}`;return C(u,s).pipe(v(c=>(i||Xt)(c)))}function O(t){const{query_params:e,form_data:n,path:r,fn:i}=t,s=R(e),o=`${A()}/${r}${s?"?"+s:""}`;return G(o,n).pipe(v(c=>(i||Xt)(c)))}function m(t){const{id:e,task_name:n,form_data:r,method:i,path:s,callback:o}=t,u=R(r),c=`${A()}/${s}/${e}/${n}`;return(i==="post"||i==="put"||!i?(i==="put"?Oe:G)(c,r):(i==="del"?ge:C)(`${c}${u?"?"+u:""}`,{response_type:"json"})).pipe(v(_=>(o||(y=>y))(_)))}function E(t){const{id:e,query_params:n,form_data:r,method:i,path:s,fn:o}=t,u=R({...n,version:r.version||0}),c=`${A()}/${s}/${e}${u?"?"+u:""}`;return(i==="put"?Oe:je)(c,r).pipe(v(l=>(o||Xt)(l)))}function T(t){const{id:e,query_params:n,path:r}=t,i=R(n),s=`${A()}/${r}/${e}${i?"?"+i:""}`;return ge(s)}function tu(t,e,n){const r=ai(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)&&(pi[n]=s),_i[n]=s,i.total=s}return r&&r.link&&(vr=Qr(r.link||"").next,i.next=Ce(vr.split("?")[1])),i}const ct="oauth_apps";function en(t){return new di(t)}function nu(t={}){return x({query_params:t,fn:en,path:ct})}function ru(t){return b({id:t,query_params:{},fn:en,path:ct})}function iu(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:en,path:ct})}function su(t){return O({form_data:t,query_params:{},fn:en,path:ct})}function ou(t){return T({id:t,query_params:{},path:ct})}var mi=(t=>(t[t.Certificate=0]="Certificate",t[t.NoAuth=1]="NoAuth",t[t.UserPassword=2]="UserPassword",t))(mi||{});class yi extends z{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 at="brokers";function tn(t){return new yi(t)}function uu(t={}){return x({query_params:t,fn:tn,path:at})}function cu(t,e={}){return b({id:t,query_params:e,fn:tn,path:at})}function au(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:tn,path:at})}function lu(t){return O({form_data:t,query_params:{},fn:tn,path:at})}function hu(t,e={}){return T({id:t,query_params:e,path:at})}class gi{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=tt(this.memory_usage*1024),this.total_memory=tt(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 vi{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=tt(this.memory_usage*1024),this.total_memory=tt(this.memory_total*1024)}}const ze="cluster";function bi(t){return new gi(t)}function fu(t={}){return x({query_params:t,fn:bi,path:ze})}function du(t,e={}){return b({id:t,query_params:e,fn:bi,path:ze})}function pu(t,e={}){return b({id:t,query_params:e,fn:n=>n.map(r=>new vi(t,r)),path:ze})}function _u(t,e){return T({id:t,query_params:e,path:ze})}function mu(){const t=`${A()}${ze}/rebalance`;return G(t,{}).pipe(v(()=>{}))}function yu(){const t=`${A()}${ze}/versions`;return C(t).pipe(v(e=>e))}class Si extends z{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 We="domains";function nn(t){return new Si(t)}function gu(t={}){return x({query_params:t,fn:nn,path:We})}function vu(t){return b({id:t,query_params:{},fn:nn,path:We})}function bu(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:nn,path:We})}function Su(t){return O({form_data:t,query_params:{},fn:nn,path:We})}function ku(t){return T({id:t,query_params:{},path:We})}function $u(t){const e=`${A()}${We}/lookup/${encodeURIComponent(t)}`;return C(e).pipe(v(n=>`${n}`))}var Ee=(t=>(t[t.None=0]="None",t[t.Support=1]="Support",t[t.Admin=2]="Admin",t[t.NeverDisplay=3]="NeverDisplay",t))(Ee||{});class ve extends z{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||Ee.None,this.keys=e.keys||[],this.modified_by_id=e.modified_by_id||""}}var rt=(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))(rt||{});class Vn extends z{class_name;description;module_name;role;default_uri;default_port;repository_id;file_name;commit;ignore_connected;update_available;update_info;alert_level;settings;constructor(e={}){super(e),this.description=e.description||"",this.module_name=e.module_name||"",this.role=e.role??rt.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.alert_level=e.alert_level||"medium",this.settings=e.settings||[null,null,null,null],typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in Ee)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new ve({parent_id:this.id,encryption_level:+n}))}}const ae="drivers";function rn(t){return new Vn(t)}function Au(t={}){return x({query_params:t,fn:rn,path:ae})}function xu(t,e={}){return b({id:t,query_params:e,fn:rn,path:ae})}function wu(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:rn,path:ae})}function Pu(t){return O({form_data:t,query_params:{},fn:rn,path:ae})}function Tu(t){return T({id:t,query_params:{},path:ae})}function Ou(t){return m({id:t,task_name:"recompile",path:ae})}function Eu(t){return m({id:t,task_name:"reload",path:ae})}function qu(t){return m({id:t,task_name:"compiled",method:"get",path:ae})}function Iu(t){return m({id:t,task_name:"readme",method:"get",path:ae})}class ki extends z{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 qe="edges";function sn(t){return new ki(t)}function Mu(t={}){return x({query_params:t,fn:sn,path:qe})}function Ru(t){return b({id:t,query_params:{},fn:sn,path:qe})}function Uu(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:sn,path:qe})}function Du(t){return O({form_data:t,query_params:{},fn:sn,path:qe})}function Cu(t){return T({id:t,query_params:{},path:qe})}function Nu(t){return m({id:t,task_name:"token",form_data:{},method:"get",path:qe})}function Fu(){const t=A(),e=t.startsWith("https")?"wss:":"ws:",n=t.startsWith("https")?"https:":"http:";return t.replace(n,e)+`${qe}/control`}class $i extends z{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 lt="ldap_auths";function on(t){return new $i(t)}function Lu(t={}){return x({query_params:t,fn:on,path:lt})}function ju(t){return b({id:t,query_params:{},fn:on,path:lt})}function Hu(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:on,path:lt})}function zu(t){return O({form_data:t,query_params:{},fn:on,path:lt})}function Wu(t){return T({id:t,query_params:{},path:lt})}class Zn{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 le extends z{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;any_match;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||"",this.any_match=e.any_match||!1}}class un extends z{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 Ee)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new ve({parent_id:this.id,encryption_level:+n}));e.trigger_data&&e.trigger_data instanceof Array&&(this.trigger_list=e.trigger_data.map(n=>new le(n)))}}class Ai{zone;metadata;keys;constructor(e={}){this.zone=new un(e.zone),this.keys=e.keys||[],this.metadata={};const n=e.metadata||{};for(const r of this.keys)this.metadata[r]=new Zn(n[r])}}const Ie="metadata";function ht(t){return new Zn(t)}function Bu(t,e={}){return b({id:t,query_params:e,fn:n=>Object.keys(n).map(r=>ht(n[r])),path:Ie})}function Qu(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 Vu(t,e={}){return m({id:t,task_name:"history",form_data:e,method:"get",callback:n=>Qu(Object.keys(n).map(r=>n[r].map(i=>ht(i)))),path:Ie})}function Zu(t,e){return b({id:t,query_params:{name:e},fn:n=>ht(n[e]),path:Ie})}function Gu(t,e,n="put"){return E({id:t,form_data:e,query_params:{},method:n,fn:ht,path:Ie})}function Ku(t){return O({form_data:t,query_params:{},fn:ht,path:Ie})}function Yu(t,e){return T({id:t,query_params:e,path:Ie})}function Ju(t,e){return m({id:t,task_name:"children",form_data:e,method:"get",callback:n=>n.map(r=>new Ai({...r,keys:Object.keys(r.metadata)})),path:Ie})}class Gn extends z{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_snapshot_urls;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_snapshot_urls=e.camera_snapshot_urls||[],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 Ee)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new ve({parent_id:this.id,encryption_level:+n}));e.module_data&&e.module_data instanceof Array&&(this.module_list=e.module_data.map(n=>new Kn(n)))}}class Kn extends z{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;alert_level;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??rt.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 Gn(e.control_system||e.system),this.has_runtime_error=e.has_runtime_error||!1,this.error_timestamp=e.error_timestamp||0,this.driver=new Vn(e.dependency||e.driver),this.settings=e.settings||[null,null,null,null],this.alert_level=e.alert_level||"medium",typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in Ee)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new ve({parent_id:this.id,encryption_level:+n}))}toJSON(e=!1){const n=super.toJSON();return(n.role!==rt.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 cn(t){return new Kn(t)}function Xu(t={}){return x({query_params:t,fn:cn,path:Y})}function ec(t,e={}){return b({id:t,query_params:e,fn:cn,path:Y})}function tc(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:cn,path:Y})}function nc(t){return O({form_data:t,query_params:{},fn:cn,path:Y})}function rc(t){return T({id:t,query_params:{},path:Y})}function ic(t){return m({id:t,task_name:"start",path:Y})}function sc(t){return m({id:t,task_name:"stop",path:Y})}function oc(t){return m({id:t,task_name:"state",method:"get",path:Y})}function uc(t,e){return m({id:t,task_name:`state/${e}`,method:"get",path:Y})}function cc(t){return m({id:t,task_name:"load",method:"post",path:Y})}function ac(t){return m({id:t,task_name:"settings",method:"get",callback:e=>e.map(n=>new ve(n)),path:Y})}function lc(t){return m({id:t,task_name:"error",method:"get",path:Y})}function hc(t,e,n=[]){return m({id:t,task_name:`exec/${encodeURIComponent(e)}`,form_data:n,path:Y})}class xi extends z{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 ft="oauth_auths";function an(t){return new xi(t)}function fc(t={}){return x({query_params:t,fn:an,path:ft})}function dc(t){return b({id:t,query_params:{},fn:an,path:ft})}function pc(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:an,path:ft})}function _c(t){return O({form_data:t,query_params:{},fn:an,path:ft})}function mc(t){return T({id:t,query_params:{},path:ft})}var Yn=(t=>(t.Driver="driver",t.Interface="interface",t))(Yn||{});class wi extends z{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||Yn.Driver,this.username=e.username||"",this.password=e.password||"",this.root_path=e.root_path||""}}const Q="repositories";function ln(t){return new wi(t)}function yc(t={}){return x({query_params:t,fn:ln,path:Q})}function gc(t){return b({id:t,query_params:{},fn:ln,path:Q})}function vc(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:ln,path:Q})}function bc(t){return O({form_data:t,query_params:{},fn:ln,path:Q})}function Sc(t){return T({id:t,query_params:{},path:Q})}function kc(){return b({id:"interfaces",query_params:{},path:Q})}function $c(t){return b({id:"remote_default_branch",query_params:t,path:Q})}function Ac(t){return b({id:"remote_branches",query_params:t,path:Q})}function xc(t){return b({id:"remote_commits",query_params:t,path:Q})}function wc(t,e){return m({id:t,task_name:"drivers",form_data:e,method:"get",path:Q})}function Pc(t,e){return m({id:t,task_name:"commits",form_data:e,method:"get",path:Q})}function Tc(t){return m({id:t,task_name:"branches",method:"get",path:Q})}function Oc(t){return m({id:t,task_name:"default_branch",method:"get",path:Q})}function Ec(t,e){return m({id:t,task_name:"details",form_data:e,method:"get",path:Q})}function qc(t,e){return m({id:t,task_name:"pull",form_data:e,method:"post",path:Q})}function Ic(t,e){return m({id:t,task_name:"folders",form_data:e,method:"get",path:Q})}class Pi extends z{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 dt="saml_auths";function hn(t){return new Pi(t)}function Mc(t={}){return x({query_params:t,fn:hn,path:dt})}function Rc(t){return b({id:t,query_params:{},fn:hn,path:dt})}function Uc(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:hn,path:dt})}function Dc(t){return O({form_data:t,query_params:{},fn:hn,path:dt})}function Cc(t){return T({id:t,query_params:{},path:dt})}const Be="settings";function pt(t){return new ve(t)}function Nc(t={}){return x({query_params:t,fn:pt,path:Be})}function Fc(t){return b({id:t,query_params:{},fn:pt,path:Be})}function Lc(t,e,n={},r="patch"){return E({id:t,form_data:e,query_params:n,method:r,fn:pt,path:Be})}function jc(t,e={}){return O({form_data:t,query_params:e,fn:pt,path:Be})}function Hc(t){return T({id:t,query_params:{},path:Be})}function zc(t,e={}){return m({id:t,task_name:"history",form_data:e,method:"get",callback:n=>n.map(r=>pt(r)),path:Be})}const U="systems";function Me(t){return new Gn(t)}function Wc(t={}){return x({query_params:t,fn:Me,path:U})}function Bc(t){return x({query_params:t,fn:Me,path:`${U}/with_emails`})}function Qc(t,e={}){return b({id:t,query_params:e,fn:Me,path:U})}function Vc(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:Me,path:U})}function Zc(t){return O({form_data:t,query_params:{},fn:Me,path:U})}function Gc(t){return T({id:t,query_params:{},path:U})}function Kc(t,e,n={}){return m({id:t,task_name:`module/${e}`,form_data:n,method:"put",callback:r=>Me(r),path:U})}function Yc(t,e){return m({id:t,task_name:`module/${e}`,form_data:{},method:"del",callback:n=>Me(n),path:U})}function Jc(t,e={}){return m({id:t,task_name:"start",form_data:e,path:U})}function Xc(t,e={}){return m({id:t,task_name:"stop",form_data:e,path:U})}function ea(t,e,n,r=1,i=[]){return m({id:t,task_name:`${n}_${r}/${encodeURIComponent(e)}`,form_data:i,path:U})}function ta(t,e,n=1){return m({id:t,task_name:`${e}_${n}`,method:"get",path:U})}function na(t,e,n=1,r){return m({id:t,task_name:`${e}_${n}/${r}`,method:"get",path:U})}function ra(t,e,n=1){return m({id:t,task_name:`functions/${e}_${n}`,method:"get",path:U})}function ia(t){return x({query_params:{},fn:e=>new un(e),path:`${U}/${t}/zones`})}function sa(t,e={}){return x({query_params:e,fn:n=>new le(n),path:`${U}/${t}/triggers`})}function oa(t,e){return m({id:t,task_name:"triggers",form_data:e,method:"post",callback:n=>new le(n),path:U})}function ua(t,e){return m({id:t,task_name:`triggers/${e}`,method:"del",path:U})}function ca(t){return m({id:t,task_name:"settings",method:"get",callback:e=>e.map(n=>new ve(n)),path:U})}function aa(t={}){const e=A(),n=e.startsWith("https")?"wss:":"ws:",r=e.startsWith("https")?"https:":"http:";let i=e.replace(r,n)+`${U}/control`;return t.fixed_device&&(i+=`?fixed_device=${encodeURIComponent(String(t.fixed_device))}`),i}function la(t,e={}){return m({id:t,task_name:"metadata",form_data:e,method:"get",path:U})}function ha(t,e,n={}){return m({id:t,task_name:`triggers/${encodeURIComponent(e)}`,form_data:n,method:"get",callback:r=>new le(r),path:U})}function fa(t,e,n,r="patch"){return m({id:t,task_name:`triggers/${encodeURIComponent(e)}`,form_data:n,method:r,callback:i=>new le(i),path:U})}const Qe="triggers";function fn(t){return new le(t)}function da(t={}){return x({query_params:t,fn,path:Qe})}function pa(t,e={}){return b({id:t,query_params:e,fn,path:Qe})}function _a(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn,path:Qe})}function ma(t){return O({form_data:t,query_params:{},fn,path:Qe})}function ya(t){return T({id:t,query_params:{},path:Qe})}function ga(t){return m({id:t,task_name:"instances",form_data:{},method:"get",callback:e=>e.map(n=>new le(n)),path:Qe})}var Ti=(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))(Ti||{}),Oi=(t=>(t.AT="at",t.CRON="cron",t))(Oi||{}),Ei=(t=>(t[t.ExecuteBefore=0]="ExecuteBefore",t[t.ExecuteAfter=1]="ExecuteAfter",t[t.PayloadOnly=2]="PayloadOnly",t[t.IgnorePayload=3]="IgnorePayload",t))(Ei||{});class qi extends z{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 J="users";function Ve(t){return new qi(t)}function va(t={}){return x({query_params:t,fn:Ve,path:J})}function ba(t,e={}){return b({id:t,query_params:e,fn:Ve,path:J})}function Sa(t={}){return b({id:"current",query_params:t,fn:Ve,path:J})}function ka(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:Ve,path:J})}function $a(t){return O({form_data:t,query_params:{},fn:Ve,path:J})}function Aa(t,e={}){return T({id:t,query_params:e,path:J})}function xa(t){const e=R(t),n=`${A()}${J}/groups${e?"?"+e:""}`;return C(n).pipe(v(r=>r))}function wa(t){const e=R(t),n=`${A()}${J}/metadata/search${e?"?"+e:""}`;return C(n).pipe(v(r=>r))}function Pa(){const t=`${A()}${J}/resource_token`;return G(t,{}).pipe(v(e=>e))}function Ta(t,e={}){return m({id:t,task_name:"metadata",form_data:e,method:"get",path:J})}function Oa(t){const e=`${A()}${J}/${encodeURIComponent(t)}/resource_token`;return ge(e,{response_type:"void"})}function Ea(t){const e=`${A()}${J}/${encodeURIComponent(t)}/resource_token`;return G(e,{}).pipe(v(n=>n))}function qa(t){return m({id:t,task_name:"revive",form_data:{},method:"post",callback:e=>Ve(e),path:J})}const he="zones";function dn(t){return new un(t)}function Ia(t={}){return x({query_params:t,fn:dn,path:he})}function Ma(t={}){return b({id:"tags",query_params:t,fn:e=>e,path:he})}function Ra(t,e={}){return b({id:t,query_params:e,fn:dn,path:he})}function Ua(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:dn,path:he})}function Da(t){return O({form_data:t,query_params:{},fn:dn,path:he})}function Ca(t){return T({id:t,query_params:{},path:he})}function Na(t,e={}){return x({query_params:e,fn:n=>new le(n),path:`${he}/${t}/triggers`})}function Fa(t,e,n,r=1,i=[]){return m({id:t,task_name:`exec/${encodeURIComponent(n+"_"+r)}/${encodeURIComponent(e)}`,form_data:i,path:he})}function La(t,e={}){return m({id:t,task_name:"metadata",form_data:e,method:"get",path:he})}var Jn=(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))(Jn||{});class Ii{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;plugin_id;plugin_params;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||_r(Date.now()),this.updated_at=e.updated_at||_r(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.plugin_id=e.plugin_id||"",this.plugin_params=e.plugin_params||{},this.play_count=e.play_count||0,this.valid_from=e.valid_from,this.valid_until=e.valid_until}}class pn{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 Mi{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||Jn.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||""}}class Ri{id;created_at;updated_at;name;description;uri;playback_type;authority_id;enabled;params;defaults;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.uri=e.uri||"",this.playback_type=e.playback_type||"static",this.authority_id=e.authority_id||"",this.enabled=e.enabled??!0,this.params=e.params||{},this.defaults=e.defaults||{}}}const Ui="signage";function ja(t,e={},n){return b({id:t,query_params:e,fn:r=>r,path:`${Ui}`,options:n})}function Ha(t){return m({id:t,task_name:"metrics",form_data:{},method:"post",callback:e=>e,path:Ui})}const Ze="signage/media";function _n(t){return new Ii(t)}function za(t={}){return x({query_params:t,fn:_n,path:Ze})}function Wa(t,e={}){return b({id:t,query_params:e,fn:_n,path:Ze})}function Ba(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:_n,path:Ze})}function Qa(t){return O({form_data:t,query_params:{},fn:_n,path:Ze})}function Va(t,e={}){return T({id:t,query_params:e,path:Ze})}function Za(t){return`${A()}/${Ze}/${t}/thumbnail`}const fe="signage/playlists";function mn(t){return new Mi(t)}function Ga(t={}){return x({query_params:t,fn:mn,path:fe})}function Ka(t,e={}){return b({id:t,query_params:e,fn:mn,path:fe})}function Ya(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:mn,path:fe})}function Ja(t){return O({form_data:t,query_params:{},fn:mn,path:fe})}function Xa(t,e={}){return T({id:t,query_params:e,path:fe})}function el(t,e={}){return m({id:t,task_name:"media",form_data:e,method:"get",callback:n=>new pn(n),path:fe})}function tl(t,e={}){return m({id:t,task_name:"media/revisions",form_data:e,method:"get",callback:n=>n.map(r=>new pn(r)),path:fe})}function nl(t){return m({id:t,task_name:"media/approve",method:"post",path:fe})}function rl(t,e){return m({id:t,task_name:"media",form_data:e,method:"post",path:fe,callback:n=>new pn(n)})}const _t="signage/plugins";function yn(t){return new Ri(t)}function il(t={}){return x({query_params:t,fn:yn,path:_t})}function sl(t,e={}){return b({id:t,query_params:e,fn:yn,path:_t})}function ol(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:yn,path:_t})}function ul(t){return O({form_data:t,query_params:{},fn:yn,path:_t})}function cl(t,e={}){return T({id:t,query_params:e,path:_t})}class Xn{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 Di="/api/staff/v1/surveys/answers";function al(t={}){const e=R(t);return C(`${Di}${e?"?"+e:""}`).pipe(v(n=>n.map(r=>new Xn(r))))}function ll(t){return G(`${Di}`,t).pipe(v(e=>e.map(n=>new Xn(n))))}class mt{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 yt="/api/staff/v1/surveys/invitations";function hl(t={}){const e=R(t);return C(`${yt}${e?"?"+e:""}`).pipe(v(n=>n.map(r=>new mt(r))))}function fl(t,e={}){const n=R(e);return C(`${yt}/${t}${n?"?"+n:""}`).pipe(v(r=>new mt(r)))}function dl(t,e,n="patch"){return(n==="put"?Oe:je)(`${yt}/${t}`,e).pipe(v(r=>new mt(r)))}function pl(t){return G(`${yt}`,t).pipe(v(e=>new mt(e)))}function _l(t,e={}){const n=R(e);return ge(`${yt}/${t}${n?"?"+n:""}`)}class gt{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 vt="/api/staff/v1/surveys/questions";function ml(t={}){const e=R(t);return C(`${vt}${e?"?"+e:""}`).pipe(v(n=>n.map(r=>new gt(r))))}function yl(t,e={}){const n=R(e);return C(`${vt}/${t}${n?"?"+n:""}`).pipe(v(r=>new gt(r)))}function gl(t){return G(`${vt}`,t).pipe(v(e=>new gt(e)))}function vl(t,e,n="patch"){return(n==="put"?Oe:je)(`${vt}/${t}`,e).pipe(v(r=>new gt(r)))}function bl(t,e={}){const n=R(e);return ge(`${vt}/${t}${n?"?"+n:""}`)}class bt{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 St="/api/staff/v1/surveys";function Sl(t={}){const e=R(t);return C(`${St}${e?"?"+e:""}`).pipe(v(n=>n.map(r=>new bt(r))))}function kl(t,e={}){const n=R(e);return C(`${St}/${t}${n?"?"+n:""}`).pipe(v(r=>new bt(r)))}function $l(t,e,n="patch"){return(n==="put"?Oe:je)(`${St}/${t}`,e).pipe(v(r=>new bt(r)))}function Al(t){return G(`${St}`,t).pipe(v(e=>new bt(e)))}function xl(t,e={}){const n=R(e);return ge(`${St}/${t}${n?"?"+n:""}`)}class Ci{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 Ni{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 Fi{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 Li{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 be="assets";function Re(t){return new Li(t)}function wl(t={}){return x({query_params:t,fn:Re,path:be})}function Pl(t,e={}){return b({id:t,query_params:e,fn:Re,path:be})}function Tl(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:Re,path:be})}function Ol(t){return O({form_data:t,query_params:{},fn:Re,path:be})}function El(t,e={}){return T({id:t,query_params:e,path:be})}function ql(t){return G(`${A()}${be}/bulk`,JSON.stringify(t),{}).pipe(v(e=>e.map(n=>Re(n))))}function Il(t,e="patch"){return(e==="put"?Oe:je)(`${A()}${be}/bulk`,JSON.stringify(t),{}).pipe(v(r=>r.map(i=>Re(i))))}function Ml(t,e={}){const n=R(e);return ge(`${A()}${be}/bulk${n?"?"+n:""}`,{body:JSON.stringify(t)}).pipe(v(r=>r.map(i=>Re(i))))}const kt="asset_types";function gn(t){return new Fi(t)}function Rl(t={}){return x({query_params:t,fn:gn,path:kt})}function Ul(t,e={}){return b({id:t,query_params:e,fn:gn,path:kt})}function Dl(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:gn,path:kt})}function Cl(t){return O({form_data:t,query_params:{},fn:gn,path:kt})}function Nl(t,e={}){return T({id:t,query_params:e,path:kt})}const $t="asset_categories";function vn(t){return new Ci(t)}function Fl(t={}){return x({query_params:t,fn:vn,path:$t})}function Ll(t,e={}){return b({id:t,query_params:e,fn:vn,path:$t})}function jl(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:vn,path:$t})}function Hl(t){return O({form_data:t,query_params:{},fn:vn,path:$t})}function zl(t,e={}){return T({id:t,query_params:e,path:$t})}const At="asset_purchase_orders";function bn(t){return new Ni(t)}function Wl(t={}){return x({query_params:t,fn:bn,path:At})}function Bl(t,e={}){return b({id:t,query_params:e,fn:bn,path:At})}function Ql(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:bn,path:At})}function Vl(t){return O({form_data:t,query_params:{},fn:bn,path:At})}function Zl(t,e={}){return T({id:t,query_params:e,path:At})}class ji{id;name;uri;description;user_id;user_email;user_name;redirect_count;enabled;valid_from;valid_until;authority_id;created_at;updated_at;constructor(e){this.id=e.id||"",this.name=e.name||"",this.uri=e.uri||"",this.description=e.description||"",this.user_id=e.user_id||"",this.user_email=e.user_email||"",this.user_name=e.user_name||"",this.redirect_count=e.redirect_count||0,this.enabled=e.enabled??!0,this.valid_from=e.valid_from||"",this.valid_until=e.valid_until||"",this.authority_id=e.authority_id||"",this.created_at=e.created_at||0,this.updated_at=e.updated_at||0}}const ie="short_url";function Sn(t){return new ji(t)}function Gl(t={}){return x({query_params:t,fn:Sn,path:ie})}function Kl(t,e={}){return b({id:t,query_params:e,fn:Sn,path:ie})}function Yl(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:Sn,path:ie})}function Jl(t){return O({form_data:t,query_params:{},fn:Sn,path:ie})}function Xl(t,e={}){return T({id:t,query_params:e,path:ie})}function eh(t){return`${A()}${ie}/${encodeURIComponent(t)}/redirect`}function th(t){return C(`${A()}${ie}/${encodeURIComponent(t)}/qr_code.svg`,{response_type:"text"})}function nh(t,e={}){const n=R(e);return`${A()}${ie}/${encodeURIComponent(t)}/qr_code.png${n?"?"+n:""}`}function rh(t){const{format:e="svg",...n}=t,r={...n,format:e},i=R(r);return`${A()}${ie}/qr_code${i?"?"+i:""}`}function ih(t){const e={...t,format:"svg"},n=R(e);return C(`${A()}${ie}/qr_code${n?"?"+n:""}`,{response_type:"text"})}class Hi{id;storage_type;bucket_name;region;access_key;access_secret;authority_id;endpoint;is_default;ext_filter;mime_filter;created_at;updated_at;constructor(e){this.id=e.id||"",this.storage_type=e.storage_type||null,this.bucket_name=e.bucket_name||"",this.region=e.region||"",this.access_key=e.access_key||"",this.access_secret=e.access_secret||"",this.authority_id=e.authority_id||"",this.endpoint=e.endpoint||"",this.is_default=e.is_default??!1,this.ext_filter=e.ext_filter||[],this.mime_filter=e.mime_filter||[],this.created_at=e.created_at||0,this.updated_at=e.updated_at||0}}const xt="storages";function kn(t){return new Hi(t)}function sh(t={}){return x({query_params:t,fn:kn,path:xt})}function oh(t,e={}){return b({id:t,query_params:e,fn:kn,path:xt})}function uh(t,e,n="patch"){return E({id:t,form_data:e,query_params:{},method:n,fn:kn,path:xt})}function ch(t){return O({form_data:t,query_params:{},fn:kn,path:xt})}function ah(t,e={}){return T({id:t,query_params:e,path:xt})}const Se="webrtc";function lh(t={}){const e=R(t),n=`${A()}${Se}/rooms${e?"?"+e:""}`;return C(n).pipe(v(r=>r))}function hh(t){const e=`${A()}${Se}/room/${encodeURIComponent(t)}`;return C(e).pipe(v(n=>n))}function fh(t){const e=`${A()}${Se}/members/${encodeURIComponent(t)}`;return C(e).pipe(v(n=>n))}function dh(t,e){const n=`${A()}${Se}/guest_entry/${encodeURIComponent(t)}`;return G(n,e).pipe(v(()=>{}))}function ph(){const t=`${A()}${Se}/guest/exit`;return G(t,{}).pipe(v(()=>{}))}function _h(t,e,n){const r=`${A()}${Se}/kick/${encodeURIComponent(t)}/${encodeURIComponent(e)}`;return G(r,n).pipe(v(()=>{}))}function mh(t,e,n){const r=`${A()}${Se}/transfer/${encodeURIComponent(t)}/${encodeURIComponent(e)}`;return G(r,n||{}).pipe(v(()=>{}))}function yh(){const t=A(),e=t.startsWith("https")?"wss:":"ws:",n=t.startsWith("https")?"https:":"http:";return t.replace(n,e)+`${Se}/signaller`}var gh={url:"",deserializer:function(t){return JSON.parse(t.data)},serializer:function(t){return JSON.stringify(t)}},vh="WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }",bh=function(t){ne(e,t);function e(n,r){var i=t.call(this)||this;if(i._socket=null,n instanceof N)i.destination=r,i.source=n;else{var s=i._config=Xe({},gh);if(i._output=new xe,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 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 xe},e.prototype.multiplex=function(n,r,i){var s=this;return new N(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(y){c.error(y);return}var _=new Pe(function(){n._socket=null,l&&l.readyState===1&&l.close()});l.onopen=function(y){var p=n._socket;if(!p){l.close(),n._resetState();return}var a=n._config.openObserver;a&&a.next(y);var f=n.destination;n.destination=Qt.create(function(h){if(l.readyState===1)try{var $=n._config.serializer;l.send($(h))}catch(S){n.destination.error(S)}},function(h){var $=n._config.closingObserver;$&&$.next(void 0),h&&h.code?l.close(h.code,h.reason):c.error(new TypeError(vh)),n._resetState()},function(){var h=n._config.closingObserver;h&&h.next(void 0),l.close(),n._resetState()}),f&&f instanceof An&&_.add(f.subscribe(n.destination))},l.onerror=function(y){n._resetState(),c.error(y)},l.onclose=function(y){l===n._socket&&n._resetState();var p=n._config.closeObserver;p&&p.next(y),y.wasClean?c.complete():c.error(y)},l.onmessage=function(y){try{var p=n._config.deserializer;c.next(p(y))}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}(On);function Sh(t){return new bh(t)}var te=(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))(te||{}),er=(t=>(t.Info="info",t.Debug="debug",t.Warning="warn",t.Error="error",t.Fatal="fatal",t.Trace="trace",t))(er||{});class zi{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 N)&&!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 ye(n),this[`_${e}_obs`]=this[`_${e}`].asObservable(),Object.defineProperty(this,e,{get:()=>this[`_${e}`].getValue(),set:r=>this[`_${e}`].next(r)})}}class Wi{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 zi(this,n))}}const zt={};function kh(t,e){return zt[t]=new Wi(e),zt[t]}function Bi(t){return zt[t]}function $h(t){delete zt[t]}const Qi=15;let wt=0,X,Vi=0;const B={},tr={},Ue={},Ah={},ke=new ye(!1);Ue._place_os_status=ke.asObservable();const Zi=new ye([0,0]);Ue._place_os_sync=Zi.asObservable();let Gi=Date.now(),Ne,Wt=0,de=null,Mt,nr=0;const Pt=10*1e3,rr=new xe;Ue._place_os_debug_events=rr.asObservable();function Rt(){return A().indexOf("/control/")>=0?"/control/websocket":`${jn()}/systems/control`}function ir(){return ke.getValue()}function Ki(){return Ue._place_os_status}function xh(){return Ue._place_os_sync}function Yi(t,e=tr,n=Ue){const r=`${t.sys}|${t.mod}_${t.index}|${t.name}`;return e[r]||(e[r]=new ye(void 0),n[r]=e[r].asObservable()),n[r]}function Ji(t,e=tr){const n=`${t.sys}|${t.mod}_${t.index}|${t.name}`;if(e[n])return e[n].getValue()}function qn(t,e=0,n=Ge){const r={id:++wt,cmd:"bind",...t};return n(r,e)}function Xi(t,e=0,n=Ge){const r={id:++wt,cmd:"unbind",...t};return n(r,e)}function es(t,e=Pt,n=Ge){const r={id:++wt,cmd:"exec",...t};return n(r,e)}function wh(t,e=Pt,n=Ge){const r={id:++wt,cmd:"debug",...t};return n(r,e)}function Ph(t,e=Pt,n=Ge){const r={id:++wt,cmd:"ignore",...t};return n(r,e)}function Ge(t,e=Pt,n=0){const r=`${t.cmd}|${t.sys}|${t.mod}${t.index}|${t.name}|${t.args}|${Kr()}`;if(B[r])d("WS","Request already in progress. Waiting...",t);else{const i={...t,key:r};i.promise=new Promise((s,o)=>{const u=()=>{delete B[r],B[r]=null,Ge(t,e,n).then(c=>s(c),c=>o(c))};if(X&&ir()){Zt()&&Rh(t,X,Ah),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),X.next(t),e>0&&oe(`${r}`,()=>{o("Request timed out."),delete B[r],B[r]=null},e)}else de?setTimeout(()=>u(),1e3):sr().then(()=>u())}),B[r]=i}return B[r].promise}function ts(t){if(t!=="pong"&&t instanceof Object){if(t.type==="notify"&&t.meta)Eh(t.meta,t.value);else if(t.type==="success")Th(t);else if(t.type==="debug"){d("WS",`[DEBUG] ${t.mod}${t.klass||""} →`,t.msg);const e=t.meta||{mod:"",index:""};rr.next({mod_id:t.mod||"<empty>",module:`${e.mod}_${e.index}`,class_name:t.klass||"<empty>",message:t.msg||"<empty>",level:t.level||er.Debug,time:Math.floor(new Date().getTime()/1e3)})}else t.type==="error"?Oh(t):t.cmd||d("WS","Invalid websocket message",t,"error");Te(`${t.id}`)}else t==="pong"&&(nr=Date.now(),d("WS","Pong!"))}function Th(t){const e=Object.keys(B).map(n=>B[n]).find(n=>n?.id===t.id);d("WS",`[SUCCESS](${t.id})`),e&&e.resolve&&(e.resolve(t.value),delete B[e.key])}function Oh(t){let e="UNEXPECTED FAILURE";switch(t.code){case te.ACCESS_DENIED:e="ACCESS DENIED";break;case te.BAD_REQUEST:e="BAD REQUEST";break;case te.MOD_NOT_FOUND:e="MODULE NOT FOUND";break;case te.SYS_NOT_FOUND:e="SYSTEM NOT FOUND";break;case te.PARSE_ERROR:e="PARSE ERROR";break;case te.REQUEST_FAILED:e="REQUEST FAILED";break;case te.UNKNOWN_CMD:e="UNKNOWN COMMAND";break}d("WS",`[ERROR] ${e}(${t.id}): ${t.msg}`,void 0,"error");const n=Object.keys(B).map(r=>B[r]).filter(r=>r).find(r=>r.id===t.id);n&&n.reject&&(n.reject(t),Te(`${n.key}`),delete B[n.key])}function Eh(t,e,n=tr,r=Ue){const i=`${t.sys}|${t.mod}_${t.index}|${t.name}`;n[i]||(n[i]=new ye(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 sr(t=0){return de==null&&(de=new Promise(e=>{if(t>40)return location.reload();Wt++,Gi=Date.now(),X=Zt()?Mh():qh(),X?(d("WS(Debug)","Authority:",[nt()]),d("WS","Connecting to websocket..."),X.subscribe(n=>{ke.getValue()||(d("WS","Connection established."),e()),ke.next(!0),Wt=0,xn(),ts(n)},n=>{X=void 0,de=null,Sr(),xn(),Ih(n)},()=>{X=void 0,de=null,Sr(),d("WS","Connection closed by browser."),ke.next(!1),Bt()}),Ne&&clearInterval(Ne),nr=Date.now(),br(),Ne=setInterval(()=>br(),Qi*1e3),xn(),Vi+=1,Mt=setTimeout(()=>{d("WS","Unhealthy connection. Reconnecting..."),ke.next(!1),de=null,Bt()},30*1e3)):(X?d("WS",`Waiting on auth(${t}). Retrying in ${1e3*Math.min(10,t+1)}ms...`,[!!K(),!!nt()],"info"):d("WS",`Failed to create websocket(${t}). Retrying in ${1e3*Math.min(10,t+1)}ms...`,void 0,"error"),setTimeout(()=>{de=null,sr(t).then(n=>e(n))},1e3*Math.min(10,++t)))})),de}function qh(){if(!nt()||!K())return null;const t=ni()||location.protocol.indexOf("https")>=0;let e=`ws${t?"s":""}://${jt()}${Rt()}${Hn()?"?fixed_device=true":""}`;const n=K();let r=n==="x-api-key"?`api-key=${it()}`:`bearer_token=${n}`;return!mo()&&!Zr()?(d("WS","Authenticating through cookie..."),r+=`;max-age=120;path=${Rt()};`,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":""}://${jt()}${Rt()}`),Sh({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 Bt(){Zi.next([Vi,Date.now()-Gi]),X&&ir()&&(X.complete(),Ne&&(clearInterval(Ne),Ne=void 0)),d("WS",`Reconnecting in ${Math.min(5e3,Wt*300||1e3)}ms...`),oe("reconnect",()=>sr(),Math.min(5e3,(Wt+1)*300||1e3))}function br(){if(Date.now()-nr>4*Qi*1e3)return Bt();X?.next("ping")}function Ih(t){ke.next(!1),d("WS","Websocket error:",t,void 0,"error"),t.status===401&&Kt(),zn(),Bt()}function xn(){Mt&&(clearTimeout(Mt),Mt=void 0)}function Mh(){const t=new xe;return t.subscribe(e=>ts(e)),t}function Rh(t,e,n){const r=`${t.sys}|${t.mod}_${t.index}|${t.name}`,i=Bi(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],Te(`${r}`));break}oe(`${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 oe(`${t.id}-error`,()=>e.next({id:t.id,type:"error",code:i?te.SYS_NOT_FOUND:te.MOD_NOT_FOUND}),10)}function Sr(){for(const t in B)B[t]&&delete B[t]}class In{constructor(e,n){this._module=e,this.name=n,Ki().pipe(Zs()).subscribe(r=>{r&&(this._stale_bindings||this._pending===1)?(d("VAR","Re-binding to status variable",this.binding()),this.rebind()):r||(Te(`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 Ji(this.binding())}listen(){return Yi(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,qn(this.binding()).then(()=>{this._binding_count++,this._pending=0}).catch(()=>null)),()=>this.unbind()}unbind(){this._binding_count===1&&this._pending===0?(this._pending=2,Xi(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||oe(`rebind:${JSON.stringify(this.binding())}`,async()=>{await qn(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 ns{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 In(this,e)),this._bindings[e]}variable(e){return this._bindings[e]||(this._bindings[e]=new In(this,e)),this._bindings[e]}execute(e,n,r=Pt){return es({sys:this._system.id,mod:this.name,index:this.index,name:e,args:n},r)}}class rs{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 ns(this,`${i}_${this._module_list[i].length+1}`));return this._module_list[i][n-1]}}const wn={};function is(t){return wn[t]||(wn[t]=new rs(t)),wn[t]}function Uh(t,e,n=1){return is(t).module(e,n)}exports.AuthType=mi;exports.EncryptionLevel=Ee;exports.MediaAnimation=Jn;exports.MockPlaceWebsocketModule=zi;exports.MockPlaceWebsocketSystem=Wi;exports.PlaceAlert=hi;exports.PlaceAlertDashboard=fi;exports.PlaceApplication=di;exports.PlaceAsset=Li;exports.PlaceAssetCategory=Ci;exports.PlaceAssetPurchaseOrder=Ni;exports.PlaceAssetType=Fi;exports.PlaceCluster=gi;exports.PlaceDomain=Si;exports.PlaceDriver=Vn;exports.PlaceDriverRole=rt;exports.PlaceEdge=ki;exports.PlaceErrorCodes=te;exports.PlaceLDAPSource=$i;exports.PlaceLogLevel=er;exports.PlaceMQTTBroker=yi;exports.PlaceMetadata=Zn;exports.PlaceModule=Kn;exports.PlaceModuleBinding=ns;exports.PlaceOAuthSource=xi;exports.PlaceProcess=vi;exports.PlaceRepository=wi;exports.PlaceRepositoryType=Yn;exports.PlaceResource=z;exports.PlaceSAMLSource=Pi;exports.PlaceSettings=ve;exports.PlaceShortUrl=ji;exports.PlaceStorage=Hi;exports.PlaceSystem=Gn;exports.PlaceSystemBinding=rs;exports.PlaceTrigger=le;exports.PlaceUser=qi;exports.PlaceVariableBinding=In;exports.PlaceZone=un;exports.PlaceZoneMetadata=Ai;exports.SignageMedia=Ii;exports.SignagePlaylist=Mi;exports.SignagePlaylistMedia=pn;exports.SignagePlugin=Ri;exports.Survey=bt;exports.SurveyAnswer=Xn;exports.SurveyInvitation=mt;exports.SurveyQuestion=gt;exports.TriggerConditionOperator=Ti;exports.TriggerTimeConditionType=Oi;exports.TriggerWebhookType=Ei;exports.addAlert=Yo;exports.addAlertDashboard=Bo;exports.addAnswer=ll;exports.addApplication=su;exports.addAsset=Ol;exports.addAssetCategory=Hl;exports.addAssetPurchaseOrder=Vl;exports.addAssetType=Cl;exports.addAssets=ql;exports.addBroker=lu;exports.addDomain=Su;exports.addDriver=Pu;exports.addEdge=Du;exports.addInvitation=pl;exports.addLDAPSource=zu;exports.addMetadata=Ku;exports.addModule=nc;exports.addOAuthSource=_c;exports.addQuestion=gl;exports.addRepository=bc;exports.addSAMLSource=Dc;exports.addSettings=jc;exports.addShortUrl=Jl;exports.addSignageMedia=Qa;exports.addSignagePlaylist=Ja;exports.addSignagePlugin=ul;exports.addStorage=ch;exports.addSurvey=Al;exports.addSystem=Zc;exports.addSystemModule=Kc;exports.addSystemTrigger=oa;exports.addTrigger=ma;exports.addUser=$a;exports.addZone=Da;exports.apiEndpoint=A;exports.apiKey=it;exports.approveSignagePlaylist=nl;exports.authorise=Wn;exports.authority=nt;exports.bind=qn;exports.cleanObject=Vr;exports.cleanupAuth=$o;exports.clientId=Jr;exports.clusterRebalance=mu;exports.clusterVersions=yu;exports.connectionState=xh;exports.consoleHasColours=En;exports.convertPairStringToMap=Ce;exports.create=O;exports.currentUser=Sa;exports.currentUserResourceToken=Pa;exports.debug=wh;exports.debug_events=rr;exports.del=ge;exports.deregisterMockEndpoint=ui;exports.deregisterSystem=$h;exports.driverReadme=Iu;exports.edgeControlUrl=Fu;exports.execute=es;exports.executeOnModule=hc;exports.executeOnSystem=ea;exports.executeOnZone=Fa;exports.functionList=ra;exports.generateNonce=Br;exports.generateQrCode=ih;exports.get=C;exports.getFragments=Fn;exports.getModule=Uh;exports.getShortUrlQrCodeSvg=th;exports.getSystem=is;exports.hasToken=ei;exports.host=jt;exports.httpRoute=jn;exports.humanReadableByteCount=tt;exports.ignore=Ph;exports.invalidateToken=Kt;exports.isDriverCompiled=qu;exports.isFixedDevice=Hn;exports.isMobileSafari=Zr;exports.isMock=Zt;exports.isNestedFrame=Gr;exports.isOnline=vo;exports.isSecure=ni;exports.isTrusted=Gt;exports.is_connected=ir;exports.lastRequestTotal=eu;exports.listChildMetadata=Ju;exports.listDashboardAlerts=Vo;exports.listInterfaceRepositories=kc;exports.listMetadata=Bu;exports.listMetadataHistory=Vu;exports.listRemoteRepositoryBranches=Ac;exports.listRemoteRepositoryCommits=xc;exports.listRemoteRepositoryDefaultBranch=$c;exports.listRepositoryBranches=Tc;exports.listRepositoryCommits=Pc;exports.listRepositoryDefaultBranch=Oc;exports.listRepositoryDriverDetails=Ec;exports.listRepositoryDrivers=wc;exports.listRepositoryFolders=Ic;exports.listSignagePlaylistMedia=el;exports.listSignagePlaylistMediaRevisions=tl;exports.listSystemTriggers=sa;exports.listSystemZones=ia;exports.listTriggerInstances=ga;exports.listZoneTags=Ma;exports.listZoneTriggers=Na;exports.listen=Yi;exports.listenForToken=ti;exports.loadModule=cc;exports.log=d;exports.logout=Ao;exports.lookupDomainByEmail=$u;exports.lookupModuleState=uc;exports.lookupSystemModuleState=na;exports.mediaThumbnail=Za;exports.mockSystem=Bi;exports.moduleRuntimeError=lc;exports.moduleSettings=ac;exports.moduleState=oc;exports.onlineState=bo;exports.parseLinkHeader=Qr;exports.patch=je;exports.post=G;exports.pullRepositoryChanges=qc;exports.put=Oe;exports.qrCodeUrl=rh;exports.query=x;exports.queryAlertDashboards=Ho;exports.queryAlerts=Zo;exports.queryAnswers=al;exports.queryApplications=nu;exports.queryAssetCategories=Fl;exports.queryAssetPurchaseOrders=Wl;exports.queryAssetTypes=Rl;exports.queryAssets=wl;exports.queryBrokers=uu;exports.queryClusters=fu;exports.queryDomains=gu;exports.queryDrivers=Au;exports.queryEdges=Mu;exports.queryInvitations=hl;exports.queryLDAPSources=Lu;exports.queryModules=Xu;exports.queryOAuthSources=fc;exports.queryProcesses=pu;exports.queryQuestions=ml;exports.queryRepositories=yc;exports.querySAMLSources=Mc;exports.querySettings=Nc;exports.queryShortUrls=Gl;exports.querySignageMedia=za;exports.querySignagePlaylists=Ga;exports.querySignagePlugins=il;exports.queryStorages=sh;exports.querySurveys=Sl;exports.querySystems=Wc;exports.querySystemsWithEmails=Bc;exports.queryTriggers=da;exports.queryUserGroups=xa;exports.queryUsers=va;exports.queryWebrtcRooms=lh;exports.queryZones=Ia;exports.recompileDriver=Ou;exports.redirectUri=yo;exports.refreshAuthority=zn;exports.refreshToken=Lt;exports.registerMockEndpoint=Do;exports.registerSystem=kh;exports.reloadDriver=Eu;exports.remove=T;exports.removeAlert=Jo;exports.removeAlertDashboard=Qo;exports.removeApplication=ou;exports.removeAsset=El;exports.removeAssetCategory=zl;exports.removeAssetPurchaseOrder=Zl;exports.removeAssetType=Nl;exports.removeAssets=Ml;exports.removeBroker=hu;exports.removeDomain=ku;exports.removeDriver=Tu;exports.removeEdge=Cu;exports.removeFragment=_e;exports.removeInvitation=_l;exports.removeLDAPSource=Wu;exports.removeMetadata=Yu;exports.removeModule=rc;exports.removeOAuthSource=mc;exports.removeQuestion=bl;exports.removeRepository=Sc;exports.removeSAMLSource=Cc;exports.removeSettings=Hc;exports.removeShortUrl=Xl;exports.removeSignageMedia=Va;exports.removeSignagePlaylist=Xa;exports.removeSignagePlugin=cl;exports.removeStorage=ah;exports.removeSurvey=xl;exports.removeSystem=Gc;exports.removeSystemModule=Yc;exports.removeSystemTrigger=ua;exports.removeTrigger=ya;exports.removeUser=Aa;exports.removeUserResourceToken=Oa;exports.removeZone=Ca;exports.requestTotal=Xo;exports.responseHeaders=ai;exports.retrieveEdgeToken=Nu;exports.reviveUser=qa;exports.searchUserMetadata=wa;exports.setAPI_Key=go;exports.setMockNotFoundHandler=Uo;exports.setStorage=ko;exports.setToken=Xr;exports.settingsHistory=zc;exports.setup=So;exports.shortUrlQrCodePngUrl=nh;exports.shortUrlRedirectUrl=eh;exports.show=b;exports.showAlert=Go;exports.showAlertDashboard=zo;exports.showApplication=ru;exports.showAsset=Pl;exports.showAssetCategory=Ll;exports.showAssetPurchaseOrder=Bl;exports.showAssetType=Ul;exports.showBroker=cu;exports.showCluster=du;exports.showDomain=vu;exports.showDriver=xu;exports.showEdge=Ru;exports.showInvitation=fl;exports.showLDAPSource=ju;exports.showMetadata=Zu;exports.showModule=ec;exports.showOAuthSource=dc;exports.showQuestion=yl;exports.showRepository=gc;exports.showSAMLSource=Rc;exports.showSettings=Fc;exports.showShortUrl=Kl;exports.showSignage=ja;exports.showSignageMedia=Wa;exports.showSignageMetrics=Ha;exports.showSignagePlaylist=Ka;exports.showSignagePlugin=sl;exports.showStorage=oh;exports.showSurvey=kl;exports.showSystem=Qc;exports.showSystemTrigger=ha;exports.showTrigger=pa;exports.showUser=ba;exports.showWebrtcRoom=hh;exports.showZone=Ra;exports.simplifiedTime=Kr;exports.startModule=ic;exports.startSystem=Jc;exports.status=Ki;exports.stopModule=sc;exports.stopSystem=Xc;exports.systemControlUrl=aa;exports.systemMetadata=la;exports.systemModuleState=ta;exports.systemSettings=ca;exports.terminateProcess=_u;exports.token=K;exports.unbind=Xi;exports.update=E;exports.updateAlert=Ko;exports.updateAlertDashboard=Wo;exports.updateApplication=iu;exports.updateAsset=Tl;exports.updateAssetCategory=jl;exports.updateAssetPurchaseOrder=Ql;exports.updateAssetType=Dl;exports.updateAssets=Il;exports.updateBroker=au;exports.updateDomain=bu;exports.updateDriver=wu;exports.updateEdge=Uu;exports.updateInvitation=dl;exports.updateLDAPSource=Hu;exports.updateMetadata=Gu;exports.updateModule=tc;exports.updateOAuthSource=pc;exports.updateQuestion=vl;exports.updateRepository=vc;exports.updateSAMLSource=Uc;exports.updateSettings=Lc;exports.updateShortUrl=Yl;exports.updateSignageMedia=Ba;exports.updateSignagePlaylist=Ya;exports.updateSignagePlaylistMedia=rl;exports.updateSignagePlugin=ol;exports.updateStorage=uh;exports.updateSurvey=$l;exports.updateSystem=Vc;exports.updateSystemTrigger=fa;exports.updateTrigger=_a;exports.updateUser=ka;exports.updateZone=Ua;exports.userMetadata=Ta;exports.userResourceToken=Ea;exports.value=Ji;exports.webrtcGuestEntry=dh;exports.webrtcGuestExit=ph;exports.webrtcKickUser=_h;exports.webrtcSessionMembers=fh;exports.webrtcSignallerUrl=yh;exports.webrtcTransferUser=mh;exports.websocketRoute=Rt;exports.zoneMetadata=La;
|
|
4
4
|
//# sourceMappingURL=index.cjs.js.map
|