@de./sdk 1.0.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.
Files changed (74) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +4391 -0
  3. package/dist/allend/Access.d.ts +15 -0
  4. package/dist/allend/Access.js +164 -0
  5. package/dist/allend/Access.js.map +1 -0
  6. package/dist/allend/DAuth/index.d.ts +20 -0
  7. package/dist/allend/DAuth/index.js +92 -0
  8. package/dist/allend/DAuth/index.js.map +1 -0
  9. package/dist/allend/DClient/Client.d.ts +10 -0
  10. package/dist/allend/DClient/Client.js +144 -0
  11. package/dist/allend/DClient/Client.js.map +1 -0
  12. package/dist/allend/DClient/Event.d.ts +18 -0
  13. package/dist/allend/DClient/Event.js +100 -0
  14. package/dist/allend/DClient/Event.js.map +1 -0
  15. package/dist/allend/DClient/Order.d.ts +49 -0
  16. package/dist/allend/DClient/Order.js +601 -0
  17. package/dist/allend/DClient/Order.js.map +1 -0
  18. package/dist/allend/IoTClient.d.ts +29 -0
  19. package/dist/allend/IoTClient.js +59 -0
  20. package/dist/allend/IoTClient.js.map +1 -0
  21. package/dist/allend/MSI/Controls.d.ts +256 -0
  22. package/dist/allend/MSI/Controls.js +763 -0
  23. package/dist/allend/MSI/Controls.js.map +1 -0
  24. package/dist/allend/MSI/Handles.d.ts +88 -0
  25. package/dist/allend/MSI/Handles.js +445 -0
  26. package/dist/allend/MSI/Handles.js.map +1 -0
  27. package/dist/allend/MSI/Plugins.d.ts +22 -0
  28. package/dist/allend/MSI/Plugins.js +38 -0
  29. package/dist/allend/MSI/Plugins.js.map +1 -0
  30. package/dist/allend/MSI/index.d.ts +55 -0
  31. package/dist/allend/MSI/index.js +155 -0
  32. package/dist/allend/MSI/index.js.map +1 -0
  33. package/dist/allend/index.d.ts +12 -0
  34. package/dist/allend/index.js +18 -0
  35. package/dist/allend/index.js.map +1 -0
  36. package/dist/backend/Auth.d.ts +38 -0
  37. package/dist/backend/Auth.js +286 -0
  38. package/dist/backend/Auth.js.map +1 -0
  39. package/dist/baseUrl.d.ts +12 -0
  40. package/dist/baseUrl.js +16 -0
  41. package/dist/baseUrl.js.map +1 -0
  42. package/dist/bundle.js +1 -0
  43. package/dist/index.d.ts +13 -0
  44. package/dist/index.js +20 -0
  45. package/dist/index.js.map +1 -0
  46. package/dist/types/access.d.ts +8 -0
  47. package/dist/types/auth.d.ts +27 -0
  48. package/dist/types/index.d.ts +281 -0
  49. package/dist/utils/index.d.ts +5 -0
  50. package/dist/utils/index.js +8 -0
  51. package/dist/utils/index.js.map +1 -0
  52. package/dist/utils/stream.d.ts +20 -0
  53. package/dist/utils/stream.js +63 -0
  54. package/dist/utils/stream.js.map +1 -0
  55. package/package.json +66 -0
  56. package/src/allend/Access.ts +78 -0
  57. package/src/allend/DAuth/index.ts +39 -0
  58. package/src/allend/DClient/Client.ts +76 -0
  59. package/src/allend/DClient/Event.ts +76 -0
  60. package/src/allend/DClient/Order.ts +452 -0
  61. package/src/allend/IoTClient.ts +68 -0
  62. package/src/allend/MSI/Controls.ts +760 -0
  63. package/src/allend/MSI/Handles.ts +387 -0
  64. package/src/allend/MSI/Plugins.ts +52 -0
  65. package/src/allend/MSI/index.ts +160 -0
  66. package/src/allend/index.ts +18 -0
  67. package/src/backend/Auth.ts +201 -0
  68. package/src/baseUrl.ts +13 -0
  69. package/src/index.ts +19 -0
  70. package/src/types/access.d.ts +8 -0
  71. package/src/types/auth.d.ts +27 -0
  72. package/src/types/index.d.ts +281 -0
  73. package/src/utils/index.ts +4 -0
  74. package/src/utils/stream.ts +68 -0
package/dist/bundle.js ADDED
@@ -0,0 +1 @@
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("DeSDK",[],t):"object"==typeof exports?exports.DeSDK=t():e.DeSDK=t()}(this,()=>(()=>{var e={1:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(266)),i=function(){function e(e,t,n,r){this.ACTIVE_PLUGINS={},this.chn=e,this.options=r,this.handles=t,this.controls=n}return e.prototype.mount=function(e){var t=this;Object.entries(e).forEach(function(e){var n=e[0],r=e[1];t.ACTIVE_PLUGINS[n]=r})},e.prototype.use=function(e,t){if(!(e in this.ACTIVE_PLUGINS))throw new Error("Undefined <".concat(e,"> plugin"));return(0,this.ACTIVE_PLUGINS[e])({handles:this.handles,controls:this.controls,map:this.options,utils:o.default},t)},e}();t.default=i},2:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IOT_SERVER_BASEURL=t.API_SERVER_BASEURL=t.ASI_SERVER_BASEURL=void 0,t.ASI_SERVER_BASEURL={dev:"http://localhost:44000",prod:"https://auth.dedot.io"},t.API_SERVER_BASEURL={dev:"http://localhost:24800",prod:"https://api.dedot.io"},t.IOT_SERVER_BASEURL={dev:"http://localhost:11011",prod:"https://iot.dedot.io"}},7:e=>{"use strict";var t,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}e.exports=i,e.exports.once=function(e,t){return new Promise(function(n,r){function o(n){e.removeListener(t,i),r(n)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),n([].slice.call(arguments))}y(e,t,i,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&y(e,"error",t,{once:!0})}(e,o)})},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var s=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function a(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function u(e,t,n,r){var o,i,s,u;if(c(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),s=i[t]),void 0===s)s=i[t]=n,++e._eventsCount;else if("function"==typeof s?s=i[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(o=a(e))>0&&s.length>o&&!s.warned){s.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=e,h.type=t,h.count=s.length,u=h,console&&console.warn&&console.warn(u)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=h.bind(r);return o.listener=n,r.wrapFn=o,o}function l(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(o):d(o,o.length)}function f(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function d(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function y(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function o(i){r.once&&e.removeEventListener(t,o),n(i)})}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},i.prototype.getMaxListeners=function(){return a(this)},i.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var o="error"===e,i=this._events;if(void 0!==i)o=o&&void 0===i.error;else if(!o)return!1;if(o){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var c=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw c.context=s,c}var a=i[e];if(void 0===a)return!1;if("function"==typeof a)r(a,this,t);else{var u=a.length,h=d(a,u);for(n=0;n<u;++n)r(h[n],this,t)}return!0},i.prototype.addListener=function(e,t){return u(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return u(this,e,t,!0)},i.prototype.once=function(e,t){return c(t),this.on(e,p(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return c(t),this.prependListener(e,p(this,e,t)),this},i.prototype.removeListener=function(e,t){var n,r,o,i,s;if(c(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(o=-1,i=n.length-1;i>=0;i--)if(n[i]===t||n[i].listener===t){s=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,o),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var o,i=Object.keys(n);for(r=0;r<i.length;++r)"removeListener"!==(o=i[r])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},i.prototype.listeners=function(e){return l(this,e,!0)},i.prototype.rawListeners=function(e){return l(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},i.prototype.listenerCount=f,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},15:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parse=function(e){if(e.length>8e3)throw"URI too long";const t=e,o=e.indexOf("["),i=e.indexOf("]");-1!=o&&-1!=i&&(e=e.substring(0,o)+e.substring(o,i).replace(/:/g,";")+e.substring(i,e.length));let s=n.exec(e||""),c={},a=14;for(;a--;)c[r[a]]=s[a]||"";return-1!=o&&-1!=i&&(c.source=t,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c.pathNames=function(e,t){const n=t.replace(/\/{2,9}/g,"/").split("/");return"/"!=t.slice(0,1)&&0!==t.length||n.splice(0,1),"/"==t.slice(-1)&&n.splice(n.length-1,1),n}(0,c.path),c.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}(0,c.query),c};const n=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,r=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"]},46:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ERROR_PACKET=t.PACKET_TYPES_REVERSE=t.PACKET_TYPES=void 0;const n=Object.create(null);t.PACKET_TYPES=n,n.open="0",n.close="1",n.ping="2",n.pong="3",n.message="4",n.upgrade="5",n.noop="6";const r=Object.create(null);t.PACKET_TYPES_REVERSE=r,Object.keys(n).forEach(e=>{r[n[e]]=e}),t.ERROR_PACKET={type:"error",data:"parser error"}},71:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.XHR=t.Request=t.BaseXHR=void 0;const o=n(528),i=n(454),s=n(374),c=n(624),a=n(110),u=(0,r(n(833)).default)("engine.io-client:polling");function h(){}class p extends o.Polling{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){u("xhr poll");const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,t)=>{this.onError("xhr poll error",e,t)}),this.pollXhr=e}}t.BaseXHR=p;class l extends i.Emitter{constructor(e,t,n){super(),this.createRequest=e,(0,s.installTimerFunctions)(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var e;const t=(0,s.pick)(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(t);try{u("xhr open %s: %s",this._method,this._uri),n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(e){}if("POST"===this._method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this._opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(n.getResponseHeader("set-cookie"))),4===n.readyState&&(200===n.status||1223===n.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof n.status?n.status:0)},0))},u("xhr data %s",this._data),n.send(this._data)}catch(e){return void this.setTimeoutFn(()=>{this._onError(e)},0)}"undefined"!=typeof document&&(this._index=l.requestsCount++,l.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=h,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete l.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(t.Request=l,l.requestsCount=0,l.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",f);else if("function"==typeof addEventListener){const e="onpagehide"in c.globalThisShim?"pagehide":"unload";addEventListener(e,f,!1)}function f(){for(let e in l.requests)l.requests.hasOwnProperty(e)&&l.requests[e].abort()}const d=function(){const e=y({xdomain:!1});return e&&null!==e.responseType}();function y(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||a.hasCORS))return new XMLHttpRequest}catch(e){}if(!t)try{return new(c.globalThisShim[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}t.XHR=class extends p{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=d&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new l(y,this.uri(),e)}}},92:(e,t)=>{"use strict";var n=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n)return n;throw new Error("unable to locate global object")}();e.exports=t=n.fetch,n.fetch&&(t.default=n.fetch.bind(n)),t.Headers=n.Headers,t.Request=n.Request,t.Response=n.Response},99:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=12e3,r="Event timeout",o=function(){function e(e,t){this.chn=e,this.options=t}return e.prototype.on=function(e,t){this.chn.on(e,t)},e.prototype.off=function(e,t){this.chn.off(e,t)},e.prototype.removeListeners=function(e){this.chn.removeListeners(e)},e.prototype.refreshToken=function(e){e&&(this.options.accessToken=e)},e.prototype.setMapStyle=function(e){var t=this;return new Promise(function(o,i){var s=setTimeout(function(){return i(r)},n);t.chn.emit("set:map:style",e,function(e){if(e)return i(e);clearTimeout(s),o()})})},e.prototype.getCurrentLocation=function(){var e=this;return new Promise(function(t,o){var i=setTimeout(function(){return o(r)},n);e.chn.emit("get:current:location",function(e,n){if(e)return o(e);clearTimeout(i),t(n)})})},e.prototype.pinCurrentLocation=function(){var e=this;return new Promise(function(t,o){var i=setTimeout(function(){return o(r)},n);e.chn.emit("pin:current:location",function(e,n){if(e)return o(e);clearTimeout(i),t(n)})})},e.prototype.setLiveLocationOptions=function(e){var t=this;return new Promise(function(o,i){var s=setTimeout(function(){return i(r)},n);t.chn.emit("set:live:options",e,function(e){if(e)return i(e);clearTimeout(s),o()})})},e.prototype.trackLiveLocation=function(){var e=this;return new Promise(function(t,o){var i=setTimeout(function(){return o(r)},n);e.chn.emit("track:live:location",function(e){if(e)return o(e);clearTimeout(i),t()})})},e.prototype.untrackLiveLocation=function(){var e=this;return new Promise(function(t,o){var i=setTimeout(function(){return o(r)},n);e.chn.emit("untrack:live:location",function(e){if(e)return o(e);clearTimeout(i),t()})})},e.prototype.enableDragPickLocation=function(e){var t=this;return new Promise(function(o,i){var s=setTimeout(function(){return i(r)},n);t.chn.emit("enable:dragpick:location",e,function(e){if(e)return i(e);clearTimeout(s),o()})})},e.prototype.disableDragPickLocation=function(){var e=this;return new Promise(function(t,o){var i=setTimeout(function(){return o(r)},n);e.chn.emit("disable:dragpick:location",function(e){if(e)return o(e);clearTimeout(i),t()})})},e.prototype.setDragPickContent=function(e,t){var o=this;return new Promise(function(i,s){var c=setTimeout(function(){return s(r)},n);o.chn.emit("set:dragpick:content",{type:e,content:t},function(e){if(e)return s(e);clearTimeout(c),i()})})},e.prototype.resolvePlace=function(e){var t=this;return new Promise(function(o,i){var s=setTimeout(function(){return i(r)},n);t.chn.emit("resolve:place",e,function(e,t){if(e)return i(e);clearTimeout(s),o(t)})})},e.prototype.resolveCoordinates=function(e){var t=this;return new Promise(function(o,i){var s=setTimeout(function(){return i(r)},n);t.chn.emit("resolve:coordinates",e,function(e,t){if(e)return i(e);clearTimeout(s),o(t)})})},e.prototype.searchQuery=function(e){var t=this;return new Promise(function(o,i){var s=setTimeout(function(){return i(r)},n);t.chn.emit("search:query",e,function(e,t){if(e)return i(e);clearTimeout(s),o(t)})})},e.prototype.searchSelect=function(e){var t=this;return new Promise(function(o,i){var s=setTimeout(function(){return i(r)},n);t.chn.emit("search:select",e,function(e,t){if(e)return i(e);clearTimeout(s),o(t)})})},e.prototype.showNearby=function(e){var t=this;return new Promise(function(o,i){var s=setTimeout(function(){return i(r)},n);t.chn.emit("show:nearby",e,function(e){if(e)return i(e);clearTimeout(s),o()})})},e.prototype.removeNearby=function(){var e=this;return new Promise(function(t,o){var i=setTimeout(function(){return o(r)},n);e.chn.emit("remove:nearby",function(e){if(e)return o(e);clearTimeout(i),t()})})},e.prototype.addNearbyEntity=function(e){var t=this;return new Promise(function(o,i){var s=setTimeout(function(){return i(r)},n);t.chn.emit("add:nearby:entity",e,function(e){if(e)return i(e);clearTimeout(s),o()})})},e.prototype.moveNearbyEntity=function(e){var t=this;return new Promise(function(o,i){var s=setTimeout(function(){return i(r)},n);t.chn.emit("move:nearby:entity",e,function(e){if(e)return i(e);clearTimeout(s),o()})})},e.prototype.removeNearbyEntity=function(e){var t=this;return new Promise(function(o,i){var s=setTimeout(function(){return i(r)},n);t.chn.emit("remove:nearby:entity",e,function(e){if(e)return i(e);clearTimeout(s),o()})})},e.prototype.setRoute=function(e){var t=this;return new Promise(function(o,i){var s=setTimeout(function(){return i(r)},n);t.chn.emit("set:route",e,function(e){if(e)return i(e);clearTimeout(s),o()})})},e.prototype.setRouteOrigin=function(e,t){var o=this;return new Promise(function(i,s){var c=setTimeout(function(){return s(r)},n);o.chn.emit("set:route:origin",{routeId:e,point:t},function(e){if(e)return s(e);clearTimeout(c),i()})})},e.prototype.removeRouteOrigin=function(e){var t=this;return new Promise(function(o,i){var s=setTimeout(function(){return i(r)},n);t.chn.emit("remove:route:origin",{routeId:e},function(e){if(e)return i(e);clearTimeout(s),o()})})},e.prototype.setRouteDestination=function(e,t){var o=this;return new Promise(function(i,s){var c=setTimeout(function(){return s(r)},n);o.chn.emit("set:route:destination",{routeId:e,point:t},function(e){if(e)return s(e);clearTimeout(c),i()})})},e.prototype.removeRouteDestination=function(e){var t=this;return new Promise(function(o,i){var s=setTimeout(function(){return i(r)},n);t.chn.emit("remove:route:destination",{routeId:e},function(e){if(e)return i(e);clearTimeout(s),o()})})},e.prototype.addRouteWaypoint=function(e,t){var o=this;return new Promise(function(i,s){var c=setTimeout(function(){return s(r)},n);o.chn.emit("add:route:waypoint",{routeId:e,point:t},function(e){if(e)return s(e);clearTimeout(c),i()})})},e.prototype.updateRouteWaypoint=function(e,t){var o=this;return new Promise(function(i,s){var c=setTimeout(function(){return s(r)},n);o.chn.emit("update:route:waypoint",{routeId:e,point:t},function(e){if(e)return s(e);clearTimeout(c),i()})})},e.prototype.removeRouteWaypoint=function(e,t){var o=this;return new Promise(function(i,s){var c=setTimeout(function(){return s(r)},n);o.chn.emit("remove:route:waypoint",{routeId:e,index:t},function(e){if(e)return s(e);clearTimeout(c),i()})})},e.prototype.fitRouteBounds=function(e,t){var o=this;return new Promise(function(i,s){var c=setTimeout(function(){return s(r)},n);o.chn.emit("fit:route:bounds",{routeId:e,margin:t},function(e){if(e)return s(e);clearTimeout(c),i()})})},e.prototype.fitRoutesBounds=function(e){var t=this;return new Promise(function(o,i){var s=setTimeout(function(){return i(r)},n);t.chn.emit("fit:routes:bounds",e,function(e){if(e)return i(e);clearTimeout(s),o()})})},e.prototype.setWaypointCaption=function(e,t,o){var i=this;return new Promise(function(s,c){var a=setTimeout(function(){return c(r)},n);i.chn.emit("set:waypoint:caption",{routeId:e,id:t,caption:o},function(e){if(e)return c(e);clearTimeout(a),s()})})},e.prototype.updateWaypointCaption=function(e,t,o){var i=this;return new Promise(function(s,c){var a=setTimeout(function(){return c(r)},n);i.chn.emit("update:waypoint:caption",{routeId:e,id:t,caption:o},function(e){if(e)return c(e);clearTimeout(a),s()})})},e.prototype.removeWaypointCaption=function(e,t){var o=this;return new Promise(function(i,s){var c=setTimeout(function(){return s(r)},n);o.chn.emit("remove:waypoint:caption",{routeId:e,id:t},function(e){if(e)return s(e);clearTimeout(c),i()})})},e.prototype.mountNavigation=function(e){var t=this;return new Promise(function(o,i){var s=setTimeout(function(){return i(r)},n);t.chn.emit("mount:navigation",e,function(e){if(e)return i(e);clearTimeout(s),o()})})},e.prototype.unmountNavigation=function(){var e=this;return new Promise(function(t,o){var i=setTimeout(function(){return o(r)},n);e.chn.emit("unmount:navigation",function(e){if(e)return o(e);clearTimeout(i),t()})})},e.prototype.loadNavigation=function(){var e=this;return new Promise(function(t,o){var i=setTimeout(function(){return o(r)},n);e.chn.emit("load:navigation",function(e){if(e)return o(e);clearTimeout(i),t()})})},e.prototype.setInitialNavigationPosition=function(e){var t=this;return new Promise(function(o,i){var s=setTimeout(function(){return i(r)},n);t.chn.emit("initial:navigation:position",e,function(e){if(e)return i(e);clearTimeout(s),o()})})},e.prototype.navigate=function(e){var t=this;return new Promise(function(o,i){var s=setTimeout(function(){return i(r)},n);t.chn.emit("navigate:navigation:direction",e,function(e){if(e)return i(e);clearTimeout(s),o()})})},e.prototype.casting=function(e,t,o,i){var s=this;return new Promise(function(c,a){var u=setTimeout(function(){return a(r)},n);s.chn.emit("casting:navigation:direction",{routeId:e,direction:t,position:o,options:i},function(e){if(e)return a(e);clearTimeout(u),c()})})},e.prototype.dismissNavigation=function(){var e=this;return new Promise(function(t,o){var i=setTimeout(function(){return o(r)},n);e.chn.emit("dismiss:navigation",function(e){if(e)return o(e);clearTimeout(i),t()})})},e}();t.default=o},106:function(e,t){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},r=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};function o(e){try{return JSON.stringify(e).length}catch(e){return 0}}Object.defineProperty(t,"__esModule",{value:!0});var i=["ping","pong","__heartbeat","__heartbeat_response"],s=function(){function e(e){if(void 0===e&&(e={}),this.messageQueue=[],this.messageRateTracker=[],this.reconnectAttempts=0,this.maxReconnectAttempts=5,e&&"object"!=typeof e)throw new Error("Invalid Options");this.options=n({debug:!1,heartbeatInterval:3e4,connectionTimeout:1e4,maxMessageSize:1048576,maxMessagesPerSecond:100,autoReconnect:!0,messageQueueSize:50},e),this.Events={},this.peer={type:"IFRAME",connected:!1},e.type&&(this.peer.type=e.type.toUpperCase())}return e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.options.debug&&console.debug.apply(console,e)},e.prototype.isConnected=function(){return!!this.peer.connected&&!!this.peer.source},e.prototype.startHeartbeat=function(){var e=this;this.options.heartbeatInterval&&(this.heartbeatTimer=setInterval(function(){if(e.isConnected()){var t=Date.now();if(e.peer.lastHeartbeat&&t-e.peer.lastHeartbeat>2*e.options.heartbeatInterval)return e.debug("[".concat(e.peer.type,"] Heartbeat timeout detected")),void e.handleConnectionLoss();try{e.emit("__heartbeat",{timestamp:t})}catch(t){e.debug("[".concat(e.peer.type,"] Heartbeat send failed:"),t),e.handleConnectionLoss()}}},this.options.heartbeatInterval))},e.prototype.stopHeartbeat=function(){this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0)},e.prototype.handleConnectionLoss=function(){this.peer.connected&&(this.peer.connected=!1,this.stopHeartbeat(),this.fire("disconnect",{reason:"CONNECTION_LOST"}),this.options.autoReconnect&&this.reconnectAttempts<this.maxReconnectAttempts&&this.attemptReconnection())},e.prototype.attemptReconnection=function(){var e=this;if(!this.reconnectTimer){this.reconnectAttempts++;var t=Math.min(1e3*Math.pow(2,this.reconnectAttempts-1),3e4);this.debug("[".concat(this.peer.type,"] Attempting reconnection ").concat(this.reconnectAttempts,"/").concat(this.maxReconnectAttempts," in ").concat(t,"ms")),this.fire("reconnecting",{attempt:this.reconnectAttempts,delay:t}),this.reconnectTimer=setTimeout(function(){e.reconnectTimer=void 0,"WINDOW"===e.peer.type&&e.peer.source&&e.peer.origin&&e.emit("ping"),setTimeout(function(){e.peer.connected||(e.reconnectAttempts<e.maxReconnectAttempts?e.attemptReconnection():e.fire("reconnection_failed",{attempts:e.reconnectAttempts}))},e.options.connectionTimeout)},t)}},e.prototype.checkRateLimit=function(){if(!this.options.maxMessagesPerSecond)return!0;var e=Date.now(),t=e-1e3;return this.messageRateTracker=this.messageRateTracker.filter(function(e){return e>t}),this.messageRateTracker.length>=this.options.maxMessagesPerSecond?(this.fire("error",{type:"RATE_LIMIT_EXCEEDED",limit:this.options.maxMessagesPerSecond,current:this.messageRateTracker.length}),!1):(this.messageRateTracker.push(e),!0)},e.prototype.queueMessage=function(e,t,n){if(this.messageQueue.length>=this.options.messageQueueSize){var r=this.messageQueue.shift();this.debug("[".concat(this.peer.type,"] Message queue full, removed oldest message:"),null==r?void 0:r._event)}this.messageQueue.push({_event:e,payload:t,fn:n,timestamp:Date.now()}),this.debug("[".concat(this.peer.type,"] Queued message: ").concat(e," (queue size: ").concat(this.messageQueue.length,")"))},e.prototype.processMessageQueue=function(){var e=this;if(this.isConnected()&&0!==this.messageQueue.length){this.debug("[".concat(this.peer.type,"] Processing ").concat(this.messageQueue.length," queued messages"));var t=r([],this.messageQueue,!0);this.messageQueue=[],t.forEach(function(t){try{e.emit(t._event,t.payload,t.fn)}catch(t){e.debug("[".concat(e.peer.type,"] Failed to send queued message:"),t)}})}},e.prototype.initiate=function(e,t){var n=this;if(!e||!t)throw new Error("Invalid Connection initiation arguments");if("IFRAME"===this.peer.type)throw new Error("Expect IFRAME to <listen> and WINDOW to <initiate> a connection");return this.cleanup(),this.peer.source=e,this.peer.origin=t,this.peer.connected=!1,this.reconnectAttempts=0,this.messageListener=function(e){var t=e.origin,r=e.data,o=e.source;try{if(t!==n.peer.origin||!o||"object"!=typeof r||!r.hasOwnProperty("_event"))return;var i=r,s=i._event,c=i.payload,a=i.cid;if(i.timestamp,"__heartbeat_response"===s)return void(n.peer.lastHeartbeat=Date.now());if("__heartbeat"===s)return n.emit("__heartbeat_response",{timestamp:Date.now()}),void(n.peer.lastHeartbeat=Date.now());if(n.debug("[".concat(n.peer.type,"] Message: ").concat(s),c||""),"pong"==s)return n.peer.connected=!0,n.reconnectAttempts=0,n.peer.lastHeartbeat=Date.now(),n.startHeartbeat(),n.fire("connect"),n.processMessageQueue(),void n.debug("[".concat(n.peer.type,"] connected"));n.fire(s,c,a)}catch(e){n.debug("[".concat(n.peer.type,"] Message handling error:"),e),n.fire("error",{type:"MESSAGE_HANDLING_ERROR",error:e instanceof Error?e.message:String(e),origin:t})}},window.addEventListener("message",this.messageListener,!1),this.debug("[".concat(this.peer.type,"] Initiate connection: IFrame origin <").concat(t,">")),this.emit("ping"),this},e.prototype.listen=function(e){var t=this;return this.peer.type="IFRAME",this.peer.connected=!1,this.reconnectAttempts=0,this.debug("[".concat(this.peer.type,"] Listening to connect").concat(e?": Host <".concat(e,">"):"")),this.cleanup(),this.messageListener=function(r){var o=r.origin,i=r.data,s=r.source;try{if(e&&e!==o)return void t.fire("error",{type:"INVALID_ORIGIN",expected:e,received:o});if(!s||"object"!=typeof i||!i.hasOwnProperty("_event"))return;if(t.peer.source){if(o!==t.peer.origin)return void t.fire("error",{type:"ORIGIN_MISMATCH",expected:t.peer.origin,received:o})}else t.peer=n(n({},t.peer),{source:s,origin:o}),t.debug("[".concat(t.peer.type,"] Connect to ").concat(o));var c=i._event,a=i.payload,u=i.cid;if(i.timestamp,"__heartbeat_response"===c)return void(t.peer.lastHeartbeat=Date.now());if("__heartbeat"===c)return t.emit("__heartbeat_response",{timestamp:Date.now()}),void(t.peer.lastHeartbeat=Date.now());if(t.debug("[".concat(t.peer.type,"] Message: ").concat(c),a||""),"ping"==c)return t.emit("pong"),t.peer.connected=!0,t.reconnectAttempts=0,t.peer.lastHeartbeat=Date.now(),t.startHeartbeat(),t.fire("connect"),t.processMessageQueue(),void t.debug("[".concat(t.peer.type,"] connected"));t.fire(c,a,u)}catch(e){t.debug("[".concat(t.peer.type,"] Message handling error:"),e),t.fire("error",{type:"MESSAGE_HANDLING_ERROR",error:e instanceof Error?e.message:String(e),origin:o})}},window.addEventListener("message",this.messageListener,!1),this},e.prototype.fire=function(e,t,n){var r=this;if(this.Events[e]||this.Events[e+"--@once"]){var o=n?function(t){for(var o=[],i=1;i<arguments.length;i++)o[i-1]=arguments[i];r.emit("".concat(e,"--").concat(n,"--@ack"),{error:t||!1,args:o})}:void 0,i=[];this.Events[e+"--@once"]?(e+="--@once",i=this.Events[e],delete this.Events[e]):i=this.Events[e],i.forEach(function(n){try{void 0!==t?n(t,o):n(o)}catch(t){r.debug("[".concat(r.peer.type,"] Listener error for ").concat(e,":"),t),r.fire("error",{type:"LISTENER_ERROR",event:e,error:t instanceof Error?t.message:String(t)})}})}else this.debug("[".concat(this.peer.type,"] No <").concat(e,"> listener defined"))},e.prototype.emit=function(e,t,n){if(!this.checkRateLimit())return this;if(!this.isConnected()&&!i.includes(e))return this.queueMessage(e,t,n),this;if(!this.peer.source)return this.fire("error",{type:"NO_CONNECTION",event:e}),this;"function"==typeof t&&(n=t,t=void 0);try{var s=t?function(e,t){if(!e)return e;var n=o(e);if(n>t)throw new Error("Message size ".concat(n," exceeds limit ").concat(t));return JSON.parse(JSON.stringify(e))}(t,this.options.maxMessageSize):t,c=void 0;if("function"==typeof n){var a=n;p=Date.now(),l=Math.floor(9e5*Math.random()+1e5),c="".concat(p,"_").concat(l),this.once("".concat(e,"--").concat(c,"--@ack"),function(e){var t=e.error,n=e.args;return a.apply(void 0,r([t],n,!1))})}var u={_event:e,payload:s,cid:c,timestamp:Date.now(),size:o(s)};this.peer.source.postMessage((h=u,JSON.parse(JSON.stringify(h))),this.peer.origin)}catch(t){this.debug("[".concat(this.peer.type,"] Emit error:"),t),this.fire("error",{type:"EMIT_ERROR",event:e,error:t instanceof Error?t.message:String(t)}),"function"==typeof n&&n(t instanceof Error?t.message:String(t))}var h,p,l;return this},e.prototype.on=function(e,t){return this.Events[e]||(this.Events[e]=[]),this.Events[e].push(t),this.debug("[".concat(this.peer.type,"] New <").concat(e,"> listener on")),this},e.prototype.once=function(e,t){return e+="--@once",this.Events[e]||(this.Events[e]=[]),this.Events[e].push(t),this.debug("[".concat(this.peer.type,"] New <").concat(e," once> listener on")),this},e.prototype.off=function(e,t){if(t&&this.Events[e]){var n=this.Events[e].indexOf(t);n>-1&&(this.Events[e].splice(n,1),0===this.Events[e].length&&delete this.Events[e])}else delete this.Events[e];return"function"==typeof t&&t(),this.debug("[".concat(this.peer.type,"] <").concat(e,"> listener off")),this},e.prototype.removeListeners=function(e){return this.Events={},"function"==typeof e&&e(),this.debug("[".concat(this.peer.type,"] All listeners removed")),this},e.prototype.emitAsync=function(e,t,n){var r=this;return void 0===n&&(n=5e3),new Promise(function(o,i){var s=setTimeout(function(){i(new Error("Event '".concat(e,"' acknowledgment timeout after ").concat(n,"ms")))},n);try{r.emit(e,t,function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];clearTimeout(s),e?i(new Error("string"==typeof e?e:"Ack error")):o(0===t.length?void 0:1===t.length?t[0]:t)})}catch(e){clearTimeout(s),i(e)}})},e.prototype.onceAsync=function(e){var t=this;return new Promise(function(n){return t.once(e,n)})},e.prototype.connectAsync=function(e){var t=this;return new Promise(function(n,r){if(t.isConnected())return n();var o=setTimeout(function(){t.off("connect",i),r(new Error("Connection timeout"))},e||t.options.connectionTimeout),i=function(){clearTimeout(o),n()};t.once("connect",i)})},e.prototype.cleanup=function(){this.messageListener&&(window.removeEventListener("message",this.messageListener),this.messageListener=void 0),this.stopHeartbeat(),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0)},e.prototype.disconnect=function(e){return this.cleanup(),this.peer.connected=!1,this.peer.source=void 0,this.peer.origin=void 0,this.peer.lastHeartbeat=void 0,this.messageQueue=[],this.messageRateTracker=[],this.reconnectAttempts=0,this.removeListeners(),"function"==typeof e&&e(),this.debug("[".concat(this.peer.type,"] Disconnected")),this},e.prototype.getStats=function(){return{connected:this.isConnected(),peerType:this.peer.type,origin:this.peer.origin,lastHeartbeat:this.peer.lastHeartbeat,queuedMessages:this.messageQueue.length,reconnectAttempts:this.reconnectAttempts,activeListeners:Object.keys(this.Events).length,messageRate:this.messageRateTracker.length}},e.prototype.clearQueue=function(){var e=this.messageQueue.length;return this.messageQueue=[],this.debug("[".concat(this.peer.type,"] Cleared ").concat(e," queued messages")),this},e}();t.default=s},110:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hasCORS=void 0;let n=!1;try{n="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}t.hasCORS=n},133:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hasBinary=t.isBinary=void 0;const n="function"==typeof ArrayBuffer,r=Object.prototype.toString,o="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===r.call(Blob),i="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===r.call(File);function s(e){return n&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||o&&e instanceof Blob||i&&e instanceof File}t.isBinary=s,t.hasBinary=function e(t,n){if(!t||"object"!=typeof t)return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(e(t[n]))return!0;return!1}if(s(t))return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1===arguments.length)return e(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return!0;return!1}},197:function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},i.apply(this,arguments)},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var c=n(7),a=s(n(106)),u=s(n(278)),h=s(n(99)),p=s(n(1)),l=["allow-scripts","allow-same-origin"],f=["geolocation"],d={},y=function(e){function t(t){var n=e.call(this)||this;if(n.options=t,!n.options.accessToken)throw new Error("Invalid Access Token");return n.isDev="dev"==n.options.env||!1,n.baseURL=n.isDev?"http://localhost:4800":"https://msi.dedot.io",n.isConnected=!1,n}return o(t,e),t.prototype.onload=function(e){var t=this,n=e.target;this.chn&&this.chn.removeListeners(),this.chn=new a.default({type:"WINDOW"}),this.chn.initiate(n.contentWindow,this.baseURL),this.chn.once("connect",function(){var e;null===(e=t.chn)||void 0===e||e.emit("bind",i(i({},t.options),{origin:window.origin}),function(e){if(e)return t.emit("error",new Error(e));t.isConnected=!0})}).on("error",function(e){return t.emit("error","object"==typeof e?e:new Error(e))}).on("ready",function(){console.log("Ready by ready-event"),t.emit("ready"),t.emit("loaded",t.chn)})},t.prototype.render=function(){var e=document.getElementById(this.options.element);if(!e)throw new Error("HTML Element Container <#".concat(this.options.element,"> Not Found"));e.innerHTML='<iframe id="de-sdk:map"\n src="'.concat(this.baseURL,'"\n style="width:100%;height:100%;border:none;"\n title="De.MSI Gateway"\n importance="high"\n referrerpolicy="origin"\n allow="').concat(f.join(),'"\n sandbox="').concat(l.join(" "),'"></iframe>');var t=document.getElementById("de-sdk:map");if(!t)throw new Error("Unexpected Error Occured. Check HTML Element selector");t.onload=this.onload.bind(this)},t.prototype.networkError=function(){this.isConnected=!1,this.emit("error",new Error("Internet network problem"))},t.prototype.load=function(){var e=this;return new Promise(function(t,n){e.once("loaded",function(n){var r=new h.default(n,e.options),o=new u.default(n,r,e.options),i=new p.default(n,o,r,e.options);i.mount(d),t({controls:r,handles:o,plugins:i})}).once("error",n),window.fetch(e.baseURL,{mode:"no-cors"}).then(e.render.bind(e)).catch(e.networkError.bind(e))})},t.prototype.isReady=function(){return this.chn&&this.isConnected},t.prototype.plugin=function(e,t){d[e]=t},t}(c.EventEmitter);t.default=y},202:function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,c)}a((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=c(0),s.throw=c(1),s.return=c(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(t,n){var r=this;if(!t)throw new Error("Undefined <clientId>");return(r=e.call(this,n,"API")||this).clientId=t,r}return o(t,e),t.prototype.fetchActiveOrders=function(){return i(this,void 0,void 0,function(){var e,t,n,r,o;return s(this,function(i){switch(i.label){case 0:if(!this.accessToken)throw new Error("Authentication required");return e={url:"/client/".concat(this.clientId,"/orders/actives"),method:"GET"},[4,this.request(e)];case 1:if(t=i.sent(),n=t.error,r=t.message,o=t.orders,n)throw new Error(r);return[2,o]}})})},t.prototype.fetchOrderHistory=function(){return i(this,void 0,void 0,function(){var e,t,n,r,o;return s(this,function(i){switch(i.label){case 0:if(!this.accessToken)throw new Error("Authentication required");return e={url:"/client/".concat(this.clientId,"/orders/history"),method:"GET"},[4,this.request(e)];case 1:if(t=i.sent(),n=t.error,r=t.message,o=t.orders,n)throw new Error(r);return[2,o]}})})},t.prototype.nearby=function(e){return i(this,void 0,void 0,function(){var t,n,r,o,i;return s(this,function(s){switch(s.label){case 0:if(!this.accessToken)throw new Error("Authentication required");if(!e)throw new Error("Undefined epicenter location");if(!e.lng||!e.lat)throw new Error("Invalid location coordinates");return t={url:"/client/".concat(this.clientId,"/nearby"),method:"POST",body:e},[4,this.request(t)];case 1:if(n=s.sent(),r=n.error,o=n.message,i=n.nearby,r)throw new Error(o);return[2,i]}})})},t}(c(n(611)).default);t.default=a},209:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Fetch=void 0;const r=n(528);class o extends r.Polling{doPoll(){this._fetch().then(e=>{if(!e.ok)return this.onError("fetch read error",e.status,e);e.text().then(e=>this.onData(e))}).catch(e=>{this.onError("fetch read error",e)})}doWrite(e,t){this._fetch(e).then(e=>{if(!e.ok)return this.onError("fetch write error",e.status,e);t()}).catch(e=>{this.onError("fetch write error",e)})}_fetch(e){var t;const n=void 0!==e,r=new Headers(this.opts.extraHeaders);return n&&r.set("content-type","text/plain;charset=UTF-8"),null===(t=this.socket._cookieJar)||void 0===t||t.appendCookies(r),fetch(this.uri(),{method:n?"POST":"GET",body:n?e:null,headers:r,credentials:this.opts.withCredentials?"include":"omit"}).then(e=>{var t;return null===(t=this.socket._cookieJar)||void 0===t||t.parseCookies(e.headers.getSetCookie()),e})}}t.Fetch=o},214:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Socket=void 0;const o=n(627),i=n(942),s=n(454),c=(0,r(n(833)).default)("socket.io-client:socket"),a=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class u extends s.Emitter{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[(0,i.on)(e,"open",this.onopen.bind(this)),(0,i.on)(e,"packet",this.onpacket.bind(this)),(0,i.on)(e,"error",this.onerror.bind(this)),(0,i.on)(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var n,r,i;if(a.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const s={type:o.PacketType.EVENT,data:t,options:{}};if(s.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++;c("emitting packet with ack id %d",e);const n=t.pop();this._registerAckCallback(e,n),s.id=e}const u=null===(r=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===r?void 0:r.writable,h=this.connected&&!(null===(i=this.io.engine)||void 0===i?void 0:i._hasPingExpired());return this.flags.volatile&&!u?c("discard packet as the transport is not currently writable"):h?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[e]=t);const o=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&(c("removing packet with ack id %d from the buffer",e),this.sendBuffer.splice(t,1));c("event with ack id %d has timed out after %d ms",e,r),t.call(this,new Error("operation has timed out"))},r),i=(...e)=>{this.io.clearTimeoutFn(o),t.apply(this,e)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise((n,r)=>{const o=(e,t)=>e?r(e):n(t);o.withError=!0,t.push(o),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>{if(n===this._queue[0])return null!==e?n.tryCount>this._opts.retries&&(c("packet [%d] is discarded after %d tries",n.id,n.tryCount),this._queue.shift(),t&&t(e)):(c("packet [%d] was successfully sent",n.id),this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue()}),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(c("draining queue"),!this.connected||0===this._queue.length)return;const t=this._queue[0];!t.pending||e?(t.pending=!0,t.tryCount++,c("sending packet [%d] (try n°%d)",t.id,t.tryCount),this.flags=t.flags,this.emit.apply(this,t.args)):c("packet [%d] has already been sent and is waiting for an ack",t.id)}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){c("transport is open - connecting"),"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:o.PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){c("close (%s)",e),this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case o.PacketType.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case o.PacketType.EVENT:case o.PacketType.BINARY_EVENT:this.onevent(e);break;case o.PacketType.ACK:case o.PacketType.BINARY_ACK:this.onack(e);break;case o.PacketType.DISCONNECT:this.ondisconnect();break;case o.PacketType.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];c("emitting event %j",t),null!=e.id&&(c("attaching ack callback to event"),t.push(this.ack(e.id))),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...r){n||(n=!0,c("sending ack %j",r),t.packet({type:o.PacketType.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t?(delete this.acks[e.id],c("calling ack %s with %j",e.id,e.data),t.withError&&e.data.unshift(null),t.apply(this,e.data)):c("bad ack %s",e.id)}onconnect(e,t){c("socket connected with id %s",e),this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){c("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&(c("performing disconnect (%s)",this.nsp),this.packet({type:o.PacketType.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}t.Socket=u},223:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Socket=t.SocketWithUpgrade=t.SocketWithoutUpgrade=void 0;const o=n(419),i=n(374),s=n(661),c=n(15),a=n(454),u=n(376),h=n(624),p=(0,r(n(833)).default)("engine.io-client:socket"),l="function"==typeof addEventListener&&"function"==typeof removeEventListener,f=[];l&&addEventListener("offline",()=>{p("closing %d connection(s) because the network was lost",f.length),f.forEach(e=>e())},!1);class d extends a.Emitter{constructor(e,t){if(super(),this.binaryType=h.defaultBinaryType,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const n=(0,c.parse)(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=(0,c.parse)(t.host).host);(0,i.installTimerFunctions)(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=(0,s.decode)(this.opts.query)),l&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(p("adding listener for the 'offline' event"),this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},f.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=(0,h.createCookieJar)()),this._open()}createTransport(e){p('creating transport "%s"',e);const t=Object.assign({},this.opts.query);t.EIO=u.protocol,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return p("options: %j",n),new this._transportsByName[e](n)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const e=this.opts.rememberUpgrade&&d.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){p("setting transport %s",e.name),this.transport&&(p("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){p("socket open"),this.readyState="open",d.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(p('socket receive: type "%s", data "%s"',e.type,e.data),this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}else p('packet received with socket readyState "%s"',this.readyState)}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();p("flushing %d packets in socket",e.length),this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){const n=this.writeBuffer[t].data;if(n&&(e+=(0,i.byteLength)(n)),t>0&&e>this._maxPayload)return p("only send %d out of %d packets",t,this.writeBuffer.length),this.writeBuffer.slice(0,t);e+=2}return p("payload size is %d (max: %d)",e,this._maxPayload),this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(p("throttled timer detected, scheduling connection close"),this._pingTimeoutTime=0,(0,h.nextTick)(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket("message",e,t,n),this}send(e,t,n){return this._sendPacket("message",e,t,n),this}_sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const o={type:e,data:t,options:n};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),p("socket closing - telling transport to close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(e){if(p("socket error %j",e),d.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return p("trying next transport"),this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(p('socket close with reason: "%s"',e),this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),l&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=f.indexOf(this._offlineEventListener);-1!==e&&(p("removing listener for the 'offline' event"),f.splice(e,1))}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}t.SocketWithoutUpgrade=d,d.protocol=u.protocol;class y extends d{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade){p("starting upgrade probes");for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}}_probe(e){p('probing transport "%s"',e);let t=this.createTransport(e),n=!1;d.priorWebsocketSuccess=!1;const r=()=>{n||(p('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",r=>{if(!n)if("pong"===r.type&&"probe"===r.data){if(p('probe transport "%s" pong',e),this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;d.priorWebsocketSuccess="websocket"===t.name,p('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{n||"closed"!==this.readyState&&(p("changing transport and sending upgrade packet"),u(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{p('probe transport "%s" failed',e);const n=new Error("probe error");n.transport=t.name,this.emitReserved("upgradeError",n)}}))};function o(){n||(n=!0,u(),t.close(),t=null)}const i=n=>{const r=new Error("probe error: "+n);r.transport=t.name,o(),p('probe transport "%s" failed because of error: %s',e,n),this.emitReserved("upgradeError",r)};function s(){i("transport closed")}function c(){i("socket closed")}function a(e){t&&e.name!==t.name&&(p('"%s" works - aborting "%s"',e.name,t.name),o())}const u=()=>{t.removeListener("open",r),t.removeListener("error",i),t.removeListener("close",s),this.off("close",c),this.off("upgrading",a)};t.once("open",r),t.once("error",i),t.once("close",s),this.once("close",c),this.once("upgrading",a),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}t.SocketWithUpgrade=y,t.Socket=class extends y{constructor(e,t={}){const n="object"==typeof e?e:t;(!n.transports||n.transports&&"string"==typeof n.transports[0])&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(e=>o.transports[e]).filter(e=>!!e)),super(e,n)}}},266:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(332));t.default={Stream:o.default}},278:function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},i.apply(this,arguments)},s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,c)}a((r=r.apply(e,t||[])).next())})},c=this&&this.__generator||function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=c(0),s.throw=c(1),s.return=c(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var u=n(7),h=a(n(332)),p=function(e){function t(t,n,r){var o=e.call(this)||this;return o.chn=t,o.options=r,o.controls=n,o}return o(t,e),t.prototype.onPickLocation=function(e){this.chn.on("pick:location",e)},t.prototype.myLocation=function(e){var t,n=this;if(this.chn){null===(t=this.chn)||void 0===t||t.emit("pin:current:location",e||"client");var r=new h.default;return this.chn.on("current:location",function(e){return r.sync(e)}).on("live:location:start",function(e){return r.sync(e)}).on("live:location:update",function(e){return r.sync(e)}).on("live:location:end",function(e){return r.sync(e)}).on("current:location:error",function(e){return r.error(new Error(e))}),r.onerror(function(e){return console.error("[Stream Error] ",e)}).onclose(function(){n.chn&&n.chn.off("current:location").off("current:location:live").off("current:location:error")}),r}},t.prototype.peerLocation=function(e,t){var n,r=this;if(this.chn){null===(n=this.chn)||void 0===n||n.emit("pin:peer:location",{id:"peer",position:e,caption:t});var o=new h.default;return o.on("data",function(e){var t,n=e.position,i=e.caption;if(!n)return o.error(new Error("Invalid Data"));null===(t=r.chn)||void 0===t||t.emit("pin:peer:location",{id:"peer",position:n,caption:i})}).onerror(function(e){return console.error("[Stream Error] ",e)}).onclose(function(){var e;return null===(e=r.chn)||void 0===e?void 0:e.emit("unpin:peer:location","peer")}),o}},t.prototype.nearby=function(e){var t,n=this;if(this.chn){var r=this,o=!1;null===(t=this.chn)||void 0===t||t.emit("show:nearby",e);var i=new h.default,s={add:function(t){return new Promise(function(n,i){var s,c;if(!o){for(var a=0;a<e.length;a++)if(e[a].id===t.id){e.splice(a,1),null===(s=r.chn)||void 0===s||s.emit("remove:nearby:entity",t.id);break}e.push(t),null===(c=r.chn)||void 0===c||c.emit("add:nearby:entity",t,function(){clearTimeout(void 0),n(),r.emit("nearby--stream","add",t)}),setTimeout(function(){return i("Add entity timeout")},8e3)}})},remove:function(t){return new Promise(function(n,i){var s;o||(e=e.filter(function(e){return e.id!==t}),null===(s=r.chn)||void 0===s||s.emit("remove:nearby:entity",t,function(){clearTimeout(void 0),n(),r.emit("nearby--stream","remove",t)}),setTimeout(function(){return i("Remove entity timeout")},8e3))})},move:function(e){return new Promise(function(t,n){var i;o||(null===(i=r.chn)||void 0===i||i.emit("move:nearby:entity",e,function(){clearTimeout(void 0),t(),r.emit("nearby--stream","move",e)}),setTimeout(function(){return n("Remove entity timeout")},8e3))})}},c=function(e){var t;o||null===(t=n.chn)||void 0===t||t.emit("remove:nearby",function(t){if("string"==typeof t)return"function"==typeof e&&e(new Error(t));o=!0,i.isActive()&&i.close(),"function"==typeof e&&e()})};return this.on("nearby--stream",function(t,n){return i.sync({action:t,dataset:n,list:e})}),i.onerror(function(e){return console.error("[Stream Error] ",e)}).onclose(function(e){n.off("nearby--stream",e||function(){}),c()}),{live:function(e){return e(s),i},pipe:i.pipe,close:c}}},t.prototype.pickupPoint=function(e,t){return s(this,void 0,void 0,function(){var n,r;return c(this,function(o){switch(o.label){case 0:return n=i({label:"Pickup point"},t||{}),[4,null===(r=this.controls)||void 0===r?void 0:r.setRouteOrigin("main",{coords:e,caption:n})];case 1:return o.sent(),[2]}})})},t.prototype.dropoffPoint=function(e,t){return s(this,void 0,void 0,function(){var n,r;return c(this,function(o){switch(o.label){case 0:return n=i({label:"Destination point"},t||{}),[4,null===(r=this.controls)||void 0===r?void 0:r.setRouteDestination("main",{coords:e,caption:n})];case 1:return o.sent(),[2]}})})},t.prototype.peerDirection=function(e){var t=this;if(this.chn){var n=new h.default;return n.on("data",function(r){var o,i=r.status,s=r.direction,c=r.position;if(!s||!c)return n.error(new Error("Invalid Data"));switch(null===(o=t.controls)||void 0===o||o.casting("peer-direction",s,c,e),i){case"STALE":case"STARTED":case"LONG_STOP":case"LOW_TRAFFIC":case"HIGH_TRAFFIC":case"MODERATE_TRAFFIC":case"SPEED_WARNING":case"NEARBY":case"ARRIVED":t.emit("pe:".concat(i.toLowerCase()));break;case"UNAVAILABLE":t.emit("pe:closed"),n.isActive()&&n.close()}}).onerror(function(e){return console.error("[Stream Error] ",e)}),n}},t.prototype.navigation=function(e){var t=this;return new Promise(function(n,r){var o;t.chn&&(null===(o=t.controls)||void 0===o||o.setRoute(e).then(function(){return s(t,void 0,void 0,function(){var o,i,s,a,u;return c(this,function(c){switch(c.label){case 0:return(i=e.origin)?[3,2]:[4,null===(s=this.controls)||void 0===s?void 0:s.getCurrentLocation()];case 1:i=c.sent(),c.label=2;case 2:return(o=i)?(function(){var e,r=new h.default;null===(e=t.chn)||void 0===e||e.on("navigation:direction",function(e){var n=e.status,o=e.direction,i=e.position;switch(r.sync({status:n,direction:o,position:i}),n){case"STALE":case"STARTED":case"LONG_STOP":case"LOW_TRAFFIC":case"HIGH_TRAFFIC":case"MODERATE_TRAFFIC":case"SPEED_WARNING":case"NEARBY":case"ARRIVED":t.emit("pe:".concat(n.toLowerCase()));break;case"UNAVAILABLE":t.emit("pe:closed"),r.isActive()&&r.close()}}),r.on("data",function(e){var n,o=e.position;if(!o)return r.error(new Error("Invalid Data"));null===(n=t.controls)||void 0===n||n.navigate(o)}).onerror(function(e){return console.error("[Stream Error] ",e)}).onclose(function(){var e,n;null===(e=t.chn)||void 0===e||e.off("navigation:direction"),null===(n=t.controls)||void 0===n||n.unmountNavigation()}),n(r)}(),[4,null===(a=this.controls)||void 0===a?void 0:a.mountNavigation(e.routeId)]):[2,r("Unable to get current location")];case 3:return c.sent(),[4,null===(u=this.controls)||void 0===u?void 0:u.setInitialNavigationPosition(o)];case 4:return c.sent(),[2]}})})}).catch(r))})},t}(u.EventEmitter);t.default=p},310:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Record=void 0;var r=n(388),o=function(){function e(e){this.socket=e}return e.prototype.get=function(e){var t=this;return new Promise(function(n,r){t.socket.emit("@record:get",e,function(e,t){return e?r(e):n(t)})})},e.prototype.delete=function(e){var t=this;return new Promise(function(n,r){t.socket.emit("@record:del",e,function(e,t){return e?r(e):n(t)})})},e.prototype.fetch=function(e){var t=this;return new Promise(function(n,r){t.socket.emit("@record:fetch",e,function(e,t){return e?r(e):n(t)})})},e.prototype.find=function(e){var t=this;return new Promise(function(n,r){t.socket.emit("@record:find",e,function(e,t){return e?r(e):n(t)})})},e}();t.Record=o;var i=function(){function e(e){if(!e.accessToken)throw new Error("Undefined Access Token");this.options=e}return e.getInstance=function(t){return e.instance||(e.instance=new e(t)),e.instance},e.prototype.connect=function(){var e=this.options.dev?"http://localhost:11011":"https://iot.dedot.io",t=(0,r.io)("".concat(e,"/").concat(this.options.channel),{auth:{accessToken:this.options.accessToken}});return{socket:t,api:{records:new o(t)}}},e}();t.default=i},332:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this._STALED=!1,this._CLOSED=!1,this._fns=[],this._exitFn=function(){},this._errorFn=function(e){}}return e.prototype._upstream=function(e){return this._upStream=e,this},e.prototype._backpressure=function(e){!this._CLOSED&&this._fns.map(function(t){return t(e)})},e.prototype.sync=function(e){var t;!this._CLOSED&&(null===(t=this._downStream)||void 0===t||t._backpressure(e))},e.prototype.on=function(e,t){if(this._CLOSED)throw new Error("Stream closed");return this._fns.push(t),this},e.prototype.pipe=function(e){return e._upstream(this),this._downStream=e,this},e.prototype.error=function(e){var t;return this._errorFn("string"==typeof e?new Error(e):e),null===(t=this._downStream)||void 0===t||t.error(e),this},e.prototype.close=function(){var e;this._CLOSED||(this._CLOSED=!0,this._fns=[],this._exitFn(),null===(e=this._downStream)||void 0===e||e.close())},e.prototype.isActive=function(){return!this._CLOSED},e.prototype.onerror=function(e){return this._errorFn=e,this},e.prototype.onclose=function(e){return this._exitFn=e,this},e}();t.default=n},374:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pick=function(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})},t.installTimerFunctions=function(e,t){t.useNativeTimers?(e.setTimeoutFn=o.bind(r.globalThisShim),e.clearTimeoutFn=i.bind(r.globalThisShim)):(e.setTimeoutFn=r.globalThisShim.setTimeout.bind(r.globalThisShim),e.clearTimeoutFn=r.globalThisShim.clearTimeout.bind(r.globalThisShim))},t.byteLength=function(e){return"string"==typeof e?function(e){let t=0,n=0;for(let r=0,o=e.length;r<o;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}(e):Math.ceil((e.byteLength||e.size)*s)},t.randomString=function(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)};const r=n(624),o=r.globalThisShim.setTimeout,i=r.globalThisShim.clearTimeout,s=1.33},376:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decodePayload=t.decodePacket=t.encodePayload=t.encodePacket=t.protocol=void 0,t.createPacketEncoderStream=function(){return new TransformStream({transform(e,t){(0,r.encodePacketToBinary)(e,n=>{const r=n.length;let o;if(r<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,r);else if(r<65536){o=new Uint8Array(3);const e=new DataView(o.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{o=new Uint8Array(9);const e=new DataView(o.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(o[0]|=128),t.enqueue(o),t.enqueue(n)})}})},t.createPacketDecoderStream=function(e,t){c||(c=new TextDecoder);const n=[];let r=0,s=-1,h=!1;return new TransformStream({transform(p,l){for(n.push(p);;){if(0===r){if(a(n)<1)break;const e=u(n,1);h=!(128&~e[0]),s=127&e[0],r=s<126?3:126===s?1:2}else if(1===r){if(a(n)<2)break;const e=u(n,2);s=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(a(n)<8)break;const e=u(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),o=t.getUint32(0);if(o>Math.pow(2,21)-1){l.enqueue(i.ERROR_PACKET);break}s=o*Math.pow(2,32)+t.getUint32(4),r=3}else{if(a(n)<s)break;const e=u(n,s);l.enqueue((0,o.decodePacket)(h?e:c.decode(e),t)),r=0}if(0===s||s>e){l.enqueue(i.ERROR_PACKET);break}}}})};const r=n(686);Object.defineProperty(t,"encodePacket",{enumerable:!0,get:function(){return r.encodePacket}});const o=n(662);Object.defineProperty(t,"decodePacket",{enumerable:!0,get:function(){return o.decodePacket}});const i=n(46),s=String.fromCharCode(30);let c;function a(e){return e.reduce((e,t)=>e+t.length,0)}function u(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let o=0;o<t;o++)n[o]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}t.encodePayload=(e,t)=>{const n=e.length,o=new Array(n);let i=0;e.forEach((e,c)=>{(0,r.encodePacket)(e,!1,e=>{o[c]=e,++i===n&&t(o.join(s))})})},t.decodePayload=(e,t)=>{const n=e.split(s),r=[];for(let e=0;e<n.length;e++){const i=(0,o.decodePacket)(n[e],t);if(r.push(i),"error"===i.type)break}return r},t.protocol=4},388:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WebTransport=t.WebSocket=t.NodeWebSocket=t.XHR=t.NodeXHR=t.Fetch=t.Socket=t.Manager=t.protocol=void 0,t.io=u,t.connect=u,t.default=u;const o=n(894),i=n(776);Object.defineProperty(t,"Manager",{enumerable:!0,get:function(){return i.Manager}});const s=n(214);Object.defineProperty(t,"Socket",{enumerable:!0,get:function(){return s.Socket}});const c=(0,r(n(833)).default)("socket.io-client"),a={};function u(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};const n=(0,o.url)(e,t.path||"/socket.io"),r=n.source,s=n.id,u=n.path,h=a[s]&&u in a[s].nsps;let p;return t.forceNew||t["force new connection"]||!1===t.multiplex||h?(c("ignoring socket cache for %s",r),p=new i.Manager(r,t)):(a[s]||(c("new io instance for %s",r),a[s]=new i.Manager(r,t)),p=a[s]),n.query&&!t.query&&(t.query=n.queryKey),p.socket(n.path,t)}Object.assign(u,{Manager:i.Manager,Socket:s.Socket,io:u,connect:u});var h=n(627);Object.defineProperty(t,"protocol",{enumerable:!0,get:function(){return h.protocol}});var p=n(956);Object.defineProperty(t,"Fetch",{enumerable:!0,get:function(){return p.Fetch}}),Object.defineProperty(t,"NodeXHR",{enumerable:!0,get:function(){return p.NodeXHR}}),Object.defineProperty(t,"XHR",{enumerable:!0,get:function(){return p.XHR}}),Object.defineProperty(t,"NodeWebSocket",{enumerable:!0,get:function(){return p.NodeWebSocket}}),Object.defineProperty(t,"WebSocket",{enumerable:!0,get:function(){return p.WebSocket}}),Object.defineProperty(t,"WebTransport",{enumerable:!0,get:function(){return p.WebTransport}}),e.exports=u},419:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.transports=void 0;const r=n(71),o=n(716),i=n(480);t.transports={websocket:o.WS,webtransport:i.WT,polling:r.XHR}},421:function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(n(388)),c=function(e){function t(t){var n=e.call(this,t,"API")||this;return n.iosHost="prod"==t.env?"https://api.dedot.io":"http://api.dedot.io:24800",n}return o(t,e),t.prototype.connect=function(e){var t=this;return new Promise(function(n,r){var o={utype:"client",id:e,remoteOrigin:(null===globalThis||void 0===globalThis?void 0:globalThis.window)?globalThis.origin:t.remoteOrigin,accessToken:t.accessToken};t.nsp=(0,s.default)(t.iosHost,{auth:o}),t.nsp.on("connect",n),t.nsp.on("connect_error",r)})},t.prototype.disconnect=function(){var e;return null===(e=this.nsp)||void 0===e||e.disconnect(),!0},t.prototype.join=function(e){var t=this;return new Promise(function(n,r){var o;null===(o=t.nsp)||void 0===o||o.emit("JOIN",e,function(e){e?r(new Error(e)):n(!0)})})},t.prototype.onLeft=function(e){var t;return null===(t=this.nsp)||void 0===t||t.on("LEFT",e),this},t.prototype.onConnected=function(e){var t;return null===(t=this.nsp)||void 0===t||t.on("CONNECTED",e),this},t.prototype.onDisconnected=function(e){var t;return null===(t=this.nsp)||void 0===t||t.on("DISCONNECTED",e),this},t.prototype.onRoute=function(e){var t;return null===(t=this.nsp)||void 0===t||t.on("ROUTE-CHANGE",e),this},t.prototype.onStage=function(e){var t;return null===(t=this.nsp)||void 0===t||t.on("STAGE-CHANGE",e),this},t.prototype.onLocation=function(e){var t;return null===(t=this.nsp)||void 0===t||t.on("LOCATION-CHANGE",e),this},t.prototype.onMessage=function(e){var t;return null===(t=this.nsp)||void 0===t||t.on("MESSAGE",e),this},t}(i(n(611)).default);t.default=c},437:function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,c)}a((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=c(0),s.throw=c(1),s.return=c(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(t){var n=e.call(this,t,"API")||this;return n.intentToken="",n}return o(t,e),t.prototype.intent=function(e){return i(this,void 0,void 0,function(){var t,n,r,o,i;return s(this,function(s){switch(s.label){case 0:if(!e)throw new Error("<clientId> argument required");return t={url:"/order/intent",method:"POST",body:{clientId:e}},[4,this.request(t)];case 1:if(n=s.sent(),r=n.error,o=n.message,i=n.token,r)throw new Error(o);return this.intentToken=i,[2,i]}})})},t.prototype.unintent=function(e){return i(this,void 0,void 0,function(){var t,n,r,o;return s(this,function(i){switch(i.label){case 0:if(!e)throw new Error("Undefined intent token");return t={url:"/order/intent",method:"DELETE",headers:{"de-intent-token":e}},[4,this.request(t)];case 1:if(n=i.sent(),r=n.error,o=n.message,r)throw new Error(o);return this.intentToken="",[2,!0]}})})},t.prototype.addWaypoint=function(e,t){return i(this,void 0,void 0,function(){var n,r,o,i,c;return s(this,function(s){switch(s.label){case 0:if(!e)throw new Error("Expect <list> argument to be [Waypoint or Waypoint<array>]");if(!(t=t||this.intentToken))throw new Error("Expected intent order token");return n={url:"/order/waypoints/add",method:"PUT",headers:{"de-intent-token":t},body:Array.isArray(e)?e:[e]},[4,this.request(n)];case 1:if(r=s.sent(),o=r.error,i=r.message,c=r.waypoints,o)throw new Error(i);return[2,c]}})})},t.prototype.getWaypoint=function(e,t){return i(this,void 0,void 0,function(){var n,r,o,i,c;return s(this,function(s){switch(s.label){case 0:if(!e)throw new Error("Expected waypoint number");if(!(t=t||this.intentToken))throw new Error("Expected intent order token");return n={url:"/order/waypoints/".concat(e),method:"GET",headers:{"de-intent-token":t}},[4,this.request(n)];case 1:if(r=s.sent(),o=r.error,i=r.message,c=r.waypoint,o)throw new Error(i);return[2,c]}})})},t.prototype.fetchWaypoints=function(e){return i(this,void 0,void 0,function(){var t,n,r,o,i;return s(this,function(s){switch(s.label){case 0:if(!(e=e||this.intentToken))throw new Error("Expected intent order token");return t={url:"/order/waypoints",method:"GET",headers:{"de-intent-token":e}},[4,this.request(t)];case 1:if(n=s.sent(),r=n.error,o=n.message,i=n.waypoints,r)throw new Error(o);return[2,i]}})})},t.prototype.updateWaypoint=function(e,t,n){return i(this,void 0,void 0,function(){var r,o,i,c,a;return s(this,function(s){switch(s.label){case 0:if(!e)throw new Error("Expected waypoint number");if(!t)throw new Error("Expect <updates: WaypointOptions> to be object");if(!(n=n||this.intentToken))throw new Error("Expected intent order token");return r={url:"/order/waypoints/".concat(e),method:"PATCH",headers:{"de-intent-token":n},body:t},[4,this.request(r)];case 1:if(o=s.sent(),i=o.error,c=o.message,a=o.waypoints,i)throw new Error(c);return[2,a]}})})},t.prototype.deleteWaypoint=function(e,t){return i(this,void 0,void 0,function(){var n,r,o,i,c;return s(this,function(s){switch(s.label){case 0:if(!e)throw new Error("Expected waypoint number");if(!(t=t||this.intentToken))throw new Error("Expected intent order token");return n={url:"/order/waypoints/".concat(e),method:"DELETE",headers:{"de-intent-token":t}},[4,this.request(n)];case 1:if(r=s.sent(),o=r.error,i=r.message,c=r.waypoints,o)throw new Error(i);return[2,c]}})})},t.prototype.addPackage=function(e,t){return i(this,void 0,void 0,function(){var n,r,o,i,c;return s(this,function(s){switch(s.label){case 0:if(!e)throw new Error("Expect <list> argument to be [Package or Package<array>]");if(!(t=t||this.intentToken))throw new Error("Expected intent order token");return n={url:"/order/packages/add",method:"PUT",headers:{"de-intent-token":t},body:Array.isArray(e)?e:[e]},[4,this.request(n)];case 1:if(r=s.sent(),o=r.error,i=r.message,c=r.packages,o)throw new Error(i);return[2,c]}})})},t.prototype.getPackage=function(e,t){return i(this,void 0,void 0,function(){var n,r;return s(this,function(o){switch(o.label){case 0:if(!e)throw new Error("Expected <PTC> Package Tracking Code");if(!(t=t||this.intentToken))throw new Error("Expected intent order token");return n={url:"/order/packages/".concat(e),method:"GET",headers:{"de-intent-token":t}},[4,this.request(n)];case 1:if((r=o.sent()).error)throw new Error(r.message);return[2,r.package]}})})},t.prototype.fetchPackages=function(e){return i(this,void 0,void 0,function(){var t,n,r,o,i;return s(this,function(s){switch(s.label){case 0:if(!(e=e||this.intentToken))throw new Error("Expected intent order token");return t={url:"/order/packages",method:"GET",headers:{"de-intent-token":e}},[4,this.request(t)];case 1:if(n=s.sent(),r=n.error,o=n.message,i=n.packages,r)throw new Error(o);return[2,i]}})})},t.prototype.updatePackage=function(e,t,n){return i(this,void 0,void 0,function(){var r,o,i,c,a;return s(this,function(s){switch(s.label){case 0:if(!e)throw new Error("Expected Package Tracking Code");if(!t)throw new Error("Expect <updates: PackageOptions> to be object");if(!(n=n||this.intentToken))throw new Error("Expected intent order token");return r={url:"/order/packages/".concat(e),method:"PATCH",headers:{"de-intent-token":n},body:t},[4,this.request(r)];case 1:if(o=s.sent(),i=o.error,c=o.message,a=o.packages,i)throw new Error(c);return[2,a]}})})},t.prototype.deletePackage=function(e,t){return i(this,void 0,void 0,function(){var n,r,o,i,c;return s(this,function(s){switch(s.label){case 0:if(!e)throw new Error("Expected Package Tracking Code");if(!(t=t||this.intentToken))throw new Error("Expected intent order token");return n={url:"/order/packages/".concat(e),method:"DELETE",headers:{"de-intent-token":t}},[4,this.request(n)];case 1:if(r=s.sent(),o=r.error,i=r.message,c=r.packages,o)throw new Error(i);return[2,c]}})})},t.prototype.initiate=function(e,t){return i(this,void 0,void 0,function(){var n,r,o,i,c;return s(this,function(s){switch(s.label){case 0:if(!e)throw new Error("Expect <payload> argument to be [OrderService]");if(!(t=t||this.intentToken))throw new Error("Expected intent order token");return n={url:"/order/service",method:"POST",headers:{"de-intent-token":t},body:e},[4,this.request(n)];case 1:if(r=s.sent(),o=r.error,i=r.message,c=r.jrtoken,o)throw new Error(i);return[2,c]}})})},t.prototype.getService=function(e){return i(this,void 0,void 0,function(){var t,n,r,o,i;return s(this,function(s){switch(s.label){case 0:if(!(e=e||this.intentToken))throw new Error("Expected intent order token");return t={url:"/order/service",method:"GET",headers:{"de-intent-token":e}},[4,this.request(t)];case 1:if(n=s.sent(),r=n.error,o=n.message,i=n.service,r)throw new Error(o);return[2,i]}})})},t.prototype.updateService=function(e,t){return i(this,void 0,void 0,function(){var n,r,o,i,c;return s(this,function(s){switch(s.label){case 0:if(!e)throw new Error("Expect <updates: OrderServiceOptions> to be object");if(!(t=t||this.intentToken))throw new Error("Expected intent order token");return n={url:"/order/service",method:"PATCH",headers:{"de-intent-token":t},body:e},[4,this.request(n)];case 1:if(r=s.sent(),o=r.error,i=r.message,c=r.service,o)throw new Error(i);return[2,c]}})})},t.prototype.rateService=function(e,t){return i(this,void 0,void 0,function(){var n,r,o,i;return s(this,function(s){switch(s.label){case 0:if(!e)throw new Error("Expect <rating> to be number betwee 0 to 5");if(!(t=t||this.intentToken))throw new Error("Expected intent order token");return n={url:"/order/service/rating",method:"POST",headers:{"de-intent-token":t},body:{rating:e}},[4,this.request(n)];case 1:if(r=s.sent(),o=r.error,i=r.message,o)throw new Error(i);return[2,!0]}})})},t.prototype.getOperator=function(e,t){return i(this,void 0,void 0,function(){var n,r,o,i,c;return s(this,function(s){switch(s.label){case 0:if(!["LSP","partner","warehouse","agent"].includes(e))throw new Error("Unknown order operator");if(!(t=t||this.intentToken))throw new Error("Expected intent order token");return n={url:"/order/operators?type=".concat(e),method:"GET",headers:{"de-intent-token":t}},[4,this.request(n)];case 1:if(r=s.sent(),o=r.error,i=r.message,c=r.operators,o)throw new Error(i);return[2,c[e]]}})})},t.prototype.getOperators=function(e){return i(this,void 0,void 0,function(){var t,n,r,o,i;return s(this,function(s){switch(s.label){case 0:if(!(e=e||this.intentToken))throw new Error("Expected intent order token");return t={url:"/order/operators",method:"GET",headers:{"de-intent-token":e}},[4,this.request(t)];case 1:if(n=s.sent(),r=n.error,o=n.message,i=n.operators,r)throw new Error(o);return[2,i]}})})},t.prototype.getCurrentStage=function(e){return i(this,void 0,void 0,function(){var t,n,r,o,i;return s(this,function(s){switch(s.label){case 0:if(!(e=e||this.intentToken))throw new Error("Expected intent order token");return t={url:"/order/stage",method:"GET",headers:{"de-intent-token":e}},[4,this.request(t)];case 1:if(n=s.sent(),r=n.error,o=n.message,i=n.stage,r)throw new Error(o);return[2,i]}})})},t.prototype.getCurrentRoute=function(e){return i(this,void 0,void 0,function(){var t,n,r,o,i;return s(this,function(s){switch(s.label){case 0:if(!(e=e||this.intentToken))throw new Error("Expected intent order token");return t={url:"/order/route",method:"GET",headers:{"de-intent-token":e}},[4,this.request(t)];case 1:if(n=s.sent(),r=n.error,o=n.message,i=n.route,r)throw new Error(o);return[2,i]}})})},t}(c(n(611)).default);t.default=a},454:(e,t,n)=>{"use strict";function r(e){if(e)return function(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}(e)}n.r(t),n.d(t,{Emitter:()=>r}),r.prototype.on=r.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},r.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<r.length;o++)if((n=r[o])===t||n.fn===t){r.splice(o,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},r.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,t)}return this},r.prototype.emitReserved=r.prototype.emit,r.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},r.prototype.hasListeners=function(e){return!!this.listeners(e).length}},480:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WT=void 0;const o=n(689),i=n(624),s=n(376),c=(0,r(n(833)).default)("engine.io-client:webtransport");class a extends o.Transport{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{c("transport closed gracefully"),this.onClose()}).catch(e=>{c("transport closed due to %s",e),this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=(0,s.createPacketDecoderStream)(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=(0,s.createPacketEncoderStream)();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const o=()=>{n.read().then(({done:e,value:t})=>{e?c("session is closed"):(c("received chunk: %o",t),this.onPacket(t),o())}).catch(e=>{c("an error occurred while reading: %s",e)})};o();const i={type:"open"};this.query.sid&&(i.data=`{"sid":"${this.query.sid}"}`),this._writer.write(i).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&(0,i.nextTick)(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}}t.WT=a},528:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Polling=void 0;const o=n(689),i=n(374),s=n(376),c=(0,r(n(833)).default)("engine.io-client:polling");class a extends o.Transport{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{c("paused"),this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(c("we are currently polling - waiting to pause"),e++,this.once("pollComplete",function(){c("pre-pause polling complete"),--e||t()})),this.writable||(c("we are currently writing - waiting to pause"),e++,this.once("drain",function(){c("pre-pause writing complete"),--e||t()}))}else t()}_poll(){c("polling"),this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){c("polling got data %s",e),(0,s.decodePayload)(e,this.socket.binaryType).forEach(e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)}),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState?this._poll():c('ignoring poll - transport state "%s"',this.readyState))}doClose(){const e=()=>{c("writing close packet"),this.write([{type:"close"}])};"open"===this.readyState?(c("transport open - closing"),e()):(c("transport not open - deferring close"),this.once("open",e))}write(e){this.writable=!1,(0,s.encodePayload)(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=(0,i.randomString)()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}t.Polling=a},585:e=>{var t=1e3,n=60*t,r=60*n,o=24*r,i=7*o;function s(e,t,n,r){var o=t>=1.5*n;return Math.round(e/n)+" "+r+(o?"s":"")}e.exports=function(e,c){c=c||{};var a,u,h=typeof e;if("string"===h&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(s){var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*c;case"weeks":case"week":case"w":return c*i;case"days":case"day":case"d":return c*o;case"hours":case"hour":case"hrs":case"hr":case"h":return c*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*n;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}}}(e);if("number"===h&&isFinite(e))return c.long?(a=e,(u=Math.abs(a))>=o?s(a,u,o,"day"):u>=r?s(a,u,r,"hour"):u>=n?s(a,u,n,"minute"):u>=t?s(a,u,t,"second"):a+" ms"):function(e){var i=Math.abs(e);return i>=o?Math.round(e/o)+"d":i>=r?Math.round(e/r)+"h":i>=n?Math.round(e/n)+"m":i>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},589:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.IoTClient=t.DClient=t.Utils=t.MSI=void 0;var o=r(n(197));t.MSI=o.default;var i=r(n(266));t.Utils=i.default;var s=r(n(310));t.IoTClient=s.default;var c=r(n(437)),a=r(n(421)),u={Client:r(n(202)).default,Order:c.default,Event:a.default};t.DClient=u},611:function(e,t,n){"use strict";var r,o=this&&this.__assign||function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)},i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||(r=function(e){return r=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},r(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n=r(e),o=0;o<n.length;o++)"default"!==n[o]&&i(t,e,n[o]);return s(t,e),t}),a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,c)}a((r=r.apply(e,t||[])).next())})},u=this&&this.__generator||function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=c(0),s.throw=c(1),s.return=c(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}},h=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};Object.defineProperty(t,"__esModule",{value:!0});var p=n(2),l=function(){function e(e,t){if(!e)throw new Error("Undefined Access Configuration");if(!e.context)throw new Error("Undefined Context Reference. Check https://doc.dedot.io/sdk/auth");if(!e.accessToken)throw new Error("Undefined Access Token. Check https://doc.dedot.io/sdk/auth");this.atype=t,this.version=e.version||1,this.platform=e.platform||"proxy",this.accessToken=e.accessToken,this.remoteOrigin=e.remoteOrigin,this.baseURL="ASI"===this.atype?p.ASI_SERVER_BASEURL[e.env||"dev"]:p.API_SERVER_BASEURL[e.env||"dev"]}return e.prototype.request=function(e){return a(this,void 0,void 0,function(){var t,r,i=e.url,s=h(e,["url"]);return u(this,function(e){switch(e.label){case 0:return t={method:"GET",headers:{origin:this.remoteOrigin,"de-user-agent":"De.".concat(this.platform,"/").concat(this.version,".0")}},"ASI"===this.atype&&(t.headers["de-auth-service"]="De.API"),this.accessToken&&(t.headers.authorization="Bearer ".concat(this.accessToken)),s.body&&(t.headers["content-type"]="application/json","object"==typeof s.body&&(s.body=JSON.stringify(s.body))),"object"==typeof s.headers&&(s.headers=o(o({},s.headers),t.headers)),s=o(o({},t),s),i="".concat(this.baseURL,"/v").concat(this.version,"/").concat(i.replace(/^\//,"")),(r=(null===globalThis||void 0===globalThis?void 0:globalThis.window)&&(null===globalThis||void 0===globalThis?void 0:globalThis.fetch))?[3,2]:[4,Promise.resolve().then(function(){return c(n(92))})];case 1:r=e.sent().default,e.label=2;case 2:return[4,r(i,s)];case 3:return[4,e.sent().json()];case 4:return[2,e.sent()]}})})},e.prototype.setToken=function(e){this.accessToken=e},e}();t.default=l},624:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultBinaryType=t.globalThisShim=t.nextTick=void 0,t.createCookieJar=function(){},t.nextTick="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),t.globalThisShim="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")(),t.defaultBinaryType="arraybuffer"},627:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Decoder=t.Encoder=t.PacketType=t.protocol=void 0;const r=n(454),o=n(926),i=n(133),s=(0,n(833).default)("socket.io-parser"),c=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var a;function u(e){return"[object Object]"===Object.prototype.toString.call(e)}t.protocol=5,function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"}(a=t.PacketType||(t.PacketType={})),t.Encoder=class{constructor(e){this.replacer=e}encode(e){return s("encoding packet %j",e),e.type!==a.EVENT&&e.type!==a.ACK||!(0,i.hasBinary)(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===a.EVENT?a.BINARY_EVENT:a.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==a.BINARY_EVENT&&e.type!==a.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),s("encoded %j as %s",e,t),t}encodeAsBinary(e){const t=(0,o.deconstructPacket)(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}};class h extends r.Emitter{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===a.BINARY_EVENT;n||t.type===a.BINARY_ACK?(t.type=n?a.EVENT:a.ACK,this.reconstructor=new p(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!(0,i.isBinary)(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(void 0===a[n.type])throw new Error("unknown packet type "+n.type);if(n.type===a.BINARY_EVENT||n.type===a.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const o=e.substring(r,t);if(o!=Number(o)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(o)}if("/"===e.charAt(t+1)){const r=t+1;for(;++t&&","!==e.charAt(t)&&t!==e.length;);n.nsp=e.substring(r,t)}else n.nsp="/";const r=e.charAt(t+1);if(""!==r&&Number(r)==r){const r=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(!h.isPayloadValid(n.type,r))throw new Error("invalid payload");n.data=r}return s("decoded %s as %j",e,n),n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case a.CONNECT:return u(t);case a.DISCONNECT:return void 0===t;case a.CONNECT_ERROR:return"string"==typeof t||u(t);case a.EVENT:case a.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===c.indexOf(t[0]));case a.ACK:case a.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}t.Decoder=h;class p{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=(0,o.reconstructPacket)(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}},661:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.encode=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t},t.decode=function(e){let t={},n=e.split("&");for(let e=0,r=n.length;e<r;e++){let r=n[e].split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}},662:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decodePacket=void 0;const r=n(46),o=n(745),i="function"==typeof ArrayBuffer;t.decodePacket=(e,t)=>{if("string"!=typeof e)return{type:"message",data:c(e,t)};const n=e.charAt(0);return"b"===n?{type:"message",data:s(e.substring(1),t)}:r.PACKET_TYPES_REVERSE[n]?e.length>1?{type:r.PACKET_TYPES_REVERSE[n],data:e.substring(1)}:{type:r.PACKET_TYPES_REVERSE[n]}:r.ERROR_PACKET};const s=(e,t)=>{if(i){const n=(0,o.decode)(e);return c(n,t)}return{base64:!0,data:e}},c=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer},686:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.encodePacket=void 0,t.encodePacketToBinary=function(e,t){return o&&e.data instanceof Blob?e.data.arrayBuffer().then(u).then(t):i&&(e.data instanceof ArrayBuffer||s(e.data))?t(u(e.data)):void c(e,!1,e=>{h||(h=new TextEncoder),t(h.encode(e))})};const r=n(46),o="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),i="function"==typeof ArrayBuffer,s=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,c=({type:e,data:t},n,c)=>o&&t instanceof Blob?n?c(t):a(t,c):i&&(t instanceof ArrayBuffer||s(t))?n?c(t):a(new Blob([t]),c):c(r.PACKET_TYPES[e]+(t||""));t.encodePacket=c;const a=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function u(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let h},689:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Transport=t.TransportError=void 0;const o=n(376),i=n(454),s=n(374),c=n(661),a=(0,r(n(833)).default)("engine.io-client:transport");class u extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}t.TransportError=u;class h extends i.Emitter{constructor(e){super(),this.writable=!1,(0,s.installTimerFunctions)(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved("error",new u(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState?this.write(e):a("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=(0,o.decodePacket)(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=(0,c.encode)(e);return t.length?"?"+t:""}}t.Transport=h},716:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WS=t.BaseWS=void 0;const o=n(689),i=n(374),s=n(376),c=n(624),a=(0,r(n(833)).default)("engine.io-client:websocket"),u="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class h extends o.Transport{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=u?{}:(0,i.pick)(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;(0,s.encodePacket)(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch(e){a("websocket closed before onclose event")}r&&(0,c.nextTick)(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=(0,i.randomString)()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}t.BaseWS=h;const p=c.globalThisShim.WebSocket||c.globalThisShim.MozWebSocket;t.WS=class extends h{createSocket(e,t,n){return u?new p(e,t,n):t?new p(e,t):new p(e)}doWrite(e,t){this.ws.send(t)}}},736:(e,t,n)=>{e.exports=function(e){function t(e){let n,o,i,s=null;function c(...e){if(!c.enabled)return;const r=c,o=Number(new Date),i=o-(n||o);r.diff=i,r.prev=n,r.curr=o,n=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(n,o)=>{if("%%"===n)return"%";s++;const i=t.formatters[o];if("function"==typeof i){const t=e[s];n=i.call(r,t),e.splice(s,1),s--}return n}),t.formatArgs.call(r,e),(r.log||t.log).apply(r,e)}return c.namespace=e,c.useColors=t.useColors(),c.color=t.selectColor(e),c.extend=r,c.destroy=t.destroy,Object.defineProperty(c,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(o!==t.namespaces&&(o=t.namespaces,i=t.enabled(e)),i),set:e=>{s=e}}),"function"==typeof t.init&&t.init(c),c}function r(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function o(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(o),...t.skips.map(o).map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(n=0;n<o;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=n(585),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}},743:(e,t)=>{"use strict";function n(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Object.defineProperty(t,"__esModule",{value:!0}),t.Backoff=n,n.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},n.prototype.reset=function(){this.attempts=0},n.prototype.setMin=function(e){this.ms=e},n.prototype.setMax=function(e){this.max=e},n.prototype.setJitter=function(e){this.jitter=e}},745:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decode=t.encode=void 0;const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)r[n.charCodeAt(e)]=e;t.encode=e=>{let t,r=new Uint8Array(e),o=r.length,i="";for(t=0;t<o;t+=3)i+=n[r[t]>>2],i+=n[(3&r[t])<<4|r[t+1]>>4],i+=n[(15&r[t+1])<<2|r[t+2]>>6],i+=n[63&r[t+2]];return o%3==2?i=i.substring(0,i.length-1)+"=":o%3==1&&(i=i.substring(0,i.length-2)+"=="),i},t.decode=e=>{let t,n,o,i,s,c=.75*e.length,a=e.length,u=0;"="===e[e.length-1]&&(c--,"="===e[e.length-2]&&c--);const h=new ArrayBuffer(c),p=new Uint8Array(h);for(t=0;t<a;t+=4)n=r[e.charCodeAt(t)],o=r[e.charCodeAt(t+1)],i=r[e.charCodeAt(t+2)],s=r[e.charCodeAt(t+3)],p[u++]=n<<2|o>>4,p[u++]=(15&o)<<4|i>>2,p[u++]=(3&i)<<6|63&s;return h}},776:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Manager=void 0;const c=n(956),a=n(214),u=i(n(627)),h=n(942),p=n(743),l=n(454),f=(0,s(n(833)).default)("socket.io-client:manager");class d extends l.Emitter{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,(0,c.installTimerFunctions)(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new p.Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||u;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(f("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;f("opening %s",this.uri),this.engine=new c.Socket(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=(0,h.on)(t,"open",function(){n.onopen(),e&&e()}),o=t=>{f("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},i=(0,h.on)(t,"error",o);if(!1!==this._timeout){const e=this._timeout;f("connect attempt will timeout after %d",e);const n=this.setTimeoutFn(()=>{f("connect attempt timed out after %d",e),r(),o(new Error("timeout")),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(i),this}connect(e){return this.open(e)}onopen(){f("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push((0,h.on)(e,"ping",this.onping.bind(this)),(0,h.on)(e,"data",this.ondata.bind(this)),(0,h.on)(e,"error",this.onerror.bind(this)),(0,h.on)(e,"close",this.onclose.bind(this)),(0,h.on)(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){(0,c.nextTick)(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){f("error",e),this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new a.Socket(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const e of t)if(this.nsps[e].active)return void f("socket %s is still active, skipping close",e);this._close()}_packet(e){f("writing packet %j",e);const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){f("cleanup"),this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){f("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var n;f("closed due to %s",e),this.cleanup(),null===(n=this.engine)||void 0===n||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)f("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();f("will wait %dms before reconnect attempt",t),this._reconnecting=!0;const n=this.setTimeoutFn(()=>{e.skipReconnect||(f("attempting reconnect"),this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(t=>{t?(f("reconnect attempt error"),e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):(f("reconnect success"),e.onreconnect())}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}t.Manager=d},833:(e,t,n)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,o=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(o=r))}),t.splice(o,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=n(736)(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},894:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.url=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(i("protocol-less url %s",e),e=void 0!==n?n.protocol+"//"+e:"https://"+e),i("parse %s",e),r=(0,o.parse)(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const s=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+s+":"+r.port+t,r.href=r.protocol+"://"+s+(n&&n.port===r.port?"":":"+r.port),r};const o=n(956),i=(0,r(n(833)).default)("socket.io-client:url")},926:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reconstructPacket=t.deconstructPacket=void 0;const r=n(133);function o(e,t){if(!e)return e;if((0,r.isBinary)(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=o(e[r],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=o(e[r],t));return n}return e}function i(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=i(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=i(e[n],t));return e}t.deconstructPacket=function(e){const t=[],n=e.data,r=e;return r.data=o(n,t),r.attachments=t.length,{packet:r,buffers:t}},t.reconstructPacket=function(e,t){return e.data=i(e.data,t),delete e.attachments,e}},942:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.on=function(e,t,n){return e.on(t,n),function(){e.off(t,n)}}},956:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebTransport=t.WebSocket=t.NodeWebSocket=t.XHR=t.NodeXHR=t.Fetch=t.nextTick=t.parse=t.installTimerFunctions=t.transports=t.TransportError=t.Transport=t.protocol=t.SocketWithUpgrade=t.SocketWithoutUpgrade=t.Socket=void 0;const r=n(223);Object.defineProperty(t,"Socket",{enumerable:!0,get:function(){return r.Socket}});var o=n(223);Object.defineProperty(t,"SocketWithoutUpgrade",{enumerable:!0,get:function(){return o.SocketWithoutUpgrade}}),Object.defineProperty(t,"SocketWithUpgrade",{enumerable:!0,get:function(){return o.SocketWithUpgrade}}),t.protocol=r.Socket.protocol;var i=n(689);Object.defineProperty(t,"Transport",{enumerable:!0,get:function(){return i.Transport}}),Object.defineProperty(t,"TransportError",{enumerable:!0,get:function(){return i.TransportError}});var s=n(419);Object.defineProperty(t,"transports",{enumerable:!0,get:function(){return s.transports}});var c=n(374);Object.defineProperty(t,"installTimerFunctions",{enumerable:!0,get:function(){return c.installTimerFunctions}});var a=n(15);Object.defineProperty(t,"parse",{enumerable:!0,get:function(){return a.parse}});var u=n(624);Object.defineProperty(t,"nextTick",{enumerable:!0,get:function(){return u.nextTick}});var h=n(209);Object.defineProperty(t,"Fetch",{enumerable:!0,get:function(){return h.Fetch}});var p=n(71);Object.defineProperty(t,"NodeXHR",{enumerable:!0,get:function(){return p.XHR}});var l=n(71);Object.defineProperty(t,"XHR",{enumerable:!0,get:function(){return l.XHR}});var f=n(716);Object.defineProperty(t,"NodeWebSocket",{enumerable:!0,get:function(){return f.WS}});var d=n(716);Object.defineProperty(t,"WebSocket",{enumerable:!0,get:function(){return d.WS}});var y=n(480);Object.defineProperty(t,"WebTransport",{enumerable:!0,get:function(){return y.WT}})}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}return n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(589)})());
@@ -0,0 +1,13 @@
1
+ import Utils from './utils';
2
+ import MSI, { type MSIInterface } from './allend/MSI';
3
+ import IoTClient, { type IoTClientOptions } from './allend/IoTClient';
4
+ import Order from './allend/DClient/Order';
5
+ import Event from './allend/DClient/Event';
6
+ import Client from './allend/DClient/Client';
7
+ import Auth from './backend/Auth';
8
+ declare const DClient: {
9
+ Client: typeof Client;
10
+ Order: typeof Order;
11
+ Event: typeof Event;
12
+ };
13
+ export { Auth, MSI, type MSIInterface, Utils, DClient, IoTClient, type IoTClientOptions };
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.IoTClient = exports.DClient = exports.Utils = exports.MSI = exports.Auth = void 0;
7
+ var utils_1 = __importDefault(require("./utils"));
8
+ exports.Utils = utils_1.default;
9
+ var MSI_1 = __importDefault(require("./allend/MSI"));
10
+ exports.MSI = MSI_1.default;
11
+ var IoTClient_1 = __importDefault(require("./allend/IoTClient"));
12
+ exports.IoTClient = IoTClient_1.default;
13
+ var Order_1 = __importDefault(require("./allend/DClient/Order"));
14
+ var Event_1 = __importDefault(require("./allend/DClient/Event"));
15
+ var Client_1 = __importDefault(require("./allend/DClient/Client"));
16
+ var Auth_1 = __importDefault(require("./backend/Auth"));
17
+ exports.Auth = Auth_1.default;
18
+ var DClient = { Client: Client_1.default, Order: Order_1.default, Event: Event_1.default };
19
+ exports.DClient = DClient;
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA2B;AAczB,gBAdK,eAAK,CAcL;AAbP,qDAAqD;AAWnD,cAXK,aAAG,CAWL;AAVL,iEAAqE;AAcnE,oBAdK,mBAAS,CAcL;AAbX,iEAA0C;AAC1C,iEAA0C;AAC1C,mEAA4C;AAC5C,wDAAiC;AAK/B,eALK,cAAI,CAKL;AAHN,IAAM,OAAO,GAAG,EAAE,MAAM,kBAAA,EAAE,KAAK,iBAAA,EAAE,KAAK,iBAAA,EAAE,CAAA;AAOtC,0BAAO"}
@@ -0,0 +1,8 @@
1
+ export type AccessOptions = {
2
+ env: 'dev' | 'prod'
3
+ platform: 'web' | 'mobile' | 'server' | 'proxy'
4
+ version?: number
5
+ context: string
6
+ accessToken: string
7
+ remoteOrigin?: string
8
+ }
@@ -0,0 +1,27 @@
1
+ export type AuthOptions = {
2
+ env: 'dev' | 'prod'
3
+ version?: number
4
+ autorefresh?: boolean
5
+ onNewToken?: (token: string) => void
6
+ }
7
+
8
+ export type AuthCredentials = {
9
+ context: string
10
+ remoteOrigin: string
11
+ cid: string
12
+ secret: string
13
+ }
14
+
15
+ export type SocketAuthCredentials = {
16
+ utype: string
17
+ id: string
18
+ remoteOrigin: string
19
+ accessToken: string
20
+ }
21
+
22
+ export type AuthRequestOptions = {
23
+ url: string
24
+ method: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE'
25
+ headers?: { [index: string]: string }
26
+ body?: any
27
+ }