epicenter-libs 3.23.2 → 3.23.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/browser/{AckExtension-263b8630.js → AckExtension-e96ecd6b.js} +3 -3
- package/dist/{module/AckExtension-d846f748.js.map → browser/AckExtension-e96ecd6b.js.map} +1 -1
- package/dist/{module/ReloadExtension-fe0c7815.js → browser/ReloadExtension-8ae34b86.js} +3 -3
- package/dist/{module/ReloadExtension-fe0c7815.js.map → browser/ReloadExtension-8ae34b86.js.map} +1 -1
- package/dist/browser/{cometd-9f5a5308.js → cometd-2fc1c79a.js} +2 -2
- package/dist/browser/{cometd-9f5a5308.js.map → cometd-2fc1c79a.js.map} +1 -1
- package/dist/browser/{epicenter-2edde226.js → epicenter-1bed8740.js} +19 -10
- package/dist/browser/epicenter-1bed8740.js.map +1 -0
- package/dist/browser/epicenter.js +1 -1
- package/dist/cjs/{AckExtension-bacc5faf.js → AckExtension-a4e7954c.js} +3 -3
- package/dist/cjs/{AckExtension-bacc5faf.js.map → AckExtension-a4e7954c.js.map} +1 -1
- package/dist/cjs/{ReloadExtension-77012f25.js → ReloadExtension-85ab0468.js} +3 -3
- package/dist/cjs/{ReloadExtension-77012f25.js.map → ReloadExtension-85ab0468.js.map} +1 -1
- package/dist/cjs/{cometd-22110d8c.js → cometd-659d91be.js} +2 -2
- package/dist/cjs/{cometd-22110d8c.js.map → cometd-659d91be.js.map} +1 -1
- package/dist/cjs/{epicenter-df8a7174.js → epicenter-c235dfe1.js} +19 -10
- package/dist/cjs/epicenter-c235dfe1.js.map +1 -0
- package/dist/cjs/epicenter.js +1 -1
- package/dist/epicenter.js +15 -6
- package/dist/epicenter.js.map +1 -1
- package/dist/epicenter.min.js +1 -1
- package/dist/epicenter.min.js.map +1 -1
- package/dist/module/{AckExtension-d846f748.js → AckExtension-d59966b7.js} +3 -3
- package/dist/{browser/AckExtension-263b8630.js.map → module/AckExtension-d59966b7.js.map} +1 -1
- package/dist/{browser/ReloadExtension-3a311aaf.js → module/ReloadExtension-6737fd08.js} +3 -3
- package/dist/{browser/ReloadExtension-3a311aaf.js.map → module/ReloadExtension-6737fd08.js.map} +1 -1
- package/dist/module/{cometd-cc43bd43.js → cometd-acc4caaf.js} +2 -2
- package/dist/module/{cometd-cc43bd43.js.map → cometd-acc4caaf.js.map} +1 -1
- package/dist/module/{epicenter-b93d398b.js → epicenter-de912d01.js} +19 -10
- package/dist/module/epicenter-de912d01.js.map +1 -0
- package/dist/module/epicenter.js +1 -1
- package/dist/types/adapters/cometd.d.ts +1 -1
- package/dist/types/adapters/daily.d.ts +1 -0
- package/dist/types/adapters/run.d.ts +1 -0
- package/package.json +1 -1
- package/src/adapters/cometd.ts +2 -2
- package/src/adapters/daily.ts +3 -0
- package/src/adapters/run.ts +7 -2
- package/dist/browser/epicenter-2edde226.js.map +0 -1
- package/dist/cjs/epicenter-df8a7174.js.map +0 -1
- package/dist/module/epicenter-b93d398b.js.map +0 -1
package/dist/epicenter.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).epicenter={})}(this,(function(e){"use strict";function t(e,t){return t.forEach((function(t){Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function r(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}r((function(e){var t=function(e){var t,n=Object.prototype,o=n.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},a=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",s=r.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,o){var r=t&&t.prototype instanceof m?t:m,a=Object.create(r.prototype),i=new N(o||[]);return a._invoke=function(e,t,n){var o=h;return function(r,a){if(o===p)throw new Error("Generator is already running");if(o===f){if("throw"===r)throw a;return P()}for(n.method=r,n.arg=a;;){var i=n.delegate;if(i){var s=x(i,n);if(s){if(s===y)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=p;var c=l(e,t,n);if("normal"===c.type){if(o=n.done?f:d,c.arg===y)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=f,n.method="throw",n.arg=c.arg)}}}(e,n,i),a}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var h="suspendedStart",d="suspendedYield",p="executing",f="completed",y={};function m(){}function g(){}function w(){}var b={};c(b,a,(function(){return this}));var v=Object.getPrototypeOf,S=v&&v(v(O([])));S&&S!==n&&o.call(S,a)&&(b=S);var _=w.prototype=m.prototype=Object.create(b);function T(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function n(r,a,i,s){var c=l(e[r],e,a);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==typeof h&&o.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,i,s)}),(function(e){n("throw",e,i,s)})):t.resolve(h).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,s)}))}s(c.arg)}var r;this._invoke=function(e,o){function a(){return new t((function(t,r){n(e,o,t,r)}))}return r=r?r.then(a,a):a()}}function x(e,n){var o=e.iterator[n.method];if(o===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,x(e,n),"throw"===n.method))return y;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var r=l(o,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,y;var a=r.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function R(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function O(e){if(e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function n(){for(;++r<e.length;)if(o.call(e,r))return n.value=e[r],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}return{next:P}}function P(){return{value:t,done:!0}}return g.prototype=w,c(_,"constructor",w),c(w,"constructor",g),g.displayName=c(w,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,c(e,s,"GeneratorFunction")),e.prototype=Object.create(_),e},e.awrap=function(e){return{__await:e}},T(E.prototype),c(E.prototype,i,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,o,r,a){void 0===a&&(a=Promise);var i=new E(u(t,n,o,r),a);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},T(_),c(_,s,"Generator"),c(_,a,(function(){return this})),c(_,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var o=t.pop();if(o in e)return n.value=o,n.done=!1,n}return n.done=!0,n}},e.values=O,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(R),!e)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function r(o,r){return s.type="throw",s.arg=e,n.next=o,r&&(n.method="next",n.arg=t),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var c=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var a=r;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),R(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var r=o.arg;R(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,o){return this.delegate={iterator:O(e),resultName:n,nextLoc:o},"next"===this.method&&(this.arg=t),y}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}));var a=o(r((function(e){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0}))),i=r((function(e,t){var o="undefined"!=typeof self?self:n,r=function(){function e(){this.fetch=!1,this.DOMException=o.DOMException}return e.prototype=o,new e}();!function(e){!function(t){var n="URLSearchParams"in e,o="Symbol"in e&&"iterator"in Symbol,r="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),a="FormData"in e,i="ArrayBuffer"in e;if(i)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function u(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function h(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return o&&(t[Symbol.iterator]=function(){return t}),t}function d(e){this.map={},e instanceof d?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function p(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function f(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function y(e){var t=new FileReader,n=f(t);return t.readAsArrayBuffer(e),n}function m(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:r&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:a&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():i&&r&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=m(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i&&(ArrayBuffer.prototype.isPrototypeOf(e)||c(e))?this._bodyArrayBuffer=m(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r&&(this.blob=function(){var e=p(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var e,t,n,o=p(this);if(o)return o;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,n=f(t),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),o=0;o<t.length;o++)n[o]=String.fromCharCode(t[o]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a&&(this.formData=function(){return this.text().then(v)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(e,t){e=u(e),t=l(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},d.prototype.delete=function(e){delete this.map[u(e)]},d.prototype.get=function(e){return e=u(e),this.has(e)?this.map[e]:null},d.prototype.has=function(e){return this.map.hasOwnProperty(u(e))},d.prototype.set=function(e,t){this.map[u(e)]=l(t)},d.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},d.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),h(e)},d.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),h(e)},d.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),h(e)},o&&(d.prototype[Symbol.iterator]=d.prototype.entries);var w=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function b(e,t){var n,o,r=(t=t||{}).body;if(e instanceof b){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new d(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,r||null==e._bodyInit||(r=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new d(t.headers)),this.method=(n=t.method||this.method||"GET",o=n.toUpperCase(),w.indexOf(o)>-1?o:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function v(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),o=n.shift().replace(/\+/g," "),r=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(o),decodeURIComponent(r))}})),t}function S(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new d(t.headers),this.url=t.url||"",this._initBody(e)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},g.call(b.prototype),g.call(S.prototype),S.prototype.clone=function(){return new S(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},S.error=function(){var e=new S(null,{status:0,statusText:""});return e.type="error",e};var _=[301,302,303,307,308];S.redirect=function(e,t){if(-1===_.indexOf(t))throw new RangeError("Invalid status code");return new S(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function T(e,n){return new Promise((function(o,a){var i=new b(e,n);if(i.signal&&i.signal.aborted)return a(new t.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function c(){s.abort()}s.onload=function(){var e,t,n={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new d,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),o=n.shift().trim();if(o){var r=n.join(":").trim();t.append(o,r)}})),t)};n.url="responseURL"in s?s.responseURL:n.headers.get("X-Request-URL");var r="response"in s?s.response:s.responseText;o(new S(r,n))},s.onerror=function(){a(new TypeError("Network request failed"))},s.ontimeout=function(){a(new TypeError("Network request failed"))},s.onabort=function(){a(new t.DOMException("Aborted","AbortError"))},s.open(i.method,i.url,!0),"include"===i.credentials?s.withCredentials=!0:"omit"===i.credentials&&(s.withCredentials=!1),"responseType"in s&&r&&(s.responseType="blob"),i.headers.forEach((function(e,t){s.setRequestHeader(t,e)})),i.signal&&(i.signal.addEventListener("abort",c),s.onreadystatechange=function(){4===s.readyState&&i.signal.removeEventListener("abort",c)}),s.send(void 0===i._bodyInit?null:i._bodyInit)}))}T.polyfill=!0,e.fetch||(e.fetch=T,e.Headers=d,e.Request=b,e.Response=S),t.Headers=d,t.Request=b,t.Response=S,t.fetch=T,Object.defineProperty(t,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var a=r;(t=a.fetch).default=a.fetch,t.fetch=a.fetch,t.Headers=a.Headers,t.Request=a.Request,t.Response=a.Response,e.exports=t})),s=o(i);class c extends Error{constructor(e,t){super(e),a(this,"code",void 0),this.code=t}}class u extends c{constructor(e,t){var n;super(e.message,null===(n=e.information)||void 0===n?void 0:n.code),a(this,"status",void 0),a(this,"information",void 0),a(this,"cause",void 0);const{information:o,message:r,cause:i,status:s}=e;if(this.status=null!=s?s:null==t?void 0:t.status,this.message=r,o){const{code:e,...t}=o;this.code=e,this.information=t}i&&(this.cause=i)}}class l{constructor(e,t){a(this,"status",void 0),a(this,"headers",void 0),a(this,"body",void 0);const{status:n,headers:o}=t;this.status=n,this.headers=o,this.body=e}}var h={getItem:e=>e&&decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*".concat(encodeURIComponent(e).replace(/[-.+*]/g,"\\$&"),"\\s*\\=\\s*([^;]*).*$)|^.*$")),"$1"))||null,setItem(e,t,n={}){if(!e||/^(?:expires|max-age|path|domain|secure)$/i.test(e))return!1;const{path:o,domain:r,end:a,secure:i,samesite:s}=n,c=(e=>{if(!e)return"";switch(e.constructor){case Number:return e===1/0?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":"; max-age=".concat(e);case String:return"; expires=".concat(e);case Date:return"; expires=".concat(new Date(e).toUTCString());default:return""}})(a),u=r?"; domain=".concat(r):"",l=o?"; path=".concat(o):"",h=i?"; secure":"",d=s?"; samesite=".concat(s):"";return document.cookie="".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(t)).concat(c).concat(u).concat(l).concat(h).concat(d),!0},removeItem(e,t={}){if(!this.hasItem(e))return!1;const{path:n,domain:o}=t,r=o?"; domain=".concat(o):"",a=n?"; path=".concat(n):"";return document.cookie="".concat(encodeURIComponent(e),"=; expires=Thu, 01 Jan 1970 00:00:00 GMT").concat(r).concat(a),!0},hasItem:e=>!(!e||/^(?:expires|max-age|path|domain|secure)$/i.test(e))&&new RegExp("(?:^|;\\s*)".concat(encodeURIComponent(e).replace(/[-.+*]/g,"\\$&"),"\\s*\\=")).test(document.cookie),clear(){const e=document.cookie.replace(/((?:^|\s*;)[^=]+)(?=;|$)|^\s*|\s*(?:=[^;]*)?(?:\1|$)/g,"").split(/\s*(?:=[^;]*)?;\s*/);for(let t=e.length,n=0;n<t;n++)e[n]=decodeURIComponent(e[n]),this.removeItem(e[n]);return e}};class d{constructor(e){a(this,"_store",void 0),this._store=e}clear(){this._store.clear()}get store(){return this._store}set store(e){this._store=e}}const p=new Map;class f extends d{constructor(){super(p)}getItem(e){return super.store.get(e)}setItem(e,t){return super.store.set(e,t)}removeItem(e){return super.store.delete(e)}}class y extends d{constructor(){super(window.sessionStorage)}getItem(e){return JSON.parse(super.store.getItem(e))}setItem(e,t){return super.store.setItem(e,JSON.stringify(t))}removeItem(e){return super.store.removeItem(e)}}class m{constructor(e={}){a(this,"options",{});const t=window.location.hostname,n="localhost"!==t?{path:"/",domain:".".concat(t)}:{path:"/"};this.options={...n,...e}}getItem(e){const t=h.getItem(e);return t?JSON.parse(t):null}setItem(e,t){return h.setItem(e,JSON.stringify(t),this.options)}removeItem(e){return h.removeItem(e,this.options)}clear(){return h.clear()}}let g;var w,b,v;let S,_,T,E;var x;!function(e){e.COOKIE="COOKIE",e.SESSION="SESSION"}(g||(g={})),e.SCOPE_BOUNDARY=void 0,(w=e.SCOPE_BOUNDARY||(e.SCOPE_BOUNDARY={})).PROJECT="PROJECT",w.GROUP="GROUP",w.EPISODE="EPISODE",w.WORLD="WORLD",e.RITUAL=void 0,(b=e.RITUAL||(e.RITUAL={})).NONE="NONE",b.INTER="INTER",b.REANIMATE="REANIMATE",b.REVIVE="REVIVE",b.EXORCISE="EXORCISE",b.RESURRECT="RESURRECT",e.PUSH_CATEGORY=void 0,(v=e.PUSH_CATEGORY||(e.PUSH_CATEGORY={})).CHAT="CHAT",v.CONSENSUS="CONSENSUS",v.CONTROL="CONTROL",v.PRESENCE="PRESENCE",v.LOBBY="LOBBY",v.RUN="RUN",v.VAULT="VAULT",v.VIDEO="VIDEO",v.WORLD="WORLD",v.GROUP="GROUP",v.SYSTEM="SYSTEM",function(e){e.SYSTEM="SYSTEM",e.MONITOR="MONITOR"}(S||(S={})),function(e){e.AUTHOR="AUTHOR",e.SUPPORT="SUPPORT"}(_||(_={})),function(e){e.ASSOCIATE="ASSOCIATE"}(T||(T={})),function(e){e.FACILITATOR="FACILITATOR",e.REVIEWER="REVIEWER",e.USER="USER",e.LEADER="LEADER",e.PARTICIPANT="PARTICIPANT",e.ANONYMOUS="ANONYMOUS"}(E||(E={})),e.ROLE=void 0,(x=e.ROLE||(e.ROLE={})).SYSTEM="SYSTEM",x.MONITOR="MONITOR",x.AUTHOR="AUTHOR",x.SUPPORT="SUPPORT",x.FACILITATOR="FACILITATOR",x.REVIEWER="REVIEWER",x.USER="USER",x.LEADER="LEADER",x.PARTICIPANT="PARTICIPANT",x.ANONYMOUS="ANONYMOUS";const A=new Function("try {return this===window;}catch(e){ return false;}"),R=new Function('try {return (typeof process !== "undefined") && (typeof process.versions.node !== "undefined")}catch(e){return false;}'),N=(e,t)=>t.startsWith(e)?t:"".concat(e).concat(t);const O=new class{constructor(){if(a(this,"_apiVersion",3),a(this,"_apiProtocol",""),a(this,"_apiHost",""),a(this,"_useProjectProxy",!1),a(this,"_accountShortName",""),a(this,"_projectShortName",""),a(this,"authOverride",void 0),A())this.loadBrowser();else{if(!R())throw new c("Could not identify environment; no configuration was setup");this.loadNode()}}get apiProtocol(){return this._apiProtocol}set apiProtocol(e){e.startsWith("http")&&(e.endsWith(":")&&(e=e.slice(0,-1)),this._apiProtocol=e)}get apiHost(){return this._apiHost}set apiHost(e){this._apiHost=e}get useProjectProxy(){return this._useProjectProxy}set useProjectProxy(e){this._useProjectProxy=e}get apiVersion(){return this._apiVersion}set apiVersion(e){}get accountShortName(){return this._accountShortName}set accountShortName(e){this._accountShortName=e}get projectShortName(){return this._projectShortName}set projectShortName(e){this._projectShortName=e}isLocal(){if(!A())return!1;const e=window.location.host;return"127.0.0.1"===e||0===e.indexOf("local.")||-1!==e.indexOf("ngrok")||0===e.indexOf("localhost")}loadNode(){this.apiProtocol="https",this.apiHost="forio.com"}loadBrowser(){const e=this.isLocal(),{protocol:t,pathname:n,host:o}=window.location;this.apiProtocol=e?"https":t,this.apiHost=e?"forio.com":o;const r=n.match(/\/app\/([\w-]+)\/([\w-]+)/);if(r){const[e,t]=r.slice(1);this.accountShortName=e,this.projectShortName=t}}setContext(e){e.apiProtocol&&(this.apiProtocol=e.apiProtocol),e.apiHost&&(this.apiHost=e.apiHost),"boolean"==typeof e.useProjectProxy&&(this.useProjectProxy=e.useProjectProxy),e.accountShortName&&(this.accountShortName=e.accountShortName),e.projectShortName&&(this.projectShortName=e.projectShortName)}},{COOKIE:P,SESSION:k}=g,I="com.forio.epicenter.session",C="epicenter.v3.sso";const L=new class{constructor(e){if(a(this,"type",void 0),e!==P&&e!==k)throw new c('Invalid Storage Type: "'.concat(e,'", please use "').concat(P,'" or "').concat(k,'".'));this.type=e,this.consumeSSO()}get session(){return(new(this.getStore())).getItem(I)}set session(e){const t=this.getStore(),n=this.getStoreOptions(e);e?new t(n).setItem(I,e):this.session&&new t(n).removeItem(I)}getStore(){return R()?f:this.type===k?y:m}getStoreOptions(e){const t=e||this.session;if(!t||R())return"";const{objectType:n}=t,o=O.isLocal(),r={samesite:o?"lax":"none",secure:!o},a=!o&&"app"!==window.location.pathname.split("/")[1];if("user"===n&&(!o&&!a)){const{accountShortName:e,projectShortName:n}=t,o=e?"/".concat(e):"",a=o&&n?"/".concat(n):"";return{...r,path:"/app".concat(o).concat(a)}}return{...r,path:"/"}}consumeSSO(){var e;if(R())return;let t=h.getItem(C);"string"==typeof t&&'"'!==t.charAt(0)&&'"'!==t.charAt(t.length-1)&&(t='"'.concat(t,'"'));const n=JSON.parse(JSON.parse(null!==(e=t)&&void 0!==e?e:'"null"'));if(n){const{accountShortName:e,projectShortName:t}=n,o=e?"/".concat(e):"",r=o&&t?"/".concat(t):"";this.session=n,h.removeItem(C,{domain:".".concat(window.location.hostname),path:"/app".concat(o).concat(r)})}}}(P);const j=new class{constructor(){a(this,"_handlers",[])}get handlers(){return this._handlers}clearHandlers(){this._handlers=[]}registerHandler(e,t){this.handlers.unshift({identifier:e,handle:t})}async handle(e,t,n){const o=(n=n||this.handlers).findIndex((({identifier:t})=>t(e))),r=n[o];if(!r)throw e;let a;try{a=await r.handle(e,t).catch((e=>{throw e}))}catch(r){console.error("Handler failed due to error",r);const i=o>-1?[...n.slice(0,o),...n.slice(o+1)]:[],s=r instanceof u?r:e;a=await this.handle(s,t,i)}return a}};const U=e=>e.constructor===URLSearchParams?e:("object"==typeof e&&e.constructor===Object&&(e=Object.entries(e).reduce(((e,[t,n])=>Array.isArray(n)?[...e,...n.map((e=>[t,e]))]:(null==n||e.push([t,n.toString()]),e)),[])),new URLSearchParams(e));async function D(e,t){const{method:n,headers:o,body:r,includeAuthorization:a,inert:i,paginated:h,authorization:d}=t,p=((e,t,n,o)=>{const r=Object.assign({},e);let a=null;if(A()&&t instanceof FormData?a=t:t&&(r["Content-type"]="application/json; charset=UTF-8",a=JSON.stringify(t)),!n)return delete r.Authorization,{headers:r,body:a};const{session:i}=L;return r.Authorization||(i&&(r.Authorization="Bearer ".concat(i.token)),o&&(r.Authorization=o),O.authOverride&&(r.Authorization=O.authOverride)),{headers:r,body:a}})(o,r,a,d),f=await s(e.toString(),{method:n,cache:"no-cache",redirect:"follow",headers:p.headers,body:p.body});if(204===f.status)return new l(void 0,f);const y=f.headers.get("content-type");if(!y||!y.includes("application/json"))throw new c("Response content-type '".concat(y,"' does not include 'application/json' and my url is ").concat(e.toString(),", ").concat(n));const m=await f.json();if(f.status>=200&&f.status<400){const n=new l(h?function(e,t,n){var o;const r=null!==(o=n.parsePage)&&void 0!==o?o:e=>e,a={...e,values:r(e.values)},i=e.totalResults,s=async function(e=0,o=[]){if(e>=i)return o;const a=new URLSearchParams(t.search);a.set("first",e.toString()),a.delete("max"),t.search=a.toString();const c=await D(t,{...n,paginated:!1}).then((({body:e})=>e));return o.push(...r(c.values)),s(e+c.maxResults,o)};return a.prev=async function(){const e=new URLSearchParams(t.search);if(0===a.firstResult)return console.warn('Pagination: cannot call "prev" on first page'),[];const o=a.firstResult-a.maxResults,i=a.maxResults+(o<0?o:0);e.set("first",Math.max(o,0).toString()),e.set("max",i.toString()),t.search=e.toString();const s=await D(t,{...n,paginated:!1}).then((({body:e})=>e));return s.values=r(s.values),Object.assign(a,s),a.values},a.next=async function(){const e=new URLSearchParams(t.search),o=a.firstResult+a.maxResults;if(o>=a.totalResults)return console.warn('Pagination: cannot call "next" on final page'),[];e.set("first",o.toString()),t.search=e.toString();const i=await D(t,{...n,paginated:!1}).then((({body:e})=>e));return i.values=r(i.values),Object.assign(a,i),a.values},a.all=s,a}(m,e,t):m,f);return n}const g=new u(m,f);if(i)throw g;const w={...t,inert:!0},b=()=>D(e,w);return b.requestArguments={url:e,...w},j.handle(g,b)}class B{constructor(){a(this,"_version",void 0),a(this,"_server",void 0),a(this,"_useProjectProxy",void 0),a(this,"_accountShortName",void 0),a(this,"_projectShortName",void 0),a(this,"_authorization",void 0),a(this,"_searchParams",new URLSearchParams)}get version(){return this._version}set version(e){this._version=e}get server(){return this._server}set server(e){this._server=e}get useProjectProxy(){return this._useProjectProxy}set useProjectProxy(e){this._useProjectProxy=e}get accountShortName(){return this._accountShortName}set accountShortName(e){this._accountShortName=e}get projectShortName(){return this._projectShortName}set projectShortName(e){this._projectShortName=e}get authorization(){return this._authorization}set authorization(e){this._authorization=e}get searchParams(){return this._searchParams}set searchParams(e){this._searchParams=U(e)}withVersion(e){return void 0!==e&&(this.version=e),this}withServer(e){return void 0!==e&&(this.server=e),this}withProjectProxy(e){return void 0!==e&&(this.useProjectProxy=e),this}withAccountShortName(e){return void 0!==e&&(this.accountShortName=e),this}withProjectShortName(e){return void 0!==e&&(this.projectShortName=e),this}withAuthorization(e){return void 0!==e&&(this.authorization=e),this}withSearchParams(e){return void 0!==e&&(this.searchParams=e),this}getURL(e,t={}){var n,o,r,a,i,s,c,u,l,h,d;const p=null!==(n=null!==(o=t.server)&&void 0!==o?o:this.server)&&void 0!==n?n:"".concat(O.apiProtocol,"://").concat(O.apiHost),f=null!==(r=null!==(a=t.useProjectProxy)&&void 0!==a?a:this.useProjectProxy)&&void 0!==r?r:O.useProjectProxy,y=null!==(i=null!==(s=t.accountShortName)&&void 0!==s?s:this.accountShortName)&&void 0!==i?i:O.accountShortName,m=null!==(c=null!==(u=t.projectShortName)&&void 0!==u?u:this.projectShortName)&&void 0!==c?c:O.projectShortName,g=null!==(l=null!==(h=null==t?void 0:t.version)&&void 0!==h?h:this.version)&&void 0!==l?l:O.apiVersion,w=new URL("".concat(p)),b=f?"proxy/".concat(y,"/").concat(m,"/"):"",v="api/v".concat(g,"/").concat(y,"/").concat(m),S=N("/",e);return w.pathname="".concat(b).concat(v).concat(S),w.search=void 0!==t.query?U(t.query).toString():(null!==(d=this.searchParams)&&void 0!==d?d:new URLSearchParams).toString(),w}async get(e,t={}){const{accountShortName:n,projectShortName:o,authorization:r,server:a,query:i,useProjectProxy:s,headers:c,includeAuthorization:u,inert:l,paginated:h,parsePage:d}=t,p=this.getURL(e,{server:a,query:i,accountShortName:n,projectShortName:o,useProjectProxy:s});if(p.href.length>2048){var f;const n=null!==(f=this.searchParams)&&void 0!==f?f:new URLSearchParams,o=Array.from(n.entries()).reduce(((e,[t,n])=>e[t]?(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(n),e):(e[t]=n,e)),{});return this.searchParams="",this.post(e,{...t,body:o})}return D(p,{method:"GET",headers:c,includeAuthorization:null==u||u,authorization:null!=r?r:this.authorization,inert:l,paginated:h,parsePage:d})}async delete(e,t={}){const{accountShortName:n,projectShortName:o,authorization:r,server:a,query:i,useProjectProxy:s,headers:c,includeAuthorization:u,inert:l}=t;return D(this.getURL(e,{server:a,query:i,accountShortName:n,projectShortName:o,useProjectProxy:s}),{method:"DELETE",headers:c,includeAuthorization:null==u||u,authorization:null!=r?r:this.authorization,inert:l})}async patch(e,t={}){const{accountShortName:n,projectShortName:o,authorization:r,server:a,query:i,useProjectProxy:s,headers:c,body:u,includeAuthorization:l,inert:h}=t;return D(this.getURL(e,{server:a,query:i,accountShortName:n,projectShortName:o,useProjectProxy:s}),{method:"PATCH",headers:c,body:u,includeAuthorization:null==l||l,authorization:null!=r?r:this.authorization,inert:h})}async post(e,t={}){const{accountShortName:n,projectShortName:o,authorization:r,server:a,query:i,useProjectProxy:s,headers:c,body:u,includeAuthorization:l,inert:h}=t;return D(this.getURL(e,{server:a,query:i,accountShortName:n,projectShortName:o,useProjectProxy:s}),{method:"POST",headers:c,body:u,includeAuthorization:null==l||l,authorization:null!=r?r:this.authorization,inert:h})}async put(e,t={}){const{accountShortName:n,projectShortName:o,authorization:r,server:a,query:i,useProjectProxy:s,headers:c,body:u,includeAuthorization:l,inert:h}=t;return D(this.getURL(e,{server:a,query:i,accountShortName:n,projectShortName:o,useProjectProxy:s}),{method:"PUT",headers:c,body:u,includeAuthorization:null==l||l,authorization:null!=r?r:this.authorization,inert:h})}}var K=Object.freeze({__proto__:null,getAccount:async function(e){return await(new B).withAccountShortName(e).get("/account").then((({body:e})=>e))},createAccount:async function(e){return await(new B).withAccountShortName("epicenter").withProjectShortName("manager").post("/account",{body:e}).then((({body:e})=>e))},updateAccount:async function(e,t={}){return await(new B).patch("/account",{body:e,...t}).then((({body:e})=>e))},removeAccount:async function(e){return await(new B).withAccountShortName(e).delete("/account").then((({body:e})=>e))},teamForAdmin:async function(e,t={}){const{includeAllMembers:n,filter:o,first:r,max:a,...i}=t,s={includeAllMembers:n,filter:o,first:r,max:a};return await(new B).withAccountShortName("epicenter").withProjectShortName("manager").withSearchParams(s).get("/account/team/for/".concat(e),i).then((({body:e})=>e))}});var M,z,F,q,H=Object.freeze({__proto__:null,createAdmin:async function(e){return await(new B).withAccountShortName("epicenter").withProjectShortName("manager").post("/admin",{body:e}).then((({body:e})=>e))},getWithHandle:async function(e,t={}){return await(new B).withAccountShortName("epicenter").withProjectShortName("manager").get("/admin/with/".concat(e),t).then((({body:e})=>e))}});async function G(e={}){return await(new B).get("/project/channel/isEnabled",e).then((({body:e})=>e))}!function(e){e.PUBLIC="PUBLIC",e.PRIVATE="PRIVATE",e.AUTHENTICATED="AUTHENTICATED"}(M||(M={})),function(e){e.NONE="NONE",e.ALL="ALL",e.FREE="FREE",e.LICENSED="LICENSED",e.ACCOUNT="ACCOUNT"}(z||(z={})),function(e){e.ORIGINAL="ORIGINAL",e.HISTORICAL="HISTORICAL",e.REFERENTIAL="REFERENTIAL",e.ORDERED="ORDERED",e.EVENTUAL="EVENTUAL"}(F||(F={})),function(e){e.INSENSITIVE="INSENSITIVE",e.SENSITIVE="SENSITIVE"}(q||(q={}));var W=Object.freeze({__proto__:null,channelsEnabled:G,get:async function(e={}){return await(new B).get("/project",e).then((({body:e})=>e))},list:async function(e,t={}){return await(new B).withAccountShortName(e).withProjectShortName("manager").get("/project/in",t).then((({body:e})=>e))}});const V="com.forio.epicenter.token",Y="connected";let X;const J=new class{constructor(){a(this,"url",""),a(this,"initialization",!1),a(this,"subscriptions",new Map),a(this,"isConnected",!1)}get cometd(){if(!X)throw new c("Tried to get non-existent cometd");return X}set cometd(e){X=e}async startup(){if(!await G())throw new c("Push Channels are not enabled on this project");const{CometD:e}=await Promise.resolve().then((function(){return lt})),t=(await Promise.resolve().then((function(){return dt}))).default,n=(await Promise.resolve().then((function(){return ft}))).default;this.cometd=new e;const{apiProtocol:o,apiHost:r,apiVersion:a,accountShortName:i,projectShortName:s}=O,u=i&&s?"/".concat(i,"/").concat(s):"/epicenter/manager";return this.url="".concat(o,"://").concat(r,"/push/v").concat(a).concat(u,"/cometd"),this.cometd.registerExtension("ack",new t),A()&&(this.cometd.registerExtension("reload",new n),window.onunload=()=>{if(this.cometd.getStatus()===Y){this.cometd.reload&&this.cometd.reload();const e=this.cometd.getTransport();e&&e.abort()}}),this.cometd.configure({url:this.url,logLevel:"debug"}),!0}listenToMetaChannels(){const e=new Promise(((e,t)=>{this.cometd.addListener("/meta/connect",(n=>{if(this.cometd.isDisconnected())return;const o=this.isConnected;if(this.isConnected=n.successful,!o&&this.isConnected){const n=new u({status:void 0,message:"Reconnected to CometD",information:{code:"COMETD_RECONNECTED"}}),o=()=>Promise.resolve();try{const t=j.handle(n,o);e(t)}catch(e){t(e)}}}))})),t=new Promise((e=>{this.cometd.addListener("/meta/disconnect",(t=>{t.successful&&(this.isConnected=!1),e(t)}))}));return Promise.all([e,t])}async init(){return this.initialization||(this.initialization=await this.startup()),this.initialization}async handshake(e={}){if(await this.init(),"disconnected"!==this.cometd.getStatus())return Promise.resolve();let t={};const{session:n}=L;return n&&(t={ext:{[V]:n.token,ack:!0}}),this.cometd.websocketEnabled=!0,new Promise(((n,o)=>this.cometd.handshake(t,(t=>{var r;if(t.successful)return this.listenToMetaChannels(),void n(t);const a=null!==(r=t.error)&&void 0!==r?r:"",i=new u({status:a.includes("403")?403:void 0,message:a,information:{code:"COMETD_ERROR",...t}});if(e.inert)return void o(i);const s=()=>this.handshake({inert:!0});try{const e=j.handle(i,s);n(e)}catch(e){o(e)}}))))}async disconnect(){return this.initialization?(await this.init(),await this.empty(),this.cometd.getStatus()!==Y?Promise.resolve():new Promise(((e,t)=>this.cometd.disconnect((n=>{n.successful?e(void 0):t(new c("Unable to disconnect from CometD server"))}))))):Promise.resolve()}async add(e,t,n={}){var o;await this.init();const r=[].concat(e);(null===(o=this.cometd)||void 0===o?void 0:o.getStatus())!==Y&&await this.handshake();const{session:a}=L,i=a?{ext:{[V]:a.token}}:{},s=({data:e})=>(e="string"==typeof e?JSON.parse(e):e,t(e)),c=[];return this.cometd.batch((()=>r.forEach((({path:o})=>c.push(new Promise(((r,a)=>{const c=this.cometd.subscribe(o,s,i,(o=>{var i;if(o.successful)return this.subscriptions.set(c.channel,c),void r(c);const s=null!==(i=o.error)&&void 0!==i?i:"",l=new u({status:s.includes("403")?403:void 0,message:s,information:{code:"COMETD_ERROR",...o}});if(n.inert)return void a(l);const h=()=>this.add(e,t,{inert:!0});try{const e=j.handle(l,h),t=Array.isArray(e)?e[0]:e;r(t)}catch(e){a(e)}}))}))))))),1===c.length?Promise.all(c).then((([e])=>e)):Promise.all(c)}async publish(e,t,n={}){await this.init();const o=[].concat(e);this.cometd.getStatus()!==Y&&await this.handshake();const{session:r}=L,a={ext:r?{[V]:r.token}:void 0},i=[];return this.cometd.batch((()=>o.forEach((({path:o})=>i.push(new Promise(((r,i)=>{this.cometd.publish(o,t,a,(o=>{var a;if(o.successful)return void r(o);const s=null!==(a=o.error)&&void 0!==a?a:"",c=new u({status:s.includes("403")?403:void 0,message:s,information:{code:"COMETD_ERROR",...o}});if(n.inert)return void i(c);const l=()=>this.publish(e,t,{inert:!0});try{const e=j.handle(c,l),t=Array.isArray(e)?e[0]:e;r(t)}catch(e){i(e)}}))}))))))),1===i.length?Promise.all(i).then((([e])=>e)):Promise.all(i)}async remove(e){return await this.init(),this.subscriptions.delete(e.channel),new Promise(((t,n)=>this.cometd.unsubscribe(e,(e=>{var o;e.successful&&t(e);const r=null!==(o=e.error)&&void 0!==o?o:"",a=new u({status:void 0,message:r,information:{code:"COMETD_ERROR",...e}});n(a)}))))}async empty(){await this.init();const e=[];return this.cometd.batch((()=>this.subscriptions.forEach((t=>{e.push(this.remove(t))})))),Promise.all(e)}};async function Z(){L.session=void 0,await J.disconnect()}async function $(e,t={}){const{objectType:n="user",accountShortName:o,...r}=t,a=await(new B).patch("/authentication",{accountShortName:"admin"===n?e:o,body:{objectType:n,groupKey:"user"===n?e:void 0},...r}).then((({body:e})=>e));return await Z(),L.session=a,a}var Q=Object.freeze({__proto__:null,logout:async function(){await J.disconnect();try{var e,t;if(null!=L&&null!==(e=L.session)&&void 0!==e&&e.groupKey)await(new B).delete("/presence/group/".concat(null==L||null===(t=L.session)||void 0===t?void 0:t.groupKey));await(new B).delete("/verification")}catch(e){console.error("Error with DELETE to /verification",e)}L.session=void 0},getSession:async function(){const{body:e}=await(new B).get("/verification");return L.session=e,e},getLocalSession:function(){return L.session},setLocalSession:function(e){return L.session=e},removeLocalSession:Z,login:async function(e,t={}){const{objectType:n,...o}=t;let r;if(Object.prototype.hasOwnProperty.call(e,"handle")){const{handle:t,password:o,groupKey:a}=e;r={objectType:null!=n?n:"user",handle:t,password:o,groupKey:a||void 0}}if(Object.prototype.hasOwnProperty.call(e,"secretKey")){const{secretKey:t}=e;r={objectType:null!=n?n:"account",secretKey:t}}const a=await(new B).post("/authentication",{inert:!0,includeAuthorization:!1,body:r,...o}).then((({body:e})=>e));return await Z(),L.session=a,a},regenerate:$,sso:async function(e={}){const t=await(new B).get("/registration/sso",e).then((({body:e})=>e));return L.session=t,t},getSAMLLink:async function(e={}){return await(new B).get("/registration/sso/saml",e).then((({body:e})=>e))},generateSAMLLINK:function(e={}){return(new B).getURL("/registration/sso/saml",e).toString()},ssoOutcome:async function(e,t,n={}){const{...o}=n;return await(new B).post("/lti/".concat(e,"/outcome"),{body:t,...o}).then((({body:e})=>e))},resetPassword:async function(e,t={}){const{redirectURL:n,subject:o,...r}=t;return await(new B).post("/verification/password/user/".concat(e),{...r,body:{redirectUrl:n,subject:o}}).then((({body:e})=>e))},verify:async function(e,t={}){return await(new B).get("/verification",{authorization:"Bearer ".concat(e),...t}).then((({body:e})=>e))}});async function ee(t,n,o={}){const{scopeBoundary:r,scopeKey:a,userKey:i}=n,{readLock:s,writeLock:c,ttlSeconds:u,...l}=o;return await(new B).post("/asset",{body:{file:t,scope:{scopeBoundary:r,scopeKey:a,userKey:i},permit:{readLock:null!=s?s:e.ROLE.USER,writeLock:null!=c?c:e.ROLE.USER},ttlSeconds:u},...l}).then((({body:e})=>e))}async function te(t,n,o={}){const{scopeBoundary:r,scopeKey:a,userKey:i}=n,{readLock:s,writeLock:c,ttlSeconds:u,...l}=o;return await(new B).patch("/asset",{body:{file:t,scope:{scopeBoundary:r,scopeKey:a,userKey:i},permit:{readLock:null!=s?s:e.ROLE.USER,writeLock:null!=c?c:e.ROLE.USER},ttlSeconds:u},...l}).then((({body:e})=>e))}var ne,oe=Object.freeze({__proto__:null,create:ee,update:te,remove:async function(e,t={}){return await(new B).delete("/asset/".concat(e),t).then((({body:e})=>e))},removeFromScope:async function(e,t={}){const{scopeBoundary:n,scopeKey:o,userKey:r}=e,a=r?"/".concat(r):"";return await(new B).delete("/asset/in/".concat(n,"/").concat(o).concat(a),t).then((({body:e})=>e))},get:async function(e,t={}){const{server:n,accountShortName:o,projectShortName:r}=t;return await(new B).withServer(n).withAccountShortName(o).withProjectShortName(r).get("/asset/".concat(e)).then((({body:e})=>e))},list:async function(e,t={}){const{scopeBoundary:n,scopeKey:o,userKey:r}=e,{filter:a,...i}=t,s=r?"/".concat(r):"";return await(new B).get("/asset/in/".concat(n,"/").concat(o).concat(s,"/").concat(null!=a?a:"*"),i).then((({body:e})=>e))},getURL:async function(e,t={}){return await(new B).get("/asset/url/".concat(e),t).then((({body:e})=>e))},getURLWithScope:async function(e,t,n={}){const{scopeBoundary:o,scopeKey:r,userKey:a}=t,i=a?"/".concat(a):"";return await(new B).get("/asset/url/with/".concat(o,"/").concat(r).concat(i,"/").concat(e),n).then((({body:e})=>e))},download:async function(e,t={}){return await(new B).get("/asset/download/".concat(e),t).then((({body:e})=>e))},downloadWithScope:async function(e,t,n={}){const{scopeBoundary:o,scopeKey:r,userKey:a}=t,i=a?"/".concat(a):"";return await(new B).get("/asset/download/with/".concat(o,"/").concat(r).concat(i,"/").concat(e),n).then((({body:e})=>e))},store:async function(e,t,n={}){const{overwrite:o,fileName:r,...a}=n,i=null!=r?r:e.name;let c="";try{c=(await ee(i,t,a)).url}catch(e){if(!(e instanceof u))throw e;if(!(409===e.status&&o))throw e;c=(await te(i,t,a)).url}await s(c,{method:"PUT",body:e})}});!function(e){e.HEX="HEX",e.BASE_64="BASE_64"}(ne||(ne={}));var re=Object.freeze({__proto__:null,sendEmail:async function(e,t,n,o,r={}){const{accountShortName:a,projectShortName:i,server:s,familyNameFirst:c,html:u,attachments:l,from:h,replyTo:d,fromUserKey:p}=r;let f="";return p?f+="/as/".concat(p):h&&(f+="/from/".concat(h),d&&(f+="/".concat(d))),await(new B).withServer(s).withAccountShortName(a).withProjectShortName(i).post("/email/user/".concat(e,"/").concat(t).concat(f),{body:{subject:n,body:o,familyNameFirst:c,html:u,attachments:l}}).then((({body:e})=>e))},sendEmailToAdmin:async function(e,t,n,o={}){const{accountShortName:r,projectShortName:a,server:i,familyNameFirst:s,html:c,attachments:u}=o;return await(new B).withServer(i).withAccountShortName(r).withProjectShortName(a).post("/email/admin/".concat(e),{body:{subject:t,body:n,familyNameFirst:s,html:c,attachments:u}}).then((({body:e})=>e))}});var ae,ie=Object.freeze({__proto__:null,create:async function(e,t,n={}){const{draft:o,runLimit:r,...a}=n;return await(new B).post("/episode/".concat(t),{body:{name:e,draft:o,runLimit:r},...a}).then((({body:e})=>e))},get:async function(e,t={}){return await(new B).get("/episode/".concat(e),t).then((({body:e})=>e))},query:async function(e,t={}){const{filter:n=[],sort:o=[],first:r=0,max:a}=e;return await(new B).withSearchParams({filter:n.join(";")||void 0,sort:o.join(";")||void 0,first:r,max:a}).get("/episode/search",{paginated:!0,...t}).then((({body:e})=>e))},forGroup:async function(e,t={}){return await(new B).get("/episode/in/".concat(e),t).then((({body:e})=>e))},withName:async function(e,t={}){const{groupName:n,...o}=t,r=L.session;return await(new B).get("/episode/with/".concat(null!=n?n:null==r?void 0:r.groupName,"/").concat(e),o).then((({body:e})=>e))},remove:async function(e,t={}){return await(new B).delete("/episode/".concat(e),t).then((({body:e})=>e))}});async function se(e,t={}){const{filter:n=[],sort:o=[],first:r,max:a,quantized:i}=e,s={filter:n.join(";")||void 0,sort:o.join(";")||void 0,first:r,max:a};return await(new B).withSearchParams(s).get("/group".concat(i?"/quantized":"","/search"),{paginated:!0,...t}).then((({body:e})=>e))}!function(e){e.MEMBERS="MEMBERS",e.QUANTIZED="QUANTIZED"}(ae||(ae={}));var ce=Object.freeze({__proto__:null,get:async function(e={}){const{groupKey:t,augment:n,...o}=e;let r="";n===ae.MEMBERS&&(r="/member"),n===ae.QUANTIZED&&(r="/quantized");const a=L.session;return await(new B).get("/group".concat(r,"/").concat(null!=t?t:null==a?void 0:a.groupKey),o).then((({body:e})=>e))},destroy:async function(e,t={}){return await(new B).delete("/group/".concat(e),t).then((({body:e})=>e))},gather:async function(e={}){const{includeExpired:t,...n}=e;return await(new B).withSearchParams({includeExpired:t}).get("/group",n).then((({body:e})=>e))},update:async function(e,t,n={}){const{runLimit:o,organization:r,allowSelfRegistration:a,flightRecorder:i,event:s,allowMembershipChanges:c,pricing:u,startDate:l,expirationDate:h,capacity:d}=t;return await(new B).patch("/group/".concat(e),{body:{runLimit:o,organization:r,allowSelfRegistration:a,flightRecorder:i,event:s,allowMembershipChanges:c,pricing:u,startDate:l,expirationDate:h,capacity:d},...n}).then((({body:e})=>e))},create:async function(e,t={}){const{name:n,runLimit:o,organization:r,allowSelfRegistration:a,flightRecorder:i,event:s,allowMembershipChanges:u,pricing:l,startDate:h,expirationDate:d,capacity:p}=e;if(!n)throw new c("Cannot create a group with no name");return await(new B).post("/group",{body:{name:n,runLimit:o,organization:r,allowSelfRegistration:a,flightRecorder:i,event:s,allowMembershipChanges:u,pricing:l,startDate:h,expirationDate:d,capacity:p},...t}).then((({body:e})=>e))},query:se,search:async function(e={}){console.warn("DEPRECATION WARNING: groupAdapter.search is deprecated and will be removed with the next release. Use groupAdapter.query instead.");const{filter:t=[],sort:n=[],first:o,max:r,quantized:a,...i}=e,s={filter:t,sort:n,first:o,max:r,quantized:a};return await se(s,i)},withGroupName:async function(e,t={}){return await(new B).get("/group/with/".concat(e),t).then((({body:e})=>e))},forUser:async function(e,t={}){const{includeExpired:n,includeAllMembers:o,role:r,...a}=t,i=Array.isArray(r)&&r.length>0,s={includeExpired:n,includeAllMembers:o,role:r?i?r:[r]:void 0};return await(new B).withSearchParams(s).get("/group/member/for/".concat(e),a).then((({body:e})=>e))},getSessionGroups:async function(e={}){const{includeExpired:t,role:n,...o}=e,r=Array.isArray(n)&&n.length>0,a={includeExpired:t,role:n?r?n:[n]:void 0};return await(new B).withSearchParams(a).get("/group/member",o).then((({body:e})=>e))},whitelistUsers:async function(e,t={}){const{allow:n=!0,emails:o=["*"],...r}=t;return await(new B).post("/group/self/".concat(e),{body:{allow:n,emails:o},...r}).then((({body:e})=>e))},getWhitelistedUsers:async function(e,t={}){return await(new B).get("/group/self/".concat(e),t).then((({body:e})=>e))},sendRegistrationEmail:async function(e,t,n={}){const{redirectURL:o,linkURL:r,subject:a,...i}=n;return await(new B).post("/registration/self/".concat(e),{body:{email:t,linkUrl:r,redirectUrl:o,subject:a},...i}).then((({body:e})=>e))},selfRegister:async function(e,t,n={}){const{displayName:o,givenName:r,familyName:a,handle:i,...s}=n;return await(new B).patch("/registration/self/".concat(e),{body:{password:t,displayName:o,givenName:r,familyName:a,handle:i},...s}).then((({body:e})=>e))},addUser:async function(t,n={}){const{groupKey:o,...r}=n,a=Array.isArray(t)?t:[t],i=L.session;return await(new B).post("/group/member/".concat(null!=o?o:null==i?void 0:i.groupKey),{body:a.map((t=>{const n="string"==typeof t?t:t.userKey,o="string"==typeof t?e.ROLE.PARTICIPANT:t.role,r="string"==typeof t||t.available;return{role:o,userKey:n,objectType:"group",available:null==r||r}})),...r}).then((({body:e})=>e))},updateUser:async function(e,t,n={}){const{role:o,available:r}=t,{groupKey:a,...i}=n,s=L.session;return await(new B).patch("/group/member/".concat(null!=a?a:null==s?void 0:s.groupKey,"/").concat(e),{body:{objectType:"group",role:o,available:r},...i}).then((({body:e})=>e))},removeUser:async function(e,t={}){const{groupKey:n,...o}=t,r=Array.isArray(e)&&e.length>1,a=r?"":"/".concat(1===e.length?e[0]:e),i=r?{userKey:e}:void 0,s=L.session;return await(new B).withSearchParams(i).delete("/group/member/".concat(null!=n?n:null==s?void 0:s.groupKey).concat(a),o).then((({body:e})=>e))},statusUpdate:async function(e,t,n={}){const{groupKey:o,...r}=n,a=L.session;return await(new B).patch("/group/status/".concat(null!=o?o:null==a?void 0:a.groupKey),{body:{code:e,message:t},...r}).then((({body:e})=>e))}});async function ue(e,t,n,o={}){const{scopeBoundary:r,scopeKey:a}=t,{filter:i=[],sort:s=[],first:c,max:u}=n,l={filter:i.join(";")||void 0,sort:s.join(";")||void 0,first:c,max:u};return await(new B).withSearchParams(l).get("/leaderboard/".concat(r,"/").concat(a,"/").concat(e),o).then((({body:e})=>e))}var le=Object.freeze({__proto__:null,update:async function(e,t,n,o={}){const{tags:r,...a}=o,{scopeBoundary:i,scopeKey:s,userKey:c}=t,u=L.session;return await(new B).post("/leaderboard",{body:{scope:{scopeBoundary:i,scopeKey:s,userKey:null!=c?c:null==u?void 0:u.userKey},collection:e,scores:n,tags:r},...a}).then((({body:e})=>e))},list:ue,get:async function(e,t,n,o={}){return console.warn("DEPRECATION WARNING: leaderboardAdapter.get is deprecated and will be removed with the next release. Use leaderboardAdapter.list instead."),await ue(e,t,n,o)}});var he=Object.freeze({__proto__:null,connect:async function(){await J.handshake()},forGroup:async function(e,t={}){return await(new B).get("/presence/group/".concat(e),t).then((({body:e})=>e))},forWorld:async function(e,t={}){return await(new B).get("/presence/world/".concat(e),t).then((({body:e})=>e))}});var de=Object.freeze({__proto__:null,google:async function(e){return await(new B).withAccountShortName("epicenter").withProjectShortName("manager").post("/recaptcha/google",{body:{humanKey:e}}).then((({body:e})=>e))}});async function pe(t,n,o={}){const{scopeBoundary:r,scopeKey:a,userKey:i}=n,{readLock:s,writeLock:c,ephemeral:u,trackingKey:l,modelContext:h,executionContext:d,...p}=o,{WORLD:f}=e.SCOPE_BOUNDARY,y=L.session,m=s||c,g=Object.assign({},p.headers,m?{"X-Forio-Confirmation":!0}:{}),w=m?{readLock:s,writeLock:c}:void 0;return await(new B).post("/run",{body:{scope:{scopeBoundary:r,scopeKey:a,userKey:r===f?void 0:null!=i?i:null==y?void 0:y.userKey},permit:w,morphology:"MANY",trackingKey:l,modelFile:t,modelContext:h||{},executionContext:d||{},ephemeral:u},...p,headers:g}).then((({body:e})=>e))}async function fe(e,t,n={}){const{filter:o=[],sort:r=[],first:a,max:i,timeout:s,variables:c=[],metadata:u=[],scope:l,groupName:h,episodeName:d,includeEpisodes:p}=t,f=L.session,y=l?"".concat(l.scopeBoundary,"/").concat(l.scopeKey):"in/".concat(null!=h?h:null==f?void 0:f.groupName).concat(d?"/".concat(d):"");null!=l&&l.userKey&&o.push("run.userKey=".concat(l.userKey));const m={filter:o.join(";")||void 0,sort:r.join(";")||void 0,var:c.join(";")||void 0,meta:u.join(";")||void 0,first:a,max:i,timeout:s,includeEpisodes:p};return await(new B).withSearchParams(m).get("/run/".concat(y,"/").concat(e),{paginated:!0,parsePage:e=>e.map((e=>(e.variables=c.reduce(((t,n,o)=>{var r;return t[n]=null===(r=e.variables)||void 0===r?void 0:r[o],t}),{}),e))),...n}).then((({body:e})=>e))}async function ye(t,n,o={}){const{timeout:r,ritual:a,...i}=o,s=Array.isArray(t)&&t.length>1;a!==e.RITUAL.EXORCISE&&s&&console.warn("Detected ritual: ".concat(a," usage with multiple runKeys; this not allowed. Defaulting to ritual: EXORCISE"));const c=e=>n.reduce(((t,n,o)=>(t[n]=e[o],t)),{}),u={timeout:r},l=s?"":"/".concat(1===t.length?t[0]:t),h=n.join(";"),d=s?{include:h,runKey:t}:{ritual:a,include:h};return await(new B).withSearchParams(u).post("/run/variable".concat(l),{body:d,...i}).then((({body:e})=>s?Object.keys(e).map((t=>({runKey:t,variables:c(e[t])}))):c(e)))}var me=Object.freeze({__proto__:null,create:pe,createSingular:async function(e,t={}){const{readLock:n,writeLock:o,ephemeral:r,modelContext:a,executionContext:i,...s}=t,c=n||o,u=Object.assign({},s.headers,c?{"X-Forio-Confirmation":!0}:{}),l=c?{readLock:n,writeLock:o}:void 0;return await(new B).post("/run/singular",{body:{modelFile:e,permit:l,modelContext:a||{},executionContext:i||{},ephemeral:r},...s,headers:u}).then((({body:e})=>e))},getSingularRunKey:async function(e={}){return await(new B).get("/run/singular/key",e).then((({body:e})=>e))},clone:async function(e,t={}){const{ephemeral:n,trackingKey:o,modelContext:r={},executionContext:a={},...i}=t;return await(new B).post("/run/clone/".concat(e),{body:{trackingKey:o,modelContext:r,executionContext:a,ephemeral:n},...i}).then((({body:e})=>e))},restore:async function(e,t={}){const{ephemeral:n,modelContext:o={},executionContext:r={},...a}=t;return await(new B).post("/run/restore/".concat(e),{body:{modelContext:o,executionContext:r,ephemeral:n},...a}).then((({body:e})=>e))},rewind:async function(e,t,n={}){const{ephemeral:o,modelContext:r={},...a}=n;return await(new B).post("/run/rewind/".concat(e),{body:{rewindCount:t,modelContext:r,ephemeral:o},...a}).then((({body:e})=>e))},update:async function(e,t,n={}){const{readLock:o,writeLock:r,trackingKey:a,marked:i,hidden:s,closed:c}=t,u=Array.isArray(e)&&e.length>1,l=u?"":"/".concat(1===e.length?e[0]:e),h=o||r?{readLock:o,writeLock:r}:void 0;return await(new B).withSearchParams(u?{runKey:e}:"").patch("/run".concat(l),{body:{permit:h,trackingKey:a,marked:i,hidden:s,closed:c},...n}).then((({body:e})=>e))},remove:async function(e,t={}){return await(new B).delete("/run/".concat(e),t).then((({body:e})=>e))},get:async function(e,t={}){return await(new B).get("/run/".concat(e),t).then((({body:e})=>e))},query:fe,introspect:async function(e,t={}){return await(new B).get("/run/introspect/model/".concat(e),t).then((({body:e})=>e))},introspectWithRunKey:async function(e,t={}){return await(new B).get("/run/introspect/".concat(e),t).then((({body:e})=>e))},operation:async function(t,n,o=[],r={}){const{timeout:a,ritual:i,...s}=r,c=Array.isArray(t)&&t.length>1,u=c?"":"/".concat(1===t.length?t[0]:t),l=c?{runKey:t,timeout:a}:{ritual:i,timeout:a};return i!==e.RITUAL.EXORCISE&&c&&console.warn("Detected ritual: ".concat(i," usage with multiple runKeys; this not allowed. Defaulting to ritual: EXORCISE")),await(new B).withSearchParams(l).post("/run/operation".concat(u),{body:{name:n,arguments:o,objectType:"execute"},...s}).then((({body:e})=>e))},getVariables:ye,getVariable:async function(e,t,n={}){const{timeout:o,ritual:r,...a}=n;if(Array.isArray(e)||Array.isArray(t)){return ye(e,Array.isArray(t)?t:[t],n)}return await(new B).withSearchParams({timeout:o,ritual:r}).get("/run/variable/".concat(e,"/").concat(t),a).then((({body:e})=>e))},updateVariables:async function(t,n,o={}){const{timeout:r,ritual:a,...i}=o,s=Array.isArray(t)&&t.length>1,c=s?"":"/".concat(1===t.length?t[0]:t),u=s?{runKey:t,timeout:r}:{ritual:a,timeout:r};return a!==e.RITUAL.EXORCISE&&s&&console.warn("Detected ritual: ".concat(a," usage with multiple runKeys; this not allowed. Defaulting to ritual: EXORCISE")),await(new B).withSearchParams(u).patch("/run/variable".concat(c),{body:n,...i}).then((({body:e})=>e))},getMetadata:async function(e,t,n={}){const{timeout:o,...r}=n,a=t.join(";"),i=Array.isArray(e)&&e.length>1,s={timeout:o},c=Array.isArray(e)?e:[e];return await(new B).withSearchParams(s).post("/run/meta",{body:{include:a,runKey:c},...r}).then((({body:e})=>{var t;const n=Object.keys(e).map((t=>({runKey:t,data:e[t]})));return i?n:null==n||null===(t=n[0])||void 0===t?void 0:t.data}))},updateMetadata:async function(e,t,n={}){const{timeout:o,...r}=n,a=Array.isArray(e)&&e.length>1,i=a?"":"/".concat(1===e.length?e[0]:e),s=a?{runKey:e,timeout:o}:{timeout:o};return await(new B).withSearchParams(s).patch("/run/meta".concat(i),{body:t,...r}).then((({body:e})=>e))},action:async function(t,n,o={}){const{timeout:r,ritual:a,...i}=o,s=Array.isArray(t)&&t.length>1,c=s?"":"/".concat(1===t.length?t[0]:t),u=s?{runKey:t,timeout:r}:{ritual:a,timeout:r};return a!==e.RITUAL.EXORCISE&&s&&console.warn("Detected ritual: ".concat(a," usage with multiple runKeys; this not allowed. Defaulting to ritual: EXORCISE")),await(new B).withSearchParams(u).post("/run/action".concat(c),{body:n,...i}).then((({body:e})=>e))},retrieveFromWorld:async function(e,t,n={}){const{readLock:o,writeLock:r,ephemeral:a,trackingKey:i,modelContext:s,executionContext:c,...u}=n,l=o||r,h=Object.assign({},u.headers,l?{"X-Forio-Confirmation":!0}:{}),d=l?{readLock:o,writeLock:r}:void 0;return await(new B).post("/run/world/".concat(e),{body:{permit:d,morphology:"MANY",trackingKey:i,modelFile:t,modelContext:s||{},executionContext:c||{},ephemeral:a},...u,headers:h}).then((({body:e})=>e))},removeFromWorld:async function(e,t={}){return await(new B).delete("/run/world/".concat(e),t).then((({body:e})=>e))},getWithStrategy:async function(e,t,n,o={}){if("reuse-across-sessions"===e){const e={scope:n,sort:["-run.created"],max:1},{values:[r]}=await fe(t,e);if(!r){return await pe(t,n,o)}return r}if("reuse-never"===e){return await pe(t,n,o)}throw new c("Invalid run strategy.")},migrate:async function(e,t,n={}){const{ephemeral:o,trackingKey:r,modelContext:a={},executionContext:i={},...s}=n;return await(new B).post("/run/migrate/to/".concat(t,"/").concat(e),{body:{trackingKey:r,modelContext:a,executionContext:i,ephemeral:o},...s}).then((({body:e})=>e))}});var ge=Object.freeze({__proto__:null,uploadCSV:async function(e,t={}){const{overwrite:n,...o}=t,r=new FormData;return r.append("file",e),await(new B).withSearchParams({overwrite:n}).post("/user/upload",{body:r,...o}).then((({body:e})=>e))},createUser:async function(e,t={}){return await(new B).post("/user",{body:e,...t}).then((({body:e})=>e))},get:async function(e,t={}){return await(new B).get("/user/".concat(e),t).then((({body:e})=>e))},getWithHandle:async function(e,t={}){const{modality:n,...o}=t,r=n?"/".concat(n):"";return await(new B).get("/user/with/".concat(e).concat(r),o).then((({body:e})=>e))}});async function we(t,n,o={}){const{scopeBoundary:r,scopeKey:a,userKey:i}=n,{readLock:s,writeLock:c,items:u,ttlSeconds:l,mutationStrategy:h="ERROR",...d}=o,{WORLD:p}=e.SCOPE_BOUNDARY,{PARTICIPANT:f,USER:y}=e.ROLE,m=r===p?f:y,g={mutationStrategy:h};return await(new B).withSearchParams(g).post("/vault/".concat(t),{body:{scope:{scopeBoundary:r,scopeKey:a,userKey:i},permit:{readLock:s||m,writeLock:c||m},ttlSeconds:l,items:u},...d}).then((({body:e})=>e))}var be=Object.freeze({__proto__:null,update:async function(e,t,n={}){var o,r,a;const{mutationKey:i,...s}=n;return await(new B).withSearchParams({MutationKey:i}).put("/vault/".concat(e),{body:{set:null!==(o=t.set)&&void 0!==o?o:{},push:null!==(r=t.push)&&void 0!==r?r:{},pop:null!==(a=t.pop)&&void 0!==a?a:{}},...s}).then((({body:e})=>e))},get:async function(e,t={}){return await(new B).get("/vault/".concat(e),t).catch((e=>404===e.status?{body:void 0}:Promise.reject(e))).then((({body:e})=>e))},withScope:async function(e,t,n={}){const{scopeBoundary:o,scopeKey:r,userKey:a}=t,i=a?"/".concat(a):"";return await(new B).get("/vault/with/".concat(o,"/").concat(r).concat(i,"/").concat(e),n).catch((e=>404===e.status?{body:void 0}:Promise.reject(e))).then((({body:e})=>e))},byName:async function(e,t={}){const{groupName:n,episodeName:o,userKey:r,includeEpisodes:a,...i}=t,s=L.session,c={userKey:r,includeEpisodes:a};return await(new B).withSearchParams(c).get("/vault/in/".concat(null!=n?n:null==s?void 0:s.groupName).concat(o?"/".concat(o):"","/").concat(e),{...i}).then((({body:e})=>e))},remove:async function(e,t={}){const{mutationKey:n,...o}=t;return await(new B).withSearchParams({MutationKey:n}).delete("/vault/".concat(e),o).then((({body:e})=>e))},define:we,create:async function(e,t,n,o={}){return console.warn("DEPRECATION WARNING: vaultAdapter.create is deprecated and will be removed with the next release. Use vaultAdapter.define instead."),await we(e,t,{items:n,...o})},list:async function(e,t={}){const{first:n,filter:o=[],max:r}=e,a={filter:o.join(";")||void 0,first:n,max:r};return(new B).withSearchParams(a).get("/vault/search",t).then((({body:e})=>e))}});let ve,Se,_e,Te;async function Ee(e,t,n={}){return await(new B).get("/video/url/".concat(t,"/").concat(e),n).then((({body:e})=>e))}async function xe(e,t,n,o,r={}){const{scopeBoundary:a,scopeKey:i,userKey:s}=o,c=s?"/".concat(s):"";return await(new B).get("/video/url/with/".concat(a,"/").concat(i).concat(c,"/").concat(n,"/").concat(t,"/").concat(e),r).then((({body:e})=>e))}async function Ae(e,t={}){return await(new B).get("/video/url/".concat(e),t).then((({body:e})=>e))}async function Re(e,t,n,o={}){const{scopeBoundary:r,scopeKey:a,userKey:i}=n,s=i?"/".concat(i):"";return await(new B).get("/video/dir/with/".concat(r,"/").concat(a).concat(s,"/").concat(t,"/").concat(e),o).then((({body:e})=>e))}async function Ne(e={}){return await(new B).get("/video/search",e).then((({body:e})=>e))}async function Oe(e,t={}){return await(new B).delete("/video/".concat(e),t).then((({body:e})=>e))}async function Pe(e,t,n={}){return await(new B).post("/video/execute/".concat(e),{body:t,...n}).then((({body:e})=>e))}async function ke(e,t,n={}){return await(new B).get("/video/download/".concat(t,"/").concat(e),n).then((({body:e})=>e))}async function Ie(e,t,n,o,r={}){const{scopeBoundary:a,scopeKey:i,userKey:s}=o,c=s?"/".concat(s):"";return await(new B).get("/video/download/with/".concat(a,"/").concat(i).concat(c,"/").concat(n,"/").concat(t,"/").concat(e),r).then((({body:e})=>e))}!function(e){e.VONAGE="VONAGE",e.DAILY="DAILY",e.DOMESTIC="DOMESTIC"}(ve||(ve={})),function(e){e.transcription="transcription"}(Se||(Se={})),function(e){e.mp3="mp3",e.mp4="mp4",e.wav="wav",e.flac="flac",e.ogg="ogg",e.amr="amr",e.webm="webm"}(_e||(_e={})),function(e){e["af-ZA"]="af-ZA",e["ar-AE"]="ar-AE",e["ar-SA"]="ar-SA",e["cy-GB"]="cy-GB",e["da-DK"]="da-DK",e["de-CH"]="de-CH",e["de-DE"]="de-DE",e["en-AB"]="en-AB",e["en-AU"]="en-AU",e["en-GB"]="en-GB",e["en-IE"]="en-IE",e["en-IN"]="en-IN",e["en-US"]="en-US",e["en-WL"]="en-WL",e["es-ES"]="es-ES",e["es-US"]="es-US",e["fa-IR"]="fa-IR",e["fr-CA"]="fr-CA",e["fr-FR"]="fr-FR",e["ga-IE"]="ga-IE",e["gd-GB"]="gd-GB",e["he-IL"]="he-IL",e["hi-IN"]="hi-IN",e["id-ID"]="id-ID",e["it-IT"]="it-IT",e["ja-JP"]="ja-JP",e["ko-KR"]="ko-KR",e["nl-NL"]="nl-NL",e["pt-BR"]="pt-BR",e["pt-PT"]="pt-PT",e["ru-RU"]="ru-RU",e["ta-IN"]="ta-IN",e["te-IN"]="te-IN",e["tr-TR"]="tr-TR",e["zh-CN"]="zh-CN",e["zh-TW"]="zh-TW",e["th-TH"]="th-TH",e["en-ZA"]="en-ZA",e["en-NZ"]="en-NZ"}(Te||(Te={}));var Ce=Object.freeze({__proto__:null,get AFFILIATE(){return ve},get PROCESSING_TYPE(){return Se},get MEDIA_FORMAT(){return _e},get LANGUAGE_CODE(){return Te},getVideoURLByKey:Ee,getVideoURLWith:xe,getVideoDirectoryByKey:Ae,getVideoDirectoryWith:Re,getVideoSearch:Ne,deleteVideoByKey:Oe,postVideoProcessor:Pe,downloadVideoByKey:ke,downloadVideoWith:Ie});async function Le(e,t={}){const{scope:n,affiliate:o,family:r,videoKey:a,...i}=t;if(n&&r&&o)return xe(e,r,o,n,i);if(a)return Ee(e,a,i);throw new c("Cannot get video URL -- either a video key or scope/affiliate/family specification is required.")}async function je(e={}){const{scope:t,affiliate:n,family:o,videoKey:r,...a}=e;if(t&&o&&n)return Re(o,n,t,a);if(r)return Ae(r,a);throw new c("Cannot get video URL -- either a video key or scope/affiliate/family specification is required.")}var Ue=Object.freeze({__proto__:null,remove:async function(e,t={}){return Oe(e,t)},query:async function(e,t={}){const{filter:n=[],sort:o=[],first:r,max:a}=e;return Ne({query:{filter:n.join(";")||void 0,sort:o.join(";")||void 0,first:r,max:a},paginated:!0,...t})},getURL:Le,getDirectoryURL:je,processVideo:async function(e,t,n={}){const{log:o,...r}=n;return Pe(e,{processors:t,log:o},r)},download:async function(e,t={}){const{scope:n,affiliate:o,family:r,videoKey:a,...i}=t;throw n&&r&&o&&Ie(e,r,o,n,i),a&&ke(e,a,i),new c("Cannot download video -- either a video key or scope/affiliate/family specification is required.")}});async function De(e={}){return await(new B).get("/vonage/session",e).then((({body:e})=>e))}async function Be(e,t={}){return await(new B).post("/vonage/token",{body:{...e,initialLayoutClassList:["placeholder"]},...t}).then((({body:e})=>e))}async function Ke(e,t={}){return await(new B).post("/vonage/archive",{body:e,...t}).then((({body:e})=>e))}async function Me(e={}){return await(new B).get("/vonage/info",e).then((({body:e})=>e))}async function ze(e,t={}){return await(new B).delete("/vonage/archive/".concat(e),t).then((({body:e})=>e))}var Fe=Object.freeze({__proto__:null,getSession:De,postToken:Be,postArchive:Ke,getInfo:Me,deleteArchiveByID:ze});var qe,He,Ge,We=Object.freeze({__proto__:null,getProjectID:async function(e={}){return(await Me(e)).apiKey},createSession:async function(e={}){return De(e)},generateToken:async function(e,t={}){return(await Be({sessionId:e},t)).token},startArchive:async function(t,n,o,r={}){const{readLock:a,writeLock:i,ttlSeconds:s,resolution:c,...u}=r,{PARTICIPANT:l,USER:h}=e.ROLE,d=o.userKey?h:l;return Ke({name:t,sessionId:n,scope:o,permit:{readLock:null!=a?a:d,writeLock:null!=i?i:d},ttlSeconds:s,resolution:c},u)},stopArchive:async function(e,t={}){return ze(e,t)}});!function(e){e.MINIMUM="MINIMUM",e.MAXIMUM="MAXIMUM"}(qe||(qe={})),function(e){e.GROUP="GROUP",e.EPISODE="EPISODE"}(He||(He={})),function(e){e.colorAnimal="colorAnimal",e.sequential="sequential"}(Ge||(Ge={}));var Ve=Object.freeze({__proto__:null,update:async function(e,t,n={}){const{name:o,runKey:r}=t;return await(new B).patch("/world/".concat(e),{body:{name:o,runKey:r},...n}).then((({body:e})=>e))},destroy:async function(e,t={}){return await(new B).delete("/world/".concat(e),t).then((({body:e})=>e))},create:async function(e={}){const{name:t,groupName:n,episodeName:o,worldNameGenerator:r,...a}=e,i=L.session;return await(new B).post("/world/".concat(null!=n?n:null==i?void 0:i.groupName).concat(o?"/".concat(o):""),{body:{name:t,worldNameGenerator:r},...a}).then((({body:e})=>e))},get:async function(e={}){const{groupName:t,episodeName:n,mine:o,...r}=e,a=L.session;return await(new B).withSearchParams({mine:o}).get("/world/".concat(null!=t?t:null==a?void 0:a.groupName).concat(n?"/".concat(n):""),r).then((({body:e})=>e))},getAssignments:async function(e={}){const{groupName:t,episodeName:n,mine:o,...r}=e,a=L.session;return await(new B).withSearchParams({mine:o}).get("/world/assignment/for/".concat(null!=t?t:null==a?void 0:a.groupName).concat(n?"/".concat(n):""),r).then((({body:e})=>e))},getSessionWorlds:async function(e={}){return await(new B).get("/world/assignment",e).then((({body:e})=>e))},selfAssign:async function(e={}){const{role:t,groupName:n,episodeName:o,objective:r=qe.MINIMUM,worldNameGenerator:a,...i}=e,s=L.session;return await(new B).post("/world/selfassign/".concat(null!=n?n:null==s?void 0:s.groupName).concat(o?"/".concat(o):""),{body:{role:t,objective:r,worldNameGenerator:a},...i}).then((({body:e})=>e))},autoAssignUsers:async function(e,t={}){const{groupName:n,episodeName:o,objective:r=qe.MINIMUM,requireAllAssignments:a,worldNameGenerator:i,keepEmptyWorlds:s,...c}=t,u=L.session;return await(new B).post("/world/assignment/".concat(null!=n?n:null==u?void 0:u.groupName).concat(o?"/".concat(o):""),{body:{assignments:e,objective:r,requireAllAssignments:a,worldNameGenerator:i,keepEmptyWorlds:s},...c}).then((({body:e})=>e))},editAssignments:async function(e,t={}){const{groupName:n,episodeName:o,objective:r=qe.MINIMUM,requireAllAssignments:a,keepEmptyWorlds:i,...s}=t,c=L.session;return await(new B).put("/world/assignment/".concat(null!=n?n:null==c?void 0:c.groupName).concat(o?"/".concat(o):""),{body:{assignments:e,objective:r,requireAllAssignments:a,keepEmptyWorlds:i},...s}).then((({body:e})=>e))},getAssignmentsByKey:async function(e,t={}){return await(new B).get("/world/assignment/".concat(e),t).then((({body:e})=>e))},removeUsers:async function(e,t={}){const{groupName:n,episodeName:o,keepEmptyWorlds:r,...a}=t,i=L.session;return await(new B).withSearchParams({userKey:e,keepEmptyWorlds:Boolean(r)}).delete("/world/assignment/".concat(null!=n?n:null==i?void 0:i.groupName).concat(o?"/".concat(o):""),a).then((({body:e})=>e))},getPersonas:async function(t,n={}){const{scopeBoundary:o,scopeKey:r}=t,a=o||e.SCOPE_BOUNDARY.PROJECT,i=a===e.SCOPE_BOUNDARY.PROJECT?"":"/".concat(r);return await(new B).get("/world/persona/".concat(a.toLowerCase()).concat(i),{...n}).then((({body:e})=>e))},setPersonas:async function(t,n,o={}){const{scopeBoundary:r,scopeKey:a}=n,i=r||e.SCOPE_BOUNDARY.PROJECT,s=i===e.SCOPE_BOUNDARY.PROJECT?"":"/".concat(a);return await(new B).put("/world/persona/".concat(i.toLowerCase()).concat(s),{body:t,...o}).then((({body:e})=>e))},assignRun:async function(e,t,n={}){return await(new B).patch("/world/run/".concat(e),{body:{runKey:t},...n}).then((({body:e})=>e))}});var Ye,Xe=Object.freeze({__proto__:null,get:async function(e={}){return await(new B).get("/time",e).catch((e=>404===e.status?{body:void 0}:Promise.reject(e))).then((({body:e})=>e))}});!function(e){e.DO_NOTHING="DO_NOTHING",e.RESCHEDULE="RESCHEDULE",e.FIRE_ON_FAIL_SAFE="FIRE_ON_FAIL_SAFE"}(Ye||(Ye={}));var Je=Object.freeze({__proto__:null,create:async function(e,t,n,o,r={}){const{retryPolicy:a,failSafeTermination:i,ttlSeconds:s,...c}=r;return await(new B).post("/task",{body:{payload:{objectType:"http",...n},trigger:o,retryPolicy:a,failSafeTermination:i,ttlSeconds:s,scope:e,name:t},...c}).then((({body:e})=>e))},destroy:async function(e,t={}){return await(new B).delete("/task/".concat(e),t).then((({body:e})=>e))},get:async function(e,t={}){return await(new B).get("/task/".concat(e),t).then((({body:e})=>e))},getHistory:async function(e,t={}){return await(new B).get("/task/history/".concat(e),t).then((({body:e})=>e))},getTaskIn:async function(e,t={}){const{scopeBoundary:n,scopeKey:o,userKey:r}=e;return await(new B).get("/task/in/".concat(n,"/").concat(o).concat(r?"/".concat(r):""),t).then((({body:e})=>e))}});var Ze=Object.freeze({__proto__:null,updatePermit:async function(e,t,n={}){return(new B).patch("/chat/".concat(e),{...n,body:{permit:t}}).then((({body:e})=>e))},create:async function(e,t,n,o={}){return(new B).post("/chat",{body:{scope:{scopeBoundary:t.scopeBoundary,scopeKey:t.scopeKey},permit:n,room:e},...o}).then((({body:e})=>e))},get:async function(e,t={}){return(new B).get("/chat/".concat(e),t).then((({body:e})=>e))},query:async function(e,t={}){const{filter:n=[],sort:o=[],first:r=0,max:a}=e,i={filter:n.join(";")||void 0,sort:o.join(";")||void 0,first:r,max:a};return await(new B).withSearchParams(i).get("/chat/search",{paginated:!0,...t}).then((({body:e})=>e))},sendMessage:async function(e,t,n={}){const{userKey:o,...r}=n,a=o?"/".concat(o):"";return(new B).put("/chat/message/".concat(e).concat(a),{body:{message:t},...r}).then((({body:e})=>e))},getMessages:async function(e,t={}){const{maxRecords:n,horizon:o,...r}=t;return(new B).withSearchParams({maxRecords:n,horizon:o}).get("/chat/message/".concat(e),r).then((({body:e})=>e))}});var $e=Object.freeze({__proto__:null,create:async function(e,t,n,o,r,a={}){const{ttlSeconds:i,transparent:s=!1,...c}=a;return await(new B).post("/consensus/".concat(e,"/").concat(t,"/").concat(n),{body:{expectedRoles:o,ttlSeconds:i,transparent:s,actions:r},...c}).then((({body:e})=>e))},load:async function(e,t,n,o={}){return await(new B).get("/consensus/".concat(e,"/").concat(t,"/").concat(n),o).then((({body:e})=>e))},list:async function(e,t,n={}){return await(new B).get("/consensus/".concat(e,"/").concat(t),n).then((({body:e})=>e))},forceClose:async function(e,t,n,o={}){const{ritual:r,...a}=o;return await(new B).post("/consensus/close/".concat(e,"/").concat(t,"/").concat(n),{body:{ritual:r},...a}).then((({body:e})=>e))},updateDefaults:async function(e,t,n,o,r={}){const{...a}=r;return await(new B).patch("/consensus/actions/".concat(e,"/").concat(t,"/").concat(n),{body:{actions:o},...a}).then((({body:e})=>e))},submitActions:async function(e,t,n,o,r={}){const{message:a,ritual:i,...s}=r;return await(new B).post("/consensus/publish/".concat(e,"/").concat(t,"/").concat(n),{body:{ritual:i,actions:o,message:a},...s}).then((({body:e})=>e))},deleteBarrier:async function(e,t,n,o={}){const{...r}=o;return await(new B).delete("/consensus/".concat(e,"/").concat(t,"/").concat(n),{...r}).then((({body:e})=>e))},deleteAll:async function(e,t,n={}){const{...o}=n;return await(new B).delete("/consensus/".concat(e,"/").concat(t),{...o}).then((({body:e})=>e))},undoSubmit:async function(e,t,n,o={}){const{...r}=o;return await(new B).delete("/consensus/arrival/".concat(e,"/").concat(t,"/").concat(n),{...r}).then((({body:e})=>e))},triggerFor:async function(e,t,n,o,r,a={}){const{ritual:i,message:s,...c}=a;return await(new B).post("/consensus/trigger/".concat(e,"/").concat(t,"/").concat(n),{body:{ritual:i,userKey:o,message:s,actions:r},...c}).then((({body:e})=>e))}});var Qe=Object.freeze({__proto__:null,create:async function(e,t={}){const{givenName:n,familyName:o,accountId:r,...a}=t;return await(new B).post("/somebody",{body:{email:e,givenName:n,familyName:o,accountId:r},...a}).then((({body:e})=>e))},query:async function(e,t={}){const{filter:n=[],sort:o=[],first:r=0,max:a,count:i=!1}=e,s={filter:n.join(";")||void 0,sort:o.join(";")||void 0,first:r,max:a,count:i};return await(new B).withSearchParams(s).get("/somebody/search",{paginated:!0,...t}).then((({body:e})=>e))}});var et,tt,nt,ot=Object.freeze({__proto__:null,create:async function(e,t,n,o={}){const{accountShortName:r,projectShortName:a,server:i}=o;return await(new B).withServer(i).withAccountShortName(r).withProjectShortName(a).post("/matchmaker/udome/".concat(e),{body:{scope:n,partners:t}}).then((({body:e})=>e))},edit:async function(e,t,n={}){const{accountShortName:o,projectShortName:r,server:a}=n;return await(new B).withServer(a).withAccountShortName(o).withProjectShortName(r).put("/matchmaker/udome/".concat(e),{body:{closed:t}}).then((({body:e})=>e))},addUser:async function(e,t={}){const{accountShortName:n,projectShortName:o,server:r}=t;return await(new B).withServer(r).withAccountShortName(n).withProjectShortName(o).patch("/matchmaker/udome",{body:{udomeKey:e}}).then((({body:e})=>e))},get:async function(e,t={}){const{accountShortName:n,projectShortName:o,server:r}=t;return await(new B).withServer(r).withAccountShortName(n).withProjectShortName(o).get("/matchmaker/udome/".concat(e)).catch((e=>404===e.status?{body:void 0}:Promise.reject(e))).then((({body:e})=>e))},byName:async function(e,t,n={}){const{accountShortName:o,projectShortName:r,server:a}=n,{scopeBoundary:i,scopeKey:s}=t;return await(new B).withServer(a).withAccountShortName(o).withProjectShortName(r).get("/matchmaker/udome/".concat(i,"/").concat(s,"/").concat(e)).catch((e=>404===e.status?{body:void 0}:Promise.reject(e))).then((({body:e})=>e))}});!function(e){e[e.CLOUD=0]="CLOUD"}(et||(et={})),function(e){e[e.PRIVATE=0]="PRIVATE"}(tt||(tt={})),function(e){e[e.HLS=0]="HLS"}(nt||(nt={}));const rt=[[6e3,1e4],[11e3,2e4],[3e4,45e3]];async function at(e,t=0){let n;try{n=await e()}catch(r){if(!(r instanceof u&&429===r.status&&t<=rt.length))throw r;{const[r,a]=rt[t];await(o=((e,t)=>e+Math.random()*(t-e))(r,a),new Promise((e=>setTimeout(e,o)))),n=await at(e,t+1)}}var o;return n}var it=Object.freeze({__proto__:null,getConfig:async function(e={}){return await(new B).get("/daily/v1",e).then((({body:e})=>e))},createRoom:async function(t,n={}){const{readLock:o,writeLock:r,ttlSeconds:a,privacy:i,exp:s,enable_recording:c,streaming_endpoints:u,disableRateLimitHandling:l,...h}=n,{PARTICIPANT:d}=e.ROLE;return at((async()=>await(new B).post("/daily/v1/room",{body:{epicenter:{ttlSeconds:a,scope:t,permit:{readLock:o||d,writeLock:r||d}},properties:{exp:s,enable_recording:c,streaming_endpoints:u},privacy:i},...h}).then((({body:e})=>e))),l?rt.length+1:0)},createToken:async function(e,t={}){const{start_video_off:n,is_owner:o,user_name:r,close_tab_on_exit:a,exp:i,enable_recording:s,disableRateLimitHandling:c,...u}=t;return at((async()=>await(new B).post("/daily/v1/meetingToken",{body:{properties:{room_name:e,start_video_off:n,is_owner:o,user_name:r,close_tab_on_exit:a,exp:i,enable_recording:s}},...u}).then((({body:e})=>e))),c?rt.length+1:0)},getVideoByRecordingId:async function(e,t,n,o={}){const r=(await je({scope:n,affiliate:"DAILY",family:e,...o})).contents;if(null==r||!r.length)return null;r.sort(((e,t)=>Number(t.split(".")[0])-Number(e.split(".")[0])));const a=r.find((e=>e.includes(t)&&e.includes(".mp4")));return a?await Le(a,{scope:n,affiliate:"DAILY",family:e,...o}):null},updateRecordingStatus:async function(e,t={}){return await(new B).delete("/daily/v1/meetingToken/".concat(e),t).then((({body:e})=>e))}});var st=Object.freeze({__proto__:null,proxy:async(e,t)=>{const{accountShortName:n,projectShortName:o,isLocal:r}=O;let a=N("/",e);return r()||(a="/proxy/".concat(n,"/").concat(o).concat(a)),s(a,t)}});const ct="Epicenter (v".concat("3.23.1",") for Browsers | Build Date: 2023-07-20T21:39:23.842Z");j.registerHandler((e=>"COMETD_RECONNECTED"===e.code),(async e=>{A()&&console.warn('Cometd Reconnected. If you wish to react to this reconnection, register an error handler with identifier: error.code === "COMETD_RECONNECTED".',e)})),j.registerHandler((e=>403===e.status&&"COMETD_ERROR"===e.code),(async(e,t)=>(console.warn("Cometd error. Attempting to reconnect.",e),await J.disconnect(),await t()))),j.registerHandler((e=>401===e.status&&"AUTHENTICATION_EXPIRED"===e.code),(async e=>{throw await Z(),A()&&alert("Session token has expired, try logging in again."),e})),j.registerHandler((e=>401===e.status&&"AUTHENTICATION_GROUP_EXPIRED"===e.code),(async e=>{throw A()&&alert("This group has expired. Try logging into a different group"),e})),j.registerHandler((e=>401===e.status&&"AUTHENTICATION_INVALIDATED"===e.code),(async(e,t)=>{try{var n;const e=L.session;if("admin"===(null==e?void 0:e.objectType))throw new c("Unhandled error: admin session was somehow invalidated");const o=null!==(n=null==e?void 0:e.groupKey)&&void 0!==n?n:"";return await $(o,{objectType:"user",inert:!0}),await t()}catch(t){throw await Z(),e}}));var ut=r((function(e,t){e.exports=function(){var e=function(){var e=0,t={};this.register=function(n){var o=++e;return t[o]=n,o},this.unregister=function(e){var n=t[e];return delete t[e],n},this.setTimeout=function(e,t){return window.setTimeout(e,t)},this.clearTimeout=function(e){window.clearTimeout(e)}};function t(){var e={};self.onmessage=function(t){var n=t.data,o=e[n.id];switch(n.type){case"setTimeout":e[n.id]=self.setTimeout((function(){delete e[n.id],self.postMessage({id:n.id})}),n.delay);break;case"clearTimeout":delete e[n.id],o&&self.clearTimeout(o);break;default:throw"Unknown command "+n.type}}}var n={isString:function(e){return null!=e&&("string"==typeof e||e instanceof String)},isArray:function(e){return null!=e&&e instanceof Array},inArray:function(e,t){for(var n=0;n<t.length;++n)if(e===t[n])return n;return-1}},o=function(){var e=[],t={};this.getTransportTypes=function(){return e.slice(0)},this.findTransportTypes=function(n,o,r){for(var a=[],i=0;i<e.length;++i){var s=e[i];!0===t[s].accept(n,o,r)&&a.push(s)}return a},this.negotiateTransport=function(n,o,r,a){for(var i=0;i<e.length;++i)for(var s=e[i],c=0;c<n.length;++c)if(s===n[c]){var u=t[s];if(!0===u.accept(o,r,a))return u}return null},this.add=function(n,o,r){for(var a=!1,i=0;i<e.length;++i)if(e[i]===n){a=!0;break}return a||("number"!=typeof r?e.push(n):e.splice(r,0,n),t[n]=o),!a},this.find=function(n){for(var o=0;o<e.length;++o)if(e[o]===n)return t[n];return null},this.remove=function(n){for(var o=0;o<e.length;++o)if(e[o]===n){e.splice(o,1);var r=t[n];return delete t[n],r}return null},this.clear=function(){e=[],t={}},this.reset=function(n){for(var o=0;o<e.length;++o)t[e[o]].reset(n)}},r=function(){var e,t,o;this.registered=function(n,o){e=n,t=o},this.unregistered=function(){e=null,t=null},this._debug=function(){t._debug.apply(t,arguments)},this._mixin=function(){return t._mixin.apply(t,arguments)},this.getConfiguration=function(){return t.getConfiguration()},this.getAdvice=function(){return t.getAdvice()},this.setTimeout=function(e,n){return t.setTimeout(e,n)},this.clearTimeout=function(e){t.clearTimeout(e)},this.convertToMessages=function(e){if(n.isString(e))try{return JSON.parse(e)}catch(t){throw this._debug("Could not convert to JSON the following string",'"'+e+'"'),t}if(n.isArray(e))return e;if(null==e)return[];if(e instanceof Object)return[e];throw"Conversion Error "+e+", typeof "+typeof e},this.accept=function(e,t,n){throw"Abstract"},this.getType=function(){return e},this.getURL=function(){return o},this.setURL=function(e){o=e},this.send=function(e,t){throw"Abstract"},this.reset=function(t){this._debug("Transport",e,"reset",t?"initial":"retry")},this.abort=function(){this._debug("Transport",e,"aborted")},this.toString=function(){return this.getType()}};r.derive=function(e){function t(){}return t.prototype=e,new t};var a=function(){var e=new r,t=r.derive(e),o=0,a=null,i=[],s=[];function c(e){for(;s.length>0;){var t=s[0],n=t[0],o=t[1];if(n.url!==e.url||n.sync!==e.sync)break;s.shift(),e.messages=e.messages.concat(n.messages),this._debug("Coalesced",n.messages.length,"messages from request",o.id)}}function u(e,t){if(this.transportSend(e,t),t.expired=!1,!e.sync){var n=this.getConfiguration().maxNetworkDelay,o=n;!0===t.metaConnect&&(o+=this.getAdvice().timeout),this._debug("Transport",this.getType(),"waiting at most",o,"ms for the response, maxNetworkDelay",n);var r=this;t.timeout=this.setTimeout((function(){t.expired=!0;var n="Request "+t.id+" of transport "+r.getType()+" exceeded "+o+" ms max network delay",a={reason:n},i=t.xhr;a.httpCode=r.xhrStatus(i),r.abortXHR(i),r._debug(n),r.complete(t,!1,t.metaConnect),e.onFailure(i,e.messages,a)}),o)}}function l(e){var t=++o,n={id:t,metaConnect:!1,envelope:e};i.length<this.getConfiguration().maxConnections-1?(i.push(n),u.call(this,e,n)):(this._debug("Transport",this.getType(),"queueing request",t,"envelope",e),s.push([e,n]))}function h(e){var t=e.id;if(this._debug("Transport",this.getType(),"/meta/connect complete, request",t),null!==a&&a.id!==t)throw"/meta/connect request mismatch, completing request "+t;a=null}function d(e,t){var o=n.inArray(e,i);if(o>=0&&i.splice(o,1),s.length>0){var r=s.shift(),a=r[0],u=r[1];if(this._debug("Transport dequeued request",u.id),t)this.getConfiguration().autoBatch&&c.call(this,a),l.call(this,a),this._debug("Transport completed request",e.id,a);else{var h=this;this.setTimeout((function(){h.complete(u,!1,u.metaConnect);var e={reason:"Previous request failed"},t=u.xhr;e.httpCode=h.xhrStatus(t),a.onFailure(t,a.messages,e)}),0)}}}function p(e){if(null!==a)throw"Concurrent /meta/connect requests not allowed, request id="+a.id+" not yet completed";var t=++o;this._debug("Transport",this.getType(),"/meta/connect send, request",t,"envelope",e);var n={id:t,metaConnect:!0,envelope:e};u.call(this,e,n),a=n}return t.complete=function(e,t,n){n?h.call(this,e):d.call(this,e,t)},t.transportSend=function(e,t){throw"Abstract"},t.transportSuccess=function(e,t,n){t.expired||(this.clearTimeout(t.timeout),this.complete(t,!0,t.metaConnect),n&&n.length>0?e.onSuccess(n):e.onFailure(t.xhr,e.messages,{httpCode:204}))},t.transportFailure=function(e,t,n){t.expired||(this.clearTimeout(t.timeout),this.complete(t,!1,t.metaConnect),e.onFailure(t.xhr,e.messages,n))},t.send=function(e,t){t?p.call(this,e):l.call(this,e)},t.abort=function(){e.abort();for(var t=0;t<i.length;++t){var n=i[t];n&&(this._debug("Aborting request",n),this.abortXHR(n.xhr)||this.transportFailure(n.envelope,n,{reason:"abort"}))}var o=a;o&&(this._debug("Aborting /meta/connect request",o),this.abortXHR(o.xhr)||this.transportFailure(o.envelope,o,{reason:"abort"})),this.reset(!0)},t.reset=function(t){e.reset(t),a=null,i=[],s=[]},t.abortXHR=function(e){if(e)try{var t=e.readyState;return e.abort(),t!==window.XMLHttpRequest.UNSENT}catch(e){this._debug(e)}return!1},t.xhrStatus=function(e){if(e)try{return e.status}catch(e){this._debug(e)}return-1},t},i=function(){var e=new a,t=r.derive(e),n=!0;function o(e){try{e.context=t.context}catch(e){this._debug("Could not copy transport context into XHR",e)}}return t.accept=function(e,t,o){return n||!t},t.newXMLHttpRequest=function(){return new window.XMLHttpRequest},t.xhrSend=function(e){var n=t.newXMLHttpRequest();o(n),n.withCredentials=!0,n.open("POST",e.url,!0!==e.sync);var r=e.headers;if(r)for(var a in r)r.hasOwnProperty(a)&&n.setRequestHeader(a,r[a]);return n.setRequestHeader("Content-Type","application/json;charset=UTF-8"),n.onload=function(){200===n.status?e.onSuccess(n.responseText):e.onError(n.statusText)},n.onabort=n.onerror=function(){e.onError(n.statusText)},n.send(e.body),n},t.transportSend=function(e,t){this._debug("Transport",this.getType(),"sending request",t.id,"envelope",e);var o=this;try{var r=!0;t.xhr=this.xhrSend({transport:this,url:e.url,sync:e.sync,headers:this.getConfiguration().requestHeaders,body:JSON.stringify(e.messages),onSuccess:function(r){o._debug("Transport",o.getType(),"received response",r);var a=!1;try{var i=o.convertToMessages(r);0===i.length?(n=!1,o.transportFailure(e,t,{httpCode:204})):(a=!0,o.transportSuccess(e,t,i))}catch(r){if(o._debug(r),!a){n=!1;var s={exception:r};s.httpCode=o.xhrStatus(t.xhr),o.transportFailure(e,t,s)}}},onError:function(a,i){o._debug("Transport",o.getType(),"received error",a,i),n=!1;var s={reason:a,exception:i};s.httpCode=o.xhrStatus(t.xhr),r?o.setTimeout((function(){o.transportFailure(e,t,s)}),0):o.transportFailure(e,t,s)}}),r=!1}catch(r){n=!1,this.setTimeout((function(){o.transportFailure(e,t,{exception:r})}),0)}},t.reset=function(t){e.reset(t),n=!0},t},s=function(){var e=new a,t=r.derive(e),n=0;function o(e,t,n){var o=this;return function(){o.transportFailure(e,t,"error",n)}}return t.accept=function(e,t,n){return!0},t.jsonpSend=function(e){var t=document.getElementsByTagName("head")[0],o=document.createElement("script"),r="_cometd_jsonp_"+n++;window[r]=function(n){t.removeChild(o),delete window[r],e.onSuccess(n)};var a=e.url;a+=a.indexOf("?")<0?"?":"&",a+="jsonp="+r,a+="&message="+encodeURIComponent(e.body),o.src=a,o.async=!0!==e.sync,o.type="application/javascript",o.onerror=function(t){e.onError("jsonp "+t.type)},t.appendChild(o)},t.transportSend=function(e,t){for(var n=this,r=0,a=e.messages.length,i=[];a>0;){var s=JSON.stringify(e.messages.slice(r,r+a)),c=e.url.length+encodeURI(s).length,u=this.getConfiguration().maxURILength;if(c>u){if(1===a){var l="Bayeux message too big ("+c+" bytes, max is "+u+") for transport "+this.getType();return void this.setTimeout(o.call(this,e,t,l),0)}--a}else i.push(a),r+=a,a=e.messages.length-r}var h=e;if(i.length>1){var d=0,p=i[0];this._debug("Transport",this.getType(),"split",e.messages.length,"messages into",i.join(" + ")),(h=this._mixin(!1,{},e)).messages=e.messages.slice(d,p),h.onSuccess=e.onSuccess,h.onFailure=e.onFailure;for(var f=1;f<i.length;++f){var y=this._mixin(!1,{},e);d=p,p+=i[f],y.messages=e.messages.slice(d,p),y.onSuccess=e.onSuccess,y.onFailure=e.onFailure,this.send(y,t.metaConnect)}}this._debug("Transport",this.getType(),"sending request",t.id,"envelope",h);try{var m=!0;this.jsonpSend({transport:this,url:h.url,sync:h.sync,headers:this.getConfiguration().requestHeaders,body:JSON.stringify(h.messages),onSuccess:function(e){var o=!1;try{var r=n.convertToMessages(e);0===r.length?n.transportFailure(h,t,{httpCode:204}):(o=!0,n.transportSuccess(h,t,r))}catch(e){n._debug(e),o||n.transportFailure(h,t,{exception:e})}},onError:function(e,o){var r={reason:e,exception:o};m?n.setTimeout((function(){n.transportFailure(h,t,r)}),0):n.transportFailure(h,t,r)}}),m=!1}catch(e){this.setTimeout((function(){n.transportFailure(h,t,{exception:e})}),0)}},t},c=function(){var e,t=new r,o=r.derive(t),a=!0,i=!1,s=!0,c=null,u=null,l=!1,h=null;function d(e,t){e&&(this.webSocketClose(e,t.code,t.reason),this.onClose(e,t))}function p(e){return e===u||e===c}function f(e,t,n){for(var o=[],r=0;r<t.messages.length;++r){var a=t.messages[r];a.id&&o.push(a.id)}e.envelopes[o.join(",")]=[t,n],this._debug("Transport",this.getType(),"stored envelope, envelopes",e.envelopes)}function y(t){if(!u){var n=e.getURL().replace(/^http/,"ws");this._debug("Transport",this.getType(),"connecting to URL",n);try{var o=e.getConfiguration().protocol;t.webSocket=o?new window.WebSocket(n,o):new window.WebSocket(n),u=t}catch(e){throw a=!1,this._debug("Exception while creating WebSocket object",e),e}s=!1!==e.getConfiguration().stickyReconnect;var r=this,l=e.getConfiguration().connectTimeout;l>0&&(t.connectTimer=this.setTimeout((function(){e._debug("Transport",r.getType(),"timed out while connecting to URL",n,":",l,"ms"),d.call(r,t,{code:1e3,reason:"Connect Timeout"})}),l));var h=function(){e._debug("WebSocket onopen",t),t.connectTimer&&r.clearTimeout(t.connectTimer),p(t)?(u=null,c=t,i=!0,r.onOpen(t)):(e._warn("Closing extra WebSocket connection",this,"active connection",c),d.call(r,t,{code:1e3,reason:"Extra Connection"}))},f=function(n){n=n||{code:1e3},e._debug("WebSocket onclose",t,n,"connecting",u,"current",c),t.connectTimer&&r.clearTimeout(t.connectTimer),r.onClose(t,n)},y=function(n){e._debug("WebSocket onmessage",n,t),r.onMessage(t,n)};t.webSocket.onopen=h,t.webSocket.onclose=f,t.webSocket.onerror=function(){f({code:1e3,reason:"Error"})},t.webSocket.onmessage=y,this._debug("Transport",this.getType(),"configured callbacks on",t)}}function m(t,n,o){var r=JSON.stringify(n.messages);t.webSocket.send(r),this._debug("Transport",this.getType(),"sent",n,"/meta/connect =",o);var a=this.getConfiguration().maxNetworkDelay,i=a;o&&(i+=this.getAdvice().timeout,l=!0);for(var s=this,c=[],u=0;u<n.messages.length;++u)!function(){var o=n.messages[u];o.id&&(c.push(o.id),t.timeouts[o.id]=s.setTimeout((function(){e._debug("Transport",s.getType(),"timing out message",o.id,"after",i,"on",t),d.call(s,t,{code:1e3,reason:"Message Timeout"})}),i))}();this._debug("Transport",this.getType(),"waiting at most",i,"ms for messages",c,"maxNetworkDelay",a,", timeouts:",t.timeouts)}function g(e,t,n){try{null===e?(e=u||{envelopes:{},timeouts:{}},f.call(this,e,t,n),y.call(this,e)):(f.call(this,e,t,n),m.call(this,e,t,n))}catch(t){var o=this;this.setTimeout((function(){d.call(o,e,{code:1e3,reason:"Exception",exception:t})}),0)}}return o.reset=function(e){t.reset(e),a=!0,e&&(i=!1),s=!0,c=null,u=null,l=!1},o._notifySuccess=function(e,t){e.call(this,t)},o._notifyFailure=function(e,t,n,o){e.call(this,t,n,o)},o.onOpen=function(e){var t=e.envelopes;for(var n in this._debug("Transport",this.getType(),"opened",e,"pending messages",t),t)if(t.hasOwnProperty(n)){var o=t[n],r=o[0],a=o[1];h=r.onSuccess,m.call(this,e,r,a)}},o.onMessage=function(e,t){this._debug("Transport",this.getType(),"received websocket message",t,e);for(var o=!1,r=this.convertToMessages(t.data),a=[],i=0;i<r.length;++i){var s=r[i];if((/^\/meta\//.test(s.channel)||void 0===s.data)&&s.id){a.push(s.id);var c=e.timeouts[s.id];c&&(this.clearTimeout(c),delete e.timeouts[s.id],this._debug("Transport",this.getType(),"removed timeout for message",s.id,", timeouts",e.timeouts))}"/meta/connect"===s.channel&&(l=!1),"/meta/disconnect"!==s.channel||l||(o=!0)}for(var u=!1,d=e.envelopes,p=0;p<a.length;++p){var f=a[p];for(var y in d)if(d.hasOwnProperty(y)){var m=y.split(","),g=n.inArray(f,m);if(g>=0){u=!0,m.splice(g,1);var w=d[y][0],b=d[y][1];delete d[y],m.length>0&&(d[m.join(",")]=[w,b]);break}}}u&&this._debug("Transport",this.getType(),"removed envelope, envelopes",d),this._notifySuccess(h,r),o&&this.webSocketClose(e,1e3,"Disconnect")},o.onClose=function(e,t){this._debug("Transport",this.getType(),"closed",e,t),p(e)&&(a=s&&i,u=null,c=null);var n=e.timeouts;for(var o in e.timeouts={},n)n.hasOwnProperty(o)&&this.clearTimeout(n[o]);var r=e.envelopes;for(var h in e.envelopes={},r)if(r.hasOwnProperty(h)){var d=r[h][0];r[h][1]&&(l=!1);var f={websocketCode:t.code,reason:t.reason};t.exception&&(f.exception=t.exception),this._notifyFailure(d.onFailure,e,d.messages,f)}},o.registered=function(n,o){t.registered(n,o),e=o},o.accept=function(t,n,o){return this._debug("Transport",this.getType(),"accept, supported:",a),a&&!!window.WebSocket&&!1!==e.websocketEnabled},o.send=function(e,t){this._debug("Transport",this.getType(),"sending",e,"/meta/connect =",t),g.call(this,c,e,t)},o.webSocketClose=function(e,t,n){try{e.webSocket&&e.webSocket.close(t,n)}catch(e){this._debug(e)}},o.abort=function(){t.abort(),d.call(this,c,{code:1e3,reason:"Abort"}),this.reset(!0)},o},u=function(r){var a,u,l,h,d,p=new e,f=this,y=r||"default",m=!1,g=new o,w="disconnected",b=0,v=null,S=0,_=[],T=!1,E=0,x={},A=0,R=null,N=[],O={},P={},k={},I=!1,C=!1,L=0,j=0,U=null,D={useWorkerScheduler:!0,protocol:null,stickyReconnect:!0,connectTimeout:0,maxConnections:2,backoffIncrement:1e3,maxBackoff:6e4,logLevel:"info",maxNetworkDelay:1e4,requestHeaders:{},appendMessageTypeToURL:!0,autoBatch:!1,urls:{},maxURILength:2e3,advice:{timeout:6e4,interval:0,reconnect:void 0,maxInterval:0}};function B(e,t){try{return e[t]}catch(e){return}}function K(e){return n.isString(e)}function M(e){return null!=e&&"function"==typeof e}function z(e,t){for(var n="";--t>0&&!(e>=Math.pow(10,t));)n+="0";return n+=e}function F(e,t){if(window.console){var n=window.console[e];if(M(n)){var o=new Date;[].splice.call(t,0,0,z(o.getHours(),2)+":"+z(o.getMinutes(),2)+":"+z(o.getSeconds(),2)+"."+z(o.getMilliseconds(),3)),n.apply(window.console,t)}}}function q(e){return new RegExp("(^https?://)?(((\\[[^\\]]+])|([^:/?#]+))(:(\\d+))?)?([^?#]*)(.*)?").exec(e)}function H(e){f._debug("Configuring cometd object with",e),K(e)&&(e={url:e}),e||(e={}),D=f._mixin(!1,D,e);var n=f.getURL();if(!n)throw"Missing required configuration parameter 'url' specifying the Bayeux server URL";var o=q(n),r=o[2],a=o[8],i=o[9];if(m=f._isCrossDomain(r),D.appendMessageTypeToURL)if(void 0!==i&&i.length>0)f._info("Appending message type to URI "+a+i+" is not supported, disabling 'appendMessageTypeToURL' configuration"),D.appendMessageTypeToURL=!1;else{var s=a.split("/"),c=s.length-1;a.match(/\/$/)&&(c-=1),s[c].indexOf(".")>=0&&(f._info("Appending message type to URI "+a+" is not supported, disabling 'appendMessageTypeToURL' configuration"),D.appendMessageTypeToURL=!1)}if(window.Worker&&window.Blob&&window.URL&&D.useWorkerScheduler){var u=t.toString();u=u.substring(u.indexOf("{")+1,u.lastIndexOf("}"));var l=new window.Blob([u],{type:"application/json"}),h=window.URL.createObjectURL(l),d=new window.Worker(h);p.setTimeout=function(e,t){var n=p.register(e);return d.postMessage({id:n,type:"setTimeout",delay:t}),n},p.clearTimeout=function(e){p.unregister(e),d.postMessage({id:e,type:"clearTimeout"})},d.onmessage=function(e){var t=e.data.id,n=p.unregister(t);n&&n()}}}function G(e){if(e){var t=x[e.channel];t&&t[e.id]&&(delete t[e.id],f._debug("Removed",e.listener?"listener":"subscription",e))}}function W(e){e&&!e.listener&&G(e)}function V(){for(var e in x)if(x.hasOwnProperty(e)){var t=x[e];if(t)for(var n in t)t.hasOwnProperty(n)&&W(t[n])}}function Y(e){w!==e&&(f._debug("Status",w,"->",e),w=e)}function X(){return"disconnecting"===w||"disconnected"===w}function J(){return""+ ++b}function Z(e,t,n,o,r){try{return t.call(e,o)}catch(e){var a=f.onExtensionException;if(M(a)){f._debug("Invoking extension exception handler",n,e);try{a.call(f,e,n,r,o)}catch(e){f._info("Exception during execution of extension exception handler",n,e)}}else f._info("Exception during execution of extension",n,e);return o}}function $(e){for(var t=0;t<N.length&&null!=e;++t){var n=N[t],o=n.extension.incoming;if(M(o)){var r=Z(n.extension,o,n.name,e,!1);e=void 0===r?e:r}}return e}function Q(e){for(var t=N.length-1;t>=0&&null!=e;--t){var n=N[t],o=n.extension.outgoing;if(M(o)){var r=Z(n.extension,o,n.name,e,!0);e=void 0===r?e:r}}return e}function ee(e,t){var n=x[e];if(n)for(var o in n)if(n.hasOwnProperty(o)){var r=n[o];if(r)try{r.callback.call(r.scope,t)}catch(e){var a=f.onListenerException;if(M(a)){f._debug("Invoking listener exception handler",r,e);try{a.call(f,e,r,r.listener,t)}catch(e){f._info("Exception during execution of listener exception handler",r,e)}}else f._info("Exception during execution of listener",r,t,e)}}}function te(e,t){ee(e,t);for(var n=e.split("/"),o=n.length-1,r=o;r>0;--r){var a=n.slice(0,r).join("/")+"/*";r===o&&ee(a,t),ee(a+="*",t)}}function ne(){null!==R&&f.clearTimeout(R),R=null}function oe(e,t){ne();var n=O.interval+t;f._debug("Function scheduled in",n,"ms, interval =",O.interval,"backoff =",A,e),R=f.setTimeout(e,n)}function re(e,t,n){for(var o=0;o<e.length;++o){var r=e[o],i=r.id;v&&(r.clientId=v),null!=(r=Q(r))?(r.id=i,e[o]=r):(delete P[i],e.splice(o--,1))}if(0!==e.length){t&&(U=e[0]);var s=f.getURL();D.appendMessageTypeToURL&&(s.match(/\/$/)||(s+="/"),n&&(s+=n));var c={url:s,sync:!1,messages:e,onSuccess:function(e){try{h.call(f,e)}catch(e){f._info("Exception during handling of messages",e)}},onFailure:function(e,t,n){try{var o=f.getTransport();n.connectionType=o?o.getType():"unknown",d.call(f,e,t,n)}catch(e){f._info("Exception during handling of failure",e)}}};f._debug("Send",c),a.send(c,t)}}function ae(e){S>0||!0===T?_.push(e):re([e],!1)}function ie(){A=0}function se(){return A<D.maxBackoff&&(A+=D.backoffIncrement),A}function ce(){++S,f._debug("Starting batch, depth",S)}function ue(){var e=_;_=[],e.length>0&&re(e,!1)}function le(){if(--S,f._debug("Ending batch, depth",S),S<0)throw"Calls to startBatch() and endBatch() are not paired";0!==S||X()||T||ue()}function he(){if(!X()){var e={id:J(),channel:"/meta/connect",connectionType:a.getType()};C||(e.advice={timeout:0}),Y("connecting"),f._debug("Connect sent",e),re([e],!0,"connect"),Y("connected")}}function de(e){Y("connecting"),oe((function(){he()}),e)}function pe(e){e&&(O=f._mixin(!1,{},D.advice,e),f._debug("New advice",O))}function fe(e){if(ne(),e&&a&&a.abort(),m=!1,a=null,Y("disconnected"),v=null,S=0,ie(),I=!1,C=!1,L=0,U=null,_.length>0){var t=_;_=[],d.call(f,void 0,t,{reason:"Disconnected"})}}function ye(e,t,n){var o=f.onTransportException;if(M(o)){f._debug("Invoking transport exception handler",e,t,n);try{o.call(f,n,e,t)}catch(e){f._info("Exception during execution of transport exception handler",e)}}}function me(e,t){M(e)&&(t=e,e=void 0),v=null,V(),X()&&g.reset(!0),pe({}),S=0,T=!0,u=e,l=t;var n="1.0",o=f.getURL(),r=g.findTransportTypes(n,m,o),i={id:J(),version:n,minimumVersion:n,channel:"/meta/handshake",supportedConnectionTypes:r,advice:{timeout:O.timeout,interval:O.interval}},s=f._mixin(!1,{},u,i);if(f._putCallback(s.id,t),!a&&!(a=g.negotiateTransport(r,n,m,o))){var c="Could not find initial transport among: "+g.getTransportTypes();throw f._warn(c),c}f._debug("Initial transport is",a.getType()),Y("handshaking"),f._debug("Handshake sent",s),re([s],!1,"handshake")}function ge(e){Y("handshaking"),T=!0,oe((function(){me(u,l)}),e)}function we(e,t){try{e.call(f,t)}catch(e){var n=f.onCallbackException;if(M(n)){f._debug("Invoking callback exception handler",e);try{n.call(f,e,t)}catch(e){f._info("Exception during execution of callback exception handler",e)}}else f._info("Exception during execution of message callback",e)}}function be(e){var t=f._getCallback([e.id]);M(t)&&(delete P[e.id],we(t,e))}function ve(e){var t=k[e.id];if(delete k[e.id],t){f._debug("Handling remote call response for",e,"with context",t);var n=t.timeout;n&&f.clearTimeout(n);var o=t.callback;if(M(o))return we(o,e),!0}return!1}function Se(e){f._debug("Transport failure handling",e),e.transport&&(a=e.transport),e.url&&a.setURL(e.url);var t=e.action,n=e.delay||0;switch(t){case"handshake":ge(n);break;case"retry":de(n);break;case"none":fe(!0);break;default:throw"Unknown action "+t}}function _e(e,t){be(e),te("/meta/handshake",e),te("/meta/unsuccessful",e),X()&&(t.action="none"),f.onTransportFailure.call(f,e,t,Se)}function Te(e){var t=f.getURL();if(e.successful){var n=f._isCrossDomain(q(t)[2]),o=g.negotiateTransport(e.supportedConnectionTypes,e.version,n,t);if(null===o)return e.successful=!1,void _e(e,{cause:"negotiation",action:"none",transport:null});a!==o&&(f._debug("Transport",a.getType(),"->",o.getType()),a=o),v=e.clientId,T=!1,ue(),e.reestablish=I,I=!0,be(e),te("/meta/handshake",e),j=e["x-messages"]||0;var r=X()?"none":O.reconnect||"retry";switch(r){case"retry":ie(),0===j?de(0):f._debug("Processing",j,"handshake-delivered messages");break;case"none":fe(!0);break;default:throw"Unrecognized advice action "+r}}else _e(e,{cause:"unsuccessful",action:O.reconnect||"handshake",transport:a})}function Ee(e){_e(e,{cause:"failure",action:"handshake",transport:null})}function xe(e){return"disconnected"===w||!(!U||U.id!==e.id)&&(U=null,!0)}function Ae(e,t){te("/meta/connect",e),te("/meta/unsuccessful",e),X()&&(t.action="none"),f.onTransportFailure.call(f,e,t,Se)}function Re(e){if(xe(e))if(C=e.successful){te("/meta/connect",e);var t=X()?"none":O.reconnect||"retry";switch(t){case"retry":ie(),de(A);break;case"none":fe(!1);break;default:throw"Unrecognized advice action "+t}}else Ae(e,{cause:"unsuccessful",action:O.reconnect||"retry",transport:a});else f._debug("Mismatched /meta/connect reply",e)}function Ne(e){xe(e)?(C=!1,Ae(e,{cause:"failure",action:"retry",transport:null})):f._debug("Mismatched /meta/connect failure",e)}function Oe(e){fe(!0),be(e),te("/meta/disconnect",e),te("/meta/unsuccessful",e)}function Pe(e){e.successful?(fe(!1),be(e),te("/meta/disconnect",e)):Oe(e)}function ke(e){Oe(e)}function Ie(e){var t=x[e.subscription];if(t)for(var n in t)if(t.hasOwnProperty(n)){var o=t[n];o&&!o.listener&&(delete t[n],f._debug("Removed failed subscription",o))}be(e),te("/meta/subscribe",e),te("/meta/unsuccessful",e)}function Ce(e){e.successful?(be(e),te("/meta/subscribe",e)):Ie(e)}function Le(e){Ie(e)}function je(e){be(e),te("/meta/unsubscribe",e),te("/meta/unsuccessful",e)}function Ue(e){e.successful?(be(e),te("/meta/unsubscribe",e)):je(e)}function De(e){je(e)}function Be(e){ve(e)||(be(e),te("/meta/publish",e),te("/meta/unsuccessful",e))}function Ke(e){void 0!==e.data?ve(e)||(te(e.channel,e),j>0&&0==--j&&(f._debug("Processed last handshake-delivered message"),de(0))):void 0===e.successful?f._warn("Unknown Bayeux Message",e):e.successful?(be(e),te("/meta/publish",e)):Be(e)}function Me(e){Be(e)}function ze(e){if(L=0,null!=(e=$(e)))switch(pe(e.advice),e.channel){case"/meta/handshake":Te(e);break;case"/meta/connect":Re(e);break;case"/meta/disconnect":Pe(e);break;case"/meta/subscribe":Ce(e);break;case"/meta/unsubscribe":Ue(e);break;default:Ke(e)}}function Fe(e){var t=x[e];if(t)for(var n in t)if(t.hasOwnProperty(n)&&t[n])return!0;return!1}function qe(e,t){var n={scope:e,method:t};if(M(e))n.scope=void 0,n.method=e;else if(K(t)){if(!e)throw"Invalid scope "+e;if(n.method=e[t],!M(n.method))throw"Invalid callback "+t+" for scope "+e}else if(!M(t))throw"Invalid callback "+t;return n}function He(e,t,n,o){var r=qe(t,n);f._debug("Adding",o?"listener":"subscription","on",e,"with scope",r.scope,"and callback",r.method);var a=++E,i={id:a,channel:e,scope:r.scope,callback:r.method,listener:o},s=x[e];return s||(s={},x[e]=s),s[a]=i,f._debug("Added",o?"listener":"subscription",i),i}this._mixin=function(e,t,n){for(var o=t||{},r=2;r<arguments.length;++r){var a=arguments[r];if(null!=a)for(var i in a)if(a.hasOwnProperty(i)){var s=B(a,i),c=B(o,i);if(s===t)continue;if(void 0===s)continue;if(e&&"object"==typeof s&&null!==s)if(s instanceof Array)o[i]=this._mixin(e,c instanceof Array?c:[],s);else{var u="object"!=typeof c||c instanceof Array?{}:c;o[i]=this._mixin(e,u,s)}else o[i]=s}}return o},this._warn=function(){F("warn",arguments)},this._info=function(){"warn"!==D.logLevel&&F("info",arguments)},this._debug=function(){"debug"===D.logLevel&&F("debug",arguments)},this._isCrossDomain=function(e){return!!(window.location&&window.location.host&&e)&&e!==window.location.host},this.send=ae,this._getCallback=function(e){return P[e]},this._putCallback=function(e,t){var n=this._getCallback(e);return M(t)&&(P[e]=t),n},this.onTransportFailure=function(e,t,n){this._debug("Transport failure",t,"for",e);var o=this.getTransportRegistry(),r=this.getURL(),i=this._isCrossDomain(q(r)[2]),s="1.0",c=o.findTransportTypes(s,i,r);if("none"===t.action){if("/meta/handshake"===e.channel&&!t.transport){var u="Could not negotiate transport, client=["+c+"], server=["+e.supportedConnectionTypes+"]";this._warn(u),ye(a.getType(),null,{reason:u,connectionType:a.getType(),transport:a})}}else if(t.delay=this.getBackoffPeriod(),"/meta/handshake"===e.channel){if(!t.transport){var l=a?a.getType():null,h=o.negotiateTransport(c,s,i,r);if(h){var d=h.getType();this._debug("Transport",l,"->",d),ye(l,d,e.failure),t.action="handshake",t.transport=h}else this._warn("Could not negotiate transport, client=["+c+"]"),ye(l,null,e.failure),t.action="none"}"none"!==t.action&&this.increaseBackoffPeriod()}else{var p=(new Date).getTime();if(0===L&&(L=p),"retry"===t.action){t.delay=this.increaseBackoffPeriod();var y=O.maxInterval;if(y>0){var m=O.timeout+O.interval+y;p-L+A>m&&(t.action="handshake")}}"handshake"===t.action&&(t.delay=0,o.reset(!1),this.resetBackoffPeriod())}n.call(f,t)},this.receive=ze,h=function(e){f._debug("Received",e);for(var t=0;t<e.length;++t)ze(e[t])},d=function(e,t,n){f._debug("handleFailure",e,t,n),n.transport=e;for(var o=0;o<t.length;++o){var r=t[o],a={id:r.id,successful:!1,channel:r.channel,failure:n};switch(n.message=r,r.channel){case"/meta/handshake":Ee(a);break;case"/meta/connect":Ne(a);break;case"/meta/disconnect":ke(a);break;case"/meta/subscribe":a.subscription=r.subscription,Le(a);break;case"/meta/unsubscribe":a.subscription=r.subscription,De(a);break;default:Me(a)}}},this.registerTransport=function(e,t,n){var o=g.add(e,t,n);return o&&(this._debug("Registered transport",e),M(t.registered)&&t.registered(e,this)),o},this.unregisterTransport=function(e){var t=g.remove(e);return null!==t&&(this._debug("Unregistered transport",e),M(t.unregistered)&&t.unregistered()),t},this.unregisterTransports=function(){g.clear()},this.getTransportTypes=function(){return g.getTransportTypes()},this.findTransport=function(e){return g.find(e)},this.getTransportRegistry=function(){return g},this.configure=function(e){H.call(this,e)},this.init=function(e,t){this.configure(e),this.handshake(t)},this.handshake=function(e,t){if("disconnected"!==w)throw"Illegal state: handshaken";me(e,t)},this.disconnect=function(e,t){if(!X()){M(e)&&(t=e,e=void 0);var n={id:J(),channel:"/meta/disconnect"},o=this._mixin(!1,{},e,n);f._putCallback(o.id,t),Y("disconnecting"),re([o],!1,"disconnect")}},this.startBatch=function(){ce()},this.endBatch=function(){le()},this.batch=function(e,t){var n=qe(e,t);this.startBatch();try{n.method.call(n.scope),this.endBatch()}catch(e){throw this._info("Exception during execution of batch",e),this.endBatch(),e}},this.addListener=function(e,t,n){if(arguments.length<2)throw"Illegal arguments number: required 2, got "+arguments.length;if(!K(e))throw"Illegal argument type: channel must be a string";return He(e,t,n,!0)},this.removeListener=function(e){if(!e||!e.channel||!("id"in e))throw"Invalid argument: expected subscription, not "+e;G(e)},this.clearListeners=function(){x={}},this.subscribe=function(e,t,n,o,r){if(arguments.length<2)throw"Illegal arguments number: required 2, got "+arguments.length;if(!K(e))throw"Illegal argument type: channel must be a string";if(X())throw"Illegal state: disconnected";M(t)&&(r=o,o=n,n=t,t=void 0),M(o)&&(r=o,o=void 0);var a=!Fe(e),i=He(e,t,n,!1);if(a){var s={id:J(),channel:"/meta/subscribe",subscription:e},c=this._mixin(!1,{},o,s);f._putCallback(c.id,r),ae(c)}return i},this.unsubscribe=function(e,t,n){if(arguments.length<1)throw"Illegal arguments number: required 1, got "+arguments.length;if(X())throw"Illegal state: disconnected";M(t)&&(n=t,t=void 0),this.removeListener(e);var o=e.channel;if(!Fe(o)){var r={id:J(),channel:"/meta/unsubscribe",subscription:o},a=this._mixin(!1,{},t,r);f._putCallback(a.id,n),ae(a)}},this.resubscribe=function(e,t){if(W(e),e)return this.subscribe(e.channel,e.scope,e.callback,t)},this.clearSubscriptions=function(){V()},this.publish=function(e,t,n,o){if(arguments.length<1)throw"Illegal arguments number: required 1, got "+arguments.length;if(!K(e))throw"Illegal argument type: channel must be a string";if(/^\/meta\//.test(e))throw"Illegal argument: cannot publish to meta channels";if(X())throw"Illegal state: disconnected";M(t)?(o=t,t={},n=void 0):M(n)&&(o=n,n=void 0);var r={id:J(),channel:e,data:t},a=this._mixin(!1,{},n,r);f._putCallback(a.id,o),ae(a)},this.publishBinary=function(e,t,n,o,r){M(t)?(r=t,t=new ArrayBuffer(0),n=!0,o=void 0):M(n)?(r=n,n=!0,o=void 0):M(o)&&(r=o,o=void 0);var a={meta:o,data:t,last:n},i={ext:{binary:{}}};this.publish(e,a,i,r)},this.remoteCall=function(e,t,n,o,r){if(arguments.length<1)throw"Illegal arguments number: required 1, got "+arguments.length;if(!K(e))throw"Illegal argument type: target must be a string";if(X())throw"Illegal state: disconnected";if(M(t)?(r=t,t={},n=D.maxNetworkDelay,o=void 0):M(n)?(r=n,n=D.maxNetworkDelay,o=void 0):M(o)&&(r=o,o=void 0),"number"!=typeof n)throw"Illegal argument type: timeout must be a number";e.match(/^\//)||(e="/"+e);var a="/service"+e,i={id:J(),channel:a,data:t},s=this._mixin(!1,{},o,i),c={callback:r};n>0&&(c.timeout=f.setTimeout((function(){f._debug("Timing out remote call",s,"after",n,"ms"),Be({id:s.id,error:"406::timeout",successful:!1,failure:{message:s,reason:"Remote Call Timeout"}})}),n),f._debug("Scheduled remote call timeout",s,"in",n,"ms")),k[s.id]=c,ae(s)},this.remoteCallBinary=function(e,t,n,o,r,a){M(t)?(a=t,t=new ArrayBuffer(0),n=!0,o=void 0,r=D.maxNetworkDelay):M(n)?(a=n,n=!0,o=void 0,r=D.maxNetworkDelay):M(o)?(a=o,o=void 0,r=D.maxNetworkDelay):M(r)&&(a=r,r=D.maxNetworkDelay);var i={meta:o,data:t,last:n},s={ext:{binary:{}}};this.remoteCall(e,i,r,s,a)},this.getStatus=function(){return w},this.isDisconnected=X,this.setBackoffIncrement=function(e){D.backoffIncrement=e},this.getBackoffIncrement=function(){return D.backoffIncrement},this.getBackoffPeriod=function(){return A},this.increaseBackoffPeriod=function(){return se()},this.resetBackoffPeriod=function(){ie()},this.setLogLevel=function(e){D.logLevel=e},this.registerExtension=function(e,t){if(arguments.length<2)throw"Illegal arguments number: required 2, got "+arguments.length;if(!K(e))throw"Illegal argument type: extension name must be a string";for(var n=!1,o=0;o<N.length;++o)if(N[o].name===e){n=!0;break}return n?(this._info("Could not register extension with name",e,"since another extension with the same name already exists"),!1):(N.push({name:e,extension:t}),this._debug("Registered extension",e),M(t.registered)&&t.registered(e,this),!0)},this.unregisterExtension=function(e){if(!K(e))throw"Illegal argument type: extension name must be a string";for(var t=!1,n=0;n<N.length;++n){var o=N[n];if(o.name===e){N.splice(n,1),t=!0,this._debug("Unregistered extension",e);var r=o.extension;M(r.unregistered)&&r.unregistered();break}}return t},this.getExtension=function(e){for(var t=0;t<N.length;++t){var n=N[t];if(n.name===e)return n.extension}return null},this.getName=function(){return y},this.getClientId=function(){return v},this.getURL=function(){if(a){var e=a.getURL();if(e)return e;if(e=D.urls[a.getType()])return e}return D.url},this.getTransport=function(){return a},this.getConfiguration=function(){return this._mixin(!0,{},D)},this.getAdvice=function(){return this._mixin(!0,{},O)},this.setTimeout=function(e,t){return p.setTimeout((function(){try{f._debug("Invoking timed function",e),e()}catch(t){f._debug("Exception invoking timed function",e,t)}}),t)},this.clearTimeout=function(e){p.clearTimeout(e)},window.WebSocket&&this.registerTransport("websocket",new c),this.registerTransport("long-polling",new i),this.registerTransport("callback-polling",new s)},l=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",".","-",":","+","=","^","!","/","*","?","&","<",">","(",")","[","]","{","}","@","%","$","#"],h=[0,68,0,84,83,82,72,0,75,76,70,65,0,63,62,69,0,1,2,3,4,5,6,7,8,9,64,0,73,66,74,71,81,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,77,0,78,67,0,0,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,79,0,80,0,0];return{CometD:u,Transport:r,RequestTransport:a,LongPollingTransport:i,CallbackPollingTransport:s,WebSocketTransport:c,Utils:n,Z85:{encode:function(e){var t=null;if(e instanceof ArrayBuffer?t=e:e.buffer instanceof ArrayBuffer?t=e.buffer:Array.isArray(e)&&(t=new Uint8Array(e).buffer),null==t)throw"Cannot Z85 encode "+e;for(var n=t.byteLength,o=n%4,r=4-(0===o?4:o),a=new DataView(t),i="",s=0,c=0;c<n+r;++c){var u=c>=n;if(s=256*s+(u?0:a.getUint8(c)),(c+1)%4==0){for(var h=52200625,d=5;d>0;--d){if(!u||d>r){var p=Math.floor(s/h)%85;i+=l[p]}h/=85}s=0}}return i},decode:function(e){for(var t=e.length%5,n=5-(0===t?5:t),o=0;o<n;++o)e+=l[l.length-1];for(var r=e.length,a=new ArrayBuffer(4*r/5-n),i=new DataView(a),s=0,c=0,u=0,d=0;d<r;++d){var p=e.charCodeAt(c++)-32;if(s=85*s+h[p],c%5==0){for(var f=16777216;f>=1;)u<i.byteLength&&i.setUint8(u++,Math.floor(s/f)%256),f/=256;s=0}}return a}}}}()})),lt=Object.freeze(t({__proto__:null,default:ut},[ut])),ht=r((function(e,t){e.exports=ut.AckExtension=function(){var e,t,n=!1;function o(t,n){e._debug(t,n)}this.registered=function(t,n){e=n,o("AckExtension: executing registration callback")},this.unregistered=function(){o("AckExtension: executing unregistration callback"),e=null},this.incoming=function(e){var r=e.channel,a=e.ext;if("/meta/handshake"===r){if(a){var i=a.ack;if("object"==typeof i){n=!0===i.enabled;var s=i.batch;"number"==typeof s&&(t=s)}else n=!0===i}o("AckExtension: server supports acknowledgements",n)}else"/meta/connect"===r&&e.successful&&n&&a&&"number"==typeof a.ack&&o("AckExtension: server sent batch",t=a.ack);return e},this.outgoing=function(r){var a=r.channel;return r.ext||(r.ext={}),"/meta/handshake"===a?(r.ext.ack=e&&!1!==e.ackEnabled,n=!1,t=0):"/meta/connect"===a&&n&&(r.ext.ack=t,o("AckExtension: client sending batch",t)),r}}})),dt=Object.freeze(t({__proto__:null,default:ht},[ht])),pt=r((function(e,t){e.exports=ut.ReloadExtension=function(e){var t,n,o={},r="org.cometd.reload",a=!1,i=!1;function s(e){if(o.handshakeResponse){i=!0;var a=t.getTransport();a&&a.abort(),u(e);var s=JSON.stringify(o);n("Reload extension saving state",s),window.sessionStorage.setItem(r,s)}}function c(e){return o.url===e.url}function u(e){e&&"string"==typeof e.name&&(r=e.name)}function l(e){t.receive(e)}this.configure=u,this._receive=l,this.registered=function(e,o){(t=o).reload=s,n=t._debug},this.unregistered=function(){delete t.reload,t=null},this.outgoing=function(e){switch(e.channel){case"/meta/handshake":(o={}).url=t.getURL();var s=window.sessionStorage.getItem(r);if(n("Reload extension found state",s),s)try{var u=JSON.parse(s);if(window.sessionStorage.removeItem(r),u.handshakeResponse&&c(u)){n("Reload extension restoring state",u);var l=t._getCallback(e.id),h=this;return setTimeout((function(){n("Reload extension replaying handshake response",u.handshakeResponse),o.handshakeResponse=u.handshakeResponse,o.transportType=u.transportType,t._putCallback(e.id,l);var r=t._mixin(!0,{},o.handshakeResponse,{id:e.id,ext:{reload:!0}});r.supportedConnectionTypes=[o.transportType],h._receive(r),n("Reload extension replayed handshake response",r)}),0),a||(a=!0,t.startBatch()),null}n("Reload extension could not restore state",u)}catch(e){n("Reload extension error while trying to restore state",e)}break;case"/meta/connect":if(!0===i)return n("Reload extension aborting /meta/connect during reload"),null;o.transportType||(o.transportType=e.connectionType,n("Reload extension tracked transport type",o.transportType));break;case"/meta/disconnect":o={}}return e},this.incoming=function(e){if(e.successful)switch(e.channel){case"/meta/handshake":o.handshakeResponse||(o.handshakeResponse=e,n("Reload extension tracked handshake response",e));break;case"/meta/connect":a&&(a=!1,t.endBatch());break;case"/meta/disconnect":o={}}return e},u(e)}})),ft=Object.freeze(t({__proto__:null,default:pt},[pt]));e.Channel=class{constructor(t){a(this,"path",void 0),a(this,"update",void 0),a(this,"subscription",null);const{scopeBoundary:n,scopeKey:o,pushCategory:r}=t;(t=>{if(!t)throw new c("No scope found where one was required");const{scopeBoundary:n,scopeKey:o,pushCategory:r}=t;if(!n)throw new c("Missing scope component: scopeBoundary");if(!o)throw new c("Missing scope component: scopeKey");if(!r)throw new c("Missing scope component: pushCategory");if(!Object.prototype.hasOwnProperty.call(e.SCOPE_BOUNDARY,n))throw new c("Invalid scope boundary: ".concat(n));if(!Object.prototype.hasOwnProperty.call(e.PUSH_CATEGORY,r))throw new c("Invalid push category: ".concat(r))})(t),this.path="/".concat(n.toLowerCase(),"/").concat(o,"/").concat(r.toLowerCase()),J.subscriptions.has(this.path)&&(this.subscription=J.subscriptions.get(this.path))}publish(e){return J.publish(this,e)}async subscribe(e,t={}){return this.subscription&&await J.remove(this.subscription),this.update=e,this.subscription=await J.add(this,e,t),this.subscription}async unsubscribe(){this.subscription&&(await J.remove(this.subscription),this.subscription=null)}},e.Fault=u,e.Router=B,e.accountAdapter=K,e.adminAdapter=H,e.assetAdapter=oe,e.authAdapter=Q,e.chatAdapter=Ze,e.config=O,e.consensusAdapter=$e,e.dailyAdapter=it,e.emailAdapter=re,e.episodeAdapter=ie,e.errorManager=j,e.groupAdapter=ce,e.leaderboardAdapter=le,e.matchmakerAdapter=ot,e.presenceAdapter=he,e.projectAdapter=W,e.recaptchaAdapter=de,e.runAdapter=me,e.somebodyAdapter=Qe,e.taskAdapter=Je,e.timeAdapter=Xe,e.userAdapter=ge,e.utils=st,e.vaultAdapter=be,e.version=ct,e.videoAPI=Ce,e.videoAdapter=Ue,e.vonageAPI=Fe,e.vonageAdapter=We,e.worldAdapter=Ve,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).epicenter={})}(this,(function(e){"use strict";function t(e,t){return t.forEach((function(t){Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function r(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}r((function(e){var t=function(e){var t,n=Object.prototype,o=n.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},a=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",s=r.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,o){var r=t&&t.prototype instanceof m?t:m,a=Object.create(r.prototype),i=new N(o||[]);return a._invoke=function(e,t,n){var o=h;return function(r,a){if(o===p)throw new Error("Generator is already running");if(o===f){if("throw"===r)throw a;return P()}for(n.method=r,n.arg=a;;){var i=n.delegate;if(i){var s=x(i,n);if(s){if(s===y)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=p;var c=l(e,t,n);if("normal"===c.type){if(o=n.done?f:d,c.arg===y)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=f,n.method="throw",n.arg=c.arg)}}}(e,n,i),a}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var h="suspendedStart",d="suspendedYield",p="executing",f="completed",y={};function m(){}function g(){}function w(){}var b={};c(b,a,(function(){return this}));var v=Object.getPrototypeOf,S=v&&v(v(O([])));S&&S!==n&&o.call(S,a)&&(b=S);var _=w.prototype=m.prototype=Object.create(b);function T(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function n(r,a,i,s){var c=l(e[r],e,a);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==typeof h&&o.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,i,s)}),(function(e){n("throw",e,i,s)})):t.resolve(h).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,s)}))}s(c.arg)}var r;this._invoke=function(e,o){function a(){return new t((function(t,r){n(e,o,t,r)}))}return r=r?r.then(a,a):a()}}function x(e,n){var o=e.iterator[n.method];if(o===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,x(e,n),"throw"===n.method))return y;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var r=l(o,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,y;var a=r.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function R(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function O(e){if(e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function n(){for(;++r<e.length;)if(o.call(e,r))return n.value=e[r],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}return{next:P}}function P(){return{value:t,done:!0}}return g.prototype=w,c(_,"constructor",w),c(w,"constructor",g),g.displayName=c(w,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,c(e,s,"GeneratorFunction")),e.prototype=Object.create(_),e},e.awrap=function(e){return{__await:e}},T(E.prototype),c(E.prototype,i,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,o,r,a){void 0===a&&(a=Promise);var i=new E(u(t,n,o,r),a);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},T(_),c(_,s,"Generator"),c(_,a,(function(){return this})),c(_,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var o=t.pop();if(o in e)return n.value=o,n.done=!1,n}return n.done=!0,n}},e.values=O,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(R),!e)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function r(o,r){return s.type="throw",s.arg=e,n.next=o,r&&(n.method="next",n.arg=t),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var c=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var a=r;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),R(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var r=o.arg;R(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,o){return this.delegate={iterator:O(e),resultName:n,nextLoc:o},"next"===this.method&&(this.arg=t),y}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}));var a=o(r((function(e){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0}))),i=r((function(e,t){var o="undefined"!=typeof self?self:n,r=function(){function e(){this.fetch=!1,this.DOMException=o.DOMException}return e.prototype=o,new e}();!function(e){!function(t){var n="URLSearchParams"in e,o="Symbol"in e&&"iterator"in Symbol,r="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),a="FormData"in e,i="ArrayBuffer"in e;if(i)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function u(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function h(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return o&&(t[Symbol.iterator]=function(){return t}),t}function d(e){this.map={},e instanceof d?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function p(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function f(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function y(e){var t=new FileReader,n=f(t);return t.readAsArrayBuffer(e),n}function m(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:r&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:a&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():i&&r&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=m(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i&&(ArrayBuffer.prototype.isPrototypeOf(e)||c(e))?this._bodyArrayBuffer=m(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r&&(this.blob=function(){var e=p(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var e,t,n,o=p(this);if(o)return o;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,n=f(t),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),o=0;o<t.length;o++)n[o]=String.fromCharCode(t[o]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a&&(this.formData=function(){return this.text().then(v)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(e,t){e=u(e),t=l(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},d.prototype.delete=function(e){delete this.map[u(e)]},d.prototype.get=function(e){return e=u(e),this.has(e)?this.map[e]:null},d.prototype.has=function(e){return this.map.hasOwnProperty(u(e))},d.prototype.set=function(e,t){this.map[u(e)]=l(t)},d.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},d.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),h(e)},d.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),h(e)},d.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),h(e)},o&&(d.prototype[Symbol.iterator]=d.prototype.entries);var w=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function b(e,t){var n,o,r=(t=t||{}).body;if(e instanceof b){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new d(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,r||null==e._bodyInit||(r=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new d(t.headers)),this.method=(n=t.method||this.method||"GET",o=n.toUpperCase(),w.indexOf(o)>-1?o:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function v(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),o=n.shift().replace(/\+/g," "),r=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(o),decodeURIComponent(r))}})),t}function S(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new d(t.headers),this.url=t.url||"",this._initBody(e)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},g.call(b.prototype),g.call(S.prototype),S.prototype.clone=function(){return new S(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},S.error=function(){var e=new S(null,{status:0,statusText:""});return e.type="error",e};var _=[301,302,303,307,308];S.redirect=function(e,t){if(-1===_.indexOf(t))throw new RangeError("Invalid status code");return new S(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function T(e,n){return new Promise((function(o,a){var i=new b(e,n);if(i.signal&&i.signal.aborted)return a(new t.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function c(){s.abort()}s.onload=function(){var e,t,n={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new d,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),o=n.shift().trim();if(o){var r=n.join(":").trim();t.append(o,r)}})),t)};n.url="responseURL"in s?s.responseURL:n.headers.get("X-Request-URL");var r="response"in s?s.response:s.responseText;o(new S(r,n))},s.onerror=function(){a(new TypeError("Network request failed"))},s.ontimeout=function(){a(new TypeError("Network request failed"))},s.onabort=function(){a(new t.DOMException("Aborted","AbortError"))},s.open(i.method,i.url,!0),"include"===i.credentials?s.withCredentials=!0:"omit"===i.credentials&&(s.withCredentials=!1),"responseType"in s&&r&&(s.responseType="blob"),i.headers.forEach((function(e,t){s.setRequestHeader(t,e)})),i.signal&&(i.signal.addEventListener("abort",c),s.onreadystatechange=function(){4===s.readyState&&i.signal.removeEventListener("abort",c)}),s.send(void 0===i._bodyInit?null:i._bodyInit)}))}T.polyfill=!0,e.fetch||(e.fetch=T,e.Headers=d,e.Request=b,e.Response=S),t.Headers=d,t.Request=b,t.Response=S,t.fetch=T,Object.defineProperty(t,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var a=r;(t=a.fetch).default=a.fetch,t.fetch=a.fetch,t.Headers=a.Headers,t.Request=a.Request,t.Response=a.Response,e.exports=t})),s=o(i);class c extends Error{constructor(e,t){super(e),a(this,"code",void 0),this.code=t}}class u extends c{constructor(e,t){var n;super(e.message,null===(n=e.information)||void 0===n?void 0:n.code),a(this,"status",void 0),a(this,"information",void 0),a(this,"cause",void 0);const{information:o,message:r,cause:i,status:s}=e;if(this.status=null!=s?s:null==t?void 0:t.status,this.message=r,o){const{code:e,...t}=o;this.code=e,this.information=t}i&&(this.cause=i)}}class l{constructor(e,t){a(this,"status",void 0),a(this,"headers",void 0),a(this,"body",void 0);const{status:n,headers:o}=t;this.status=n,this.headers=o,this.body=e}}var h={getItem:e=>e&&decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*".concat(encodeURIComponent(e).replace(/[-.+*]/g,"\\$&"),"\\s*\\=\\s*([^;]*).*$)|^.*$")),"$1"))||null,setItem(e,t,n={}){if(!e||/^(?:expires|max-age|path|domain|secure)$/i.test(e))return!1;const{path:o,domain:r,end:a,secure:i,samesite:s}=n,c=(e=>{if(!e)return"";switch(e.constructor){case Number:return e===1/0?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":"; max-age=".concat(e);case String:return"; expires=".concat(e);case Date:return"; expires=".concat(new Date(e).toUTCString());default:return""}})(a),u=r?"; domain=".concat(r):"",l=o?"; path=".concat(o):"",h=i?"; secure":"",d=s?"; samesite=".concat(s):"";return document.cookie="".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(t)).concat(c).concat(u).concat(l).concat(h).concat(d),!0},removeItem(e,t={}){if(!this.hasItem(e))return!1;const{path:n,domain:o}=t,r=o?"; domain=".concat(o):"",a=n?"; path=".concat(n):"";return document.cookie="".concat(encodeURIComponent(e),"=; expires=Thu, 01 Jan 1970 00:00:00 GMT").concat(r).concat(a),!0},hasItem:e=>!(!e||/^(?:expires|max-age|path|domain|secure)$/i.test(e))&&new RegExp("(?:^|;\\s*)".concat(encodeURIComponent(e).replace(/[-.+*]/g,"\\$&"),"\\s*\\=")).test(document.cookie),clear(){const e=document.cookie.replace(/((?:^|\s*;)[^=]+)(?=;|$)|^\s*|\s*(?:=[^;]*)?(?:\1|$)/g,"").split(/\s*(?:=[^;]*)?;\s*/);for(let t=e.length,n=0;n<t;n++)e[n]=decodeURIComponent(e[n]),this.removeItem(e[n]);return e}};class d{constructor(e){a(this,"_store",void 0),this._store=e}clear(){this._store.clear()}get store(){return this._store}set store(e){this._store=e}}const p=new Map;class f extends d{constructor(){super(p)}getItem(e){return super.store.get(e)}setItem(e,t){return super.store.set(e,t)}removeItem(e){return super.store.delete(e)}}class y extends d{constructor(){super(window.sessionStorage)}getItem(e){return JSON.parse(super.store.getItem(e))}setItem(e,t){return super.store.setItem(e,JSON.stringify(t))}removeItem(e){return super.store.removeItem(e)}}class m{constructor(e={}){a(this,"options",{});const t=window.location.hostname,n="localhost"!==t?{path:"/",domain:".".concat(t)}:{path:"/"};this.options={...n,...e}}getItem(e){const t=h.getItem(e);return t?JSON.parse(t):null}setItem(e,t){return h.setItem(e,JSON.stringify(t),this.options)}removeItem(e){return h.removeItem(e,this.options)}clear(){return h.clear()}}let g;var w,b,v;let S,_,T,E;var x;!function(e){e.COOKIE="COOKIE",e.SESSION="SESSION"}(g||(g={})),e.SCOPE_BOUNDARY=void 0,(w=e.SCOPE_BOUNDARY||(e.SCOPE_BOUNDARY={})).PROJECT="PROJECT",w.GROUP="GROUP",w.EPISODE="EPISODE",w.WORLD="WORLD",e.RITUAL=void 0,(b=e.RITUAL||(e.RITUAL={})).NONE="NONE",b.INTER="INTER",b.REANIMATE="REANIMATE",b.REVIVE="REVIVE",b.EXORCISE="EXORCISE",b.RESURRECT="RESURRECT",e.PUSH_CATEGORY=void 0,(v=e.PUSH_CATEGORY||(e.PUSH_CATEGORY={})).CHAT="CHAT",v.CONSENSUS="CONSENSUS",v.CONTROL="CONTROL",v.PRESENCE="PRESENCE",v.LOBBY="LOBBY",v.RUN="RUN",v.VAULT="VAULT",v.VIDEO="VIDEO",v.WORLD="WORLD",v.GROUP="GROUP",v.SYSTEM="SYSTEM",function(e){e.SYSTEM="SYSTEM",e.MONITOR="MONITOR"}(S||(S={})),function(e){e.AUTHOR="AUTHOR",e.SUPPORT="SUPPORT"}(_||(_={})),function(e){e.ASSOCIATE="ASSOCIATE"}(T||(T={})),function(e){e.FACILITATOR="FACILITATOR",e.REVIEWER="REVIEWER",e.USER="USER",e.LEADER="LEADER",e.PARTICIPANT="PARTICIPANT",e.ANONYMOUS="ANONYMOUS"}(E||(E={})),e.ROLE=void 0,(x=e.ROLE||(e.ROLE={})).SYSTEM="SYSTEM",x.MONITOR="MONITOR",x.AUTHOR="AUTHOR",x.SUPPORT="SUPPORT",x.FACILITATOR="FACILITATOR",x.REVIEWER="REVIEWER",x.USER="USER",x.LEADER="LEADER",x.PARTICIPANT="PARTICIPANT",x.ANONYMOUS="ANONYMOUS";const A=new Function("try {return this===window;}catch(e){ return false;}"),R=new Function('try {return (typeof process !== "undefined") && (typeof process.versions.node !== "undefined")}catch(e){return false;}'),N=(e,t)=>t.startsWith(e)?t:"".concat(e).concat(t);const O=new class{constructor(){if(a(this,"_apiVersion",3),a(this,"_apiProtocol",""),a(this,"_apiHost",""),a(this,"_useProjectProxy",!1),a(this,"_accountShortName",""),a(this,"_projectShortName",""),a(this,"authOverride",void 0),A())this.loadBrowser();else{if(!R())throw new c("Could not identify environment; no configuration was setup");this.loadNode()}}get apiProtocol(){return this._apiProtocol}set apiProtocol(e){e.startsWith("http")&&(e.endsWith(":")&&(e=e.slice(0,-1)),this._apiProtocol=e)}get apiHost(){return this._apiHost}set apiHost(e){this._apiHost=e}get useProjectProxy(){return this._useProjectProxy}set useProjectProxy(e){this._useProjectProxy=e}get apiVersion(){return this._apiVersion}set apiVersion(e){}get accountShortName(){return this._accountShortName}set accountShortName(e){this._accountShortName=e}get projectShortName(){return this._projectShortName}set projectShortName(e){this._projectShortName=e}isLocal(){if(!A())return!1;const e=window.location.host;return"127.0.0.1"===e||0===e.indexOf("local.")||-1!==e.indexOf("ngrok")||0===e.indexOf("localhost")}loadNode(){this.apiProtocol="https",this.apiHost="forio.com"}loadBrowser(){const e=this.isLocal(),{protocol:t,pathname:n,host:o}=window.location;this.apiProtocol=e?"https":t,this.apiHost=e?"forio.com":o;const r=n.match(/\/app\/([\w-]+)\/([\w-]+)/);if(r){const[e,t]=r.slice(1);this.accountShortName=e,this.projectShortName=t}}setContext(e){e.apiProtocol&&(this.apiProtocol=e.apiProtocol),e.apiHost&&(this.apiHost=e.apiHost),"boolean"==typeof e.useProjectProxy&&(this.useProjectProxy=e.useProjectProxy),e.accountShortName&&(this.accountShortName=e.accountShortName),e.projectShortName&&(this.projectShortName=e.projectShortName)}},{COOKIE:P,SESSION:k}=g,I="com.forio.epicenter.session",C="epicenter.v3.sso";const L=new class{constructor(e){if(a(this,"type",void 0),e!==P&&e!==k)throw new c('Invalid Storage Type: "'.concat(e,'", please use "').concat(P,'" or "').concat(k,'".'));this.type=e,this.consumeSSO()}get session(){return(new(this.getStore())).getItem(I)}set session(e){const t=this.getStore(),n=this.getStoreOptions(e);e?new t(n).setItem(I,e):this.session&&new t(n).removeItem(I)}getStore(){return R()?f:this.type===k?y:m}getStoreOptions(e){const t=e||this.session;if(!t||R())return"";const{objectType:n}=t,o=O.isLocal(),r={samesite:o?"lax":"none",secure:!o},a=!o&&"app"!==window.location.pathname.split("/")[1];if("user"===n&&(!o&&!a)){const{accountShortName:e,projectShortName:n}=t,o=e?"/".concat(e):"",a=o&&n?"/".concat(n):"";return{...r,path:"/app".concat(o).concat(a)}}return{...r,path:"/"}}consumeSSO(){var e;if(R())return;let t=h.getItem(C);"string"==typeof t&&'"'!==t.charAt(0)&&'"'!==t.charAt(t.length-1)&&(t='"'.concat(t,'"'));const n=JSON.parse(JSON.parse(null!==(e=t)&&void 0!==e?e:'"null"'));if(n){const{accountShortName:e,projectShortName:t}=n,o=e?"/".concat(e):"",r=o&&t?"/".concat(t):"";this.session=n,h.removeItem(C,{domain:".".concat(window.location.hostname),path:"/app".concat(o).concat(r)})}}}(P);const j=new class{constructor(){a(this,"_handlers",[])}get handlers(){return this._handlers}clearHandlers(){this._handlers=[]}registerHandler(e,t){this.handlers.unshift({identifier:e,handle:t})}async handle(e,t,n){const o=(n=n||this.handlers).findIndex((({identifier:t})=>t(e))),r=n[o];if(!r)throw e;let a;try{a=await r.handle(e,t).catch((e=>{throw e}))}catch(r){console.error("Handler failed due to error",r);const i=o>-1?[...n.slice(0,o),...n.slice(o+1)]:[],s=r instanceof u?r:e;a=await this.handle(s,t,i)}return a}};const U=e=>e.constructor===URLSearchParams?e:("object"==typeof e&&e.constructor===Object&&(e=Object.entries(e).reduce(((e,[t,n])=>Array.isArray(n)?[...e,...n.map((e=>[t,e]))]:(null==n||e.push([t,n.toString()]),e)),[])),new URLSearchParams(e));async function D(e,t){const{method:n,headers:o,body:r,includeAuthorization:a,inert:i,paginated:h,authorization:d}=t,p=((e,t,n,o)=>{const r=Object.assign({},e);let a=null;if(A()&&t instanceof FormData?a=t:t&&(r["Content-type"]="application/json; charset=UTF-8",a=JSON.stringify(t)),!n)return delete r.Authorization,{headers:r,body:a};const{session:i}=L;return r.Authorization||(i&&(r.Authorization="Bearer ".concat(i.token)),o&&(r.Authorization=o),O.authOverride&&(r.Authorization=O.authOverride)),{headers:r,body:a}})(o,r,a,d),f=await s(e.toString(),{method:n,cache:"no-cache",redirect:"follow",headers:p.headers,body:p.body});if(204===f.status)return new l(void 0,f);const y=f.headers.get("content-type");if(!y||!y.includes("application/json"))throw new c("Response content-type '".concat(y,"' does not include 'application/json' and my url is ").concat(e.toString(),", ").concat(n));const m=await f.json();if(f.status>=200&&f.status<400){const n=new l(h?function(e,t,n){var o;const r=null!==(o=n.parsePage)&&void 0!==o?o:e=>e,a={...e,values:r(e.values)},i=e.totalResults,s=async function(e=0,o=[]){if(e>=i)return o;const a=new URLSearchParams(t.search);a.set("first",e.toString()),a.delete("max"),t.search=a.toString();const c=await D(t,{...n,paginated:!1}).then((({body:e})=>e));return o.push(...r(c.values)),s(e+c.maxResults,o)};return a.prev=async function(){const e=new URLSearchParams(t.search);if(0===a.firstResult)return console.warn('Pagination: cannot call "prev" on first page'),[];const o=a.firstResult-a.maxResults,i=a.maxResults+(o<0?o:0);e.set("first",Math.max(o,0).toString()),e.set("max",i.toString()),t.search=e.toString();const s=await D(t,{...n,paginated:!1}).then((({body:e})=>e));return s.values=r(s.values),Object.assign(a,s),a.values},a.next=async function(){const e=new URLSearchParams(t.search),o=a.firstResult+a.maxResults;if(o>=a.totalResults)return console.warn('Pagination: cannot call "next" on final page'),[];e.set("first",o.toString()),t.search=e.toString();const i=await D(t,{...n,paginated:!1}).then((({body:e})=>e));return i.values=r(i.values),Object.assign(a,i),a.values},a.all=s,a}(m,e,t):m,f);return n}const g=new u(m,f);if(i)throw g;const w={...t,inert:!0},b=()=>D(e,w);return b.requestArguments={url:e,...w},j.handle(g,b)}class B{constructor(){a(this,"_version",void 0),a(this,"_server",void 0),a(this,"_useProjectProxy",void 0),a(this,"_accountShortName",void 0),a(this,"_projectShortName",void 0),a(this,"_authorization",void 0),a(this,"_searchParams",new URLSearchParams)}get version(){return this._version}set version(e){this._version=e}get server(){return this._server}set server(e){this._server=e}get useProjectProxy(){return this._useProjectProxy}set useProjectProxy(e){this._useProjectProxy=e}get accountShortName(){return this._accountShortName}set accountShortName(e){this._accountShortName=e}get projectShortName(){return this._projectShortName}set projectShortName(e){this._projectShortName=e}get authorization(){return this._authorization}set authorization(e){this._authorization=e}get searchParams(){return this._searchParams}set searchParams(e){this._searchParams=U(e)}withVersion(e){return void 0!==e&&(this.version=e),this}withServer(e){return void 0!==e&&(this.server=e),this}withProjectProxy(e){return void 0!==e&&(this.useProjectProxy=e),this}withAccountShortName(e){return void 0!==e&&(this.accountShortName=e),this}withProjectShortName(e){return void 0!==e&&(this.projectShortName=e),this}withAuthorization(e){return void 0!==e&&(this.authorization=e),this}withSearchParams(e){return void 0!==e&&(this.searchParams=e),this}getURL(e,t={}){var n,o,r,a,i,s,c,u,l,h,d;const p=null!==(n=null!==(o=t.server)&&void 0!==o?o:this.server)&&void 0!==n?n:"".concat(O.apiProtocol,"://").concat(O.apiHost),f=null!==(r=null!==(a=t.useProjectProxy)&&void 0!==a?a:this.useProjectProxy)&&void 0!==r?r:O.useProjectProxy,y=null!==(i=null!==(s=t.accountShortName)&&void 0!==s?s:this.accountShortName)&&void 0!==i?i:O.accountShortName,m=null!==(c=null!==(u=t.projectShortName)&&void 0!==u?u:this.projectShortName)&&void 0!==c?c:O.projectShortName,g=null!==(l=null!==(h=null==t?void 0:t.version)&&void 0!==h?h:this.version)&&void 0!==l?l:O.apiVersion,w=new URL("".concat(p)),b=f?"proxy/".concat(y,"/").concat(m,"/"):"",v="api/v".concat(g,"/").concat(y,"/").concat(m),S=N("/",e);return w.pathname="".concat(b).concat(v).concat(S),w.search=void 0!==t.query?U(t.query).toString():(null!==(d=this.searchParams)&&void 0!==d?d:new URLSearchParams).toString(),w}async get(e,t={}){const{accountShortName:n,projectShortName:o,authorization:r,server:a,query:i,useProjectProxy:s,headers:c,includeAuthorization:u,inert:l,paginated:h,parsePage:d}=t,p=this.getURL(e,{server:a,query:i,accountShortName:n,projectShortName:o,useProjectProxy:s});if(p.href.length>2048){var f;const n=null!==(f=this.searchParams)&&void 0!==f?f:new URLSearchParams,o=Array.from(n.entries()).reduce(((e,[t,n])=>e[t]?(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(n),e):(e[t]=n,e)),{});return this.searchParams="",this.post(e,{...t,body:o})}return D(p,{method:"GET",headers:c,includeAuthorization:null==u||u,authorization:null!=r?r:this.authorization,inert:l,paginated:h,parsePage:d})}async delete(e,t={}){const{accountShortName:n,projectShortName:o,authorization:r,server:a,query:i,useProjectProxy:s,headers:c,includeAuthorization:u,inert:l}=t;return D(this.getURL(e,{server:a,query:i,accountShortName:n,projectShortName:o,useProjectProxy:s}),{method:"DELETE",headers:c,includeAuthorization:null==u||u,authorization:null!=r?r:this.authorization,inert:l})}async patch(e,t={}){const{accountShortName:n,projectShortName:o,authorization:r,server:a,query:i,useProjectProxy:s,headers:c,body:u,includeAuthorization:l,inert:h}=t;return D(this.getURL(e,{server:a,query:i,accountShortName:n,projectShortName:o,useProjectProxy:s}),{method:"PATCH",headers:c,body:u,includeAuthorization:null==l||l,authorization:null!=r?r:this.authorization,inert:h})}async post(e,t={}){const{accountShortName:n,projectShortName:o,authorization:r,server:a,query:i,useProjectProxy:s,headers:c,body:u,includeAuthorization:l,inert:h}=t;return D(this.getURL(e,{server:a,query:i,accountShortName:n,projectShortName:o,useProjectProxy:s}),{method:"POST",headers:c,body:u,includeAuthorization:null==l||l,authorization:null!=r?r:this.authorization,inert:h})}async put(e,t={}){const{accountShortName:n,projectShortName:o,authorization:r,server:a,query:i,useProjectProxy:s,headers:c,body:u,includeAuthorization:l,inert:h}=t;return D(this.getURL(e,{server:a,query:i,accountShortName:n,projectShortName:o,useProjectProxy:s}),{method:"PUT",headers:c,body:u,includeAuthorization:null==l||l,authorization:null!=r?r:this.authorization,inert:h})}}var K=Object.freeze({__proto__:null,getAccount:async function(e){return await(new B).withAccountShortName(e).get("/account").then((({body:e})=>e))},createAccount:async function(e){return await(new B).withAccountShortName("epicenter").withProjectShortName("manager").post("/account",{body:e}).then((({body:e})=>e))},updateAccount:async function(e,t={}){return await(new B).patch("/account",{body:e,...t}).then((({body:e})=>e))},removeAccount:async function(e){return await(new B).withAccountShortName(e).delete("/account").then((({body:e})=>e))},teamForAdmin:async function(e,t={}){const{includeAllMembers:n,filter:o,first:r,max:a,...i}=t,s={includeAllMembers:n,filter:o,first:r,max:a};return await(new B).withAccountShortName("epicenter").withProjectShortName("manager").withSearchParams(s).get("/account/team/for/".concat(e),i).then((({body:e})=>e))}});var M,z,F,q,H=Object.freeze({__proto__:null,createAdmin:async function(e){return await(new B).withAccountShortName("epicenter").withProjectShortName("manager").post("/admin",{body:e}).then((({body:e})=>e))},getWithHandle:async function(e,t={}){return await(new B).withAccountShortName("epicenter").withProjectShortName("manager").get("/admin/with/".concat(e),t).then((({body:e})=>e))}});async function G(e={}){return await(new B).get("/project/channel/isEnabled",e).then((({body:e})=>e))}!function(e){e.PUBLIC="PUBLIC",e.PRIVATE="PRIVATE",e.AUTHENTICATED="AUTHENTICATED"}(M||(M={})),function(e){e.NONE="NONE",e.ALL="ALL",e.FREE="FREE",e.LICENSED="LICENSED",e.ACCOUNT="ACCOUNT"}(z||(z={})),function(e){e.ORIGINAL="ORIGINAL",e.HISTORICAL="HISTORICAL",e.REFERENTIAL="REFERENTIAL",e.ORDERED="ORDERED",e.EVENTUAL="EVENTUAL"}(F||(F={})),function(e){e.INSENSITIVE="INSENSITIVE",e.SENSITIVE="SENSITIVE"}(q||(q={}));var W=Object.freeze({__proto__:null,channelsEnabled:G,get:async function(e={}){return await(new B).get("/project",e).then((({body:e})=>e))},list:async function(e,t={}){return await(new B).withAccountShortName(e).withProjectShortName("manager").get("/project/in",t).then((({body:e})=>e))}});const V="com.forio.epicenter.token",Y="connected";let X;const J=new class{constructor(){a(this,"url",""),a(this,"initialization",void 0),a(this,"subscriptions",new Map),a(this,"isConnected",!1)}get cometd(){if(!X)throw new c("Tried to get non-existent cometd");return X}set cometd(e){X=e}async startup(){if(!await G())throw new c("Push Channels are not enabled on this project");const{CometD:e}=await Promise.resolve().then((function(){return lt})),t=(await Promise.resolve().then((function(){return dt}))).default,n=(await Promise.resolve().then((function(){return ft}))).default;this.cometd=new e;const{apiProtocol:o,apiHost:r,apiVersion:a,accountShortName:i,projectShortName:s}=O,u=i&&s?"/".concat(i,"/").concat(s):"/epicenter/manager";return this.url="".concat(o,"://").concat(r,"/push/v").concat(a).concat(u,"/cometd"),this.cometd.registerExtension("ack",new t),A()&&(this.cometd.registerExtension("reload",new n),window.onunload=()=>{if(this.cometd.getStatus()===Y){this.cometd.reload&&this.cometd.reload();const e=this.cometd.getTransport();e&&e.abort()}}),this.cometd.configure({url:this.url,logLevel:"debug"}),!0}listenToMetaChannels(){const e=new Promise(((e,t)=>{this.cometd.addListener("/meta/connect",(n=>{if(this.cometd.isDisconnected())return;const o=this.isConnected;if(this.isConnected=n.successful,!o&&this.isConnected){const n=new u({status:void 0,message:"Reconnected to CometD",information:{code:"COMETD_RECONNECTED"}}),o=()=>Promise.resolve();try{const t=j.handle(n,o);e(t)}catch(e){t(e)}}}))})),t=new Promise((e=>{this.cometd.addListener("/meta/disconnect",(t=>{t.successful&&(this.isConnected=!1),e(t)}))}));return Promise.all([e,t])}async init(){return this.initialization||(this.initialization=this.startup()),this.initialization}async handshake(e={}){if(await this.init(),"disconnected"!==this.cometd.getStatus())return Promise.resolve();let t={};const{session:n}=L;return n&&(t={ext:{[V]:n.token,ack:!0}}),this.cometd.websocketEnabled=!0,new Promise(((n,o)=>this.cometd.handshake(t,(t=>{var r;if(t.successful)return this.listenToMetaChannels(),void n(t);const a=null!==(r=t.error)&&void 0!==r?r:"",i=new u({status:a.includes("403")?403:void 0,message:a,information:{code:"COMETD_ERROR",...t}});if(e.inert)return void o(i);const s=()=>this.handshake({inert:!0});try{const e=j.handle(i,s);n(e)}catch(e){o(e)}}))))}async disconnect(){return this.initialization?(await this.init(),await this.empty(),this.cometd.getStatus()!==Y?Promise.resolve():new Promise(((e,t)=>this.cometd.disconnect((n=>{n.successful?e(void 0):t(new c("Unable to disconnect from CometD server"))}))))):Promise.resolve()}async add(e,t,n={}){var o;await this.init();const r=[].concat(e);(null===(o=this.cometd)||void 0===o?void 0:o.getStatus())!==Y&&await this.handshake();const{session:a}=L,i=a?{ext:{[V]:a.token}}:{},s=({data:e})=>(e="string"==typeof e?JSON.parse(e):e,t(e)),c=[];return this.cometd.batch((()=>r.forEach((({path:o})=>c.push(new Promise(((r,a)=>{const c=this.cometd.subscribe(o,s,i,(o=>{var i;if(o.successful)return this.subscriptions.set(c.channel,c),void r(c);const s=null!==(i=o.error)&&void 0!==i?i:"",l=new u({status:s.includes("403")?403:void 0,message:s,information:{code:"COMETD_ERROR",...o}});if(n.inert)return void a(l);const h=()=>this.add(e,t,{inert:!0});try{const e=j.handle(l,h),t=Array.isArray(e)?e[0]:e;r(t)}catch(e){a(e)}}))}))))))),1===c.length?Promise.all(c).then((([e])=>e)):Promise.all(c)}async publish(e,t,n={}){await this.init();const o=[].concat(e);this.cometd.getStatus()!==Y&&await this.handshake();const{session:r}=L,a={ext:r?{[V]:r.token}:void 0},i=[];return this.cometd.batch((()=>o.forEach((({path:o})=>i.push(new Promise(((r,i)=>{this.cometd.publish(o,t,a,(o=>{var a;if(o.successful)return void r(o);const s=null!==(a=o.error)&&void 0!==a?a:"",c=new u({status:s.includes("403")?403:void 0,message:s,information:{code:"COMETD_ERROR",...o}});if(n.inert)return void i(c);const l=()=>this.publish(e,t,{inert:!0});try{const e=j.handle(c,l),t=Array.isArray(e)?e[0]:e;r(t)}catch(e){i(e)}}))}))))))),1===i.length?Promise.all(i).then((([e])=>e)):Promise.all(i)}async remove(e){return await this.init(),this.subscriptions.delete(e.channel),new Promise(((t,n)=>this.cometd.unsubscribe(e,(e=>{var o;e.successful&&t(e);const r=null!==(o=e.error)&&void 0!==o?o:"",a=new u({status:void 0,message:r,information:{code:"COMETD_ERROR",...e}});n(a)}))))}async empty(){await this.init();const e=[];return this.cometd.batch((()=>this.subscriptions.forEach((t=>{e.push(this.remove(t))})))),Promise.all(e)}};async function Z(){L.session=void 0,await J.disconnect()}async function $(e,t={}){const{objectType:n="user",accountShortName:o,...r}=t,a=await(new B).patch("/authentication",{accountShortName:"admin"===n?e:o,body:{objectType:n,groupKey:"user"===n?e:void 0},...r}).then((({body:e})=>e));return await Z(),L.session=a,a}var Q=Object.freeze({__proto__:null,logout:async function(){await J.disconnect();try{var e,t;if(null!=L&&null!==(e=L.session)&&void 0!==e&&e.groupKey)await(new B).delete("/presence/group/".concat(null==L||null===(t=L.session)||void 0===t?void 0:t.groupKey));await(new B).delete("/verification")}catch(e){console.error("Error with DELETE to /verification",e)}L.session=void 0},getSession:async function(){const{body:e}=await(new B).get("/verification");return L.session=e,e},getLocalSession:function(){return L.session},setLocalSession:function(e){return L.session=e},removeLocalSession:Z,login:async function(e,t={}){const{objectType:n,...o}=t;let r;if(Object.prototype.hasOwnProperty.call(e,"handle")){const{handle:t,password:o,groupKey:a}=e;r={objectType:null!=n?n:"user",handle:t,password:o,groupKey:a||void 0}}if(Object.prototype.hasOwnProperty.call(e,"secretKey")){const{secretKey:t}=e;r={objectType:null!=n?n:"account",secretKey:t}}const a=await(new B).post("/authentication",{inert:!0,includeAuthorization:!1,body:r,...o}).then((({body:e})=>e));return await Z(),L.session=a,a},regenerate:$,sso:async function(e={}){const t=await(new B).get("/registration/sso",e).then((({body:e})=>e));return L.session=t,t},getSAMLLink:async function(e={}){return await(new B).get("/registration/sso/saml",e).then((({body:e})=>e))},generateSAMLLINK:function(e={}){return(new B).getURL("/registration/sso/saml",e).toString()},ssoOutcome:async function(e,t,n={}){const{...o}=n;return await(new B).post("/lti/".concat(e,"/outcome"),{body:t,...o}).then((({body:e})=>e))},resetPassword:async function(e,t={}){const{redirectURL:n,subject:o,...r}=t;return await(new B).post("/verification/password/user/".concat(e),{...r,body:{redirectUrl:n,subject:o}}).then((({body:e})=>e))},verify:async function(e,t={}){return await(new B).get("/verification",{authorization:"Bearer ".concat(e),...t}).then((({body:e})=>e))}});async function ee(t,n,o={}){const{scopeBoundary:r,scopeKey:a,userKey:i}=n,{readLock:s,writeLock:c,ttlSeconds:u,...l}=o;return await(new B).post("/asset",{body:{file:t,scope:{scopeBoundary:r,scopeKey:a,userKey:i},permit:{readLock:null!=s?s:e.ROLE.USER,writeLock:null!=c?c:e.ROLE.USER},ttlSeconds:u},...l}).then((({body:e})=>e))}async function te(t,n,o={}){const{scopeBoundary:r,scopeKey:a,userKey:i}=n,{readLock:s,writeLock:c,ttlSeconds:u,...l}=o;return await(new B).patch("/asset",{body:{file:t,scope:{scopeBoundary:r,scopeKey:a,userKey:i},permit:{readLock:null!=s?s:e.ROLE.USER,writeLock:null!=c?c:e.ROLE.USER},ttlSeconds:u},...l}).then((({body:e})=>e))}var ne,oe=Object.freeze({__proto__:null,create:ee,update:te,remove:async function(e,t={}){return await(new B).delete("/asset/".concat(e),t).then((({body:e})=>e))},removeFromScope:async function(e,t={}){const{scopeBoundary:n,scopeKey:o,userKey:r}=e,a=r?"/".concat(r):"";return await(new B).delete("/asset/in/".concat(n,"/").concat(o).concat(a),t).then((({body:e})=>e))},get:async function(e,t={}){const{server:n,accountShortName:o,projectShortName:r}=t;return await(new B).withServer(n).withAccountShortName(o).withProjectShortName(r).get("/asset/".concat(e)).then((({body:e})=>e))},list:async function(e,t={}){const{scopeBoundary:n,scopeKey:o,userKey:r}=e,{filter:a,...i}=t,s=r?"/".concat(r):"";return await(new B).get("/asset/in/".concat(n,"/").concat(o).concat(s,"/").concat(null!=a?a:"*"),i).then((({body:e})=>e))},getURL:async function(e,t={}){return await(new B).get("/asset/url/".concat(e),t).then((({body:e})=>e))},getURLWithScope:async function(e,t,n={}){const{scopeBoundary:o,scopeKey:r,userKey:a}=t,i=a?"/".concat(a):"";return await(new B).get("/asset/url/with/".concat(o,"/").concat(r).concat(i,"/").concat(e),n).then((({body:e})=>e))},download:async function(e,t={}){return await(new B).get("/asset/download/".concat(e),t).then((({body:e})=>e))},downloadWithScope:async function(e,t,n={}){const{scopeBoundary:o,scopeKey:r,userKey:a}=t,i=a?"/".concat(a):"";return await(new B).get("/asset/download/with/".concat(o,"/").concat(r).concat(i,"/").concat(e),n).then((({body:e})=>e))},store:async function(e,t,n={}){const{overwrite:o,fileName:r,...a}=n,i=null!=r?r:e.name;let c="";try{c=(await ee(i,t,a)).url}catch(e){if(!(e instanceof u))throw e;if(!(409===e.status&&o))throw e;c=(await te(i,t,a)).url}await s(c,{method:"PUT",body:e})}});!function(e){e.HEX="HEX",e.BASE_64="BASE_64"}(ne||(ne={}));var re=Object.freeze({__proto__:null,sendEmail:async function(e,t,n,o,r={}){const{accountShortName:a,projectShortName:i,server:s,familyNameFirst:c,html:u,attachments:l,from:h,replyTo:d,fromUserKey:p}=r;let f="";return p?f+="/as/".concat(p):h&&(f+="/from/".concat(h),d&&(f+="/".concat(d))),await(new B).withServer(s).withAccountShortName(a).withProjectShortName(i).post("/email/user/".concat(e,"/").concat(t).concat(f),{body:{subject:n,body:o,familyNameFirst:c,html:u,attachments:l}}).then((({body:e})=>e))},sendEmailToAdmin:async function(e,t,n,o={}){const{accountShortName:r,projectShortName:a,server:i,familyNameFirst:s,html:c,attachments:u}=o;return await(new B).withServer(i).withAccountShortName(r).withProjectShortName(a).post("/email/admin/".concat(e),{body:{subject:t,body:n,familyNameFirst:s,html:c,attachments:u}}).then((({body:e})=>e))}});var ae,ie=Object.freeze({__proto__:null,create:async function(e,t,n={}){const{draft:o,runLimit:r,...a}=n;return await(new B).post("/episode/".concat(t),{body:{name:e,draft:o,runLimit:r},...a}).then((({body:e})=>e))},get:async function(e,t={}){return await(new B).get("/episode/".concat(e),t).then((({body:e})=>e))},query:async function(e,t={}){const{filter:n=[],sort:o=[],first:r=0,max:a}=e;return await(new B).withSearchParams({filter:n.join(";")||void 0,sort:o.join(";")||void 0,first:r,max:a}).get("/episode/search",{paginated:!0,...t}).then((({body:e})=>e))},forGroup:async function(e,t={}){return await(new B).get("/episode/in/".concat(e),t).then((({body:e})=>e))},withName:async function(e,t={}){const{groupName:n,...o}=t,r=L.session;return await(new B).get("/episode/with/".concat(null!=n?n:null==r?void 0:r.groupName,"/").concat(e),o).then((({body:e})=>e))},remove:async function(e,t={}){return await(new B).delete("/episode/".concat(e),t).then((({body:e})=>e))}});async function se(e,t={}){const{filter:n=[],sort:o=[],first:r,max:a,quantized:i}=e,s={filter:n.join(";")||void 0,sort:o.join(";")||void 0,first:r,max:a};return await(new B).withSearchParams(s).get("/group".concat(i?"/quantized":"","/search"),{paginated:!0,...t}).then((({body:e})=>e))}!function(e){e.MEMBERS="MEMBERS",e.QUANTIZED="QUANTIZED"}(ae||(ae={}));var ce=Object.freeze({__proto__:null,get:async function(e={}){const{groupKey:t,augment:n,...o}=e;let r="";n===ae.MEMBERS&&(r="/member"),n===ae.QUANTIZED&&(r="/quantized");const a=L.session;return await(new B).get("/group".concat(r,"/").concat(null!=t?t:null==a?void 0:a.groupKey),o).then((({body:e})=>e))},destroy:async function(e,t={}){return await(new B).delete("/group/".concat(e),t).then((({body:e})=>e))},gather:async function(e={}){const{includeExpired:t,...n}=e;return await(new B).withSearchParams({includeExpired:t}).get("/group",n).then((({body:e})=>e))},update:async function(e,t,n={}){const{runLimit:o,organization:r,allowSelfRegistration:a,flightRecorder:i,event:s,allowMembershipChanges:c,pricing:u,startDate:l,expirationDate:h,capacity:d}=t;return await(new B).patch("/group/".concat(e),{body:{runLimit:o,organization:r,allowSelfRegistration:a,flightRecorder:i,event:s,allowMembershipChanges:c,pricing:u,startDate:l,expirationDate:h,capacity:d},...n}).then((({body:e})=>e))},create:async function(e,t={}){const{name:n,runLimit:o,organization:r,allowSelfRegistration:a,flightRecorder:i,event:s,allowMembershipChanges:u,pricing:l,startDate:h,expirationDate:d,capacity:p}=e;if(!n)throw new c("Cannot create a group with no name");return await(new B).post("/group",{body:{name:n,runLimit:o,organization:r,allowSelfRegistration:a,flightRecorder:i,event:s,allowMembershipChanges:u,pricing:l,startDate:h,expirationDate:d,capacity:p},...t}).then((({body:e})=>e))},query:se,search:async function(e={}){console.warn("DEPRECATION WARNING: groupAdapter.search is deprecated and will be removed with the next release. Use groupAdapter.query instead.");const{filter:t=[],sort:n=[],first:o,max:r,quantized:a,...i}=e,s={filter:t,sort:n,first:o,max:r,quantized:a};return await se(s,i)},withGroupName:async function(e,t={}){return await(new B).get("/group/with/".concat(e),t).then((({body:e})=>e))},forUser:async function(e,t={}){const{includeExpired:n,includeAllMembers:o,role:r,...a}=t,i=Array.isArray(r)&&r.length>0,s={includeExpired:n,includeAllMembers:o,role:r?i?r:[r]:void 0};return await(new B).withSearchParams(s).get("/group/member/for/".concat(e),a).then((({body:e})=>e))},getSessionGroups:async function(e={}){const{includeExpired:t,role:n,...o}=e,r=Array.isArray(n)&&n.length>0,a={includeExpired:t,role:n?r?n:[n]:void 0};return await(new B).withSearchParams(a).get("/group/member",o).then((({body:e})=>e))},whitelistUsers:async function(e,t={}){const{allow:n=!0,emails:o=["*"],...r}=t;return await(new B).post("/group/self/".concat(e),{body:{allow:n,emails:o},...r}).then((({body:e})=>e))},getWhitelistedUsers:async function(e,t={}){return await(new B).get("/group/self/".concat(e),t).then((({body:e})=>e))},sendRegistrationEmail:async function(e,t,n={}){const{redirectURL:o,linkURL:r,subject:a,...i}=n;return await(new B).post("/registration/self/".concat(e),{body:{email:t,linkUrl:r,redirectUrl:o,subject:a},...i}).then((({body:e})=>e))},selfRegister:async function(e,t,n={}){const{displayName:o,givenName:r,familyName:a,handle:i,...s}=n;return await(new B).patch("/registration/self/".concat(e),{body:{password:t,displayName:o,givenName:r,familyName:a,handle:i},...s}).then((({body:e})=>e))},addUser:async function(t,n={}){const{groupKey:o,...r}=n,a=Array.isArray(t)?t:[t],i=L.session;return await(new B).post("/group/member/".concat(null!=o?o:null==i?void 0:i.groupKey),{body:a.map((t=>{const n="string"==typeof t?t:t.userKey,o="string"==typeof t?e.ROLE.PARTICIPANT:t.role,r="string"==typeof t||t.available;return{role:o,userKey:n,objectType:"group",available:null==r||r}})),...r}).then((({body:e})=>e))},updateUser:async function(e,t,n={}){const{role:o,available:r}=t,{groupKey:a,...i}=n,s=L.session;return await(new B).patch("/group/member/".concat(null!=a?a:null==s?void 0:s.groupKey,"/").concat(e),{body:{objectType:"group",role:o,available:r},...i}).then((({body:e})=>e))},removeUser:async function(e,t={}){const{groupKey:n,...o}=t,r=Array.isArray(e)&&e.length>1,a=r?"":"/".concat(1===e.length?e[0]:e),i=r?{userKey:e}:void 0,s=L.session;return await(new B).withSearchParams(i).delete("/group/member/".concat(null!=n?n:null==s?void 0:s.groupKey).concat(a),o).then((({body:e})=>e))},statusUpdate:async function(e,t,n={}){const{groupKey:o,...r}=n,a=L.session;return await(new B).patch("/group/status/".concat(null!=o?o:null==a?void 0:a.groupKey),{body:{code:e,message:t},...r}).then((({body:e})=>e))}});async function ue(e,t,n,o={}){const{scopeBoundary:r,scopeKey:a}=t,{filter:i=[],sort:s=[],first:c,max:u}=n,l={filter:i.join(";")||void 0,sort:s.join(";")||void 0,first:c,max:u};return await(new B).withSearchParams(l).get("/leaderboard/".concat(r,"/").concat(a,"/").concat(e),o).then((({body:e})=>e))}var le=Object.freeze({__proto__:null,update:async function(e,t,n,o={}){const{tags:r,...a}=o,{scopeBoundary:i,scopeKey:s,userKey:c}=t,u=L.session;return await(new B).post("/leaderboard",{body:{scope:{scopeBoundary:i,scopeKey:s,userKey:null!=c?c:null==u?void 0:u.userKey},collection:e,scores:n,tags:r},...a}).then((({body:e})=>e))},list:ue,get:async function(e,t,n,o={}){return console.warn("DEPRECATION WARNING: leaderboardAdapter.get is deprecated and will be removed with the next release. Use leaderboardAdapter.list instead."),await ue(e,t,n,o)}});var he=Object.freeze({__proto__:null,connect:async function(){await J.handshake()},forGroup:async function(e,t={}){return await(new B).get("/presence/group/".concat(e),t).then((({body:e})=>e))},forWorld:async function(e,t={}){return await(new B).get("/presence/world/".concat(e),t).then((({body:e})=>e))}});var de=Object.freeze({__proto__:null,google:async function(e){return await(new B).withAccountShortName("epicenter").withProjectShortName("manager").post("/recaptcha/google",{body:{humanKey:e}}).then((({body:e})=>e))}});async function pe(t,n,o={}){const{scopeBoundary:r,scopeKey:a,userKey:i}=n,{readLock:s,writeLock:c,ephemeral:u,trackingKey:l,modelContext:h,executionContext:d,...p}=o,{WORLD:f}=e.SCOPE_BOUNDARY,y=L.session,m=s||c,g=Object.assign({},p.headers,m?{"X-Forio-Confirmation":!0}:{}),w=m?{readLock:s,writeLock:c}:void 0;return await(new B).post("/run",{body:{scope:{scopeBoundary:r,scopeKey:a,userKey:r===f?void 0:null!=i?i:null==y?void 0:y.userKey},permit:w,morphology:"MANY",trackingKey:l,modelFile:t,modelContext:h||{},executionContext:d||{},ephemeral:u},...p,headers:g}).then((({body:e})=>e))}async function fe(e,t,n={}){const{filter:o=[],sort:r=[],first:a,max:i,timeout:s,variables:c=[],metadata:u=[],scope:l,groupName:h,episodeName:d,includeEpisodes:p}=t,f=L.session,y=l?"".concat(l.scopeBoundary,"/").concat(l.scopeKey):"in/".concat(null!=h?h:null==f?void 0:f.groupName).concat(d?"/".concat(d):"");null!=l&&l.userKey&&o.push("run.userKey=".concat(l.userKey));const m={filter:o.join(";")||void 0,sort:r.join(";")||void 0,var:c.join(";")||void 0,meta:u.join(";")||void 0,first:a,max:i,timeout:s,includeEpisodes:p};return await(new B).withSearchParams(m).get("/run/".concat(y,"/").concat(e),{paginated:!0,parsePage:e=>e.map((e=>(e.variables=c.reduce(((t,n,o)=>{var r;return t[n]=null===(r=e.variables)||void 0===r?void 0:r[o],t}),{}),e))),...n}).then((({body:e})=>e))}async function ye(t,n,o={}){const{timeout:r,ritual:a,ignorable:i,...s}=o,c=Array.isArray(t)&&t.length>1;a!==e.RITUAL.EXORCISE&&c&&console.warn("Detected ritual: ".concat(a," usage with multiple runKeys; this not allowed. Defaulting to ritual: EXORCISE"));const u=e=>n.reduce(((t,n,o)=>(t[n]=e[o],t)),{}),l={timeout:r},h=c?"":"/".concat(1===t.length?t[0]:t),d=n.join(";"),p=c?{include:d,runKey:t}:{ritual:a,include:d},f=i?{ignorable:i}:{};return await(new B).withSearchParams(l).post("/run/variable".concat(h),{body:{...p,...f},...s}).then((({body:e})=>c?Object.keys(e).map((t=>({runKey:t,variables:u(e[t])}))):u(e)))}var me=Object.freeze({__proto__:null,create:pe,createSingular:async function(e,t={}){const{readLock:n,writeLock:o,ephemeral:r,modelContext:a,executionContext:i,...s}=t,c=n||o,u=Object.assign({},s.headers,c?{"X-Forio-Confirmation":!0}:{}),l=c?{readLock:n,writeLock:o}:void 0;return await(new B).post("/run/singular",{body:{modelFile:e,permit:l,modelContext:a||{},executionContext:i||{},ephemeral:r},...s,headers:u}).then((({body:e})=>e))},getSingularRunKey:async function(e={}){return await(new B).get("/run/singular/key",e).then((({body:e})=>e))},clone:async function(e,t={}){const{ephemeral:n,trackingKey:o,modelContext:r={},executionContext:a={},...i}=t;return await(new B).post("/run/clone/".concat(e),{body:{trackingKey:o,modelContext:r,executionContext:a,ephemeral:n},...i}).then((({body:e})=>e))},restore:async function(e,t={}){const{ephemeral:n,modelContext:o={},executionContext:r={},...a}=t;return await(new B).post("/run/restore/".concat(e),{body:{modelContext:o,executionContext:r,ephemeral:n},...a}).then((({body:e})=>e))},rewind:async function(e,t,n={}){const{ephemeral:o,modelContext:r={},...a}=n;return await(new B).post("/run/rewind/".concat(e),{body:{rewindCount:t,modelContext:r,ephemeral:o},...a}).then((({body:e})=>e))},update:async function(e,t,n={}){const{readLock:o,writeLock:r,trackingKey:a,marked:i,hidden:s,closed:c}=t,u=Array.isArray(e)&&e.length>1,l=u?"":"/".concat(1===e.length?e[0]:e),h=o||r?{readLock:o,writeLock:r}:void 0;return await(new B).withSearchParams(u?{runKey:e}:"").patch("/run".concat(l),{body:{permit:h,trackingKey:a,marked:i,hidden:s,closed:c},...n}).then((({body:e})=>e))},remove:async function(e,t={}){return await(new B).delete("/run/".concat(e),t).then((({body:e})=>e))},get:async function(e,t={}){return await(new B).get("/run/".concat(e),t).then((({body:e})=>e))},query:fe,introspect:async function(e,t={}){return await(new B).get("/run/introspect/model/".concat(e),t).then((({body:e})=>e))},introspectWithRunKey:async function(e,t={}){return await(new B).get("/run/introspect/".concat(e),t).then((({body:e})=>e))},operation:async function(t,n,o=[],r={}){const{timeout:a,ritual:i,...s}=r,c=Array.isArray(t)&&t.length>1,u=c?"":"/".concat(1===t.length?t[0]:t),l=c?{runKey:t,timeout:a}:{ritual:i,timeout:a};return i!==e.RITUAL.EXORCISE&&c&&console.warn("Detected ritual: ".concat(i," usage with multiple runKeys; this not allowed. Defaulting to ritual: EXORCISE")),await(new B).withSearchParams(l).post("/run/operation".concat(u),{body:{name:n,arguments:o,objectType:"execute"},...s}).then((({body:e})=>e))},getVariables:ye,getVariable:async function(e,t,n={}){const{timeout:o,ritual:r,...a}=n;if(Array.isArray(e)||Array.isArray(t)){return ye(e,Array.isArray(t)?t:[t],n)}return await(new B).withSearchParams({timeout:o,ritual:r}).get("/run/variable/".concat(e,"/").concat(t),a).then((({body:e})=>e))},updateVariables:async function(t,n,o={}){const{timeout:r,ritual:a,...i}=o,s=Array.isArray(t)&&t.length>1,c=s?"":"/".concat(1===t.length?t[0]:t),u=s?{runKey:t,timeout:r}:{ritual:a,timeout:r};return a!==e.RITUAL.EXORCISE&&s&&console.warn("Detected ritual: ".concat(a," usage with multiple runKeys; this not allowed. Defaulting to ritual: EXORCISE")),await(new B).withSearchParams(u).patch("/run/variable".concat(c),{body:n,...i}).then((({body:e})=>e))},getMetadata:async function(e,t,n={}){const{timeout:o,...r}=n,a=t.join(";"),i=Array.isArray(e)&&e.length>1,s={timeout:o},c=Array.isArray(e)?e:[e];return await(new B).withSearchParams(s).post("/run/meta",{body:{include:a,runKey:c},...r}).then((({body:e})=>{var t;const n=Object.keys(e).map((t=>({runKey:t,data:e[t]})));return i?n:null==n||null===(t=n[0])||void 0===t?void 0:t.data}))},updateMetadata:async function(e,t,n={}){const{timeout:o,...r}=n,a=Array.isArray(e)&&e.length>1,i=a?"":"/".concat(1===e.length?e[0]:e),s=a?{runKey:e,timeout:o}:{timeout:o};return await(new B).withSearchParams(s).patch("/run/meta".concat(i),{body:t,...r}).then((({body:e})=>e))},action:async function(t,n,o={}){const{timeout:r,ritual:a,...i}=o,s=Array.isArray(t)&&t.length>1,c=s?"":"/".concat(1===t.length?t[0]:t),u=s?{runKey:t,timeout:r}:{ritual:a,timeout:r};return a!==e.RITUAL.EXORCISE&&s&&console.warn("Detected ritual: ".concat(a," usage with multiple runKeys; this not allowed. Defaulting to ritual: EXORCISE")),await(new B).withSearchParams(u).post("/run/action".concat(c),{body:n,...i}).then((({body:e})=>e))},retrieveFromWorld:async function(e,t,n={}){const{readLock:o,writeLock:r,ephemeral:a,trackingKey:i,modelContext:s,executionContext:c,...u}=n,l=o||r,h=Object.assign({},u.headers,l?{"X-Forio-Confirmation":!0}:{}),d=l?{readLock:o,writeLock:r}:void 0;return await(new B).post("/run/world/".concat(e),{body:{permit:d,morphology:"MANY",trackingKey:i,modelFile:t,modelContext:s||{},executionContext:c||{},ephemeral:a},...u,headers:h}).then((({body:e})=>e))},removeFromWorld:async function(e,t={}){return await(new B).delete("/run/world/".concat(e),t).then((({body:e})=>e))},getWithStrategy:async function(e,t,n,o={}){if("reuse-across-sessions"===e){const e={scope:n,sort:["-run.created"],max:1},{values:[r]}=await fe(t,e);if(!r){return await pe(t,n,o)}return r}if("reuse-never"===e){return await pe(t,n,o)}throw new c("Invalid run strategy.")},migrate:async function(e,t,n={}){const{ephemeral:o,trackingKey:r,modelContext:a={},executionContext:i={},...s}=n;return await(new B).post("/run/migrate/to/".concat(t,"/").concat(e),{body:{trackingKey:r,modelContext:a,executionContext:i,ephemeral:o},...s}).then((({body:e})=>e))}});var ge=Object.freeze({__proto__:null,uploadCSV:async function(e,t={}){const{overwrite:n,...o}=t,r=new FormData;return r.append("file",e),await(new B).withSearchParams({overwrite:n}).post("/user/upload",{body:r,...o}).then((({body:e})=>e))},createUser:async function(e,t={}){return await(new B).post("/user",{body:e,...t}).then((({body:e})=>e))},get:async function(e,t={}){return await(new B).get("/user/".concat(e),t).then((({body:e})=>e))},getWithHandle:async function(e,t={}){const{modality:n,...o}=t,r=n?"/".concat(n):"";return await(new B).get("/user/with/".concat(e).concat(r),o).then((({body:e})=>e))}});async function we(t,n,o={}){const{scopeBoundary:r,scopeKey:a,userKey:i}=n,{readLock:s,writeLock:c,items:u,ttlSeconds:l,mutationStrategy:h="ERROR",...d}=o,{WORLD:p}=e.SCOPE_BOUNDARY,{PARTICIPANT:f,USER:y}=e.ROLE,m=r===p?f:y,g={mutationStrategy:h};return await(new B).withSearchParams(g).post("/vault/".concat(t),{body:{scope:{scopeBoundary:r,scopeKey:a,userKey:i},permit:{readLock:s||m,writeLock:c||m},ttlSeconds:l,items:u},...d}).then((({body:e})=>e))}var be=Object.freeze({__proto__:null,update:async function(e,t,n={}){var o,r,a;const{mutationKey:i,...s}=n;return await(new B).withSearchParams({MutationKey:i}).put("/vault/".concat(e),{body:{set:null!==(o=t.set)&&void 0!==o?o:{},push:null!==(r=t.push)&&void 0!==r?r:{},pop:null!==(a=t.pop)&&void 0!==a?a:{}},...s}).then((({body:e})=>e))},get:async function(e,t={}){return await(new B).get("/vault/".concat(e),t).catch((e=>404===e.status?{body:void 0}:Promise.reject(e))).then((({body:e})=>e))},withScope:async function(e,t,n={}){const{scopeBoundary:o,scopeKey:r,userKey:a}=t,i=a?"/".concat(a):"";return await(new B).get("/vault/with/".concat(o,"/").concat(r).concat(i,"/").concat(e),n).catch((e=>404===e.status?{body:void 0}:Promise.reject(e))).then((({body:e})=>e))},byName:async function(e,t={}){const{groupName:n,episodeName:o,userKey:r,includeEpisodes:a,...i}=t,s=L.session,c={userKey:r,includeEpisodes:a};return await(new B).withSearchParams(c).get("/vault/in/".concat(null!=n?n:null==s?void 0:s.groupName).concat(o?"/".concat(o):"","/").concat(e),{...i}).then((({body:e})=>e))},remove:async function(e,t={}){const{mutationKey:n,...o}=t;return await(new B).withSearchParams({MutationKey:n}).delete("/vault/".concat(e),o).then((({body:e})=>e))},define:we,create:async function(e,t,n,o={}){return console.warn("DEPRECATION WARNING: vaultAdapter.create is deprecated and will be removed with the next release. Use vaultAdapter.define instead."),await we(e,t,{items:n,...o})},list:async function(e,t={}){const{first:n,filter:o=[],max:r}=e,a={filter:o.join(";")||void 0,first:n,max:r};return(new B).withSearchParams(a).get("/vault/search",t).then((({body:e})=>e))}});let ve,Se,_e,Te;async function Ee(e,t,n={}){return await(new B).get("/video/url/".concat(t,"/").concat(e),n).then((({body:e})=>e))}async function xe(e,t,n,o,r={}){const{scopeBoundary:a,scopeKey:i,userKey:s}=o,c=s?"/".concat(s):"";return await(new B).get("/video/url/with/".concat(a,"/").concat(i).concat(c,"/").concat(n,"/").concat(t,"/").concat(e),r).then((({body:e})=>e))}async function Ae(e,t={}){return await(new B).get("/video/url/".concat(e),t).then((({body:e})=>e))}async function Re(e,t,n,o={}){const{scopeBoundary:r,scopeKey:a,userKey:i}=n,s=i?"/".concat(i):"";return await(new B).get("/video/dir/with/".concat(r,"/").concat(a).concat(s,"/").concat(t,"/").concat(e),o).then((({body:e})=>e))}async function Ne(e={}){return await(new B).get("/video/search",e).then((({body:e})=>e))}async function Oe(e,t={}){return await(new B).delete("/video/".concat(e),t).then((({body:e})=>e))}async function Pe(e,t,n={}){return await(new B).post("/video/execute/".concat(e),{body:t,...n}).then((({body:e})=>e))}async function ke(e,t,n={}){return await(new B).get("/video/download/".concat(t,"/").concat(e),n).then((({body:e})=>e))}async function Ie(e,t,n,o,r={}){const{scopeBoundary:a,scopeKey:i,userKey:s}=o,c=s?"/".concat(s):"";return await(new B).get("/video/download/with/".concat(a,"/").concat(i).concat(c,"/").concat(n,"/").concat(t,"/").concat(e),r).then((({body:e})=>e))}!function(e){e.VONAGE="VONAGE",e.DAILY="DAILY",e.DOMESTIC="DOMESTIC"}(ve||(ve={})),function(e){e.transcription="transcription"}(Se||(Se={})),function(e){e.mp3="mp3",e.mp4="mp4",e.wav="wav",e.flac="flac",e.ogg="ogg",e.amr="amr",e.webm="webm"}(_e||(_e={})),function(e){e["af-ZA"]="af-ZA",e["ar-AE"]="ar-AE",e["ar-SA"]="ar-SA",e["cy-GB"]="cy-GB",e["da-DK"]="da-DK",e["de-CH"]="de-CH",e["de-DE"]="de-DE",e["en-AB"]="en-AB",e["en-AU"]="en-AU",e["en-GB"]="en-GB",e["en-IE"]="en-IE",e["en-IN"]="en-IN",e["en-US"]="en-US",e["en-WL"]="en-WL",e["es-ES"]="es-ES",e["es-US"]="es-US",e["fa-IR"]="fa-IR",e["fr-CA"]="fr-CA",e["fr-FR"]="fr-FR",e["ga-IE"]="ga-IE",e["gd-GB"]="gd-GB",e["he-IL"]="he-IL",e["hi-IN"]="hi-IN",e["id-ID"]="id-ID",e["it-IT"]="it-IT",e["ja-JP"]="ja-JP",e["ko-KR"]="ko-KR",e["nl-NL"]="nl-NL",e["pt-BR"]="pt-BR",e["pt-PT"]="pt-PT",e["ru-RU"]="ru-RU",e["ta-IN"]="ta-IN",e["te-IN"]="te-IN",e["tr-TR"]="tr-TR",e["zh-CN"]="zh-CN",e["zh-TW"]="zh-TW",e["th-TH"]="th-TH",e["en-ZA"]="en-ZA",e["en-NZ"]="en-NZ"}(Te||(Te={}));var Ce=Object.freeze({__proto__:null,get AFFILIATE(){return ve},get PROCESSING_TYPE(){return Se},get MEDIA_FORMAT(){return _e},get LANGUAGE_CODE(){return Te},getVideoURLByKey:Ee,getVideoURLWith:xe,getVideoDirectoryByKey:Ae,getVideoDirectoryWith:Re,getVideoSearch:Ne,deleteVideoByKey:Oe,postVideoProcessor:Pe,downloadVideoByKey:ke,downloadVideoWith:Ie});async function Le(e,t={}){const{scope:n,affiliate:o,family:r,videoKey:a,...i}=t;if(n&&r&&o)return xe(e,r,o,n,i);if(a)return Ee(e,a,i);throw new c("Cannot get video URL -- either a video key or scope/affiliate/family specification is required.")}async function je(e={}){const{scope:t,affiliate:n,family:o,videoKey:r,...a}=e;if(t&&o&&n)return Re(o,n,t,a);if(r)return Ae(r,a);throw new c("Cannot get video URL -- either a video key or scope/affiliate/family specification is required.")}var Ue=Object.freeze({__proto__:null,remove:async function(e,t={}){return Oe(e,t)},query:async function(e,t={}){const{filter:n=[],sort:o=[],first:r,max:a}=e;return Ne({query:{filter:n.join(";")||void 0,sort:o.join(";")||void 0,first:r,max:a},paginated:!0,...t})},getURL:Le,getDirectoryURL:je,processVideo:async function(e,t,n={}){const{log:o,...r}=n;return Pe(e,{processors:t,log:o},r)},download:async function(e,t={}){const{scope:n,affiliate:o,family:r,videoKey:a,...i}=t;throw n&&r&&o&&Ie(e,r,o,n,i),a&&ke(e,a,i),new c("Cannot download video -- either a video key or scope/affiliate/family specification is required.")}});async function De(e={}){return await(new B).get("/vonage/session",e).then((({body:e})=>e))}async function Be(e,t={}){return await(new B).post("/vonage/token",{body:{...e,initialLayoutClassList:["placeholder"]},...t}).then((({body:e})=>e))}async function Ke(e,t={}){return await(new B).post("/vonage/archive",{body:e,...t}).then((({body:e})=>e))}async function Me(e={}){return await(new B).get("/vonage/info",e).then((({body:e})=>e))}async function ze(e,t={}){return await(new B).delete("/vonage/archive/".concat(e),t).then((({body:e})=>e))}var Fe=Object.freeze({__proto__:null,getSession:De,postToken:Be,postArchive:Ke,getInfo:Me,deleteArchiveByID:ze});var qe,He,Ge,We=Object.freeze({__proto__:null,getProjectID:async function(e={}){return(await Me(e)).apiKey},createSession:async function(e={}){return De(e)},generateToken:async function(e,t={}){return(await Be({sessionId:e},t)).token},startArchive:async function(t,n,o,r={}){const{readLock:a,writeLock:i,ttlSeconds:s,resolution:c,...u}=r,{PARTICIPANT:l,USER:h}=e.ROLE,d=o.userKey?h:l;return Ke({name:t,sessionId:n,scope:o,permit:{readLock:null!=a?a:d,writeLock:null!=i?i:d},ttlSeconds:s,resolution:c},u)},stopArchive:async function(e,t={}){return ze(e,t)}});!function(e){e.MINIMUM="MINIMUM",e.MAXIMUM="MAXIMUM"}(qe||(qe={})),function(e){e.GROUP="GROUP",e.EPISODE="EPISODE"}(He||(He={})),function(e){e.colorAnimal="colorAnimal",e.sequential="sequential"}(Ge||(Ge={}));var Ve=Object.freeze({__proto__:null,update:async function(e,t,n={}){const{name:o,runKey:r}=t;return await(new B).patch("/world/".concat(e),{body:{name:o,runKey:r},...n}).then((({body:e})=>e))},destroy:async function(e,t={}){return await(new B).delete("/world/".concat(e),t).then((({body:e})=>e))},create:async function(e={}){const{name:t,groupName:n,episodeName:o,worldNameGenerator:r,...a}=e,i=L.session;return await(new B).post("/world/".concat(null!=n?n:null==i?void 0:i.groupName).concat(o?"/".concat(o):""),{body:{name:t,worldNameGenerator:r},...a}).then((({body:e})=>e))},get:async function(e={}){const{groupName:t,episodeName:n,mine:o,...r}=e,a=L.session;return await(new B).withSearchParams({mine:o}).get("/world/".concat(null!=t?t:null==a?void 0:a.groupName).concat(n?"/".concat(n):""),r).then((({body:e})=>e))},getAssignments:async function(e={}){const{groupName:t,episodeName:n,mine:o,...r}=e,a=L.session;return await(new B).withSearchParams({mine:o}).get("/world/assignment/for/".concat(null!=t?t:null==a?void 0:a.groupName).concat(n?"/".concat(n):""),r).then((({body:e})=>e))},getSessionWorlds:async function(e={}){return await(new B).get("/world/assignment",e).then((({body:e})=>e))},selfAssign:async function(e={}){const{role:t,groupName:n,episodeName:o,objective:r=qe.MINIMUM,worldNameGenerator:a,...i}=e,s=L.session;return await(new B).post("/world/selfassign/".concat(null!=n?n:null==s?void 0:s.groupName).concat(o?"/".concat(o):""),{body:{role:t,objective:r,worldNameGenerator:a},...i}).then((({body:e})=>e))},autoAssignUsers:async function(e,t={}){const{groupName:n,episodeName:o,objective:r=qe.MINIMUM,requireAllAssignments:a,worldNameGenerator:i,keepEmptyWorlds:s,...c}=t,u=L.session;return await(new B).post("/world/assignment/".concat(null!=n?n:null==u?void 0:u.groupName).concat(o?"/".concat(o):""),{body:{assignments:e,objective:r,requireAllAssignments:a,worldNameGenerator:i,keepEmptyWorlds:s},...c}).then((({body:e})=>e))},editAssignments:async function(e,t={}){const{groupName:n,episodeName:o,objective:r=qe.MINIMUM,requireAllAssignments:a,keepEmptyWorlds:i,...s}=t,c=L.session;return await(new B).put("/world/assignment/".concat(null!=n?n:null==c?void 0:c.groupName).concat(o?"/".concat(o):""),{body:{assignments:e,objective:r,requireAllAssignments:a,keepEmptyWorlds:i},...s}).then((({body:e})=>e))},getAssignmentsByKey:async function(e,t={}){return await(new B).get("/world/assignment/".concat(e),t).then((({body:e})=>e))},removeUsers:async function(e,t={}){const{groupName:n,episodeName:o,keepEmptyWorlds:r,...a}=t,i=L.session;return await(new B).withSearchParams({userKey:e,keepEmptyWorlds:Boolean(r)}).delete("/world/assignment/".concat(null!=n?n:null==i?void 0:i.groupName).concat(o?"/".concat(o):""),a).then((({body:e})=>e))},getPersonas:async function(t,n={}){const{scopeBoundary:o,scopeKey:r}=t,a=o||e.SCOPE_BOUNDARY.PROJECT,i=a===e.SCOPE_BOUNDARY.PROJECT?"":"/".concat(r);return await(new B).get("/world/persona/".concat(a.toLowerCase()).concat(i),{...n}).then((({body:e})=>e))},setPersonas:async function(t,n,o={}){const{scopeBoundary:r,scopeKey:a}=n,i=r||e.SCOPE_BOUNDARY.PROJECT,s=i===e.SCOPE_BOUNDARY.PROJECT?"":"/".concat(a);return await(new B).put("/world/persona/".concat(i.toLowerCase()).concat(s),{body:t,...o}).then((({body:e})=>e))},assignRun:async function(e,t,n={}){return await(new B).patch("/world/run/".concat(e),{body:{runKey:t},...n}).then((({body:e})=>e))}});var Ye,Xe=Object.freeze({__proto__:null,get:async function(e={}){return await(new B).get("/time",e).catch((e=>404===e.status?{body:void 0}:Promise.reject(e))).then((({body:e})=>e))}});!function(e){e.DO_NOTHING="DO_NOTHING",e.RESCHEDULE="RESCHEDULE",e.FIRE_ON_FAIL_SAFE="FIRE_ON_FAIL_SAFE"}(Ye||(Ye={}));var Je=Object.freeze({__proto__:null,create:async function(e,t,n,o,r={}){const{retryPolicy:a,failSafeTermination:i,ttlSeconds:s,...c}=r;return await(new B).post("/task",{body:{payload:{objectType:"http",...n},trigger:o,retryPolicy:a,failSafeTermination:i,ttlSeconds:s,scope:e,name:t},...c}).then((({body:e})=>e))},destroy:async function(e,t={}){return await(new B).delete("/task/".concat(e),t).then((({body:e})=>e))},get:async function(e,t={}){return await(new B).get("/task/".concat(e),t).then((({body:e})=>e))},getHistory:async function(e,t={}){return await(new B).get("/task/history/".concat(e),t).then((({body:e})=>e))},getTaskIn:async function(e,t={}){const{scopeBoundary:n,scopeKey:o,userKey:r}=e;return await(new B).get("/task/in/".concat(n,"/").concat(o).concat(r?"/".concat(r):""),t).then((({body:e})=>e))}});var Ze=Object.freeze({__proto__:null,updatePermit:async function(e,t,n={}){return(new B).patch("/chat/".concat(e),{...n,body:{permit:t}}).then((({body:e})=>e))},create:async function(e,t,n,o={}){return(new B).post("/chat",{body:{scope:{scopeBoundary:t.scopeBoundary,scopeKey:t.scopeKey},permit:n,room:e},...o}).then((({body:e})=>e))},get:async function(e,t={}){return(new B).get("/chat/".concat(e),t).then((({body:e})=>e))},query:async function(e,t={}){const{filter:n=[],sort:o=[],first:r=0,max:a}=e,i={filter:n.join(";")||void 0,sort:o.join(";")||void 0,first:r,max:a};return await(new B).withSearchParams(i).get("/chat/search",{paginated:!0,...t}).then((({body:e})=>e))},sendMessage:async function(e,t,n={}){const{userKey:o,...r}=n,a=o?"/".concat(o):"";return(new B).put("/chat/message/".concat(e).concat(a),{body:{message:t},...r}).then((({body:e})=>e))},getMessages:async function(e,t={}){const{maxRecords:n,horizon:o,...r}=t;return(new B).withSearchParams({maxRecords:n,horizon:o}).get("/chat/message/".concat(e),r).then((({body:e})=>e))}});var $e=Object.freeze({__proto__:null,create:async function(e,t,n,o,r,a={}){const{ttlSeconds:i,transparent:s=!1,...c}=a;return await(new B).post("/consensus/".concat(e,"/").concat(t,"/").concat(n),{body:{expectedRoles:o,ttlSeconds:i,transparent:s,actions:r},...c}).then((({body:e})=>e))},load:async function(e,t,n,o={}){return await(new B).get("/consensus/".concat(e,"/").concat(t,"/").concat(n),o).then((({body:e})=>e))},list:async function(e,t,n={}){return await(new B).get("/consensus/".concat(e,"/").concat(t),n).then((({body:e})=>e))},forceClose:async function(e,t,n,o={}){const{ritual:r,...a}=o;return await(new B).post("/consensus/close/".concat(e,"/").concat(t,"/").concat(n),{body:{ritual:r},...a}).then((({body:e})=>e))},updateDefaults:async function(e,t,n,o,r={}){const{...a}=r;return await(new B).patch("/consensus/actions/".concat(e,"/").concat(t,"/").concat(n),{body:{actions:o},...a}).then((({body:e})=>e))},submitActions:async function(e,t,n,o,r={}){const{message:a,ritual:i,...s}=r;return await(new B).post("/consensus/publish/".concat(e,"/").concat(t,"/").concat(n),{body:{ritual:i,actions:o,message:a},...s}).then((({body:e})=>e))},deleteBarrier:async function(e,t,n,o={}){const{...r}=o;return await(new B).delete("/consensus/".concat(e,"/").concat(t,"/").concat(n),{...r}).then((({body:e})=>e))},deleteAll:async function(e,t,n={}){const{...o}=n;return await(new B).delete("/consensus/".concat(e,"/").concat(t),{...o}).then((({body:e})=>e))},undoSubmit:async function(e,t,n,o={}){const{...r}=o;return await(new B).delete("/consensus/arrival/".concat(e,"/").concat(t,"/").concat(n),{...r}).then((({body:e})=>e))},triggerFor:async function(e,t,n,o,r,a={}){const{ritual:i,message:s,...c}=a;return await(new B).post("/consensus/trigger/".concat(e,"/").concat(t,"/").concat(n),{body:{ritual:i,userKey:o,message:s,actions:r},...c}).then((({body:e})=>e))}});var Qe=Object.freeze({__proto__:null,create:async function(e,t={}){const{givenName:n,familyName:o,accountId:r,...a}=t;return await(new B).post("/somebody",{body:{email:e,givenName:n,familyName:o,accountId:r},...a}).then((({body:e})=>e))},query:async function(e,t={}){const{filter:n=[],sort:o=[],first:r=0,max:a,count:i=!1}=e,s={filter:n.join(";")||void 0,sort:o.join(";")||void 0,first:r,max:a,count:i};return await(new B).withSearchParams(s).get("/somebody/search",{paginated:!0,...t}).then((({body:e})=>e))}});var et,tt,nt,ot=Object.freeze({__proto__:null,create:async function(e,t,n,o={}){const{accountShortName:r,projectShortName:a,server:i}=o;return await(new B).withServer(i).withAccountShortName(r).withProjectShortName(a).post("/matchmaker/udome/".concat(e),{body:{scope:n,partners:t}}).then((({body:e})=>e))},edit:async function(e,t,n={}){const{accountShortName:o,projectShortName:r,server:a}=n;return await(new B).withServer(a).withAccountShortName(o).withProjectShortName(r).put("/matchmaker/udome/".concat(e),{body:{closed:t}}).then((({body:e})=>e))},addUser:async function(e,t={}){const{accountShortName:n,projectShortName:o,server:r}=t;return await(new B).withServer(r).withAccountShortName(n).withProjectShortName(o).patch("/matchmaker/udome",{body:{udomeKey:e}}).then((({body:e})=>e))},get:async function(e,t={}){const{accountShortName:n,projectShortName:o,server:r}=t;return await(new B).withServer(r).withAccountShortName(n).withProjectShortName(o).get("/matchmaker/udome/".concat(e)).catch((e=>404===e.status?{body:void 0}:Promise.reject(e))).then((({body:e})=>e))},byName:async function(e,t,n={}){const{accountShortName:o,projectShortName:r,server:a}=n,{scopeBoundary:i,scopeKey:s}=t;return await(new B).withServer(a).withAccountShortName(o).withProjectShortName(r).get("/matchmaker/udome/".concat(i,"/").concat(s,"/").concat(e)).catch((e=>404===e.status?{body:void 0}:Promise.reject(e))).then((({body:e})=>e))}});!function(e){e[e.CLOUD=0]="CLOUD"}(et||(et={})),function(e){e[e.PRIVATE=0]="PRIVATE"}(tt||(tt={})),function(e){e[e.HLS=0]="HLS"}(nt||(nt={}));const rt=[[6e3,1e4],[11e3,2e4],[3e4,45e3]];async function at(e,t=0){let n;try{n=await e()}catch(r){if(!(r instanceof u&&429===r.status&&t<=rt.length))throw r;{const[r,a]=rt[t];await(o=((e,t)=>e+Math.random()*(t-e))(r,a),new Promise((e=>setTimeout(e,o)))),n=await at(e,t+1)}}var o;return n}var it=Object.freeze({__proto__:null,getConfig:async function(e={}){return await(new B).get("/daily/v1",e).then((({body:e})=>e))},createRoom:async function(t,n={}){const{readLock:o,writeLock:r,ttlSeconds:a,privacy:i,exp:s,enable_recording:c,streaming_endpoints:u,disableRateLimitHandling:l,...h}=n,{PARTICIPANT:d}=e.ROLE;return at((async()=>await(new B).post("/daily/v1/room",{body:{epicenter:{ttlSeconds:a,scope:t,permit:{readLock:o||d,writeLock:r||d}},properties:{exp:s,enable_recording:c,streaming_endpoints:u},privacy:i},...h}).then((({body:e})=>e))),l?rt.length+1:0)},createToken:async function(e,t={}){const{start_video_off:n,is_owner:o,user_name:r,close_tab_on_exit:a,exp:i,enable_recording:s,disableRateLimitHandling:c,selfSign:u=!0,...l}=t;return at((async()=>await(new B).withSearchParams({selfSign:u}).post("/daily/v1/meetingToken",{body:{properties:{room_name:e,start_video_off:n,is_owner:o,user_name:r,close_tab_on_exit:a,exp:i,enable_recording:s}},...l}).then((({body:e})=>e))),c?rt.length+1:0)},getVideoByRecordingId:async function(e,t,n,o={}){const r=(await je({scope:n,affiliate:"DAILY",family:e,...o})).contents;if(null==r||!r.length)return null;r.sort(((e,t)=>Number(t.split(".")[0])-Number(e.split(".")[0])));const a=r.find((e=>e.includes(t)&&e.includes(".mp4")));return a?await Le(a,{scope:n,affiliate:"DAILY",family:e,...o}):null},updateRecordingStatus:async function(e,t={}){return await(new B).delete("/daily/v1/meetingToken/".concat(e),t).then((({body:e})=>e))}});var st=Object.freeze({__proto__:null,proxy:async(e,t)=>{const{accountShortName:n,projectShortName:o,isLocal:r}=O;let a=N("/",e);return r()||(a="/proxy/".concat(n,"/").concat(o).concat(a)),s(a,t)}});const ct="Epicenter (v".concat("3.23.3",") for Browsers | Build Date: 2023-11-02T22:12:09.447Z");j.registerHandler((e=>"COMETD_RECONNECTED"===e.code),(async e=>{A()&&console.warn('Cometd Reconnected. If you wish to react to this reconnection, register an error handler with identifier: error.code === "COMETD_RECONNECTED".',e)})),j.registerHandler((e=>403===e.status&&"COMETD_ERROR"===e.code),(async(e,t)=>(console.warn("Cometd error. Attempting to reconnect.",e),await J.disconnect(),await t()))),j.registerHandler((e=>401===e.status&&"AUTHENTICATION_EXPIRED"===e.code),(async e=>{throw await Z(),A()&&alert("Session token has expired, try logging in again."),e})),j.registerHandler((e=>401===e.status&&"AUTHENTICATION_GROUP_EXPIRED"===e.code),(async e=>{throw A()&&alert("This group has expired. Try logging into a different group"),e})),j.registerHandler((e=>401===e.status&&"AUTHENTICATION_INVALIDATED"===e.code),(async(e,t)=>{try{var n;const e=L.session;if("admin"===(null==e?void 0:e.objectType))throw new c("Unhandled error: admin session was somehow invalidated");const o=null!==(n=null==e?void 0:e.groupKey)&&void 0!==n?n:"";return await $(o,{objectType:"user",inert:!0}),await t()}catch(t){throw await Z(),e}}));var ut=r((function(e,t){e.exports=function(){var e=function(){var e=0,t={};this.register=function(n){var o=++e;return t[o]=n,o},this.unregister=function(e){var n=t[e];return delete t[e],n},this.setTimeout=function(e,t){return window.setTimeout(e,t)},this.clearTimeout=function(e){window.clearTimeout(e)}};function t(){var e={};self.onmessage=function(t){var n=t.data,o=e[n.id];switch(n.type){case"setTimeout":e[n.id]=self.setTimeout((function(){delete e[n.id],self.postMessage({id:n.id})}),n.delay);break;case"clearTimeout":delete e[n.id],o&&self.clearTimeout(o);break;default:throw"Unknown command "+n.type}}}var n={isString:function(e){return null!=e&&("string"==typeof e||e instanceof String)},isArray:function(e){return null!=e&&e instanceof Array},inArray:function(e,t){for(var n=0;n<t.length;++n)if(e===t[n])return n;return-1}},o=function(){var e=[],t={};this.getTransportTypes=function(){return e.slice(0)},this.findTransportTypes=function(n,o,r){for(var a=[],i=0;i<e.length;++i){var s=e[i];!0===t[s].accept(n,o,r)&&a.push(s)}return a},this.negotiateTransport=function(n,o,r,a){for(var i=0;i<e.length;++i)for(var s=e[i],c=0;c<n.length;++c)if(s===n[c]){var u=t[s];if(!0===u.accept(o,r,a))return u}return null},this.add=function(n,o,r){for(var a=!1,i=0;i<e.length;++i)if(e[i]===n){a=!0;break}return a||("number"!=typeof r?e.push(n):e.splice(r,0,n),t[n]=o),!a},this.find=function(n){for(var o=0;o<e.length;++o)if(e[o]===n)return t[n];return null},this.remove=function(n){for(var o=0;o<e.length;++o)if(e[o]===n){e.splice(o,1);var r=t[n];return delete t[n],r}return null},this.clear=function(){e=[],t={}},this.reset=function(n){for(var o=0;o<e.length;++o)t[e[o]].reset(n)}},r=function(){var e,t,o;this.registered=function(n,o){e=n,t=o},this.unregistered=function(){e=null,t=null},this._debug=function(){t._debug.apply(t,arguments)},this._mixin=function(){return t._mixin.apply(t,arguments)},this.getConfiguration=function(){return t.getConfiguration()},this.getAdvice=function(){return t.getAdvice()},this.setTimeout=function(e,n){return t.setTimeout(e,n)},this.clearTimeout=function(e){t.clearTimeout(e)},this.convertToMessages=function(e){if(n.isString(e))try{return JSON.parse(e)}catch(t){throw this._debug("Could not convert to JSON the following string",'"'+e+'"'),t}if(n.isArray(e))return e;if(null==e)return[];if(e instanceof Object)return[e];throw"Conversion Error "+e+", typeof "+typeof e},this.accept=function(e,t,n){throw"Abstract"},this.getType=function(){return e},this.getURL=function(){return o},this.setURL=function(e){o=e},this.send=function(e,t){throw"Abstract"},this.reset=function(t){this._debug("Transport",e,"reset",t?"initial":"retry")},this.abort=function(){this._debug("Transport",e,"aborted")},this.toString=function(){return this.getType()}};r.derive=function(e){function t(){}return t.prototype=e,new t};var a=function(){var e=new r,t=r.derive(e),o=0,a=null,i=[],s=[];function c(e){for(;s.length>0;){var t=s[0],n=t[0],o=t[1];if(n.url!==e.url||n.sync!==e.sync)break;s.shift(),e.messages=e.messages.concat(n.messages),this._debug("Coalesced",n.messages.length,"messages from request",o.id)}}function u(e,t){if(this.transportSend(e,t),t.expired=!1,!e.sync){var n=this.getConfiguration().maxNetworkDelay,o=n;!0===t.metaConnect&&(o+=this.getAdvice().timeout),this._debug("Transport",this.getType(),"waiting at most",o,"ms for the response, maxNetworkDelay",n);var r=this;t.timeout=this.setTimeout((function(){t.expired=!0;var n="Request "+t.id+" of transport "+r.getType()+" exceeded "+o+" ms max network delay",a={reason:n},i=t.xhr;a.httpCode=r.xhrStatus(i),r.abortXHR(i),r._debug(n),r.complete(t,!1,t.metaConnect),e.onFailure(i,e.messages,a)}),o)}}function l(e){var t=++o,n={id:t,metaConnect:!1,envelope:e};i.length<this.getConfiguration().maxConnections-1?(i.push(n),u.call(this,e,n)):(this._debug("Transport",this.getType(),"queueing request",t,"envelope",e),s.push([e,n]))}function h(e){var t=e.id;if(this._debug("Transport",this.getType(),"/meta/connect complete, request",t),null!==a&&a.id!==t)throw"/meta/connect request mismatch, completing request "+t;a=null}function d(e,t){var o=n.inArray(e,i);if(o>=0&&i.splice(o,1),s.length>0){var r=s.shift(),a=r[0],u=r[1];if(this._debug("Transport dequeued request",u.id),t)this.getConfiguration().autoBatch&&c.call(this,a),l.call(this,a),this._debug("Transport completed request",e.id,a);else{var h=this;this.setTimeout((function(){h.complete(u,!1,u.metaConnect);var e={reason:"Previous request failed"},t=u.xhr;e.httpCode=h.xhrStatus(t),a.onFailure(t,a.messages,e)}),0)}}}function p(e){if(null!==a)throw"Concurrent /meta/connect requests not allowed, request id="+a.id+" not yet completed";var t=++o;this._debug("Transport",this.getType(),"/meta/connect send, request",t,"envelope",e);var n={id:t,metaConnect:!0,envelope:e};u.call(this,e,n),a=n}return t.complete=function(e,t,n){n?h.call(this,e):d.call(this,e,t)},t.transportSend=function(e,t){throw"Abstract"},t.transportSuccess=function(e,t,n){t.expired||(this.clearTimeout(t.timeout),this.complete(t,!0,t.metaConnect),n&&n.length>0?e.onSuccess(n):e.onFailure(t.xhr,e.messages,{httpCode:204}))},t.transportFailure=function(e,t,n){t.expired||(this.clearTimeout(t.timeout),this.complete(t,!1,t.metaConnect),e.onFailure(t.xhr,e.messages,n))},t.send=function(e,t){t?p.call(this,e):l.call(this,e)},t.abort=function(){e.abort();for(var t=0;t<i.length;++t){var n=i[t];n&&(this._debug("Aborting request",n),this.abortXHR(n.xhr)||this.transportFailure(n.envelope,n,{reason:"abort"}))}var o=a;o&&(this._debug("Aborting /meta/connect request",o),this.abortXHR(o.xhr)||this.transportFailure(o.envelope,o,{reason:"abort"})),this.reset(!0)},t.reset=function(t){e.reset(t),a=null,i=[],s=[]},t.abortXHR=function(e){if(e)try{var t=e.readyState;return e.abort(),t!==window.XMLHttpRequest.UNSENT}catch(e){this._debug(e)}return!1},t.xhrStatus=function(e){if(e)try{return e.status}catch(e){this._debug(e)}return-1},t},i=function(){var e=new a,t=r.derive(e),n=!0;function o(e){try{e.context=t.context}catch(e){this._debug("Could not copy transport context into XHR",e)}}return t.accept=function(e,t,o){return n||!t},t.newXMLHttpRequest=function(){return new window.XMLHttpRequest},t.xhrSend=function(e){var n=t.newXMLHttpRequest();o(n),n.withCredentials=!0,n.open("POST",e.url,!0!==e.sync);var r=e.headers;if(r)for(var a in r)r.hasOwnProperty(a)&&n.setRequestHeader(a,r[a]);return n.setRequestHeader("Content-Type","application/json;charset=UTF-8"),n.onload=function(){200===n.status?e.onSuccess(n.responseText):e.onError(n.statusText)},n.onabort=n.onerror=function(){e.onError(n.statusText)},n.send(e.body),n},t.transportSend=function(e,t){this._debug("Transport",this.getType(),"sending request",t.id,"envelope",e);var o=this;try{var r=!0;t.xhr=this.xhrSend({transport:this,url:e.url,sync:e.sync,headers:this.getConfiguration().requestHeaders,body:JSON.stringify(e.messages),onSuccess:function(r){o._debug("Transport",o.getType(),"received response",r);var a=!1;try{var i=o.convertToMessages(r);0===i.length?(n=!1,o.transportFailure(e,t,{httpCode:204})):(a=!0,o.transportSuccess(e,t,i))}catch(r){if(o._debug(r),!a){n=!1;var s={exception:r};s.httpCode=o.xhrStatus(t.xhr),o.transportFailure(e,t,s)}}},onError:function(a,i){o._debug("Transport",o.getType(),"received error",a,i),n=!1;var s={reason:a,exception:i};s.httpCode=o.xhrStatus(t.xhr),r?o.setTimeout((function(){o.transportFailure(e,t,s)}),0):o.transportFailure(e,t,s)}}),r=!1}catch(r){n=!1,this.setTimeout((function(){o.transportFailure(e,t,{exception:r})}),0)}},t.reset=function(t){e.reset(t),n=!0},t},s=function(){var e=new a,t=r.derive(e),n=0;function o(e,t,n){var o=this;return function(){o.transportFailure(e,t,"error",n)}}return t.accept=function(e,t,n){return!0},t.jsonpSend=function(e){var t=document.getElementsByTagName("head")[0],o=document.createElement("script"),r="_cometd_jsonp_"+n++;window[r]=function(n){t.removeChild(o),delete window[r],e.onSuccess(n)};var a=e.url;a+=a.indexOf("?")<0?"?":"&",a+="jsonp="+r,a+="&message="+encodeURIComponent(e.body),o.src=a,o.async=!0!==e.sync,o.type="application/javascript",o.onerror=function(t){e.onError("jsonp "+t.type)},t.appendChild(o)},t.transportSend=function(e,t){for(var n=this,r=0,a=e.messages.length,i=[];a>0;){var s=JSON.stringify(e.messages.slice(r,r+a)),c=e.url.length+encodeURI(s).length,u=this.getConfiguration().maxURILength;if(c>u){if(1===a){var l="Bayeux message too big ("+c+" bytes, max is "+u+") for transport "+this.getType();return void this.setTimeout(o.call(this,e,t,l),0)}--a}else i.push(a),r+=a,a=e.messages.length-r}var h=e;if(i.length>1){var d=0,p=i[0];this._debug("Transport",this.getType(),"split",e.messages.length,"messages into",i.join(" + ")),(h=this._mixin(!1,{},e)).messages=e.messages.slice(d,p),h.onSuccess=e.onSuccess,h.onFailure=e.onFailure;for(var f=1;f<i.length;++f){var y=this._mixin(!1,{},e);d=p,p+=i[f],y.messages=e.messages.slice(d,p),y.onSuccess=e.onSuccess,y.onFailure=e.onFailure,this.send(y,t.metaConnect)}}this._debug("Transport",this.getType(),"sending request",t.id,"envelope",h);try{var m=!0;this.jsonpSend({transport:this,url:h.url,sync:h.sync,headers:this.getConfiguration().requestHeaders,body:JSON.stringify(h.messages),onSuccess:function(e){var o=!1;try{var r=n.convertToMessages(e);0===r.length?n.transportFailure(h,t,{httpCode:204}):(o=!0,n.transportSuccess(h,t,r))}catch(e){n._debug(e),o||n.transportFailure(h,t,{exception:e})}},onError:function(e,o){var r={reason:e,exception:o};m?n.setTimeout((function(){n.transportFailure(h,t,r)}),0):n.transportFailure(h,t,r)}}),m=!1}catch(e){this.setTimeout((function(){n.transportFailure(h,t,{exception:e})}),0)}},t},c=function(){var e,t=new r,o=r.derive(t),a=!0,i=!1,s=!0,c=null,u=null,l=!1,h=null;function d(e,t){e&&(this.webSocketClose(e,t.code,t.reason),this.onClose(e,t))}function p(e){return e===u||e===c}function f(e,t,n){for(var o=[],r=0;r<t.messages.length;++r){var a=t.messages[r];a.id&&o.push(a.id)}e.envelopes[o.join(",")]=[t,n],this._debug("Transport",this.getType(),"stored envelope, envelopes",e.envelopes)}function y(t){if(!u){var n=e.getURL().replace(/^http/,"ws");this._debug("Transport",this.getType(),"connecting to URL",n);try{var o=e.getConfiguration().protocol;t.webSocket=o?new window.WebSocket(n,o):new window.WebSocket(n),u=t}catch(e){throw a=!1,this._debug("Exception while creating WebSocket object",e),e}s=!1!==e.getConfiguration().stickyReconnect;var r=this,l=e.getConfiguration().connectTimeout;l>0&&(t.connectTimer=this.setTimeout((function(){e._debug("Transport",r.getType(),"timed out while connecting to URL",n,":",l,"ms"),d.call(r,t,{code:1e3,reason:"Connect Timeout"})}),l));var h=function(){e._debug("WebSocket onopen",t),t.connectTimer&&r.clearTimeout(t.connectTimer),p(t)?(u=null,c=t,i=!0,r.onOpen(t)):(e._warn("Closing extra WebSocket connection",this,"active connection",c),d.call(r,t,{code:1e3,reason:"Extra Connection"}))},f=function(n){n=n||{code:1e3},e._debug("WebSocket onclose",t,n,"connecting",u,"current",c),t.connectTimer&&r.clearTimeout(t.connectTimer),r.onClose(t,n)},y=function(n){e._debug("WebSocket onmessage",n,t),r.onMessage(t,n)};t.webSocket.onopen=h,t.webSocket.onclose=f,t.webSocket.onerror=function(){f({code:1e3,reason:"Error"})},t.webSocket.onmessage=y,this._debug("Transport",this.getType(),"configured callbacks on",t)}}function m(t,n,o){var r=JSON.stringify(n.messages);t.webSocket.send(r),this._debug("Transport",this.getType(),"sent",n,"/meta/connect =",o);var a=this.getConfiguration().maxNetworkDelay,i=a;o&&(i+=this.getAdvice().timeout,l=!0);for(var s=this,c=[],u=0;u<n.messages.length;++u)!function(){var o=n.messages[u];o.id&&(c.push(o.id),t.timeouts[o.id]=s.setTimeout((function(){e._debug("Transport",s.getType(),"timing out message",o.id,"after",i,"on",t),d.call(s,t,{code:1e3,reason:"Message Timeout"})}),i))}();this._debug("Transport",this.getType(),"waiting at most",i,"ms for messages",c,"maxNetworkDelay",a,", timeouts:",t.timeouts)}function g(e,t,n){try{null===e?(e=u||{envelopes:{},timeouts:{}},f.call(this,e,t,n),y.call(this,e)):(f.call(this,e,t,n),m.call(this,e,t,n))}catch(t){var o=this;this.setTimeout((function(){d.call(o,e,{code:1e3,reason:"Exception",exception:t})}),0)}}return o.reset=function(e){t.reset(e),a=!0,e&&(i=!1),s=!0,c=null,u=null,l=!1},o._notifySuccess=function(e,t){e.call(this,t)},o._notifyFailure=function(e,t,n,o){e.call(this,t,n,o)},o.onOpen=function(e){var t=e.envelopes;for(var n in this._debug("Transport",this.getType(),"opened",e,"pending messages",t),t)if(t.hasOwnProperty(n)){var o=t[n],r=o[0],a=o[1];h=r.onSuccess,m.call(this,e,r,a)}},o.onMessage=function(e,t){this._debug("Transport",this.getType(),"received websocket message",t,e);for(var o=!1,r=this.convertToMessages(t.data),a=[],i=0;i<r.length;++i){var s=r[i];if((/^\/meta\//.test(s.channel)||void 0===s.data)&&s.id){a.push(s.id);var c=e.timeouts[s.id];c&&(this.clearTimeout(c),delete e.timeouts[s.id],this._debug("Transport",this.getType(),"removed timeout for message",s.id,", timeouts",e.timeouts))}"/meta/connect"===s.channel&&(l=!1),"/meta/disconnect"!==s.channel||l||(o=!0)}for(var u=!1,d=e.envelopes,p=0;p<a.length;++p){var f=a[p];for(var y in d)if(d.hasOwnProperty(y)){var m=y.split(","),g=n.inArray(f,m);if(g>=0){u=!0,m.splice(g,1);var w=d[y][0],b=d[y][1];delete d[y],m.length>0&&(d[m.join(",")]=[w,b]);break}}}u&&this._debug("Transport",this.getType(),"removed envelope, envelopes",d),this._notifySuccess(h,r),o&&this.webSocketClose(e,1e3,"Disconnect")},o.onClose=function(e,t){this._debug("Transport",this.getType(),"closed",e,t),p(e)&&(a=s&&i,u=null,c=null);var n=e.timeouts;for(var o in e.timeouts={},n)n.hasOwnProperty(o)&&this.clearTimeout(n[o]);var r=e.envelopes;for(var h in e.envelopes={},r)if(r.hasOwnProperty(h)){var d=r[h][0];r[h][1]&&(l=!1);var f={websocketCode:t.code,reason:t.reason};t.exception&&(f.exception=t.exception),this._notifyFailure(d.onFailure,e,d.messages,f)}},o.registered=function(n,o){t.registered(n,o),e=o},o.accept=function(t,n,o){return this._debug("Transport",this.getType(),"accept, supported:",a),a&&!!window.WebSocket&&!1!==e.websocketEnabled},o.send=function(e,t){this._debug("Transport",this.getType(),"sending",e,"/meta/connect =",t),g.call(this,c,e,t)},o.webSocketClose=function(e,t,n){try{e.webSocket&&e.webSocket.close(t,n)}catch(e){this._debug(e)}},o.abort=function(){t.abort(),d.call(this,c,{code:1e3,reason:"Abort"}),this.reset(!0)},o},u=function(r){var a,u,l,h,d,p=new e,f=this,y=r||"default",m=!1,g=new o,w="disconnected",b=0,v=null,S=0,_=[],T=!1,E=0,x={},A=0,R=null,N=[],O={},P={},k={},I=!1,C=!1,L=0,j=0,U=null,D={useWorkerScheduler:!0,protocol:null,stickyReconnect:!0,connectTimeout:0,maxConnections:2,backoffIncrement:1e3,maxBackoff:6e4,logLevel:"info",maxNetworkDelay:1e4,requestHeaders:{},appendMessageTypeToURL:!0,autoBatch:!1,urls:{},maxURILength:2e3,advice:{timeout:6e4,interval:0,reconnect:void 0,maxInterval:0}};function B(e,t){try{return e[t]}catch(e){return}}function K(e){return n.isString(e)}function M(e){return null!=e&&"function"==typeof e}function z(e,t){for(var n="";--t>0&&!(e>=Math.pow(10,t));)n+="0";return n+=e}function F(e,t){if(window.console){var n=window.console[e];if(M(n)){var o=new Date;[].splice.call(t,0,0,z(o.getHours(),2)+":"+z(o.getMinutes(),2)+":"+z(o.getSeconds(),2)+"."+z(o.getMilliseconds(),3)),n.apply(window.console,t)}}}function q(e){return new RegExp("(^https?://)?(((\\[[^\\]]+])|([^:/?#]+))(:(\\d+))?)?([^?#]*)(.*)?").exec(e)}function H(e){f._debug("Configuring cometd object with",e),K(e)&&(e={url:e}),e||(e={}),D=f._mixin(!1,D,e);var n=f.getURL();if(!n)throw"Missing required configuration parameter 'url' specifying the Bayeux server URL";var o=q(n),r=o[2],a=o[8],i=o[9];if(m=f._isCrossDomain(r),D.appendMessageTypeToURL)if(void 0!==i&&i.length>0)f._info("Appending message type to URI "+a+i+" is not supported, disabling 'appendMessageTypeToURL' configuration"),D.appendMessageTypeToURL=!1;else{var s=a.split("/"),c=s.length-1;a.match(/\/$/)&&(c-=1),s[c].indexOf(".")>=0&&(f._info("Appending message type to URI "+a+" is not supported, disabling 'appendMessageTypeToURL' configuration"),D.appendMessageTypeToURL=!1)}if(window.Worker&&window.Blob&&window.URL&&D.useWorkerScheduler){var u=t.toString();u=u.substring(u.indexOf("{")+1,u.lastIndexOf("}"));var l=new window.Blob([u],{type:"application/json"}),h=window.URL.createObjectURL(l),d=new window.Worker(h);p.setTimeout=function(e,t){var n=p.register(e);return d.postMessage({id:n,type:"setTimeout",delay:t}),n},p.clearTimeout=function(e){p.unregister(e),d.postMessage({id:e,type:"clearTimeout"})},d.onmessage=function(e){var t=e.data.id,n=p.unregister(t);n&&n()}}}function G(e){if(e){var t=x[e.channel];t&&t[e.id]&&(delete t[e.id],f._debug("Removed",e.listener?"listener":"subscription",e))}}function W(e){e&&!e.listener&&G(e)}function V(){for(var e in x)if(x.hasOwnProperty(e)){var t=x[e];if(t)for(var n in t)t.hasOwnProperty(n)&&W(t[n])}}function Y(e){w!==e&&(f._debug("Status",w,"->",e),w=e)}function X(){return"disconnecting"===w||"disconnected"===w}function J(){return""+ ++b}function Z(e,t,n,o,r){try{return t.call(e,o)}catch(e){var a=f.onExtensionException;if(M(a)){f._debug("Invoking extension exception handler",n,e);try{a.call(f,e,n,r,o)}catch(e){f._info("Exception during execution of extension exception handler",n,e)}}else f._info("Exception during execution of extension",n,e);return o}}function $(e){for(var t=0;t<N.length&&null!=e;++t){var n=N[t],o=n.extension.incoming;if(M(o)){var r=Z(n.extension,o,n.name,e,!1);e=void 0===r?e:r}}return e}function Q(e){for(var t=N.length-1;t>=0&&null!=e;--t){var n=N[t],o=n.extension.outgoing;if(M(o)){var r=Z(n.extension,o,n.name,e,!0);e=void 0===r?e:r}}return e}function ee(e,t){var n=x[e];if(n)for(var o in n)if(n.hasOwnProperty(o)){var r=n[o];if(r)try{r.callback.call(r.scope,t)}catch(e){var a=f.onListenerException;if(M(a)){f._debug("Invoking listener exception handler",r,e);try{a.call(f,e,r,r.listener,t)}catch(e){f._info("Exception during execution of listener exception handler",r,e)}}else f._info("Exception during execution of listener",r,t,e)}}}function te(e,t){ee(e,t);for(var n=e.split("/"),o=n.length-1,r=o;r>0;--r){var a=n.slice(0,r).join("/")+"/*";r===o&&ee(a,t),ee(a+="*",t)}}function ne(){null!==R&&f.clearTimeout(R),R=null}function oe(e,t){ne();var n=O.interval+t;f._debug("Function scheduled in",n,"ms, interval =",O.interval,"backoff =",A,e),R=f.setTimeout(e,n)}function re(e,t,n){for(var o=0;o<e.length;++o){var r=e[o],i=r.id;v&&(r.clientId=v),null!=(r=Q(r))?(r.id=i,e[o]=r):(delete P[i],e.splice(o--,1))}if(0!==e.length){t&&(U=e[0]);var s=f.getURL();D.appendMessageTypeToURL&&(s.match(/\/$/)||(s+="/"),n&&(s+=n));var c={url:s,sync:!1,messages:e,onSuccess:function(e){try{h.call(f,e)}catch(e){f._info("Exception during handling of messages",e)}},onFailure:function(e,t,n){try{var o=f.getTransport();n.connectionType=o?o.getType():"unknown",d.call(f,e,t,n)}catch(e){f._info("Exception during handling of failure",e)}}};f._debug("Send",c),a.send(c,t)}}function ae(e){S>0||!0===T?_.push(e):re([e],!1)}function ie(){A=0}function se(){return A<D.maxBackoff&&(A+=D.backoffIncrement),A}function ce(){++S,f._debug("Starting batch, depth",S)}function ue(){var e=_;_=[],e.length>0&&re(e,!1)}function le(){if(--S,f._debug("Ending batch, depth",S),S<0)throw"Calls to startBatch() and endBatch() are not paired";0!==S||X()||T||ue()}function he(){if(!X()){var e={id:J(),channel:"/meta/connect",connectionType:a.getType()};C||(e.advice={timeout:0}),Y("connecting"),f._debug("Connect sent",e),re([e],!0,"connect"),Y("connected")}}function de(e){Y("connecting"),oe((function(){he()}),e)}function pe(e){e&&(O=f._mixin(!1,{},D.advice,e),f._debug("New advice",O))}function fe(e){if(ne(),e&&a&&a.abort(),m=!1,a=null,Y("disconnected"),v=null,S=0,ie(),I=!1,C=!1,L=0,U=null,_.length>0){var t=_;_=[],d.call(f,void 0,t,{reason:"Disconnected"})}}function ye(e,t,n){var o=f.onTransportException;if(M(o)){f._debug("Invoking transport exception handler",e,t,n);try{o.call(f,n,e,t)}catch(e){f._info("Exception during execution of transport exception handler",e)}}}function me(e,t){M(e)&&(t=e,e=void 0),v=null,V(),X()&&g.reset(!0),pe({}),S=0,T=!0,u=e,l=t;var n="1.0",o=f.getURL(),r=g.findTransportTypes(n,m,o),i={id:J(),version:n,minimumVersion:n,channel:"/meta/handshake",supportedConnectionTypes:r,advice:{timeout:O.timeout,interval:O.interval}},s=f._mixin(!1,{},u,i);if(f._putCallback(s.id,t),!a&&!(a=g.negotiateTransport(r,n,m,o))){var c="Could not find initial transport among: "+g.getTransportTypes();throw f._warn(c),c}f._debug("Initial transport is",a.getType()),Y("handshaking"),f._debug("Handshake sent",s),re([s],!1,"handshake")}function ge(e){Y("handshaking"),T=!0,oe((function(){me(u,l)}),e)}function we(e,t){try{e.call(f,t)}catch(e){var n=f.onCallbackException;if(M(n)){f._debug("Invoking callback exception handler",e);try{n.call(f,e,t)}catch(e){f._info("Exception during execution of callback exception handler",e)}}else f._info("Exception during execution of message callback",e)}}function be(e){var t=f._getCallback([e.id]);M(t)&&(delete P[e.id],we(t,e))}function ve(e){var t=k[e.id];if(delete k[e.id],t){f._debug("Handling remote call response for",e,"with context",t);var n=t.timeout;n&&f.clearTimeout(n);var o=t.callback;if(M(o))return we(o,e),!0}return!1}function Se(e){f._debug("Transport failure handling",e),e.transport&&(a=e.transport),e.url&&a.setURL(e.url);var t=e.action,n=e.delay||0;switch(t){case"handshake":ge(n);break;case"retry":de(n);break;case"none":fe(!0);break;default:throw"Unknown action "+t}}function _e(e,t){be(e),te("/meta/handshake",e),te("/meta/unsuccessful",e),X()&&(t.action="none"),f.onTransportFailure.call(f,e,t,Se)}function Te(e){var t=f.getURL();if(e.successful){var n=f._isCrossDomain(q(t)[2]),o=g.negotiateTransport(e.supportedConnectionTypes,e.version,n,t);if(null===o)return e.successful=!1,void _e(e,{cause:"negotiation",action:"none",transport:null});a!==o&&(f._debug("Transport",a.getType(),"->",o.getType()),a=o),v=e.clientId,T=!1,ue(),e.reestablish=I,I=!0,be(e),te("/meta/handshake",e),j=e["x-messages"]||0;var r=X()?"none":O.reconnect||"retry";switch(r){case"retry":ie(),0===j?de(0):f._debug("Processing",j,"handshake-delivered messages");break;case"none":fe(!0);break;default:throw"Unrecognized advice action "+r}}else _e(e,{cause:"unsuccessful",action:O.reconnect||"handshake",transport:a})}function Ee(e){_e(e,{cause:"failure",action:"handshake",transport:null})}function xe(e){return"disconnected"===w||!(!U||U.id!==e.id)&&(U=null,!0)}function Ae(e,t){te("/meta/connect",e),te("/meta/unsuccessful",e),X()&&(t.action="none"),f.onTransportFailure.call(f,e,t,Se)}function Re(e){if(xe(e))if(C=e.successful){te("/meta/connect",e);var t=X()?"none":O.reconnect||"retry";switch(t){case"retry":ie(),de(A);break;case"none":fe(!1);break;default:throw"Unrecognized advice action "+t}}else Ae(e,{cause:"unsuccessful",action:O.reconnect||"retry",transport:a});else f._debug("Mismatched /meta/connect reply",e)}function Ne(e){xe(e)?(C=!1,Ae(e,{cause:"failure",action:"retry",transport:null})):f._debug("Mismatched /meta/connect failure",e)}function Oe(e){fe(!0),be(e),te("/meta/disconnect",e),te("/meta/unsuccessful",e)}function Pe(e){e.successful?(fe(!1),be(e),te("/meta/disconnect",e)):Oe(e)}function ke(e){Oe(e)}function Ie(e){var t=x[e.subscription];if(t)for(var n in t)if(t.hasOwnProperty(n)){var o=t[n];o&&!o.listener&&(delete t[n],f._debug("Removed failed subscription",o))}be(e),te("/meta/subscribe",e),te("/meta/unsuccessful",e)}function Ce(e){e.successful?(be(e),te("/meta/subscribe",e)):Ie(e)}function Le(e){Ie(e)}function je(e){be(e),te("/meta/unsubscribe",e),te("/meta/unsuccessful",e)}function Ue(e){e.successful?(be(e),te("/meta/unsubscribe",e)):je(e)}function De(e){je(e)}function Be(e){ve(e)||(be(e),te("/meta/publish",e),te("/meta/unsuccessful",e))}function Ke(e){void 0!==e.data?ve(e)||(te(e.channel,e),j>0&&0==--j&&(f._debug("Processed last handshake-delivered message"),de(0))):void 0===e.successful?f._warn("Unknown Bayeux Message",e):e.successful?(be(e),te("/meta/publish",e)):Be(e)}function Me(e){Be(e)}function ze(e){if(L=0,null!=(e=$(e)))switch(pe(e.advice),e.channel){case"/meta/handshake":Te(e);break;case"/meta/connect":Re(e);break;case"/meta/disconnect":Pe(e);break;case"/meta/subscribe":Ce(e);break;case"/meta/unsubscribe":Ue(e);break;default:Ke(e)}}function Fe(e){var t=x[e];if(t)for(var n in t)if(t.hasOwnProperty(n)&&t[n])return!0;return!1}function qe(e,t){var n={scope:e,method:t};if(M(e))n.scope=void 0,n.method=e;else if(K(t)){if(!e)throw"Invalid scope "+e;if(n.method=e[t],!M(n.method))throw"Invalid callback "+t+" for scope "+e}else if(!M(t))throw"Invalid callback "+t;return n}function He(e,t,n,o){var r=qe(t,n);f._debug("Adding",o?"listener":"subscription","on",e,"with scope",r.scope,"and callback",r.method);var a=++E,i={id:a,channel:e,scope:r.scope,callback:r.method,listener:o},s=x[e];return s||(s={},x[e]=s),s[a]=i,f._debug("Added",o?"listener":"subscription",i),i}this._mixin=function(e,t,n){for(var o=t||{},r=2;r<arguments.length;++r){var a=arguments[r];if(null!=a)for(var i in a)if(a.hasOwnProperty(i)){var s=B(a,i),c=B(o,i);if(s===t)continue;if(void 0===s)continue;if(e&&"object"==typeof s&&null!==s)if(s instanceof Array)o[i]=this._mixin(e,c instanceof Array?c:[],s);else{var u="object"!=typeof c||c instanceof Array?{}:c;o[i]=this._mixin(e,u,s)}else o[i]=s}}return o},this._warn=function(){F("warn",arguments)},this._info=function(){"warn"!==D.logLevel&&F("info",arguments)},this._debug=function(){"debug"===D.logLevel&&F("debug",arguments)},this._isCrossDomain=function(e){return!!(window.location&&window.location.host&&e)&&e!==window.location.host},this.send=ae,this._getCallback=function(e){return P[e]},this._putCallback=function(e,t){var n=this._getCallback(e);return M(t)&&(P[e]=t),n},this.onTransportFailure=function(e,t,n){this._debug("Transport failure",t,"for",e);var o=this.getTransportRegistry(),r=this.getURL(),i=this._isCrossDomain(q(r)[2]),s="1.0",c=o.findTransportTypes(s,i,r);if("none"===t.action){if("/meta/handshake"===e.channel&&!t.transport){var u="Could not negotiate transport, client=["+c+"], server=["+e.supportedConnectionTypes+"]";this._warn(u),ye(a.getType(),null,{reason:u,connectionType:a.getType(),transport:a})}}else if(t.delay=this.getBackoffPeriod(),"/meta/handshake"===e.channel){if(!t.transport){var l=a?a.getType():null,h=o.negotiateTransport(c,s,i,r);if(h){var d=h.getType();this._debug("Transport",l,"->",d),ye(l,d,e.failure),t.action="handshake",t.transport=h}else this._warn("Could not negotiate transport, client=["+c+"]"),ye(l,null,e.failure),t.action="none"}"none"!==t.action&&this.increaseBackoffPeriod()}else{var p=(new Date).getTime();if(0===L&&(L=p),"retry"===t.action){t.delay=this.increaseBackoffPeriod();var y=O.maxInterval;if(y>0){var m=O.timeout+O.interval+y;p-L+A>m&&(t.action="handshake")}}"handshake"===t.action&&(t.delay=0,o.reset(!1),this.resetBackoffPeriod())}n.call(f,t)},this.receive=ze,h=function(e){f._debug("Received",e);for(var t=0;t<e.length;++t)ze(e[t])},d=function(e,t,n){f._debug("handleFailure",e,t,n),n.transport=e;for(var o=0;o<t.length;++o){var r=t[o],a={id:r.id,successful:!1,channel:r.channel,failure:n};switch(n.message=r,r.channel){case"/meta/handshake":Ee(a);break;case"/meta/connect":Ne(a);break;case"/meta/disconnect":ke(a);break;case"/meta/subscribe":a.subscription=r.subscription,Le(a);break;case"/meta/unsubscribe":a.subscription=r.subscription,De(a);break;default:Me(a)}}},this.registerTransport=function(e,t,n){var o=g.add(e,t,n);return o&&(this._debug("Registered transport",e),M(t.registered)&&t.registered(e,this)),o},this.unregisterTransport=function(e){var t=g.remove(e);return null!==t&&(this._debug("Unregistered transport",e),M(t.unregistered)&&t.unregistered()),t},this.unregisterTransports=function(){g.clear()},this.getTransportTypes=function(){return g.getTransportTypes()},this.findTransport=function(e){return g.find(e)},this.getTransportRegistry=function(){return g},this.configure=function(e){H.call(this,e)},this.init=function(e,t){this.configure(e),this.handshake(t)},this.handshake=function(e,t){if("disconnected"!==w)throw"Illegal state: handshaken";me(e,t)},this.disconnect=function(e,t){if(!X()){M(e)&&(t=e,e=void 0);var n={id:J(),channel:"/meta/disconnect"},o=this._mixin(!1,{},e,n);f._putCallback(o.id,t),Y("disconnecting"),re([o],!1,"disconnect")}},this.startBatch=function(){ce()},this.endBatch=function(){le()},this.batch=function(e,t){var n=qe(e,t);this.startBatch();try{n.method.call(n.scope),this.endBatch()}catch(e){throw this._info("Exception during execution of batch",e),this.endBatch(),e}},this.addListener=function(e,t,n){if(arguments.length<2)throw"Illegal arguments number: required 2, got "+arguments.length;if(!K(e))throw"Illegal argument type: channel must be a string";return He(e,t,n,!0)},this.removeListener=function(e){if(!e||!e.channel||!("id"in e))throw"Invalid argument: expected subscription, not "+e;G(e)},this.clearListeners=function(){x={}},this.subscribe=function(e,t,n,o,r){if(arguments.length<2)throw"Illegal arguments number: required 2, got "+arguments.length;if(!K(e))throw"Illegal argument type: channel must be a string";if(X())throw"Illegal state: disconnected";M(t)&&(r=o,o=n,n=t,t=void 0),M(o)&&(r=o,o=void 0);var a=!Fe(e),i=He(e,t,n,!1);if(a){var s={id:J(),channel:"/meta/subscribe",subscription:e},c=this._mixin(!1,{},o,s);f._putCallback(c.id,r),ae(c)}return i},this.unsubscribe=function(e,t,n){if(arguments.length<1)throw"Illegal arguments number: required 1, got "+arguments.length;if(X())throw"Illegal state: disconnected";M(t)&&(n=t,t=void 0),this.removeListener(e);var o=e.channel;if(!Fe(o)){var r={id:J(),channel:"/meta/unsubscribe",subscription:o},a=this._mixin(!1,{},t,r);f._putCallback(a.id,n),ae(a)}},this.resubscribe=function(e,t){if(W(e),e)return this.subscribe(e.channel,e.scope,e.callback,t)},this.clearSubscriptions=function(){V()},this.publish=function(e,t,n,o){if(arguments.length<1)throw"Illegal arguments number: required 1, got "+arguments.length;if(!K(e))throw"Illegal argument type: channel must be a string";if(/^\/meta\//.test(e))throw"Illegal argument: cannot publish to meta channels";if(X())throw"Illegal state: disconnected";M(t)?(o=t,t={},n=void 0):M(n)&&(o=n,n=void 0);var r={id:J(),channel:e,data:t},a=this._mixin(!1,{},n,r);f._putCallback(a.id,o),ae(a)},this.publishBinary=function(e,t,n,o,r){M(t)?(r=t,t=new ArrayBuffer(0),n=!0,o=void 0):M(n)?(r=n,n=!0,o=void 0):M(o)&&(r=o,o=void 0);var a={meta:o,data:t,last:n},i={ext:{binary:{}}};this.publish(e,a,i,r)},this.remoteCall=function(e,t,n,o,r){if(arguments.length<1)throw"Illegal arguments number: required 1, got "+arguments.length;if(!K(e))throw"Illegal argument type: target must be a string";if(X())throw"Illegal state: disconnected";if(M(t)?(r=t,t={},n=D.maxNetworkDelay,o=void 0):M(n)?(r=n,n=D.maxNetworkDelay,o=void 0):M(o)&&(r=o,o=void 0),"number"!=typeof n)throw"Illegal argument type: timeout must be a number";e.match(/^\//)||(e="/"+e);var a="/service"+e,i={id:J(),channel:a,data:t},s=this._mixin(!1,{},o,i),c={callback:r};n>0&&(c.timeout=f.setTimeout((function(){f._debug("Timing out remote call",s,"after",n,"ms"),Be({id:s.id,error:"406::timeout",successful:!1,failure:{message:s,reason:"Remote Call Timeout"}})}),n),f._debug("Scheduled remote call timeout",s,"in",n,"ms")),k[s.id]=c,ae(s)},this.remoteCallBinary=function(e,t,n,o,r,a){M(t)?(a=t,t=new ArrayBuffer(0),n=!0,o=void 0,r=D.maxNetworkDelay):M(n)?(a=n,n=!0,o=void 0,r=D.maxNetworkDelay):M(o)?(a=o,o=void 0,r=D.maxNetworkDelay):M(r)&&(a=r,r=D.maxNetworkDelay);var i={meta:o,data:t,last:n},s={ext:{binary:{}}};this.remoteCall(e,i,r,s,a)},this.getStatus=function(){return w},this.isDisconnected=X,this.setBackoffIncrement=function(e){D.backoffIncrement=e},this.getBackoffIncrement=function(){return D.backoffIncrement},this.getBackoffPeriod=function(){return A},this.increaseBackoffPeriod=function(){return se()},this.resetBackoffPeriod=function(){ie()},this.setLogLevel=function(e){D.logLevel=e},this.registerExtension=function(e,t){if(arguments.length<2)throw"Illegal arguments number: required 2, got "+arguments.length;if(!K(e))throw"Illegal argument type: extension name must be a string";for(var n=!1,o=0;o<N.length;++o)if(N[o].name===e){n=!0;break}return n?(this._info("Could not register extension with name",e,"since another extension with the same name already exists"),!1):(N.push({name:e,extension:t}),this._debug("Registered extension",e),M(t.registered)&&t.registered(e,this),!0)},this.unregisterExtension=function(e){if(!K(e))throw"Illegal argument type: extension name must be a string";for(var t=!1,n=0;n<N.length;++n){var o=N[n];if(o.name===e){N.splice(n,1),t=!0,this._debug("Unregistered extension",e);var r=o.extension;M(r.unregistered)&&r.unregistered();break}}return t},this.getExtension=function(e){for(var t=0;t<N.length;++t){var n=N[t];if(n.name===e)return n.extension}return null},this.getName=function(){return y},this.getClientId=function(){return v},this.getURL=function(){if(a){var e=a.getURL();if(e)return e;if(e=D.urls[a.getType()])return e}return D.url},this.getTransport=function(){return a},this.getConfiguration=function(){return this._mixin(!0,{},D)},this.getAdvice=function(){return this._mixin(!0,{},O)},this.setTimeout=function(e,t){return p.setTimeout((function(){try{f._debug("Invoking timed function",e),e()}catch(t){f._debug("Exception invoking timed function",e,t)}}),t)},this.clearTimeout=function(e){p.clearTimeout(e)},window.WebSocket&&this.registerTransport("websocket",new c),this.registerTransport("long-polling",new i),this.registerTransport("callback-polling",new s)},l=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",".","-",":","+","=","^","!","/","*","?","&","<",">","(",")","[","]","{","}","@","%","$","#"],h=[0,68,0,84,83,82,72,0,75,76,70,65,0,63,62,69,0,1,2,3,4,5,6,7,8,9,64,0,73,66,74,71,81,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,77,0,78,67,0,0,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,79,0,80,0,0];return{CometD:u,Transport:r,RequestTransport:a,LongPollingTransport:i,CallbackPollingTransport:s,WebSocketTransport:c,Utils:n,Z85:{encode:function(e){var t=null;if(e instanceof ArrayBuffer?t=e:e.buffer instanceof ArrayBuffer?t=e.buffer:Array.isArray(e)&&(t=new Uint8Array(e).buffer),null==t)throw"Cannot Z85 encode "+e;for(var n=t.byteLength,o=n%4,r=4-(0===o?4:o),a=new DataView(t),i="",s=0,c=0;c<n+r;++c){var u=c>=n;if(s=256*s+(u?0:a.getUint8(c)),(c+1)%4==0){for(var h=52200625,d=5;d>0;--d){if(!u||d>r){var p=Math.floor(s/h)%85;i+=l[p]}h/=85}s=0}}return i},decode:function(e){for(var t=e.length%5,n=5-(0===t?5:t),o=0;o<n;++o)e+=l[l.length-1];for(var r=e.length,a=new ArrayBuffer(4*r/5-n),i=new DataView(a),s=0,c=0,u=0,d=0;d<r;++d){var p=e.charCodeAt(c++)-32;if(s=85*s+h[p],c%5==0){for(var f=16777216;f>=1;)u<i.byteLength&&i.setUint8(u++,Math.floor(s/f)%256),f/=256;s=0}}return a}}}}()})),lt=Object.freeze(t({__proto__:null,default:ut},[ut])),ht=r((function(e,t){e.exports=ut.AckExtension=function(){var e,t,n=!1;function o(t,n){e._debug(t,n)}this.registered=function(t,n){e=n,o("AckExtension: executing registration callback")},this.unregistered=function(){o("AckExtension: executing unregistration callback"),e=null},this.incoming=function(e){var r=e.channel,a=e.ext;if("/meta/handshake"===r){if(a){var i=a.ack;if("object"==typeof i){n=!0===i.enabled;var s=i.batch;"number"==typeof s&&(t=s)}else n=!0===i}o("AckExtension: server supports acknowledgements",n)}else"/meta/connect"===r&&e.successful&&n&&a&&"number"==typeof a.ack&&o("AckExtension: server sent batch",t=a.ack);return e},this.outgoing=function(r){var a=r.channel;return r.ext||(r.ext={}),"/meta/handshake"===a?(r.ext.ack=e&&!1!==e.ackEnabled,n=!1,t=0):"/meta/connect"===a&&n&&(r.ext.ack=t,o("AckExtension: client sending batch",t)),r}}})),dt=Object.freeze(t({__proto__:null,default:ht},[ht])),pt=r((function(e,t){e.exports=ut.ReloadExtension=function(e){var t,n,o={},r="org.cometd.reload",a=!1,i=!1;function s(e){if(o.handshakeResponse){i=!0;var a=t.getTransport();a&&a.abort(),u(e);var s=JSON.stringify(o);n("Reload extension saving state",s),window.sessionStorage.setItem(r,s)}}function c(e){return o.url===e.url}function u(e){e&&"string"==typeof e.name&&(r=e.name)}function l(e){t.receive(e)}this.configure=u,this._receive=l,this.registered=function(e,o){(t=o).reload=s,n=t._debug},this.unregistered=function(){delete t.reload,t=null},this.outgoing=function(e){switch(e.channel){case"/meta/handshake":(o={}).url=t.getURL();var s=window.sessionStorage.getItem(r);if(n("Reload extension found state",s),s)try{var u=JSON.parse(s);if(window.sessionStorage.removeItem(r),u.handshakeResponse&&c(u)){n("Reload extension restoring state",u);var l=t._getCallback(e.id),h=this;return setTimeout((function(){n("Reload extension replaying handshake response",u.handshakeResponse),o.handshakeResponse=u.handshakeResponse,o.transportType=u.transportType,t._putCallback(e.id,l);var r=t._mixin(!0,{},o.handshakeResponse,{id:e.id,ext:{reload:!0}});r.supportedConnectionTypes=[o.transportType],h._receive(r),n("Reload extension replayed handshake response",r)}),0),a||(a=!0,t.startBatch()),null}n("Reload extension could not restore state",u)}catch(e){n("Reload extension error while trying to restore state",e)}break;case"/meta/connect":if(!0===i)return n("Reload extension aborting /meta/connect during reload"),null;o.transportType||(o.transportType=e.connectionType,n("Reload extension tracked transport type",o.transportType));break;case"/meta/disconnect":o={}}return e},this.incoming=function(e){if(e.successful)switch(e.channel){case"/meta/handshake":o.handshakeResponse||(o.handshakeResponse=e,n("Reload extension tracked handshake response",e));break;case"/meta/connect":a&&(a=!1,t.endBatch());break;case"/meta/disconnect":o={}}return e},u(e)}})),ft=Object.freeze(t({__proto__:null,default:pt},[pt]));e.Channel=class{constructor(t){a(this,"path",void 0),a(this,"update",void 0),a(this,"subscription",null);const{scopeBoundary:n,scopeKey:o,pushCategory:r}=t;(t=>{if(!t)throw new c("No scope found where one was required");const{scopeBoundary:n,scopeKey:o,pushCategory:r}=t;if(!n)throw new c("Missing scope component: scopeBoundary");if(!o)throw new c("Missing scope component: scopeKey");if(!r)throw new c("Missing scope component: pushCategory");if(!Object.prototype.hasOwnProperty.call(e.SCOPE_BOUNDARY,n))throw new c("Invalid scope boundary: ".concat(n));if(!Object.prototype.hasOwnProperty.call(e.PUSH_CATEGORY,r))throw new c("Invalid push category: ".concat(r))})(t),this.path="/".concat(n.toLowerCase(),"/").concat(o,"/").concat(r.toLowerCase()),J.subscriptions.has(this.path)&&(this.subscription=J.subscriptions.get(this.path))}publish(e){return J.publish(this,e)}async subscribe(e,t={}){return this.subscription&&await J.remove(this.subscription),this.update=e,this.subscription=await J.add(this,e,t),this.subscription}async unsubscribe(){this.subscription&&(await J.remove(this.subscription),this.subscription=null)}},e.Fault=u,e.Router=B,e.accountAdapter=K,e.adminAdapter=H,e.assetAdapter=oe,e.authAdapter=Q,e.chatAdapter=Ze,e.config=O,e.consensusAdapter=$e,e.dailyAdapter=it,e.emailAdapter=re,e.episodeAdapter=ie,e.errorManager=j,e.groupAdapter=ce,e.leaderboardAdapter=le,e.matchmakerAdapter=ot,e.presenceAdapter=he,e.projectAdapter=W,e.recaptchaAdapter=de,e.runAdapter=me,e.somebodyAdapter=Qe,e.taskAdapter=Je,e.timeAdapter=Xe,e.userAdapter=ge,e.utils=st,e.vaultAdapter=be,e.version=ct,e.videoAPI=Ce,e.videoAdapter=Ue,e.vonageAPI=Fe,e.vonageAdapter=We,e.worldAdapter=Ve,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=epicenter.min.js.map
|