UNPKG

47.5 kBJavaScriptView Raw
1!function(){"use strict";var e="undefined"==typeof global?self:global;if("function"!=typeof e.require){var t={},r={},n={},o={}.hasOwnProperty,i=/^\.\.?(\/|$)/,a=function(e,t){for(var r,n=[],o=(i.test(t)?e+"/"+t:t).split("/"),a=0,u=o.length;a<u;a++)".."===(r=o[a])?n.pop():"."!==r&&""!==r&&n.push(r);return n.join("/")},u=function(e){return e.split("/").slice(0,-1).join("/")},f=function(t,n){var o,i={id:t,exports:{},hot:p&&p.createHot(t)};return r[t]=i,n(i.exports,(o=t,function(t){var r=a(u(o),t);return e.require(r,o)}),i),i.exports},c=function(e){var t=n[e];return t&&e!==t?c(t):e},l=function(e,n){null==n&&(n="/");var i=c(e);if(o.call(r,i))return r[i].exports;if(o.call(t,i))return f(i,t[i]);throw new Error("Cannot find module '"+e+"' from '"+n+"'")};l.alias=function(e,t){n[t]=e};var s=/\.[^.\/]+$/,y=/\/index(\.[^\/]+)?$/;l.register=l.define=function(e,i){if(e&&"object"==typeof e)for(var a in e)o.call(e,a)&&l.register(a,e[a]);else t[e]=i,delete r[e],function(e){if(s.test(e)){var t=e.replace(s,"");o.call(n,t)&&n[t].replace(s,"")!==t+"/index"||(n[t]=e)}if(y.test(e)){var r=e.replace(y,"");o.call(n,r)||(n[r]=e)}}(e)},l.list=function(){var e=[];for(var r in t)o.call(t,r)&&e.push(r);return e};var p=e._hmr&&new e._hmr((function(e,t){return c(a(u(e),t))}),l,t,r);l._cache=r,l.hmr=p&&p.wrap,l.brunch=!0,e.require=l}}(),function(){"undefined"==typeof window||window;var e=function(e,t,r){var n={},o=function(t,r){try{return e(r+"/node_modules/"+t)}catch(e){if(-1===e.toString().indexOf("Cannot find module"))throw e;if(-1!==r.indexOf("node_modules")){var i=r.split("/"),a=i.lastIndexOf("node_modules"),u=i.slice(0,a).join("/");return o(t,u)}}return n};return function(i){if(i in t&&(i=t[i]),i){if("."!==i[0]&&r){var a=o(i,r);if(a!==n)return a}return e(i)}}};require.register("curvature/base/Bindable.js",(function(t,r,n){r=e(r,{},"curvature"),function(){"use strict";function e(t,o,i){return e=r()?Reflect.construct:function(e,t,r){var o=[null];o.push.apply(o,t);var i=new(Function.bind.apply(e,o));return r&&n(i,r.prototype),i},e.apply(null,arguments)}function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function n(e,t){return n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(e,t)}function o(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||a(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=a(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,f=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return u=e.done,e},e:function(e){f=!0,i=e},f:function(){try{u||null==r.return||r.return()}finally{if(f)throw i}}}}function a(e,t){if(e){if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0}),t.Bindable=void 0;var s=Symbol("ref"),y=Symbol("original"),p=Symbol("deck"),b=Symbol("binding"),v=Symbol("subBinding"),d=Symbol("bindingAll"),m=Symbol("isBindable"),h=Symbol("wrapping"),g=Symbol("Names"),w=Symbol("executing"),O=Symbol("stack"),j=(Symbol("object"),Symbol("wrapped")),P=Symbol("unwrapped"),S=Symbol("getProto"),k=Symbol("onGet"),_=Symbol("onAllGet"),A=Symbol("bindChain"),x=Symbol("Descriptors"),B=Symbol("Before"),E=Symbol("After"),C=Symbol("NoGetters"),I=Object.getPrototypeOf(Int8Array),M=Set.prototype[Symbol.iterator],D=Map.prototype[Symbol.iterator],T=globalThis,R=[T.Node,T.File,T.Map,T.Set,T.WeakMap,T.WeakSet,T.ArrayBuffer,T.ResizeObserver,T.MutationObserver,T.PerformanceObserver,T.IntersectionObserver,T.IDBCursor,T.IDBCursorWithValue,T.IDBDatabase,T.IDBFactory,T.IDBIndex,T.IDBKeyRange,T.IDBObjectStore,T.IDBOpenDBRequest,T.IDBRequest,T.IDBTransaction,T.IDBVersionChangeEvent,T.Event,T.CustomEvent,T.FileSystemFileHandle].filter((function(e){return"function"==typeof e})),F=function(){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t)}var r,n,a;return r=t,a=[{key:"isBindable",value:function(e){return!(!e||!e[m])&&e[m]===t}},{key:"onDeck",value:function(e,t){return e[p][t]||!1}},{key:"ref",value:function(e){return e[s]||e||!1}},{key:"makeBindable",value:function(e){return this.make(e)}},{key:"shuck",value:function(e,r){r=r||new Map;var n={};if(e instanceof I||e instanceof ArrayBuffer){var o=e.slice(0);return r.set(e,o),o}var i=Object.keys(e);for(var a in i){var u=i[a];if("___"!==u.substring(0,3)){var c=r.get(e[u]);if(c)n[u]=c;else if(e[u]!==e){if(e[u]&&"object"===f(e[u])){var l=e[u];t.isBindable(e[u])&&(l=e[u][y]),n[u]=this.shuck(l,r)}else n[u]=e[u];r.set(e[u],n[u])}else r.set(e[u],n),n[u]=n}}return t.isBindable(e)&&(delete n.bindTo,delete n.isBound),n}},{key:"make",value:function(r){var n=this;if(!r||!["function","object"].includes(f(r)))return r;if(r[s])return r[s];if(r[m])return r;if(Object.isSealed(r)||Object.isFrozen(r)||!Object.isExtensible(r)||R.filter((function(e){return r instanceof e})).length)return r;Object.defineProperty(r,m,{configurable:!1,enumerable:!1,writable:!1,value:t}),Object.defineProperty(r,s,{configurable:!0,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(r,y,{configurable:!1,enumerable:!1,writable:!1,value:r}),Object.defineProperty(r,p,{configurable:!1,enumerable:!1,writable:!1,value:{}}),Object.defineProperty(r,b,{configurable:!1,enumerable:!1,writable:!1,value:{}}),Object.defineProperty(r,v,{configurable:!1,enumerable:!1,writable:!1,value:new Map}),Object.defineProperty(r,d,{configurable:!1,enumerable:!1,writable:!1,value:[]}),Object.defineProperty(r,w,{enumerable:!1,writable:!0}),Object.defineProperty(r,h,{enumerable:!1,writable:!0}),Object.defineProperty(r,O,{configurable:!1,enumerable:!1,writable:!1,value:[]}),Object.defineProperty(r,B,{configurable:!1,enumerable:!1,writable:!1,value:[]}),Object.defineProperty(r,E,{configurable:!1,enumerable:!1,writable:!1,value:[]}),Object.defineProperty(r,j,{configurable:!1,enumerable:!1,writable:!1,value:Object.preventExtensions(new Map)}),Object.defineProperty(r,P,{configurable:!1,enumerable:!1,writable:!1,value:{}}),Object.defineProperty(r,x,{configurable:!1,enumerable:!1,writable:!1,value:Object.preventExtensions(new Map)}),Object.defineProperty(r,"bindTo",{configurable:!1,enumerable:!1,writable:!1,value:function e(o){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},u=!1;if(Array.isArray(o)){var c=o.forEach((function(t){return e(t,i,a)}));return function(){return c.forEach((function(e){return e()}))}}if(o instanceof Function&&(a=i||{},i=o,u=!0),a.delay>=0&&(i=n.wrapDelayCallback(i,a.delay)),a.throttle>=0&&(i=n.wrapThrottleCallback(i,a.throttle)),a.wait>=0&&(i=n.wrapWaitCallback(i,a.wait)),a.frame&&(i=n.wrapFrameCallback(i,a.frame)),a.idle&&(i=n.wrapIdleCallback(i)),u){var l=r[d].length;if(r[d].push(i),!("now"in a)||a.now)for(var s in r)i(r[s],s,r,!1);return function(){delete r[d][l]}}if(r[b][o]||(r[b][o]=new Set),a.children){var y=i;i=function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];var i=n[0],u=r[v].get(y);if(u&&(r[v].delete(y),u()),"object"===f(i)){var c=t.make(i);t.isBindable(c)&&r[v].set(y,c.bindTo((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return y.apply(void 0,n.concat(t))}),Object.assign({},a,{children:!1}))),y.apply(void 0,n)}else y.apply(void 0,n)}}r[b][o].add(i),"now"in a&&!a.now||i(r[o],o,r,!1);var p=function(){var e=r[v].get(i);e&&(r[v].delete(i),e()),r[b][o]&&r[b][o].has(i)&&r[b][o].delete(i)};return a.removeWith&&a.removeWith instanceof View&&a.removeWith.onRemove((function(){return p})),p}}),Object.defineProperty(r,A,{configurable:!1,enumerable:!1,writable:!1,value:function(e,t){var o=e.split("."),i=o.shift(),a=o.slice(0),u=[];return u.push(r.bindTo(i,(function(e,r,o,i){var f=a.join(".");0!==a.length?(void 0===e&&(e=o[r]=n.make({})),u=u.concat(e[A](f,t))):t(e,r,o,i)}))),function(){return u.forEach((function(e){return e()}))}}}),Object.defineProperty(r,"___before",{configurable:!1,enumerable:!1,writable:!1,value:function(e){var t=r[B].length;r[B].push(e);var n=!1;return function(){n||(n=!0,delete r[B][t])}}}),Object.defineProperty(r,"___after",{configurable:!1,enumerable:!1,writable:!1,value:function(e){var t=r[E].length;r[E].push(e);var n=!1;return function(){n||(n=!0,delete r[E][t])}}}),Object.defineProperty(r,"isBound",{configurable:!1,enumerable:!1,writable:!1,value:function(){for(var e in r[d])if(r[d][e])return!0;for(var t in r[b]){var n,o=i(r[b][t]);try{for(o.s();!(n=o.n()).done;)if(n.value)return!0}catch(e){o.e(e)}finally{o.f()}}return!1}});var a=function(e){r[e]&&r[e]instanceof Object&&!r[e]instanceof Promise&&(R.filter((function(t){return r[e]instanceof t})).length||!Object.isExtensible(r[e])||Object.isSealed(r[e])||(r[e]=t.make(r[e])))};for(var u in r)a(u);var c=r[x],l=r[j],T=r[O],F={get:function(n,o){if(l.has(o))return l.get(o);if(o===s||o===y||"apply"===o||"isBound"===o||"bindTo"===o||"__proto__"===o||"constructor"===o)return r[o];var a;if(c.has(o)?a=c.get(o):(a=Object.getOwnPropertyDescriptor(r,o),c.set(o,a)),a&&!a.configurable&&!a.writable)return r[o];if(_ in r)return r[_](o);if(k in r&&!(o in r))return r[k](o);if(a&&!a.configurable&&!a.writable)return l.set(o,r[o]),r[o];if("function"==typeof r[o]){if(g in r[o])return r[o];Object.defineProperty(r[P],o,{configurable:!1,enumerable:!1,writable:!0,value:r[o]});var u=Object.getPrototypeOf(r)[o]===r[o],f="function"==typeof Promise&&r instanceof Promise||"function"==typeof Map&&r instanceof Map||"function"==typeof Set&&r instanceof Set||"function"==typeof D&&r.prototype===D||"function"==typeof M&&r.prototype===M||"function"==typeof M&&r.prototype===M||"function"==typeof WeakMap&&r instanceof WeakMap||"function"==typeof WeakSet&&r instanceof WeakSet||"function"==typeof Date&&r instanceof Date||"function"==typeof I&&r instanceof I||"function"==typeof ArrayBuffer&&r instanceof ArrayBuffer||"function"==typeof EventTarget&&r instanceof EventTarget||"function"==typeof ResizeObserver&&r instanceof ResizeObserver||"function"==typeof MutationObserver&&r instanceof MutationObserver||"function"==typeof PerformanceObserver&&r instanceof PerformanceObserver||"function"==typeof IntersectionObserver&&r instanceof IntersectionObserver||"function"==typeof r[Symbol.iterator]&&"next"===o?r:r[s],p=function(){r[w]=o,T.unshift(o);for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];var c,l,s=i(r[B]);try{for(s.s();!(c=s.n()).done;){var y=c.value;y(r,o,T,r,n)}}catch(e){s.e(e)}finally{s.f()}if(new.target)l=e(r[P][o],n);else{var p=r[P][o];l=u?p.apply(f||r,n):p.apply(void 0,n)}var b,v=i(r[E]);try{for(v.s();!(b=v.n()).done;){var d=b.value;d(r,o,T,r,n)}}catch(e){v.e(e)}finally{v.f()}return r[w]=null,T.shift(),l};(p[g]=p[g]||new WeakMap).set(r,o),p[_]=function(e){var t=p[g].get(r);return r[t][e]};var b=t.make(p);return l.set(o,b),b}return r[o]},set:function(e,n,o){if(l.has(n)&&l.delete(n),n===y)return!0;var a=r[p];if(n in a&&a[n]===o)return!0;if(n.slice&&"___"===n.slice(-3))return!0;if(e[n]===o||"number"==typeof o&&isNaN(a[n])&&isNaN(o))return!0;for(var u in o&&o instanceof Object&&(R.filter((function(e){return r instanceof e})).length||!Object.isExtensible(r)||Object.isSealed(r)||(r[C],o=t.make(o))),a[n]=o,r[d])r[d][u]&&r[d][u](o,n,e,!1);var f=!1;if(n in r[b]){var c,s=i(r[b][n]);try{for(s.s();!(c=s.n()).done;)!1===(0,c.value)(o,n,e,!1,e[n])&&(f=!0)}catch(e){s.e(e)}finally{s.f()}}if(delete a[n],!f){var v=Object.getOwnPropertyDescriptor(e,n);e instanceof File&&"lastModifiedDate"==n||v&&!v.writable||e[n]!==o||(e[n]=o)}var m=Reflect.set(e,n,o);if(Array.isArray(e)&&r[b].length)for(var h in r[b].length)(0,r[b].length[h])(e.length,"length",e,!1,e.length);return m},construct:function(n,i){var a="constructor";for(var u in n[B])n[B][u](n,a,r[O],void 0,i);var f=t.make(e(n[y],o(i)));for(var c in n[E])n[E][c](n,a,r[O],f,i);return f},getPrototypeOf:function(e){return S in r?r[S]:Reflect.getPrototypeOf(e)},deleteProperty:function(e,t){var n=r[p];if(void 0!==n[t])return!0;if(!(t in e))return!0;if(c.has(t)){var o=c.get(t);if(o&&!o.configurable)return!1;c.delete(t)}for(var a in n[t]=null,l.has(t)&&l.delete(t),r[d])r[d][a](void 0,t,e,!0,e[t]);if(t in r[b]){var u,f=i(r[b][t]);try{for(f.s();!(u=f.n()).done;)(0,u.value)(void 0,t,e,!0,e[t])}catch(e){f.e(e)}finally{f.f()}}return delete n[t],delete e[t],!0}};return r[C]&&delete F.get,Object.defineProperty(r,s,{configurable:!1,enumerable:!1,writable:!1,value:new Proxy(r,F)}),r[s]}},{key:"clearBindings",value:function(e){var t,r=(t=function(e){return Object.keys(e).map((function(t){return delete e[t]}))},function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return r.map(t)});r(e[j],e[b],e[d],e[E],e[B])}},{key:"resolve",value:function(e,t){for(var r,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=t.split("."),i=o[0];o.length;){if(n&&1===o.length){var a=this.make(e);return[a,o.shift(),i]}!(!(r=o.shift())in e)&&e[r]&&e[r]instanceof Object||(e[r]={}),e=this.make(e[r])}return[this.make(e),r,i]}},{key:"wrapDelayCallback",value:function(e,t){return function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return setTimeout((function(){return e.apply(void 0,n)}),t)}}},{key:"wrapThrottleCallback",value:function(e,t){var r=this;return this.throttles.set(e,!1),function(){r.throttles.get(e,!0)||(e.apply(void 0,arguments),r.throttles.set(e,!0),setTimeout((function(){r.throttles.set(e,!1)}),t))}}},{key:"wrapWaitCallback",value:function(e,t){var r=this;return function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];var a;(a=r.waiters.get(e))&&(r.waiters.delete(e),clearTimeout(a)),a=setTimeout((function(){return e.apply(void 0,o)}),t),r.waiters.set(e,a)}}},{key:"wrapFrameCallback",value:function(e,t){return function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];requestAnimationFrame((function(){return e.apply(void 0,r)}))}}},{key:"wrapIdleCallback",value:function(e){return function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var o=window.requestIdleCallback||requestAnimationFrame;o((function(){return e.apply(void 0,r)}))}}}],(n=null)&&c(r.prototype,n),a&&c(r,a),Object.defineProperty(r,"prototype",{writable:!1}),t}();t.Bindable=F,l(F,"waiters",new WeakMap),l(F,"throttles",new WeakMap),Object.defineProperty(F,"OnGet",{configurable:!1,enumerable:!1,writable:!1,value:k}),Object.defineProperty(F,"NoGetters",{configurable:!1,enumerable:!1,writable:!1,value:C}),Object.defineProperty(F,"GetProto",{configurable:!1,enumerable:!1,writable:!1,value:S}),Object.defineProperty(F,"OnAllGet",{configurable:!1,enumerable:!1,writable:!1,value:_})}()})),require.register("curvature/base/Mixin.js",(function(t,r,n){r=e(r,{},"curvature"),function(){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Mixin=void 0;var e=r("./Bindable");function n(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||a(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=a(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,f=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return u=e.done,e},e:function(e){f=!0,i=e},f:function(){try{u||null==r.return||r.return()}finally{if(f)throw i}}}}function a(e,t){if(e){if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}function c(e,t){return c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},c(e,t)}function l(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=p(e);if(t){var o=p(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return s(this,r)}}function s(e,t){if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return y(e)}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function b(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function d(e,t,r){return t&&v(e.prototype,t),r&&v(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var m=Symbol("constructor"),h=(Symbol("mixinList"),function(){function t(){b(this,t)}return d(t,null,[{key:"from",value:function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];var u=function(r){f(u,r);var a=l(u);function u(){var r;b(this,u);for(var f=arguments.length,c=new Array(f),l=0;l<f;l++)c[l]=arguments[l];var p,v=e.constructor?r=a.call.apply(a,[this].concat(c)):null,d=i(n);try{for(d.s();!(p=d.n()).done;){var m=p.value;switch(m[t.Constructor]&&m[t.Constructor].apply(y(r)),o(m)){case"function":t.mixClass(m,u);break;case"object":t.mixObject(m,y(r))}}}catch(e){d.e(e)}finally{d.f()}return s(r,v)}return d(u)}(e);return u}},{key:"make",value:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var o=r.pop();return t.to.apply(t,[o].concat(r))}},{key:"to",value:function(e){for(var t={},r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];n.map((function(r){switch(o(r)){case"object":Object.assign(t,Object.getOwnPropertyDescriptors(r));break;case"function":Object.assign(t,Object.getOwnPropertyDescriptors(r.prototype))}delete t.constructor,Object.defineProperties(e.prototype,t)}))}},{key:"with",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.from.apply(this,[function(){return d((function e(){b(this,e)}))}()].concat(t))}},{key:"mixObject",value:function(e,t){var r,n=i(Object.getOwnPropertyNames(e));try{for(n.s();!(r=n.n()).done;){var o=r.value;"function"!=typeof e[o]?t[o]=e[o]:t[o]=e[o].bind(t)}}catch(e){n.e(e)}finally{n.f()}var a,u=i(Object.getOwnPropertySymbols(e));try{for(u.s();!(a=u.n()).done;){var f=a.value;"function"!=typeof e[f]?t[f]=e[f]:t[f]=e[f].bind(t)}}catch(e){u.e(e)}finally{u.f()}}},{key:"mixClass",value:function(e,t){var r,n=i(Object.getOwnPropertyNames(e.prototype));try{for(n.s();!(r=n.n()).done;){var o=r.value;if(!["name","prototype","length"].includes(o)){var a=Object.getOwnPropertyDescriptor(t,o);a&&!a.writable||("function"==typeof e[o]?t.prototype[o]=e.prototype[o].bind(t.prototype):t.prototype[o]=e.prototype[o])}}}catch(e){n.e(e)}finally{n.f()}var u,f=i(Object.getOwnPropertySymbols(e.prototype));try{for(f.s();!(u=f.n()).done;){var c=u.value;"function"==typeof e[c]?t.prototype[c]=e.prototype[c].bind(t.prototype):t.prototype[c]=e.prototype[c]}}catch(e){f.e(e)}finally{f.f()}var l,s=i(Object.getOwnPropertyNames(e));try{var y=function(){var r=l.value;if(["name","prototype","length"].includes(r))return"continue";var n=Object.getOwnPropertyDescriptor(t,r);if(n&&!n.writable)return"continue";if("function"!=typeof e[r])return t[r]=e[r],"continue";var o=t[r]||!1,i=e[r].bind(t);t[r]=function(){return o&&o.apply(void 0,arguments),i.apply(void 0,arguments)}};for(s.s();!(l=s.n()).done;)y()}catch(e){s.e(e)}finally{s.f()}var p,b=i(Object.getOwnPropertySymbols(e));try{var v=function(){var r=p.value;if("function"!=typeof e[r])return t.prototype[r]=e[r],"continue";var n=t[r]||!1,o=e[r].bind(t);t[r]=function(){return n&&n.apply(void 0,arguments),o.apply(void 0,arguments)}};for(b.s();!(p=b.n()).done;)v()}catch(e){b.e(e)}finally{b.f()}}},{key:"mix",value:function(t){for(var r={},o={},a=e.Bindable.makeBindable(t),u=function(e){var t,u=Object.getOwnPropertyNames(e.prototype),f=Object.getOwnPropertyNames(e),c=/^(before|after)__(.+)/,l=i(f);try{var s=function(){var o=t.value,i=o.match(c);if(i){switch(i[1]){case"before":a.___before((function(t,r,a,u,f){if(r===i[2])return e[o].bind(u).apply(void 0,n(f))}));break;case"after":a.___after((function(t,r,a,u,f){if(r===i[2])return e[o].bind(u).apply(void 0,n(f))}))}return"continue"}return r[o]||"function"!=typeof e[o]?"continue":void(r[o]=e[o])};for(l.s();!(t=l.n()).done;)s()}catch(e){l.e(e)}finally{l.f()}var y,p=i(u);try{var b=function(){var t=y.value,r=t.match(c);if(r){switch(r[1]){case"before":a.___before((function(o,i,a,u,f){if(i===r[2])return e.prototype[t].bind(u).apply(void 0,n(f))}));break;case"after":a.___after((function(o,i,a,u,f){if(i===r[2])return e.prototype[t].bind(u).apply(void 0,n(f))}))}return"continue"}return o[t]||"function"!=typeof e.prototype[t]?"continue":void(o[t]=e.prototype[t])};for(p.s();!(y=p.n()).done;)b()}catch(e){p.e(e)}finally{p.f()}},f=this;f&&f.prototype;f=Object.getPrototypeOf(f))u(f);for(var c in r)t[c]=r[c].bind(t);var l=function(e){t.prototype[e]=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return o[e].apply(this,r)}};for(var s in o)l(s);return a}}]),t}());t.Mixin=h,h.Constructor=m}()})),require.register("curvature/base/Uuid.js",(function(t,r,n){r=e(r,{},"curvature"),function(){"use strict";var e;function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0}),t.Uuid=void 0,e=Symbol.toPrimitive;var i=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(r(this,t),o(this,"uuid",null),o(this,"version",4),e){if(!e||"string"!=typeof e&&!(e instanceof t)||!e.match(/[0-9A-Fa-f]{8}(-[0-9A-Fa-f]{4}){3}-[0-9A-Fa-f]{12}/))throw new Error('Invalid input for Uuid: "'.concat(e,'"'));this.version=n,this.uuid=e}else"function"==typeof crypto.randomUUID?this.uuid=crypto.randomUUID():this.uuid=([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(e){return(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)}));Object.freeze(this)}var i,a,u;return i=t,(a=[{key:e,value:function(){return this.toString()}},{key:"toString",value:function(){return this.uuid}},{key:"toJson",value:function(){return{version:this.version,uuid:this.uuid}}}])&&n(i.prototype,a),u&&n(i,u),Object.defineProperty(i,"prototype",{writable:!1}),t}();t.Uuid=i}()})),require.register("curvature/mixin/EventTargetMixin.js",(function(t,r,n){r=e(r,{},"curvature"),function(){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventTargetMixin=void 0;var e,n=r("../base/Mixin");function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var i=Symbol("Target"),a=(o(e={},n.Mixin.Constructor,(function(){try{this[i]=new EventTarget}catch(e){this[i]=document.createDocumentFragment()}})),o(e,"dispatchEvent",(function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var o=r[0];"string"==typeof o&&(o=new CustomEvent(o),r[0]=o),(e=this[i]).dispatchEvent.apply(e,r);var a="on".concat(o.type[0].toUpperCase()+o.type.slice(1));return"function"==typeof this[a]&&this[a](o),o.returnValue})),o(e,"addEventListener",(function(){var e;(e=this[i]).addEventListener.apply(e,arguments)})),o(e,"removeEventListener",(function(){var e;(e=this[i]).removeEventListener.apply(e,arguments)})),e);t.EventTargetMixin=a}()})),require.register("build/Config.js",(function(e,t,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Config=void 0;e.Config={title:"matrix-api 0.0.0-f"}})),require.register("___globals___",(function(e,t,r){}))}(),require("___globals___");
2!function(){"use strict";var e="undefined"==typeof global?self:global;if("function"!=typeof e.require){var t={},n={},r={},o={}.hasOwnProperty,i=/^\.\.?(\/|$)/,a=function(e,t){for(var n,r=[],o=(i.test(t)?e+"/"+t:t).split("/"),a=0,c=o.length;a<c;a++)".."===(n=o[a])?r.pop():"."!==n&&""!==n&&r.push(n);return r.join("/")},c=function(e){return e.split("/").slice(0,-1).join("/")},s=function(t,r){var o,i={id:t,exports:{},hot:v&&v.createHot(t)};return n[t]=i,r(i.exports,(o=t,function(t){var n=a(c(o),t);return e.require(n,o)}),i),i.exports},u=function(e){var t=r[e];return t&&e!==t?u(t):e},l=function(e,r){null==r&&(r="/");var i=u(e);if(o.call(n,i))return n[i].exports;if(o.call(t,i))return s(i,t[i]);throw new Error("Cannot find module '"+e+"' from '"+r+"'")};l.alias=function(e,t){r[t]=e};var f=/\.[^.\/]+$/,h=/\/index(\.[^\/]+)?$/;l.register=l.define=function(e,i){if(e&&"object"==typeof e)for(var a in e)o.call(e,a)&&l.register(a,e[a]);else t[e]=i,delete n[e],function(e){if(f.test(e)){var t=e.replace(f,"");o.call(r,t)&&r[t].replace(f,"")!==t+"/index"||(r[t]=e)}if(h.test(e)){var n=e.replace(h,"");o.call(r,n)||(r[n]=e)}}(e)},l.list=function(){var e=[];for(var n in t)o.call(t,n)&&e.push(n);return e};var v=e._hmr&&new e._hmr((function(e,t){return u(a(c(e),t))}),l,t,n);l._cache=n,l.hmr=v&&v.wrap,l.brunch=!0,e.require=l}}(),function(){"undefined"==typeof window||window;require.register("matrix-api/Matrix.js",(function(e,t,n){"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.Matrix=void 0;var o=t("curvature/base/Uuid"),i=t("curvature/base/Mixin"),a=t("curvature/mixin/EventTargetMixin");function c(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=u(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw i}}}}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],a=!0,c=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){c=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(c)throw o}}return i}(e,t)||u(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){if(e){if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y(e);if(t){var o=y(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return d(this,n)}}function d(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var b=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}(a,e);var t,n,r,i=p(a);function a(e){var t,n,r,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return f(this,a),g(m(r=i.call(this)),"ssoUuid",String(new o.Uuid)),g(m(r),"isLoggedIn",!1),g(m(r),"loggingIn",null),r.baseUrl=e||"https://matrix.org/_matrix",r.clientUrl="".concat(r.baseUrl,"/client/v3"),r.mediaUrl="".concat(r.baseUrl,"/media/v3"),r.profileCache=new Map,r.mediaCache=new Map,r.storage=null!==(t=c.storage)&&void 0!==t?t:globalThis.sessionStorage,r.interval=null!==(n=c.interval)&&void 0!==n&&n,r}return t=a,n=[{key:"isLoggedIn",get:function(){this.isLoggedIn&&this.dispatchEvent(new CustomEvent("logged-in"));var e=this.storage.getItem("matrix:access-token")||"false";return JSON.parse(e),this.storage.getItem("matrix:access-token")}},{key:"initSso",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;if(this.storage.getItem("matrix:access-token"))return this.isLoggedIn=!0,void this.dispatchEvent(new CustomEvent("logged-in"));var r=new URLSearchParams({redirectUrl:e}),o="login/sso/redirect?".concat(r),i=400,a=600,c=window.screenX+window.outerWidth/2+i/2,s=window.screenY+window.outerHeight/2-a/2,u="width=".concat(i,",height=").concat(a,",screenX=").concat(c,",screenY=").concat(s),l=(n.open("".concat(this.clientUrl,"/").concat(o),"matrix-login-".concat(this.ssoUuid),u),function e(r){if(r.origin===location.origin&&r.source!==window&&"string"==typeof r.data){var o=JSON.parse(r.data);"s.sso.complete"===o.type&&(t.storage.setItem("matrix:access-token",JSON.stringify(o.data)),t.isLoggedIn=!0,t.dispatchEvent(new CustomEvent("logged-in")),n.removeEventListener("message",e))}});n.addEventListener("message",l)}},{key:"completeSso",value:function(e){var t={type:"m.login.token",token:e,txn_id:(1/Math.random()).toString(36)};fetch("".concat(this.clientUrl,"/").concat("login"),{method:"POST",body:JSON.stringify(t)}).then((function(e){return e.json()})).then((function(e){window.opener.postMessage(JSON.stringify({type:"s.sso.complete",data:e}),location.origin),window.close()}))}},{key:"logIn",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;return this.loggingIn||(this.loggingIn=new Promise((function(e){t.loggingIn=null,t.addEventListener("logged-in",(function(t){e(t)}),{once:!0})}))),this.initSso(e,n),this.loggingIn}},{key:"logOut",value:function(){this.storage.removeItem("matrix:access-token"),this.isLoggedIn=!1,this.loggingIn=null,this.dispatchEvent(new CustomEvent("logged-out"))}},{key:"getGuestToken",value:function(){var e=this,t=this.storage.getItem("matrix:access-token")||"false",n=JSON.parse(t);if(n&&n.isGuest)return Promise.resolve(n);var r=new URLSearchParams({kind:"guest"}),o=fetch("".concat(this.clientUrl,"/register?").concat(r),{method:"POST",body:"{}"}).then((function(e){return e.json()}));return o.then((function(t){t.isGuest=!0,e.isLoggedIn=!0,e.storage.setItem("matrix:access-token",JSON.stringify(t))})),o}},{key:"getToken",value:function(){var e=this.storage.getItem("matrix:access-token")||"false",t=JSON.parse(e);return t?Promise.resolve(t):matrix.getGuestToken()}},{key:"listenForServerEvents",value:function(){var e=this,t=JSON.parse(this.storage.getItem("matrix:access-token")||"false");if(!t)return Promise.reject("No access token found.");var n=new URLSearchParams({access_token:t.access_token}),r="".concat(this.clientUrl,"/events?").concat(n);fetch(r).then((function(e){return e.json()})).then((function(t){return e.streamServerEvents(t)}))}},{key:"listenForRoomEvents",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(!t||!t.cancelled){var o=JSON.parse(this.storage.getItem("matrix:access-token")||"false");if(!o)return Promise.reject("No access token found.");var i=new URLSearchParams({access_token:o.access_token,room_id:e,from:r}),a="".concat(this.clientUrl,"/events?").concat(i);return t=t||{cancelled:!1},fetch(a).then((function(e){return e.json()})).then((function(r){return n.streamServerEvents(r,e,t)})),t}}},{key:"streamServerEvents",value:function(e,t,n){var r=this;n&&n.cancelled||(this.interval?setTimeout((function(){t?r.listenForRoomEvents(t,n,e.end):r.listenForServerEvents()}),this.interval):t?this.listenForRoomEvents(t,n,e.end):this.listenForServerEvents(),e.chunk&&e.chunk.forEach((function(e){var t={};e.event_id||(e.event_id="local:".concat(new o.Uuid)),Object.assign(t,e),r.dispatchEvent(new CustomEvent("matrix-event",{detail:t})),r.dispatchEvent(new CustomEvent(t.type,{detail:t}))})))}},{key:"getUserProfile",value:function(e){if(this.profileCache.has(e))return this.profileCache.get(e);var t=fetch("".concat(this.clientUrl,"/profile/").concat(e)).then((function(e){return e.json()}));return this.profileCache.set(e,t),t}},{key:"getUserData",value:function(e){var t=JSON.parse(this.storage.getItem("matrix:access-token")||"false");if(!t)return Promise.reject("No access token found.");var n=new URLSearchParams({access_token:t.access_token});return fetch("".concat(this.clientUrl,"/user/").concat(t.user_id,"/account_data/").concat(e,"?").concat(n)).then((function(e){return e.json()}))}},{key:"putUserData",value:function(e,t){var n=JSON.parse(this.storage.getItem("matrix:access-token")||"false");if(n){var r=new URLSearchParams({access_token:n.access_token}),o="".concat(this.clientUrl,"/user/").concat(n.user_id,"/account_data/").concat(e,"?").concat(r);return fetch(o,{method:"PUT",body:t}).then((function(e){if(!e.ok){var t=new Error("HTTP status code: "+e.status);throw t.status=e.status,t.response=e,t}return e})).then((function(e){return e.json()}))}}},{key:"getMediaUrl",value:function(e){var t=new URL(e);return"".concat(this.mediaUrl,"/download/").concat(t.pathname.substr(2))}},{key:"getMedia",value:function(e){if(this.mediaCache.has(e))return this.mediaCache.get(e);var t=fetch(this.getMediaUrl(e)).then((function(e){return Promise.all([e.arrayBuffer(),e.headers.get("Content-type")])})).then((function(e){var t=s(e,2),n=t[0],r=t[1];return URL.createObjectURL(new Blob([n],{type:r}))}));return this.mediaCache.set(e,t),t}},{key:"postMedia",value:function(e,t){var n=this.storage.getItem("matrix:access-token")||"false",r=JSON.parse(n);if(r){var o=new URLSearchParams({access_token:r.access_token}),i="".concat(this.mediaUrl,"/upload?").concat(o),a=new Headers({"Content-Type":e.type});return fetch(i,{method:"POST",headers:a,body:e}).then((function(e){return e.json()}))}}},{key:"putEvent",value:function(e,t,n){var r=this.storage.getItem("matrix:access-token")||"false",o=JSON.parse(r);if(o){var i=new URLSearchParams({access_token:o.access_token}),a="".concat(this.clientUrl,"/rooms/").concat(e,"/send/").concat(t,"/").concat(Math.random().toString(36),"?").concat(i),c=g({method:"PUT",headers:new Headers({"Content-Type":"application/json"}),keepalive:!0,body:JSON.stringify(n)},"keepalive",!0);return fetch(a,c).then((function(e){return e.json()}))}}},{key:"getEvent",value:function(e,t){var n=this.storage.getItem("matrix:access-token")||"false",r=JSON.parse(n);if(r){var o=new URLSearchParams({access_token:r.access_token}),i="".concat(this.clientUrl,"/rooms/").concat(e,"/event/").concat(t,"?").concat(o),a=new Headers({"Content-Type":"application/json"});return fetch(i,{method:"GET",headers:a}).then((function(e){return e.json()}))}}},{key:"sync",value:function(){var e=this.storage.getItem("matrix:access-token")||"false",t=JSON.parse(e);if(!t)return Promise.resolve();var n=new URLSearchParams({full_state:!0,access_token:t.access_token}),r="".concat(this.clientUrl,"/sync?").concat(n);return fetch(r).then((function(e){return e.json()}))}},{key:"getRoomState",value:function(e){var t=this.storage.getItem("matrix:access-token")||"false",n=JSON.parse(t);if(!n)return Promise.resolve();var r=new URLSearchParams({access_token:n.access_token}),o="".concat(this.clientUrl,"/rooms/").concat(e,"/state?").concat(r);return fetch(o).then((function(e){return e.json()}))}},{key:"syncRoom",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!this.isLoggedIn)return Promise.reject("Logged out.");var r=JSON.parse(this.storage.getItem("matrix:access-token")||"false");if(!r)return Promise.reject("No access token found.");var o=new URLSearchParams({access_token:r.access_token,room_id:e,dir:"b",from:t||"",filter:n?JSON.stringify(n):""}),i="".concat(this.clientUrl,"/rooms/").concat(e,"/messages?").concat(o),a=new AbortController,c=a.signal,s=function(){return a.abort()};this.addEventListener("logged-out",s,{once:!0});var u=fetch(i,{signal:c}).then((function(e){return e.json()}));return u.finally(this.removeEventListener("logged-out",s)),u}},{key:"syncRoomHistory",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;return this.syncRoom(e,o,i).then((function(o){if(!t.isLoggedIn)return Promise.reject("Logged out.");var a=new CustomEvent("roomSyncFrame",{detail:{frame:o},cancelable:!0});if(t.dispatchEvent(a)){if(n&&o.chunk){var s,u=c(o.chunk);try{for(u.s();!(s=u.n()).done;){var l=s.value;if(!t.isLoggedIn)return Promise.reject("Logged out.");if(r&&l.origin_server_ts<=r)return Promise.resolve();if(!1===n(l))return Promise.resolve()}}catch(e){u.e(e)}finally{u.f()}}return new Promise((function(a){var c;return setTimeout((function(){return a(o.chunk.length&&t.syncRoomHistory(e,n,r,o.end,i))}),null!==(c=t.interval)&&void 0!==c?c:0)}))}}))}},{key:"getCurrentUserId",value:function(){var e=this.storage.getItem("matrix:access-token")||"false",t=JSON.parse(e);if(t)return t.user_id}},{key:"createRoom",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=JSON.stringify({name:e,topic:t,visibility:n,initial_state:r}),i=JSON.parse(this.storage.getItem("matrix:access-token")||"false");if(!i)return Promise.resolve();var a=new URLSearchParams({access_token:i.access_token}),c="".concat(this.clientUrl,"/createRoom?").concat(a),s="POST";return fetch(c,{body:o,method:s}).then((function(e){return e.json()}))}},{key:"joinRoom",value:function(e){var t=JSON.parse(this.storage.getItem("matrix:access-token")||"false");if(!t)return Promise.reject("No access token found.");var n=new URLSearchParams({access_token:t.access_token});fetch("".concat(this.clientUrl,"/rooms/").concat(e,"/join?").concat(n),{method:"POST"}).then((function(e){return e.json()}))}},{key:"leaveRoom",value:function(e){var t=JSON.parse(this.storage.getItem("matrix:access-token")||"false");if(!t)return Promise.reject("No access token found.");var n=new URLSearchParams({access_token:t.access_token});fetch("".concat(this.clientUrl,"/rooms/").concat(e,"/leave?").concat(n),{method:"POST"}).then((function(e){return e.json()}))}},{key:"whoAmI",value:function(){var e=JSON.parse(this.storage.getItem("matrix:access-token")||"false");if(!e)return Promise.reject("No access token found.");var t=new URLSearchParams({access_token:e.access_token});return fetch("".concat(this.clientUrl,"/account/whoami?").concat(t)).then((function(e){return e.json()}))}}],n&&h(t.prototype,n),r&&h(t,r),Object.defineProperty(t,"prototype",{writable:!1}),a}(i.Mixin.with(a.EventTargetMixin));e.Matrix=b})),require.register("matrix-api/MatrixEvent.js",(function(e,t,n){"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function c(e){var t="function"==typeof Map?new Map:void 0;return c=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return s(e,arguments,f(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,e)},c(e)}function s(e,t,n){return s=u()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&l(o,n.prototype),o},s.apply(null,arguments)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.MatrixEvent=void 0;var h=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(v,e);var t,n,r,c,s,h=(t=v,n=u(),function(){var e,r=f(t);if(n){var o=f(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return a(this,e)});function v(){return i(this,v),h.apply(this,arguments)}return r=v,c&&o(r.prototype,c),s&&o(r,s),Object.defineProperty(r,"prototype",{writable:!1}),r}(c(CustomEvent));e.MatrixEvent=h})),require.register("matrix-api/Room.js",(function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(e,"__esModule",{value:!0}),e.Room=void 0;var i=o((function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}));e.Room=i})),require.register("matrix-api/Sync.js",(function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(e,"__esModule",{value:!0}),e.Sync=void 0;var i=o((function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}));e.Sync=i})),require.register("matrix-api/User.js",(function(e,t,n){})),require.register("___globals___",(function(e,t,n){}))}(),require("___globals___");