@placeos/ts-client 4.3.0 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(u,_e){typeof exports=="object"&&typeof module<"u"?_e(exports):typeof define=="function"&&define.amd?define(["exports"],_e):(u=typeof globalThis<"u"?globalThis:u||self,_e(u.cloud_uploads={}))})(this,function(u){"use strict";var _e=function(t,e){return _e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(n[r]=i[r])},_e(t,e)};function G(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");_e(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var ze=function(){return ze=Object.assign||function(e){for(var n,i=1,r=arguments.length;i<r;i++){n=arguments[i];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},ze.apply(this,arguments)};function Ir(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]]);return n}function Mr(t,e,n,i){function r(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function c(_){try{f(i.next(_))}catch(y){s(y)}}function a(_){try{f(i.throw(_))}catch(y){s(y)}}function f(_){_.done?o(_.value):r(_.value).then(c,a)}f((i=i.apply(t,e||[])).next())})}function Ln(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=c(0),s.throw=c(1),s.return=c(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(f){return function(_){return a([f,_])}}function a(f){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,f[0]&&(n=0)),n;)try{if(i=1,r&&(o=f[0]&2?r.return:f[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,f[1])).done)return o;switch(r=0,o&&(f=[f[0]&2,o.value]),f[0]){case 0:case 1:o=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,r=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!o||f[1]>o[0]&&f[1]<o[3])){n.label=f[1];break}if(f[0]===6&&n.label<o[1]){n.label=o[1],o=f;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(f);break}o[2]&&n.ops.pop(),n.trys.pop();continue}f=e.call(t,n)}catch(_){f=[6,_],r=0}finally{i=o=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function Ie(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function yt(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var i=n.call(t),r,o=[],s;try{for(;(e===void 0||e-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(c){s={error:c}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(s)throw s.error}}return o}function gt(t,e,n){if(n||arguments.length===2)for(var i=0,r=e.length,o;i<r;i++)(o||!(i in e))&&(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))}function Me(t){return this instanceof Me?(this.v=t,this):new Me(t)}function Rr(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=n.apply(t,e||[]),r,o=[];return r=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",s),r[Symbol.asyncIterator]=function(){return this},r;function s(l){return function(d){return Promise.resolve(d).then(l,y)}}function c(l,d){i[l]&&(r[l]=function(h){return new Promise(function(k,v){o.push([l,h,k,v])>1||a(l,h)})},d&&(r[l]=d(r[l])))}function a(l,d){try{f(i[l](d))}catch(h){m(o[0][3],h)}}function f(l){l.value instanceof Me?Promise.resolve(l.value.v).then(_,y):m(o[0][2],l)}function _(l){a("next",l)}function y(l){a("throw",l)}function m(l,d){l(d),o.shift(),o.length&&a(o[0][0],o[0][1])}}function Dr(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 Ie=="function"?Ie(t):t[Symbol.iterator](),n={},i("next"),i("throw"),i("return"),n[Symbol.asyncIterator]=function(){return this},n);function i(o){n[o]=t[o]&&function(s){return new Promise(function(c,a){s=t[o](s),r(c,a,s.done,s.value)})}}function r(o,s,c,a){Promise.resolve(a).then(function(f){o({value:f,done:c})},s)}}typeof SuppressedError=="function"&&SuppressedError;function M(t){return typeof t=="function"}function xn(t){var e=function(i){Error.call(i),i.stack=new Error().stack},n=t(e);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var on=xn(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
1
+ (function(u,_e){typeof exports=="object"&&typeof module<"u"?_e(exports):typeof define=="function"&&define.amd?define(["exports"],_e):(u=typeof globalThis<"u"?globalThis:u||self,_e(u.cloud_uploads={}))})(this,function(u){"use strict";var _e=function(t,e){return _e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(n[r]=i[r])},_e(t,e)};function G(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");_e(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var Be=function(){return Be=Object.assign||function(e){for(var n,i=1,r=arguments.length;i<r;i++){n=arguments[i];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Be.apply(this,arguments)};function Cr(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]]);return n}function Nr(t,e,n,i){function r(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function c(_){try{h(i.next(_))}catch(y){s(y)}}function a(_){try{h(i.throw(_))}catch(y){s(y)}}function h(_){_.done?o(_.value):r(_.value).then(c,a)}h((i=i.apply(t,e||[])).next())})}function Wn(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=c(0),s.throw=c(1),s.return=c(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(h){return function(_){return a([h,_])}}function a(h){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,h[0]&&(n=0)),n;)try{if(i=1,r&&(o=h[0]&2?r.return:h[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,h[1])).done)return o;switch(r=0,o&&(h=[h[0]&2,o.value]),h[0]){case 0:case 1:o=h;break;case 4:return n.label++,{value:h[1],done:!1};case 5:n.label++,r=h[1],h=[0];continue;case 7:h=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(h[0]===6||h[0]===2)){n=0;continue}if(h[0]===3&&(!o||h[1]>o[0]&&h[1]<o[3])){n.label=h[1];break}if(h[0]===6&&n.label<o[1]){n.label=o[1],o=h;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(h);break}o[2]&&n.ops.pop(),n.trys.pop();continue}h=e.call(t,n)}catch(_){h=[6,_],r=0}finally{i=o=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function Ie(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function bt(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var i=n.call(t),r,o=[],s;try{for(;(e===void 0||e-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(c){s={error:c}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(s)throw s.error}}return o}function St(t,e,n){if(n||arguments.length===2)for(var i=0,r=e.length,o;i<r;i++)(o||!(i in e))&&(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))}function Me(t){return this instanceof Me?(this.v=t,this):new Me(t)}function Fr(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=n.apply(t,e||[]),r,o=[];return r=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",s),r[Symbol.asyncIterator]=function(){return this},r;function s(l){return function(d){return Promise.resolve(d).then(l,y)}}function c(l,d){i[l]&&(r[l]=function(f){return new Promise(function(k,v){o.push([l,f,k,v])>1||a(l,f)})},d&&(r[l]=d(r[l])))}function a(l,d){try{h(i[l](d))}catch(f){m(o[0][3],f)}}function h(l){l.value instanceof Me?Promise.resolve(l.value.v).then(_,y):m(o[0][2],l)}function _(l){a("next",l)}function y(l){a("throw",l)}function m(l,d){l(d),o.shift(),o.length&&a(o[0][0],o[0][1])}}function jr(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 Ie=="function"?Ie(t):t[Symbol.iterator](),n={},i("next"),i("throw"),i("return"),n[Symbol.asyncIterator]=function(){return this},n);function i(o){n[o]=t[o]&&function(s){return new Promise(function(c,a){s=t[o](s),r(c,a,s.done,s.value)})}}function r(o,s,c,a){Promise.resolve(a).then(function(h){o({value:h,done:c})},s)}}typeof SuppressedError=="function"&&SuppressedError;function q(t){return typeof t=="function"}function xn(t){var e=function(i){Error.call(i),i.stack=new Error().stack},n=t(e);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var an=xn(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
2
2
  `+n.map(function(i,r){return r+1+") "+i.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=n}});function vt(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var ye=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,i,r,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var c=Ie(s),a=c.next();!a.done;a=c.next()){var f=a.value;f.remove(this)}}catch(h){e={error:h}}finally{try{a&&!a.done&&(n=c.return)&&n.call(c)}finally{if(e)throw e.error}}else s.remove(this);var _=this.initialTeardown;if(M(_))try{_()}catch(h){o=h instanceof on?h.errors:[h]}var y=this._finalizers;if(y){this._finalizers=null;try{for(var m=Ie(y),l=m.next();!l.done;l=m.next()){var d=l.value;try{Bn(d)}catch(h){o=o??[],h instanceof on?o=gt(gt([],yt(o)),yt(h.errors)):o.push(h)}}}catch(h){i={error:h}}finally{try{l&&!l.done&&(r=m.return)&&r.call(m)}finally{if(i)throw i.error}}}if(o)throw new on(o)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)Bn(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)&&vt(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&vt(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),zn=ye.EMPTY;function Hn(t){return t instanceof ye||t&&"closed"in t&&M(t.remove)&&M(t.add)&&M(t.unsubscribe)}function Bn(t){M(t)?t():t.unsubscribe()}var qr={Promise:void 0},Ur={setTimeout:function(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return setTimeout.apply(void 0,gt([t,e],yt(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function Wn(t){Ur.setTimeout(function(){throw t})}function Qn(){}function bt(t){t()}var St=function(t){G(e,t);function e(n){var i=t.call(this)||this;return i.isStopped=!1,n?(i.destination=n,Hn(n)&&n.add(i)):i.destination=Fr,i}return e.create=function(n,i,r){return new sn(n,i,r)},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}(ye),Cr=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(i){kt(i)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(i){kt(i)}else kt(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){kt(n)}},t}(),sn=function(t){G(e,t);function e(n,i,r){var o=t.call(this)||this,s;return M(n)||!n?s={next:n??void 0,error:i??void 0,complete:r??void 0}:s=n,o.destination=new Cr(s),o}return e}(St);function kt(t){Wn(t)}function Nr(t){throw t}var Fr={closed:!0,next:Qn,error:Nr,complete:Qn},un=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function cn(t){return t}function jr(t){return t.length===0?cn:t.length===1?t[0]:function(n){return t.reduce(function(i,r){return r(i)},n)}}var D=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(e,n,i){var r=this,o=xr(e)?e:new sn(e,n,i);return bt(function(){var s=r,c=s.operator,a=s.source;o.add(c?c.call(o,a):a?r._subscribe(o):r._trySubscribe(o))}),o},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},t.prototype.forEach=function(e,n){var i=this;return n=Zn(n),new n(function(r,o){var s=new sn({next:function(c){try{e(c)}catch(a){o(a),s.unsubscribe()}},error:o,complete:r});i.subscribe(s)})},t.prototype._subscribe=function(e){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(e)},t.prototype[un]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return jr(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=Zn(e),new e(function(i,r){var o;n.subscribe(function(s){return o=s},function(s){return r(s)},function(){return i(o)})})},t.create=function(e){return new t(e)},t}();function Zn(t){var e;return(e=t??qr.Promise)!==null&&e!==void 0?e:Promise}function Lr(t){return t&&M(t.next)&&M(t.error)&&M(t.complete)}function xr(t){return t&&t instanceof St||Lr(t)&&Hn(t)}function zr(t){return M(t?.lift)}function ne(t){return function(e){if(zr(e))return e.lift(function(n){try{return t(n,this)}catch(i){this.error(i)}});throw new TypeError("Unable to lift unknown Observable type")}}function K(t,e,n,i,r){return new Hr(t,e,n,i,r)}var Hr=function(t){G(e,t);function e(n,i,r,o,s,c){var a=t.call(this,n)||this;return a.onFinalize=s,a.shouldUnsubscribe=c,a._next=i?function(f){try{i(f)}catch(_){n.error(_)}}:t.prototype._next,a._error=o?function(f){try{o(f)}catch(_){n.error(_)}finally{this.unsubscribe()}}:t.prototype._error,a._complete=r?function(){try{r()}catch(f){n.error(f)}finally{this.unsubscribe()}}:t.prototype._complete,a}return e.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var i=this.closed;t.prototype.unsubscribe.call(this),!i&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},e}(St),Br=xn(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),ge=function(t){G(e,t);function e(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return e.prototype.lift=function(n){var i=new an(this,this);return i.operator=n,i},e.prototype._throwIfClosed=function(){if(this.closed)throw new Br},e.prototype.next=function(n){var i=this;bt(function(){var r,o;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var s=Ie(i.currentObservers),c=s.next();!c.done;c=s.next()){var a=c.value;a.next(n)}}catch(f){r={error:f}}finally{try{c&&!c.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}})},e.prototype.error=function(n){var i=this;bt(function(){if(i._throwIfClosed(),!i.isStopped){i.hasError=i.isStopped=!0,i.thrownError=n;for(var r=i.observers;r.length;)r.shift().error(n)}})},e.prototype.complete=function(){var n=this;bt(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var i=n.observers;i.length;)i.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 i=this,r=this,o=r.hasError,s=r.isStopped,c=r.observers;return o||s?zn:(this.currentObservers=null,c.push(n),new ye(function(){i.currentObservers=null,vt(c,n)}))},e.prototype._checkFinalizedStatuses=function(n){var i=this,r=i.hasError,o=i.thrownError,s=i.isStopped;r?n.error(o):s&&n.complete()},e.prototype.asObservable=function(){var n=new D;return n.source=this,n},e.create=function(n,i){return new an(n,i)},e}(D),an=function(t){G(e,t);function e(n,i){var r=t.call(this)||this;return r.destination=n,r.source=i,r}return e.prototype.next=function(n){var i,r;(r=(i=this.destination)===null||i===void 0?void 0:i.next)===null||r===void 0||r.call(i,n)},e.prototype.error=function(n){var i,r;(r=(i=this.destination)===null||i===void 0?void 0:i.error)===null||r===void 0||r.call(i,n)},e.prototype.complete=function(){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||i===void 0||i.call(n)},e.prototype._subscribe=function(n){var i,r;return(r=(i=this.source)===null||i===void 0?void 0:i.subscribe(n))!==null&&r!==void 0?r:zn},e}(ge),ue=function(t){G(e,t);function e(n){var i=t.call(this)||this;return i._value=n,i}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(n){var i=t.prototype._subscribe.call(this,n);return!i.closed&&n.next(this._value),i},e.prototype.getValue=function(){var n=this,i=n.hasError,r=n.thrownError,o=n._value;if(i)throw r;return this._throwIfClosed(),o},e.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},e}(ge),ln={now:function(){return(ln.delegate||Date).now()},delegate:void 0},fn=function(t){G(e,t);function e(n,i,r){n===void 0&&(n=1/0),i===void 0&&(i=1/0),r===void 0&&(r=ln);var o=t.call(this)||this;return o._bufferSize=n,o._windowTime=i,o._timestampProvider=r,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=i===1/0,o._bufferSize=Math.max(1,n),o._windowTime=Math.max(1,i),o}return e.prototype.next=function(n){var i=this,r=i.isStopped,o=i._buffer,s=i._infiniteTimeWindow,c=i._timestampProvider,a=i._windowTime;r||(o.push(n),!s&&o.push(c.now()+a)),this._trimBuffer(),t.prototype.next.call(this,n)},e.prototype._subscribe=function(n){this._throwIfClosed(),this._trimBuffer();for(var i=this._innerSubscribe(n),r=this,o=r._infiniteTimeWindow,s=r._buffer,c=s.slice(),a=0;a<c.length&&!n.closed;a+=o?1:2)n.next(c[a]);return this._checkFinalizedStatuses(n),i},e.prototype._trimBuffer=function(){var n=this,i=n._bufferSize,r=n._timestampProvider,o=n._buffer,s=n._infiniteTimeWindow,c=(s?1:2)*i;if(i<1/0&&c<o.length&&o.splice(0,o.length-c),!s){for(var a=r.now(),f=0,_=1;_<o.length&&o[_]<=a;_+=2)f=_;f&&o.splice(0,f+1)}},e}(ge),Wr=function(t){G(e,t);function e(n,i){return t.call(this)||this}return e.prototype.schedule=function(n,i){return this},e}(ye),Vn={setInterval:function(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return setInterval.apply(void 0,gt([t,e],yt(n)))},clearInterval:function(t){return clearInterval(t)},delegate:void 0},Qr=function(t){G(e,t);function e(n,i){var r=t.call(this,n,i)||this;return r.scheduler=n,r.work=i,r.pending=!1,r}return e.prototype.schedule=function(n,i){var r;if(i===void 0&&(i=0),this.closed)return this;this.state=n;var o=this.id,s=this.scheduler;return o!=null&&(this.id=this.recycleAsyncId(s,o,i)),this.pending=!0,this.delay=i,this.id=(r=this.id)!==null&&r!==void 0?r:this.requestAsyncId(s,this.id,i),this},e.prototype.requestAsyncId=function(n,i,r){return r===void 0&&(r=0),Vn.setInterval(n.flush.bind(n,this),r)},e.prototype.recycleAsyncId=function(n,i,r){if(r===void 0&&(r=0),r!=null&&this.delay===r&&this.pending===!1)return i;i!=null&&Vn.clearInterval(i)},e.prototype.execute=function(n,i){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(n,i);if(r)return r;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(n,i){var r=!1,o;try{this.work(n)}catch(s){r=!0,o=s||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),o},e.prototype.unsubscribe=function(){if(!this.closed){var n=this,i=n.id,r=n.scheduler,o=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,vt(o,this),i!=null&&(this.id=this.recycleAsyncId(r,i,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(Wr),Kn=function(){function t(e,n){n===void 0&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(e,n,i){return n===void 0&&(n=0),new this.schedulerActionCtor(this,e).schedule(i,n)},t.now=ln.now,t}(),Zr=function(t){G(e,t);function e(n,i){i===void 0&&(i=Kn.now);var r=t.call(this,n,i)||this;return r.actions=[],r._active=!1,r}return e.prototype.flush=function(n){var i=this.actions;if(this._active){i.push(n);return}var r;this._active=!0;do if(r=n.execute(n.state,n.delay))break;while(n=i.shift());if(this._active=!1,r){for(;n=i.shift();)n.unsubscribe();throw r}},e}(Kn),Yn=new Zr(Qr),Vr=Yn,Kr=new D(function(t){return t.complete()});function Yr(t){return t&&M(t.schedule)}var Jn=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function Gn(t){return M(t?.then)}function Xn(t){return M(t[un])}function ei(t){return Symbol.asyncIterator&&M(t?.[Symbol.asyncIterator])}function ti(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 Jr(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var ni=Jr();function ii(t){return M(t?.[ni])}function ri(t){return Rr(this,arguments,function(){var n,i,r,o;return Ln(this,function(s){switch(s.label){case 0:n=t.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Me(n.read())];case 3:return i=s.sent(),r=i.value,o=i.done,o?[4,Me(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Me(r)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function oi(t){return M(t?.getReader)}function ie(t){if(t instanceof D)return t;if(t!=null){if(Xn(t))return Gr(t);if(Jn(t))return Xr(t);if(Gn(t))return eo(t);if(ei(t))return si(t);if(ii(t))return to(t);if(oi(t))return no(t)}throw ti(t)}function Gr(t){return new D(function(e){var n=t[un]();if(M(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Xr(t){return new D(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function eo(t){return new D(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,Wn)})}function to(t){return new D(function(e){var n,i;try{for(var r=Ie(t),o=r.next();!o.done;o=r.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(c){n={error:c}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}e.complete()})}function si(t){return new D(function(e){io(t,e).catch(function(n){return e.error(n)})})}function no(t){return si(ri(t))}function io(t,e){var n,i,r,o;return Mr(this,void 0,void 0,function(){var s,c;return Ln(this,function(a){switch(a.label){case 0:a.trys.push([0,5,6,11]),n=Dr(t),a.label=1;case 1:return[4,n.next()];case 2:if(i=a.sent(),!!i.done)return[3,4];if(s=i.value,e.next(s),e.closed)return[2];a.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return c=a.sent(),r={error:c},[3,11];case 6:return a.trys.push([6,,9,10]),i&&!i.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:a.sent(),a.label=8;case 8:return[3,10];case 9:if(r)throw r.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function ve(t,e,n,i,r){i===void 0&&(i=0),r===void 0&&(r=!1);var o=e.schedule(function(){n(),r?t.add(this.schedule(null,i)):this.unsubscribe()},i);if(t.add(o),!r)return o}function ui(t,e){return e===void 0&&(e=0),ne(function(n,i){n.subscribe(K(i,function(r){return ve(i,t,function(){return i.next(r)},e)},function(){return ve(i,t,function(){return i.complete()},e)},function(r){return ve(i,t,function(){return i.error(r)},e)}))})}function ci(t,e){return e===void 0&&(e=0),ne(function(n,i){i.add(t.schedule(function(){return n.subscribe(i)},e))})}function ro(t,e){return ie(t).pipe(ci(e),ui(e))}function oo(t,e){return ie(t).pipe(ci(e),ui(e))}function so(t,e){return new D(function(n){var i=0;return e.schedule(function(){i===t.length?n.complete():(n.next(t[i++]),n.closed||this.schedule())})})}function uo(t,e){return new D(function(n){var i;return ve(n,e,function(){i=t[ni](),ve(n,e,function(){var r,o,s;try{r=i.next(),o=r.value,s=r.done}catch(c){n.error(c);return}s?n.complete():n.next(o)},0,!0)}),function(){return M(i?.return)&&i.return()}})}function ai(t,e){if(!t)throw new Error("Iterable cannot be null");return new D(function(n){ve(n,e,function(){var i=t[Symbol.asyncIterator]();ve(n,e,function(){i.next().then(function(r){r.done?n.complete():n.next(r.value)})},0,!0)})})}function co(t,e){return ai(ri(t),e)}function ao(t,e){if(t!=null){if(Xn(t))return ro(t,e);if(Jn(t))return so(t,e);if(Gn(t))return oo(t,e);if(ei(t))return ai(t,e);if(ii(t))return uo(t,e);if(oi(t))return co(t,e)}throw ti(t)}function lo(t,e){return e?ao(t,e):ie(t)}function li(t,e){var n=M(t)?t:function(){return t},i=function(r){return r.error(n())};return new D(i)}function fo(t){return t instanceof Date&&!isNaN(t)}function I(t,e){return ne(function(n,i){var r=0;n.subscribe(K(i,function(o){i.next(t.call(e,o,r++))}))})}function ho(t,e,n,i,r,o,s,c){var a=[],f=0,_=0,y=!1,m=function(){y&&!a.length&&!f&&e.complete()},l=function(h){return f<i?d(h):a.push(h)},d=function(h){f++;var k=!1;ie(n(h,_++)).subscribe(K(e,function(v){e.next(v)},function(){k=!0},void 0,function(){if(k)try{f--;for(var v=function(){var $=a.shift();s||d($)};a.length&&f<i;)v();m()}catch($){e.error($)}}))};return t.subscribe(K(e,l,function(){y=!0,m()})),function(){}}function fi(t,e,n){return n===void 0&&(n=1/0),M(e)?fi(function(i,r){return I(function(o,s){return e(i,o,r,s)})(ie(t(i,r)))},n):(typeof e=="number"&&(n=e),ne(function(i,r){return ho(i,r,t,n)}))}function hi(t,e,n){t===void 0&&(t=0),n===void 0&&(n=Vr);var i=-1;return e!=null&&(Yr(e)?n=e:i=e),new D(function(r){var o=fo(t)?+t-n.now():t;o<0&&(o=0);var s=0;return n.schedule(function(){r.closed||(r.next(s++),0<=i?this.schedule(void 0,i):r.complete())},o)})}function po(t,e){return ne(function(n,i){var r=0;n.subscribe(K(i,function(o){return t.call(e,o,r++)&&i.next(o)}))})}function di(t){return t<=0?function(){return Kr}:ne(function(e,n){var i=0;e.subscribe(K(n,function(r){++i<=t&&(n.next(r),t<=i&&n.complete())}))})}function mo(t){return I(function(){return t})}function _o(t,e){return fi(function(n,i){return ie(t(n,i)).pipe(di(1),mo(n))})}function yo(t,e){e===void 0&&(e=Yn);var n=hi(t,e);return _o(function(){return n})}function go(t,e){return e===void 0&&(e=cn),t=t??vo,ne(function(n,i){var r,o=!0;n.subscribe(K(i,function(s){var c=e(s);(o||!t(r,c))&&(o=!1,r=c,i.next(s))}))})}function vo(t,e){return t===e}function bo(t){t===void 0&&(t=1/0);var e;t&&typeof t=="object"?e=t:e={count:t};var n=e.count,i=n===void 0?1/0:n,r=e.delay,o=e.resetOnSuccess,s=o===void 0?!1:o;return i<=0?cn:ne(function(c,a){var f=0,_,y=function(){var m=!1;_=c.subscribe(K(a,function(l){s&&(f=0),a.next(l)},void 0,function(l){if(f++<i){var d=function(){_?(_.unsubscribe(),_=null,y()):m=!0};if(r!=null){var h=typeof r=="number"?hi(r):ie(r(l,f)),k=K(a,function(){k.unsubscribe(),d()},function(){a.complete()});h.subscribe(k)}else d()}else a.error(l)})),m&&(_.unsubscribe(),_=null,y())};y()})}function pi(t,e){return ne(function(n,i){var r=null,o=0,s=!1,c=function(){return s&&!r&&i.complete()};n.subscribe(K(i,function(a){r?.unsubscribe();var f=0,_=o++;ie(t(a,_)).subscribe(r=K(i,function(y){return i.next(e?e(a,y,_,f++):y)},function(){r=null,c()}))},function(){s=!0,c()}))})}function hn(t,e){e===void 0&&(e={});var n=e.selector,i=Ir(e,["selector"]);return new D(function(r){var o=new AbortController,s=o.signal,c=!0,a=i.signal;if(a)if(a.aborted)o.abort();else{var f=function(){s.aborted||o.abort()};a.addEventListener("abort",f),r.add(function(){return a.removeEventListener("abort",f)})}var _=ze(ze({},i),{signal:s}),y=function(m){c=!1,r.error(m)};return fetch(t,_).then(function(m){n?ie(n(m)).subscribe(K(r,void 0,function(){c=!1,r.complete()},y)):(c=!1,r.next(m),r.complete())}).catch(y),function(){c&&o.abort()}})}const re=["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","+","/"],mi=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];function $t(t){if(t>=mi.length)throw new Error("Unable to parse base64 string.");const e=mi[t];if(e===255)throw new Error("Unable to parse base64 string.");return e}function _i(t){let e="",n,i=t.length;for(n=2;n<i;n+=3)e+=re[t[n-2]>>2],e+=re[(t[n-2]&3)<<4|t[n-1]>>4],e+=re[(t[n-1]&15)<<2|t[n]>>6],e+=re[t[n]&63];return n===i+1&&(e+=re[t[n-2]>>2],e+=re[(t[n-2]&3)<<4],e+="=="),n===i&&(e+=re[t[n-2]>>2],e+=re[(t[n-2]&3)<<4|t[n-1]>>4],e+=re[(t[n-1]&15)<<2],e+="="),e}function So(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,i=t.length,r=new Uint8Array(3*(i/4)),o;for(let s=0,c=0;s<i;s+=4,c+=3)o=$t(t.charCodeAt(s))<<18|$t(t.charCodeAt(s+1))<<12|$t(t.charCodeAt(s+2))<<6|$t(t.charCodeAt(s+3)),r[c]=o>>16,r[c+1]=o>>8&255,r[c+2]=o&255;return r.subarray(0,r.length-n)}function ko(t,e=new TextEncoder){return _i(e.encode(t))}var At={exports:{}},$o=At.exports,yi;function Ao(){return yi||(yi=1,function(t){(function(e,n){var i={};n(i);var r=i.default;for(var o in i)r[o]=i[o];t.exports=r})($o,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 i(m,l,d,h,k){for(var v,$,A,Z,N,E,te,F,z,j,mt,_t,rn;k>=64;){for(v=l[0],$=l[1],A=l[2],Z=l[3],N=l[4],E=l[5],te=l[6],F=l[7],j=0;j<16;j++)mt=h+j*4,m[j]=(d[mt]&255)<<24|(d[mt+1]&255)<<16|(d[mt+2]&255)<<8|d[mt+3]&255;for(j=16;j<64;j++)z=m[j-2],_t=(z>>>17|z<<15)^(z>>>19|z<<13)^z>>>10,z=m[j-15],rn=(z>>>7|z<<25)^(z>>>18|z<<14)^z>>>3,m[j]=(_t+m[j-7]|0)+(rn+m[j-16]|0);for(j=0;j<64;j++)_t=(((N>>>6|N<<26)^(N>>>11|N<<21)^(N>>>25|N<<7))+(N&E^~N&te)|0)+(F+(n[j]+m[j]|0)|0)|0,rn=((v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10))+(v&$^v&A^$&A)|0,F=te,te=E,E=N,N=Z+_t|0,Z=A,A=$,$=v,v=_t+rn|0;l[0]+=v,l[1]+=$,l[2]+=A,l[3]+=Z,l[4]+=N,l[5]+=E,l[6]+=te,l[7]+=F,h+=64,k-=64}return h}var r=function(){function m(){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 m.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},m.prototype.clean=function(){for(var l=0;l<this.buffer.length;l++)this.buffer[l]=0;for(var l=0;l<this.temp.length;l++)this.temp[l]=0;this.reset()},m.prototype.update=function(l,d){if(d===void 0&&(d=l.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var h=0;if(this.bytesHashed+=d,this.bufferLength>0){for(;this.bufferLength<64&&d>0;)this.buffer[this.bufferLength++]=l[h++],d--;this.bufferLength===64&&(i(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(d>=64&&(h=i(this.temp,this.state,l,h,d),d%=64);d>0;)this.buffer[this.bufferLength++]=l[h++],d--;return this},m.prototype.finish=function(l){if(!this.finished){var d=this.bytesHashed,h=this.bufferLength,k=d/536870912|0,v=d<<3,$=d%64<56?64:128;this.buffer[h]=128;for(var A=h+1;A<$-8;A++)this.buffer[A]=0;this.buffer[$-8]=k>>>24&255,this.buffer[$-7]=k>>>16&255,this.buffer[$-6]=k>>>8&255,this.buffer[$-5]=k>>>0&255,this.buffer[$-4]=v>>>24&255,this.buffer[$-3]=v>>>16&255,this.buffer[$-2]=v>>>8&255,this.buffer[$-1]=v>>>0&255,i(this.temp,this.state,this.buffer,0,$),this.finished=!0}for(var A=0;A<8;A++)l[A*4+0]=this.state[A]>>>24&255,l[A*4+1]=this.state[A]>>>16&255,l[A*4+2]=this.state[A]>>>8&255,l[A*4+3]=this.state[A]>>>0&255;return this},m.prototype.digest=function(){var l=new Uint8Array(this.digestLength);return this.finish(l),l},m.prototype._saveState=function(l){for(var d=0;d<this.state.length;d++)l[d]=this.state[d]},m.prototype._restoreState=function(l,d){for(var h=0;h<this.state.length;h++)this.state[h]=l[h];this.bytesHashed=d,this.finished=!1,this.bufferLength=0},m}();e.Hash=r;var o=function(){function m(l){this.inner=new r,this.outer=new r,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var d=new Uint8Array(this.blockSize);if(l.length>this.blockSize)new r().update(l).finish(d).clean();else for(var h=0;h<l.length;h++)d[h]=l[h];for(var h=0;h<d.length;h++)d[h]^=54;this.inner.update(d);for(var h=0;h<d.length;h++)d[h]^=106;this.outer.update(d),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<d.length;h++)d[h]=0}return m.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},m.prototype.clean=function(){for(var l=0;l<this.istate.length;l++)this.ostate[l]=this.istate[l]=0;this.inner.clean(),this.outer.clean()},m.prototype.update=function(l){return this.inner.update(l),this},m.prototype.finish=function(l){return this.outer.finished?this.outer.finish(l):(this.inner.finish(l),this.outer.update(l,this.digestLength).finish(l)),this},m.prototype.digest=function(){var l=new Uint8Array(this.digestLength);return this.finish(l),l},m}();e.HMAC=o;function s(m){var l=new r().update(m),d=l.digest();return l.clean(),d}e.hash=s,e.default=s;function c(m,l){var d=new o(m).update(l),h=d.digest();return d.clean(),h}e.hmac=c;function a(m,l,d,h){var k=h[0];if(k===0)throw new Error("hkdf: cannot expand more");l.reset(),k>1&&l.update(m),d&&l.update(d),l.update(h),l.finish(m),h[0]++}var f=new Uint8Array(e.digestLength);function _(m,l,d,h){l===void 0&&(l=f),h===void 0&&(h=32);for(var k=new Uint8Array([1]),v=c(l,m),$=new o(v),A=new Uint8Array($.digestLength),Z=A.length,N=new Uint8Array(h),E=0;E<h;E++)Z===A.length&&(a(A,$,d,k),Z=0),N[E]=A[Z++];return $.clean(),A.fill(0),k.fill(0),N}e.hkdf=_;function y(m,l,d,h){for(var k=new o(m),v=k.digestLength,$=new Uint8Array(4),A=new Uint8Array(v),Z=new Uint8Array(v),N=new Uint8Array(h),E=0;E*v<h;E++){var te=E+1;$[0]=te>>>24&255,$[1]=te>>>16&255,$[2]=te>>>8&255,$[3]=te>>>0&255,k.reset(),k.update(l),k.update($),k.finish(Z);for(var F=0;F<v;F++)A[F]=Z[F];for(var F=2;F<=d;F++){k.reset(),k.update(Z).finish(Z);for(var z=0;z<v;z++)A[z]^=Z[z]}for(var F=0;F<v&&E*v+F<h;F++)N[E*v+F]=A[F]}for(var E=0;E<v;E++)A[E]=Z[E]=0;for(var E=0;E<4;E++)$[E]=0;return k.clean(),N}e.pbkdf2=y})}(At)),At.exports}var wo=Ao();const Po=new Int32Array(4);class W{static hashStr(e,n=!1){return this.onePassHasher.start().appendStr(e).end(n)}static hashAsciiStr(e,n=!1){return this.onePassHasher.start().appendAsciiStr(e).end(n)}static stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]);static buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);static hexChars="0123456789abcdef";static hexOut=[];static onePassHasher=new W;static _hex(e){const n=W.hexChars,i=W.hexOut;let r,o,s,c;for(c=0;c<4;c+=1)for(o=c*8,r=e[c],s=0;s<8;s+=2)i[o+1+s]=n.charAt(r&15),r>>>=4,i[o+0+s]=n.charAt(r&15),r>>>=4;return i.join("")}static _md5cycle(e,n){let i=e[0],r=e[1],o=e[2],s=e[3];i+=(r&o|~r&s)+n[0]-680876936|0,i=(i<<7|i>>>25)+r|0,s+=(i&r|~i&o)+n[1]-389564586|0,s=(s<<12|s>>>20)+i|0,o+=(s&i|~s&r)+n[2]+606105819|0,o=(o<<17|o>>>15)+s|0,r+=(o&s|~o&i)+n[3]-1044525330|0,r=(r<<22|r>>>10)+o|0,i+=(r&o|~r&s)+n[4]-176418897|0,i=(i<<7|i>>>25)+r|0,s+=(i&r|~i&o)+n[5]+1200080426|0,s=(s<<12|s>>>20)+i|0,o+=(s&i|~s&r)+n[6]-1473231341|0,o=(o<<17|o>>>15)+s|0,r+=(o&s|~o&i)+n[7]-45705983|0,r=(r<<22|r>>>10)+o|0,i+=(r&o|~r&s)+n[8]+1770035416|0,i=(i<<7|i>>>25)+r|0,s+=(i&r|~i&o)+n[9]-1958414417|0,s=(s<<12|s>>>20)+i|0,o+=(s&i|~s&r)+n[10]-42063|0,o=(o<<17|o>>>15)+s|0,r+=(o&s|~o&i)+n[11]-1990404162|0,r=(r<<22|r>>>10)+o|0,i+=(r&o|~r&s)+n[12]+1804603682|0,i=(i<<7|i>>>25)+r|0,s+=(i&r|~i&o)+n[13]-40341101|0,s=(s<<12|s>>>20)+i|0,o+=(s&i|~s&r)+n[14]-1502002290|0,o=(o<<17|o>>>15)+s|0,r+=(o&s|~o&i)+n[15]+1236535329|0,r=(r<<22|r>>>10)+o|0,i+=(r&s|o&~s)+n[1]-165796510|0,i=(i<<5|i>>>27)+r|0,s+=(i&o|r&~o)+n[6]-1069501632|0,s=(s<<9|s>>>23)+i|0,o+=(s&r|i&~r)+n[11]+643717713|0,o=(o<<14|o>>>18)+s|0,r+=(o&i|s&~i)+n[0]-373897302|0,r=(r<<20|r>>>12)+o|0,i+=(r&s|o&~s)+n[5]-701558691|0,i=(i<<5|i>>>27)+r|0,s+=(i&o|r&~o)+n[10]+38016083|0,s=(s<<9|s>>>23)+i|0,o+=(s&r|i&~r)+n[15]-660478335|0,o=(o<<14|o>>>18)+s|0,r+=(o&i|s&~i)+n[4]-405537848|0,r=(r<<20|r>>>12)+o|0,i+=(r&s|o&~s)+n[9]+568446438|0,i=(i<<5|i>>>27)+r|0,s+=(i&o|r&~o)+n[14]-1019803690|0,s=(s<<9|s>>>23)+i|0,o+=(s&r|i&~r)+n[3]-187363961|0,o=(o<<14|o>>>18)+s|0,r+=(o&i|s&~i)+n[8]+1163531501|0,r=(r<<20|r>>>12)+o|0,i+=(r&s|o&~s)+n[13]-1444681467|0,i=(i<<5|i>>>27)+r|0,s+=(i&o|r&~o)+n[2]-51403784|0,s=(s<<9|s>>>23)+i|0,o+=(s&r|i&~r)+n[7]+1735328473|0,o=(o<<14|o>>>18)+s|0,r+=(o&i|s&~i)+n[12]-1926607734|0,r=(r<<20|r>>>12)+o|0,i+=(r^o^s)+n[5]-378558|0,i=(i<<4|i>>>28)+r|0,s+=(i^r^o)+n[8]-2022574463|0,s=(s<<11|s>>>21)+i|0,o+=(s^i^r)+n[11]+1839030562|0,o=(o<<16|o>>>16)+s|0,r+=(o^s^i)+n[14]-35309556|0,r=(r<<23|r>>>9)+o|0,i+=(r^o^s)+n[1]-1530992060|0,i=(i<<4|i>>>28)+r|0,s+=(i^r^o)+n[4]+1272893353|0,s=(s<<11|s>>>21)+i|0,o+=(s^i^r)+n[7]-155497632|0,o=(o<<16|o>>>16)+s|0,r+=(o^s^i)+n[10]-1094730640|0,r=(r<<23|r>>>9)+o|0,i+=(r^o^s)+n[13]+681279174|0,i=(i<<4|i>>>28)+r|0,s+=(i^r^o)+n[0]-358537222|0,s=(s<<11|s>>>21)+i|0,o+=(s^i^r)+n[3]-722521979|0,o=(o<<16|o>>>16)+s|0,r+=(o^s^i)+n[6]+76029189|0,r=(r<<23|r>>>9)+o|0,i+=(r^o^s)+n[9]-640364487|0,i=(i<<4|i>>>28)+r|0,s+=(i^r^o)+n[12]-421815835|0,s=(s<<11|s>>>21)+i|0,o+=(s^i^r)+n[15]+530742520|0,o=(o<<16|o>>>16)+s|0,r+=(o^s^i)+n[2]-995338651|0,r=(r<<23|r>>>9)+o|0,i+=(o^(r|~s))+n[0]-198630844|0,i=(i<<6|i>>>26)+r|0,s+=(r^(i|~o))+n[7]+1126891415|0,s=(s<<10|s>>>22)+i|0,o+=(i^(s|~r))+n[14]-1416354905|0,o=(o<<15|o>>>17)+s|0,r+=(s^(o|~i))+n[5]-57434055|0,r=(r<<21|r>>>11)+o|0,i+=(o^(r|~s))+n[12]+1700485571|0,i=(i<<6|i>>>26)+r|0,s+=(r^(i|~o))+n[3]-1894986606|0,s=(s<<10|s>>>22)+i|0,o+=(i^(s|~r))+n[10]-1051523|0,o=(o<<15|o>>>17)+s|0,r+=(s^(o|~i))+n[1]-2054922799|0,r=(r<<21|r>>>11)+o|0,i+=(o^(r|~s))+n[8]+1873313359|0,i=(i<<6|i>>>26)+r|0,s+=(r^(i|~o))+n[15]-30611744|0,s=(s<<10|s>>>22)+i|0,o+=(i^(s|~r))+n[6]-1560198380|0,o=(o<<15|o>>>17)+s|0,r+=(s^(o|~i))+n[13]+1309151649|0,r=(r<<21|r>>>11)+o|0,i+=(o^(r|~s))+n[4]-145523070|0,i=(i<<6|i>>>26)+r|0,s+=(r^(i|~o))+n[11]-1120210379|0,s=(s<<10|s>>>22)+i|0,o+=(i^(s|~r))+n[2]+718787259|0,o=(o<<15|o>>>17)+s|0,r+=(s^(o|~i))+n[9]-343485551|0,r=(r<<21|r>>>11)+o|0,e[0]=i+e[0]|0,e[1]=r+e[1]|0,e[2]=o+e[2]|0,e[3]=s+e[3]|0}_dataLength=0;_bufferLength=0;_state=new Int32Array(4);_buffer=new ArrayBuffer(68);_buffer8;_buffer32;constructor(){this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(W.stateIdentity),this}appendStr(e){const n=this._buffer8,i=this._buffer32;let r=this._bufferLength,o,s;for(s=0;s<e.length;s+=1){if(o=e.charCodeAt(s),o<128)n[r++]=o;else if(o<2048)n[r++]=(o>>>6)+192,n[r++]=o&63|128;else if(o<55296||o>56319)n[r++]=(o>>>12)+224,n[r++]=o>>>6&63|128,n[r++]=o&63|128;else{if(o=(o-55296)*1024+(e.charCodeAt(++s)-56320)+65536,o>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");n[r++]=(o>>>18)+240,n[r++]=o>>>12&63|128,n[r++]=o>>>6&63|128,n[r++]=o&63|128}r>=64&&(this._dataLength+=64,W._md5cycle(this._state,i),r-=64,i[0]=i[16])}return this._bufferLength=r,this}appendAsciiStr(e){const n=this._buffer8,i=this._buffer32;let r=this._bufferLength,o,s=0;for(;;){for(o=Math.min(e.length-s,64-r);o--;)n[r++]=e.charCodeAt(s++);if(r<64)break;this._dataLength+=64,W._md5cycle(this._state,i),r=0}return this._bufferLength=r,this}appendByteArray(e){const n=this._buffer8,i=this._buffer32;let r=this._bufferLength,o,s=0;for(;;){for(o=Math.min(e.length-s,64-r);o--;)n[r++]=e[s++];if(r<64)break;this._dataLength+=64,W._md5cycle(this._state,i),r=0}return this._bufferLength=r,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,i=e.state,r=this._state;let o;for(this._dataLength=e.length,this._bufferLength=e.buflen,r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],o=0;o<n.length;o+=1)this._buffer8[o]=n.charCodeAt(o)}end(e=!1){const n=this._bufferLength,i=this._buffer8,r=this._buffer32,o=(n>>2)+1;this._dataLength+=n;const s=this._dataLength*8;if(i[n]=128,i[n+1]=i[n+2]=i[n+3]=0,r.set(W.buffer32Identity.subarray(o),o),n>55&&(W._md5cycle(this._state,r),r.set(W.buffer32Identity)),s<=4294967295)r[14]=s;else{const c=s.toString(16).match(/(.*?)(.{0,8})$/);if(c===null)return e?Po:"";const a=parseInt(c[2],16),f=parseInt(c[1],16)||0;r[14]=a,r[15]=f}return W._md5cycle(this._state,r),e?this._state:W._hex(this._state)}}if(W.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592")throw new Error("Md5 self test failed.");const To=36e5,gi=Symbol.for("constructDateFrom");function wt(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&gi in t?t[gi](e):t instanceof Date?new t.constructor(e):new Date(e)}function He(t,e){return wt(t,t)}function Oo(t,e,n){const i=He(t);if(isNaN(e))return wt(t,NaN);const r=i.getDate(),o=wt(t,i.getTime());o.setMonth(i.getMonth()+e+1,0);const s=o.getDate();return r>=s?o:(i.setFullYear(o.getFullYear(),o.getMonth(),r),i)}function vi(t,e,n){return wt(t,+He(t)+e)}function Eo(t,e,n){return vi(t,e*To)}function Io(t,e,n){return vi(t,e*1e3)}function Mo(t,e,n){return Oo(t,e*12)}function bi(t){return Math.trunc(+He(t)/1e3)}function Ro(t,e){return+He(t)<+He(e)}function p(t,e,n,i="debug",r){if(window.debug){const s=["color: #0288D1",`color:${r||"#009688"}`,"color: default"];n?dn()?console[i](`%c[PlaceOS]%c[${t}] %c${e}`,...s,n):console[i](`[PlaceOS][${t}] ${e}`,n):dn()?console[i](`%c[PlaceOS]%c[${t}] %c${e}`,...s):console[i](`[PlaceOS][${t}] ${e}`)}}function dn(){return!(document.documentMode||/Edge/.test(navigator.userAgent))}function pn(){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 r=t.split("?");n=Re(r[0]),e||(e=r[1])}else n=Re(t);let i={};return e&&(i=Re(e)),{...n,...i}}function Re(t){const e={},n=t.split("&");for(const i of n){const r=i.split("=");r[1]&&(e[decodeURIComponent(r[0])]=decodeURIComponent(r[1]))}return e}const Si="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function ki(t=40){let e="";for(let n=0;n<t;n++)e+=Si.charAt(Math.floor(Math.random()*Si.length));return e}function ce(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 Be(t,e=!1){const n=e?1e3:1024;if(t<n)return t+(e?" iB":" B");const i=Math.floor(Math.log(t)/Math.log(n)),r=(e?"kMGTPE":"KMGTPE").charAt(i-1)+(e?"iB":"B");return(t/Math.pow(n,i)).toFixed(2)+" "+r}function $i(t){if(t.length===0)throw new Error("Input must not be of zero length");const e=t.split(","),n={};for(const i of e){const r=i.split(";");if(r.length!==2)throw new Error("Section could not be split on ';'");const o=r[0].replace(/<(.*)>/,"$1").trim(),s=r[1].replace(/rel="(.*)"/,"$1").trim();n[s]=o}return n}function Ai(t,e){for(const n in t)t.hasOwnProperty(n)&&e.indexOf(t[n])>=0&&delete t[n];return t}function wi(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Pi(){return window.location!==window.parent.location}function Ti(t=Date.now(),e=60*1e3){return Math.floor(t/e)}class Do{abort(){p("Stub","Aborted")}}function L(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 be={},We={},ae={};function qo(){for(const t in be)be.hasOwnProperty(t)&&Se(t);for(const t in We)We.hasOwnProperty(t)&&Uo(t);for(const t in ae)ae.hasOwnProperty(t)&&Co(t)}function oe(t,e,n=300){if(t&&e&&e instanceof Function)Se(t),be[t]=setTimeout(()=>{e(),delete be[t]},n);else throw new Error(t?"Cannot create named timeout without a name":"Cannot create a timeout without a callback")}function Se(t){be[t]&&(clearTimeout(be[t]),delete be[t])}function Uo(t){We[t]&&(clearInterval(We[t]),delete We[t])}function Co(t){ae&&ae[t]&&(ae[t]instanceof ye?ae[t].unsubscribe():ae[t](),delete ae[t])}const No={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 b={},P,x;const S={};let T="",ke="";const De=new ue(""),Pt=new ue("");let mn="/api/engine/v2";const le=new ue(!1),Fo=le.asObservable();let Tt=0;function fe(){return`${`${b.secure||window.location?.protocol.indexOf("https")>=0?"https:":"http:"}//${b.host||window.location?.host}`}${_n()}`}function _n(){return b.version==="ACA Engine"?"/control/api":mn}function jo(){return!!b.token_header}function Oi(){return T}function Lo(){return b.redirect_uri}function xo(t,e=!0){P.setItem(`${T}_x-api-key`,`${t}`),P.setItem("trusted",`${e}`),Ei("x-api-key",Mo(new Date,5).valueOf())}function Qe(){return Rt("x-api-key",!1)||""}function Ei(t,e=Eo(new Date,2).valueOf()){b.ignore_api_key&&t==="x-api-key"||(P.setItem(`${T}_expires_at`,`${e}`),P.setItem(`${T}_access_token`,t))}function V(t=!0){if(b.mock)return"mock-token";if(!P)return"";if(Qe()&&!b.ignore_api_key)return"x-api-key";const e=P.getItem(`${T}_expires_at`)||"",n=De.getValue();return Ro(+e,new Date)&&(p("Auth","Token expired. Requesting new token..."),Dt(),S.load_authority||(Tt+=1,oe("re-authorise",()=>vn().catch(i=>p("Auth",`Failed to get token: ${i}`)),200*Math.min(20,Tt))),!t)?"":n||P.getItem(`${T}_access_token`)||""}function Ot(){return Pt.getValue()||P.getItem(`${T}_refresh_token`)||""}function Et(){return b.host||window.location?.host}function Ii(){return!!V()}function Mi(){return De.pipe(I(t=>!!Ii()))}function Ze(){return x}function zo(){return le.getValue()}function It(){return!!b.mock}function Ri(){return!!b.secure}function Ho(){return Fo}function Mt(){return Rt("trust")==="true"||Rt("trusted")==="true"}function yn(){return!!Qe()&&!b.ignore_api_key||Rt("fixed_device")==="true"}function Rt(t,e=!0){let i=pn()[t];if(P){const r=`${Oi()}_${t}`;i=i||P.getItem(r)||P.getItem(t)||"",e&&P.setItem(r,`${i}`)}return i}function Bo(t){return b=t||b,b.token_header=b.token_header??Pi(),window.AbortController||(window.AbortController=Do),P=b.storage==="session"?sessionStorage:localStorage,T=W.hashStr(b.redirect_uri,!1),bn()}function Wo(){b={},x=void 0,De.next(""),Pt.next(""),le.next(!1),T="",ke="",mn="/api/engine/v2";for(const t in S)t in S&&delete S[t];qo()}function gn(){return p("Auth","Refreshing authorty."),x=void 0,bn()}function Dt(){p("Auth","Invalidating tokens."),P.removeItem(`${T}_access_token`),P.removeItem(`${T}_expires_at`),De.getValue()&&De.next("")}function vn(t,e=x){return S.authorise||(S.authorise=new Promise((n,i)=>{if(!e)return delete S.authorise,i("Authority is not loaded");p("Auth","Authorising user...");const r=()=>{if(V(!1))p("Auth","Valid token found."),delete S.authorise,n(V());else{const o=[()=>{p("Auth","Successfully generated token."),n(V()),delete S.authorise},()=>{p("Auth","Failed to generate token."),i("Failed to generate token"),setTimeout(()=>delete S.authorise,200)}];b&&b.auth_type==="password"?(p("Auth","Logging in with credentials."),ts(b).then(...o),Tt=0):ke||Ot()?(p("Auth",`Generating token with ${ke?"code":"refresh token"}`),Ci().then(...o),Tt=0):e.session?(p("Auth","Users has session. Authorising application..."),Zo(t).then(...o)):(p("Auth","No user session"),qi(e),i("No user session"),setTimeout(()=>delete S.authorise,200))}};Ko().then(r,r)})),S.authorise}function Qo(){const t=x?x.logout_url:"/logout";fetch(t,{method:"GET",redirect:"manual",headers:{Authorization:"Bearer "+V()}}).then(e=>{const n=e.headers.get("Location")||t;for(let i=0;i<P.length;i++){const r=P.key(i);r&&r.indexOf(T)>=0&&P.removeItem(r)}window.location?.assign(n)})}function bn(t=0){return S.load_authority||(S.load_authority=new Promise(e=>{if(le.next(!1),b.mock){x=No,p("Auth","System in mock mode"),le.next(!0),e();return}p("Auth",`Fixed: ${yn()} | Trusted: ${Mt()}`),p("Auth","Loading authority...");const n=b.secure||window.location?.protocol.indexOf("https")>=0,i=r=>{p("Auth",`Failed to load authority(${r})`),le.next(!1),oe("load_authority",()=>{delete S.load_authority,bn(t).then(o=>e())},300*Math.min(20,++t))};hn(`${n?"https:":"http:"}//${Et()}/auth/authority`,{credentials:"same-origin"}).subscribe(async r=>{if(!r.ok)return i(await r.text().catch(s=>s));x=await r.json(),mn=/[2-9]\.[0-9]+\.[0-9]+/g.test(x.version||"")?"/api/engine/v2":"/control/api",p("Auth","Loaded authority.",[],"group"),x&&(p("Auth",`Name: ${x.name}`),p("Auth",`Version: ${x.version}`),p("Auth",`Domain: ${x.domain}`),p("Auth",`Session: ${x.session}`),p("Auth",`Production: ${x.production}`),p("Auth",`Config Keys: ${Object.keys(x.config||{}).length}`)),p("Auth","",[],"groupEnd");const o=()=>{le.next(!0),p("Auth","Application set online."),e()};delete S.load_authority,vn("").then(o,o)},i)})),S.load_authority}async function Zo(t){const e=Jo(t);if(b.use_iframe)return Vo(e);window.location?.assign(e)}function Vo(t){return S.iframe_auth||(S.iframe_auth=new Promise((e,n)=>{p("Auth","Authorizing in an iFrame...");const i=document.createElement("iframe");i.style.position="absolute",i.style.top="0",i.style.left="0",i.style.height="1px",i.style.width="1px",i.style.zIndex="-1",i.id="place-authorize",i.src=`${t}`;const r=o=>{if(o.origin===window.location?.origin&&o.data.type==="place-os"){const s=o.data;if(p("Auth","Received credentials from iFrame..."),document.body.removeChild(i),Se("iframe_auth"),window.removeEventListener("message",r),delete S.iframe_auth,s.token)return e(),Sn({access_token:s.token,...s});ke=s.code||"",Ci().then(c=>e(c),c=>n(c))}};oe("iframe_auth",()=>{p("Auth","Unable to resolve iFrame after 15 seconds..."),n()},15*1e3),window.addEventListener("message",r),i.onerror=o=>{p("Auth","iFrame error.",o),delete S.iframe_auth,n()},document.body.appendChild(i)})),S.iframe_auth}let Di=!1;function qi(t){if(b.handle_login!==!1&&!Di){p("Auth","Redirecting to login page...");const e=t.login_url?.replace("{{url}}",encodeURIComponent(window.location?.href));throw setTimeout(()=>window.location?.assign(e),300),Di=!0,new Error("Redirecting to login page...")}else p("Auth","Login being handled locally.");delete S.authorise}function Ko(){return S.check_token||(S.check_token=new Promise(async(t,e)=>{V()?(p("Auth","Valid token found."),t(V())):(p("Auth","No token. Checking URL for auth credentials..."),await Yo()?t(!0):e()),delete S.check_token})),S.check_token}function Yo(){return S.check_params||(S.check_params=new Promise(t=>{p("Auth","Checking for auth parameters...");let e=pn();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&&(ke=e.code,ce("code")),e.refresh_token&&(P.setItem(`${T}_refresh_token`,e.refresh_token),ce("refresh_token"));const n=P.getItem(`${T}_nonce`)||"",i=(e.state||"").split(";");ce("state"),ce("token_type");const r=i[0];n===r?(Sn(e),t(!!e.access_token)):t(!1)}else t(!1);oe("check_params_promise",()=>delete S.check_params,50)})),S.check_params}function Jo(t){const e=ns();t=t?`${e};${t}`:e;const n=b?(b.auth_uri||"").indexOf("?")>=0:!1,i=(b?b.auth_uri:null)||"/auth/oauth/authorize",r=Mt()||b.auth_type==="auth_code"?"code":"token";let o=`${i}${n?"&":"?"}response_type=${encodeURIComponent(r)}&client_id=${encodeURIComponent(T)}&state=${encodeURIComponent(t)}&redirect_uri=${encodeURIComponent(b.redirect_uri)}&scope=${encodeURIComponent(b.scope)}`;if(b.auth_type==="auth_code"){const{challenge:s,verify:c}=Go();sessionStorage.setItem(`${T}_challenge`,s),o+="&code_challenge_method=S256",o+=`&code_challenge=${c}`}return o}const Ui="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split("");function Go(t=43){const e=new Array(t).fill(0).map(()=>Ui[Math.floor(Math.random()*Ui.length)]).join(""),n=So(ko(e)),i=_i(wo.hash(n)).split("=")[0].replace(/\//g,"_").replace(/\+/g,"-");return{challenge:e,verify:i}}function Xo(){let e=(b.token_uri||"/auth/token")+`?client_id=${encodeURIComponent(T)}`,n="";if(e+=`&redirect_uri=${encodeURIComponent(b.redirect_uri)}`,Ot()){e+=`&refresh_token=${encodeURIComponent(Ot())}`,e+="&grant_type=refresh_token";const i=e.split("?");e=i[0],n=i[1]}else{e+=`&code=${encodeURIComponent(ke)}`,e+="&grant_type=authorization_code";const i=sessionStorage.getItem(`${T}_challenge`);i&&(e+=`&code_verifier=${i}`,sessionStorage.removeItem(`${T}_challenge`)),ke=""}return[e,n]}function es(t){const e=t.token_uri||"/auth/token",n=L({grant_type:"password",client_id:T,client_secret:t.client_secret,redirect_uri:t.redirect_uri,authority:x?.id,scope:t.scope,username:t.username,password:t.password});return`${e}?${n}`}function Ci(){return Ni(...Xo())}function ts(t){return Ni(es(t))}function Ni(t,e=""){return S.generate_tokens||(S.generate_tokens=new Promise((n,i)=>{p("Auth","Generating new token...");const r=o=>{p("Auth","Error generating new tokens.",o),P.removeItem(`${T}_refresh_token`),Pt.next(""),i(),delete S.generate_tokens};hn(t,{method:"POST",body:e,headers:{"Content-Type":"application/x-www-form-urlencoded"}}).subscribe(async o=>{if(!o.ok)return r(o);const s=await o.json();Sn(s),n(),delete S.generate_tokens},r)})),S.generate_tokens}function Sn(t){const e=Io(new Date,Math.max(60,parseInt(t.expires_in,10)-300));p("Auth","Tokens generated storing..."),Mt()&&(t.access_token&&(P.setItem(`${T}_access_token`,t.access_token),ce("access_token")),t.refresh_token&&(P.setItem(`${T}_refresh_token`,t.refresh_token),ce("refresh_token"))),t.expires_in&&(P.setItem(`${T}_expires_at`,`${e.valueOf()}`),ce("expires_in")),le.next(!0),De.next(t.access_token||""),Pt.next(t.refresh_token||"")}function ns(){const t=ki();return P.setItem(`${T}_nonce`,t),t}const qt={};let Fi=(t,e)=>{const n=new Error(`Mock endpoint not found: ${t} ${e}`);return n.status=404,p("HTTP(M)",`404 ${t}:`,e),li(n)};function is(t){Fi=t}function rs(t,e=qt){ji(t.method,t.path,e);const n=`${t.method}|${t.path}`,i=t.path.replace(/(http|https):\/\/[a-zA-Z0-9.-]*:?([0-9]*)?/g,"").replace(/^\//,"").split("/"),r={...t,path_parts:i,path_structure:i.map(o=>o[0]===":"?o.replace(":",""):"")};e[n]=r,p("HTTP(M)",`+ ${t.method} ${t.path}`)}function ji(t,e,n=qt){const i=`${t}|${e}`;n[i]&&(delete n[i],p("HTTP(M)",`- ${t} ${e}`))}function os(t,e,n,i=qt){const r=ss(t,e,i);if(r){const o=us(e,r,n);return cs(r,o)}return Fi(t,e)}function ss(t,e,n=qt){const r=e.replace(/(http|https):\/\/[a-zA-Z0-9.-]*:?([0-9]*)?/g,"").replace(/^\//,"").split("?")[0].split("/"),o=Object.keys(n).reduce((s,c)=>(c.indexOf(`${t}|`)===0&&s.push(n[c]),s),[]);for(const s of o)if(s.path_structure.length===r.length){let c=!0;for(let a=0;a<s.path_structure.length;a++)if(!s.path_structure[a]&&s.path_parts[a]!==r[a]){c=!1;break}if(c)return s}return null}function us(t,e,n){const i=t.replace(/(http|https):\/\/[a-zA-Z0-9.-]*:?([0-9]*)?/g,"").split("?"),r=i[0].replace(/^\//,""),o=i[1]||"",s=Re(o),c=r.split("/"),a={};for(let _=0;_<e.path_structure.length;_++){const y=e.path_structure[_];y&&(a[y]=c[_])}const f={url:t,path:e.path,method:e.method,metadata:e.metadata,route_params:a,query_params:s,body:n};return p("HTTP(M)",`MATCHED ${f.method}:`,f),f}function cs(t,e){let n;try{n=t.callback?t.callback(e):t.metadata}catch(s){throw p("HTTP(M)",`ERROR ${e.method}:`,[e.url,s]),s}const i=t.delay_variance||100,r=t.delay||300,o=Math.floor(Math.random()*i-i/2)+r;return p("HTTP(M)",`RESP ${e.method}:`,[e.url,n]),lo([n]).pipe(yo(Math.max(200,o)))}const Li={};function xi(t,e=Li){return e[t]||{}}function X(t,e,n=Ke){return e||(e={response_type:"json"}),n("GET",t,{response_type:"json",...e})}function $e(t,e,n,i=Ke){return n||(n={response_type:"json"}),i("POST",t,{body:e,response_type:"json",...n})}function qe(t,e,n,i=Ke){return n||(n={response_type:"json"}),i("PUT",t,{body:e,response_type:"json",...n})}function Ve(t,e,n,i=Ke){return n||(n={response_type:"json"}),i("PATCH",t,{body:e,response_type:"json",...n})}function Ue(t,e,n=Ke){return e||(e={response_type:"void"}),n("DELETE",t,{response_type:"void",...e})}async function as(t,e,n=Li){if(t.headers){const i={};t.headers.forEach?t.headers.forEach((r,o)=>i[o.toLowerCase()]=r):Object.keys(t.headers).forEach(r=>i[r.toLowerCase()]=t.headers[r]),n[t.url||""]=i}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 zi=()=>(Dt(),gn().then(()=>Promise.resolve(),()=>new Promise(t=>{setTimeout(()=>{zi().then(()=>t())},1e3)})));function Ke(t,e,n,i=It,r=os,o=as){if(i()){const s=r(t,e,n?.body);if(s)return s}return n.headers=n.headers||{},!n.headers["Content-Type"]&&!n.headers["content-type"]&&(n.headers["Content-Type"]="application/json"),Mi().pipe(po(s=>s),di(1),pi(s=>{V()==="x-api-key"?n.headers["X-API-Key"]=Qe():n.headers.Authorization=`Bearer ${V()}`;const c={...n,method:t,credentials:"same-origin"};return["POST","PUT","PATCH"].includes(t)&&n.body!==void 0&&(c.body=typeof n.body=="string"?n.body:JSON.stringify(n.body)),hn(e,c)}),pi(s=>s.ok?o(s,n.response_type):li(s)),bo({count:4,delay:(s,c)=>new D(a=>{if(s.status===511){qi(Ze()),a.error(s);return}if(s.status!==401){a.error(s||{});return}p("HTTP","Auth error",s);const f=Math.pow(2,c-1)*1e3;zi().then(()=>{a.next(f),a.complete()}).catch(()=>{a.error(s)})})}))}class H{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,Ai(e,[void 0,null,""])}}class Hi extends H{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 ls(t){return Bi[t]||0}function fs(t){return Wi[t]||0}let Bi={},Wi={},Qi="";const Ut=t=>t;function O(t){const{query_params:e,fn:n,path:i,endpoint:r}=t,o=L(e),s=`${r||fe()}${i?"/"+i:""}${o?"?"+o:""}`;return X(s).pipe(I(c=>{const a=hs(s,o,i);return{total:a.total||0,next:a.next?()=>O({query_params:a.next,fn:n,endpoint:r,path:i}):null,data:c&&c instanceof Array?c.map(f=>(n||Ut)(f)):c&&!(c instanceof Array)&&c.results?c.results.map(f=>f):[]}}))}function w(t){const{query_params:e,id:n,path:i,fn:r,options:o}=t,s=L(e),c=`${fe()}/${i}/${n}${s?"?"+s:""}`;return X(c,o).pipe(I(a=>(r||Ut)(a)))}function q(t){const{query_params:e,form_data:n,path:i,fn:r}=t,o=L(e),s=`${fe()}/${i}${o?"?"+o:""}`;return $e(s,n).pipe(I(a=>(r||Ut)(a)))}function g(t){const{id:e,task_name:n,form_data:i,method:r,path:o,callback:s}=t,c=L(i),a=`${fe()}/${o}/${e}/${n}`;return(r==="post"||r==="put"||!r?(r==="put"?qe:$e)(a,i):(r==="del"?Ue:X)(`${a}${c?"?"+c:""}`,{response_type:"json"})).pipe(I(_=>(s||(y=>y))(_)))}function U(t){const{id:e,query_params:n,form_data:i,method:r,path:o,fn:s}=t,c=L({...n,version:i.version||0}),a=`${fe()}/${o}/${e}${c?"?"+c:""}`;return(r==="put"?qe:Ve)(a,i).pipe(I(f=>(s||Ut)(f)))}function R(t){const{id:e,query_params:n,path:i}=t,r=L(n),o=`${fe()}/${i}/${e}${r?"?"+r:""}`;return Ue(o)}function hs(t,e,n){const i=xi(t[0]==="/"?`${location.origin}${t}`:t),r={total:0,next:null};if(i&&i["x-total-count"]){const o=+(i["x-total-count"]||0);(e.length<2||e.length<12&&e.indexOf("offset=")>=0)&&(Bi[n]=o),Wi[n]=o,r.total=o}return i&&i.link&&(Qi=$i(i.link||"").next,r.next=Re(Qi.split("?")[1])),r}function Ia(t){return t}const Ye="oauth_apps";function Ct(t){return new Hi(t)}function ds(t={}){return O({query_params:t,fn:Ct,path:Ye})}function ps(t,e={}){return w({id:t,query_params:e,fn:Ct,path:Ye})}function ms(t,e,n="patch"){return U({id:t,form_data:e,query_params:{},method:n,fn:Ct,path:Ye})}function _s(t){return q({form_data:t,query_params:{},fn:Ct,path:Ye})}function ys(t,e={}){return R({id:t,query_params:e,path:Ye})}var Zi=(t=>(t[t.Certificate=0]="Certificate",t[t.NoAuth=1]="NoAuth",t[t.UserPassword=2]="UserPassword",t))(Zi||{});class Vi extends H{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 Je="brokers";function Nt(t){return new Vi(t)}function gs(t={}){return O({query_params:t,fn:Nt,path:Je})}function vs(t,e={}){return w({id:t,query_params:e,fn:Nt,path:Je})}function bs(t,e,n="patch"){return U({id:t,form_data:e,query_params:{},method:n,fn:Nt,path:Je})}function Ss(t){return q({form_data:t,query_params:{},fn:Nt,path:Je})}function ks(t,e={}){return R({id:t,query_params:e,path:Je})}class Ki{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=Be(this.memory_usage*1024),this.total_memory=Be(this.memory_total*1024);const n=e.load?.edge||{};this.edge_nodes=e.edge_nodes||Object.keys(n).map(i=>({id:i,...n[i],run_count:e.status?.run_count?.edge[i]||{}}))||[]}}class Yi{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=Be(this.memory_usage*1024),this.total_memory=Be(this.memory_total*1024)}}const kn="cluster";function $s(t){return new Ki(t)}function As(t={}){return O({query_params:t,fn:$s,path:kn})}function ws(t,e={}){return w({id:t,query_params:e,fn:n=>n.map(i=>new Yi(t,i)),path:kn})}function Ps(t,e){return R({id:t,query_params:{driver:e},path:kn})}class Ji extends H{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 Ge="domains";function Ft(t){return new Ji(t)}function Ts(t={}){return O({query_params:t,fn:Ft,path:Ge})}function Os(t,e={}){return w({id:t,query_params:e,fn:Ft,path:Ge})}function Es(t,e,n="patch"){return U({id:t,form_data:e,query_params:{},method:n,fn:Ft,path:Ge})}function Is(t){return q({form_data:t,query_params:{},fn:Ft,path:Ge})}function Ms(t,e={}){return R({id:t,query_params:e,path:Ge})}var Ae=(t=>(t[t.None=0]="None",t[t.Support=1]="Support",t[t.Admin=2]="Admin",t[t.NeverDisplay=3]="NeverDisplay",t))(Ae||{});class he extends H{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||Ae.None,this.keys=e.keys||[],this.modified_by_id=e.modified_by_id||""}}var Xe=(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))(Xe||{});class $n extends H{class_name;description;module_name;role;default_uri;default_port;repository_id;file_name;commit;ignore_connected;update_available;update_info;settings;constructor(e={}){super(e),this.description=e.description||"",this.module_name=e.module_name||"",this.role=e.role??Xe.Logic,this.default_uri=e.default_uri||"",this.default_port=e.default_port||1,this.ignore_connected=e.ignore_connected||!1,this.class_name=e.class_name||"",this.repository_id=e.repository_id||"",this.file_name=e.file_name||"",this.commit=e.commit||"",this.update_available=e.update_available||!1,this.update_info=e.update_info,this.settings=e.settings||[null,null,null,null],typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in Ae)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new he({parent_id:this.id,encryption_level:+n}))}}const de="drivers";function jt(t){return new $n(t)}function Rs(t={}){return O({query_params:t,fn:jt,path:de})}function Ds(t,e={}){return w({id:t,query_params:e,fn:jt,path:de})}function qs(t,e,n="patch"){return U({id:t,form_data:e,query_params:{},method:n,fn:jt,path:de})}function Us(t){return q({form_data:t,query_params:{},fn:jt,path:de})}function Cs(t,e={}){return R({id:t,query_params:e,path:de})}function Ns(t){return g({id:t,task_name:"recompile",path:de})}function Fs(t){return g({id:t,task_name:"reload",path:de})}function js(t){return g({id:t,task_name:"compiled",method:"get",path:de})}class Gi extends H{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 Ce="edges";function Lt(t){return new Gi(t)}function Ls(t={}){return O({query_params:t,fn:Lt,path:Ce})}function xs(t,e={}){return w({id:t,query_params:e,fn:Lt,path:Ce})}function zs(t,e,n="patch"){return U({id:t,form_data:e,query_params:{},method:n,fn:Lt,path:Ce})}function Hs(t){return q({form_data:t,query_params:{},fn:Lt,path:Ce})}function Bs(t,e={}){return R({id:t,query_params:e,path:Ce})}function Ws(t,e={}){return g({id:t,task_name:"token",form_data:e,method:"get",path:Ce})}class Xi extends H{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 et="ldap_auths";function xt(t){return new Xi(t)}function Qs(t={}){return O({query_params:t,fn:xt,path:et})}function Zs(t,e={}){return w({id:t,query_params:e,fn:xt,path:et})}function Vs(t,e,n="patch"){return U({id:t,form_data:e,query_params:{},method:n,fn:xt,path:et})}function Ks(t){return q({form_data:t,query_params:{},fn:xt,path:et})}function Ys(t,e={}){return R({id:t,query_params:e,path:et})}class An{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 we extends H{system_name;activated_count;description;debounce_period;important;enabled;enable_webhook;exec_enabled;webhook_secret;supported_methods;control_system_id;zone_id;trigger_id;playlists;get system_id(){return this.control_system_id}get actions(){const e=this._actions,n=(e.functions||[]).map(r=>({...r,args:{...r.args}})),i=(e.mailers||[]).map(r=>({...r,emails:[...r.emails]}));return{functions:n,mailers:i}}get conditions(){const e=this._conditions,n=(e.comparisons||[]).map(r=>({...r,left:typeof r.left=="object"?{...r.left}:r.left,right:typeof r.right=="object"?{...r.right}:r.right})),i=(e.time_dependents||[]).map(r=>({...r}));return{comparisons:n,time_dependents:i}}_actions;_conditions;constructor(e={}){super(e),this.description=e.description||"",this._actions=e.actions||{functions:[],mailers:[]},this._conditions=e.conditions||{comparisons:[],time_dependents:[]},this.debounce_period=e.debounce_period||0,this.important=e.important||!1,this.enabled=e.enabled||!1,this.webhook_secret=e.webhook_secret||"",this.control_system_id=e.system_id||e.control_system_id||"",this.zone_id=e.zone_id||"",this.system_name=e.system_name||(e.control_system?e.control_system.name:""),this.enable_webhook=e.enable_webhook||!1,this.exec_enabled=e.exec_enabled||!1,this.supported_methods=e.supported_methods||["POST"],this.activated_count=e.activated_count||e.trigger_count||0,this.playlists=e.playlists||[],this.trigger_id=e.trigger_id||""}}class zt extends H{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 Ae)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new he({parent_id:this.id,encryption_level:+n}));e.trigger_data&&e.trigger_data instanceof Array&&(this.trigger_list=e.trigger_data.map(n=>new we(n)))}}class er{zone;metadata;keys;constructor(e={}){this.zone=new zt(e.zone),this.keys=e.keys||[],this.metadata={};const n=e.metadata||{};for(const i of this.keys)this.metadata[i]=new An(n[i])}}const Pe="metadata";function tt(t){return new An(t)}function Js(t,e={}){return w({id:t,query_params:e,fn:n=>Object.keys(n).map(i=>tt(n[i])),path:Pe})}function Gs(t){const e=[...t],n=[];for(;e.length;){const i=e.pop();Array.isArray(i)?e.push(...i):n.push(i)}return n.reverse()}function Xs(t,e={}){return g({id:t,task_name:"history",form_data:e,method:"get",callback:n=>Gs(Object.keys(n).map(i=>n[i].map(r=>tt(r)))),path:Pe})}function eu(t,e,n={}){return w({id:t,query_params:{...n,name:e},fn:i=>tt(i[e]),path:Pe})}function tu(t,e,n="put"){return U({id:t,form_data:e,query_params:{},method:n,fn:tt,path:Pe})}function nu(t){return q({form_data:t,query_params:{},fn:tt,path:Pe})}function iu(t,e={}){return R({id:t,query_params:e,path:Pe})}function ru(t,e){return g({id:t,task_name:"children",form_data:e,method:"get",callback:n=>n.map(i=>new er({...i,keys:Object.keys(i.metadata)})),path:Pe})}class wn extends H{settings=[null,null,null,null];display_name;description;email;code;capacity;features;bookable;public;installed_ui_devices;support_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.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 Ae)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new he({parent_id:this.id,encryption_level:+n}));e.module_data&&e.module_data instanceof Array&&(this.module_list=e.module_data.map(n=>new Pn(n)))}}class Pn extends H{connected;running;updated_at;edge_id;driver_id;driver;control_system_id;system;ip;tls;udp;port;makebreak;uri;custom_name;role;notes;ignore_connected;settings=[null,null,null,null];has_runtime_error;error_timestamp;get system_id(){return this.control_system_id}constructor(e={}){super(e),this.driver_id=e.driver_id||e.dependency_id||"",this.control_system_id=e.control_system_id||"",this.edge_id=e.edge_id||"",this.ip=e.ip||"",this.tls=e.tls||!1,this.udp=e.udp||!1,this.port=e.port||1,this.makebreak=e.makebreak||!1,this.uri=e.uri||"",this.custom_name=e.custom_name||"",this.role=e.role??Xe.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 wn(e.control_system||e.system),this.has_runtime_error=e.has_runtime_error||!1,this.error_timestamp=e.error_timestamp||0,this.driver=new $n(e.dependency||e.driver),this.settings=e.settings||[null,null,null,null],typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in Ae)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new he({parent_id:this.id,encryption_level:+n}))}toJSON(e=!1){const n=super.toJSON();return(n.role!==Xe.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 Ht(t){return new Pn(t)}function ou(t={}){return O({query_params:t,fn:Ht,path:Y})}function su(t,e={}){return w({id:t,query_params:e,fn:Ht,path:Y})}function uu(t,e,n="patch"){return U({id:t,form_data:e,query_params:{},method:n,fn:Ht,path:Y})}function cu(t){return q({form_data:t,query_params:{},fn:Ht,path:Y})}function au(t,e={}){return R({id:t,query_params:e,path:Y})}function lu(t){return g({id:t,task_name:"start",path:Y})}function fu(t){return g({id:t,task_name:"stop",path:Y})}function hu(t){return g({id:t,task_name:"state",method:"get",path:Y})}function du(t,e){return g({id:t,task_name:`state${e}`,method:"get",path:Y})}function pu(t){return g({id:t,task_name:"load",method:"post",path:Y})}function mu(t){return g({id:t,task_name:"settings",method:"get",callback:e=>e.map(n=>new he(n)),path:Y})}function _u(t){return g({id:t,task_name:"error",method:"get",path:Y})}class tr extends H{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 nt="oauth_auths";function Bt(t){return new tr(t)}function yu(t={}){return O({query_params:t,fn:Bt,path:nt})}function gu(t,e={}){return w({id:t,query_params:e,fn:Bt,path:nt})}function vu(t,e,n="patch"){return U({id:t,form_data:e,query_params:{},method:n,fn:Bt,path:nt})}function bu(t){return q({form_data:t,query_params:{},fn:Bt,path:nt})}function Su(t,e={}){return R({id:t,query_params:e,path:nt})}var Tn=(t=>(t.Driver="driver",t.Interface="interface",t))(Tn||{});class nr extends H{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||Tn.Driver,this.username=e.username||"",this.password=e.password||"",this.root_path=e.root_path||""}}const Q="repositories";function Wt(t){return new nr(t)}function ku(t={}){return O({query_params:t,fn:Wt,path:Q})}function $u(t,e={}){return w({id:t,query_params:e,fn:Wt,path:Q})}function Au(t,e,n="patch"){return U({id:t,form_data:e,query_params:{},method:n,fn:Wt,path:Q})}function wu(t){return q({form_data:t,query_params:{},fn:Wt,path:Q})}function Pu(t,e={}){return R({id:t,query_params:e,path:Q})}function Tu(t={}){return w({id:"interfaces",query_params:t,path:Q})}function Ou(t){return w({id:"remote_default_branch",query_params:t,path:Q})}function Eu(t){return w({id:"remote_branches",query_params:t,path:Q})}function Iu(t){return w({id:"remote_commits",query_params:t,path:Q})}function Mu(t,e){return g({id:t,task_name:"drivers",form_data:e,method:"get",path:Q})}function Ru(t,e){return g({id:t,task_name:"commits",form_data:e,method:"get",path:Q})}function Du(t){return g({id:t,task_name:"branches",method:"get",path:Q})}function qu(t){return g({id:t,task_name:"default_branch",method:"get",path:Q})}function Uu(t,e){return g({id:t,task_name:"details",form_data:e,method:"get",path:Q})}function Cu(t,e){return g({id:t,task_name:"pull",form_data:e,method:"post",path:Q})}class ir extends H{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 it="saml_auths";function Qt(t){return new ir(t)}function Nu(t={}){return O({query_params:t,fn:Qt,path:it})}function Fu(t,e={}){return w({id:t,query_params:e,fn:Qt,path:it})}function ju(t,e,n="patch"){return U({id:t,form_data:e,query_params:{},method:n,fn:Qt,path:it})}function Lu(t){return q({form_data:t,query_params:{},fn:Qt,path:it})}function xu(t,e={}){return R({id:t,query_params:e,path:it})}const Ne="settings";function rt(t){return new he(t)}function zu(t={}){return O({query_params:t,fn:rt,path:Ne})}function Hu(t,e={}){return w({id:t,query_params:e,fn:rt,path:Ne})}function Bu(t,e,n={},i="patch"){return U({id:t,form_data:e,query_params:n,method:i,fn:rt,path:Ne})}function Wu(t,e={}){return q({form_data:t,query_params:e,fn:rt,path:Ne})}function Qu(t,e={}){return R({id:t,query_params:e,path:Ne})}function Zu(t,e={}){return g({id:t,task_name:"history",form_data:e,method:"get",callback:n=>n.map(i=>rt(i)),path:Ne})}const C="systems";function Te(t){return new wn(t)}function Vu(t={}){return O({query_params:t,fn:Te,path:C})}function Ku(t={}){return O({query_params:t,fn:Te,path:`${C}/with_emails`})}function Yu(t,e={}){return w({id:t,query_params:e,fn:Te,path:C})}function Ju(t,e,n="patch"){return U({id:t,form_data:e,query_params:{},method:n,fn:Te,path:C})}function Gu(t){return q({form_data:t,query_params:{},fn:Te,path:C})}function Xu(t,e={}){return R({id:t,query_params:e,path:C})}function ec(t,e,n={}){return g({id:t,task_name:`module/${e}`,form_data:n,method:"put",callback:i=>Te(i),path:C})}function tc(t,e){return g({id:t,task_name:`module/${e}`,form_data:{},method:"del",callback:n=>Te(n),path:C})}function nc(t){return g({id:t,task_name:"start",form_data:{},path:C})}function ic(t){return g({id:t,task_name:"stop",path:C})}function rc(t,e,n,i=1,r=[]){return g({id:t,task_name:`${n}_${i}/${encodeURIComponent(e)}`,form_data:r,path:C})}function oc(t,e,n=1){return g({id:t,task_name:`${e}_${n}`,method:"get",path:C})}function sc(t,e,n=1,i){return g({id:t,task_name:`${e}_${n}/${i}`,method:"get",path:C})}function uc(t,e,n=1){return g({id:t,task_name:`functions/${e}_${n}`,method:"get",path:C})}function cc(t){return O({query_params:{},fn:e=>new zt(e),path:`${C}/${t}/zones`})}function ac(t){return O({query_params:{},fn:e=>new we(e),path:`${C}/${t}/triggers`})}function lc(t,e){return g({id:t,task_name:"triggers",form_data:e,method:"post",callback:n=>new we(n),path:C})}function fc(t,e){return g({id:t,task_name:`triggers/${e}`,method:"del",path:C})}function hc(t){return g({id:t,task_name:"settings",method:"get",callback:e=>e.map(n=>new he(n)),path:C})}const Fe="triggers";function Zt(t){return new we(t)}function dc(t={}){return O({query_params:t,fn:Zt,path:Fe})}function pc(t,e={}){return w({id:t,query_params:e,fn:Zt,path:Fe})}function mc(t,e,n="patch"){return U({id:t,form_data:e,query_params:{},method:n,fn:Zt,path:Fe})}function _c(t){return q({form_data:t,query_params:{},fn:Zt,path:Fe})}function yc(t,e={}){return R({id:t,query_params:e,path:Fe})}function gc(t){return g({id:t,task_name:"instances",form_data:{},method:"get",callback:e=>e.map(n=>new we(n)),path:Fe})}var rr=(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))(rr||{}),or=(t=>(t.AT="at",t.CRON="cron",t))(or||{}),sr=(t=>(t[t.ExecuteBefore=0]="ExecuteBefore",t[t.ExecuteAfter=1]="ExecuteAfter",t[t.PayloadOnly=2]="PayloadOnly",t[t.IgnorePayload=3]="IgnorePayload",t))(sr||{});class ur extends H{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 je="users";function ot(t){return new ur(t)}function vc(t={}){return O({query_params:t,fn:ot,path:je})}function bc(t,e={}){return w({id:t,query_params:e,fn:ot,path:je})}function Sc(t={}){return w({id:"current",query_params:t,fn:ot,path:je})}function kc(t,e,n="patch"){return U({id:t,form_data:e,query_params:{},method:n,fn:ot,path:je})}function $c(t){return q({form_data:t,query_params:{},fn:ot,path:je})}function Ac(t,e={}){return R({id:t,query_params:e,path:je})}const pe="zones";function Vt(t){return new zt(t)}function wc(t={}){return O({query_params:t,fn:Vt,path:pe})}function Pc(t={}){return w({id:"tags",query_params:t,fn:e=>e,path:pe})}function Tc(t,e={}){return w({id:t,query_params:e,fn:Vt,path:pe})}function Oc(t,e,n="patch"){return U({id:t,form_data:e,query_params:{},method:n,fn:Vt,path:pe})}function Ec(t){return q({form_data:t,query_params:{},fn:Vt,path:pe})}function Ic(t,e={}){return R({id:t,query_params:e,path:pe})}function Mc(t,e={}){return O({query_params:e,fn:n=>new we(n),path:`${pe}/${t}/triggers`})}function Rc(t,e,n,i=1,r=[]){return g({id:t,task_name:`exec/${encodeURIComponent(n+"_"+i)}/${encodeURIComponent(e)}`,form_data:r,path:pe})}var On=(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))(On||{});class cr{id;created_at;updated_at;name;description;authority_id;start_time;play_time;video_length;animation;media_type;orientation;media_uri;media_id;thumbnail_id;play_count;valid_from;valid_until;get media_url(){return this.media_id?`/api/engine/v2/uploads/${this.media_id}/url`:this.media_uri}get thumbnail_url(){return`/api/engine/v2/uploads/${this.thumbnail_id}/url`}constructor(e){this.id=e.id||"",this.created_at=e.created_at||bi(Date.now()),this.updated_at=e.updated_at||bi(Date.now()),this.name=e.name||"",this.description=e.description||"",this.authority_id=e.authority_id||"",this.start_time=e.start_time||0,this.play_time=e.play_time||0,this.video_length=e.video_length||0,this.animation=e.animation,this.media_type=e.media_type||"unknown",this.orientation=e.orientation||"unspecified",this.media_uri=e.media_uri||"",this.media_id=e.media_id||"",this.thumbnail_id=e.thumbnail_id||"",this.play_count=e.play_count||0,this.valid_from=e.valid_from,this.valid_until=e.valid_until}}class Kt{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 ar{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||On.Cut,this.random=e.random||!1,this.enabled=e.enabled??!0,this.default_duration=e.default_duration??15*1e3,this.valid_from=e.valid_from,this.valid_until=e.valid_until,this.play_hours=e.play_hours||"",this.play_at=e.play_at||"",this.play_cron=e.play_cron||""}}const lr="signage";function Dc(t,e={},n){return w({id:t,query_params:e,fn:i=>i,path:`${lr}`,options:n})}function qc(t){return g({id:t,task_name:"metrics",form_data:{},method:"post",callback:e=>e,path:lr})}const st="signage/media";function Yt(t){return new cr(t)}function Uc(t={}){return O({query_params:t,fn:Yt,path:st})}function Cc(t,e={}){return w({id:t,query_params:e,fn:Yt,path:st})}function Nc(t,e,n="patch"){return U({id:t,form_data:e,query_params:{},method:n,fn:Yt,path:st})}function Fc(t){return q({form_data:t,query_params:{},fn:Yt,path:st})}function jc(t,e={}){return R({id:t,query_params:e,path:st})}const se="signage/playlists";function Jt(t){return new ar(t)}function Lc(t={}){return O({query_params:t,fn:Jt,path:se})}function xc(t,e={}){return w({id:t,query_params:e,fn:Jt,path:se})}function zc(t,e,n="patch"){return U({id:t,form_data:e,query_params:{},method:n,fn:Jt,path:se})}function Hc(t){return q({form_data:t,query_params:{},fn:Jt,path:se})}function Bc(t,e={}){return R({id:t,query_params:e,path:se})}function Wc(t,e={}){return g({id:t,task_name:"media",form_data:e,method:"get",callback:n=>new Kt(n),path:se})}function Qc(t,e={}){return g({id:t,task_name:"media/revisions",form_data:e,method:"get",callback:n=>n.map(i=>new Kt(i)),path:se})}function Zc(t){return g({id:t,task_name:"media/approve",method:"post",path:se})}function Vc(t,e){return g({id:t,task_name:"media",form_data:e,method:"post",path:se,callback:n=>new Kt(n)})}class En{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 fr="/api/staff/v1/surveys/answers";function Kc(t={}){const e=L(t);return X(`${fr}${e?"?"+e:""}`).pipe(I(n=>n.map(i=>new En(i))))}function Yc(t){return $e(`${fr}`,t).pipe(I(e=>e.map(n=>new En(n))))}class ut{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 ct="/api/staff/v1/surveys/invitations";function Jc(t={}){const e=L(t);return X(`${ct}${e?"?"+e:""}`).pipe(I(n=>n.map(i=>new ut(i))))}function Gc(t,e={}){const n=L(e);return X(`${ct}/${t}${n?"?"+n:""}`).pipe(I(i=>new ut(i)))}function Xc(t,e,n="patch"){return(n==="put"?qe:Ve)(`${ct}/${t}`,e).pipe(I(i=>new ut(i)))}function ea(t){return $e(`${ct}`,t).pipe(I(e=>new ut(e)))}function ta(t,e={}){const n=L(e);return Ue(`${ct}/${t}${n?"?"+n:""}`)}class at{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 lt="/api/staff/v1/surveys/questions";function na(t={}){const e=L(t);return X(`${lt}${e?"?"+e:""}`).pipe(I(n=>n.map(i=>new at(i))))}function ia(t,e={}){const n=L(e);return X(`${lt}/${t}${n?"?"+n:""}`).pipe(I(i=>new at(i)))}function ra(t){return $e(`${lt}`,t).pipe(I(e=>new at(e)))}function oa(t,e,n="patch"){return(n==="put"?qe:Ve)(`${lt}/${t}`,e).pipe(I(i=>new at(i)))}function sa(t,e={}){const n=L(e);return Ue(`${lt}/${t}${n?"?"+n:""}`)}class ft{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 ht="/api/staff/v1/surveys";function ua(t={}){const e=L(t);return X(`${ht}${e?"?"+e:""}`).pipe(I(n=>n.map(i=>new ft(i))))}function ca(t,e={}){const n=L(e);return X(`${ht}/${t}${n?"?"+n:""}`).pipe(I(i=>new ft(i)))}function aa(t,e,n="patch"){return(n==="put"?qe:Ve)(`${ht}/${t}`,e).pipe(I(i=>new ft(i)))}function la(t){return $e(`${ht}`,t).pipe(I(e=>new ft(e)))}function fa(t,e={}){const n=L(e);return Ue(`${ht}/${t}${n?"?"+n:""}`)}var ha={url:"",deserializer:function(t){return JSON.parse(t.data)},serializer:function(t){return JSON.stringify(t)}},da="WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }",pa=function(t){G(e,t);function e(n,i){var r=t.call(this)||this;if(r._socket=null,n instanceof D)r.destination=i,r.source=n;else{var o=r._config=ze({},ha);if(r._output=new ge,typeof n=="string")o.url=n;else for(var s in n)n.hasOwnProperty(s)&&(o[s]=n[s]);if(!o.WebSocketCtor&&WebSocket)o.WebSocketCtor=WebSocket;else if(!o.WebSocketCtor)throw new Error("no WebSocket constructor can be found");r.destination=new fn}return r}return e.prototype.lift=function(n){var i=new e(this._config,this.destination);return i.operator=n,i.source=this,i},e.prototype._resetState=function(){this._socket=null,this.source||(this.destination=new fn),this._output=new ge},e.prototype.multiplex=function(n,i,r){var o=this;return new D(function(s){try{o.next(n())}catch(a){s.error(a)}var c=o.subscribe({next:function(a){try{r(a)&&s.next(a)}catch(f){s.error(f)}},error:function(a){return s.error(a)},complete:function(){return s.complete()}});return function(){try{o.next(i())}catch(a){s.error(a)}c.unsubscribe()}})},e.prototype._connectSocket=function(){var n=this,i=this._config,r=i.WebSocketCtor,o=i.protocol,s=i.url,c=i.binaryType,a=this._output,f=null;try{f=o?new r(s,o):new r(s),this._socket=f,c&&(this._socket.binaryType=c)}catch(y){a.error(y);return}var _=new ye(function(){n._socket=null,f&&f.readyState===1&&f.close()});f.onopen=function(y){var m=n._socket;if(!m){f.close(),n._resetState();return}var l=n._config.openObserver;l&&l.next(y);var d=n.destination;n.destination=St.create(function(h){if(f.readyState===1)try{var k=n._config.serializer;f.send(k(h))}catch(v){n.destination.error(v)}},function(h){var k=n._config.closingObserver;k&&k.next(void 0),h&&h.code?f.close(h.code,h.reason):a.error(new TypeError(da)),n._resetState()},function(){var h=n._config.closingObserver;h&&h.next(void 0),f.close(),n._resetState()}),d&&d instanceof fn&&_.add(d.subscribe(n.destination))},f.onerror=function(y){n._resetState(),a.error(y)},f.onclose=function(y){f===n._socket&&n._resetState();var m=n._config.closeObserver;m&&m.next(y),y.wasClean?a.complete():a.error(y)},f.onmessage=function(y){try{var m=n._config.deserializer;a.next(m(y))}catch(l){a.error(l)}}},e.prototype._subscribe=function(n){var i=this,r=this.source;return r?r.subscribe(n):(this._socket||this._connectSocket(),this._output.subscribe(n),n.add(function(){var o=i._socket;i._output.observers.length===0&&(o&&(o.readyState===1||o.readyState===0)&&o.close(),i._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}(an);function ma(t){return new pa(t)}var ee=(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))(ee||{}),In=(t=>(t.Info="info",t.Debug="debug",t.Warning="warn",t.Error="error",t.Fatal="fatal",t.Trace="trace",t))(In||{});class hr{constructor(e,n){this._system=e;const i=Object.getOwnPropertyNames(Object.getPrototypeOf(n)).filter(r=>r.startsWith("$"));for(const r in n)n.hasOwnProperty(r)&&n[r]!==void 0&&(n[r]instanceof Function?this.addMethod(r,n[r]):this.addProperty(r,n[r]));for(const r of i)n[r]instanceof Function&&this.addMethod(r,n[r])}call(e,n=[]){return this[`$${e}`]instanceof Function?this[`$${e}`](...n):null}listen(e){return!this[`_${e}`]&&!(this[`_${e}_obs`]instanceof D)&&!this[e]&&this.addProperty(e,null),this[`_${e}_obs`]}addMethod(e,n){e[0]!=="$"&&(e=`$${e}`),this[e]=n}addProperty(e,n){e[0]==="$"&&(e=e.replace("$","")),this[`_${e}`]=new ue(n),this[`_${e}_obs`]=this[`_${e}`].asObservable(),Object.defineProperty(this,e,{get:()=>this[`_${e}`].getValue(),set:i=>this[`_${e}`].next(i)})}}class dr{constructor(e){for(const n in e)e.hasOwnProperty(n)&&e[n]&&e[n]instanceof Array&&e[n].forEach(i=>{this.addModule(n,i)})}addModule(e,n){this[e]||(this[e]=[]),this[e].push(new hr(this,n))}}const Gt={};function _a(t,e){return Gt[t]=new dr(e),Gt[t]}function pr(t){return Gt[t]}function ya(t){delete Gt[t]}const mr=15;let dt=0,J,_r=0;const B={},Mn={},Oe={},ga={},Ee=new ue(!1);Oe._place_os_status=Ee.asObservable();const yr=new ue([0,0]);Oe._place_os_sync=yr.asObservable();let gr=Date.now(),Le,Xt=0,me=null,en,Rn=0;const pt=10*1e3,Dn=new ge;Oe._place_os_debug_events=Dn.asObservable();function tn(){return fe().indexOf("/control/")>=0?"/control/websocket":`${_n()}/systems/control`}function qn(){return Ee.getValue()}function vr(){return Oe._place_os_status}function va(){return Oe._place_os_status}function br(t,e=Mn,n=Oe){const i=`${t.sys}|${t.mod}_${t.index}|${t.name}`;return e[i]||(e[i]=new ue(void 0),n[i]=e[i].asObservable()),n[i]}function Sr(t,e=Mn){const n=`${t.sys}|${t.mod}_${t.index}|${t.name}`;if(e[n])return e[n].getValue()}function Un(t,e=0,n=xe){const i={id:++dt,cmd:"bind",...t};return n(i,e)}function kr(t,e=0,n=xe){const i={id:++dt,cmd:"unbind",...t};return n(i,e)}function $r(t,e=pt,n=xe){const i={id:++dt,cmd:"exec",...t};return n(i,e)}function ba(t,e=pt,n=xe){const i={id:++dt,cmd:"debug",...t};return n(i,e)}function Sa(t,e=pt,n=xe){const i={id:++dt,cmd:"ignore",...t};return n(i,e)}function xe(t,e=pt,n=0){const i=`${t.cmd}|${t.sys}|${t.mod}${t.index}|${t.name}|${t.args}|${Ti()}`;if(B[i])p("WS","Request already in progress. Waiting...",t);else{const r={...t,key:i};r.promise=new Promise((o,s)=>{const c=()=>{delete B[i],B[i]=null,xe(t,e,n).then(a=>o(a),a=>s(a))};if(J&&qn()){It()&&Oa(t,J,ga),r.resolve=o,r.reject=s;const a=`${t.sys}, ${t.mod}_${t.index}, ${t.name}`;p("WS",`[${t.cmd.toUpperCase()}](${t.id}) ${a}`,t.args),J.next(t),e>0&&oe(`${i}`,()=>{s("Request timed out."),delete B[i],B[i]=null},e)}else me?setTimeout(()=>c(),1e3):Cn().then(()=>c())}),B[i]=r}return B[i].promise}function Ar(t){if(t!=="pong"&&t instanceof Object){if(t.type==="notify"&&t.meta)Aa(t.meta,t.value);else if(t.type==="success")ka(t);else if(t.type==="debug"){p("WS",`[DEBUG] ${t.mod}${t.klass||""} →`,t.msg);const e=t.meta||{mod:"",index:""};Dn.next({mod_id:t.mod||"<empty>",module:`${e.mod}_${e.index}`,class_name:t.klass||"<empty>",message:t.msg||"<empty>",level:t.level||In.Debug,time:Math.floor(new Date().getTime()/1e3)})}else t.type==="error"?$a(t):t.cmd||p("WS","Invalid websocket message",t,"error");Se(`${t.id}`)}else t==="pong"&&(Rn=Date.now(),p("WS","Pong!"))}function ka(t){const e=Object.keys(B).map(n=>B[n]).find(n=>n?.id===t.id);p("WS",`[SUCCESS](${t.id})`),e&&e.resolve&&(e.resolve(t.value),delete B[e.key])}function $a(t){let e="UNEXPECTED FAILURE";switch(t.code){case ee.ACCESS_DENIED:e="ACCESS DENIED";break;case ee.BAD_REQUEST:e="BAD REQUEST";break;case ee.MOD_NOT_FOUND:e="MODULE NOT FOUND";break;case ee.SYS_NOT_FOUND:e="SYSTEM NOT FOUND";break;case ee.PARSE_ERROR:e="PARSE ERROR";break;case ee.REQUEST_FAILED:e="REQUEST FAILED";break;case ee.UNKNOWN_CMD:e="UNKNOWN COMMAND";break}p("WS",`[ERROR] ${e}(${t.id}): ${t.msg}`,void 0,"error");const n=Object.keys(B).map(i=>B[i]).filter(i=>i).find(i=>i.id===t.id);n&&n.reject&&(n.reject(t),Se(`${n.key}`),delete B[n.key])}function Aa(t,e,n=Mn,i=Oe){const r=`${t.sys}|${t.mod}_${t.index}|${t.name}`;n[r]||(n[r]=new ue(null),i[r]=n[r].asObservable());const o=`${t.sys}, ${t.mod}_${t.index}, ${t.name}`;p("WS",`[NOTIFY] ${o} changed`,[n[r].getValue(),"→",e]),n[r].next(e)}function Cn(t=0){return me==null&&(me=new Promise(e=>{if(t>40)return location.reload();Xt++,gr=Date.now(),J=It()?Ta():wa(),J?(p("WS(Debug)","Authority:",[Ze()]),p("WS","Connecting to websocket..."),J.subscribe(n=>{Ee.getValue()||(p("WS","Connection established."),e()),Ee.next(!0),Xt=0,Nn(),Ar(n)},n=>{J=void 0,me=null,Pr(),Nn(),Pa(n)},()=>{J=void 0,me=null,Pr(),p("WS","Connection closed by browser."),Ee.next(!1),nn()}),Le&&clearInterval(Le),Rn=Date.now(),wr(),Le=setInterval(()=>wr(),mr*1e3),Nn(),_r+=1,en=setTimeout(()=>{p("WS","Unhealthy connection. Reconnecting..."),Ee.next(!1),me=null,nn()},30*1e3)):(J?p("WS",`Waiting on auth(${t}). Retrying in ${1e3*Math.min(10,t+1)}ms...`,[!!V(),!!Ze()],"info"):p("WS",`Failed to create websocket(${t}). Retrying in ${1e3*Math.min(10,t+1)}ms...`,void 0,"error"),setTimeout(()=>{me=null,Cn(t).then(n=>e(n))},1e3*Math.min(10,++t)))})),me}function wa(){if(!Ze()||!V())return null;const t=Ri()||location.protocol.indexOf("https")>=0;let e=`ws${t?"s":""}://${Et()}${tn()}${yn()?"?fixed_device=true":""}`;const n=V();let i=n==="x-api-key"?`api-key=${Qe()}`:`bearer_token=${n}`;return!jo()&&!wi()?(p("WS","Authenticating through cookie..."),i+=`;max-age=120;path=${tn()};`,i+=`${t?"secure;":""}samesite=strict`,document.cookie=i,p("WS","Cookies:",[document.cookie,i])):(p("WS","Authenticating through URL query parameter..."),e+=`${e.indexOf("?")>=0?"&":"?"}${i}`),p("WS",`Creating websocket connection to ws${t?"s":""}://${Et()}${tn()}`),ma({url:e,serializer:r=>typeof r=="object"?JSON.stringify(r):r,deserializer:r=>{let o=r.data;if(o==="pong")return o;try{return JSON.parse(r.data)}catch{return o}}})}function nn(){yr.next([_r,Date.now()-gr]),J&&qn()&&(J.complete(),Le&&(clearInterval(Le),Le=void 0)),p("WS",`Reconnecting in ${Math.min(5e3,Xt*300||1e3)}ms...`),oe("reconnect",()=>Cn(),Math.min(5e3,(Xt+1)*300||1e3))}function wr(){if(Date.now()-Rn>4*mr*1e3)return nn();J?.next("ping")}function Pa(t){Ee.next(!1),p("WS","Websocket error:",t,void 0,"error"),t.status===401&&Dt(),gn(),nn()}function Nn(){en&&(clearTimeout(en),en=void 0)}function Ta(){const t=new ge;return t.subscribe(e=>Ar(e)),t}function Oa(t,e,n){const i=`${t.sys}|${t.mod}_${t.index}|${t.name}`,r=pr(t.sys),o=r&&r[t.mod]?r[t.mod][t.index-1||0]:null;if(o){switch(t.cmd){case"bind":n[i]=o.listen(t.name).subscribe(s=>{setTimeout(()=>{e.next({type:"notify",value:s,meta:t})},Math.floor(Math.random()*100+50))});break;case"unbind":n[i]&&(n[i].unsubscribe(),delete n[i],Se(`${i}`));break}oe(`${t.id}-response`,()=>{const s={id:t.id,type:"success",value:t.cmd==="exec"?o.call(t.name,t.args):null};e.next(s)},10)}else oe(`${t.id}-error`,()=>e.next({id:t.id,type:"error",code:r?ee.SYS_NOT_FOUND:ee.MOD_NOT_FOUND}),10)}function Pr(){for(const t in B)B[t]&&delete B[t]}class Fn{constructor(e,n){this._module=e,this.name=n,vr().pipe(go()).subscribe(i=>{i&&(this._stale_bindings||this._pending===1)?(p("VAR","Re-binding to status variable",this.binding()),this.rebind()):i||(Se(`rebind:${JSON.stringify(this.binding())}`),p("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 Sr(this.binding())}listen(){return br(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,Un(this.binding()).then(()=>{this._binding_count++,this._pending=0}).catch(()=>null)),()=>this.unbind()}unbind(){this._binding_count===1&&this._pending===0?(this._pending=2,kr(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 Un(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 Tr{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 Fn(this,e)),this._bindings[e]}variable(e){return this._bindings[e]||(this._bindings[e]=new Fn(this,e)),this._bindings[e]}execute(e,n,i=pt){return $r({sys:this._system.id,mod:this.name,index:this.index,name:e,args:n},i)}}class Or{id;_module_list={};constructor(e){this.id=e}module(e,n=1){if(!e)throw new Error("Invalid module ID");const i=e.split("_");i.length>1&&Number.isInteger(+i[i.length-1])&&(n=+i[i.length-1],i.pop()),n<1&&(n=1);const r=i.join("_");for(this._module_list[r]||(this._module_list[r]=[]);this._module_list[r].length<n;)this._module_list[r].push(new Tr(this,`${r}_${this._module_list[r].length+1}`));return this._module_list[r][n-1]}}const jn={};function Er(t){return jn[t]||(jn[t]=new Or(t)),jn[t]}function Ea(t,e,n=1){return Er(t).module(e,n)}u.AuthType=Zi,u.EncryptionLevel=Ae,u.MediaAnimation=On,u.MockPlaceWebsocketModule=hr,u.MockPlaceWebsocketSystem=dr,u.PlaceApplication=Hi,u.PlaceCluster=Ki,u.PlaceDomain=Ji,u.PlaceDriver=$n,u.PlaceDriverRole=Xe,u.PlaceEdge=Gi,u.PlaceErrorCodes=ee,u.PlaceLDAPSource=Xi,u.PlaceLogLevel=In,u.PlaceMQTTBroker=Vi,u.PlaceMetadata=An,u.PlaceModule=Pn,u.PlaceModuleBinding=Tr,u.PlaceOAuthSource=tr,u.PlaceProcess=Yi,u.PlaceRepository=nr,u.PlaceRepositoryType=Tn,u.PlaceResource=H,u.PlaceSAMLSource=ir,u.PlaceSettings=he,u.PlaceSystem=wn,u.PlaceSystemBinding=Or,u.PlaceTrigger=we,u.PlaceUser=ur,u.PlaceVariableBinding=Fn,u.PlaceZone=zt,u.PlaceZoneMetadata=er,u.SignageMedia=cr,u.SignagePlaylist=ar,u.SignagePlaylistMedia=Kt,u.Survey=ft,u.SurveyAnswer=En,u.SurveyInvitation=ut,u.SurveyQuestion=at,u.TriggerConditionOperator=rr,u.TriggerTimeConditionType=or,u.TriggerWebhookType=sr,u.addAnswer=Yc,u.addApplication=_s,u.addBroker=Ss,u.addDomain=Is,u.addDriver=Us,u.addEdge=Hs,u.addInvitation=ea,u.addLDAPSource=Ks,u.addMetadata=nu,u.addModule=cu,u.addOAuthSource=bu,u.addQuestion=ra,u.addRepository=wu,u.addSAMLSource=Lu,u.addSettings=Wu,u.addSignageMedia=Fc,u.addSignagePlaylist=Hc,u.addSurvey=la,u.addSystem=Gu,u.addSystemModule=ec,u.addSystemTrigger=lc,u.addTrigger=_c,u.addUser=$c,u.addZone=Ec,u.apiEndpoint=fe,u.apiKey=Qe,u.approveSignagePlaylist=Zc,u.authorise=vn,u.authority=Ze,u.bind=Un,u.cleanObject=Ai,u.cleanupAuth=Wo,u.clientId=Oi,u.connectionState=va,u.consoleHasColours=dn,u.convertPairStringToMap=Re,u.create=q,u.currentUser=Sc,u.debug=ba,u.debug_events=Dn,u.del=Ue,u.deregisterMockEndpoint=ji,u.deregisterSystem=ya,u.execute=$r,u.executeOnSystem=rc,u.executeOnZone=Rc,u.functionList=uc,u.generateNonce=ki,u.get=X,u.getFragments=pn,u.getModule=Ea,u.getSystem=Er,u.hasToken=Ii,u.host=Et,u.httpRoute=_n,u.humanReadableByteCount=Be,u.ignore=Sa,u.invalidateToken=Dt,u.isDriverCompiled=js,u.isFixedDevice=yn,u.isMobileSafari=wi,u.isMock=It,u.isNestedFrame=Pi,u.isOnline=zo,u.isSecure=Ri,u.isTrusted=Mt,u.is_connected=qn,u.lastRequestTotal=fs,u.listChildMetadata=ru,u.listInterfaceRepositories=Tu,u.listMetadata=Js,u.listMetadataHistory=Xs,u.listRemoteRepositoryBranches=Eu,u.listRemoteRepositoryCommits=Iu,u.listRemoteRepositoryDefaultBranch=Ou,u.listRepositoryBranches=Du,u.listRepositoryCommits=Ru,u.listRepositoryDefaultBranch=qu,u.listRepositoryDriverDetails=Uu,u.listRepositoryDrivers=Mu,u.listSignagePlaylistMedia=Wc,u.listSignagePlaylistMediaRevisions=Qc,u.listSystemTriggers=ac,u.listSystemZones=cc,u.listTriggerInstances=gc,u.listZoneTags=Pc,u.listZoneTriggers=Mc,u.listen=br,u.listenForToken=Mi,u.loadModule=pu,u.log=p,u.logout=Qo,u.lookupModuleState=du,u.lookupSystemModuleState=sc,u.mockSystem=pr,u.moduleRuntimeError=_u,u.moduleSettings=mu,u.moduleState=hu,u.onlineState=Ho,u.parseLinkHeader=$i,u.patch=Ve,u.post=$e,u.pullRepositoryChanges=Cu,u.put=qe,u.query=O,u.queryAnswers=Kc,u.queryApplications=ds,u.queryBrokers=gs,u.queryClusters=As,u.queryDomains=Ts,u.queryDrivers=Rs,u.queryEdges=Ls,u.queryInvitations=Jc,u.queryLDAPSources=Qs,u.queryModules=ou,u.queryOAuthSources=yu,u.queryProcesses=ws,u.queryQuestions=na,u.queryRepositories=ku,u.querySAMLSources=Nu,u.querySettings=zu,u.querySignageMedia=Uc,u.querySignagePlaylists=Lc,u.querySurveys=ua,u.querySystems=Vu,u.querySystemsWithEmails=Ku,u.queryTriggers=dc,u.queryUsers=vc,u.queryZones=wc,u.recompileDriver=Ns,u.redirectUri=Lo,u.refreshAuthority=gn,u.refreshToken=Ot,u.registerMockEndpoint=rs,u.registerSystem=_a,u.reloadDriver=Fs,u.remove=R,u.removeApplication=ys,u.removeBroker=ks,u.removeDomain=Ms,u.removeDriver=Cs,u.removeEdge=Bs,u.removeFragment=ce,u.removeInvitation=ta,u.removeLDAPSource=Ys,u.removeMetadata=iu,u.removeModule=au,u.removeOAuthSource=Su,u.removeQuestion=sa,u.removeRepository=Pu,u.removeSAMLSource=xu,u.removeSettings=Qu,u.removeSignageMedia=jc,u.removeSignagePlaylist=Bc,u.removeSurvey=fa,u.removeSystem=Xu,u.removeSystemModule=tc,u.removeSystemTrigger=fc,u.removeTrigger=yc,u.removeUser=Ac,u.removeZone=Ic,u.requestTotal=ls,u.responseHeaders=xi,u.retrieveEdgeToken=Ws,u.setAPI_Key=xo,u.setMockNotFoundHandler=is,u.setToken=Ei,u.settingsHistory=Zu,u.setup=Bo,u.show=w,u.showApplication=ps,u.showBroker=vs,u.showDomain=Os,u.showDriver=Ds,u.showEdge=xs,u.showInvitation=Gc,u.showLDAPSource=Zs,u.showMetadata=eu,u.showModule=su,u.showOAuthSource=gu,u.showQuestion=ia,u.showRepository=$u,u.showSAMLSource=Fu,u.showSettings=Hu,u.showSignage=Dc,u.showSignageMedia=Cc,u.showSignageMetrics=qc,u.showSignagePlaylist=xc,u.showSurvey=ca,u.showSystem=Yu,u.showTrigger=pc,u.showUser=bc,u.showZone=Tc,u.simplifiedTime=Ti,u.startModule=lu,u.startSystem=nc,u.status=vr,u.stopModule=fu,u.stopSystem=ic,u.systemModuleState=oc,u.systemSettings=hc,u.terminateProcess=Ps,u.token=V,u.unbind=kr,u.update=U,u.updateApplication=ms,u.updateBroker=bs,u.updateDomain=Es,u.updateDriver=qs,u.updateEdge=zs,u.updateInvitation=Xc,u.updateLDAPSource=Vs,u.updateMetadata=tu,u.updateModule=uu,u.updateOAuthSource=vu,u.updateQuestion=oa,u.updateRepository=Au,u.updateSAMLSource=ju,u.updateSettings=Bu,u.updateSignageMedia=Nc,u.updateSignagePlaylist=zc,u.updateSignagePlaylistMedia=Vc,u.updateSurvey=aa,u.updateSystem=Ju,u.updateTrigger=mc,u.updateUser=kc,u.updateZone=Oc,u.value=Sr,u.websocketRoute=tn,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
3
+ `):"",this.name="UnsubscriptionError",this.errors=n}});function kt(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var ye=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,i,r,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var c=Ie(s),a=c.next();!a.done;a=c.next()){var h=a.value;h.remove(this)}}catch(f){e={error:f}}finally{try{a&&!a.done&&(n=c.return)&&n.call(c)}finally{if(e)throw e.error}}else s.remove(this);var _=this.initialTeardown;if(q(_))try{_()}catch(f){o=f instanceof an?f.errors:[f]}var y=this._finalizers;if(y){this._finalizers=null;try{for(var m=Ie(y),l=m.next();!l.done;l=m.next()){var d=l.value;try{Vn(d)}catch(f){o=o??[],f instanceof an?o=St(St([],bt(o)),bt(f.errors)):o.push(f)}}}catch(f){i={error:f}}finally{try{l&&!l.done&&(r=m.return)&&r.call(m)}finally{if(i)throw i.error}}}if(o)throw new an(o)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)Vn(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)&&kt(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&kt(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),Qn=ye.EMPTY;function Zn(t){return t instanceof ye||t&&"closed"in t&&q(t.remove)&&q(t.add)&&q(t.unsubscribe)}function Vn(t){q(t)?t():t.unsubscribe()}var Lr={Promise:void 0},Hr={setTimeout:function(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return setTimeout.apply(void 0,St([t,e],bt(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function Kn(t){Hr.setTimeout(function(){throw t})}function Yn(){}function $t(t){t()}var At=function(t){G(e,t);function e(n){var i=t.call(this)||this;return i.isStopped=!1,n?(i.destination=n,Zn(n)&&n.add(i)):i.destination=Wr,i}return e.create=function(n,i,r){return new ln(n,i,r)},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}(ye),zr=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(i){wt(i)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(i){wt(i)}else wt(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){wt(n)}},t}(),ln=function(t){G(e,t);function e(n,i,r){var o=t.call(this)||this,s;return q(n)||!n?s={next:n??void 0,error:i??void 0,complete:r??void 0}:s=n,o.destination=new zr(s),o}return e}(At);function wt(t){Kn(t)}function Br(t){throw t}var Wr={closed:!0,next:Yn,error:Br,complete:Yn},hn=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function fn(t){return t}function xr(t){return t.length===0?fn:t.length===1?t[0]:function(n){return t.reduce(function(i,r){return r(i)},n)}}var U=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,i){var r=this,o=Zr(e)?e:new ln(e,n,i);return $t(function(){var s=r,c=s.operator,a=s.source;o.add(c?c.call(o,a):a?r._subscribe(o):r._trySubscribe(o))}),o},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},t.prototype.forEach=function(e,n){var i=this;return n=Jn(n),new n(function(r,o){var s=new ln({next:function(c){try{e(c)}catch(a){o(a),s.unsubscribe()}},error:o,complete:r});i.subscribe(s)})},t.prototype._subscribe=function(e){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(e)},t.prototype[hn]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return xr(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=Jn(e),new e(function(i,r){var o;n.subscribe(function(s){return o=s},function(s){return r(s)},function(){return i(o)})})},t.create=function(e){return new t(e)},t}();function Jn(t){var e;return(e=t??Lr.Promise)!==null&&e!==void 0?e:Promise}function Qr(t){return t&&q(t.next)&&q(t.error)&&q(t.complete)}function Zr(t){return t&&t instanceof At||Qr(t)&&Zn(t)}function Vr(t){return q(t?.lift)}function ne(t){return function(e){if(Vr(e))return e.lift(function(n){try{return t(n,this)}catch(i){this.error(i)}});throw new TypeError("Unable to lift unknown Observable type")}}function K(t,e,n,i,r){return new Kr(t,e,n,i,r)}var Kr=function(t){G(e,t);function e(n,i,r,o,s,c){var a=t.call(this,n)||this;return a.onFinalize=s,a.shouldUnsubscribe=c,a._next=i?function(h){try{i(h)}catch(_){n.error(_)}}:t.prototype._next,a._error=o?function(h){try{o(h)}catch(_){n.error(_)}finally{this.unsubscribe()}}:t.prototype._error,a._complete=r?function(){try{r()}catch(h){n.error(h)}finally{this.unsubscribe()}}:t.prototype._complete,a}return e.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var i=this.closed;t.prototype.unsubscribe.call(this),!i&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},e}(At),Yr=xn(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),ge=function(t){G(e,t);function e(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return e.prototype.lift=function(n){var i=new dn(this,this);return i.operator=n,i},e.prototype._throwIfClosed=function(){if(this.closed)throw new Yr},e.prototype.next=function(n){var i=this;$t(function(){var r,o;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var s=Ie(i.currentObservers),c=s.next();!c.done;c=s.next()){var a=c.value;a.next(n)}}catch(h){r={error:h}}finally{try{c&&!c.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}})},e.prototype.error=function(n){var i=this;$t(function(){if(i._throwIfClosed(),!i.isStopped){i.hasError=i.isStopped=!0,i.thrownError=n;for(var r=i.observers;r.length;)r.shift().error(n)}})},e.prototype.complete=function(){var n=this;$t(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var i=n.observers;i.length;)i.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 i=this,r=this,o=r.hasError,s=r.isStopped,c=r.observers;return o||s?Qn:(this.currentObservers=null,c.push(n),new ye(function(){i.currentObservers=null,kt(c,n)}))},e.prototype._checkFinalizedStatuses=function(n){var i=this,r=i.hasError,o=i.thrownError,s=i.isStopped;r?n.error(o):s&&n.complete()},e.prototype.asObservable=function(){var n=new U;return n.source=this,n},e.create=function(n,i){return new dn(n,i)},e}(U),dn=function(t){G(e,t);function e(n,i){var r=t.call(this)||this;return r.destination=n,r.source=i,r}return e.prototype.next=function(n){var i,r;(r=(i=this.destination)===null||i===void 0?void 0:i.next)===null||r===void 0||r.call(i,n)},e.prototype.error=function(n){var i,r;(r=(i=this.destination)===null||i===void 0?void 0:i.error)===null||r===void 0||r.call(i,n)},e.prototype.complete=function(){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||i===void 0||i.call(n)},e.prototype._subscribe=function(n){var i,r;return(r=(i=this.source)===null||i===void 0?void 0:i.subscribe(n))!==null&&r!==void 0?r:Qn},e}(ge),ce=function(t){G(e,t);function e(n){var i=t.call(this)||this;return i._value=n,i}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(n){var i=t.prototype._subscribe.call(this,n);return!i.closed&&n.next(this._value),i},e.prototype.getValue=function(){var n=this,i=n.hasError,r=n.thrownError,o=n._value;if(i)throw r;return this._throwIfClosed(),o},e.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},e}(ge),pn={now:function(){return(pn.delegate||Date).now()},delegate:void 0},mn=function(t){G(e,t);function e(n,i,r){n===void 0&&(n=1/0),i===void 0&&(i=1/0),r===void 0&&(r=pn);var o=t.call(this)||this;return o._bufferSize=n,o._windowTime=i,o._timestampProvider=r,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=i===1/0,o._bufferSize=Math.max(1,n),o._windowTime=Math.max(1,i),o}return e.prototype.next=function(n){var i=this,r=i.isStopped,o=i._buffer,s=i._infiniteTimeWindow,c=i._timestampProvider,a=i._windowTime;r||(o.push(n),!s&&o.push(c.now()+a)),this._trimBuffer(),t.prototype.next.call(this,n)},e.prototype._subscribe=function(n){this._throwIfClosed(),this._trimBuffer();for(var i=this._innerSubscribe(n),r=this,o=r._infiniteTimeWindow,s=r._buffer,c=s.slice(),a=0;a<c.length&&!n.closed;a+=o?1:2)n.next(c[a]);return this._checkFinalizedStatuses(n),i},e.prototype._trimBuffer=function(){var n=this,i=n._bufferSize,r=n._timestampProvider,o=n._buffer,s=n._infiniteTimeWindow,c=(s?1:2)*i;if(i<1/0&&c<o.length&&o.splice(0,o.length-c),!s){for(var a=r.now(),h=0,_=1;_<o.length&&o[_]<=a;_+=2)h=_;h&&o.splice(0,h+1)}},e}(ge),Jr=function(t){G(e,t);function e(n,i){return t.call(this)||this}return e.prototype.schedule=function(n,i){return this},e}(ye),Gn={setInterval:function(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return setInterval.apply(void 0,St([t,e],bt(n)))},clearInterval:function(t){return clearInterval(t)},delegate:void 0},Gr=function(t){G(e,t);function e(n,i){var r=t.call(this,n,i)||this;return r.scheduler=n,r.work=i,r.pending=!1,r}return e.prototype.schedule=function(n,i){var r;if(i===void 0&&(i=0),this.closed)return this;this.state=n;var o=this.id,s=this.scheduler;return o!=null&&(this.id=this.recycleAsyncId(s,o,i)),this.pending=!0,this.delay=i,this.id=(r=this.id)!==null&&r!==void 0?r:this.requestAsyncId(s,this.id,i),this},e.prototype.requestAsyncId=function(n,i,r){return r===void 0&&(r=0),Gn.setInterval(n.flush.bind(n,this),r)},e.prototype.recycleAsyncId=function(n,i,r){if(r===void 0&&(r=0),r!=null&&this.delay===r&&this.pending===!1)return i;i!=null&&Gn.clearInterval(i)},e.prototype.execute=function(n,i){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(n,i);if(r)return r;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(n,i){var r=!1,o;try{this.work(n)}catch(s){r=!0,o=s||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),o},e.prototype.unsubscribe=function(){if(!this.closed){var n=this,i=n.id,r=n.scheduler,o=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,kt(o,this),i!=null&&(this.id=this.recycleAsyncId(r,i,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(Jr),Xn=function(){function t(e,n){n===void 0&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(e,n,i){return n===void 0&&(n=0),new this.schedulerActionCtor(this,e).schedule(i,n)},t.now=pn.now,t}(),Xr=function(t){G(e,t);function e(n,i){i===void 0&&(i=Xn.now);var r=t.call(this,n,i)||this;return r.actions=[],r._active=!1,r}return e.prototype.flush=function(n){var i=this.actions;if(this._active){i.push(n);return}var r;this._active=!0;do if(r=n.execute(n.state,n.delay))break;while(n=i.shift());if(this._active=!1,r){for(;n=i.shift();)n.unsubscribe();throw r}},e}(Xn),ei=new Xr(Gr),eo=ei,to=new U(function(t){return t.complete()});function no(t){return t&&q(t.schedule)}var ti=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function ni(t){return q(t?.then)}function ii(t){return q(t[hn])}function ri(t){return Symbol.asyncIterator&&q(t?.[Symbol.asyncIterator])}function oi(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 io(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var si=io();function ui(t){return q(t?.[si])}function ci(t){return Fr(this,arguments,function(){var n,i,r,o;return Wn(this,function(s){switch(s.label){case 0:n=t.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Me(n.read())];case 3:return i=s.sent(),r=i.value,o=i.done,o?[4,Me(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Me(r)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function ai(t){return q(t?.getReader)}function ie(t){if(t instanceof U)return t;if(t!=null){if(ii(t))return ro(t);if(ti(t))return oo(t);if(ni(t))return so(t);if(ri(t))return li(t);if(ui(t))return uo(t);if(ai(t))return co(t)}throw oi(t)}function ro(t){return new U(function(e){var n=t[hn]();if(q(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function oo(t){return new U(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function so(t){return new U(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,Kn)})}function uo(t){return new U(function(e){var n,i;try{for(var r=Ie(t),o=r.next();!o.done;o=r.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(c){n={error:c}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}e.complete()})}function li(t){return new U(function(e){ao(t,e).catch(function(n){return e.error(n)})})}function co(t){return li(ci(t))}function ao(t,e){var n,i,r,o;return Nr(this,void 0,void 0,function(){var s,c;return Wn(this,function(a){switch(a.label){case 0:a.trys.push([0,5,6,11]),n=jr(t),a.label=1;case 1:return[4,n.next()];case 2:if(i=a.sent(),!!i.done)return[3,4];if(s=i.value,e.next(s),e.closed)return[2];a.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return c=a.sent(),r={error:c},[3,11];case 6:return a.trys.push([6,,9,10]),i&&!i.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:a.sent(),a.label=8;case 8:return[3,10];case 9:if(r)throw r.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function ve(t,e,n,i,r){i===void 0&&(i=0),r===void 0&&(r=!1);var o=e.schedule(function(){n(),r?t.add(this.schedule(null,i)):this.unsubscribe()},i);if(t.add(o),!r)return o}function hi(t,e){return e===void 0&&(e=0),ne(function(n,i){n.subscribe(K(i,function(r){return ve(i,t,function(){return i.next(r)},e)},function(){return ve(i,t,function(){return i.complete()},e)},function(r){return ve(i,t,function(){return i.error(r)},e)}))})}function fi(t,e){return e===void 0&&(e=0),ne(function(n,i){i.add(t.schedule(function(){return n.subscribe(i)},e))})}function lo(t,e){return ie(t).pipe(fi(e),hi(e))}function ho(t,e){return ie(t).pipe(fi(e),hi(e))}function fo(t,e){return new U(function(n){var i=0;return e.schedule(function(){i===t.length?n.complete():(n.next(t[i++]),n.closed||this.schedule())})})}function po(t,e){return new U(function(n){var i;return ve(n,e,function(){i=t[si](),ve(n,e,function(){var r,o,s;try{r=i.next(),o=r.value,s=r.done}catch(c){n.error(c);return}s?n.complete():n.next(o)},0,!0)}),function(){return q(i?.return)&&i.return()}})}function di(t,e){if(!t)throw new Error("Iterable cannot be null");return new U(function(n){ve(n,e,function(){var i=t[Symbol.asyncIterator]();ve(n,e,function(){i.next().then(function(r){r.done?n.complete():n.next(r.value)})},0,!0)})})}function mo(t,e){return di(ci(t),e)}function _o(t,e){if(t!=null){if(ii(t))return lo(t,e);if(ti(t))return fo(t,e);if(ni(t))return ho(t,e);if(ri(t))return di(t,e);if(ui(t))return po(t,e);if(ai(t))return mo(t,e)}throw oi(t)}function yo(t,e){return e?_o(t,e):ie(t)}function pi(t,e){var n=q(t)?t:function(){return t},i=function(r){return r.error(n())};return new U(i)}function go(t){return t instanceof Date&&!isNaN(t)}function I(t,e){return ne(function(n,i){var r=0;n.subscribe(K(i,function(o){i.next(t.call(e,o,r++))}))})}function vo(t,e,n,i,r,o,s,c){var a=[],h=0,_=0,y=!1,m=function(){y&&!a.length&&!h&&e.complete()},l=function(f){return h<i?d(f):a.push(f)},d=function(f){h++;var k=!1;ie(n(f,_++)).subscribe(K(e,function(v){e.next(v)},function(){k=!0},void 0,function(){if(k)try{h--;for(var v=function(){var $=a.shift();s||d($)};a.length&&h<i;)v();m()}catch($){e.error($)}}))};return t.subscribe(K(e,l,function(){y=!0,m()})),function(){}}function mi(t,e,n){return n===void 0&&(n=1/0),q(e)?mi(function(i,r){return I(function(o,s){return e(i,o,r,s)})(ie(t(i,r)))},n):(typeof e=="number"&&(n=e),ne(function(i,r){return vo(i,r,t,n)}))}function _i(t,e,n){t===void 0&&(t=0),n===void 0&&(n=eo);var i=-1;return e!=null&&(no(e)?n=e:i=e),new U(function(r){var o=go(t)?+t-n.now():t;o<0&&(o=0);var s=0;return n.schedule(function(){r.closed||(r.next(s++),0<=i?this.schedule(void 0,i):r.complete())},o)})}function bo(t,e){return ne(function(n,i){var r=0;n.subscribe(K(i,function(o){return t.call(e,o,r++)&&i.next(o)}))})}function yi(t){return t<=0?function(){return to}:ne(function(e,n){var i=0;e.subscribe(K(n,function(r){++i<=t&&(n.next(r),t<=i&&n.complete())}))})}function So(t){return I(function(){return t})}function ko(t,e){return mi(function(n,i){return ie(t(n,i)).pipe(yi(1),So(n))})}function $o(t,e){e===void 0&&(e=ei);var n=_i(t,e);return ko(function(){return n})}function Ao(t,e){return e===void 0&&(e=fn),t=t??wo,ne(function(n,i){var r,o=!0;n.subscribe(K(i,function(s){var c=e(s);(o||!t(r,c))&&(o=!1,r=c,i.next(s))}))})}function wo(t,e){return t===e}function Po(t){t===void 0&&(t=1/0);var e;t&&typeof t=="object"?e=t:e={count:t};var n=e.count,i=n===void 0?1/0:n,r=e.delay,o=e.resetOnSuccess,s=o===void 0?!1:o;return i<=0?fn:ne(function(c,a){var h=0,_,y=function(){var m=!1;_=c.subscribe(K(a,function(l){s&&(h=0),a.next(l)},void 0,function(l){if(h++<i){var d=function(){_?(_.unsubscribe(),_=null,y()):m=!0};if(r!=null){var f=typeof r=="number"?_i(r):ie(r(l,h)),k=K(a,function(){k.unsubscribe(),d()},function(){a.complete()});f.subscribe(k)}else d()}else a.error(l)})),m&&(_.unsubscribe(),_=null,y())};y()})}function gi(t,e){return ne(function(n,i){var r=null,o=0,s=!1,c=function(){return s&&!r&&i.complete()};n.subscribe(K(i,function(a){r?.unsubscribe();var h=0,_=o++;ie(t(a,_)).subscribe(r=K(i,function(y){return i.next(e?e(a,y,_,h++):y)},function(){r=null,c()}))},function(){s=!0,c()}))})}function _n(t,e){e===void 0&&(e={});var n=e.selector,i=Cr(e,["selector"]);return new U(function(r){var o=new AbortController,s=o.signal,c=!0,a=i.signal;if(a)if(a.aborted)o.abort();else{var h=function(){s.aborted||o.abort()};a.addEventListener("abort",h),r.add(function(){return a.removeEventListener("abort",h)})}var _=Be(Be({},i),{signal:s}),y=function(m){c=!1,r.error(m)};return fetch(t,_).then(function(m){n?ie(n(m)).subscribe(K(r,void 0,function(){c=!1,r.complete()},y)):(c=!1,r.next(m),r.complete())}).catch(y),function(){c&&o.abort()}})}const re=["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","+","/"],vi=[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 Pt(t){if(t>=vi.length)throw new Error("Unable to parse base64 string.");const e=vi[t];if(e===255)throw new Error("Unable to parse base64 string.");return e}function bi(t){let e="",n,i=t.length;for(n=2;n<i;n+=3)e+=re[t[n-2]>>2],e+=re[(t[n-2]&3)<<4|t[n-1]>>4],e+=re[(t[n-1]&15)<<2|t[n]>>6],e+=re[t[n]&63];return n===i+1&&(e+=re[t[n-2]>>2],e+=re[(t[n-2]&3)<<4],e+="=="),n===i&&(e+=re[t[n-2]>>2],e+=re[(t[n-2]&3)<<4|t[n-1]>>4],e+=re[(t[n-1]&15)<<2],e+="="),e}function To(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,i=t.length,r=new Uint8Array(3*(i/4)),o;for(let s=0,c=0;s<i;s+=4,c+=3)o=Pt(t.charCodeAt(s))<<18|Pt(t.charCodeAt(s+1))<<12|Pt(t.charCodeAt(s+2))<<6|Pt(t.charCodeAt(s+3)),r[c]=o>>16,r[c+1]=o>>8&255,r[c+2]=o&255;return r.subarray(0,r.length-n)}function Oo(t,e=new TextEncoder){return bi(e.encode(t))}var Tt={exports:{}},Eo=Tt.exports,Si;function Io(){return Si||(Si=1,function(t){(function(e,n){var i={};n(i);var r=i.default;for(var o in i)r[o]=i[o];t.exports=r})(Eo,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 i(m,l,d,f,k){for(var v,$,A,Z,F,E,te,j,B,L,gt,vt,cn;k>=64;){for(v=l[0],$=l[1],A=l[2],Z=l[3],F=l[4],E=l[5],te=l[6],j=l[7],L=0;L<16;L++)gt=f+L*4,m[L]=(d[gt]&255)<<24|(d[gt+1]&255)<<16|(d[gt+2]&255)<<8|d[gt+3]&255;for(L=16;L<64;L++)B=m[L-2],vt=(B>>>17|B<<15)^(B>>>19|B<<13)^B>>>10,B=m[L-15],cn=(B>>>7|B<<25)^(B>>>18|B<<14)^B>>>3,m[L]=(vt+m[L-7]|0)+(cn+m[L-16]|0);for(L=0;L<64;L++)vt=(((F>>>6|F<<26)^(F>>>11|F<<21)^(F>>>25|F<<7))+(F&E^~F&te)|0)+(j+(n[L]+m[L]|0)|0)|0,cn=((v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10))+(v&$^v&A^$&A)|0,j=te,te=E,E=F,F=Z+vt|0,Z=A,A=$,$=v,v=vt+cn|0;l[0]+=v,l[1]+=$,l[2]+=A,l[3]+=Z,l[4]+=F,l[5]+=E,l[6]+=te,l[7]+=j,f+=64,k-=64}return f}var r=function(){function m(){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 m.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},m.prototype.clean=function(){for(var l=0;l<this.buffer.length;l++)this.buffer[l]=0;for(var l=0;l<this.temp.length;l++)this.temp[l]=0;this.reset()},m.prototype.update=function(l,d){if(d===void 0&&(d=l.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var f=0;if(this.bytesHashed+=d,this.bufferLength>0){for(;this.bufferLength<64&&d>0;)this.buffer[this.bufferLength++]=l[f++],d--;this.bufferLength===64&&(i(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(d>=64&&(f=i(this.temp,this.state,l,f,d),d%=64);d>0;)this.buffer[this.bufferLength++]=l[f++],d--;return this},m.prototype.finish=function(l){if(!this.finished){var d=this.bytesHashed,f=this.bufferLength,k=d/536870912|0,v=d<<3,$=d%64<56?64:128;this.buffer[f]=128;for(var A=f+1;A<$-8;A++)this.buffer[A]=0;this.buffer[$-8]=k>>>24&255,this.buffer[$-7]=k>>>16&255,this.buffer[$-6]=k>>>8&255,this.buffer[$-5]=k>>>0&255,this.buffer[$-4]=v>>>24&255,this.buffer[$-3]=v>>>16&255,this.buffer[$-2]=v>>>8&255,this.buffer[$-1]=v>>>0&255,i(this.temp,this.state,this.buffer,0,$),this.finished=!0}for(var A=0;A<8;A++)l[A*4+0]=this.state[A]>>>24&255,l[A*4+1]=this.state[A]>>>16&255,l[A*4+2]=this.state[A]>>>8&255,l[A*4+3]=this.state[A]>>>0&255;return this},m.prototype.digest=function(){var l=new Uint8Array(this.digestLength);return this.finish(l),l},m.prototype._saveState=function(l){for(var d=0;d<this.state.length;d++)l[d]=this.state[d]},m.prototype._restoreState=function(l,d){for(var f=0;f<this.state.length;f++)this.state[f]=l[f];this.bytesHashed=d,this.finished=!1,this.bufferLength=0},m}();e.Hash=r;var o=function(){function m(l){this.inner=new r,this.outer=new r,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var d=new Uint8Array(this.blockSize);if(l.length>this.blockSize)new r().update(l).finish(d).clean();else for(var f=0;f<l.length;f++)d[f]=l[f];for(var f=0;f<d.length;f++)d[f]^=54;this.inner.update(d);for(var f=0;f<d.length;f++)d[f]^=106;this.outer.update(d),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var f=0;f<d.length;f++)d[f]=0}return m.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},m.prototype.clean=function(){for(var l=0;l<this.istate.length;l++)this.ostate[l]=this.istate[l]=0;this.inner.clean(),this.outer.clean()},m.prototype.update=function(l){return this.inner.update(l),this},m.prototype.finish=function(l){return this.outer.finished?this.outer.finish(l):(this.inner.finish(l),this.outer.update(l,this.digestLength).finish(l)),this},m.prototype.digest=function(){var l=new Uint8Array(this.digestLength);return this.finish(l),l},m}();e.HMAC=o;function s(m){var l=new r().update(m),d=l.digest();return l.clean(),d}e.hash=s,e.default=s;function c(m,l){var d=new o(m).update(l),f=d.digest();return d.clean(),f}e.hmac=c;function a(m,l,d,f){var k=f[0];if(k===0)throw new Error("hkdf: cannot expand more");l.reset(),k>1&&l.update(m),d&&l.update(d),l.update(f),l.finish(m),f[0]++}var h=new Uint8Array(e.digestLength);function _(m,l,d,f){l===void 0&&(l=h),f===void 0&&(f=32);for(var k=new Uint8Array([1]),v=c(l,m),$=new o(v),A=new Uint8Array($.digestLength),Z=A.length,F=new Uint8Array(f),E=0;E<f;E++)Z===A.length&&(a(A,$,d,k),Z=0),F[E]=A[Z++];return $.clean(),A.fill(0),k.fill(0),F}e.hkdf=_;function y(m,l,d,f){for(var k=new o(m),v=k.digestLength,$=new Uint8Array(4),A=new Uint8Array(v),Z=new Uint8Array(v),F=new Uint8Array(f),E=0;E*v<f;E++){var te=E+1;$[0]=te>>>24&255,$[1]=te>>>16&255,$[2]=te>>>8&255,$[3]=te>>>0&255,k.reset(),k.update(l),k.update($),k.finish(Z);for(var j=0;j<v;j++)A[j]=Z[j];for(var j=2;j<=d;j++){k.reset(),k.update(Z).finish(Z);for(var B=0;B<v;B++)A[B]^=Z[B]}for(var j=0;j<v&&E*v+j<f;j++)F[E*v+j]=A[j]}for(var E=0;E<v;E++)A[E]=Z[E]=0;for(var E=0;E<4;E++)$[E]=0;return k.clean(),F}e.pbkdf2=y})}(Tt)),Tt.exports}var Mo=Io();const Ro=new Int32Array(4);class x{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 x;static _hex(e){const n=x.hexChars,i=x.hexOut;let r,o,s,c;for(c=0;c<4;c+=1)for(o=c*8,r=e[c],s=0;s<8;s+=2)i[o+1+s]=n.charAt(r&15),r>>>=4,i[o+0+s]=n.charAt(r&15),r>>>=4;return i.join("")}static _md5cycle(e,n){let i=e[0],r=e[1],o=e[2],s=e[3];i+=(r&o|~r&s)+n[0]-680876936|0,i=(i<<7|i>>>25)+r|0,s+=(i&r|~i&o)+n[1]-389564586|0,s=(s<<12|s>>>20)+i|0,o+=(s&i|~s&r)+n[2]+606105819|0,o=(o<<17|o>>>15)+s|0,r+=(o&s|~o&i)+n[3]-1044525330|0,r=(r<<22|r>>>10)+o|0,i+=(r&o|~r&s)+n[4]-176418897|0,i=(i<<7|i>>>25)+r|0,s+=(i&r|~i&o)+n[5]+1200080426|0,s=(s<<12|s>>>20)+i|0,o+=(s&i|~s&r)+n[6]-1473231341|0,o=(o<<17|o>>>15)+s|0,r+=(o&s|~o&i)+n[7]-45705983|0,r=(r<<22|r>>>10)+o|0,i+=(r&o|~r&s)+n[8]+1770035416|0,i=(i<<7|i>>>25)+r|0,s+=(i&r|~i&o)+n[9]-1958414417|0,s=(s<<12|s>>>20)+i|0,o+=(s&i|~s&r)+n[10]-42063|0,o=(o<<17|o>>>15)+s|0,r+=(o&s|~o&i)+n[11]-1990404162|0,r=(r<<22|r>>>10)+o|0,i+=(r&o|~r&s)+n[12]+1804603682|0,i=(i<<7|i>>>25)+r|0,s+=(i&r|~i&o)+n[13]-40341101|0,s=(s<<12|s>>>20)+i|0,o+=(s&i|~s&r)+n[14]-1502002290|0,o=(o<<17|o>>>15)+s|0,r+=(o&s|~o&i)+n[15]+1236535329|0,r=(r<<22|r>>>10)+o|0,i+=(r&s|o&~s)+n[1]-165796510|0,i=(i<<5|i>>>27)+r|0,s+=(i&o|r&~o)+n[6]-1069501632|0,s=(s<<9|s>>>23)+i|0,o+=(s&r|i&~r)+n[11]+643717713|0,o=(o<<14|o>>>18)+s|0,r+=(o&i|s&~i)+n[0]-373897302|0,r=(r<<20|r>>>12)+o|0,i+=(r&s|o&~s)+n[5]-701558691|0,i=(i<<5|i>>>27)+r|0,s+=(i&o|r&~o)+n[10]+38016083|0,s=(s<<9|s>>>23)+i|0,o+=(s&r|i&~r)+n[15]-660478335|0,o=(o<<14|o>>>18)+s|0,r+=(o&i|s&~i)+n[4]-405537848|0,r=(r<<20|r>>>12)+o|0,i+=(r&s|o&~s)+n[9]+568446438|0,i=(i<<5|i>>>27)+r|0,s+=(i&o|r&~o)+n[14]-1019803690|0,s=(s<<9|s>>>23)+i|0,o+=(s&r|i&~r)+n[3]-187363961|0,o=(o<<14|o>>>18)+s|0,r+=(o&i|s&~i)+n[8]+1163531501|0,r=(r<<20|r>>>12)+o|0,i+=(r&s|o&~s)+n[13]-1444681467|0,i=(i<<5|i>>>27)+r|0,s+=(i&o|r&~o)+n[2]-51403784|0,s=(s<<9|s>>>23)+i|0,o+=(s&r|i&~r)+n[7]+1735328473|0,o=(o<<14|o>>>18)+s|0,r+=(o&i|s&~i)+n[12]-1926607734|0,r=(r<<20|r>>>12)+o|0,i+=(r^o^s)+n[5]-378558|0,i=(i<<4|i>>>28)+r|0,s+=(i^r^o)+n[8]-2022574463|0,s=(s<<11|s>>>21)+i|0,o+=(s^i^r)+n[11]+1839030562|0,o=(o<<16|o>>>16)+s|0,r+=(o^s^i)+n[14]-35309556|0,r=(r<<23|r>>>9)+o|0,i+=(r^o^s)+n[1]-1530992060|0,i=(i<<4|i>>>28)+r|0,s+=(i^r^o)+n[4]+1272893353|0,s=(s<<11|s>>>21)+i|0,o+=(s^i^r)+n[7]-155497632|0,o=(o<<16|o>>>16)+s|0,r+=(o^s^i)+n[10]-1094730640|0,r=(r<<23|r>>>9)+o|0,i+=(r^o^s)+n[13]+681279174|0,i=(i<<4|i>>>28)+r|0,s+=(i^r^o)+n[0]-358537222|0,s=(s<<11|s>>>21)+i|0,o+=(s^i^r)+n[3]-722521979|0,o=(o<<16|o>>>16)+s|0,r+=(o^s^i)+n[6]+76029189|0,r=(r<<23|r>>>9)+o|0,i+=(r^o^s)+n[9]-640364487|0,i=(i<<4|i>>>28)+r|0,s+=(i^r^o)+n[12]-421815835|0,s=(s<<11|s>>>21)+i|0,o+=(s^i^r)+n[15]+530742520|0,o=(o<<16|o>>>16)+s|0,r+=(o^s^i)+n[2]-995338651|0,r=(r<<23|r>>>9)+o|0,i+=(o^(r|~s))+n[0]-198630844|0,i=(i<<6|i>>>26)+r|0,s+=(r^(i|~o))+n[7]+1126891415|0,s=(s<<10|s>>>22)+i|0,o+=(i^(s|~r))+n[14]-1416354905|0,o=(o<<15|o>>>17)+s|0,r+=(s^(o|~i))+n[5]-57434055|0,r=(r<<21|r>>>11)+o|0,i+=(o^(r|~s))+n[12]+1700485571|0,i=(i<<6|i>>>26)+r|0,s+=(r^(i|~o))+n[3]-1894986606|0,s=(s<<10|s>>>22)+i|0,o+=(i^(s|~r))+n[10]-1051523|0,o=(o<<15|o>>>17)+s|0,r+=(s^(o|~i))+n[1]-2054922799|0,r=(r<<21|r>>>11)+o|0,i+=(o^(r|~s))+n[8]+1873313359|0,i=(i<<6|i>>>26)+r|0,s+=(r^(i|~o))+n[15]-30611744|0,s=(s<<10|s>>>22)+i|0,o+=(i^(s|~r))+n[6]-1560198380|0,o=(o<<15|o>>>17)+s|0,r+=(s^(o|~i))+n[13]+1309151649|0,r=(r<<21|r>>>11)+o|0,i+=(o^(r|~s))+n[4]-145523070|0,i=(i<<6|i>>>26)+r|0,s+=(r^(i|~o))+n[11]-1120210379|0,s=(s<<10|s>>>22)+i|0,o+=(i^(s|~r))+n[2]+718787259|0,o=(o<<15|o>>>17)+s|0,r+=(s^(o|~i))+n[9]-343485551|0,r=(r<<21|r>>>11)+o|0,e[0]=i+e[0]|0,e[1]=r+e[1]|0,e[2]=o+e[2]|0,e[3]=s+e[3]|0}_dataLength=0;_bufferLength=0;_state=new Int32Array(4);_buffer=new ArrayBuffer(68);_buffer8;_buffer32;constructor(){this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(x.stateIdentity),this}appendStr(e){const n=this._buffer8,i=this._buffer32;let r=this._bufferLength,o,s;for(s=0;s<e.length;s+=1){if(o=e.charCodeAt(s),o<128)n[r++]=o;else if(o<2048)n[r++]=(o>>>6)+192,n[r++]=o&63|128;else if(o<55296||o>56319)n[r++]=(o>>>12)+224,n[r++]=o>>>6&63|128,n[r++]=o&63|128;else{if(o=(o-55296)*1024+(e.charCodeAt(++s)-56320)+65536,o>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");n[r++]=(o>>>18)+240,n[r++]=o>>>12&63|128,n[r++]=o>>>6&63|128,n[r++]=o&63|128}r>=64&&(this._dataLength+=64,x._md5cycle(this._state,i),r-=64,i[0]=i[16])}return this._bufferLength=r,this}appendAsciiStr(e){const n=this._buffer8,i=this._buffer32;let r=this._bufferLength,o,s=0;for(;;){for(o=Math.min(e.length-s,64-r);o--;)n[r++]=e.charCodeAt(s++);if(r<64)break;this._dataLength+=64,x._md5cycle(this._state,i),r=0}return this._bufferLength=r,this}appendByteArray(e){const n=this._buffer8,i=this._buffer32;let r=this._bufferLength,o,s=0;for(;;){for(o=Math.min(e.length-s,64-r);o--;)n[r++]=e[s++];if(r<64)break;this._dataLength+=64,x._md5cycle(this._state,i),r=0}return this._bufferLength=r,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,i=e.state,r=this._state;let o;for(this._dataLength=e.length,this._bufferLength=e.buflen,r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],o=0;o<n.length;o+=1)this._buffer8[o]=n.charCodeAt(o)}end(e=!1){const n=this._bufferLength,i=this._buffer8,r=this._buffer32,o=(n>>2)+1;this._dataLength+=n;const s=this._dataLength*8;if(i[n]=128,i[n+1]=i[n+2]=i[n+3]=0,r.set(x.buffer32Identity.subarray(o),o),n>55&&(x._md5cycle(this._state,r),r.set(x.buffer32Identity)),s<=4294967295)r[14]=s;else{const c=s.toString(16).match(/(.*?)(.{0,8})$/);if(c===null)return e?Ro:"";const a=parseInt(c[2],16),h=parseInt(c[1],16)||0;r[14]=a,r[15]=h}return x._md5cycle(this._state,r),e?this._state:x._hex(this._state)}}if(x.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592")throw new Error("Md5 self test failed.");const Do=36e5,ki=Symbol.for("constructDateFrom");function Ot(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&ki in t?t[ki](e):t instanceof Date?new t.constructor(e):new Date(e)}function We(t,e){return Ot(t,t)}function qo(t,e,n){const i=We(t);if(isNaN(e))return Ot(t,NaN);const r=i.getDate(),o=Ot(t,i.getTime());o.setMonth(i.getMonth()+e+1,0);const s=o.getDate();return r>=s?o:(i.setFullYear(o.getFullYear(),o.getMonth(),r),i)}function $i(t,e,n){return Ot(t,+We(t)+e)}function Uo(t,e,n){return $i(t,e*Do)}function Co(t,e,n){return $i(t,e*1e3)}function No(t,e,n){return qo(t,e*12)}function Ai(t){return Math.trunc(+We(t)/1e3)}function Fo(t,e){return+We(t)<+We(e)}function p(t,e,n,i="debug",r){if(window.debug){const s=["color: #0288D1",`color:${r||"#009688"}`,"color: default"];n?yn()?console[i](`%c[PlaceOS]%c[${t}] %c${e}`,...s,n):console[i](`[PlaceOS][${t}] ${e}`,n):yn()?console[i](`%c[PlaceOS]%c[${t}] %c${e}`,...s):console[i](`[PlaceOS][${t}] ${e}`)}}function yn(){return!(document.documentMode||/Edge/.test(navigator.userAgent))}function gn(){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 r=t.split("?");n=Re(r[0]),e||(e=r[1])}else n=Re(t);let i={};return e&&(i=Re(e)),{...n,...i}}function Re(t){const e={},n=t.split("&");for(const i of n){const r=i.split("=");r[1]&&(e[decodeURIComponent(r[0])]=decodeURIComponent(r[1]))}return e}const wi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function Pi(t=40){let e="";for(let n=0;n<t;n++)e+=wi.charAt(Math.floor(Math.random()*wi.length));return e}function ae(t){const e=(window.location?.hash||"").replace(new RegExp(`${t}[a-zA-Z0-9_+-.%=]*&?`,"g"),"").replace(/&&/g,"&").replace(/#&/g,"#").replace(/&$/g,"#"),n=(window.location?.search||"").replace(new RegExp(`${t}[a-zA-Z0-9_+-.%=]*&?`,"g"),"").replace(/&&/g,"&").replace(/\?&/g,"#").replace(/&$/g,"#");window.history?.replaceState&&window.history?.replaceState(null,"",`${window.location?.pathname}${e}${n}`)}function xe(t,e=!1){const n=e?1e3:1024;if(t<n)return t+(e?" iB":" B");const i=Math.floor(Math.log(t)/Math.log(n)),r=(e?"kMGTPE":"KMGTPE").charAt(i-1)+(e?"iB":"B");return(t/Math.pow(n,i)).toFixed(2)+" "+r}function Ti(t){if(t.length===0)throw new Error("Input must not be of zero length");const e=t.split(","),n={};for(const i of e){const r=i.split(";");if(r.length!==2)throw new Error("Section could not be split on ';'");const o=r[0].replace(/<(.*)>/,"$1").trim(),s=r[1].replace(/rel="(.*)"/,"$1").trim();n[s]=o}return n}function Oi(t,e){for(const n in t)t.hasOwnProperty(n)&&e.indexOf(t[n])>=0&&delete t[n];return t}function Ei(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Ii(){return window.location!==window.parent.location}function Mi(t=Date.now(),e=60*1e3){return Math.floor(t/e)}class jo{abort(){p("Stub","Aborted")}}function H(t){let e="";if(t)for(const n in t)t.hasOwnProperty(n)&&t[n]!==void 0&&t[n]!==null&&(e+=`${e?"&":""}${n}=${encodeURIComponent(t[n])}`);return e}const be={},Qe={},le={};function Lo(){for(const t in be)be.hasOwnProperty(t)&&Se(t);for(const t in Qe)Qe.hasOwnProperty(t)&&Ho(t);for(const t in le)le.hasOwnProperty(t)&&zo(t)}function oe(t,e,n=300){if(t&&e&&e instanceof Function)Se(t),be[t]=setTimeout(()=>{e(),delete be[t]},n);else throw new Error(t?"Cannot create named timeout without a name":"Cannot create a timeout without a callback")}function Se(t){be[t]&&(clearTimeout(be[t]),delete be[t])}function Ho(t){Qe[t]&&(clearInterval(Qe[t]),delete Qe[t])}function zo(t){le&&le[t]&&(le[t]instanceof ye?le[t].unsubscribe():le[t](),delete le[t])}const Bo={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 b={},T,z;const S={};let O="",ke="";const De=new ce(""),Et=new ce("");let vn="/api/engine/v2";const he=new ce(!1),Wo=he.asObservable();let It=0;function fe(){return`${`${b.secure||window.location?.protocol.indexOf("https")>=0?"https:":"http:"}//${b.host||window.location?.host}`}${bn()}`}function bn(){return b.version==="ACA Engine"?"/control/api":vn}function xo(){return!!b.token_header}function Ri(){return O}function Qo(){return b.redirect_uri}function Zo(t,e=!0){T.setItem(`${O}_x-api-key`,`${t}`),T.setItem("trusted",`${e}`),Di("x-api-key",No(new Date,5).valueOf())}function Ze(){return Ut("x-api-key",!1)||""}function Di(t,e=Uo(new Date,2).valueOf()){b.ignore_api_key&&t==="x-api-key"||(T.setItem(`${O}_expires_at`,`${e}`),T.setItem(`${O}_access_token`,t))}function V(t=!0){if(b.mock)return"mock-token";if(!T)return"";if(Ze()&&!b.ignore_api_key)return"x-api-key";const e=T.getItem(`${O}_expires_at`)||"",n=De.getValue();return Fo(+e,new Date)&&(p("Auth","Token expired. Requesting new token..."),Ct(),S.load_authority||(It+=1,oe("re-authorise",()=>$n().catch(i=>p("Auth",`Failed to get token: ${i}`)),200*Math.min(20,It))),!t)?"":n||T.getItem(`${O}_access_token`)||""}function Mt(){return Et.getValue()||T.getItem(`${O}_refresh_token`)||""}function Rt(){return b.host||window.location?.host}function qi(){return!!V()}function Ui(){return De.pipe(I(t=>!!qi()))}function Ve(){return z}function Vo(){return he.getValue()}function Dt(){return!!b.mock}function Ci(){return!!b.secure}function Ko(){return Wo}function qt(){return Ut("trust")==="true"||Ut("trusted")==="true"}function Sn(){return!!Ze()&&!b.ignore_api_key||Ut("fixed_device")==="true"}function Ut(t,e=!0){let i=gn()[t];if(T){const r=`${Ri()}_${t}`;i=i||T.getItem(r)||T.getItem(t)||"",e&&T.setItem(r,`${i}`)}return i}function Yo(t){return b=t||b,b.token_header=b.token_header??Ii(),window.AbortController||(window.AbortController=jo),T=b.storage==="session"?sessionStorage:localStorage,O=x.hashStr(b.redirect_uri,!1),An()}function Jo(){b={},z=void 0,De.next(""),Et.next(""),he.next(!1),O="",ke="",vn="/api/engine/v2";for(const t in S)t in S&&delete S[t];Lo()}function kn(){return p("Auth","Refreshing authorty."),z=void 0,An()}function Ct(){p("Auth","Invalidating tokens."),T.removeItem(`${O}_access_token`),T.removeItem(`${O}_expires_at`),De.getValue()&&De.next("")}function $n(t,e=z){return S.authorise||(S.authorise=new Promise((n,i)=>{if(!e)return delete S.authorise,i("Authority is not loaded");p("Auth","Authorising user...");const r=()=>{if(V(!1))p("Auth","Valid token found."),delete S.authorise,n(V());else{const o=[()=>{p("Auth","Successfully generated token."),n(V()),delete S.authorise},()=>{p("Auth","Failed to generate token."),i("Failed to generate token"),setTimeout(()=>delete S.authorise,200)}];b&&b.auth_type==="password"?(p("Auth","Logging in with credentials."),us(b).then(...o),It=0):ke||Mt()?(p("Auth",`Generating token with ${ke?"code":"refresh token"}`),Li().then(...o),It=0):e.session?(p("Auth","Users has session. Authorising application..."),Xo(t).then(...o)):(p("Auth","No user session"),Fi(e),i("No user session"),setTimeout(()=>delete S.authorise,200))}};ts().then(r,r)})),S.authorise}function Go(){const t=z?z.logout_url:"/logout";fetch(t,{method:"GET",redirect:"manual",headers:{Authorization:"Bearer "+V()}}).then(e=>{const n=e.headers.get("Location")||t;for(let i=0;i<T.length;i++){const r=T.key(i);r&&r.indexOf(O)>=0&&T.removeItem(r)}window.location?.assign(n)})}function An(t=0){return S.load_authority||(S.load_authority=new Promise(e=>{if(he.next(!1),b.mock){z=Bo,p("Auth","System in mock mode"),he.next(!0),e();return}p("Auth",`Fixed: ${Sn()} | Trusted: ${qt()}`),p("Auth","Loading authority...");const n=b.secure||window.location?.protocol.indexOf("https")>=0,i=r=>{p("Auth",`Failed to load authority(${r})`),he.next(!1),oe("load_authority",()=>{delete S.load_authority,An(t).then(o=>e())},300*Math.min(20,++t))};_n(`${n?"https:":"http:"}//${Rt()}/auth/authority`,{credentials:"same-origin"}).subscribe(async r=>{if(!r.ok)return i(await r.text().catch(s=>s));z=await r.json(),vn=/[2-9]\.[0-9]+\.[0-9]+/g.test(z.version||"")?"/api/engine/v2":"/control/api",p("Auth","Loaded authority.",[],"group"),z&&(p("Auth",`Name: ${z.name}`),p("Auth",`Version: ${z.version}`),p("Auth",`Domain: ${z.domain}`),p("Auth",`Session: ${z.session}`),p("Auth",`Production: ${z.production}`),p("Auth",`Config Keys: ${Object.keys(z.config||{}).length}`)),p("Auth","",[],"groupEnd");const o=()=>{he.next(!0),p("Auth","Application set online."),e()};delete S.load_authority,$n("").then(o,o)},i)})),S.load_authority}async function Xo(t){const e=is(t);if(b.use_iframe)return es(e);window.location?.assign(e)}function es(t){return S.iframe_auth||(S.iframe_auth=new Promise((e,n)=>{p("Auth","Authorizing in an iFrame...");const i=document.createElement("iframe");i.style.position="absolute",i.style.top="0",i.style.left="0",i.style.height="1px",i.style.width="1px",i.style.zIndex="-1",i.id="place-authorize",i.src=`${t}`;const r=o=>{if(o.origin===window.location?.origin&&o.data.type==="place-os"){const s=o.data;if(p("Auth","Received credentials from iFrame..."),document.body.removeChild(i),Se("iframe_auth"),window.removeEventListener("message",r),delete S.iframe_auth,s.token)return e(),wn({access_token:s.token,...s});ke=s.code||"",Li().then(c=>e(c),c=>n(c))}};oe("iframe_auth",()=>{p("Auth","Unable to resolve iFrame after 15 seconds..."),n()},15*1e3),window.addEventListener("message",r),i.onerror=o=>{p("Auth","iFrame error.",o),delete S.iframe_auth,n()},document.body.appendChild(i)})),S.iframe_auth}let Ni=!1;function Fi(t){if(b.handle_login!==!1&&!Ni){p("Auth","Redirecting to login page...");const e=t.login_url?.replace("{{url}}",encodeURIComponent(window.location?.href));throw setTimeout(()=>window.location?.assign(e),300),Ni=!0,new Error("Redirecting to login page...")}else p("Auth","Login being handled locally.");delete S.authorise}function ts(){return S.check_token||(S.check_token=new Promise(async(t,e)=>{V()?(p("Auth","Valid token found."),t(V())):(p("Auth","No token. Checking URL for auth credentials..."),await ns()?t(!0):e()),delete S.check_token})),S.check_token}function ns(){return S.check_params||(S.check_params=new Promise(t=>{p("Auth","Checking for auth parameters...");let e=gn();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&&(ke=e.code,ae("code")),e.refresh_token&&(T.setItem(`${O}_refresh_token`,e.refresh_token),ae("refresh_token"));const n=T.getItem(`${O}_nonce`)||"",i=(e.state||"").split(";");ae("state"),ae("token_type");const r=i[0];n===r?(wn(e),t(!!e.access_token)):t(!1)}else t(!1);oe("check_params_promise",()=>delete S.check_params,50)})),S.check_params}function is(t){const e=cs();t=t?`${e};${t}`:e;const n=b?(b.auth_uri||"").indexOf("?")>=0:!1,i=(b?b.auth_uri:null)||"/auth/oauth/authorize",r=qt()||b.auth_type==="auth_code"?"code":"token";let o=`${i}${n?"&":"?"}response_type=${encodeURIComponent(r)}&client_id=${encodeURIComponent(O)}&state=${encodeURIComponent(t)}&redirect_uri=${encodeURIComponent(b.redirect_uri)}&scope=${encodeURIComponent(b.scope)}`;if(b.auth_type==="auth_code"){const{challenge:s,verify:c}=rs();sessionStorage.setItem(`${O}_challenge`,s),o+="&code_challenge_method=S256",o+=`&code_challenge=${c}`}return o}const ji="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split("");function rs(t=43){const e=new Array(t).fill(0).map(()=>ji[Math.floor(Math.random()*ji.length)]).join(""),n=To(Oo(e)),i=bi(Mo.hash(n)).split("=")[0].replace(/\//g,"_").replace(/\+/g,"-");return{challenge:e,verify:i}}function os(){let e=(b.token_uri||"/auth/token")+`?client_id=${encodeURIComponent(O)}`,n="";if(e+=`&redirect_uri=${encodeURIComponent(b.redirect_uri)}`,Mt()){e+=`&refresh_token=${encodeURIComponent(Mt())}`,e+="&grant_type=refresh_token";const i=e.split("?");e=i[0],n=i[1]}else{e+=`&code=${encodeURIComponent(ke)}`,e+="&grant_type=authorization_code";const i=sessionStorage.getItem(`${O}_challenge`);i&&(e+=`&code_verifier=${i}`,sessionStorage.removeItem(`${O}_challenge`)),ke=""}return[e,n]}function ss(t){const e=t.token_uri||"/auth/token",n=H({grant_type:"password",client_id:O,client_secret:t.client_secret,redirect_uri:t.redirect_uri,authority:z?.id,scope:t.scope,username:t.username,password:t.password});return`${e}?${n}`}function Li(){return Hi(...os())}function us(t){return Hi(ss(t))}function Hi(t,e=""){return S.generate_tokens||(S.generate_tokens=new Promise((n,i)=>{p("Auth","Generating new token...");const r=o=>{p("Auth","Error generating new tokens.",o),T.removeItem(`${O}_refresh_token`),Et.next(""),i(),delete S.generate_tokens};_n(t,{method:"POST",body:e,headers:{"Content-Type":"application/x-www-form-urlencoded"}}).subscribe(async o=>{if(!o.ok)return r(o);const s=await o.json();wn(s),n(),delete S.generate_tokens},r)})),S.generate_tokens}function wn(t){const e=Co(new Date,Math.max(60,parseInt(t.expires_in,10)-300));p("Auth","Tokens generated storing..."),qt()&&(t.access_token&&(T.setItem(`${O}_access_token`,t.access_token),ae("access_token")),t.refresh_token&&(T.setItem(`${O}_refresh_token`,t.refresh_token),ae("refresh_token"))),t.expires_in&&(T.setItem(`${O}_expires_at`,`${e.valueOf()}`),ae("expires_in")),he.next(!0),De.next(t.access_token||""),Et.next(t.refresh_token||"")}function cs(){const t=Pi();return T.setItem(`${O}_nonce`,t),t}const Nt={};let zi=(t,e)=>{const n=new Error(`Mock endpoint not found: ${t} ${e}`);return n.status=404,p("HTTP(M)",`404 ${t}:`,e),pi(n)};function as(t){zi=t}function ls(t,e=Nt){Bi(t.method,t.path,e);const n=`${t.method}|${t.path}`,i=t.path.replace(/(http|https):\/\/[a-zA-Z0-9.-]*:?([0-9]*)?/g,"").replace(/^\//,"").split("/"),r={...t,path_parts:i,path_structure:i.map(o=>o[0]===":"?o.replace(":",""):"")};e[n]=r,p("HTTP(M)",`+ ${t.method} ${t.path}`)}function Bi(t,e,n=Nt){const i=`${t}|${e}`;n[i]&&(delete n[i],p("HTTP(M)",`- ${t} ${e}`))}function hs(t,e,n,i=Nt){const r=fs(t,e,i);if(r){const o=ds(e,r,n);return ps(r,o)}return zi(t,e)}function fs(t,e,n=Nt){const r=e.replace(/(http|https):\/\/[a-zA-Z0-9.-]*:?([0-9]*)?/g,"").replace(/^\//,"").split("?")[0].split("/"),o=Object.keys(n).reduce((s,c)=>(c.indexOf(`${t}|`)===0&&s.push(n[c]),s),[]);for(const s of o)if(s.path_structure.length===r.length){let c=!0;for(let a=0;a<s.path_structure.length;a++)if(!s.path_structure[a]&&s.path_parts[a]!==r[a]){c=!1;break}if(c)return s}return null}function ds(t,e,n){const i=t.replace(/(http|https):\/\/[a-zA-Z0-9.-]*:?([0-9]*)?/g,"").split("?"),r=i[0].replace(/^\//,""),o=i[1]||"",s=Re(o),c=r.split("/"),a={};for(let _=0;_<e.path_structure.length;_++){const y=e.path_structure[_];y&&(a[y]=c[_])}const h={url:t,path:e.path,method:e.method,metadata:e.metadata,route_params:a,query_params:s,body:n};return p("HTTP(M)",`MATCHED ${h.method}:`,h),h}function ps(t,e){let n;try{n=t.callback?t.callback(e):t.metadata}catch(s){throw p("HTTP(M)",`ERROR ${e.method}:`,[e.url,s]),s}const i=t.delay_variance||100,r=t.delay||300,o=Math.floor(Math.random()*i-i/2)+r;return p("HTTP(M)",`RESP ${e.method}:`,[e.url,n]),yo([n]).pipe($o(Math.max(200,o)))}const Wi={};function xi(t,e=Wi){return e[t]||{}}function X(t,e,n=Ye){return e||(e={response_type:"json"}),n("GET",t,{response_type:"json",...e})}function $e(t,e,n,i=Ye){return n||(n={response_type:"json"}),i("POST",t,{body:e,response_type:"json",...n})}function qe(t,e,n,i=Ye){return n||(n={response_type:"json"}),i("PUT",t,{body:e,response_type:"json",...n})}function Ke(t,e,n,i=Ye){return n||(n={response_type:"json"}),i("PATCH",t,{body:e,response_type:"json",...n})}function Ue(t,e,n=Ye){return e||(e={response_type:"void"}),n("DELETE",t,{response_type:"void",...e})}async function ms(t,e,n=Wi){if(t.headers){const i={};t.headers.forEach?t.headers.forEach((r,o)=>i[o.toLowerCase()]=r):Object.keys(t.headers).forEach(r=>i[r.toLowerCase()]=t.headers[r]),n[t.url||""]=i}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 Qi=()=>(Ct(),kn().then(()=>Promise.resolve(),()=>new Promise(t=>{setTimeout(()=>{Qi().then(()=>t())},1e3)})));function Ye(t,e,n,i=Dt,r=hs,o=ms){if(i()){const s=r(t,e,n?.body);if(s)return s}return n.headers=n.headers||{},!n.headers["Content-Type"]&&!n.headers["content-type"]&&(n.headers["Content-Type"]="application/json"),Ui().pipe(bo(s=>s),yi(1),gi(s=>{V()==="x-api-key"?n.headers["X-API-Key"]=Ze():n.headers.Authorization=`Bearer ${V()}`;const c={...n,method:t,credentials:"same-origin"};return["POST","PUT","PATCH"].includes(t)&&n.body!==void 0&&(c.body=typeof n.body=="string"?n.body:JSON.stringify(n.body)),_n(e,c)}),gi(s=>s.ok?o(s,n.response_type):pi(s)),Po({count:4,delay:(s,c)=>new U(a=>{if(s.status===511){Fi(Ve()),a.error(s);return}if(s.status!==401){a.error(s||{});return}p("HTTP","Auth error",s);const h=Math.pow(2,c-1)*1e3;Qi().then(()=>{a.next(h),a.complete()}).catch(()=>{a.error(s)})})}))}class N{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,Oi(e,[void 0,null,""])}}class Zi extends N{alert_dashboard_id;alert_dashboard_details;authority_id;description;enabled;conditions;severity;alert_type;debounce_period;constructor(e){super(e),this.authority_id=e.authority_id||"",this.description=e.description||"",this.enabled=e.enabled||!1,this.conditions=e.conditions||{time_dependents:[],comparisons:[]},this.severity=e.severity||"low",this.alert_type=e.alert_type||"threshold",this.debounce_period=e.debounce_period||0,this.alert_dashboard_id=e.alert_dashboard_id||"",this.alert_dashboard_details=e.alert_dashboard_details||void 0}}class Vi extends N{authority_id;description;enabled;constructor(e){super(e),this.authority_id=e.authority_id||"",this.description=e.description||"",this.enabled=e.enabled||!1}}const Ce="alert_dashboards";function Ft(t){return new Vi(t)}function _s(t={}){return P({query_params:t,fn:Ft,path:Ce})}function ys(t,e={}){return w({id:t,query_params:e,fn:Ft,path:Ce})}function gs(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Ft,path:Ce})}function vs(t){return R({form_data:t,query_params:{},fn:Ft,path:Ce})}function bs(t,e={}){return M({id:t,query_params:e,path:Ce})}function Ss(t){return P({query_params:{},fn:Ge,path:`${Ce}/${t}/alerts`})}const Je="alerts";function Ge(t){return new Zi(t)}function ks(t={}){return P({query_params:t,fn:Ge,path:Je})}function $s(t,e={}){return w({id:t,query_params:e,fn:Ge,path:Je})}function As(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Ge,path:Je})}function ws(t){return R({form_data:t,query_params:{},fn:Ge,path:Je})}function Ps(t,e={}){return M({id:t,query_params:e,path:Je})}class Ki extends N{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 Ts(t){return Yi[t]||0}function Os(t){return Ji[t]||0}let Yi={},Ji={},Gi="";const jt=t=>t;function P(t){const{query_params:e,fn:n,path:i,endpoint:r}=t,o=H(e),s=`${r||fe()}${i?"/"+i:""}${o?"?"+o:""}`;return X(s).pipe(I(c=>{const a=Es(s,o,i);return{total:a.total||0,next:a.next?()=>P({query_params:a.next,fn:n,endpoint:r,path:i}):null,data:c&&c instanceof Array?c.map(h=>(n||jt)(h)):c&&!(c instanceof Array)&&c.results?c.results.map(h=>h):[]}}))}function w(t){const{query_params:e,id:n,path:i,fn:r,options:o}=t,s=H(e),c=`${fe()}/${i}/${n}${s?"?"+s:""}`;return X(c,o).pipe(I(a=>(r||jt)(a)))}function R(t){const{query_params:e,form_data:n,path:i,fn:r}=t,o=H(e),s=`${fe()}/${i}${o?"?"+o:""}`;return $e(s,n).pipe(I(a=>(r||jt)(a)))}function g(t){const{id:e,task_name:n,form_data:i,method:r,path:o,callback:s}=t,c=H(i),a=`${fe()}/${o}/${e}/${n}`;return(r==="post"||r==="put"||!r?(r==="put"?qe:$e)(a,i):(r==="del"?Ue:X)(`${a}${c?"?"+c:""}`,{response_type:"json"})).pipe(I(_=>(s||(y=>y))(_)))}function D(t){const{id:e,query_params:n,form_data:i,method:r,path:o,fn:s}=t,c=H({...n,version:i.version||0}),a=`${fe()}/${o}/${e}${c?"?"+c:""}`;return(r==="put"?qe:Ke)(a,i).pipe(I(h=>(s||jt)(h)))}function M(t){const{id:e,query_params:n,path:i}=t,r=H(n),o=`${fe()}/${i}/${e}${r?"?"+r:""}`;return Ue(o)}function Es(t,e,n){const i=xi(t[0]==="/"?`${location.origin}${t}`:t),r={total:0,next:null};if(i&&i["x-total-count"]){const o=+(i["x-total-count"]||0);(e.length<2||e.length<12&&e.indexOf("offset=")>=0)&&(Yi[n]=o),Ji[n]=o,r.total=o}return i&&i.link&&(Gi=Ti(i.link||"").next,r.next=Re(Gi.split("?")[1])),r}function Va(t){return t}const Xe="oauth_apps";function Lt(t){return new Ki(t)}function Is(t={}){return P({query_params:t,fn:Lt,path:Xe})}function Ms(t,e={}){return w({id:t,query_params:e,fn:Lt,path:Xe})}function Rs(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Lt,path:Xe})}function Ds(t){return R({form_data:t,query_params:{},fn:Lt,path:Xe})}function qs(t,e={}){return M({id:t,query_params:e,path:Xe})}var Xi=(t=>(t[t.Certificate=0]="Certificate",t[t.NoAuth=1]="NoAuth",t[t.UserPassword=2]="UserPassword",t))(Xi||{});class er extends N{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 et="brokers";function Ht(t){return new er(t)}function Us(t={}){return P({query_params:t,fn:Ht,path:et})}function Cs(t,e={}){return w({id:t,query_params:e,fn:Ht,path:et})}function Ns(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Ht,path:et})}function Fs(t){return R({form_data:t,query_params:{},fn:Ht,path:et})}function js(t,e={}){return M({id:t,query_params:e,path:et})}class tr{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=xe(this.memory_usage*1024),this.total_memory=xe(this.memory_total*1024);const n=e.load?.edge||{};this.edge_nodes=e.edge_nodes||Object.keys(n).map(i=>({id:i,...n[i],run_count:e.status?.run_count?.edge[i]||{}}))||[]}}class nr{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=xe(this.memory_usage*1024),this.total_memory=xe(this.memory_total*1024)}}const Pn="cluster";function Ls(t){return new tr(t)}function Hs(t={}){return P({query_params:t,fn:Ls,path:Pn})}function zs(t,e={}){return w({id:t,query_params:e,fn:n=>n.map(i=>new nr(t,i)),path:Pn})}function Bs(t,e){return M({id:t,query_params:{driver:e},path:Pn})}class ir extends N{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 tt="domains";function zt(t){return new ir(t)}function Ws(t={}){return P({query_params:t,fn:zt,path:tt})}function xs(t,e={}){return w({id:t,query_params:e,fn:zt,path:tt})}function Qs(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:zt,path:tt})}function Zs(t){return R({form_data:t,query_params:{},fn:zt,path:tt})}function Vs(t,e={}){return M({id:t,query_params:e,path:tt})}var Ae=(t=>(t[t.None=0]="None",t[t.Support=1]="Support",t[t.Admin=2]="Admin",t[t.NeverDisplay=3]="NeverDisplay",t))(Ae||{});class de extends N{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||Ae.None,this.keys=e.keys||[],this.modified_by_id=e.modified_by_id||""}}var nt=(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))(nt||{});class Tn extends N{class_name;description;module_name;role;default_uri;default_port;repository_id;file_name;commit;ignore_connected;update_available;update_info;settings;constructor(e={}){super(e),this.description=e.description||"",this.module_name=e.module_name||"",this.role=e.role??nt.Logic,this.default_uri=e.default_uri||"",this.default_port=e.default_port||1,this.ignore_connected=e.ignore_connected||!1,this.class_name=e.class_name||"",this.repository_id=e.repository_id||"",this.file_name=e.file_name||"",this.commit=e.commit||"",this.update_available=e.update_available||!1,this.update_info=e.update_info,this.settings=e.settings||[null,null,null,null],typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in Ae)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new de({parent_id:this.id,encryption_level:+n}))}}const se="drivers";function Bt(t){return new Tn(t)}function Ks(t={}){return P({query_params:t,fn:Bt,path:se})}function Ys(t,e={}){return w({id:t,query_params:e,fn:Bt,path:se})}function Js(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Bt,path:se})}function Gs(t){return R({form_data:t,query_params:{},fn:Bt,path:se})}function Xs(t,e={}){return M({id:t,query_params:e,path:se})}function eu(t){return g({id:t,task_name:"recompile",path:se})}function tu(t){return g({id:t,task_name:"reload",path:se})}function nu(t){return g({id:t,task_name:"compiled",method:"get",path:se})}function iu(t){return g({id:t,task_name:"readme",method:"get",path:se})}class rr extends N{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 Ne="edges";function Wt(t){return new rr(t)}function ru(t={}){return P({query_params:t,fn:Wt,path:Ne})}function ou(t,e={}){return w({id:t,query_params:e,fn:Wt,path:Ne})}function su(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Wt,path:Ne})}function uu(t){return R({form_data:t,query_params:{},fn:Wt,path:Ne})}function cu(t,e={}){return M({id:t,query_params:e,path:Ne})}function au(t,e={}){return g({id:t,task_name:"token",form_data:e,method:"get",path:Ne})}class or extends N{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 it="ldap_auths";function xt(t){return new or(t)}function lu(t={}){return P({query_params:t,fn:xt,path:it})}function hu(t,e={}){return w({id:t,query_params:e,fn:xt,path:it})}function fu(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:xt,path:it})}function du(t){return R({form_data:t,query_params:{},fn:xt,path:it})}function pu(t,e={}){return M({id:t,query_params:e,path:it})}class On{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 we extends N{system_name;activated_count;description;debounce_period;important;enabled;enable_webhook;exec_enabled;webhook_secret;supported_methods;control_system_id;zone_id;trigger_id;playlists;get system_id(){return this.control_system_id}get actions(){const e=this._actions,n=(e.functions||[]).map(r=>({...r,args:{...r.args}})),i=(e.mailers||[]).map(r=>({...r,emails:[...r.emails]}));return{functions:n,mailers:i}}get conditions(){const e=this._conditions,n=(e.comparisons||[]).map(r=>({...r,left:typeof r.left=="object"?{...r.left}:r.left,right:typeof r.right=="object"?{...r.right}:r.right})),i=(e.time_dependents||[]).map(r=>({...r}));return{comparisons:n,time_dependents:i}}_actions;_conditions;constructor(e={}){super(e),this.description=e.description||"",this._actions=e.actions||{functions:[],mailers:[]},this._conditions=e.conditions||{comparisons:[],time_dependents:[]},this.debounce_period=e.debounce_period||0,this.important=e.important||!1,this.enabled=e.enabled||!1,this.webhook_secret=e.webhook_secret||"",this.control_system_id=e.system_id||e.control_system_id||"",this.zone_id=e.zone_id||"",this.system_name=e.system_name||(e.control_system?e.control_system.name:""),this.enable_webhook=e.enable_webhook||!1,this.exec_enabled=e.exec_enabled||!1,this.supported_methods=e.supported_methods||["POST"],this.activated_count=e.activated_count||e.trigger_count||0,this.playlists=e.playlists||[],this.trigger_id=e.trigger_id||""}}class Qt extends N{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 Ae)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new de({parent_id:this.id,encryption_level:+n}));e.trigger_data&&e.trigger_data instanceof Array&&(this.trigger_list=e.trigger_data.map(n=>new we(n)))}}class sr{zone;metadata;keys;constructor(e={}){this.zone=new Qt(e.zone),this.keys=e.keys||[],this.metadata={};const n=e.metadata||{};for(const i of this.keys)this.metadata[i]=new On(n[i])}}const Pe="metadata";function rt(t){return new On(t)}function mu(t,e={}){return w({id:t,query_params:e,fn:n=>Object.keys(n).map(i=>rt(n[i])),path:Pe})}function _u(t){const e=[...t],n=[];for(;e.length;){const i=e.pop();Array.isArray(i)?e.push(...i):n.push(i)}return n.reverse()}function yu(t,e={}){return g({id:t,task_name:"history",form_data:e,method:"get",callback:n=>_u(Object.keys(n).map(i=>n[i].map(r=>rt(r)))),path:Pe})}function gu(t,e,n={}){return w({id:t,query_params:{...n,name:e},fn:i=>rt(i[e]),path:Pe})}function vu(t,e,n="put"){return D({id:t,form_data:e,query_params:{},method:n,fn:rt,path:Pe})}function bu(t){return R({form_data:t,query_params:{},fn:rt,path:Pe})}function Su(t,e={}){return M({id:t,query_params:e,path:Pe})}function ku(t,e){return g({id:t,task_name:"children",form_data:e,method:"get",callback:n=>n.map(i=>new sr({...i,keys:Object.keys(i.metadata)})),path:Pe})}class En extends N{settings=[null,null,null,null];display_name;description;email;code;capacity;features;bookable;public;installed_ui_devices;support_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.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 Ae)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new de({parent_id:this.id,encryption_level:+n}));e.module_data&&e.module_data instanceof Array&&(this.module_list=e.module_data.map(n=>new In(n)))}}class In extends N{connected;running;updated_at;edge_id;driver_id;driver;control_system_id;system;ip;tls;udp;port;makebreak;uri;custom_name;role;notes;ignore_connected;settings=[null,null,null,null];has_runtime_error;error_timestamp;get system_id(){return this.control_system_id}constructor(e={}){super(e),this.driver_id=e.driver_id||e.dependency_id||"",this.control_system_id=e.control_system_id||"",this.edge_id=e.edge_id||"",this.ip=e.ip||"",this.tls=e.tls||!1,this.udp=e.udp||!1,this.port=e.port||1,this.makebreak=e.makebreak||!1,this.uri=e.uri||"",this.custom_name=e.custom_name||"",this.role=e.role??nt.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 En(e.control_system||e.system),this.has_runtime_error=e.has_runtime_error||!1,this.error_timestamp=e.error_timestamp||0,this.driver=new Tn(e.dependency||e.driver),this.settings=e.settings||[null,null,null,null],typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in Ae)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new de({parent_id:this.id,encryption_level:+n}))}toJSON(e=!1){const n=super.toJSON();return(n.role!==nt.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 Zt(t){return new In(t)}function $u(t={}){return P({query_params:t,fn:Zt,path:Y})}function Au(t,e={}){return w({id:t,query_params:e,fn:Zt,path:Y})}function wu(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Zt,path:Y})}function Pu(t){return R({form_data:t,query_params:{},fn:Zt,path:Y})}function Tu(t,e={}){return M({id:t,query_params:e,path:Y})}function Ou(t){return g({id:t,task_name:"start",path:Y})}function Eu(t){return g({id:t,task_name:"stop",path:Y})}function Iu(t){return g({id:t,task_name:"state",method:"get",path:Y})}function Mu(t,e){return g({id:t,task_name:`state${e}`,method:"get",path:Y})}function Ru(t){return g({id:t,task_name:"load",method:"post",path:Y})}function Du(t){return g({id:t,task_name:"settings",method:"get",callback:e=>e.map(n=>new de(n)),path:Y})}function qu(t){return g({id:t,task_name:"error",method:"get",path:Y})}class ur extends N{type="oauth";authority_id;client_id;client_secret;info_mappings;site;authorize_url;token_method;token_url;auth_scheme;scope;raw_info_url;authorize_params;ensure_matching;constructor(e={}){super(e),this.authority_id=e.authority_id||"",this.client_id=e.client_id||"",this.client_secret=e.client_secret||"",this.info_mappings=e.info_mappings||{},this.authorize_params=e.authorize_params||{},this.ensure_matching=e.ensure_matching||{},this.site=e.site||"",this.authorize_url=e.authorize_url||"oauth/authorize",this.token_method=e.token_method||"post",this.token_url=e.token_url||"oauth/token",this.auth_scheme=e.auth_scheme||"request_body",this.scope=e.scope||"",this.raw_info_url=e.raw_info_url||"",this.authorize_params=e.authorize_params||{},this.ensure_matching=e.ensure_matching||{}}}const ot="oauth_auths";function Vt(t){return new ur(t)}function Uu(t={}){return P({query_params:t,fn:Vt,path:ot})}function Cu(t,e={}){return w({id:t,query_params:e,fn:Vt,path:ot})}function Nu(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Vt,path:ot})}function Fu(t){return R({form_data:t,query_params:{},fn:Vt,path:ot})}function ju(t,e={}){return M({id:t,query_params:e,path:ot})}var Mn=(t=>(t.Driver="driver",t.Interface="interface",t))(Mn||{});class cr extends N{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||Mn.Driver,this.username=e.username||"",this.password=e.password||"",this.root_path=e.root_path||""}}const Q="repositories";function Kt(t){return new cr(t)}function Lu(t={}){return P({query_params:t,fn:Kt,path:Q})}function Hu(t,e={}){return w({id:t,query_params:e,fn:Kt,path:Q})}function zu(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Kt,path:Q})}function Bu(t){return R({form_data:t,query_params:{},fn:Kt,path:Q})}function Wu(t,e={}){return M({id:t,query_params:e,path:Q})}function xu(t={}){return w({id:"interfaces",query_params:t,path:Q})}function Qu(t){return w({id:"remote_default_branch",query_params:t,path:Q})}function Zu(t){return w({id:"remote_branches",query_params:t,path:Q})}function Vu(t){return w({id:"remote_commits",query_params:t,path:Q})}function Ku(t,e){return g({id:t,task_name:"drivers",form_data:e,method:"get",path:Q})}function Yu(t,e){return g({id:t,task_name:"commits",form_data:e,method:"get",path:Q})}function Ju(t){return g({id:t,task_name:"branches",method:"get",path:Q})}function Gu(t){return g({id:t,task_name:"default_branch",method:"get",path:Q})}function Xu(t,e){return g({id:t,task_name:"details",form_data:e,method:"get",path:Q})}function ec(t,e){return g({id:t,task_name:"pull",form_data:e,method:"post",path:Q})}class ar extends N{type="saml";authority_id;issuer;idp_sso_target_url_runtime_params;name_identifier_format;uid_attribute;assertion_consumer_service_url;idp_sso_target_url;idp_cert;idp_cert_fingerprint;attribute_service_name;attribute_statements;request_attributes;idp_slo_target_url;slo_default_relay_state;constructor(e={}){super(e),this.authority_id=e.authority_id||"",this.issuer=e.issuer||"",this.idp_sso_target_url_runtime_params=e.idp_sso_target_url_runtime_params||{},this.name_identifier_format=e.name_identifier_format||"",this.uid_attribute=e.uid_attribute||"",this.assertion_consumer_service_url=e.assertion_consumer_service_url||"",this.idp_sso_target_url=e.idp_sso_target_url||"",this.idp_cert=e.idp_cert||"",this.idp_cert_fingerprint=e.idp_cert_fingerprint||"",this.attribute_service_name=e.attribute_service_name||"",this.attribute_statements=e.attribute_statements||{},this.request_attributes=e.request_attributes||[],this.idp_slo_target_url=e.idp_slo_target_url||"",this.slo_default_relay_state=e.slo_default_relay_state||""}}const st="saml_auths";function Yt(t){return new ar(t)}function tc(t={}){return P({query_params:t,fn:Yt,path:st})}function nc(t,e={}){return w({id:t,query_params:e,fn:Yt,path:st})}function ic(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Yt,path:st})}function rc(t){return R({form_data:t,query_params:{},fn:Yt,path:st})}function oc(t,e={}){return M({id:t,query_params:e,path:st})}const Fe="settings";function ut(t){return new de(t)}function sc(t={}){return P({query_params:t,fn:ut,path:Fe})}function uc(t,e={}){return w({id:t,query_params:e,fn:ut,path:Fe})}function cc(t,e,n={},i="patch"){return D({id:t,form_data:e,query_params:n,method:i,fn:ut,path:Fe})}function ac(t,e={}){return R({form_data:t,query_params:e,fn:ut,path:Fe})}function lc(t,e={}){return M({id:t,query_params:e,path:Fe})}function hc(t,e={}){return g({id:t,task_name:"history",form_data:e,method:"get",callback:n=>n.map(i=>ut(i)),path:Fe})}const C="systems";function Te(t){return new En(t)}function fc(t={}){return P({query_params:t,fn:Te,path:C})}function dc(t={}){return P({query_params:t,fn:Te,path:`${C}/with_emails`})}function pc(t,e={}){return w({id:t,query_params:e,fn:Te,path:C})}function mc(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Te,path:C})}function _c(t){return R({form_data:t,query_params:{},fn:Te,path:C})}function yc(t,e={}){return M({id:t,query_params:e,path:C})}function gc(t,e,n={}){return g({id:t,task_name:`module/${e}`,form_data:n,method:"put",callback:i=>Te(i),path:C})}function vc(t,e){return g({id:t,task_name:`module/${e}`,form_data:{},method:"del",callback:n=>Te(n),path:C})}function bc(t){return g({id:t,task_name:"start",form_data:{},path:C})}function Sc(t){return g({id:t,task_name:"stop",path:C})}function kc(t,e,n,i=1,r=[]){return g({id:t,task_name:`${n}_${i}/${encodeURIComponent(e)}`,form_data:r,path:C})}function $c(t,e,n=1){return g({id:t,task_name:`${e}_${n}`,method:"get",path:C})}function Ac(t,e,n=1,i){return g({id:t,task_name:`${e}_${n}/${i}`,method:"get",path:C})}function wc(t,e,n=1){return g({id:t,task_name:`functions/${e}_${n}`,method:"get",path:C})}function Pc(t){return P({query_params:{},fn:e=>new Qt(e),path:`${C}/${t}/zones`})}function Tc(t){return P({query_params:{},fn:e=>new we(e),path:`${C}/${t}/triggers`})}function Oc(t,e){return g({id:t,task_name:"triggers",form_data:e,method:"post",callback:n=>new we(n),path:C})}function Ec(t,e){return g({id:t,task_name:`triggers/${e}`,method:"del",path:C})}function Ic(t){return g({id:t,task_name:"settings",method:"get",callback:e=>e.map(n=>new de(n)),path:C})}const je="triggers";function Jt(t){return new we(t)}function Mc(t={}){return P({query_params:t,fn:Jt,path:je})}function Rc(t,e={}){return w({id:t,query_params:e,fn:Jt,path:je})}function Dc(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Jt,path:je})}function qc(t){return R({form_data:t,query_params:{},fn:Jt,path:je})}function Uc(t,e={}){return M({id:t,query_params:e,path:je})}function Cc(t){return g({id:t,task_name:"instances",form_data:{},method:"get",callback:e=>e.map(n=>new we(n)),path:je})}var lr=(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))(lr||{}),hr=(t=>(t.AT="at",t.CRON="cron",t))(hr||{}),fr=(t=>(t[t.ExecuteBefore=0]="ExecuteBefore",t[t.ExecuteAfter=1]="ExecuteAfter",t[t.PayloadOnly=2]="PayloadOnly",t[t.IgnorePayload=3]="IgnorePayload",t))(fr||{});class dr extends N{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 Le="users";function ct(t){return new dr(t)}function Nc(t={}){return P({query_params:t,fn:ct,path:Le})}function Fc(t,e={}){return w({id:t,query_params:e,fn:ct,path:Le})}function jc(t={}){return w({id:"current",query_params:t,fn:ct,path:Le})}function Lc(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:ct,path:Le})}function Hc(t){return R({form_data:t,query_params:{},fn:ct,path:Le})}function zc(t,e={}){return M({id:t,query_params:e,path:Le})}const pe="zones";function Gt(t){return new Qt(t)}function Bc(t={}){return P({query_params:t,fn:Gt,path:pe})}function Wc(t={}){return w({id:"tags",query_params:t,fn:e=>e,path:pe})}function xc(t,e={}){return w({id:t,query_params:e,fn:Gt,path:pe})}function Qc(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Gt,path:pe})}function Zc(t){return R({form_data:t,query_params:{},fn:Gt,path:pe})}function Vc(t,e={}){return M({id:t,query_params:e,path:pe})}function Kc(t,e={}){return P({query_params:e,fn:n=>new we(n),path:`${pe}/${t}/triggers`})}function Yc(t,e,n,i=1,r=[]){return g({id:t,task_name:`exec/${encodeURIComponent(n+"_"+i)}/${encodeURIComponent(e)}`,form_data:r,path:pe})}var Rn=(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))(Rn||{});class pr{id;created_at;updated_at;name;description;authority_id;start_time;play_time;video_length;animation;media_type;orientation;media_uri;media_id;thumbnail_id;play_count;valid_from;valid_until;get media_url(){return this.media_id?`/api/engine/v2/uploads/${this.media_id}/url`:this.media_uri}get thumbnail_url(){return`/api/engine/v2/uploads/${this.thumbnail_id}/url`}constructor(e){this.id=e.id||"",this.created_at=e.created_at||Ai(Date.now()),this.updated_at=e.updated_at||Ai(Date.now()),this.name=e.name||"",this.description=e.description||"",this.authority_id=e.authority_id||"",this.start_time=e.start_time||0,this.play_time=e.play_time||0,this.video_length=e.video_length||0,this.animation=e.animation,this.media_type=e.media_type||"unknown",this.orientation=e.orientation||"unspecified",this.media_uri=e.media_uri||"",this.media_id=e.media_id||"",this.thumbnail_id=e.thumbnail_id||"",this.play_count=e.play_count||0,this.valid_from=e.valid_from,this.valid_until=e.valid_until}}class Xt{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 mr{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||Rn.Cut,this.random=e.random||!1,this.enabled=e.enabled??!0,this.default_duration=e.default_duration??15*1e3,this.valid_from=e.valid_from,this.valid_until=e.valid_until,this.play_hours=e.play_hours||"",this.play_at=e.play_at||"",this.play_cron=e.play_cron||""}}const _r="signage";function Jc(t,e={},n){return w({id:t,query_params:e,fn:i=>i,path:`${_r}`,options:n})}function Gc(t){return g({id:t,task_name:"metrics",form_data:{},method:"post",callback:e=>e,path:_r})}const at="signage/media";function en(t){return new pr(t)}function Xc(t={}){return P({query_params:t,fn:en,path:at})}function ea(t,e={}){return w({id:t,query_params:e,fn:en,path:at})}function ta(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:en,path:at})}function na(t){return R({form_data:t,query_params:{},fn:en,path:at})}function ia(t,e={}){return M({id:t,query_params:e,path:at})}const ue="signage/playlists";function tn(t){return new mr(t)}function ra(t={}){return P({query_params:t,fn:tn,path:ue})}function oa(t,e={}){return w({id:t,query_params:e,fn:tn,path:ue})}function sa(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:tn,path:ue})}function ua(t){return R({form_data:t,query_params:{},fn:tn,path:ue})}function ca(t,e={}){return M({id:t,query_params:e,path:ue})}function aa(t,e={}){return g({id:t,task_name:"media",form_data:e,method:"get",callback:n=>new Xt(n),path:ue})}function la(t,e={}){return g({id:t,task_name:"media/revisions",form_data:e,method:"get",callback:n=>n.map(i=>new Xt(i)),path:ue})}function ha(t){return g({id:t,task_name:"media/approve",method:"post",path:ue})}function fa(t,e){return g({id:t,task_name:"media",form_data:e,method:"post",path:ue,callback:n=>new Xt(n)})}class Dn{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 yr="/api/staff/v1/surveys/answers";function da(t={}){const e=H(t);return X(`${yr}${e?"?"+e:""}`).pipe(I(n=>n.map(i=>new Dn(i))))}function pa(t){return $e(`${yr}`,t).pipe(I(e=>e.map(n=>new Dn(n))))}class lt{id;survey_id;token;email;sent;constructor(e){this.id=e.id||0,this.survey_id=e.survey_id||0,this.token=e.token||"",this.email=e.email||"",this.sent=e.sent??!1}}const ht="/api/staff/v1/surveys/invitations";function ma(t={}){const e=H(t);return X(`${ht}${e?"?"+e:""}`).pipe(I(n=>n.map(i=>new lt(i))))}function _a(t,e={}){const n=H(e);return X(`${ht}/${t}${n?"?"+n:""}`).pipe(I(i=>new lt(i)))}function ya(t,e,n="patch"){return(n==="put"?qe:Ke)(`${ht}/${t}`,e).pipe(I(i=>new lt(i)))}function ga(t){return $e(`${ht}`,t).pipe(I(e=>new lt(e)))}function va(t,e={}){const n=H(e);return Ue(`${ht}/${t}${n?"?"+n:""}`)}class ft{id;title;description;type;options;required;max_rating;choices;tags;deleted;constructor(e){this.id=e.id||0,this.title=e.title||"",this.description=e.description||"",this.type=e.type||"",this.options=e.options||{},this.required=e.required||!1,this.max_rating=e.max_rating||0,this.choices=e.choices||[],this.tags=e.tags||[],this.deleted=e.deleted||!1}}const dt="/api/staff/v1/surveys/questions";function ba(t={}){const e=H(t);return X(`${dt}${e?"?"+e:""}`).pipe(I(n=>n.map(i=>new ft(i))))}function Sa(t,e={}){const n=H(e);return X(`${dt}/${t}${n?"?"+n:""}`).pipe(I(i=>new ft(i)))}function ka(t){return $e(`${dt}`,t).pipe(I(e=>new ft(e)))}function $a(t,e,n="patch"){return(n==="put"?qe:Ke)(`${dt}/${t}`,e).pipe(I(i=>new ft(i)))}function Aa(t,e={}){const n=H(e);return Ue(`${dt}/${t}${n?"?"+n:""}`)}class pt{id;title;description;trigger;building_id;zone_id;pages;constructor(e){this.id=e.id||0,this.title=e.title||"",this.description=e.description||"",this.building_id=e.building_id||"",this.zone_id=e.zone_id||"",this.pages=e.pages||[],this.trigger=e.trigger||"NONE"}}const mt="/api/staff/v1/surveys";function wa(t={}){const e=H(t);return X(`${mt}${e?"?"+e:""}`).pipe(I(n=>n.map(i=>new pt(i))))}function Pa(t,e={}){const n=H(e);return X(`${mt}/${t}${n?"?"+n:""}`).pipe(I(i=>new pt(i)))}function Ta(t,e,n="patch"){return(n==="put"?qe:Ke)(`${mt}/${t}`,e).pipe(I(i=>new pt(i)))}function Oa(t){return $e(`${mt}`,t).pipe(I(e=>new pt(e)))}function Ea(t,e={}){const n=H(e);return Ue(`${mt}/${t}${n?"?"+n:""}`)}var Ia={url:"",deserializer:function(t){return JSON.parse(t.data)},serializer:function(t){return JSON.stringify(t)}},Ma="WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }",Ra=function(t){G(e,t);function e(n,i){var r=t.call(this)||this;if(r._socket=null,n instanceof U)r.destination=i,r.source=n;else{var o=r._config=Be({},Ia);if(r._output=new ge,typeof n=="string")o.url=n;else for(var s in n)n.hasOwnProperty(s)&&(o[s]=n[s]);if(!o.WebSocketCtor&&WebSocket)o.WebSocketCtor=WebSocket;else if(!o.WebSocketCtor)throw new Error("no WebSocket constructor can be found");r.destination=new mn}return r}return e.prototype.lift=function(n){var i=new e(this._config,this.destination);return i.operator=n,i.source=this,i},e.prototype._resetState=function(){this._socket=null,this.source||(this.destination=new mn),this._output=new ge},e.prototype.multiplex=function(n,i,r){var o=this;return new U(function(s){try{o.next(n())}catch(a){s.error(a)}var c=o.subscribe({next:function(a){try{r(a)&&s.next(a)}catch(h){s.error(h)}},error:function(a){return s.error(a)},complete:function(){return s.complete()}});return function(){try{o.next(i())}catch(a){s.error(a)}c.unsubscribe()}})},e.prototype._connectSocket=function(){var n=this,i=this._config,r=i.WebSocketCtor,o=i.protocol,s=i.url,c=i.binaryType,a=this._output,h=null;try{h=o?new r(s,o):new r(s),this._socket=h,c&&(this._socket.binaryType=c)}catch(y){a.error(y);return}var _=new ye(function(){n._socket=null,h&&h.readyState===1&&h.close()});h.onopen=function(y){var m=n._socket;if(!m){h.close(),n._resetState();return}var l=n._config.openObserver;l&&l.next(y);var d=n.destination;n.destination=At.create(function(f){if(h.readyState===1)try{var k=n._config.serializer;h.send(k(f))}catch(v){n.destination.error(v)}},function(f){var k=n._config.closingObserver;k&&k.next(void 0),f&&f.code?h.close(f.code,f.reason):a.error(new TypeError(Ma)),n._resetState()},function(){var f=n._config.closingObserver;f&&f.next(void 0),h.close(),n._resetState()}),d&&d instanceof mn&&_.add(d.subscribe(n.destination))},h.onerror=function(y){n._resetState(),a.error(y)},h.onclose=function(y){h===n._socket&&n._resetState();var m=n._config.closeObserver;m&&m.next(y),y.wasClean?a.complete():a.error(y)},h.onmessage=function(y){try{var m=n._config.deserializer;a.next(m(y))}catch(l){a.error(l)}}},e.prototype._subscribe=function(n){var i=this,r=this.source;return r?r.subscribe(n):(this._socket||this._connectSocket(),this._output.subscribe(n),n.add(function(){var o=i._socket;i._output.observers.length===0&&(o&&(o.readyState===1||o.readyState===0)&&o.close(),i._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}(dn);function Da(t){return new Ra(t)}var ee=(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))(ee||{}),qn=(t=>(t.Info="info",t.Debug="debug",t.Warning="warn",t.Error="error",t.Fatal="fatal",t.Trace="trace",t))(qn||{});class gr{constructor(e,n){this._system=e;const i=Object.getOwnPropertyNames(Object.getPrototypeOf(n)).filter(r=>r.startsWith("$"));for(const r in n)n.hasOwnProperty(r)&&n[r]!==void 0&&(n[r]instanceof Function?this.addMethod(r,n[r]):this.addProperty(r,n[r]));for(const r of i)n[r]instanceof Function&&this.addMethod(r,n[r])}call(e,n=[]){return this[`$${e}`]instanceof Function?this[`$${e}`](...n):null}listen(e){return!this[`_${e}`]&&!(this[`_${e}_obs`]instanceof U)&&!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 ce(n),this[`_${e}_obs`]=this[`_${e}`].asObservable(),Object.defineProperty(this,e,{get:()=>this[`_${e}`].getValue(),set:i=>this[`_${e}`].next(i)})}}class vr{constructor(e){for(const n in e)e.hasOwnProperty(n)&&e[n]&&e[n]instanceof Array&&e[n].forEach(i=>{this.addModule(n,i)})}addModule(e,n){this[e]||(this[e]=[]),this[e].push(new gr(this,n))}}const nn={};function qa(t,e){return nn[t]=new vr(e),nn[t]}function br(t){return nn[t]}function Ua(t){delete nn[t]}const Sr=15;let _t=0,J,kr=0;const W={},Un={},Oe={},Ca={},Ee=new ce(!1);Oe._place_os_status=Ee.asObservable();const $r=new ce([0,0]);Oe._place_os_sync=$r.asObservable();let Ar=Date.now(),He,rn=0,me=null,on,Cn=0;const yt=10*1e3,Nn=new ge;Oe._place_os_debug_events=Nn.asObservable();function sn(){return fe().indexOf("/control/")>=0?"/control/websocket":`${bn()}/systems/control`}function Fn(){return Ee.getValue()}function wr(){return Oe._place_os_status}function Na(){return Oe._place_os_status}function Pr(t,e=Un,n=Oe){const i=`${t.sys}|${t.mod}_${t.index}|${t.name}`;return e[i]||(e[i]=new ce(void 0),n[i]=e[i].asObservable()),n[i]}function Tr(t,e=Un){const n=`${t.sys}|${t.mod}_${t.index}|${t.name}`;if(e[n])return e[n].getValue()}function jn(t,e=0,n=ze){const i={id:++_t,cmd:"bind",...t};return n(i,e)}function Or(t,e=0,n=ze){const i={id:++_t,cmd:"unbind",...t};return n(i,e)}function Er(t,e=yt,n=ze){const i={id:++_t,cmd:"exec",...t};return n(i,e)}function Fa(t,e=yt,n=ze){const i={id:++_t,cmd:"debug",...t};return n(i,e)}function ja(t,e=yt,n=ze){const i={id:++_t,cmd:"ignore",...t};return n(i,e)}function ze(t,e=yt,n=0){const i=`${t.cmd}|${t.sys}|${t.mod}${t.index}|${t.name}|${t.args}|${Mi()}`;if(W[i])p("WS","Request already in progress. Waiting...",t);else{const r={...t,key:i};r.promise=new Promise((o,s)=>{const c=()=>{delete W[i],W[i]=null,ze(t,e,n).then(a=>o(a),a=>s(a))};if(J&&Fn()){Dt()&&Qa(t,J,Ca),r.resolve=o,r.reject=s;const a=`${t.sys}, ${t.mod}_${t.index}, ${t.name}`;p("WS",`[${t.cmd.toUpperCase()}](${t.id}) ${a}`,t.args),J.next(t),e>0&&oe(`${i}`,()=>{s("Request timed out."),delete W[i],W[i]=null},e)}else me?setTimeout(()=>c(),1e3):Ln().then(()=>c())}),W[i]=r}return W[i].promise}function Ir(t){if(t!=="pong"&&t instanceof Object){if(t.type==="notify"&&t.meta)za(t.meta,t.value);else if(t.type==="success")La(t);else if(t.type==="debug"){p("WS",`[DEBUG] ${t.mod}${t.klass||""} →`,t.msg);const e=t.meta||{mod:"",index:""};Nn.next({mod_id:t.mod||"<empty>",module:`${e.mod}_${e.index}`,class_name:t.klass||"<empty>",message:t.msg||"<empty>",level:t.level||qn.Debug,time:Math.floor(new Date().getTime()/1e3)})}else t.type==="error"?Ha(t):t.cmd||p("WS","Invalid websocket message",t,"error");Se(`${t.id}`)}else t==="pong"&&(Cn=Date.now(),p("WS","Pong!"))}function La(t){const e=Object.keys(W).map(n=>W[n]).find(n=>n?.id===t.id);p("WS",`[SUCCESS](${t.id})`),e&&e.resolve&&(e.resolve(t.value),delete W[e.key])}function Ha(t){let e="UNEXPECTED FAILURE";switch(t.code){case ee.ACCESS_DENIED:e="ACCESS DENIED";break;case ee.BAD_REQUEST:e="BAD REQUEST";break;case ee.MOD_NOT_FOUND:e="MODULE NOT FOUND";break;case ee.SYS_NOT_FOUND:e="SYSTEM NOT FOUND";break;case ee.PARSE_ERROR:e="PARSE ERROR";break;case ee.REQUEST_FAILED:e="REQUEST FAILED";break;case ee.UNKNOWN_CMD:e="UNKNOWN COMMAND";break}p("WS",`[ERROR] ${e}(${t.id}): ${t.msg}`,void 0,"error");const n=Object.keys(W).map(i=>W[i]).filter(i=>i).find(i=>i.id===t.id);n&&n.reject&&(n.reject(t),Se(`${n.key}`),delete W[n.key])}function za(t,e,n=Un,i=Oe){const r=`${t.sys}|${t.mod}_${t.index}|${t.name}`;n[r]||(n[r]=new ce(null),i[r]=n[r].asObservable());const o=`${t.sys}, ${t.mod}_${t.index}, ${t.name}`;p("WS",`[NOTIFY] ${o} changed`,[n[r].getValue(),"→",e]),n[r].next(e)}function Ln(t=0){return me==null&&(me=new Promise(e=>{if(t>40)return location.reload();rn++,Ar=Date.now(),J=Dt()?xa():Ba(),J?(p("WS(Debug)","Authority:",[Ve()]),p("WS","Connecting to websocket..."),J.subscribe(n=>{Ee.getValue()||(p("WS","Connection established."),e()),Ee.next(!0),rn=0,Hn(),Ir(n)},n=>{J=void 0,me=null,Rr(),Hn(),Wa(n)},()=>{J=void 0,me=null,Rr(),p("WS","Connection closed by browser."),Ee.next(!1),un()}),He&&clearInterval(He),Cn=Date.now(),Mr(),He=setInterval(()=>Mr(),Sr*1e3),Hn(),kr+=1,on=setTimeout(()=>{p("WS","Unhealthy connection. Reconnecting..."),Ee.next(!1),me=null,un()},30*1e3)):(J?p("WS",`Waiting on auth(${t}). Retrying in ${1e3*Math.min(10,t+1)}ms...`,[!!V(),!!Ve()],"info"):p("WS",`Failed to create websocket(${t}). Retrying in ${1e3*Math.min(10,t+1)}ms...`,void 0,"error"),setTimeout(()=>{me=null,Ln(t).then(n=>e(n))},1e3*Math.min(10,++t)))})),me}function Ba(){if(!Ve()||!V())return null;const t=Ci()||location.protocol.indexOf("https")>=0;let e=`ws${t?"s":""}://${Rt()}${sn()}${Sn()?"?fixed_device=true":""}`;const n=V();let i=n==="x-api-key"?`api-key=${Ze()}`:`bearer_token=${n}`;return!xo()&&!Ei()?(p("WS","Authenticating through cookie..."),i+=`;max-age=120;path=${sn()};`,i+=`${t?"secure;":""}samesite=strict`,document.cookie=i,p("WS","Cookies:",[document.cookie,i])):(p("WS","Authenticating through URL query parameter..."),e+=`${e.indexOf("?")>=0?"&":"?"}${i}`),p("WS",`Creating websocket connection to ws${t?"s":""}://${Rt()}${sn()}`),Da({url:e,serializer:r=>typeof r=="object"?JSON.stringify(r):r,deserializer:r=>{let o=r.data;if(o==="pong")return o;try{return JSON.parse(r.data)}catch{return o}}})}function un(){$r.next([kr,Date.now()-Ar]),J&&Fn()&&(J.complete(),He&&(clearInterval(He),He=void 0)),p("WS",`Reconnecting in ${Math.min(5e3,rn*300||1e3)}ms...`),oe("reconnect",()=>Ln(),Math.min(5e3,(rn+1)*300||1e3))}function Mr(){if(Date.now()-Cn>4*Sr*1e3)return un();J?.next("ping")}function Wa(t){Ee.next(!1),p("WS","Websocket error:",t,void 0,"error"),t.status===401&&Ct(),kn(),un()}function Hn(){on&&(clearTimeout(on),on=void 0)}function xa(){const t=new ge;return t.subscribe(e=>Ir(e)),t}function Qa(t,e,n){const i=`${t.sys}|${t.mod}_${t.index}|${t.name}`,r=br(t.sys),o=r&&r[t.mod]?r[t.mod][t.index-1||0]:null;if(o){switch(t.cmd){case"bind":n[i]=o.listen(t.name).subscribe(s=>{setTimeout(()=>{e.next({type:"notify",value:s,meta:t})},Math.floor(Math.random()*100+50))});break;case"unbind":n[i]&&(n[i].unsubscribe(),delete n[i],Se(`${i}`));break}oe(`${t.id}-response`,()=>{const s={id:t.id,type:"success",value:t.cmd==="exec"?o.call(t.name,t.args):null};e.next(s)},10)}else oe(`${t.id}-error`,()=>e.next({id:t.id,type:"error",code:r?ee.SYS_NOT_FOUND:ee.MOD_NOT_FOUND}),10)}function Rr(){for(const t in W)W[t]&&delete W[t]}class zn{constructor(e,n){this._module=e,this.name=n,wr().pipe(Ao()).subscribe(i=>{i&&(this._stale_bindings||this._pending===1)?(p("VAR","Re-binding to status variable",this.binding()),this.rebind()):i||(Se(`rebind:${JSON.stringify(this.binding())}`),p("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 Tr(this.binding())}listen(){return Pr(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,jn(this.binding()).then(()=>{this._binding_count++,this._pending=0}).catch(()=>null)),()=>this.unbind()}unbind(){this._binding_count===1&&this._pending===0?(this._pending=2,Or(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 jn(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 Dr{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 zn(this,e)),this._bindings[e]}variable(e){return this._bindings[e]||(this._bindings[e]=new zn(this,e)),this._bindings[e]}execute(e,n,i=yt){return Er({sys:this._system.id,mod:this.name,index:this.index,name:e,args:n},i)}}class qr{id;_module_list={};constructor(e){this.id=e}module(e,n=1){if(!e)throw new Error("Invalid module ID");const i=e.split("_");i.length>1&&Number.isInteger(+i[i.length-1])&&(n=+i[i.length-1],i.pop()),n<1&&(n=1);const r=i.join("_");for(this._module_list[r]||(this._module_list[r]=[]);this._module_list[r].length<n;)this._module_list[r].push(new Dr(this,`${r}_${this._module_list[r].length+1}`));return this._module_list[r][n-1]}}const Bn={};function Ur(t){return Bn[t]||(Bn[t]=new qr(t)),Bn[t]}function Za(t,e,n=1){return Ur(t).module(e,n)}u.AuthType=Xi,u.EncryptionLevel=Ae,u.MediaAnimation=Rn,u.MockPlaceWebsocketModule=gr,u.MockPlaceWebsocketSystem=vr,u.PlaceAlert=Zi,u.PlaceAlertDashboard=Vi,u.PlaceApplication=Ki,u.PlaceCluster=tr,u.PlaceDomain=ir,u.PlaceDriver=Tn,u.PlaceDriverRole=nt,u.PlaceEdge=rr,u.PlaceErrorCodes=ee,u.PlaceLDAPSource=or,u.PlaceLogLevel=qn,u.PlaceMQTTBroker=er,u.PlaceMetadata=On,u.PlaceModule=In,u.PlaceModuleBinding=Dr,u.PlaceOAuthSource=ur,u.PlaceProcess=nr,u.PlaceRepository=cr,u.PlaceRepositoryType=Mn,u.PlaceResource=N,u.PlaceSAMLSource=ar,u.PlaceSettings=de,u.PlaceSystem=En,u.PlaceSystemBinding=qr,u.PlaceTrigger=we,u.PlaceUser=dr,u.PlaceVariableBinding=zn,u.PlaceZone=Qt,u.PlaceZoneMetadata=sr,u.SignageMedia=pr,u.SignagePlaylist=mr,u.SignagePlaylistMedia=Xt,u.Survey=pt,u.SurveyAnswer=Dn,u.SurveyInvitation=lt,u.SurveyQuestion=ft,u.TriggerConditionOperator=lr,u.TriggerTimeConditionType=hr,u.TriggerWebhookType=fr,u.addAlert=ws,u.addAlertDashboard=vs,u.addAnswer=pa,u.addApplication=Ds,u.addBroker=Fs,u.addDomain=Zs,u.addDriver=Gs,u.addEdge=uu,u.addInvitation=ga,u.addLDAPSource=du,u.addMetadata=bu,u.addModule=Pu,u.addOAuthSource=Fu,u.addQuestion=ka,u.addRepository=Bu,u.addSAMLSource=rc,u.addSettings=ac,u.addSignageMedia=na,u.addSignagePlaylist=ua,u.addSurvey=Oa,u.addSystem=_c,u.addSystemModule=gc,u.addSystemTrigger=Oc,u.addTrigger=qc,u.addUser=Hc,u.addZone=Zc,u.apiEndpoint=fe,u.apiKey=Ze,u.approveSignagePlaylist=ha,u.authorise=$n,u.authority=Ve,u.bind=jn,u.cleanObject=Oi,u.cleanupAuth=Jo,u.clientId=Ri,u.connectionState=Na,u.consoleHasColours=yn,u.convertPairStringToMap=Re,u.create=R,u.currentUser=jc,u.debug=Fa,u.debug_events=Nn,u.del=Ue,u.deregisterMockEndpoint=Bi,u.deregisterSystem=Ua,u.driverReadme=iu,u.execute=Er,u.executeOnSystem=kc,u.executeOnZone=Yc,u.functionList=wc,u.generateNonce=Pi,u.get=X,u.getFragments=gn,u.getModule=Za,u.getSystem=Ur,u.hasToken=qi,u.host=Rt,u.httpRoute=bn,u.humanReadableByteCount=xe,u.ignore=ja,u.invalidateToken=Ct,u.isDriverCompiled=nu,u.isFixedDevice=Sn,u.isMobileSafari=Ei,u.isMock=Dt,u.isNestedFrame=Ii,u.isOnline=Vo,u.isSecure=Ci,u.isTrusted=qt,u.is_connected=Fn,u.lastRequestTotal=Os,u.listChildMetadata=ku,u.listDashboardAlerts=Ss,u.listInterfaceRepositories=xu,u.listMetadata=mu,u.listMetadataHistory=yu,u.listRemoteRepositoryBranches=Zu,u.listRemoteRepositoryCommits=Vu,u.listRemoteRepositoryDefaultBranch=Qu,u.listRepositoryBranches=Ju,u.listRepositoryCommits=Yu,u.listRepositoryDefaultBranch=Gu,u.listRepositoryDriverDetails=Xu,u.listRepositoryDrivers=Ku,u.listSignagePlaylistMedia=aa,u.listSignagePlaylistMediaRevisions=la,u.listSystemTriggers=Tc,u.listSystemZones=Pc,u.listTriggerInstances=Cc,u.listZoneTags=Wc,u.listZoneTriggers=Kc,u.listen=Pr,u.listenForToken=Ui,u.loadModule=Ru,u.log=p,u.logout=Go,u.lookupModuleState=Mu,u.lookupSystemModuleState=Ac,u.mockSystem=br,u.moduleRuntimeError=qu,u.moduleSettings=Du,u.moduleState=Iu,u.onlineState=Ko,u.parseLinkHeader=Ti,u.patch=Ke,u.post=$e,u.pullRepositoryChanges=ec,u.put=qe,u.query=P,u.queryAlertDashboards=_s,u.queryAlerts=ks,u.queryAnswers=da,u.queryApplications=Is,u.queryBrokers=Us,u.queryClusters=Hs,u.queryDomains=Ws,u.queryDrivers=Ks,u.queryEdges=ru,u.queryInvitations=ma,u.queryLDAPSources=lu,u.queryModules=$u,u.queryOAuthSources=Uu,u.queryProcesses=zs,u.queryQuestions=ba,u.queryRepositories=Lu,u.querySAMLSources=tc,u.querySettings=sc,u.querySignageMedia=Xc,u.querySignagePlaylists=ra,u.querySurveys=wa,u.querySystems=fc,u.querySystemsWithEmails=dc,u.queryTriggers=Mc,u.queryUsers=Nc,u.queryZones=Bc,u.recompileDriver=eu,u.redirectUri=Qo,u.refreshAuthority=kn,u.refreshToken=Mt,u.registerMockEndpoint=ls,u.registerSystem=qa,u.reloadDriver=tu,u.remove=M,u.removeAlert=Ps,u.removeAlertDashboard=bs,u.removeApplication=qs,u.removeBroker=js,u.removeDomain=Vs,u.removeDriver=Xs,u.removeEdge=cu,u.removeFragment=ae,u.removeInvitation=va,u.removeLDAPSource=pu,u.removeMetadata=Su,u.removeModule=Tu,u.removeOAuthSource=ju,u.removeQuestion=Aa,u.removeRepository=Wu,u.removeSAMLSource=oc,u.removeSettings=lc,u.removeSignageMedia=ia,u.removeSignagePlaylist=ca,u.removeSurvey=Ea,u.removeSystem=yc,u.removeSystemModule=vc,u.removeSystemTrigger=Ec,u.removeTrigger=Uc,u.removeUser=zc,u.removeZone=Vc,u.requestTotal=Ts,u.responseHeaders=xi,u.retrieveEdgeToken=au,u.setAPI_Key=Zo,u.setMockNotFoundHandler=as,u.setToken=Di,u.settingsHistory=hc,u.setup=Yo,u.show=w,u.showAlert=$s,u.showAlertDashboard=ys,u.showApplication=Ms,u.showBroker=Cs,u.showDomain=xs,u.showDriver=Ys,u.showEdge=ou,u.showInvitation=_a,u.showLDAPSource=hu,u.showMetadata=gu,u.showModule=Au,u.showOAuthSource=Cu,u.showQuestion=Sa,u.showRepository=Hu,u.showSAMLSource=nc,u.showSettings=uc,u.showSignage=Jc,u.showSignageMedia=ea,u.showSignageMetrics=Gc,u.showSignagePlaylist=oa,u.showSurvey=Pa,u.showSystem=pc,u.showTrigger=Rc,u.showUser=Fc,u.showZone=xc,u.simplifiedTime=Mi,u.startModule=Ou,u.startSystem=bc,u.status=wr,u.stopModule=Eu,u.stopSystem=Sc,u.systemModuleState=$c,u.systemSettings=Ic,u.terminateProcess=Bs,u.token=V,u.unbind=Or,u.update=D,u.updateAlert=As,u.updateAlertDashboard=gs,u.updateApplication=Rs,u.updateBroker=Ns,u.updateDomain=Qs,u.updateDriver=Js,u.updateEdge=su,u.updateInvitation=ya,u.updateLDAPSource=fu,u.updateMetadata=vu,u.updateModule=wu,u.updateOAuthSource=Nu,u.updateQuestion=$a,u.updateRepository=zu,u.updateSAMLSource=ic,u.updateSettings=cc,u.updateSignageMedia=ta,u.updateSignagePlaylist=sa,u.updateSignagePlaylistMedia=fa,u.updateSurvey=Ta,u.updateSystem=mc,u.updateTrigger=Dc,u.updateUser=Lc,u.updateZone=Qc,u.value=Tr,u.websocketRoute=sn,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
4
4
  //# sourceMappingURL=index.umd.js.map