🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

matrix-api

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

matrix-api - npm Package Compare versions

Comparing version
0.0.0-e
to
0.0.0-f
+1
-1
dist/matrix-api.standalone.js

@@ -0,2 +1,2 @@

!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:y&&y.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=/\.[^.\/]+$/,b=/\/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(b.test(e)){var r=e.replace(b,"");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 y=e._hmr&&new e._hmr(function(e,t){return c(a(u(e),t))},l,t,r);l._cache=r,l.hmr=y&&y.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,n,o){return(e=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}}()?Reflect.construct:function(e,t,n){var o=[null];o.push.apply(o,t);var i=new(Function.bind.apply(e,o));return n&&r(i,n.prototype),i}).apply(null,arguments)}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function n(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||i(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,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=i(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 a,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,a=e},f:function(){try{u||null==r.return||r.return()}finally{if(f)throw a}}}}function i(e,t){if(e){if("string"==typeof e)return a(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)?a(e,t):void 0}}function a(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 u(e){return(u="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})(e)}function f(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 c(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 l=Symbol("ref"),s=Symbol("original"),b=Symbol("deck"),y=Symbol("binding"),p=Symbol("subBinding"),v=Symbol("bindingAll"),d=Symbol("isBindable"),m=Symbol("wrapping"),h=Symbol("Names"),_=Symbol("executing"),g=Symbol("stack"),w=(Symbol("object"),Symbol("wrapped")),O=Symbol("unwrapped"),j=Symbol("getProto"),P=Symbol("onGet"),S=Symbol("onAllGet"),k=Symbol("bindChain"),A=Symbol("Descriptors"),x=Symbol("NoGetters"),M=Object.getPrototypeOf(Int8Array),E=Set.prototype[Symbol.iterator],C=Map.prototype[Symbol.iterator],B=globalThis,T=[B.Node,B.File,B.Map,B.Set,B.WeakMap,B.WeakSet,B.ArrayBuffer,B.ResizeObserver,B.MutationObserver,B.PerformanceObserver,B.IntersectionObserver].filter(function(e){return"function"==typeof e}),I=function(){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t)}var r,i;return r=t,i=[{key:"isBindable",value:function(e){return!(!e||!e[d])&&e[d]===t}},{key:"onDeck",value:function(e,t){return e[b][t]||!1}},{key:"ref",value:function(e){return e[l]||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 M||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 f=i[a];if("___"!==f.substring(0,3)){var c=r.get(e[f]);if(c)n[f]=c;else if(e[f]!==e){if(e[f]&&"object"===u(e[f])){var l=e[f];t.isBindable(e[f])&&(l=e[f][s]),n[f]=this.shuck(l,r)}else n[f]=e[f];r.set(e[f],n[f])}else r.set(e[f],n),n[f]=n}}return t.isBindable(e)&&(delete n.bindTo,delete n.isBound),n}},{key:"make",value:function(r){var i=this;if(!r||!["function","object"].includes(u(r)))return r;if(T.filter(function(e){return r instanceof e}).length||Object.isSealed(r)||!Object.isExtensible(r))return r;if(r[l])return r[l];if(r[y])return r;Object.defineProperty(r,l,{configurable:!0,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(r,s,{configurable:!1,enumerable:!1,writable:!1,value:r}),Object.defineProperty(r,b,{configurable:!1,enumerable:!1,writable:!1,value:{}}),Object.defineProperty(r,y,{configurable:!1,enumerable:!1,writable:!1,value:{}}),Object.defineProperty(r,p,{configurable:!1,enumerable:!1,writable:!1,value:new Map}),Object.defineProperty(r,v,{configurable:!1,enumerable:!1,writable:!1,value:[]}),Object.defineProperty(r,d,{configurable:!1,enumerable:!1,writable:!1,value:t}),Object.defineProperty(r,_,{enumerable:!1,writable:!0}),Object.defineProperty(r,m,{enumerable:!1,writable:!0}),Object.defineProperty(r,g,{configurable:!1,enumerable:!1,writable:!1,value:[]}),Object.defineProperty(r,"___before___",{configurable:!1,enumerable:!1,writable:!1,value:[]}),Object.defineProperty(r,"___after___",{configurable:!1,enumerable:!1,writable:!1,value:[]}),Object.defineProperty(r,w,{configurable:!1,enumerable:!1,writable:!1,value:new Map}),Object.defineProperty(r,O,{configurable:!1,enumerable:!1,writable:!1,value:{}}),Object.defineProperty(r,A,{configurable:!1,enumerable:!1,writable:!1,value:new Map}),Object.defineProperty(r,"bindTo",{configurable:!1,enumerable:!1,writable:!1,value:function e(n){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},f=!1;if(Array.isArray(n)){var c=n.forEach(function(t){return e(t,o,a)});return function(){return c.forEach(function(e){return e()})}}if(n instanceof Function&&(a=o||{},o=n,f=!0),a.delay>=0&&(o=i.wrapDelayCallback(o,a.delay)),a.throttle>=0&&(o=i.wrapThrottleCallback(o,a.throttle)),a.wait>=0&&(o=i.wrapWaitCallback(o,a.wait)),a.frame&&(o=i.wrapFrameCallback(o,a.frame)),a.idle&&(o=i.wrapIdleCallback(o)),f){var l=r[v].length;if(r[v].push(o),!("now"in a)||a.now)for(var s in r)o(r[s],s,r,!1);return function(){delete r[v][l]}}if(r[y][n]||(r[y][n]=new Set),a.children){var b=o;o=function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];var i=n[0],f=r[p].get(b);if(f&&(r[p].delete(b),f()),"object"===u(i)){var c=t.make(i);t.isBindable(c)&&r[p].set(b,c.bindTo(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return b.apply(void 0,n.concat(t))},Object.assign({},a,{children:!1}))),b.apply(void 0,n)}else b.apply(void 0,n)}}r[y][n].add(o),"now"in a&&!a.now||o(r[n],n,r,!1);var d=function(){var e=r[p].get(o);e&&(r[p].delete(o),e()),r[y][n]&&r[y][n].has(o)&&r[y][n].delete(o)};return a.removeWith&&a.removeWith instanceof View&&a.removeWith.onRemove(function(){return d}),d}}),Object.defineProperty(r,k,{configurable:!1,enumerable:!1,writable:!1,value:function(e,t){var n=e.split("."),o=n.shift(),a=n.slice(0),u=[];return u.push(r.bindTo(o,function(e,r,n,o){var f=a.join(".");0!==a.length?(void 0===e&&(e=n[r]=i.makeBindable({})),u=u.concat(e[k](f,t))):t(e,r,n,o)})),function(){return u.forEach(function(e){return e()})}}}),Object.defineProperty(r,"___before",{configurable:!1,enumerable:!1,writable:!1,value:function(e){var t=r.___before___.length;r.___before___.push(e);var n=!1;return function(){n||(n=!0,delete r.___before___[t])}}}),Object.defineProperty(r,"___after",{configurable:!1,enumerable:!1,writable:!1,value:function(e){var t=r.___after___.length;r.___after___.push(e);var n=!1;return function(){n||(n=!0,delete r.___after___[t])}}}),Object.defineProperty(r,"isBound",{configurable:!1,enumerable:!1,writable:!1,value:function(){for(var e in r[v])if(r[v][e])return!0;for(var t in r[y])for(var n in r[y][t])if(r[y][t][n])return!0;return!1}});var a=function(e){r[e]&&r[e]instanceof Object&&!r[e]instanceof Promise&&(T.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 f in r)a(f);var c=r[A],B=r[w],I=r[g],R={get:function(n,i){if(B.has(i))return B.get(i);if(i===l||i===s||"apply"===i||"isBound"===i||"bindTo"===i||"__proto__"===i||"constructor"===i)return r[i];var a;if(c.has(i)?a=c.get(i):(a=Object.getOwnPropertyDescriptor(r,i),c.set(i,a)),a&&!a.configurable&&!a.writable)return r[i];if(S in r)return r[S](i);if(P in r&&!(i in r))return r[P](i);if(a&&!a.configurable&&!a.writable)return B.set(i,r[i]),r[i];if("function"==typeof r[i]){if(h in r[i])return r[i];Object.defineProperty(r[O],i,{configurable:!1,enumerable:!1,writable:!1,value:r[i]});var u=Object.getPrototypeOf(r)[i]===r[i],f="function"==typeof Promise&&r instanceof Promise||"function"==typeof Map&&r instanceof Map||"function"==typeof Set&&r instanceof Set||"function"==typeof C&&r.prototype===C||"function"==typeof E&&r.prototype===E||"function"==typeof E&&r.prototype===E||"function"==typeof WeakMap&&r instanceof WeakMap||"function"==typeof WeakSet&&r instanceof WeakSet||"function"==typeof Date&&r instanceof Date||"function"==typeof M&&r instanceof M||"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"===i?r:r[l],b=function(){r[_]=i,I.unshift(i);for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];var c,l,s=o(r.___before___);try{for(s.s();!(c=s.n()).done;){(0,c.value)(r,i,I,r,n)}}catch(e){s.e(e)}finally{s.f()}if(new.target)l=e(r[O][i],n);else{var b=r[O][i];l=u?b.apply(f||r,n):b.apply(void 0,n)}var y,p=o(r.___after___);try{for(p.s();!(y=p.n()).done;){(0,y.value)(r,i,I,r,n)}}catch(e){p.e(e)}finally{p.f()}return r[_]=null,I.shift(),l};(b[h]=b[h]||new WeakMap).set(r,i),b[S]=function(e){var t=b[h].get(r);return r[t][e]};var y=t.make(b);return B.set(i,y),y}return r[i]},set:function(e,n,i){if(n===s)return!0;if(void 0!==r[b][n]&&r[b][n]===i)return!0;if("string"==typeof n&&"___"===n.substring(0,3)&&"___"===n.slice(-3))return!0;if(e[n]===i)return!0;for(var a in i&&i instanceof Object&&(T.filter(function(e){return r instanceof e}).length||!Object.isExtensible(r)||Object.isSealed(r)||(r[x],i=t.makeBindable(i))),r[b][n]=i,r[v])r[v][a]&&r[v][a](i,n,e,!1);var u=!1;if(n in r[y]){var f,c=o(r[y][n]);try{for(c.s();!(f=c.n()).done;)!1===(0,f.value)(i,n,e,!1,e[n])&&(u=!0)}catch(e){c.e(e)}finally{c.f()}}if(delete r[b][n],!u){var l=Object.getOwnPropertyDescriptor(e,n);e instanceof File&&"lastModifiedDate"==n||l&&!l.writable||e[n]!==i||(e[n]=i)}var p=Reflect.set(e,n,i);if(Array.isArray(e)&&r[y].length)for(var d in r[y].length)(0,r[y].length[d])(e.length,"length",e,!1,e.length);return p},construct:function(o,i){var a="constructor";for(var u in o.___before___)o.___before___[u](o,a,r[g],void 0,i);var f=t.make(e(o[s],n(i)));for(var c in o.___after___)o.___after___[c](o,a,r[g],f,i);return f},getPrototypeOf:function(e){return j in r?r[j]:Reflect.getPrototypeOf(e)},deleteProperty:function(e,t){if(!(t in e))return!0;if(c.has(t)){var n=c.get(t);if(n&&!n.configurable)return!1;c.delete(t)}for(var o in r[v])r[v][o](void 0,t,e,!0,e[t]);if(t in r[y])for(var i in r[y][t])r[y][t][i]&&r[y][t][i](void 0,t,e,!0,e[t]);return delete e[t],!0}};return r[x]&&delete R.get,Object.defineProperty(r,l,{configurable:!1,enumerable:!1,writable:!1,value:new Proxy(r,R)}),r[l]}},{key:"clearBindings",value:function(e){var t;(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)})(e[w],e[y],e[v],e.___after___,e.___before___)}},{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)return[this.make(e),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];(window.requestIdleCallback||requestAnimationFrame)(function(){return e.apply(void 0,r)})}}}],null&&f(r.prototype,null),i&&f(r,i),t}();t.Bindable=I,c(I,"waiters",new WeakMap),c(I,"throttles",new WeakMap),Object.defineProperty(I,"OnGet",{configurable:!1,enumerable:!1,writable:!1,value:P}),Object.defineProperty(I,"NoGetters",{configurable:!1,enumerable:!1,writable:!1,value:x}),Object.defineProperty(I,"GetProto",{configurable:!1,enumerable:!1,writable:!1,value:j}),Object.defineProperty(I,"OnAllGet",{configurable:!1,enumerable:!1,writable:!1,value:S})}()}),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})(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){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(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 l(e)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(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)}}var p=Symbol("constructor"),v=(Symbol("mixinList"),function(){function t(){b(this,t)}return function(e,t,r){r&&y(e,r)}(t,0,[{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];return function(r){!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}}),t&&f(e,t)}(u,e);var a=function(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=s(e);if(t){var o=s(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}(u);function u(){var r;b(this,u);for(var f=arguments.length,s=new Array(f),y=0;y<f;y++)s[y]=arguments[y];var p,v=e.constructor?r=a.call.apply(a,[this].concat(s)):void 0,d=i(n);try{for(d.s();!(p=d.n()).done;){var m=p.value;m[t.Constructor]&&m[t.Constructor].apply(l(r)),"object"===o(m)&&t.mixObject(m,l(r))}}catch(e){d.e(e)}finally{d.f()}return c(r,v)}return u}()}},{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 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;t.prototype[o]=e.prototype[o].bind(t.prototype)}}catch(e){n.e(e)}finally{n.f()}var a,u=i(Object.getOwnPropertySymbols(e.prototype));try{for(u.s();!(a=u.n()).done;){var f=a.value;t.prototype[f]=e.prototype[f].bind(t.prototype)}}catch(e){u.e(e)}finally{u.f()}var c,l=i(Object.getOwnPropertyNames(e));try{var s=function(){var r=c.value;if("function"!=typeof e[r])return"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(l.s();!(c=l.n()).done;)s()}catch(e){l.e(e)}finally{l.f()}var b,y=i(Object.getOwnPropertySymbols(e));try{var p=function(){var r=b.value;if("function"!=typeof e[r])return"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(y.s();!(b=y.n()).done;)p()}catch(e){y.e(e)}finally{y.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=/^(before|after)__(.+)/,c=i(Object.getOwnPropertyNames(e));try{var l=function(){var o=t.value,i=o.match(f);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(c.s();!(t=c.n()).done;)l()}catch(e){c.e(e)}finally{c.f()}var s,b=i(u);try{var y=function(){var t=s.value,r=t.match(f);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(b.s();!(s=b.n()).done;)y()}catch(e){b.e(e)}finally{b.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=v,v.Constructor=p}()}),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-d"}}),require.register("___globals___",function(e,t,r){})}(),require("___globals___");
!function(){"use strict";var e="undefined"==typeof global?self:global;if("function"!=typeof e.require){var t={},n={},r={},o={}.hasOwnProperty,c=/^\.\.?(\/|$)/,a=function(e,t){for(var n,r=[],o=(c.test(t)?e+"/"+t:t).split("/"),a=0,s=o.length;a<s;a++)".."===(n=o[a])?r.pop():"."!==n&&""!==n&&r.push(n);return r.join("/")},s=function(e){return e.split("/").slice(0,-1).join("/")},i=function(t,r){var o,c={id:t,exports:{},hot:v&&v.createHot(t)};return n[t]=c,r(c.exports,(o=t,function(t){var n=a(s(o),t);return e.require(n,o)}),c),c.exports},u=function(e){var t=r[e];return t&&e!==t?u(t):e},l=function(e,r){null==r&&(r="/");var c=u(e);if(o.call(n,c))return n[c].exports;if(o.call(t,c))return i(c,t[c]);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,c){if(e&&"object"==typeof e)for(var a in e)o.call(e,a)&&l.register(a,e[a]);else t[e]=c,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(s(e),t))},l,t,n);l._cache=n,l.hmr=v&&v.wrap,l.brunch=!0,e.require=l}}(),"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})(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.Matrix=void 0;var o=t("curvature/base/Mixin"),c=t("curvature/mixin/EventTargetMixin");function a(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 s(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){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(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 l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=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}}),t&&i(e,t)}(o,e);var t,n,r=function(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=l(e);if(t){var o=l(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}(o);function o(e){var t;return function(e,t){if(!(e instanceof o))throw new TypeError("Cannot call a class as a function")}(this),(t=r.call(this)).baseUrl=e||"https://matrix.org/_matrix",t.clientUrl="".concat(t.baseUrl,"/client/r0"),t.mediaUrl="".concat(t.baseUrl,"/media/r0"),t.profileCache=new Map,t.mediaCache=new Map,t}return t=o,(n=[{key:"isLoggedIn",get:function(){sessionStorage.getItem("matrix:access-token")&&this.dispatchEvent(new CustomEvent("logged-in"));var e=sessionStorage.getItem("matrix:access-token")||"false";return JSON.parse(e),sessionStorage.getItem("matrix:access-token")}},{key:"initSso",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window,r="login/sso/redirect?redirectUrl="+e,o=window.screenX+window.outerWidth/2+200,c=window.screenY+window.outerHeight/2-300,a="width=".concat(400,",height=").concat(600,",screenX=").concat(o,",screenY=").concat(c),s=(n.open("".concat(this.clientUrl,"/").concat(r),"matrix-login",a),function(e){if(e.origin===location.origin){var n=JSON.parse(e.data);"s.sso.complete"===n.type&&(sessionStorage.setItem("matrix:access-token",JSON.stringify(n.data)),t.dispatchEvent(new CustomEvent("logged-in")))}});n.addEventListener("message",s)}},{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:"getGuestToken",value:function(){var e=sessionStorage.getItem("matrix:access-token")||"false",t=JSON.parse(e);if(t&&t.isGuest)return Promise.resolve(t);var n=fetch("".concat(this.clientUrl,"/register?kind=guest"),{method:"POST",body:"{}"}).then(function(e){return e.json()});return n.then(function(e){e.isGuest=!0,sessionStorage.setItem("matrix:access-token",JSON.stringify(e))}),n}},{key:"getToken",value:function(){var e=sessionStorage.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(sessionStorage.getItem("matrix:access-token")||"false");if(!t)return Promise.reject("No access token found.");var n="".concat(this.clientUrl,"/events?access_token=").concat(t.access_token);fetch(n).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(sessionStorage.getItem("matrix:access-token")||"false");if(!o)return Promise.reject("No access token found.");var c="".concat(this.clientUrl,"/events?room_id=").concat(e,"&access_token=").concat(o.access_token,"&from=").concat(r);return t=t||{cancelled:!1},fetch(c).then(function(e){return e.json()}).then(function(r){return n.streamServerEvents(r,e,t)}),t}}},{key:"getUserProfile",value:function(e){if(this.profileCache.has(e,t))return this.profileCache.get(e,t);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(sessionStorage.getItem("matrix:access-token")||"false");return t?fetch("".concat(this.clientUrl,"/user/").concat(t.user_id,"/account_data/").concat(e,"?access_token=").concat(t.access_token)).then(function(e){return e.json()}):Promise.reject("No access token found.")}},{key:"putUserData",value:function(e,t){var n=JSON.parse(sessionStorage.getItem("matrix:access-token")||"false");if(n){var r="".concat(this.clientUrl,"/user/").concat(n.user_id,"/account_data/").concat(e,"?access_token=").concat(n.access_token);return fetch(r,{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=function(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){var r,o,c=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(c.push(r.value),!t||c.length!==t);a=!0);}catch(e){s=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(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)?a(e,t):void 0}}(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.")}()}(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=sessionStorage.getItem("matrix:access-token")||"false",r=JSON.parse(n);if(r){var o="".concat(this.mediaUrl,"/upload?access_token=").concat(r.access_token),c=new Headers({"Content-Type":e.type});return fetch(o,{method:"POST",headers:c,body:e}).then(function(e){return e.json()})}}},{key:"putEvent",value:function(e,t,n){var r=sessionStorage.getItem("matrix:access-token")||"false",o=JSON.parse(r);if(o){var c="".concat(this.clientUrl,"/rooms/").concat(e,"/send/").concat(t,"/").concat(Math.random().toString(36),"?access_token=").concat(o.access_token),a={method:"PUT",headers:new Headers({"Content-Type":"application/json"}),body:JSON.stringify(n)};return fetch(c,a).then(function(e){return e.json()})}}},{key:"getEvent",value:function(e,t){var n=sessionStorage.getItem("matrix:access-token")||"false",r=JSON.parse(n);if(r){var o="".concat(this.clientUrl,"/rooms/").concat(e,"/event/").concat(t,"?access_token=").concat(r.access_token),c=new Headers({"Content-Type":"application/json"});return fetch(o,{method:"GET",headers:c}).then(function(e){return e.json()})}}},{key:"sync",value:function(){var e=sessionStorage.getItem("matrix:access-token")||"false",t=JSON.parse(e);if(!t)return Promise.resolve();var n="".concat(this.clientUrl,"/sync?full_state=true&access_token=").concat(t.access_token);return fetch(n).then(function(e){return e.json()})}},{key:"getRoomState",value:function(e){var t=sessionStorage.getItem("matrix:access-token")||"false",n=JSON.parse(t);if(!n)return Promise.resolve();var r="".concat(this.clientUrl,"/rooms/").concat(e,"/state?access_token=").concat(n.access_token);return fetch(r).then(function(e){return e.json()})}},{key:"syncRoom",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=JSON.parse(sessionStorage.getItem("matrix:access-token")||"false");if(!n)return Promise.reject("No access token found.");var r="".concat(this.clientUrl,"/rooms/").concat(e,"/messages?dir=b&room_id=").concat(e,"&access_token=").concat(n.access_token,"&from=").concat(t);return fetch(r).then(function(e){return e.json()})}},{key:"syncRoomHistory",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.syncRoom(e,t).then(function(t){return t.chunk&&r&&t.chunk.forEach(r),t.chunk.length&&n.syncRoomHistory(e,t.end,r)})}},{key:"streamServerEvents",value:function(e,t,n){var r=this;n&&n.cancelled||(t?this.listenForRoomEvents(t,n,e.end):this.listenForServerEvents(),e.chunk&&e.chunk.forEach(function(e){var t=new MatrixEvent;e.event_id||(e.event_id="local:"+(1/Math.random()).toString(36)),t.consume(e),r.dispatchEvent(new CustomEvent("matrix-event",{detail:t})),r.dispatchEvent(new CustomEvent(t.type,{detail:t}))}))}},{key:"getCurrentUserId",value:function(){var e=sessionStorage.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}),c=JSON.parse(sessionStorage.getItem("matrix:access-token")||"false");if(!c)return Promise.resolve();var a="".concat(this.clientUrl,"/createRoom?access_token=").concat(c.access_token);return fetch(a,{body:o,method:"POST"}).then(function(e){return e.json()})}},{key:"joinRoom",value:function(e){var t=JSON.parse(sessionStorage.getItem("matrix:access-token")||"false");if(!t)return Promise.reject("No access token found.");fetch("".concat(this.clientUrl,"/rooms/").concat(e,"/join?access_token=").concat(t.access_token),{method:"POST"}).then(function(e){return e.json()})}},{key:"leaveRoom",value:function(e){var t=JSON.parse(sessionStorage.getItem("matrix:access-token")||"false");if(!t)return Promise.reject("No access token found.");fetch("".concat(this.clientUrl,"/rooms/").concat(e,"/leave?access_token=").concat(t.access_token),{method:"POST"}).then(function(e){return e.json()})}},{key:"whoAmI",value:function(){var e=JSON.parse(sessionStorage.getItem("matrix:access-token")||"false");return e?fetch("".concat(this.clientUrl,"/account/whoami?access_token=").concat(e.access_token)).then(function(e){return e.json()}):Promise.reject("No access token found.")}}])&&s(t.prototype,n),o}(o.Mixin.with(c.EventTargetMixin));e.Matrix=f}),require.register("___globals___",function(e,t,n){}),require("___globals___");
!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:y&&y.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=/\.[^.\/]+$/,b=/\/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(b.test(e)){var r=e.replace(b,"");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 y=e._hmr&&new e._hmr(function(e,t){return c(a(u(e),t))},l,t,r);l._cache=r,l.hmr=y&&y.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,n,o){return(e=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}}()?Reflect.construct:function(e,t,n){var o=[null];o.push.apply(o,t);var i=new(Function.bind.apply(e,o));return n&&r(i,n.prototype),i}).apply(null,arguments)}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function n(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||i(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,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=i(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 a,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,a=e},f:function(){try{u||null==r.return||r.return()}finally{if(f)throw a}}}}function i(e,t){if(e){if("string"==typeof e)return a(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)?a(e,t):void 0}}function a(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 u(e){return(u="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})(e)}function f(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 c(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 l=Symbol("ref"),s=Symbol("original"),b=Symbol("deck"),y=Symbol("binding"),p=Symbol("subBinding"),v=Symbol("bindingAll"),d=Symbol("isBindable"),m=Symbol("wrapping"),h=Symbol("Names"),_=Symbol("executing"),g=Symbol("stack"),w=(Symbol("object"),Symbol("wrapped")),O=Symbol("unwrapped"),j=Symbol("getProto"),P=Symbol("onGet"),S=Symbol("onAllGet"),k=Symbol("bindChain"),A=Symbol("Descriptors"),x=Symbol("NoGetters"),M=Object.getPrototypeOf(Int8Array),E=Set.prototype[Symbol.iterator],C=Map.prototype[Symbol.iterator],B=globalThis,T=[B.Node,B.File,B.Map,B.Set,B.WeakMap,B.WeakSet,B.ArrayBuffer,B.ResizeObserver,B.MutationObserver,B.PerformanceObserver,B.IntersectionObserver].filter(function(e){return"function"==typeof e}),I=function(){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t)}var r,i;return r=t,i=[{key:"isBindable",value:function(e){return!(!e||!e[d])&&e[d]===t}},{key:"onDeck",value:function(e,t){return e[b][t]||!1}},{key:"ref",value:function(e){return e[l]||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 M||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 f=i[a];if("___"!==f.substring(0,3)){var c=r.get(e[f]);if(c)n[f]=c;else if(e[f]!==e){if(e[f]&&"object"===u(e[f])){var l=e[f];t.isBindable(e[f])&&(l=e[f][s]),n[f]=this.shuck(l,r)}else n[f]=e[f];r.set(e[f],n[f])}else r.set(e[f],n),n[f]=n}}return t.isBindable(e)&&(delete n.bindTo,delete n.isBound),n}},{key:"make",value:function(r){var i=this;if(!r||!["function","object"].includes(u(r)))return r;if(T.filter(function(e){return r instanceof e}).length||Object.isSealed(r)||!Object.isExtensible(r))return r;if(r[l])return r[l];if(r[y])return r;Object.defineProperty(r,l,{configurable:!0,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(r,s,{configurable:!1,enumerable:!1,writable:!1,value:r}),Object.defineProperty(r,b,{configurable:!1,enumerable:!1,writable:!1,value:{}}),Object.defineProperty(r,y,{configurable:!1,enumerable:!1,writable:!1,value:{}}),Object.defineProperty(r,p,{configurable:!1,enumerable:!1,writable:!1,value:new Map}),Object.defineProperty(r,v,{configurable:!1,enumerable:!1,writable:!1,value:[]}),Object.defineProperty(r,d,{configurable:!1,enumerable:!1,writable:!1,value:t}),Object.defineProperty(r,_,{enumerable:!1,writable:!0}),Object.defineProperty(r,m,{enumerable:!1,writable:!0}),Object.defineProperty(r,g,{configurable:!1,enumerable:!1,writable:!1,value:[]}),Object.defineProperty(r,"___before___",{configurable:!1,enumerable:!1,writable:!1,value:[]}),Object.defineProperty(r,"___after___",{configurable:!1,enumerable:!1,writable:!1,value:[]}),Object.defineProperty(r,w,{configurable:!1,enumerable:!1,writable:!1,value:new Map}),Object.defineProperty(r,O,{configurable:!1,enumerable:!1,writable:!1,value:{}}),Object.defineProperty(r,A,{configurable:!1,enumerable:!1,writable:!1,value:new Map}),Object.defineProperty(r,"bindTo",{configurable:!1,enumerable:!1,writable:!1,value:function e(n){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},f=!1;if(Array.isArray(n)){var c=n.forEach(function(t){return e(t,o,a)});return function(){return c.forEach(function(e){return e()})}}if(n instanceof Function&&(a=o||{},o=n,f=!0),a.delay>=0&&(o=i.wrapDelayCallback(o,a.delay)),a.throttle>=0&&(o=i.wrapThrottleCallback(o,a.throttle)),a.wait>=0&&(o=i.wrapWaitCallback(o,a.wait)),a.frame&&(o=i.wrapFrameCallback(o,a.frame)),a.idle&&(o=i.wrapIdleCallback(o)),f){var l=r[v].length;if(r[v].push(o),!("now"in a)||a.now)for(var s in r)o(r[s],s,r,!1);return function(){delete r[v][l]}}if(r[y][n]||(r[y][n]=new Set),a.children){var b=o;o=function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];var i=n[0],f=r[p].get(b);if(f&&(r[p].delete(b),f()),"object"===u(i)){var c=t.make(i);t.isBindable(c)&&r[p].set(b,c.bindTo(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return b.apply(void 0,n.concat(t))},Object.assign({},a,{children:!1}))),b.apply(void 0,n)}else b.apply(void 0,n)}}r[y][n].add(o),"now"in a&&!a.now||o(r[n],n,r,!1);var d=function(){var e=r[p].get(o);e&&(r[p].delete(o),e()),r[y][n]&&r[y][n].has(o)&&r[y][n].delete(o)};return a.removeWith&&a.removeWith instanceof View&&a.removeWith.onRemove(function(){return d}),d}}),Object.defineProperty(r,k,{configurable:!1,enumerable:!1,writable:!1,value:function(e,t){var n=e.split("."),o=n.shift(),a=n.slice(0),u=[];return u.push(r.bindTo(o,function(e,r,n,o){var f=a.join(".");0!==a.length?(void 0===e&&(e=n[r]=i.makeBindable({})),u=u.concat(e[k](f,t))):t(e,r,n,o)})),function(){return u.forEach(function(e){return e()})}}}),Object.defineProperty(r,"___before",{configurable:!1,enumerable:!1,writable:!1,value:function(e){var t=r.___before___.length;r.___before___.push(e);var n=!1;return function(){n||(n=!0,delete r.___before___[t])}}}),Object.defineProperty(r,"___after",{configurable:!1,enumerable:!1,writable:!1,value:function(e){var t=r.___after___.length;r.___after___.push(e);var n=!1;return function(){n||(n=!0,delete r.___after___[t])}}}),Object.defineProperty(r,"isBound",{configurable:!1,enumerable:!1,writable:!1,value:function(){for(var e in r[v])if(r[v][e])return!0;for(var t in r[y])for(var n in r[y][t])if(r[y][t][n])return!0;return!1}});var a=function(e){r[e]&&r[e]instanceof Object&&!r[e]instanceof Promise&&(T.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 f in r)a(f);var c=r[A],B=r[w],I=r[g],R={get:function(n,i){if(B.has(i))return B.get(i);if(i===l||i===s||"apply"===i||"isBound"===i||"bindTo"===i||"__proto__"===i||"constructor"===i)return r[i];var a;if(c.has(i)?a=c.get(i):(a=Object.getOwnPropertyDescriptor(r,i),c.set(i,a)),a&&!a.configurable&&!a.writable)return r[i];if(S in r)return r[S](i);if(P in r&&!(i in r))return r[P](i);if(a&&!a.configurable&&!a.writable)return B.set(i,r[i]),r[i];if("function"==typeof r[i]){if(h in r[i])return r[i];Object.defineProperty(r[O],i,{configurable:!1,enumerable:!1,writable:!1,value:r[i]});var u=Object.getPrototypeOf(r)[i]===r[i],f="function"==typeof Promise&&r instanceof Promise||"function"==typeof Map&&r instanceof Map||"function"==typeof Set&&r instanceof Set||"function"==typeof C&&r.prototype===C||"function"==typeof E&&r.prototype===E||"function"==typeof E&&r.prototype===E||"function"==typeof WeakMap&&r instanceof WeakMap||"function"==typeof WeakSet&&r instanceof WeakSet||"function"==typeof Date&&r instanceof Date||"function"==typeof M&&r instanceof M||"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"===i?r:r[l],b=function(){r[_]=i,I.unshift(i);for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];var c,l,s=o(r.___before___);try{for(s.s();!(c=s.n()).done;){(0,c.value)(r,i,I,r,n)}}catch(e){s.e(e)}finally{s.f()}if(new.target)l=e(r[O][i],n);else{var b=r[O][i];l=u?b.apply(f||r,n):b.apply(void 0,n)}var y,p=o(r.___after___);try{for(p.s();!(y=p.n()).done;){(0,y.value)(r,i,I,r,n)}}catch(e){p.e(e)}finally{p.f()}return r[_]=null,I.shift(),l};(b[h]=b[h]||new WeakMap).set(r,i),b[S]=function(e){var t=b[h].get(r);return r[t][e]};var y=t.make(b);return B.set(i,y),y}return r[i]},set:function(e,n,i){if(n===s)return!0;if(void 0!==r[b][n]&&r[b][n]===i)return!0;if("string"==typeof n&&"___"===n.substring(0,3)&&"___"===n.slice(-3))return!0;if(e[n]===i)return!0;for(var a in i&&i instanceof Object&&(T.filter(function(e){return r instanceof e}).length||!Object.isExtensible(r)||Object.isSealed(r)||(r[x],i=t.makeBindable(i))),r[b][n]=i,r[v])r[v][a]&&r[v][a](i,n,e,!1);var u=!1;if(n in r[y]){var f,c=o(r[y][n]);try{for(c.s();!(f=c.n()).done;)!1===(0,f.value)(i,n,e,!1,e[n])&&(u=!0)}catch(e){c.e(e)}finally{c.f()}}if(delete r[b][n],!u){var l=Object.getOwnPropertyDescriptor(e,n);e instanceof File&&"lastModifiedDate"==n||l&&!l.writable||e[n]!==i||(e[n]=i)}var p=Reflect.set(e,n,i);if(Array.isArray(e)&&r[y].length)for(var d in r[y].length)(0,r[y].length[d])(e.length,"length",e,!1,e.length);return p},construct:function(o,i){var a="constructor";for(var u in o.___before___)o.___before___[u](o,a,r[g],void 0,i);var f=t.make(e(o[s],n(i)));for(var c in o.___after___)o.___after___[c](o,a,r[g],f,i);return f},getPrototypeOf:function(e){return j in r?r[j]:Reflect.getPrototypeOf(e)},deleteProperty:function(e,t){if(!(t in e))return!0;if(c.has(t)){var n=c.get(t);if(n&&!n.configurable)return!1;c.delete(t)}for(var o in r[v])r[v][o](void 0,t,e,!0,e[t]);if(t in r[y])for(var i in r[y][t])r[y][t][i]&&r[y][t][i](void 0,t,e,!0,e[t]);return delete e[t],!0}};return r[x]&&delete R.get,Object.defineProperty(r,l,{configurable:!1,enumerable:!1,writable:!1,value:new Proxy(r,R)}),r[l]}},{key:"clearBindings",value:function(e){var t;(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)})(e[w],e[y],e[v],e.___after___,e.___before___)}},{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)return[this.make(e),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];(window.requestIdleCallback||requestAnimationFrame)(function(){return e.apply(void 0,r)})}}}],null&&f(r.prototype,null),i&&f(r,i),t}();t.Bindable=I,c(I,"waiters",new WeakMap),c(I,"throttles",new WeakMap),Object.defineProperty(I,"OnGet",{configurable:!1,enumerable:!1,writable:!1,value:P}),Object.defineProperty(I,"NoGetters",{configurable:!1,enumerable:!1,writable:!1,value:x}),Object.defineProperty(I,"GetProto",{configurable:!1,enumerable:!1,writable:!1,value:j}),Object.defineProperty(I,"OnAllGet",{configurable:!1,enumerable:!1,writable:!1,value:S})}()}),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})(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){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(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 l(e)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(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)}}var p=Symbol("constructor"),v=(Symbol("mixinList"),function(){function t(){b(this,t)}return function(e,t,r){r&&y(e,r)}(t,0,[{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];return function(r){!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}}),t&&f(e,t)}(u,e);var a=function(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=s(e);if(t){var o=s(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}(u);function u(){var r;b(this,u);for(var f=arguments.length,s=new Array(f),y=0;y<f;y++)s[y]=arguments[y];var p,v=e.constructor?r=a.call.apply(a,[this].concat(s)):void 0,d=i(n);try{for(d.s();!(p=d.n()).done;){var m=p.value;m[t.Constructor]&&m[t.Constructor].apply(l(r)),"object"===o(m)&&t.mixObject(m,l(r))}}catch(e){d.e(e)}finally{d.f()}return c(r,v)}return u}()}},{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 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;t.prototype[o]=e.prototype[o].bind(t.prototype)}}catch(e){n.e(e)}finally{n.f()}var a,u=i(Object.getOwnPropertySymbols(e.prototype));try{for(u.s();!(a=u.n()).done;){var f=a.value;t.prototype[f]=e.prototype[f].bind(t.prototype)}}catch(e){u.e(e)}finally{u.f()}var c,l=i(Object.getOwnPropertyNames(e));try{var s=function(){var r=c.value;if("function"!=typeof e[r])return"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(l.s();!(c=l.n()).done;)s()}catch(e){l.e(e)}finally{l.f()}var b,y=i(Object.getOwnPropertySymbols(e));try{var p=function(){var r=b.value;if("function"!=typeof e[r])return"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(y.s();!(b=y.n()).done;)p()}catch(e){y.e(e)}finally{y.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=/^(before|after)__(.+)/,c=i(Object.getOwnPropertyNames(e));try{var l=function(){var o=t.value,i=o.match(f);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(c.s();!(t=c.n()).done;)l()}catch(e){c.e(e)}finally{c.f()}var s,b=i(u);try{var y=function(){var t=s.value,r=t.match(f);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(b.s();!(s=b.n()).done;)y()}catch(e){b.e(e)}finally{b.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=v,v.Constructor=p}()}),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-d"}}),require.register("___globals___",function(e,t,r){})}(),require("___globals___");

@@ -6,8 +6,4 @@ {

"author": "Sean Morris",
"version": "0.0.0-e",
"version": "0.0.0-f",
"repository": "https://github.com/seanmorris/matrix-api",
"scripts": {
"start": "brunch watch --server",
"build": "brunch build --production"
},
"devDependencies": {

@@ -28,3 +24,3 @@ "@babel/cli": "^7.13.14",

"dependencies": {
"curvature": "^0.0.66-p"
"curvature": "^0.0.66-q"
},

@@ -34,5 +30,4 @@ "files": [

"dist/matrix-api.js",
"dist/matrix-api.min.js",
"dist/matrix-api.standalone.js"
]
}
+518
-33

@@ -1,27 +0,111 @@

# Matrix API
# seanmorris/matrix-api
![avatar](https://avatars3.githubusercontent.com/u/640101?s=80&v=4)
## npm install matrix-api
`v0.0.0 - early αlphα`
Matrix API. 100% frontend.
https://curvature.seanmorr.is/matrix-api
Try it: https://curvature.seanmorr.is/matrix-api
## Issue Tracker
Please report any and all bugs to [the GitHub issue tracker](https://github.com/seanmorris/matrix-api/issues).
## Install:
Only one install method is required. (npm, cdn, or download).
### npm
Install `matrix-api` with the npm package manager.
**This is the recommended install method.**
#### 1) First, Install with NPM:
```bash
$ npm install matrix-api
```
#### 2) Then, `import` or `require` the module in your javascript:
```javascript
import { Matrix } from 'matrix-api/Matrix';
```
or
```javascript
const Matrix = require('matrix-api/Matrix').Matrix;
```
### CDN
If npm isn't an option, `matrix-api` can be included from a CDN.
You can include both the `matrix-api` and its dependency, the `curvature` library with the following script tags:
```html
<script src = "https://unpkg.com/curvature@0.0.66-q/dist/curvature.js"></script>
<script src = "https://unpkg.com/matrix-api@0.0.0-d/dist/matrix-api.js"></script>
<script src = "https://unpkg.com/matrix-api@0.0.0-f/dist/matrix-api.js"></script>
```
You can also include only the parts of `curvature` needed to run `matrix api` with `matrix-api.standalone.js`:
```html
<script src = "https://unpkg.com/matrix-api@0.0.0-d/dist/matrix-api.standalone.js"></script>
<script src = "https://unpkg.com/matrix-api@0.0.0-f/dist/matrix-api.standalone.js"></script>
```
Then `require` the module in your javascript:
```javascript
const Matrix = require('matrix-api/Matrix').Matrix;
```
**curvature is not required if the standalone build is used.**
### Download
If you'd prefer to host the files yourself, `matrix-api` can be included from your own server, or your own CDN.
Both [matrix-api.js](https://unpkg.com/matrix-api/dist/matrix-api.js) and
[matrix-api.standalone.js](https://unpkg.com/matrix-api/dist/matrix-api.standalone.js) can be downloaded from the following page:
https://unpkg.com/browse/matrix-api/dist/
Either one of the files can be served by any static HTTP server and used in the browser.
[Curvature](https://unpkg.com/curvature/dist/curvature.js) is available from:
https://unpkg.com/browse/curvature/dist/
**curvature is not required if the standalone build is used.**
Import the scripts from your own server:
```html
<script src = "https://YOUR-SERVER/js/curvature.js"></script>
<script src = "https://YOUR-SERVER/js/matrix-api.js"></script>
```
or
```html
<script src = "https://YOUR-SERVER/js/matrix-api.standalone.js"></script>
```
Then `require` the module in your javascript:
```javascript
const Matrix = require('matrix-api/Matrix').Matrix;
```
## Usage:
### Step 1:
### Step 1: Set up a Redirect Target
Set up a page that can serve as your redirect target.
This page will post a message back to its opener when the login flow completes, and then it will close.
Set up a page that can serve as your redirect target. When the login flow completes, this is the last page that will load in the popup window.
It will post a message back to its opener when the login flow completes, and then it will close.
```javascript
// Under /accept-sso
// On a page served from /accept-sso

@@ -31,11 +115,16 @@ const baseUrl = 'https://matrix.org/_matrix';

const loginToken = '...'; // Get the loginToken from the query string.
// Get the loginToken from the query string.
const query = new URLSearchParams(location.search);
const token = query.get('loginToken');
matrix.completeSso(loginToken);
// Complete the SSO and close the window.
matrix.completeSso(token);
```
### Step 2:
### Step 2: Open the Login Popup
In your main application, initialize a Matrix object with the same baseUrl. Log in and listen for events:
In your main application, initialize a Matrix object.
You can then start the login flow and listen for events:
```javascript

@@ -52,24 +141,32 @@ // In your main application

// ... and wait or the user to log in:
matrix.addEventListener('logged-in', event => console.log('Logged in!', event));
// ... and wait for the user to log in:
matrix.addEventListener('logged-in', event => {
// Listen for events of only one type:
matrix.addEventListener('m.room.message', event => console.log('Message:', event));
console.log('Logged in!', event);
// Listen for ALL events from the server:
matrix.addEventListener('matrix-event', event => console.log('Event:', event));
// Poll the server for events
matrix.listenForServerEvents();
// Act on events of only one type:
matrix.addEventListener('m.room.message', event => console.log('Message:', event));
// Act on events of another type:
matrix.addEventListener('m.reaction', event => console.log('Reaction:', event));
// Act on ALL events from the server:
matrix.addEventListener('matrix-event', event => console.log('Event:', event));
});
```
### Step 3:
### Step 3: Join a Room
Join a room:
Once you're logged in, you can then join a room. A room is a shared event stream that multiple users can read and contribute to.
You'll receive a promise that will complete when the server responds.
```javascript
// Send a message:
const roomId = 'ROOM_ID_HERE';
// You'll receive a promise that will complete
// when the server responds:
matrix.joinRoom(roomId)

@@ -80,10 +177,12 @@ .then(response => console.log(response))

### Step 4:
### Step 4: Send a Message
Send messages to a room:
Once you've joined one or more rooms, you can send messages to them:
This will also a return promise. It will resolve when the HTTP request completes.
```javascript
// Send a message:
const roomId = 'ROOM_ID_HERE';
const evttype = 'm.room.message';
const roomId = 'ROOM_ID_HERE';
const msgtype = 'm.text';

@@ -93,8 +192,394 @@ const body = 'message body...';

// You'll receive a promise that will complete
// when the server responds:
matrix.putEvent(roomId, 'm.room.message', message)
matrix.putEvent(roomId, evttype, message)
.then(response => console.log(response))
.catch(error => console.error(error));
```
## Methods
### `new Matrix(baseUrl)`
Create a new connection to a Matrix server.
* baseUrl - The endpoint of the Matrix server.
```javascript
const matrix = new Matrix(baseUrl);
```
### matrix.initSso(redirectUri, windowRef = window)
Starts the 'Single Sign On' login flow with the matrix server. The login flow will open in a popup, allow the user to sign in, and finally. redirect to `redirectUri` with the token in the `loginToken` field of the URL's search parameters when complete.
* redirectUri - The redirect target URI
* windowRef - The window reference
```javascript
// Connect to your Matrix endpoint:
const baseUrl = 'https://matrix.org/_matrix';
const matrix = new Matrix(baseUrl);
// Open the login popup, targetting the url from the first step:
const redirectUrl = location.origin + '/accept-sso';
matrix.initSso(redirectUrl);
```
### matrix.completeSso(loginToken)
Meant to be called in the popup, on the last page of the SSO login flow, after the matrix server has redirected the user back to the `redirectUri` passed into `matrix.initSso()`.
Will post a message event back to its own `window.opener`, targetting the current origin, and automatically close the popup.
* loginToken - The loginToken from the URL search params.
```javascript
const baseUrl = 'https://matrix.org/_matrix';
const matrix = new Matrix(baseUrl);
// Get the loginToken from the query string.
const query = new URLSearchParams(location.search);
const token = query.get('loginToken');
// Complete the SSO and close the window.
matrix.completeSso(token);
```
### matrix.getGuestToken() *async*
Get a login token suitable for guest-level access.
Returns a promise.
```javascript
matrix.getGuestToken().then(token => console.log(token));
```
### matrix.getToken() *async*
Get the login token associated with the current user's session.
Returns a promise.
```javascript
matrix.getToken().then(token => console.log(token));
```
### matrix.getUserProfile(userId) *async*
Get the profile for a user, given a userId.
* userId - The matrix-id of the user in question.
Returns a promise.
```javascript
matrix.getUserProfile(userId).then(profile => console.log(profile));
```
### matrix.getUserData(key) *async*
Get a chunk of privately accessible data assciated with the current user.
* key - The key associated with the chunk of data.
Returns a promise.
```javascript
const key = 'foobar';
matrix.getUserData(key).then(data => console.log(data));
```
### matrix.putUserData(key, body) *async*
Store a chunk of privately accessible data assciated with the current user on the server.
* key - The key associated with the chunk of data.
* body - The data to store at the given key.
Returns a promise.
```javascript
const key = 'foobar';
const body = 'Hello, World!'
matrix.putUserData(key, body).then(response => console.log(response));
```
### matrix.getMediaUrl(mxcUrl) *string*
Translate an MXCURL to an HTTP-accessible URL for a given media resource.
* mxcUrl - The MXCURL associated with the given media resource.
Returns a string.
```javascript
const mediaUrl = matrix.getMediaUrl(mxcUrl);
```
### matrix.getMedia(mxcUrl) *async*
Download a given media resource and return an ObjectUrl that can be used in HTML.
* mxcUrl - The MXCURL associated with the given media resource.
Returns a promise.
```javascript
matrix.getMedia(mxcUrl).then(objectUrl => {
const img = document.createElement('img');
img.src = objectUrl;
document.body.appendChild(img);
});
```
### matrix.postMedia(file, name)
Upload a given media resource to the server.
* file - HTML File object, like from a `file input` or a drag-n-drop event.
* name - The name of the file to use in downloads.
https://developer.mozilla.org/en-US/docs/Web/API/File
Returns a promise.
```javascript
matrix.postMedia(mxcUrl).then(response => console.log(response));
```
### matrix.putEvent(roomId, type, body) *async*
Send a message to a room.
* roomId - The id of the room in question.
* type - The event type of the message.
* body - The body of the message.
Returns a promise.
```javascript
matrix.putEvent(roomId, type, body).then(response => console.log(response));
```
### matrix.getEvent(roomId, eventId) *async*
Request message from a channel.
* roomId - The id of the room in question.
* eventId -The id of the event in question.
Returns a promise.
```javascript
matrix.getEvent(roomId, eventId).then(response => console.log(response));
```
### matrix.getRoomState(roomId) *async*
Get the current state configuration of a room.
* roomId - The id of the room in question.
Returns a promise.
```javascript
matrix.getRoomState(roomId).then(response => console.log(response));
```
### matrix.getCurrentUserId() *string|bool*
Get the id of the current user.
Returns a string or boolean `false`.
```javascript
const userId = matrix.getUserId();
```
### matrix.createRoom(name, topic, visibility, initialState = {}) *async*
Create a new room on the server.
* name - The name of the room.
* topic - The topic line of the room.
* visibility - The visibility of the room.
* initialState - The initial state values of the room.
Returns a promise.
```javascript
matrix.createRoom(name,topic,visibility,initialState)
.then(response => console.log(response));
```
### matrix.joinRoom(roomId) *async*
Join a room on the server.
* roomId - The id of the room in question.
Returns a promise.
```javascript
matrix.joinRoom(roomId).then(response => console.log(response));
```
### matrix.leaveRoom(roomId) *async*
Leave a room on the server.
* roomId - The id of the room in question
Returns a promise.
```javascript
matrix.leaveRoom(roomId).then(response => console.log(response));
```
### matrix.whoAmI()
Gets the user id for the current logged in user.
Returns a promise.
```javascript
matrix.whoAmI(roomId).then(response => console.log(response));
```
### matrix.listenForServerEvents()
Poll the server for new events. Does not return a value. Use `addEventListener` to capture events.
```javacript
matrix.listenForServerEvents();
matrix.addEventListener('matrix-event', event => console.log('Event:', event));
```
### matrix.sync()
*To be documented.*
### matrix.syncRoomHistory(room, from, callback = null)
**Internal Method**
Sync the event history of a given room, starting from a given chunk id and moving backward.
* roomId - The id of the room in question
* from - Chunk id to resume the sync from
* callback - Callback to run on each chunk.
### matrix.syncRoom(room_id, from = '')
**Internal Method**
### matrix.streamServerEvents(chunkList, roomId, controller)
**Internal Method**
## Formatting and Sending Messages
### Chats: m.room-message
Normal chat messages must be formatted as such when sending to the server:
```javascript
const roomId = 'ROOM_ID_HERE';
const body = {
msgtype: 'm.text'
, body: 'THIS IS A NORMAL CHAT MESSAGE.'
};
matrix.putEvent(roomId, 'm.room.message', body);
```
### Reactions: m.reaction
Reactions to messages is a little more complicated than sending them:
```javascript
const roomId = 'ROOM_ID_HERE';
const eventId = 'EVENT_ID_HERE';
const body = {
'm.relates_to': {
key: '🍁'
, rel_type: 'm.annotation'
, event_id: eventId
}
};
matrix.putEvent(roomId, 'm.reaction', body);
```
## Under the Hood
### Polling for Server Events
Matrix transmits events over standard HTTP requests. Meaning polling the server does just that, it opens an HTTP GET to the server and waits for an event to come in. When it does, its transmitted and the connection is closed.
The next connection is then immediately opened and the process repeated. If the connection is timed out and no events are received, the cycle is again immediately repeated.
This may look strange in your network inspector, but rest assured, it is expected behavior.
Perhaps Matrix would do well to implement a simple EventSouce endpoint:
https://developer.mozilla.org/en-US/docs/Web/API/EventSource
https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events
### Notes on Syncing
Matrix.org serves 10 events per chunk. For large sync operations, this can take some time. I see no way as of yet to optimize this.
Recommened behavior is to cache the events in an IndexedDB and store a highwater and lowwater mark. Highwater is the latest cached chunk, lowwater is the earliest.
Interupted syncs should resume from the lowwater mark since Matrix provides event records in reverse chronological order, and continue to the room's creation date.
A parallel sync can be started from the present momemnt and move backward, ending at the highwater mark.
Once each sync reaches its mark, the current store should have the 100% of the available event history of the given room.
## Contributing
### Building
You'll need a copy of NodeJS and NPM.
Files in `dist/` are built with [brunch](https://brunch.io/).
### Licensing
Changes must be licensed under the Apache-2.0 or more permissive license to be accepted.
### Philosophy
Do one thing, do it well.
### Common Decency
Tabs, not spaces.
## License
seanmorris/matrix-api
Copyright 2021 Sean Morris
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.