forked from zakaton/croquet-authentication
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcroquet.js
104 lines (103 loc) · 185 KB
/
croquet.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"rbta":[function(require,module,exports) {
!function(t,o){"object"==typeof module&&module.exports?module.exports=o():t.Toastify=o()}(this,function(t){var o=function(t){return new o.lib.init(t)};function i(t,o){return!(!t||"string"!=typeof o)&&!!(t.className&&t.className.trim().split(/\s+/gi).indexOf(o)>-1)}return o.lib=o.prototype={toastify:"1.6.1",constructor:o,init:function(t){return t||(t={}),this.options={},this.toastElement=null,this.options.text=t.text||"Hi there!",this.options.duration=t.duration||3e3,this.options.selector=t.selector,this.options.callback=t.callback||function(){},this.options.destination=t.destination,this.options.newWindow=t.newWindow||!1,this.options.close=t.close||!1,this.options.gravity="bottom"==t.gravity?"toastify-bottom":"toastify-top",this.options.positionLeft=t.positionLeft||!1,this.options.position=t.position||"",this.options.backgroundColor=t.backgroundColor,this.options.avatar=t.avatar||"",this.options.className=t.className||"",this.options.stopOnFocus=void 0===t.stopOnFocus||t.stopOnFocus,this},buildToast:function(){if(!this.options)throw"Toastify is not initialized";var t=document.createElement("div");if(t.className="toastify on "+this.options.className,this.options.position?t.className+=" toastify-"+this.options.position:!0===this.options.positionLeft?(t.className+=" toastify-left",console.warn("Property `positionLeft` will be depreciated in further versions. Please use `position` instead.")):t.className+=" toastify-right",t.className+=" "+this.options.gravity,this.options.backgroundColor&&(t.style.background=this.options.backgroundColor),t.innerHTML=this.options.text,""!==this.options.avatar){var o=document.createElement("img");o.src=this.options.avatar,o.className="toastify-avatar","left"==this.options.position||!0===this.options.positionLeft?t.appendChild(o):t.insertAdjacentElement("beforeend",o)}if(!0===this.options.close){var i=document.createElement("span");if(i.innerHTML="✖",i.className="toast-close",i.addEventListener("click",function(t){t.stopPropagation(),this.removeElement(t.target.parentElement),window.clearTimeout(t.target.parentElement.timeOutValue)}.bind(this)),this.options.stopOnFocus&&this.options.duration>0){const o=this;t.addEventListener("mouseover",function(o){window.clearTimeout(t.timeOutValue)}),t.addEventListener("mouseleave",function(){t.timeOutValue=window.setTimeout(function(){o.removeElement(t)},o.options.duration)})}var e=window.innerWidth>0?window.innerWidth:screen.width;("left"==this.options.position||!0===this.options.positionLeft)&&e>360?t.insertAdjacentElement("afterbegin",i):t.appendChild(i)}return void 0!==this.options.destination&&t.addEventListener("click",function(t){t.stopPropagation(),!0===this.options.newWindow?window.open(this.options.destination,"_blank"):window.location=this.options.destination}.bind(this)),t},showToast:function(){var t;if(this.toastElement=this.buildToast(),!(t=void 0===this.options.selector?document.body:document.getElementById(this.options.selector)))throw"Root element is not defined";return t.insertBefore(this.toastElement,t.firstChild),o.reposition(),this.options.duration>0&&(this.toastElement.timeOutValue=window.setTimeout(function(){this.removeElement(this.toastElement)}.bind(this),this.options.duration)),this},hideToast:function(){this.toastElement.timeOutValue&&clearTimeout(this.toastElement.timeOutValue),this.removeElement(this.toastElement)},removeElement:function(t){t.className=t.className.replace(" on",""),window.setTimeout(function(){t.parentNode.removeChild(t),this.options.callback.call(t),o.reposition()}.bind(this),400)}},o.reposition=function(){for(var t,o={top:15,bottom:15},e={top:15,bottom:15},s={top:15,bottom:15},n=document.getElementsByClassName("toastify"),a=0;a<n.length;a++){t=!0===i(n[a],"toastify-top")?"toastify-top":"toastify-bottom";var r=n[a].offsetHeight;t=t.substr(9,t.length-1);(window.innerWidth>0?window.innerWidth:screen.width)<=360?(n[a].style[t]=s[t]+"px",s[t]+=r+15):!0===i(n[a],"toastify-left")?(n[a].style[t]=o[t]+"px",o[t]+=r+15):(n[a].style[t]=e[t]+"px",e[t]+=r+15)}return this},o.lib.init.prototype=o.lib,o});
},{}],"niZ7":[function(require,module,exports) {
var define;
var t;!function(t,n,e){function s(t){var n,e=this,s=(n=4022871197,function(t){t=t.toString();for(var e=0;e<t.length;e++){var s=.02519603282416938*(n+=t.charCodeAt(e));s-=n=s>>>0,n=(s*=n)>>>0,n+=4294967296*(s-=n)}return 2.3283064365386963e-10*(n>>>0)});e.next=function(){var t=2091639*e.s0+2.3283064365386963e-10*e.c;return e.s0=e.s1,e.s1=e.s2,e.s2=t-(e.c=0|t)},e.c=1,e.s0=s(" "),e.s1=s(" "),e.s2=s(" "),e.s0-=s(t),e.s0<0&&(e.s0+=1),e.s1-=s(t),e.s1<0&&(e.s1+=1),e.s2-=s(t),e.s2<0&&(e.s2+=1),s=null}function r(t,n){return n.c=t.c,n.s0=t.s0,n.s1=t.s1,n.s2=t.s2,n}function o(t,n){var e=new s(t),o=n&&n.state,u=e.next;return u.int32=function(){return 4294967296*e.next()|0},u.double=function(){return u()+1.1102230246251565e-16*(2097152*u()|0)},u.quick=u,o&&("object"==typeof o&&r(o,e),u.state=function(){return r(e,{})}),u}n&&n.exports?n.exports=o:e&&e.amd?e(function(){return o}):this.alea=o}(0,"object"==typeof module&&module,"function"==typeof t&&t);
},{}],"wr2V":[function(require,module,exports) {
var define;
var t;!function(t,n,e){function r(t){var n=this,e="";n.x=0,n.y=0,n.z=0,n.w=0,n.next=function(){var t=n.x^n.x<<11;return n.x=n.y,n.y=n.z,n.z=n.w,n.w^=n.w>>>19^t^t>>>8},t===(0|t)?n.x=t:e+=t;for(var r=0;r<e.length+64;r++)n.x^=0|e.charCodeAt(r),n.next()}function o(t,n){return n.x=t.x,n.y=t.y,n.z=t.z,n.w=t.w,n}function u(t,n){var e=new r(t),u=n&&n.state,x=function(){return(e.next()>>>0)/4294967296};return x.double=function(){do{var t=((e.next()>>>11)+(e.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},x.int32=e.next,x.quick=x,u&&("object"==typeof u&&o(u,e),x.state=function(){return o(e,{})}),x}n&&n.exports?n.exports=u:e&&e.amd?e(function(){return u}):this.xor128=u}(0,"object"==typeof module&&module,"function"==typeof t&&t);
},{}],"2Wi2":[function(require,module,exports) {
var define;
var t;!function(t,n,e){function o(t){var n=this,e="";n.next=function(){var t=n.x^n.x>>>2;return n.x=n.y,n.y=n.z,n.z=n.w,n.w=n.v,(n.d=n.d+362437|0)+(n.v=n.v^n.v<<4^t^t<<1)|0},n.x=0,n.y=0,n.z=0,n.w=0,n.v=0,t===(0|t)?n.x=t:e+=t;for(var o=0;o<e.length+64;o++)n.x^=0|e.charCodeAt(o),o==e.length&&(n.d=n.x<<10^n.x>>>4),n.next()}function r(t,n){return n.x=t.x,n.y=t.y,n.z=t.z,n.w=t.w,n.v=t.v,n.d=t.d,n}function u(t,n){var e=new o(t),u=n&&n.state,x=function(){return(e.next()>>>0)/4294967296};return x.double=function(){do{var t=((e.next()>>>11)+(e.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},x.int32=e.next,x.quick=x,u&&("object"==typeof u&&r(u,e),x.state=function(){return r(e,{})}),x}n&&n.exports?n.exports=u:e&&e.amd?e(function(){return u}):this.xorwow=u}(0,"object"==typeof module&&module,"function"==typeof t&&t);
},{}],"yIMU":[function(require,module,exports) {
var define;
var n;!function(n,t,e){function r(n){var t=this;t.next=function(){var n,e,r=t.x,o=t.i;return n=r[o],e=(n^=n>>>7)^n<<24,e^=(n=r[o+1&7])^n>>>10,e^=(n=r[o+3&7])^n>>>3,e^=(n=r[o+4&7])^n<<7,n=r[o+7&7],e^=(n^=n<<13)^n<<9,r[o]=e,t.i=o+1&7,e},function(n,t){var e,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,e=0;e<t.length;++e)r[7&e]=r[7&e]<<15^t.charCodeAt(e)+r[e+1&7]<<13;for(;r.length<8;)r.push(0);for(e=0;e<8&&0===r[e];++e);for(8==e?r[7]=-1:r[e],n.x=r,n.i=0,e=256;e>0;--e)n.next()}(t,n)}function o(n,t){return t.x=n.x.slice(),t.i=n.i,t}function i(n,t){null==n&&(n=+new Date);var e=new r(n),i=t&&t.state,u=function(){return(e.next()>>>0)/4294967296};return u.double=function(){do{var n=((e.next()>>>11)+(e.next()>>>0)/4294967296)/(1<<21)}while(0===n);return n},u.int32=e.next,u.quick=u,i&&(i.x&&o(i,e),u.state=function(){return o(e,{})}),u}t&&t.exports?t.exports=i:e&&e.amd?e(function(){return i}):this.xorshift7=i}(0,"object"==typeof module&&module,"function"==typeof n&&n);
},{}],"jcz7":[function(require,module,exports) {
var define;
var n;!function(n,t,e){function r(n){var t=this;t.next=function(){var n,e,r=t.w,o=t.X,u=t.i;return t.w=r=r+1640531527|0,e=o[u+34&127],n=o[u=u+1&127],e^=e<<13,n^=n<<17,e^=e>>>15,n^=n>>>12,e=o[u]=e^n,t.i=u,e+(r^r>>>16)|0},function(n,t){var e,r,o,u,i,c=[],f=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,f=Math.max(f,t.length)),o=0,u=-32;u<f;++u)t&&(r^=t.charCodeAt((u+32)%t.length)),0===u&&(i=r),r^=r<<10,r^=r>>>15,r^=r<<4,r^=r>>>13,u>=0&&(i=i+1640531527|0,o=0==(e=c[127&u]^=r+i)?o+1:0);for(o>=128&&(c[127&(t&&t.length||0)]=-1),o=127,u=512;u>0;--u)r=c[o+34&127],e=c[o=o+1&127],r^=r<<13,e^=e<<17,r^=r>>>15,e^=e>>>12,c[o]=r^e;n.w=i,n.X=c,n.i=o}(t,n)}function o(n,t){return t.i=n.i,t.w=n.w,t.X=n.X.slice(),t}function u(n,t){null==n&&(n=+new Date);var e=new r(n),u=t&&t.state,i=function(){return(e.next()>>>0)/4294967296};return i.double=function(){do{var n=((e.next()>>>11)+(e.next()>>>0)/4294967296)/(1<<21)}while(0===n);return n},i.int32=e.next,i.quick=i,u&&(u.X&&o(u,e),i.state=function(){return o(e,{})}),i}t&&t.exports?t.exports=u:e&&e.amd?e(function(){return u}):this.xor4096=u}(0,"object"==typeof module&&module,"function"==typeof n&&n);
},{}],"xU2t":[function(require,module,exports) {
var define;
var t;!function(t,n,e){function o(t){var n=this,e="";n.next=function(){var t=n.b,e=n.c,o=n.d,r=n.a;return t=t<<25^t>>>7^e,e=e-o|0,o=o<<24^o>>>8^r,r=r-t|0,n.b=t=t<<20^t>>>12^e,n.c=e=e-o|0,n.d=o<<16^e>>>16^r,n.a=r-t|0},n.a=0,n.b=0,n.c=-1640531527,n.d=1367130551,t===Math.floor(t)?(n.a=t/4294967296|0,n.b=0|t):e+=t;for(var o=0;o<e.length+20;o++)n.b^=0|e.charCodeAt(o),n.next()}function r(t,n){return n.a=t.a,n.b=t.b,n.c=t.c,n.d=t.d,n}function u(t,n){var e=new o(t),u=n&&n.state,c=function(){return(e.next()>>>0)/4294967296};return c.double=function(){do{var t=((e.next()>>>11)+(e.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},c.int32=e.next,c.quick=c,u&&("object"==typeof u&&r(u,e),c.state=function(){return r(e,{})}),c}n&&n.exports?n.exports=u:e&&e.amd?e(function(){return u}):this.tychei=u}(0,"object"==typeof module&&module,"function"==typeof t&&t);
},{}],"KVVd":[function(require,module,exports) {
},{}],"J1zm":[function(require,module,exports) {
var global = arguments[3];
var define;
var r,n=arguments[3];!function(n,t){var e,o=(0,eval)("this"),u=256,i=6,a="random",c=t.pow(u,i),f=t.pow(2,52),s=2*f,l=u-1;function p(r,l,p){var v=[],m=h(function r(n,t){var e,o=[],u=typeof n;if(t&&"object"==u)for(e in n)try{o.push(r(n[e],t-1))}catch(i){}return o.length?o:"string"==u?n:n+"\0"}((l=1==l?{entropy:!0}:l||{}).entropy?[r,d(n)]:null==r?function(){try{var r;return e&&(r=e.randomBytes)?r=r(u):(r=new Uint8Array(u),(o.crypto||o.msCrypto).getRandomValues(r)),d(r)}catch(a){var t=o.navigator,i=t&&t.plugins;return[+new Date,o,i,o.screen,d(n)]}}():r,3),v),j=new g(v),S=function(){for(var r=j.g(i),n=c,t=0;r<f;)r=(r+t)*u,n*=u,t=j.g(1);for(;r>=s;)r/=2,n/=2,t>>>=1;return(r+t)/n};return S.int32=function(){return 0|j.g(4)},S.quick=function(){return j.g(4)/4294967296},S.double=S,h(d(j.S),n),(l.pass||p||function(r,n,e,o){return o&&(o.S&&y(o,j),r.state=function(){return y(j,{})}),e?(t[a]=r,n):r})(S,m,"global"in l?l.global:this==t,l.state)}function g(r){var n,t=r.length,e=this,o=0,i=e.i=e.j=0,a=e.S=[];for(t||(r=[t++]);o<u;)a[o]=o++;for(o=0;o<u;o++)a[o]=a[i=l&i+r[o%t]+(n=a[o])],a[i]=n;(e.g=function(r){for(var n,t=0,o=e.i,i=e.j,a=e.S;r--;)n=a[o=l&o+1],t=t*u+a[l&(a[o]=a[i=l&i+n])+(a[i]=n)];return e.i=o,e.j=i,t})(u)}function y(r,n){return n.i=r.i,n.j=r.j,n.S=r.S.slice(),n}function h(r,n){for(var t,e=r+"",o=0;o<e.length;)n[l&o]=l&(t^=19*n[l&o])+e.charCodeAt(o++);return d(n)}function d(r){return String.fromCharCode.apply(0,r)}if(t["seed"+a]=p,h(t.random(),n),"object"==typeof module&&module.exports){module.exports=p;try{e=require("crypto")}catch(v){}}else"function"==typeof r&&r.amd&&r(function(){return p})}([],Math);
},{"crypto":"KVVd"}],"rzg3":[function(require,module,exports) {
var r=require("./lib/alea"),e=require("./lib/xor128"),i=require("./lib/xorwow"),o=require("./lib/xorshift7"),l=require("./lib/xor4096"),x=require("./lib/tychei"),u=require("./seedrandom");u.alea=r,u.xor128=e,u.xorwow=i,u.xorshift7=o,u.xor4096=l,u.tychei=x,module.exports=u;
},{"./lib/alea":"niZ7","./lib/xor128":"wr2V","./lib/xorwow":"2Wi2","./lib/xorshift7":"yIMU","./lib/xor4096":"jcz7","./lib/tychei":"xU2t","./seedrandom":"J1zm"}],"3e4Q":[function(require,module,exports) {
"use strict";var t;Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,function(){function e(t){this.mode=o.MODE_8BIT_BYTE,this.data=t,this.parsedData=[];for(var e=0,r=this.data.length;e<r;e++){var n=[],i=this.data.charCodeAt(e);i>65536?(n[0]=240|(1835008&i)>>>18,n[1]=128|(258048&i)>>>12,n[2]=128|(4032&i)>>>6,n[3]=128|63&i):i>2048?(n[0]=224|(61440&i)>>>12,n[1]=128|(4032&i)>>>6,n[2]=128|63&i):i>128?(n[0]=192|(1984&i)>>>6,n[1]=128|63&i):n[0]=i,this.parsedData.push(n)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function r(t,e){this.typeNumber=t,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}e.prototype={getLength:function(t){return this.parsedData.length},write:function(t){for(var e=0,r=this.parsedData.length;e<r;e++)t.put(this.parsedData[e],8)}},r.prototype={addData:function(t){var r=new e(t);this.dataList.push(r),this.dataCache=null},isDark:function(t,e){if(t<0||this.moduleCount<=t||e<0||this.moduleCount<=e)throw new Error(t+","+e);return this.modules[t][e]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(t,e){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var o=0;o<this.moduleCount;o++){this.modules[o]=new Array(this.moduleCount);for(var n=0;n<this.moduleCount;n++)this.modules[o][n]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(t,e),this.typeNumber>=7&&this.setupTypeNumber(t),null==this.dataCache&&(this.dataCache=r.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(t,e){for(var r=-1;r<=7;r++)if(!(t+r<=-1||this.moduleCount<=t+r))for(var o=-1;o<=7;o++)e+o<=-1||this.moduleCount<=e+o||(this.modules[t+r][e+o]=0<=r&&r<=6&&(0==o||6==o)||0<=o&&o<=6&&(0==r||6==r)||2<=r&&r<=4&&2<=o&&o<=4)},getBestMaskPattern:function(){for(var t=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var o=c.getLostPoint(this);(0==r||t>o)&&(t=o,e=r)}return e},createMovieClip:function(t,e,r){var o=t.createEmptyMovieClip(e,r);this.make();for(var n=0;n<this.modules.length;n++)for(var i=1*n,a=0;a<this.modules[n].length;a++){var s=1*a;this.modules[n][a]&&(o.beginFill(0,100),o.moveTo(s,i),o.lineTo(s+1,i),o.lineTo(s+1,i+1),o.lineTo(s,i+1),o.endFill())}return o},setupTimingPattern:function(){for(var t=8;t<this.moduleCount-8;t++)null==this.modules[t][6]&&(this.modules[t][6]=t%2==0);for(var e=8;e<this.moduleCount-8;e++)null==this.modules[6][e]&&(this.modules[6][e]=e%2==0)},setupPositionAdjustPattern:function(){for(var t=c.getPatternPosition(this.typeNumber),e=0;e<t.length;e++)for(var r=0;r<t.length;r++){var o=t[e],n=t[r];if(null==this.modules[o][n])for(var i=-2;i<=2;i++)for(var a=-2;a<=2;a++)this.modules[o+i][n+a]=-2==i||2==i||-2==a||2==a||0==i&&0==a}},setupTypeNumber:function(t){for(var e=c.getBCHTypeNumber(this.typeNumber),r=0;r<18;r++){var o=!t&&1==(e>>r&1);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=o}for(r=0;r<18;r++){o=!t&&1==(e>>r&1);this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=o}},setupTypeInfo:function(t,e){for(var r=this.errorCorrectLevel<<3|e,o=c.getBCHTypeInfo(r),n=0;n<15;n++){var i=!t&&1==(o>>n&1);n<6?this.modules[n][8]=i:n<8?this.modules[n+1][8]=i:this.modules[this.moduleCount-15+n][8]=i}for(n=0;n<15;n++){i=!t&&1==(o>>n&1);n<8?this.modules[8][this.moduleCount-n-1]=i:n<9?this.modules[8][15-n-1+1]=i:this.modules[8][15-n-1]=i}this.modules[this.moduleCount-8][8]=!t},mapData:function(t,e){for(var r=-1,o=this.moduleCount-1,n=7,i=0,a=this.moduleCount-1;a>0;a-=2)for(6==a&&a--;;){for(var s=0;s<2;s++)if(null==this.modules[o][a-s]){var h=!1;i<t.length&&(h=1==(t[i]>>>n&1)),c.getMask(e,o,a-s)&&(h=!h),this.modules[o][a-s]=h,-1==--n&&(i++,n=7)}if((o+=r)<0||this.moduleCount<=o){o-=r,r=-r;break}}}},r.PAD0=236,r.PAD1=17,r.createData=function(t,e,o){for(var n=v.getRSBlocks(t,e),i=new _,a=0;a<o.length;a++){var s=o[a];i.put(s.mode,4),i.put(s.getLength(),c.getLengthInBits(s.mode,t)),s.write(i)}var h=0;for(a=0;a<n.length;a++)h+=n[a].dataCount;if(i.getLengthInBits()>8*h)throw new Error("code length overflow. ("+i.getLengthInBits()+">"+8*h+")");for(i.getLengthInBits()+4<=8*h&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=8*h||(i.put(r.PAD0,8),i.getLengthInBits()>=8*h));)i.put(r.PAD1,8);return r.createBytes(i,n)},r.createBytes=function(t,e){for(var r=0,o=0,n=0,i=new Array(e.length),a=new Array(e.length),s=0;s<e.length;s++){var h=e[s].dataCount,u=e[s].totalCount-h;o=Math.max(o,h),n=Math.max(n,u),i[s]=new Array(h);for(var l=0;l<i[s].length;l++)i[s][l]=255&t.buffer[l+r];r+=h;var f=c.getErrorCorrectPolynomial(u),g=new m(i[s],f.getLength()-1).mod(f);a[s]=new Array(f.getLength()-1);for(l=0;l<a[s].length;l++){var d=l+g.getLength()-a[s].length;a[s][l]=d>=0?g.get(d):0}}var p=0;for(l=0;l<e.length;l++)p+=e[l].totalCount;var v=new Array(p),_=0;for(l=0;l<o;l++)for(s=0;s<e.length;s++)l<i[s].length&&(v[_++]=i[s][l]);for(l=0;l<n;l++)for(s=0;s<e.length;s++)l<a[s].length&&(v[_++]=a[s][l]);return v};for(var o={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},n={L:1,M:0,Q:3,H:2},i=0,a=1,s=2,h=3,u=4,l=5,f=6,g=7,c={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(t){for(var e=t<<10;c.getBCHDigit(e)-c.getBCHDigit(c.G15)>=0;)e^=c.G15<<c.getBCHDigit(e)-c.getBCHDigit(c.G15);return(t<<10|e)^c.G15_MASK},getBCHTypeNumber:function(t){for(var e=t<<12;c.getBCHDigit(e)-c.getBCHDigit(c.G18)>=0;)e^=c.G18<<c.getBCHDigit(e)-c.getBCHDigit(c.G18);return t<<12|e},getBCHDigit:function(t){for(var e=0;0!=t;)e++,t>>>=1;return e},getPatternPosition:function(t){return c.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,r){switch(t){case i:return(e+r)%2==0;case a:return e%2==0;case s:return r%3==0;case h:return(e+r)%3==0;case u:return(Math.floor(e/2)+Math.floor(r/3))%2==0;case l:return e*r%2+e*r%3==0;case f:return(e*r%2+e*r%3)%2==0;case g:return(e*r%3+(e+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new m([1],0),r=0;r<t;r++)e=e.multiply(new m([1,d.gexp(r)],0));return e},getLengthInBits:function(t,e){if(1<=e&&e<10)switch(t){case o.MODE_NUMBER:return 10;case o.MODE_ALPHA_NUM:return 9;case o.MODE_8BIT_BYTE:case o.MODE_KANJI:return 8;default:throw new Error("mode:"+t)}else if(e<27)switch(t){case o.MODE_NUMBER:return 12;case o.MODE_ALPHA_NUM:return 11;case o.MODE_8BIT_BYTE:return 16;case o.MODE_KANJI:return 10;default:throw new Error("mode:"+t)}else{if(!(e<41))throw new Error("type:"+e);switch(t){case o.MODE_NUMBER:return 14;case o.MODE_ALPHA_NUM:return 13;case o.MODE_8BIT_BYTE:return 16;case o.MODE_KANJI:return 12;default:throw new Error("mode:"+t)}}},getLostPoint:function(t){for(var e=t.getModuleCount(),r=0,o=0;o<e;o++)for(var n=0;n<e;n++){for(var i=0,a=t.isDark(o,n),s=-1;s<=1;s++)if(!(o+s<0||e<=o+s))for(var h=-1;h<=1;h++)n+h<0||e<=n+h||0==s&&0==h||a==t.isDark(o+s,n+h)&&i++;i>5&&(r+=3+i-5)}for(o=0;o<e-1;o++)for(n=0;n<e-1;n++){var u=0;t.isDark(o,n)&&u++,t.isDark(o+1,n)&&u++,t.isDark(o,n+1)&&u++,t.isDark(o+1,n+1)&&u++,0!=u&&4!=u||(r+=3)}for(o=0;o<e;o++)for(n=0;n<e-6;n++)t.isDark(o,n)&&!t.isDark(o,n+1)&&t.isDark(o,n+2)&&t.isDark(o,n+3)&&t.isDark(o,n+4)&&!t.isDark(o,n+5)&&t.isDark(o,n+6)&&(r+=40);for(n=0;n<e;n++)for(o=0;o<e-6;o++)t.isDark(o,n)&&!t.isDark(o+1,n)&&t.isDark(o+2,n)&&t.isDark(o+3,n)&&t.isDark(o+4,n)&&!t.isDark(o+5,n)&&t.isDark(o+6,n)&&(r+=40);var l=0;for(n=0;n<e;n++)for(o=0;o<e;o++)t.isDark(o,n)&&l++;return r+=10*(Math.abs(100*l/e/e-50)/5)}},d={glog:function(t){if(t<1)throw new Error("glog("+t+")");return d.LOG_TABLE[t]},gexp:function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return d.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},p=0;p<8;p++)d.EXP_TABLE[p]=1<<p;for(p=8;p<256;p++)d.EXP_TABLE[p]=d.EXP_TABLE[p-4]^d.EXP_TABLE[p-5]^d.EXP_TABLE[p-6]^d.EXP_TABLE[p-8];for(p=0;p<255;p++)d.LOG_TABLE[d.EXP_TABLE[p]]=p;function m(t,e){if(null==t.length)throw new Error(t.length+"/"+e);for(var r=0;r<t.length&&0==t[r];)r++;this.num=new Array(t.length-r+e);for(var o=0;o<t.length-r;o++)this.num[o]=t[o+r]}function v(t,e){this.totalCount=t,this.dataCount=e}function _(){this.buffer=[],this.length=0}m.prototype={get:function(t){return this.num[t]},getLength:function(){return this.num.length},multiply:function(t){for(var e=new Array(this.getLength()+t.getLength()-1),r=0;r<this.getLength();r++)for(var o=0;o<t.getLength();o++)e[r+o]^=d.gexp(d.glog(this.get(r))+d.glog(t.get(o)));return new m(e,0)},mod:function(t){if(this.getLength()-t.getLength()<0)return this;for(var e=d.glog(this.get(0))-d.glog(t.get(0)),r=new Array(this.getLength()),o=0;o<this.getLength();o++)r[o]=this.get(o);for(o=0;o<t.getLength();o++)r[o]^=d.gexp(d.glog(t.get(o))+e);return new m(r,0).mod(t)}},v.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],v.getRSBlocks=function(t,e){var r=v.getRsBlockTable(t,e);if(null==r)throw new Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+e);for(var o=r.length/3,n=[],i=0;i<o;i++)for(var a=r[3*i+0],s=r[3*i+1],h=r[3*i+2],u=0;u<a;u++)n.push(new v(s,h));return n},v.getRsBlockTable=function(t,e){switch(e){case n.L:return v.RS_BLOCK_TABLE[4*(t-1)+0];case n.M:return v.RS_BLOCK_TABLE[4*(t-1)+1];case n.Q:return v.RS_BLOCK_TABLE[4*(t-1)+2];case n.H:return v.RS_BLOCK_TABLE[4*(t-1)+3];default:return}},_.prototype={get:function(t){var e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)},put:function(t,e){for(var r=0;r<e;r++)this.putBit(1==(t>>>e-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var C=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]],D=function(){var t=function(t,e){this._bIsPainted=!1,this._htOption=e,this._elCanvas=document.createElement("canvas"),this._elCanvas.width=e.width,this._elCanvas.height=e.height,t.appendChild(this._elCanvas),this._el=t,this._oContext=this._elCanvas.getContext("2d"),this._bIsPainted=!1,this._bSupportDataURI=null};return t.prototype.draw=function(t){var e=this._oContext,r=this._htOption,o=t.getModuleCount(),n=r.width/o,i=r.height/o,a=Math.round(n),s=Math.round(i);this.clear();for(var h=0;h<o;h++)for(var u=0;u<o;u++){var l=t.isDark(h,u),f=u*n,g=h*i;e.strokeStyle=l?r.colorDark:r.colorLight,e.lineWidth=1,e.fillStyle=l?r.colorDark:r.colorLight,e.fillRect(f,g,n,i),e.strokeRect(Math.floor(f)+.5,Math.floor(g)+.5,a,s),e.strokeRect(Math.ceil(f)-.5,Math.ceil(g)-.5,a,s)}this._bIsPainted=!0},t.prototype.isPainted=function(){return this._bIsPainted},t.prototype.clear=function(){this._oContext.clearRect(0,0,this._elCanvas.width,this._elCanvas.height),this._bIsPainted=!1},t.prototype.round=function(t){return t?Math.floor(1e3*t)/1e3:t},t}();function L(t,e){for(var r=1,o=function(t){var e=encodeURI(t).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return e.length+(e.length!=t?3:0)}(t),i=0,a=C.length;i<=a;i++){var s=0;switch(e){case n.L:s=C[i][0];break;case n.M:s=C[i][1];break;case n.Q:s=C[i][2];break;case n.H:s=C[i][3]}if(o<=s)break;r++}if(r>C.length)throw new Error("Too long data");return r}(t=function(t,e){if(this._htOption={width:256,height:256,typeNumber:4,colorDark:"#000000",colorLight:"#ffffff",correctLevel:n.H},"string"==typeof e&&(e={text:e}),e)for(var r in e)this._htOption[r]=e[r];"string"==typeof t&&(t=document.getElementById(t)),this._htOption.useSVG&&(D=svgDrawer),this._el=t,this._oQRCode=null,this._oDrawing=new D(this._el,this._htOption),this._htOption.text&&this.makeCode(this._htOption.text)}).prototype.makeCode=function(t){this._oQRCode=new r(L(t,this._htOption.correctLevel),this._htOption.correctLevel),this._oQRCode.addData(t),this._oQRCode.make(),this._oDrawing.draw(this._oQRCode)},t.prototype.clear=function(){this._oDrawing.clear()},t.prototype.getCanvas=function(){for(let t=0;t<this._el.children.length;t++){const e=this._el.children[t];if("CANVAS"===e.tagName)return e}return null},t.CorrectLevel=n}();var e=t;exports.default=e;
},{}],"M1T5":[function(require,module,exports) {
function o(){const o=module.bundle,e={},t={},n={};for(const[l,r]of Object.entries(o.modules)){const s=""+o.modules[l][0],c=t[s];c?n[l]=c:t[s]=l;for(const[o,t]of Object.entries(r[1]))(e[t]||(e[t]=new Set)).add(o)}const s=o=>e[o]?`${[...e[o]].sort().join('" and "')}`:"top-level",c={},d=[];for(const[l,r]of Object.entries(o.modules))for(const[e,t]of Object.entries(r[1])){const i=n[t];i&&(o.cache[t]?c[i]=t:(r[1][e]=i,delete o.modules[t],d.push(`"${e}" in "${s(l)}" (${l})`)))}for(const[l,r]of Object.entries(o.modules))for(const[e,t]of Object.entries(r[1])){const n=c[t];n&&(o.cache[t]?console.warn(`Could not deduplicate import "${e}" in "${s(l)}" (to fix, import "${s(module.id)}" earlier)`):(r[1][e]=n,delete o.modules[t],d.push(`"${e}" in "${s(l)}" (${l})`)))}for(const l of d.sort())console.log("Deduplicated import",l)}module.bundle&&o();
},{}],"zPnd":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("./deduplicate");const t=window.location.hostname.endsWith("croquet.studio");let o="",s="";class e{constructor(){"undefined"!=typeof document&&document.location&&(this.getSession(),n(this,document.location.search.slice(1)),n(this,t?document.location.hash.slice(1):s),document.location.pathname.indexOf("/ar.html")>=0&&(this.ar=!0))}has(t,o,s){"boolean"!=typeof s&&(s=this.isHost(s)),!0===s&&(o=`no${o}`);const e=this[t];return"string"!=typeof e?s:e.split(",").includes(o)?!s:s}getSession(){if(t){const t=/^\/([^\/]+)\/(.*)$/,s=document.location.pathname.match(t);if(s)return o=s[1],s[2]}else{const t=/^#([^&]+)&?(.*)$/,o=document.location.hash.match(t);if(o)return o[1].includes("=")?(s=`${o[1]}&${o[2]}`,""):(s=o[2],o[1])}return"string"==typeof this.session?(s=document.location.hash.slice(1),this.session):""}setSession(e,n=!1){null==t&&this.getSession();const{search:i,hash:c}=window.location,l=t?`/${o}/${e}${i}${c}`:`#${e}${s?"&"+s:""}`;n?window.history.replaceState({},"",l):window.history.pushState({},"",l)}isHost(t){const o=window.location.hostname;return o===t||"localhost"===t&&(!!o.endsWith(".ngrok.io")||["127.0.0.1","::1"].includes(o))}isLocalhost(){return this.isHost("localhost")}}function n(t,o){if(o)for(const e of o.split("&")){const o=e.split("="),n=o[0];let i=!0;if(o.length>1&&(i=decodeURIComponent(o.slice(1).join("="))).match(/^(true|false|null|[0-9.]*|["[{].*)$/))try{i=JSON.parse(i)}catch(s){"["===i[0]&&(i=i.slice(1,-1).split(","))}t[n]=i}}const i=new e;var c=i;exports.default=c;
},{"./deduplicate":"M1T5"}],"ISxG":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.makeStats=r,exports.Stats=void 0;const e=Date.now();"undefined"==typeof performance&&(window.performance={now:()=>Date.now()-e});const t=["simulate","update","render","snapshot"],o={total:"black",update:"blue",render:"magenta",simulate:"yellow",snapshot:"green",backlog:"red",network:"lightgray"};let n=null,a=null,i=null,l=null;const s=!1;function r(e){for(n=e;e.firstChild;)e.removeChild(e.firstChild);e.style.background="#faf0dc",(a=document.createElement("div")).id="text_stats",a.style.padding=5,a.style.background="rgba(255,255,255,0.2)",a.style.fontFamily="sans-serif",e.appendChild(a),e.title=Object.entries(o).map(([e,t])=>`${t}: ${e}`).join("\n"),(i=document.createElement("canvas")).width=Math.min(125,window.innerWidth)*window.devicePixelRatio,i.height=(s?360:125)*window.devicePixelRatio,i.style.width="100%",e.appendChild(i),(l=i.getContext("2d")).scale(window.devicePixelRatio,window.devicePixelRatio)}const c=[];let d=0,h=!1,m=k(0);function k(e){return{start:e,total:0,items:{},users:0,backlog:0,network:0,latency:0,activity:1e3,connected:h}}function g(e){for(m.total=e-m.start,c.push(m);c.length>Math.min(120,window.innerWidth);)c.shift();if(!n||"none"===window.getComputedStyle(n).display)return;const r=c.slice(1).filter(e=>e.total),h=r.map(e=>e.total).reduce((e,t)=>e+t,0)/r.length,k=Math.max(...r.map(e=>Math.max(e.backlog,e.network)));d=s?Math.max(k,.98*d):1e3,a.parentElement||(console.warn("who broke the stats div and canvas?"),n.appendChild(a),n.appendChild(i)),a.innerText=`${m.users} users, ${Math.round(1e3/h)} fps, `+(m.backlog<100&&m.activity<1e3?`latency: ${m.latency} ms`:`backlog: ${m.backlog<100?"0.0":(m.backlog/1e3).toFixed(1)} s`),l.clearRect(0,0,i.width,i.height);const g=e=>20*(1-e/(1e3/60))+60,f=e=>g(s?e/Math.max(3e3,d)*-200:e/d*-2*(1e3/60))+5;for(let n=0;n<c.length;n++){const e=c[n],a=n+.5;let i=g(0);l.beginPath(),l.moveTo(a,i),l.lineTo(a,g(e.total)),l.strokeStyle=o[e.connected?"total":"network"],l.stroke(),l.beginPath(),l.moveTo(a,i),i=g(e.total);let r=0;for(const n of t)e.items[n]&&(r+=e.items[n],i=g(r),l.lineTo(a,i),l.strokeStyle=o[n],l.stroke(),l.beginPath(),l.moveTo(a,i));e.network&&(l.beginPath(),l.moveTo(a,f(0)),l.lineTo(a,f(e.network)),l.strokeStyle=o.network,l.stroke()),s&&e.backlog&&(l.beginPath(),l.moveTo(a,f(0)),l.lineTo(a,f(e.backlog)),l.strokeStyle=o.backlog,l.stroke())}l.strokeStyle="rgba(255, 255, 255, 0.2)";for(let t=0;t<60;t+=1e3/60)l.moveTo(0,g(t)),l.lineTo(120,g(t)),l.stroke();if(s&&d>500){const e=10**Math.floor(Math.log10(Math.max(3e3,d)));l.font="10pt sans-serif",l.fillStyle="rgba(255, 255, 255, 1)";for(let t=1;t<11;t++){const o=t*e,n=f(o);if(l.moveTo(0,n),l.lineTo(120,n),l.stroke(),l.fillText(`${o/1e3}s`,0,n-5),o>d)break}}s&&(n.style.bottom=f(Math.max(1e3,d))-350)}const f=[],w={animationFrame(e,t={}){g(e),m=k(e);for(const[o,n]of Object.entries(t))this[o](n)},begin(e){const t=performance.now();m.items[e]=(m.items[e]||0)-t;const o=f[f.length-1];return o&&(m.items[o]+=t),f.push(e),t},end(e){const t=performance.now();if(m.items[e]+=t,f.pop()!==e)throw Error("Unmatched stats calls for "+e);const o=f[f.length-1];return o&&(m.items[o]-=t),t},backlog(e){m.backlog=Math.max(e,m.backlog)},network(e){m.network=e},starvation(e){m.network=e},latency(e){m.latency=e},activity(e){m.activity=e},users(e){m.users=e},connected(e){m.connected=h=e}};exports.Stats=w;
},{}],"vYkp":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.showMessageAsToast=g,exports.displayError=x,exports.displayWarning=y,exports.displayStatus=b,exports.displayAppError=w,exports.App=void 0;var t=r(require("toastify-js")),e=r(require("seedrandom")),n=r(require("./thirdparty-patched/qrcodejs/qrcode")),o=r(require("./urlOptions")),i=require("./stats");function r(t){return t&&t.__esModule?t:{default:t}}const a="ontouchstart"in document.documentElement,s=18,d=2,c=a?20:12,l=2,u=a?0:15,p=2,f=.3;function h(){const t=`\n #croquet_dock { position: absolute; z-index: 2; border: 3px solid white; bottom: 6px; left: 6px; width: 84px; height: 36px; box-sizing: border-box; background: white; opacity: 0.4; transition: all ${f}s ease; }\n #croquet_dock.active { opacity: 0.95; border-radius: 12px; }\n #croquet_dock_bar { position: absolute; border: 3px solid white; width: 100%; height: 30px; box-sizing: border-box; background: white; }\n\n #croquet_badge { position: absolute; width: 72px; height: 24px; top: 50%; transform: translate(0px, -50%); cursor: none; }\n #croquet_dock.active #croquet_badge { left: 2%; }\n\n .croquet_dock_button { position: absolute; width: ${c}%; height: 90%; top: 50%; transform: translate(0px, -50%); font-size: 80%; text-align: center; border-radius: 20%; }\n .croquet_dock_button:focus { outline: 0; }\n .croquet_dock_button canvas { position: absolute; width: 100%; height: 100%; top: 0px; left: 0px; }\n #croquet_dock:not(.active) .croquet_dock_button { display: none; }\n #croquet_dock_left { right: ${d+u+c+l}% }\n #croquet_dock_right { right: ${d+u}%; }\n #croquet_dock_pin { right: ${d}%; }\n #croquet_dock_pin.pinned { background: #cce6ff; }\n\n #croquet_dock_content { position: absolute; left: ${p}px; top: ${p}px; right: ${p}px; bottom: ${p}px; background: white; }\n #croquet_dock:not(.active) #croquet_dock_content { display: none; }\n #croquet_dock:not(.active) #croquet_dock_content div { display: none; }\n\n #croquet_qrcode { position: absolute; border: 6px solid white; width: 100%; height: 100%;box-sizing: border-box; cursor: crosshair; }\n #croquet_qrcode:not(.active) { display: none; }\n #croquet_qrcode canvas { image-rendering: pixelated; }\n\n #croquet_stats { position: absolute; width: 70%; height: 90%; left: 15%; top: 5%; opacity: 0.8; font-family: sans-serif; }\n #croquet_stats:not(.active) { display: none; }\n`,e=document.createElement("style");e.innerHTML=t,document.head.appendChild(e)}function m(){let t="/*!\n * Toastify js 1.5.0\n * https://github.com/apvarun/toastify-js\n * @license MIT licensed\n *\n * Copyright (C) 2018 Varun A P\n */\n .toastify {\n padding: 12px 20px;\n color: #ffffff;\n display: inline-block;\n box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.12), 0 10px 36px -4px rgba(77, 96, 232, 0.3);\n background: -webkit-linear-gradient(315deg, #73a5ff, #5477f5);\n background: linear-gradient(135deg, #73a5ff, #5477f5);\n position: fixed;\n opacity: 0;\n transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);\n border-radius: 2px;\n cursor: pointer;\n text-decoration: none;\n max-width: calc(50% - 20px);\n z-index: 2147483647;\n }\n .toastify.on {\n opacity: 1;\n }\n .toast-close {\n opacity: 0.4;\n padding: 0 5px;\n }\n .toastify-right {\n right: 15px;\n }\n .toastify-left {\n left: 15px;\n }\n .toastify-top {\n top: -150px;\n }\n .toastify-bottom {\n bottom: -150px;\n }\n .toastify-rounded {\n border-radius: 25px;\n }\n .toastify-avatar {\n width: 1.5em;\n height: 1.5em;\n margin: 0 5px;\n border-radius: 2px;\n }\n @media only screen and (max-width: 360px) {\n .toastify-right, .toastify-left {\n margin-left: auto;\n margin-right: auto;\n left: 0;\n right: 0;\n max-width: fit-content;\n }\n }\n";t+="\n .toastify { font-family: sans-serif; border-radius: 8px; }\n";const e=document.createElement("style");e.innerHTML="/*!\n * Toastify js 1.5.0\n * https://github.com/apvarun/toastify-js\n * @license MIT licensed\n *\n * Copyright (C) 2018 Varun A P\n */\n .toastify {\n padding: 12px 20px;\n color: #ffffff;\n display: inline-block;\n box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.12), 0 10px 36px -4px rgba(77, 96, 232, 0.3);\n background: -webkit-linear-gradient(315deg, #73a5ff, #5477f5);\n background: linear-gradient(135deg, #73a5ff, #5477f5);\n position: fixed;\n opacity: 0;\n transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);\n border-radius: 2px;\n cursor: pointer;\n text-decoration: none;\n max-width: calc(50% - 20px);\n z-index: 2147483647;\n }\n .toastify.on {\n opacity: 1;\n }\n .toast-close {\n opacity: 0.4;\n padding: 0 5px;\n }\n .toastify-right {\n right: 15px;\n }\n .toastify-left {\n left: 15px;\n }\n .toastify-top {\n top: -150px;\n }\n .toastify-bottom {\n bottom: -150px;\n }\n .toastify-rounded {\n border-radius: 25px;\n }\n .toastify-avatar {\n width: 1.5em;\n height: 1.5em;\n margin: 0 5px;\n border-radius: 2px;\n }\n @media only screen and (max-width: 360px) {\n .toastify-right, .toastify-left {\n margin-left: auto;\n margin-right: auto;\n left: 0;\n right: 0;\n max-width: fit-content;\n }\n }\n\n .toastify { font-family: sans-serif; border-radius: 8px; }\n",document.head.appendChild(e)}function g(t,e={}){const n=e.level;let o;return v(t,{backgroundColor:o="error"===n?"red":"warning"===n?"gold":"#aaa",...e})}function x(t,e={}){return t&&U.showMessage(t,{...e,level:"error"})}function y(t,e={}){return t&&U.showMessage(t,{...e,level:"warning"})}function b(t,e={}){return t&&U.showMessage(t,{...e,level:"status"})}function w(t,e){const n=e.stack.split("\n").filter(t=>!t.match(/croquet-.*\.min.js/)).join("\n");U.showMessage(`<b>Error during ${t}: ${e.message}</b>\n\n${n}`.replace(/\n/g,"<br>"),{level:"error",duration:1e4,stopOnFocus:!0})}function v(e,n){const o=U.root;if(!1===o)return null;const i={text:e,duration:3e3,gravity:"bottom",position:"left",backgroundColor:"linear-gradient(to right, #00b09b, #96c93d)",stopOnFocus:!0,...n};let r;return o instanceof Element&&o!==document.body?(r=o.id)||(o.id=r="_croquetToastParent"):"string"==typeof o&&(r=o),r&&(i.selector=r),(0,t.default)(i).showToast()}function k(t){const n=new e.default(t),o=["bcdfghjklmnpqrstvwxyz","aeiou"];let i="";for(let e=0;e<5;e++)i+=o[e%2][n.quick()*o[e%2].length|0];return i}function _(t,n=1){const o=new e.default(t),i=[];for(let e=0;e<n;e++)i.push(`hsl(${360*o.quick()}, 50%, 70%)`);return i}function q(){!1!==U.badge&&(document.title=document.title.replace(/:.*/,""))}h(),m();let C,E,T=!1,L=null;function $(t={}){if(o.default.nodock)return;const e=document.getElementById("croquet_dock");e&&e.parentElement.removeChild(e);const n=I(U.root);if(!n)return;const i=document.createElement("div");i.id="croquet_dock",n.appendChild(i);const r=document.createElement("div");let d;r.id="croquet_dock_bar",i.appendChild(r),!1!==t.badge&&((d=document.createElement("div")).id="croquet_badge",r.appendChild(d),U.badge=d);const c=document.createElement("div");c.id="croquet_dock_content",i.appendChild(c);const l=[];let u,h;if(!1!==t.qrcode){U.sessionURL&&((u=document.createElement("div")).id="croquet_qrcode",c.appendChild(u),l.push(u.id),U.qrcode=u)}if(!1!==t.stats&&((h=document.createElement("div")).id="croquet_stats",c.appendChild(h),l.push(h.id),U.stats=h),l.length){function m(t){const e=l.length;let n,o=0;if(L){const t=l.indexOf(L);t>=0?(o=t,n=document.getElementById(L)):L=null}const i=l[(o+e+t)%e];let r;i===L?r=n:(n&&n.classList.remove("active"),r=document.getElementById(i)),r&&r.classList.add("active"),L=i}l.length>1&&(r.appendChild(M("<","croquet_dock_left",()=>m(-1))),r.appendChild(M(">","croquet_dock_right",()=>m(1)))),m(0)}if(!a){const t=M("📌","croquet_dock_pin",()=>{T=!T,e()}),e=()=>{T?t.classList.add("pinned"):t.classList.remove("pinned")};e(),r.appendChild(t)}const g=t=>{i.style.width=`${t}px`,i.style.height=`${t*(1+s/100)}px`;const e=t*s/100;r.style.height=`${e}px`,c.style.top=`${e+p}px`,d&&(d.style.height=`${.9*e}px`,d.style.width=`${.9*e*3}px`),u&&(u.style.border=`${8*t/200}px solid white`)};let x=200;const y=()=>{i.classList.add("active"),g(x),setTimeout(()=>i.style.transition="none",1e3*f)},b=()=>{i.style.transition="",i.classList.remove("active"),i.style.width=i.style.height="",r.style.height="",c.style.top="",d&&(d.style.height=d.style.width=""),u&&(u.style.border="")};if(a)b(),i.ontouchstart=(t=>{t.preventDefault(),t.stopPropagation(),(()=>i.classList.contains("active"))()?b():y()});else{T?y():b();let t=0;i.onwheel=(e=>{e.preventDefault(),e.stopPropagation();const n=Date.now();if(n-t<100)return;t=n;const{deltaY:o}=e,r=.9*Math.min(window.innerWidth,window.innerHeight);x=Math.max(166,Math.min(r,i.offsetWidth*1.05**o)),g(x)}),i.onmouseenter=y,i.onmouseleave=(()=>{T||b()})}}function M(t,e,n){const o=document.createElement("canvas"),i=o.width=40*c/12,r=o.height=60,s=o.getContext("2d");s.font="36px Arial",s.textAlign="center",s.textBaseline="middle",s.fillStyle="black",s.fillText(t,i/2,.55*r);const d=document.createElement("button");return d.id=e,d.className="croquet_dock_button",a?d.ontouchstart=(t=>{t.preventDefault(),t.stopPropagation(),n()}):d.onclick=n,d.appendChild(o),d}function z(t,e){if(!1===U.badge)return;const n=k(e);for(document.title=document.title.replace(/:.*/,""),document.title+=":"+n;t.firstChild;)t.removeChild(t.firstChild);const o=document.createElement("canvas"),i=o.width=120,r=o.height=40;o.style.width="100%",t.appendChild(o);const a=o.getContext("2d"),s=_(e,2);a.fillStyle=s[0],a.beginPath(),a.moveTo(0,0),a.lineTo(0,r),a.lineTo(i,0),a.closePath(),a.fill(),a.fillStyle=s[1],a.beginPath(),a.moveTo(i,r),a.lineTo(i,0),a.lineTo(0,r),a.closePath(),a.fill(),a.font="30px Arial",a.textAlign="center",a.textBaseline="middle",a.fillStyle="black",a.fillText(n,i/2,r/2)}function j(t,e,o={}){for(;t.firstChild;)t.removeChild(t.firstChild);return new n.default(t,{text:e,width:128,height:128,colorDark:"#000000",colorLight:"#ffffff",correctLevel:n.default.CorrectLevel.L,...o})}function A(t){if(!t||!1===U.root)return;const e=I(U.badge);e&&z(e,t)}function P(){if(!1===U.root||!1===U.qrcode)return;if(o.default.noqr)return;const t=U.sessionURL;if(!t)return void console.warn("App.sessionURL is not set");const e=I(U.qrcode);e&&(a||(e.onclick=(()=>window.open(t))),j(e,t).getCanvas().style.width="100%")}function S(){if(!1===U.root)return;if(o.default.nostats)return;const t=I(U.stats);t&&(0,i.makeStats)(t)}function O(t){A(t),P(),S()}let R=0;function B(t){if(E!==t)if(!1===U.sync&&(t=!1),t&&!C&&(C=D()),E=t,t)clearTimeout(R),R=setTimeout(()=>{if(!E)return;I(U.root,()=>document.body).appendChild(C),C.style.opacity=.9},500);else{if(!C)return;clearTimeout(R),C.style.opacity=0,R=setTimeout(()=>{E||C.parentElement&&C.parentElement.removeChild(C)},500)}}function D(){const t=document.createElement("style");t.innerHTML="\n .spinnerOverlay {\n z-index: 1000;\n position: fixed;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n background-color:#333;\n opacity:0.9;\n display:flex;\n align-items:center;\n justify-content:center;\n transition: opacity 1.0s ease-out;\n }\n /* https://github.com/lukehaas/css-loaders */\n @keyframes dots {\n 0%, 80%, 100% { box-shadow: 0 2.5em 0 -1.3em; }\n 40% { box-shadow: 0 2.5em 0 0; }\n }\n .loader,\n .loader:before,\n .loader:after {\n border-radius: 50%;\n width: 2.5em;\n height: 2.5em;\n animation: dots 1.8s infinite ease-in-out;\n }\n .loader {\n color: #fff;\n font-size: 10px;\n margin: 80px auto;\n position: relative;\n text-indent: -9999em;\n animation-delay: -0.16s;\n }\n .loader:before,\n .loader:after {\n content: '';\n position: absolute;\n top: 0;\n }\n .loader:before { left: -3.5em; animation-delay: -0.32s; }\n .loader:after { left: 3.5em; }\n ",document.head.appendChild(t);const e=document.createElement("div");e.className="spinnerOverlay";const n=document.createElement("div");return n.className="loader",n.innerText="Catching up...",e.appendChild(n),e}function I(t,e){if(!1===t)return!1;if(t instanceof Element)return t;if("string"==typeof t){const e=document.getElementById(t);if(e)return e}return e?e():null}const U={sessionURL:window.location.href,root:document.body,sync:!0,messages:!1,badge:!1,stats:!1,qrcode:!1,makeWidgetDock:$,makeSessionWidgets:O,makeQRCanvas(t={}){if(!U.sessionURL)return null;const e=j(document.createElement("div"),U.sessionURL,t);return e&&e.getCanvas()},clearSessionMoniker:q,showSyncWait(t){!1===U.root&&(t=!1),B(t)},messageFunction:g,showMessage:(t,e={})=>o.default.nomessages||!1===U.root||!1===U.messages||!U.messageFunction?null:U.messageFunction(t,e)};exports.App=U;
},{"toastify-js":"rbta","seedrandom":"rzg3","./thirdparty-patched/qrcodejs/qrcode":"3e4Q","./urlOptions":"zPnd","./stats":"ISxG"}],"YlCk":[function(require,module,exports) {
"use strict";module.exports=function(r,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var e,n="boolean"==typeof t.cycles&&t.cycles,i=t.cmp&&(e=t.cmp,function(r){return function(t,n){var i={key:t,value:r[t]},u={key:n,value:r[n]};return e(i,u)}}),u=[];return function r(t){if(t&&t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0!==t){if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);var e,o;if(Array.isArray(t)){for(o="[",e=0;e<t.length;e++)e&&(o+=","),o+=r(t[e])||"null";return o+"]"}if(null===t)return"null";if(-1!==u.indexOf(t)){if(n)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var f=u.push(t)-1,c=Object.keys(t).sort(i&&i(t));for(o="",e=0;e<c.length;e++){var l=c[e],y=r(t[l]);y&&(o&&(o+=","),o+=JSON.stringify(l)+":"+y)}return u.splice(f,1),"{"+o+"}"}}(r)};
},{}],"5BG1":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getUser=r,exports.login=o;var e=t(require("./urlOptions")),n=require("./modules");function t(e){return e&&e.__esModule?e:{default:e}}function r(e,n,t=null){let r={};try{r=JSON.parse(localStorage.croquetUser||"{}")}catch(o){}return e in r?r[e]:t?(r[e]=t(),r[e]!==n&&(localStorage.croquetUser=JSON.stringify(r)),r[e]):n}async function o(){return!e.default.nologin&&(!(!r("name")||e.default.user)||new Promise(t=>{const o=document.createElement("style");o.innerHTML='\n .overlay {\n z-index: 1010;\n position: fixed;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n background-color:#333;\n opacity:0.9;\n display:flex;\n align-items:center;\n justify-content:center\n }\n form {\n background-color: #fff;\n color: #666;\n border-radius: 10px;\n padding: 16px;\n font-size: 14px;\n }\n form dt { margin: 4px 0 }\n form dd { margin-left: 0 }\n form input {\n border: 1px solid #ccc;\n border-radius: 5px;\n min-height: 46px;\n padding: 10px;\n font-size: 16px;\n width: 100%;\n box-shadow: inset 0 1px 2px #666;\n }\n form input:invalid { border: 1px solid red; }\n form input:valid { border: 1px solid #ccc; }\n form button {\n padding: 20px 32px;\n background-color: #3b5;\n color: #fff;\n border-radius: 50px;\n border-width:0;\n font-size: 16px;\n font-weight: 500;\n width: 100%;\n }\n .error {\n visibility: hidden;\n width: 250px;\n background-color: #fcc;\n color: #900;\n padding: 5px;\n border-radius: 6px;\n border: 1px solid #c99;\n position: absolute;\n margin-top: 5px;\n font-size: 12px;\n }\n .error::after {\n content: " ";\n position: absolute;\n bottom: 100%; /* At the top of message */\n left: 10px;\n border-width: 5px;\n border-style: solid;\n border-color: transparent transparent #c99 transparent;\n }\n .notice {\n visibility: hidden;\n width: 270px;\n height: 70px;\n background-color: #fff;\n padding: 5px;\n position: absolute;\n margin-top: 5px;\n font-size: 12px;\n }\n ',document.head.appendChild(o);const i=document.createElement("form");i.innerHTML='\n <dl>\n <dt><label for="user[name]">Username</label></dt>\n <dd>\n <input type="text" required pattern="^[a-zA-Z0-9_]*$" minlength="2" maxlength="15" name="user[name]" id="user[name]" placeholder="Enter a username" autocomplete="off" spellcheck="false"></input>\n </dd>\n <dd class="error"></dd>\n <dd class="notice"></dd>\n </dl>\n <dl>\n <dt><label for="user[email]">Email</label></dt>\n <dd>\n <input type="email" required id="user[email]" placeholder="you@example.com" autocomplete="off" spellcheck="false"></input>\n </dd>\n <dd class="error"></dd>\n </dl>\n <dl>\n <dt><label for="user[password]">Password</label></dt>\n <dd>\n <input type="password" required minlength="8" id="user[password]" placeholder="Create a password" autocomplete="off" spellcheck="false"></input>\n </dd>\n <dd class="error"></dd>\n </dl>\n <button id="user[create]">Sign up / Log in</button>\n <div style="margin:16px auto;text-align: center">— OR —</div>\n <button id="user[guest]" style="background-color: #999">Continue as Croquet Guest</button>\n <div style="max-width:280px;text-align: center;font-size:11px;margin:4px auto">\n Continuing from this screen to our website indicates that you agree to our\n <a href="/terms.html" target="_blank" style="color:#36c;text-decoration:none">terms of service</a>\n and\n <a href="/privacy.html" target="_blank" style="color:#36c;text-decoration:none">privacy statement</a>.\n </div>\n ';const a=document.createElement("div");a.classList.add("overlay"),a.appendChild(i),document.body.appendChild(a);const[s,l,d]=i.getElementsByTagName("input"),[c,u,p]=i.getElementsByClassName("error"),[m]=i.getElementsByClassName("notice"),[f,y]=i.getElementsByTagName("button");"string"==typeof e.default.user?s.value=e.default.user:r("name")&&(s.value=r("name"));let g=0;s.oninput=(()=>{clearTimeout(g),g=setTimeout(()=>w(),300)}),S(!0),s.oninput();let h=0;l.oninput=(()=>{clearTimeout(h),h=setTimeout(()=>T(),300)});let b=0;function v(){i.reset(),document.head.removeChild(o),document.body.removeChild(a)}function x(e,t,r=".json"){return`${(0,n.fileServer)()}/user/${e.toLowerCase()}/${t}${r}`}async function w(e=!1){c.style.visibility="hidden",e||S(!0);const t=s.value.trim();if(!t&&!e)return!1;if(s.validity.tooShort||s.validity.tooLong)return c.innerHTML=`Your username must be between ${s.minLength} and ${s.maxLength} characters long.`,c.style.visibility="visible",!1;if(s.validity.patternMismatch)return c.innerHTML="Your username can only contain alphanumeric characters (letters A-Z, numbers 0-9) and underscores.",c.style.visibility="visible",!1;try{const o=g,i=await fetch(x(t,"salt"),{mode:"cors"});if(o!==g&&!e)return!1;if(i.ok){e||S(!1);const r=await i.json();return{name:t,salt:(0,n.fromBase64url)(r.salt)}}}catch(r){}return{name:t}}function T(e=!1){u.style.visibility="hidden";const n=l.value.trim();return!(!n&&!e)&&(l.validity.valid?n:(u.innerHTML="Please enter a valid email address.",u.style.visibility="visible",!1))}function L(e=!1){p.style.visibility="hidden";const n=d.value;return!(!n&&!e)&&(d.validity.tooShort?(p.innerHTML=`Your password must be at least ${d.minLength} characters long.`,p.style.visibility="visible",!1):n)}function S(e){const n=s.value.trim();m.innerHTML=`“${n}” is already registered as a user.<br><br>\n If this is you, please enter your password below to continue.\n Otherwise, please pick a different name.`,m.style.visibility=e?"hidden":"visible",l.disabled=!e,d.placeholder=n?e?`Create a password for “${n}”`:`Enter password for “${n}”`:"Enter a password",f.innerHTML=n?e?`Sign up as “${n}”`:`Log in as “${n}”`:"Sign up / Log in"}d.oninput=(()=>{clearTimeout(b),b=setTimeout(()=>L(),300)}),f.onclick=(async e=>{e.preventDefault();const{name:r,salt:o}=await w(!0),i=!!o||T(!0),a=L(!0);if(!r||!i||!a)return;let s=o;s||(s=crypto.getRandomValues(new Uint8Array(8)),fetch(x(r,"salt"),{method:"PUT",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify({salt:(0,n.toBase64url)(s)})}));const l=await window.crypto.subtle.importKey("raw",(new TextEncoder).encode(a),{name:"PBKDF2"},!1,["deriveBits"]),d=await window.crypto.subtle.deriveBits({name:"PBKDF2",salt:s,iterations:5e5,hash:"SHA-256"},l,256),c=(0,n.toBase64url)(d);if(o)try{const e=await fetch(x(r,c),{mode:"cors"});if(!e.ok)throw Error("wrong password");const n=await e.json();console.log(`Logged in as ${n.name} <${n.email}>`),localStorage.croquetUser=JSON.stringify(n)}catch(u){return p.innerHTML=`Wrong password for “${r}“`,void(p.style.visibility="visible")}else{const e=crypto.getRandomValues(new Uint8Array(16)),t={name:r,email:i,salt:(0,n.toBase64url)(s),secret:(0,n.toBase64url)(e)};localStorage.croquetUser=JSON.stringify(t),fetch(x(r,c),{method:"PUT",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),console.log(`Signed up as ${t.name} <${t.email}>`)}v(),t(!0)}),y.onclick=(e=>{e.preventDefault(),delete localStorage.croquetUser,v(),t(!1)})}))}
},{"./urlOptions":"zPnd","./modules":"uCN1"}],"uCN1":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.fileServer=c,exports.baseUrl=a,exports.fromBase64url=O,exports.toBase64url=$,exports.hashBuffer=b,exports.hashString=C,exports.hashFile=v,exports.addClassHash=U,exports.addConstantsHash=q,exports.hashNameAndCode=H,exports.uploadCode=E,exports.CROQUET_HOST=void 0;var e=o(require("fast-json-stable-stringify")),t=o(require("./urlOptions")),n=require("./user");function o(e){return e&&e.__esModule?e:{default:e}}const r="entry",s="index.html";let i="";const u=window.location.hostname.endsWith("croquet.io")?window.location.host:"croquet.studio";function c(){const e="string"==typeof t.default.files?t.default.files:`https://${u}/files-v1`;return e.endsWith("/")?e.slice(0,-1):e}function a(e="code"){const o=t.default.has("dev","host","localhost")?`dev/${(0,n.getUser)("name","GUEST")}/`:"all/";return`${c()}/${o}${e}/`}function l(){return module.bundle?module.bundle.modules:[]}function f(){return Object.keys(l()).filter(e=>!e.endsWith("hmr-runtime.js"))}function d(e){return l()[e]}function h(e,t){return d(e)[1][t]||t}function p(e){const t=""+e,n=t.indexOf("{"),o=t.lastIndexOf("}");return t.slice(n+1,o).trim()}function g(e){const t=""+e,n=t.indexOf("{"),o=t.lastIndexOf("}");return`${t.slice(0,n).replace(/\s+/g," ").trim()} {\n${t.slice(n+1,o).trim()}}`}function x(e){return e===s?i:p(d(e)[0])}function m(e){return d(e)[1]}function y(e){return Object.values(m(e))}function w(e){return f().filter(t=>y(t).includes(e))}function O(e){return new Uint8Array(atob(e.padEnd(e.length+3&-4,"=").replace(/-/g,"+").replace(/_/g,"/")).split("").map(e=>e.charCodeAt(0)))}function $(e){return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}async function b(e){return $(await window.crypto.subtle.digest("SHA-256",e))}exports.CROQUET_HOST=u;const j=new TextEncoder;async function C(e){return b(j.encode(e))}const S={};async function v(e){if(S[e])return S[e];const t=x(e).replace(/\s+/g," ");return S[e]=await C(t)}const _=[];function U(e){const t=C(g(e));t.then(t=>console.log(`hashing ${e.name}: ${t}`)),_.push(t)}function q(t){const n=JSON.stringify(t,(e,t)=>"function"==typeof t?""+t:t);if("{}"===n)return;const o=JSON.parse(n),r=C((0,e.default)(o));r.then(e=>console.log(`hashing Croquet.Constants(${Object.keys(o).join(", ")}): ${e}`)),_.push(r)}async function H(e){const t=f().filter(e=>{const t=e.endsWith("/package.json")||e.endsWith("/ar.js");return t&&console.warn(`excluding ${e} from code hash`),!t}).sort();console.log(`hashing ${t.length} SDK modules`);const n=await Promise.all([...t.map(v),..._]),o=await C(n.join("|"));return{hash:await C([e,o].join("|")),codeHash:o}}let T;{function A(){}T=A}async function E(){return T()}
},{"fast-json-stable-stringify":"YlCk","./urlOptions":"zPnd","./user":"5BG1"}],"XQ2t":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;class s{constructor(){this.values=[],this.resolves=[]}async next(){return this.values.length>0&&this.values.shift(),new Promise(s=>this.resolves.push(s))}put(s){const e=this.resolves.shift();e?e(s):this.values.push(s)}peek(){return this.values[0]}nextNonBlocking(){return this.values.shift()}}exports.default=s;
},{}],"TxNx":[function(require,module,exports) {
"use strict";var t=function(t,r){return t<r};function r(i){if(!(this instanceof r))return new r(i);this.array=[],this.size=0,this.compare=i||t}r.prototype.clone=function(){var t=new r(this.compare);t.size=this.size;for(var i=0;i<this.size;i++)t.array.push(this.array[i]);return t},r.prototype.add=function(t){var r,i,e=this.size;for(this.array[this.size]=t,this.size+=1;e>0&&(r=e-1>>1,i=this.array[r],this.compare(t,i));)this.array[e]=i,e=r;this.array[e]=t},r.prototype.heapify=function(t){var r;for(this.array=t,this.size=t.length,r=this.size>>1;r>=0;r--)this._percolateDown(r)},r.prototype._percolateUp=function(t,r){for(var i,e,a=this.array[t];t>0&&(i=t-1>>1,e=this.array[i],r||this.compare(a,e));)this.array[t]=e,t=i;this.array[t]=a},r.prototype._percolateDown=function(t){for(var r,i,e,a=this.size,s=this.size>>>1,o=this.array[t];t<s&&(i=(r=1+(t<<1))+1,e=this.array[r],i<a&&this.compare(this.array[i],e)&&(r=i,e=this.array[i]),this.compare(e,o));)this.array[t]=e,t=r;this.array[t]=o},r.prototype._removeAt=function(t){if(!(t>this.size-1||t<0))return this._percolateUp(t,!0),this.poll()},r.prototype.remove=function(t){for(var r=0;r<this.size;r++)if(!this.compare(this.array[r],t)&&!this.compare(t,this.array[r]))return this._removeAt(r),!0;return!1},r.prototype._batchRemove=function(t,r){var i=new Array(r||this.size),e=0;if("function"==typeof t&&this.size)for(var a=0;a<this.size&&e<i.length;)t(this.array[a])?(i[e]=this._removeAt(a),e++,a>>=1):a++;return i.length=e,i},r.prototype.removeOne=function(t){var r=this._batchRemove(t,1);return r.length>0?r[0]:void 0},r.prototype.removeMany=function(t,r){return this._batchRemove(t,r)},r.prototype.peek=function(){if(0!=this.size)return this.array[0]},r.prototype.poll=function(){if(0!=this.size){var t=this.array[0];return this.size>1?(this.array[0]=this.array[--this.size],this._percolateDown(0)):this.size-=1,t}},r.prototype.replaceTop=function(t){if(0!=this.size){var r=this.array[0];return this.array[0]=t,this._percolateDown(0),r}},r.prototype.trim=function(){this.array=this.array.slice(0,this.size)},r.prototype.isEmpty=function(){return 0===this.size},r.prototype.forEach=function(t){if(!this.isEmpty()&&"function"==typeof t)for(var r=0,i=this.clone();!i.isEmpty();)t(i.poll(),r++)},r.prototype.kSmallest=function(t){if(0==this.size)return[];var i=this.compare,e=this.array,a=new r(function(t,r){return i(e[t],e[r])});t=Math.min(this.size,t);var s=new Array(t),o=0;for(a.add(0);o<t;){var h=a.poll();s[o++]=this.array[h];var n=1+(h<<1),p=n+1;n<this.size&&a.add(n),p<this.size&&a.add(p)}return s};var i=function(){var t=new r(function(t,r){return t<r});for(t.add(1),t.add(0),t.add(5),t.add(4),t.add(3);!t.isEmpty();)console.log(t.poll())};require.main===module&&i(),module.exports=r;
},{}],"XDZa":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=r(require("fastpriorityqueue"));function r(e){return e&&e.__esModule?e:{default:e}}class t extends e.default{poll(){const e=super.poll();return this.array[this.size]=null,e}asArray(){const e=[];return this.forEach(r=>e.push(r)),e}asUnsortedArray(){return this.array.slice(0,this.size)}}exports.default=t;
},{"fastpriorityqueue":"TxNx"}],"Ym10":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e={asyncQueue:!0,PriorityQueue:!0,Stats:!0,urlOptions:!0};Object.defineProperty(exports,"asyncQueue",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(exports,"PriorityQueue",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(exports,"Stats",{enumerable:!0,get:function(){return o.Stats}}),Object.defineProperty(exports,"urlOptions",{enumerable:!0,get:function(){return i.default}});var t=a(require("./asyncQueue")),r=require("./modules");Object.keys(r).forEach(function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return r[t]}}))});var u=require("./html");Object.keys(u).forEach(function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return u[t]}}))});var n=a(require("./priorityQueue")),o=require("./stats"),i=a(require("./urlOptions"));function a(e){return e&&e.__esModule?e:{default:e}}
},{"./asyncQueue":"XQ2t","./modules":"uCN1","./html":"vYkp","./priorityQueue":"XDZa","./stats":"ISxG","./urlOptions":"zPnd"}],"IfYm":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.viewDomain=exports.Domain=void 0;const e="#__vote";class t{constructor(){this.subscriptions={},this.queuedEvents=[],this.perFrameEvents=new Map,this.perSyncedFrameEvents=new Map,this.id=r(),this.lastId=0}register(e){return this.id+"/V"+ ++this.lastId}deregister(e){}addSubscription(t,s,i,r,n){if("vote"===n)return void this.addSubscription(t,s+e,i,r,"immediate");const o=t+":"+s,c=r;c.for=i;let a=this.subscriptions[o];a||(a=this.subscriptions[o]={immediate:new Set,queued:new Set,oncePerFrame:new Set,oncePerFrameWhileSynced:new Set}),a[n].add(c)}removeSubscription(t,i,r){const n=t+":"+i,o=this.subscriptions[n];if(o){0===s(o,r)&&delete this.subscriptions[n]}i.endsWith(e)||this.removeSubscription(t,i+e,r)}removeAllSubscriptionsFor(e){const t=`${e}:`;for(const[i,r]of Object.entries(this.subscriptions))if(i.startsWith(t))delete this.subscriptions[i];else{0===s(r,e)&&delete this.subscriptions[i]}}handleEvent(e,t){const s=this.subscriptions[e];if(s){s.queued.size>0&&this.queuedEvents.push({topic:e,data:t}),s.oncePerFrame.size>0&&this.perFrameEvents.set(e,t),s.oncePerFrameWhileSynced.size>0&&this.perSyncedFrameEvents.set(e,t);for(const e of s.immediate)e(t)}}processFrameEvents(e){let t=0;for(const{topic:s,data:i}of this.queuedEvents){const e=this.subscriptions[s];if(e)for(const s of e.queued)s(i),t++}this.queuedEvents.length=0;for(const[s,i]of this.perFrameEvents){const e=this.subscriptions[s];if(e)for(const s of e.oncePerFrame)s(i),t++}if(this.perFrameEvents.clear(),e){for(const[e,s]of this.perSyncedFrameEvents){const i=this.subscriptions[e];if(i)for(const e of i.oncePerFrameWhileSynced)e(s),t++}this.perSyncedFrameEvents.clear()}return t}}function s(e,t){function s(e){for(const s of e)s.for===t&&e.delete(s)}return s(e.immediate),s(e.oncePerFrame),s(e.oncePerFrameWhileSynced),s(e.queued),e.immediate.size+e.queued.size+e.oncePerFrame.size+e.oncePerFrameWhileSynced.size}exports.Domain=t;const i=new t;function r(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))}exports.viewDomain=i;
},{}],"QEgO":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.currentRealm=u,exports.inModelRealm=l,exports.inViewRealm=c;var e=i(require("@croquet/util/urlOptions")),r=require("./domain");function i(e){return e&&e.__esModule?e:{default:e}}let s={get subscribe(){return(s={subscribe:e.default.has("debug","subscribe",!1)}).subscribe}};class t{constructor(e){this.island=e}register(e){return this.island.registerModel(e)}deregister(e){this.island.deregisterModel(e.id)}publish(e,r,i){this.island.publishFromModel(i,e,r)}subscribe(e,r,i,t){return s.subscribe&&console.log(`Model.subscribe(${r}:${i}) ${e} ${t}`),this.island.addSubscription(e,r,i,t)}unsubscribe(e,r,i,t="*"){s.subscribe&&console.log(`Model.unsubscribe(${r}:${i}) ${e}`),this.island.removeSubscription(e,r,i,t)}unsubscribeAll(e){s.subscribe&&console.log(`View.unsubscribeAll(${e}`),this.island.removeAllSubscriptionsFor(e)}future(e,r,i,s){if(o&&o.equal(this))return this.island.future(e,r,i,s);if(r)throw Error("tOffset not supported from cross-realm future send yet.");const t=this.island;return new Proxy(e,{get(r,i){if("function"==typeof e[i]){return new Proxy(e[i],{apply(r,s,n){t.callModelMethod(e.id,i,n)}})}throw Error("Tried to call "+i+"() on future of "+Object.getPrototypeOf(e).constructor.name+" which is not a function")}})}random(){return this.island.random()}now(){return this.island.time}equal(e){return e instanceof t&&e.island===this.island}}class n{constructor(e){this.island=e}register(e){return r.viewDomain.register(e)}deregister(e){r.viewDomain.deregister(e)}publish(e,r,i){this.island.publishFromView(i,e,r)}subscribe(e,i,t,n,o="queued"){s.subscribe&&console.log(`View.subscribe(${n}:${e}) ${i} ${t} [${o}]`),r.viewDomain.addSubscription(n,e,i,t,o)}unsubscribe(e,i,t,n){s.subscribe&&console.log(`View.unsubscribe(${n}:${e}) ${i} ${t}`),r.viewDomain.removeSubscription(n,e,i,t)}unsubscribeAll(e){s.subscribe&&console.log(`View.unsubscribeAll(${e})`),r.viewDomain.removeAllSubscriptionsFor(e)}future(e,r){return r?new Proxy(e,{get(i,s){if("function"==typeof e[s]){return new Proxy(e[s],{apply(i,t,n){setTimeout(()=>{e.id&&e[s](...n)},r)}})}throw Error("Tried to call "+s+"() on future of "+Object.getPrototypeOf(e).constructor.name+" which is not a function")}}):e}random(){return Math.random()}now(){return this.island.time}externalNow(){return this.island.controller.time}isSynced(){return!!this.island.controller.synced}equal(e){return e instanceof n&&e.island===this.island}}let o=null;function u(){if(!o)throw Error("Tried to execute code that requires realm outside of realm.");return o}function l(e,r){if(null!==o)throw Error("Can't switch realms from inside realm");try{return o=new t(e),r()}finally{o=null}}function c(e,r){if(null!==o)throw Error("Can't switch realms from inside realm");try{return o=new n(e),r()}finally{o=null}}
},{"@croquet/util/urlOptions":"zPnd","./domain":"IfYm"}],"QjFl":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=n(require("@croquet/util/urlOptions")),r=require("@croquet/util/modules"),t=require("@croquet/util"),s=require("./realms");function n(e){return e&&e.__esModule?e:{default:e}}const i={classes:e.default.has("debug","classes",!1)};let o=Symbol("SECRET");const l=new WeakSet;class a{static __isTeatimeModelClass__(){return!0}static create(e,r){const t=this,n=(0,s.currentRealm)(),i=new t(o);return Object.defineProperty(i,"__realm",{value:n}),Object.defineProperty(i,"id",{value:n.register(i),enumerable:!0}),l.add(i),r&&i.beWellKnownAs(r),i.init(e),l.has(i)&&(l.delete(i),Object.getPrototypeOf(t)!==a&&console.warn(`${i} did not call super.init(options)`)),i}static createNoInit(e){const r=(0,s.currentRealm)(),t=new this(o);return Object.defineProperty(t,"__realm",{value:r}),Object.defineProperty(t,"id",{value:e,enumerable:!0}),t}static allowConstructors(){o=void 0,console.warn("disabling error reporting for Model constructors")}static register(e="unknown-file"){return(0,r.addClassHash)(this),p(e,this.name,this),this}static registerIfNeeded(){_(this)||this.register()}static types(){return{}}static classToID(e){return f(e)}static classFromID(e){return b(e)}static allClasses(){return h()}static allClassTypes(){return m()}static instantiateClassID(e,r){return b(e).createNoInit(r)}constructor(e){if(e!==o)throw Error(`You must create ${this} using create() not "new"!`)}init(e){l.delete(this)}destroy(){(0,s.currentRealm)().unsubscribeAll(this),(0,s.currentRealm)().deregister(this)}publish(e,r,t){this.__realm||this.__realmError(),this.__realm.publish(r,t,e)}subscribe(e,r,t){return this.__realm||this.__realmError(),this.__realm.subscribe(this,e,r,t)}unsubscribe(e,r){this.__realm||this.__realmError(),this.__realm.unsubscribe(this,e,r)}unsubscribeAll(){this.__realm||this.__realmError(),this.__realm.unsubscribeAll(this)}__realmError(){if(!this.id)throw Error(`${this} has no ID, did you call super.init(options)?`)}future(e=0,r,...t){return this.__realm||this.__realmError(),this.__realm.future(this,e,r,t)}random(){return(0,s.currentRealm)().random()}now(){return(0,s.currentRealm)().now()}beWellKnownAs(e){(0,s.currentRealm)().island.set(e,this)}wellKnownModel(e){return this.__realm.island.get(e)}modelOnly(e){let r="none";try{r=(0,s.currentRealm)()}catch(i){}if(r===this.__realm)return!0;const n=Error(e||`${this}.modelOnly() called from outside a model!`);throw(0,t.displayAppError)("view code",n),n}get sessionId(){return this.__realm.island.id}[Symbol.toPrimitive](){const e=this.constructor.name;return e.includes("Model")?e:`${e}[Model]`}}const u={},c=Symbol("CLASS_ID");function d(){if(module.bundle)for(const[e,r]of Object.entries(module.bundle.cache))for(const[t,s]of Object.entries(r.exports))s&&s.__isTeatimeModelClass__&&p(e,"default"===t?s.name:t,s)}function h(){return 0===Object.keys(u).length&&d(),Object.values(u).map(e=>e.cls)}function m(){const e={};for(const r of h())Object.prototype.hasOwnProperty.call(r,"types")&&Object.assign(e,r.types());return Object.entries(e)}function _(e){return Object.prototype.hasOwnProperty.call(e,c)}function f(e){if(_(e))return e[c];if(d(),_(e))return e[c];throw Error(`Class "${e.name}" not found, did you call ${e.name}.register()?`)}function b(e){if(u[e])return u[e].cls;if(d(),u[e])return u[e].cls;throw Error(`Class "${e}" in snapshot, but not found in current source?`)}function p(e,r,t){const s=`${e}:${r}`,n=u[s];if(n&&n.cls!==t)throw Error(`Duplicate class ${r} in ${e}`);return _(t)?i.classes&&!n&&console.warn(`ignoring re-exported class ${r} from ${e}`):(i.classes&&console.log(`registering class ${r} from ${e}`),t[c]=s),u[s]={cls:t,file:e},t}var y=a;exports.default=y;
},{"@croquet/util/urlOptions":"zPnd","@croquet/util/modules":"uCN1","@croquet/util":"Ym10","./realms":"QEgO"}],"Sudw":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("@croquet/util/html"),r=require("./realms");class t{static displayStatus(r,t){return(0,e.displayStatus)(r,t)}static displayWarning(r,t){return(0,e.displayWarning)(r,t)}static displayError(r,t){return(0,e.displayError)(r,t)}constructor(e){Object.defineProperty(this,"realm",{value:(0,r.currentRealm)()}),Object.defineProperty(this,"id",{value:this.realm.register(this),configurable:!0})}detach(){this.unsubscribeAll(),this.realm.deregister(this),Object.defineProperty(this,"id",{value:""})}publish(e,r,t){this.realm.publish(r,t,e)}subscribe(e,r,t){this[t.name]===t&&(t=t.bind(this));const{event:i,handling:s}=r.event?r:{event:r};this.realm.subscribe(i,this.id,t,e,s)}unsubscribe(e,r){this.realm.unsubscribe(r,this.id,null,e)}unsubscribeAll(){this.realm.unsubscribeAll(this.id)}future(e=0){return this.realm.future(this,e)}random(){return(0,r.currentRealm)().random()}now(){return this.realm.now()}externalNow(){return this.realm.externalNow()}update(e){}wellKnownModel(e){return this.realm.island.get(e)}get sessionId(){return this.realm.island.id}get viewId(){return this.realm.island.controller.viewId}[Symbol.toPrimitive](){const e=this.constructor.name;return e.includes("View")?e:`${e}[View]`}}var i=t;exports.default=i;
},{"@croquet/util/html":"vYkp","./realms":"QEgO"}],"ypWm":[function(require,module,exports) {
!function(){"use strict";var r,n=function(r){return r!=r},t=Math.sqrt,e=.7853981633974483,u=function(r){var u,o,i,f,a;if(n(r))return NaN;if(r>0?i=r:(u=!0,i=-r),i>1)return NaN;if(i>.625)f=(o=1-i)*function(r){var n,t;return 0===r?.08333333333333809:((r<0?-r:r)<=1?(n=28.536655482610616+r*(r*(6.968710824104713+r*(.002967721961301243*r-.5634242780008963))-25.56901049652825),t=342.43986579130785+r*(r*(147.0656354026815+r*(1*r-21.947795316429207))-383.8770957603691)):(n=.002967721961301243+(r=1/r)*(r*(6.968710824104713+r*(28.536655482610616*r-25.56901049652825))-.5634242780008963),t=1+r*(r*(147.0656354026815+r*(342.43986579130785*r-383.8770957603691))-21.947795316429207)),n/t)}(o),o=t(o+o),a=e-o,a-=o=o*f-6.123233995736766e-17,a+=e;else{if(i<1e-8)return r;a=i*(a=(o=i*i)*function(r){var n,t;return 0===r?.16666666666666713:((r<0?-r:r)<=1?(n=r*(19.562619833175948+r*(r*(5.444622390564711+r*(.004253011369004428*r-.6019598008014124))-16.262479672107002))-8.198089802484825,t=r*(139.51056146574857+r*(r*(70.49610280856842+r*(1*r-14.740913729888538))-147.1791292232726))-49.18853881490881):(n=.004253011369004428+(r=1/r)*(r*(5.444622390564711+r*(r*(19.562619833175948+-8.198089802484825*r)-16.262479672107002))-.6019598008014124),t=1+r*(r*(70.49610280856842+r*(r*(139.51056146574857+-49.18853881490881*r)-147.1791292232726))-14.740913729888538)),n/t)}(o))+i}return u?-a:a},o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,f=Object.prototype.hasOwnProperty,a="function"==typeof Symbol?Symbol.toStringTag:"",c={};r=o&&"symbol"==typeof Symbol.toStringTag?function(r){var n,t,e;if(null==r)return i.call(r);t=r[a],n=function(r,n){return null!=r&&f.call(r,n)}(r,a);try{r[a]=void 0}catch(u){return i.call(r)}return e=i.call(r),n?r[a]=t:delete r[a],e}:function(r){return i.call(r)},c=r;var w="function"==typeof Uint32Array,y="function"==typeof Uint32Array?Uint32Array:null,l="function"==typeof Uint32Array?Uint32Array:null,v={};v=function(){var r,n;if("function"!=typeof y)return!1;try{r=function(r){return w&&r instanceof Uint32Array||"[object Uint32Array]"===c(r)}(n=new y(n=[1,3.14,-3.14,4294967296,4294967297]))&&1===n[0]&&3===n[1]&&4294967293===n[2]&&0===n[3]&&1===n[4]}catch(t){r=!1}return r}()?l:function(){throw new Error("not implemented")};var N="function"==typeof Float64Array,h="function"==typeof Float64Array?Float64Array:null,s="function"==typeof Float64Array?Float64Array:null,d={};d=function(){var r,n;if("function"!=typeof h)return!1;try{r=function(r){return N&&r instanceof Float64Array||"[object Float64Array]"===c(r)}(n=new h([1,3.14,-3.14,NaN]))&&1===n[0]&&3.14===n[1]&&-3.14===n[2]&&n[3]!=n[3]}catch(t){r=!1}return r}()?s:function(){throw new Error("not implemented")};var p,A="function"==typeof Uint8Array,M="function"==typeof Uint8Array?Uint8Array:null,q="function"==typeof Uint8Array?Uint8Array:null;p=function(){var r,n;if("function"!=typeof M)return!1;try{r=function(r){return A&&r instanceof Uint8Array||"[object Uint8Array]"===c(r)}(n=new M(n=[1,3.14,-3.14,256,257]))&&1===n[0]&&3===n[1]&&253===n[2]&&0===n[3]&&1===n[4]}catch(t){r=!1}return r}()?q:function(){throw new Error("not implemented")};var b,C="function"==typeof Uint16Array,U="function"==typeof Uint16Array?Uint16Array:null,m="function"==typeof Uint16Array?Uint16Array:null,g={uint16:function(){var r,n;if("function"!=typeof U)return!1;try{r=function(r){return C&&r instanceof Uint16Array||"[object Uint16Array]"===c(r)}(n=new U(n=[1,3.14,-3.14,65536,65537]))&&1===n[0]&&3===n[1]&&65533===n[2]&&0===n[3]&&1===n[4]}catch(t){r=!1}return r}()?m:function(){throw new Error("not implemented")},uint8:p};(b=new g.uint16(1))[0]=4660;var I,F=52===new g.uint8(b.buffer)[0];I=!0===F?1:0;var S,H=new d(1),O=new v(H.buffer),x=function(r){return H[0]=r,O[I]};S=!0===F?1:0;var E,j,T,G=new d(1),L=new v(G.buffer),W=function(r,n){return G[0]=r,L[S]=n>>>0,G[0]},P=Number.POSITIVE_INFINITY,V=Number.NEGATIVE_INFINITY,Y=.6931471803691238,_=1.9082149292705877e-10,k=function(r){var t,e,u,o,i,f,a,c,w,y;if(r<-1||n(r))return NaN;if(-1===r)return V;if(r===P)return r;if(0===r)return r;if(y=1,(u=r<0?-r:r)<.41421356237309503){if(u<1.862645149230957e-9)return u<5.551115123125783e-17?r:r-r*r*.5;r>-.2928932188134525&&(y=0,o=r,e=1)}return 0!==y&&(u<9007199254740992?(i=(y=((e=x(w=1+r))>>20)-1023)>0?1-(w-r):r-(w-1),i/=w):(y=((e=x(w=r))>>20)-1023,i=0),(e&=1048575)<434334?w=W(w,1072693248|e):(y+=1,w=W(w,1071644672|e),e=1048576-e>>2),o=w-1),t=.5*o*o,0===e?0===o?y*Y+(i+=y*_):y*Y-((c=t*(1-.6666666666666666*o))-(y*_+i)-o):(c=(a=(f=o/(2+o))*f)*(0===a?.6666666666666735:.6666666666666735+a*(.3999999999940942+a*(.2857142874366239+a*(.22222198432149784+a*(.1818357216161805+a*(.15313837699209373+.14798198605116586*a)))))),0===y?o-(t-f*(t+c)):y*Y-(t-(f*(t+c)+(y*_+i))-o))},z=.6931471805599453,B=1.9082149292705877e-10,D=function(r){var t,e,u,o,i,f,a,c,w,y;return 0===r?V:n(r)||r<0?NaN:(o=0,(e=x(r))<1048576&&(o-=54,e=x(r*=0x40000000000000)),e>=2146435072?r+r:(o+=(e>>20)-1023|0,o+=(a=614244+(e&=1048575)&1048576|0)>>20|0,f=(r=W(r,e|1072693248^a))-1,(1048575&2+e)<3?0===f?0===o?0:.6931471803691238*o+o*B:(i=f*f*(.5-.3333333333333333*f),0===o?f-i:.6931471803691238*o-(i-o*B-f)):(a=e-398458|0,u=(w=(y=(c=f/(2+f))*c)*y)*(0===w?.3999999999940942:.3999999999940942+w*(.22222198432149784+.15313837699209373*w)),i=y*(0===w?.6666666666666735:.6666666666666735+w*(.2857142874366239+w*(.1818357216161805+.14798198605116586*w)))+u,(a|=440401-e|0)>0?(t=.5*f*f,0===o?f-(t-c*(t+i)):.6931471803691238*o-(t-(c*(t+i)+o*B)-f)):0===o?f-c*(f-i):.6931471803691238*o-(c*(f-i)-o*B-f))))},J=function(r){return r===P||r===V},K=1.5707963267948966,Q=function(r){var t,u,o,i;return n(r)||0===r?r:r===P?K:r===V?-K:(r<0&&(u=!0,r=-r),t=0,r>2.414213562373095?(o=K,t=1,r=-1/r):r<=.66?o=0:(o=e,t=2,r=(r-1)/(r+1)),i=r*(i=(i=r*r)*(0===i?-64.85021904942025:i*(i*(i*(-.8750608600031904*i-16.157537187333652)-75.00855792314705)-122.88666844901361)-64.85021904942025)/(0===i?194.5506571482614:194.5506571482614+i*(485.3903996359137+i*(432.88106049129027+i*(165.02700983169885+i*(24.858464901423062+1*i))))))+r,2===t?i+=3.061616997868383e-17:1===t&&(i+=6.123233995736766e-17),o+=i,u?-o:o)};!0===F?(j=1,T=0):(j=0,T=1),E={HIGH:j,LOW:T};var R,X,Z,$=new d(1),rr=new v($.buffer),nr=E.HIGH,tr=E.LOW,er=function(r,n){return $[0]=n,r[0]=rr[nr],r[1]=rr[tr],r},ur=function(r,n){return 1===arguments.length?er([0,0],r):er(r,n)};!0===F?(X=1,Z=0):(X=0,Z=1),R={HIGH:X,LOW:Z};var or,ir=new d(1),fr=new v(ir.buffer),ar=R.HIGH,cr=R.LOW,wr=function(r,n){return fr[ar]=r,fr[cr]=n,ir[0]},yr=[0,0],lr=function(r,n){var t,e;return ur(yr,r),t=yr[0],t&=2147483647,e=x(n),wr(t|=e&=2147483648,yr[1])},vr=3.141592653589793,Nr=function(r,n){var t,e,u,o;return u=(o=r*r)*o,e=o*(0===o?.0416666666666666:.0416666666666666+o*(2480158728947673e-20*o-.001388888888887411)),e+=u*u*(0===o?-2.7557314351390663e-7:o*(2.087572321298175e-9+-1.1359647557788195e-11*o)-2.7557314351390663e-7),(u=1-(t=.5*o))+(1-u-t+(o*e-r*n))},hr=-.16666666666666632,sr=function(r,n){var t,e,u;return t=.00833333333332249+(u=r*r)*(27557313707070068e-22*u-.0001984126982985795)+u*(u*u)*(1.58969099521155e-10*u-2.5050760253406863e-8),e=u*r,0===n?r+e*(hr+u*t):r-(u*(.5*n-e*t)-n-e*hr)};or=!0===F?0:1;var dr=new d(1),pr=new v(dr.buffer),Ar=Math.floor,Mr=function(r){return r<0?-r:0===r?0:r},qr=function(r,t){return n(t)||J(t)?(r[0]=t,r[1]=0,r):0!==t&&Mr(t)<2.2250738585072014e-308?(r[0]=4503599627370496*t,r[1]=-52,r):(r[0]=t,r[1]=0,r)},br=[0,0],Cr=[0,0],Ur=function(r,t){var e,u;return 0===r||n(r)||J(r)?r:(function(r,n){1===arguments.length?qr([0,0],r):qr(r,n)}(br,r),t+=br[1],(t+=function(r){var n=x(r);return(n=(2146435072&n)>>>20)-1023|0}(r=br[0]))<-1074?lr(0,r):t>1023?r<0?V:P:(t<=-1023?(t+=52,u=2.220446049250313e-16):u=1,ur(Cr,r),e=Cr[0],e&=2148532223,u*wr(e|=t+1023<<20,Cr[1])))},mr=[10680707,7228996,1387004,2578385,16069853,12639074,9804092,4427841,16666979,11263675,12935607,2387514,4345298,14681673,3074569,13734428,16653803,1880361,10960616,8533493,3062596,8710556,7349940,6258241,3772886,3769171,3798172,8675211,12450088,3874808,9961438,366607,15675153,9132554,7151469,3571407,2607881,12013382,4155038,6285869,7677882,13102053,15825725,473591,9065106,15363067,6271263,9264392,5636912,4652155,7056368,13614112,10155062,1944035,9527646,15080200,6658437,6231200,6832269,16767104,5075751,3212806,1398474,7579849,6349435,12618859],gr=[1.570796251296997,7.549789415861596e-8,5.390302529957765e-15,3.282003415807913e-22,1.270655753080676e-29,1.2293330898111133e-36,2.7337005381646456e-44,2.1674168387780482e-51],Ir=5.960464477539063e-8,Fr=xr(new Array(20)),Sr=xr(new Array(20)),Hr=xr(new Array(20)),Or=xr(new Array(20));function xr(r){var n,t=r.length;for(n=0;n<t;n++)r[n]=0;return r}var Er,jr=Math.round,Tr=function(r,n,t){var e,u,o,i,f;return o=r-1.5707963267341256*(e=jr(.6366197723675814*r)),i=6.077100506506192e-11*e,f=n>>20|0,t[0]=o-i,f-(x(t[0])>>20&2047)>16&&(i=2.0222662487959506e-21*e-((u=o)-(o=u-(i=6.077100506303966e-11*e))-i),t[0]=o-i,f-(x(t[0])>>20&2047)>49&&(i=8.4784276603689e-32*e-((u=o)-(o=u-(i=2.0222662487111665e-21*e))-i),t[0]=o-i)),t[1]=o-t[0]-i,e},Gr=1.5707963267341256,Lr=6.077100506506192e-11,Wr=2*Lr,Pr=4*Lr,Vr=new Array(3),Yr=new Array(2),_r=function(r,n){var t,e,u,o,i,f,a;if((u=2147483647&x(r)|0)<=1072243195)return n[0]=r,n[1]=0,0;if(u<=1074752122)return 598523==(1048575&u)?Tr(r,u,n):u<=1073928572?r>0?(a=r-Gr,n[0]=a-Lr,n[1]=a-n[0]-Lr,1):(a=r+Gr,n[0]=a+Lr,n[1]=a-n[0]+Lr,-1):r>0?(a=r-2*Gr,n[0]=a-Wr,n[1]=a-n[0]-Wr,2):(a=r+2*Gr,n[0]=a+Wr,n[1]=a-n[0]+Wr,-2);if(u<=1075594811)return u<=1075183036?1074977148===u?Tr(r,u,n):r>0?(a=r-3*Gr,n[0]=a-1.8231301519518578e-10,n[1]=a-n[0]-1.8231301519518578e-10,3):(a=r+3*Gr,n[0]=a+1.8231301519518578e-10,n[1]=a-n[0]+1.8231301519518578e-10,-3):1075388923===u?Tr(r,u,n):r>0?(a=r-4*Gr,n[0]=a-Pr,n[1]=a-n[0]-Pr,4):(a=r+4*Gr,n[0]=a+Pr,n[1]=a-n[0]+Pr,-4);if(u<1094263291)return Tr(r,u,n);if(u>=2146435072)return n[0]=NaN,n[1]=NaN,0;for(t=function(r){return dr[0]=r,pr[or]}(r),a=wr(u-((e=(u>>20)-1046)<<20|0),t),i=0;i<2;i++)Vr[i]=0|a,a=16777216*(a-Vr[i]);for(Vr[2]=a,o=3;0===Vr[o-1];)o-=1;return f=function(r,n,t,e){var u,o,i,f,a,c,w;for((o=(t-3)/24|0)<0&&(o=0),f=t-24*(o+1),c=o-(i=e-1),w=i+4,a=0;a<=w;a++)Fr[a]=c<0?0:mr[c],c+=1;for(a=0;a<=4;a++){for(u=0,c=0;c<=i;c++)u+=r[c]*Fr[i+(a-c)];Sr[a]=u}return function r(n,t,e,u,o,i,f,a,c){var w,y,l,v,N,h,s,d,p;for(v=i,p=u[e],d=e,N=0;d>0;N++)y=Ir*p|0,Or[N]=p-16777216*y|0,p=u[d-1]+y,d-=1;if(p=Ur(p,o),p-=8*Ar(.125*p),p-=s=0|p,l=0,o>0?(s+=N=Or[e-1]>>24-o,Or[e-1]-=N<<24-o,l=Or[e-1]>>23-o):0===o?l=Or[e-1]>>23:p>=.5&&(l=2),l>0){for(s+=1,w=0,N=0;N<e;N++)d=Or[N],0===w?0!==d&&(w=1,Or[N]=16777216-d):Or[N]=16777215-d;if(o>0)switch(o){case 1:Or[e-1]&=8388607;break;case 2:Or[e-1]&=4194303}2===l&&(p=1-p,0!==w&&(p-=Ur(1,o)))}if(0===p){for(d=0,N=e-1;N>=i;N--)d|=Or[N];if(0===d){for(h=1;0===Or[i-h];h++);for(N=e+1;N<=e+h;N++){for(c[a+N]=mr[f+N],y=0,d=0;d<=a;d++)y+=n[d]*c[a+(N-d)];u[N]=y}return r(n,t,e+=h,u,o,i,f,a,c)}}if(0===p)for(e-=1,o-=24;0===Or[e];)e-=1,o-=24;else(p=Ur(p,-o))>=16777216?(y=Ir*p|0,Or[e]=p-16777216*y|0,o+=24,Or[e+=1]=y):Or[e]=0|p;for(y=Ur(1,o),N=e;N>=0;N--)u[N]=y*Or[N],y*=Ir;for(N=e;N>=0;N--){for(y=0,h=0;h<=v&&h<=e-N;h++)y+=gr[h]*u[N+h];Hr[e-N]=y}for(y=0,N=e;N>=0;N--)y+=Hr[N];for(t[0]=0===l?y:-y,y=Hr[0]-y,N=1;N<=e;N++)y+=Hr[N];return t[1]=0===l?y:-y,7&s}(r,n,4,Sr,f,4,o,i,Fr)}(Vr,Yr,e,o),r<0?(n[0]=-Yr[0],n[1]=-Yr[1],-f):(n[0]=Yr[0],n[1]=Yr[1],f)},kr=[0,0],zr=Math.ceil,Br=function(r){var t;return n(r)||r===P?r:r===V?0:r>709.782712893384?P:r<-745.1332191019411?0:r>-1/(1<<28)&&r<1/(1<<28)?1+r:function(r,n,t){var e,u,o,i;return o=(e=r-n)-(u=e*e)*(0===(i=u)?.16666666666666602:.16666666666666602+i*(i*(6613756321437934e-20+i*(4.1381367970572385e-8*i-16533902205465252e-22))-.0027777777777015593)),Ur(1-(n-e*o/(2-o)-r),t)}(r-.6931471803691238*(t=function(r){return r<0?zr(r):Ar(r)}(r<0?1.4426950408889634*r-.5:1.4426950408889634*r+.5)),1.9082149292705877e-10*t,t)};Er=!0===F?0:1;var Dr=new d(1),Jr=new v(Dr.buffer),Kr=function(r,n){return Dr[0]=r,Jr[Er]=n>>>0,Dr[0]},Qr=[0,0],Rr=[0,0],Xr=function(r,n,t){var e,u,o,i,f,a,c,w,y;return(u=2147483647&(e=x(r))|0)>=1072010280&&(r<0&&(r=-r,n=-n),r=(y=.7853981633974483-r)+(w=3.061616997868383e-17-n),n=0),i=n+(y=r*r)*((f=y*r)*((i=function(r){return 0===r?.13333333333320124:.13333333333320124+r*(.021869488294859542+r*(.0035920791075913124+r*(.0005880412408202641+r*(7817944429395571e-20+-18558637485527546e-21*r))))}(w=y*y))+(c=y*(0===w?.05396825397622605:.05396825397622605+w*(.0088632398235993+w*(.0014562094543252903+w*(.0002464631348184699+w*(7140724913826082e-20+2590730518636337e-20*w)))))))+n),w=r+(i+=.3333333333333341*f),u>=1072010280?(1-(e>>30&2))*((c=t)-2*(r-(w*w/(w+c)-i))):1===t?w:(Kr(y=w,0),c=i-(y-r),Kr(a=o=-1/w,0),a+o*((f=1+a*y)+a*c))},Zr=[0,0];void 0===window.CroquetMath&&(window.CroquetMath={}),window.CroquetMath.acos=function(r){var o;return n(r)?NaN:r<-1||r>1?NaN:r>.5?2*u(t(.5-.5*r)):(o=e-u(r),o+=6.123233995736766e-17,o+=e)},window.CroquetMath.acosh=function(r){var e;return n(r)?NaN:r<1?NaN:1===r?0:r>=1<<28?D(r)+z:r>2?D(2*r-1/(r+t(r*r-1))):k((e=r-1)+t(2*e+e*e))},window.CroquetMath.asin=u,window.CroquetMath.asinh=function(r){var e,u,o;return n(r)||J(r)?r:(r<0&&(r=-r,e=!0),o=r<1/(1<<28)?r:r>1<<28?D(r)+z:r>2?D(2*r+1/(t(r*r+1)+r)):k(r+(u=r*r)/(1+t(1+u))),e?-o:o)},window.CroquetMath.atan=Q,window.CroquetMath.atanh=function(r){var t,e;return n(r)?NaN:r<-1||r>1?NaN:1===r?P:-1===r?V:(r<0&&(t=!0,r=-r),r<1/(1<<28)?t?-r:r:(e=r<.5?.5*k((e=r+r)+e*r/(1-r)):.5*k((r+r)/(1-r)),t?-e:e))},window.CroquetMath.atan2=function(r,t){var e;return n(t)||n(r)?NaN:J(t)?t===P?J(r)?lr(vr/4,r):lr(0,r):J(r)?lr(3*vr/4,r):lr(vr,r):J(r)?lr(vr/2,r):0===r?t>=0&&!function(r){return!!(x(r)>>>31)}(t)?lr(0,r):lr(vr,r):0===t?lr(vr/2,r):(e=Q(r/t),t<0?e<=0?e+vr:e-vr:e)},window.CroquetMath.cbrt=function(r){var t,e,u,o,i;return n(r)||J(r)||0===r?r:(e=-2147483648&(u=x(r)),u&=2147483647,i=0,r<2.2250738585072014e-308?(i=0x40000000000000,t=x(i*=r),i=wr(e|(t=(2147483647&t)/3+696219795),0)):i=W(i,e|(t=u/3+715094163)),i*=function(r){return 0===r?1.87595182427177:1.87595182427177+r*(r*(1.6214297201053545+r*(.14599619288661245*r-.758397934778766))-1.8849797954337717)}(o=i*i*(i/r)),t=x(i),i=wr(t+1,0),i+=i*(o=((o=r/(i*i))-i)/(i+i+o)))},window.CroquetMath.cos=function(r){var n;if(n=x(r),(n&=2147483647)<=1072243195)return n<1044381696?1:Nr(r,0);if(n>=2146435072)return NaN;switch(3&_r(r,kr)){case 0:return Nr(kr[0],kr[1]);case 1:return-sr(kr[0],kr[1]);case 2:return-Nr(kr[0],kr[1]);default:return sr(kr[0],kr[1])}},window.CroquetMath.cosh=function(r){return n(r)?r:(r<0&&(r=-r),r>21?Br(r)/2:(Br(r)+Br(-r))/2)},window.CroquetMath.exp=Br,window.CroquetMath.expm1=function(r){var t,e,u,o,i,f,a,c,w,y,l,v;if(r===P||n(r))return r;if(r===V)return-1;if(0===r)return r;if(r<0?(e=!0,a=-r):(e=!1,a=r),a>=38.816242111356935){if(e)return-1;if(a>=709.782712893384)return P}if(i=0|x(a),a>.34657359027997264)a<1.0397207708399179?e?(u=r+.6931471803691238,o=-1.9082149292705877e-10,v=-1):(u=r-.6931471803691238,o=1.9082149292705877e-10,v=1):(v=e?1.4426950408889634*r-.5:1.4426950408889634*r+.5,u=r-.6931471803691238*(y=v|=0),o=1.9082149292705877e-10*y),w=u-(r=u-o)-o;else{if(i<1016070144)return r;v=0}return l=(c=r*(t=.5*r))*(((f=1+c*(0===c?-.03333333333333313:c*(.0015873015872548146+c*(c*(4008217827329362e-21+-2.0109921818362437e-7*c)-793650757867488e-19))-.03333333333333313))-(y=3-f*t))/(6-r*y)),0===v?r-(r*l-c):(l=r*(l-w)-w,l-=c,-1===v?.5*(r-l)-.5:1===v?r<-.25?-2*(l-(r+.5)):1+2*(r-l):v<=-2||v>56?(u=x(a=1-(l-r))+(v<<20)|0,(a=W(a,u))-1):(y=1,v<20?a=(y=W(y,u=1072693248-(2097152>>v)|0))-(l-r):(a=r-(l+(y=W(y,u=1023-v<<20|0))),a+=1),u=x(a)+(v<<20)|0,W(a,u)))},window.CroquetMath.log=D,window.CroquetMath.log1p=k,window.CroquetMath.log10=function(r){var t,e,u,o,i,f,a;return n(r)||r<0?NaN:0===r?V:(i=0,(e=x(r))<1048576&&(i-=54,e=x(r*=0x40000000000000)),e>=2146435072?r+r:(i+=(e>>20)-1023|0,r=W(r,(e&=1048575)|1072693248^(o=e+614244&1048576|0)),f=i+=o>>20|0,u=function(r){var n,t,e,u,o,i,f,a,c;return u=r-1,(1048575&2+(e=x(r)))<3?0===u?0:u*u*(.3333333333333333*u-.5):(c=(e&=1048575)-398458|0,t=(a=(i=(o=u/(2+u))*o)*i)*(0===a?.3999999999940942:.3999999999940942+a*(.22222198432149784+.15313837699209373*a)),f=i*(0===a?.6666666666666735:.6666666666666735+a*(.2857142874366239+a*(.1818357216161805+.14798198605116586*a)))+t,(c|=440401-e|0)>0?o*((n=.5*u*u)+f)-n:o*(f-u))}(r),t=Kr(r-=1,0),a=3.694239077158931e-13*f+2.5082946711645275e-11*(r+u),(a+=.4342944818781689*(r-t+u)+.4342944818781689*t)+.30102999566361177*f))},window.CroquetMath.log2=function(r){var t,e,u,o,i;if(n(r)||r<0)return NaN;if(ur(Qr,r),i=0,(e=Qr[0])<1048576){if(0==(2147483647&e|Qr[1]))return V;i-=54,e=x(r*=0x40000000000000)}return e>=2146435072?r+r:(i+=(e>>20)-1023|0,r=W(r,(e&=1048575)|1072693248^(o=e+614244&1048576|0)),i+=o>>20|0,u=function(r){var n,t,e,u,o,i,f,a,c;return u=r-1,(1048575&2+(e=x(r)))<3?0===u?0:u*u*(.3333333333333333*u-.5):(c=(e&=1048575)-398458|0,t=(a=(i=(o=u/(2+u))*o)*i)*(0===a?.3999999999940942:.3999999999940942+a*(.22222198432149784+.15313837699209373*a)),f=i*(0===a?.6666666666666735:.6666666666666735+a*(.2857142874366239+a*(.1818357216161805+.14798198605116586*a)))+t,(c|=440401-e|0)>0?o*((n=.5*u*u)+f)-n:o*(f-u))}(r),t=Kr(r-=1,0),1.6751713164886512e-10*(r+u)+1.4426950407214463*(r-t+u)+1.4426950407214463*t+i)},window.CroquetMath.sin=function(r){var n;if(n=x(r),(n&=2147483647)<=1072243195)return n<1045430272?r:sr(r,0);if(n>=2146435072)return NaN;switch(3&_r(r,Rr)){case 0:return sr(Rr[0],Rr[1]);case 1:return Nr(Rr[0],Rr[1]);case 2:return-sr(Rr[0],Rr[1]);default:return-Nr(Rr[0],Rr[1])}},window.CroquetMath.sinh=function(r){var n;return 0===r?r:(n=Mr(r),r>710.4758600739439||r<-709.089565712824?r>0?P:V:n>1?n>=709.0895657128241?(n=Br(.5*n),n*=.5*n,r<0&&(n=-n),n):(n=.5*(n=Br(n))-.5/n,r<0&&(n=-n),n):r+r*(n*=n)*function(r){var n,t;return 0===r?.16666666666666666:((r<0?-r:r)<=1?(n=r*(r*(-.789474443963537*r-163.72585752598383)-11561.443576500522)-351754.9648081514,t=r*(36157.827983443196+r*(1*r-277.7110814206028))-2110529.7888489086):(n=(r=1/r)*(r*(-351754.9648081514*r-11561.443576500522)-163.72585752598383)-.789474443963537,t=1+r*(r*(36157.827983443196+-2110529.7888489086*r)-277.7110814206028)),n/t)}(n))},window.CroquetMath.tan=function(r){var n,t;return n=x(r),(n&=2147483647)<=1072243195?n<1044381696?r:Xr(r,0,1):n>=2146435072?NaN:(t=_r(r,Zr),Xr(Zr[0],Zr[1],1-((1&t)<<1)))},window.CroquetMath.tanh=function(r){var n,t;if((t=Mr(r))>44.014845965556525)return r<0?-1:1;if(t>=.625)t=1-2/((n=Br(2*t))+1),r<0&&(t=-t);else{if(0===r)return r;t=r+r*(n=r*r)*function(r){var n,t;return 0===r?-.3333333333333332:((r<0?-r:r)<=1?(n=r*(r*(0*r-.9643991794250523)-99.28772310019185)-1614.6876844170845,t=4844.063053251255+r*(2235.4883906010045+r*(112.81167849163293+1*r))):(n=0+(r=1/r)*(r*(-1614.6876844170845*r-99.28772310019185)-.9643991794250523),t=1+r*(112.81167849163293+r*(2235.4883906010045+4844.063053251255*r))),n/t)}(n)}return t};const $r=Math.pow;function rn(r){return r===1/0||r===-1/0}window.CroquetMath.pow=((r,n)=>{if(isNaN(r)||isNaN(n))return NaN;if(rn(r)||rn(n))return $r(r,n);if(0===r||0===n)return $r(r,n);if(r<0&&!function(r){return Number.isInteger(r)}(n))return NaN;if(1===n)return r;if(2===n)return r*r;if(3===n)return r*r*r;if(4===n)return r*r*r*r;let t=1;return r<0&&(r*=-1,t=$r(-1,n)),window.CroquetMath.exp(window.CroquetMath.log(r)*n)*t})}();
},{}],"dCl0":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.QFunc=c,exports.inSequence=E,exports.gatherInternalClassTypes=N,exports.Message=exports.default=void 0;var t=n(require("seedrandom/seedrandom")),e=n(require("@croquet/util/priorityQueue"));require("@croquet/math");var s=require("@croquet/util/html"),r=n(require("./model")),i=require("./realms"),o=require("./domain");function n(t){return t&&t.__esModule?t:{default:t}}let a=null;const h={};function c(t,e){"function"==typeof t&&(e=t,t={});const s=Object.keys(t).concat(["return "+e]),r=Object.values(t),i={qPara:s,qArgs:r},o=r.indexOf(e);return o>=0&&(r[o]=s[o],i.qFn=o),`{${btoa(JSON.stringify(i))}}`}function l(t,e){const{qPara:s,qArgs:r,qFn:i}=JSON.parse(atob(t.slice(1,-1))),o=JSON.stringify(s),n=h[o]||(h[o]=new Function(...s));return"number"==typeof i&&(r[i]=n),n.call(e,...r).bind(e)}function d(t,e){if(a)throw Error("Island confusion");if(!(t instanceof w))throw Error("not an island: "+t);const s=a;try{a=t,window.ISLAND=t,e()}finally{a=s}}const u="#__vote",f="#reflected",p="#divergence";class w{static current(){return a||console.warn("No CurrentIsland!"),a}static installCustomMath(){if(!window.BrowserMath){window.CroquetMath.random=(()=>a.random()),window.BrowserMath={};for(const[t,e]of Object.entries(window.CroquetMath)){const s=window.Math[t];window.BrowserMath[t]=s,window.Math[t]=["pow","atan2"].includes(t)?(t,r)=>a?e(t,r):s(t,r):t=>a?e(t):s(t)}}}constructor(s,r){w.installCustomMath(),d(this,()=>{(0,i.inModelRealm)(this,()=>{if(this.modelsById={},this.modelsByName={},this.messages=new e.default((t,e)=>t.before(e)),this.subscriptions={},this.users={},this._random=(()=>{throw Error("You must not use random when applying state!")}),this.id=s.id,this.time=0,this.seq=4294967280,this.externalTime=0,this.externalSeq=this.seq,this.futureSeq=0,this.tuttiSeq=0,this.modelsId=0,s.modelsById){const t=new q(this).readIsland(s,"$");for(const e of Object.keys(t))if(e in this||"meta"===e)if("messages"===e)for(const s of t.messages)this.messages.add(s);else this[e]=t[e];else console.warn(`Ignoring property snapshot.${e}`)}else{this._random=new t.default(null,{state:!0});const e=r(this)||{};Object.assign(this.modelsByName,e),this.addSubscription(this,this.id,"__users__",this.generateJoinExit)}})})}registerModel(t,e){if(a!==this)throw Error("Island Error");return e||(e=this.id+"/M"+ ++this.modelsId),this.modelsById[e]=t,e}deregisterModel(t){if(a!==this)throw Error("Island Error");const e=this.modelsById;delete this.modelsById[t];for(const[s,r]of Object.entries(this.modelsByName))e===r&&delete this.modelsByName[s];this.messages.removeMany(e=>e.hasReceiver(t))}lookUpModel(t){if(t===this.id)return this;const e=this.modelsById[t];if(e)return e;const[s,r,i]=t.match(/^([^#]+)#(.*)$/);return this.modelsById[r].lookUp(i)}get(t){return this.modelsByName[t]}set(t,e){if(a!==this)throw Error("Island Error");this.modelsByName[t]=e}getNextTuttiSeq(){return this.tuttiSeq=this.tuttiSeq+1>>>0,this.tuttiSeq}callModelMethod(t,e,s){if(a)throw Error("Island Error");const r=this.lookUpModel(t);if(!r)return void console.error(Error(`Model not found: ${t}`));const i=new v(this.time,0,r.id,e,s);this.controller.sendMessage(i)}noop(){}generateJoinExit({entered:t,exited:e,count:s}){e=t.length===s?Object.keys(this.users):e.map(t=>t[0]);for(const r of e)this.users[r]&&(delete this.users[r],this.publishFromModel(this.id,"view-exit",r));for(const[r,i,o]of t)this.users[r]||(this.users[r]={name:i},o&&(this.users[r].location=o),this.publishFromModel(this.id,"view-join",r))}scheduleExternalMessage(t){const e=v.fromState(t);if(e.time<this.time)throw Error("past message from reflector "+t);const s=this.externalSeq+1>>>0;if(e.seq!==s)throw Error(`External message error. Expected message #${s} got #${e.seq}`);return this.externalTime=e.time,this.externalSeq=e.seq,e.seq=2*e.seq+1,this.messages.add(e),e}futureSend(t,e,s,r){if(t.every)return this.futureRepeat(t.every,e,s,r);if(t<0)throw Error("attempt to send future message into the past");this.futureSeq=this.futureSeq+1>>>0;const i=new v(this.time+t,2*this.futureSeq,e,s,r);return this.messages.add(i),i}futureRepeat(t,e,s,r){this.futureSend(t,this.id,"futureExecAndRepeat",[t,e,s,r])}futureExecAndRepeat(t,e,r,i){const o=this.lookUpModel(e);if("function"==typeof o[r])try{o[r](...i)}catch(n){(0,s.displayAppError)(`future message ${o}.${r}`,n)}else{const t=l(r,o);try{t(...i)}catch(n){(0,s.displayAppError)(`future message ${o} ${t}`,n)}}this.futureRepeat(t,e,r,i)}future(t,e,s,r){const i=this.asQFunc(t,s);if("string"==typeof i)return this.futureSend(e,t.id,i,r);const o=this;return new Proxy(t,{get(s,r){if("function"==typeof t[r])return(...s)=>{if(o.lookUpModel(t.id)!==t)throw Error("future send to unregistered model");return o.futureSend(e,t.id,r,s)};throw Error("Tried to call "+r+"() on future of "+Object.getPrototypeOf(t).constructor.name+" which is not a function")}})}advanceTo(t,e){if(a)throw Error("Island Error");let s,r=0;for(;(s=this.messages.peek())&&s.time<=t;){const{time:t,seq:i}=s;if(t<this.time)throw Error("past message encountered: "+s);if(1&i&&(this.seq=this.seq+1>>>0,i/2>>>0!==this.seq))throw Error(`Sequence error: expected ${this.seq} got ${i/2>>>0} in ${s}`);if(this.messages.poll(),this.time=s.time,s.executeOn(this),++r>100&&(r=0,Date.now()>e))return!1}return this.time=t,!0}asQFunc(t,e){if("string"==typeof e)return e;if("function"==typeof e){if(t[e.name]===e)return e.name;let s=t;for(;null!==s;){for(const[t,r]of Object.entries(Object.getOwnPropertyDescriptors(s)))if(r.value===e)return t;s=Object.getPrototypeOf(s)}const r=/^\(?([a-z][a-z0-9]*)?\)? *=> *this\.([a-z][a-z0-9]*) *\( *([a-z][a-z0-9]*)? *\) *$/i,i=e.toString().match(r);return!i||i[3]&&i[3]!==i[1]?c(e):i[2]}return null}addSubscription(t,e,s,r){if(a!==this)throw Error("Island Error");const i=this.asQFunc(t,r);if("string"!=typeof i)throw Error(`Subscription handler for "${s}" must be a method name`);if("function"!=typeof t[i]&&"}"===!i[0])throw Error(`Subscriber method for "${s}" not found: ${t}.${i}()`);const o=e+":"+s,n=t.id+"."+i;if(this.subscriptions[o]){if(-1!==this.subscriptions[o].indexOf(n))throw Error(`${t}.${i} already subscribed to ${s}`)}else this.subscriptions[o]=[];this.subscriptions[o].push(n)}removeSubscription(t,e,s,r){if(a!==this)throw Error("Island Error");const i=e+":"+s,o=t.id+"."+r,n=this.subscriptions[i];if(n){const t=n.indexOf(o);n.splice(t,1),0===n.length&&delete this.subscriptions[i]}}removeAllSubscriptionsFor(t){const e=`${t.id}:`,s=`${t.id}.`;for(const[r,i]of Object.entries(this.subscriptions))if(r.startsWith(e))delete this.subscriptions[r];else{for(let t=i.length-1;t>=0;t--)i[t].startsWith(s)&&i.splice(t,1);0===i.size&&delete this.subscriptions[r]}}publishFromModel(t,e,s){if(a!==this)throw Error("Island Error");const r=e.endsWith(f);r&&(e=e.slice(0,e.length-f.length));const i=t+":"+e;this.handleModelEventInModel(i,s,r),this.handleModelEventInView(i,s)}publishFromView(t,e,s){if(a)throw Error("Island Error");const r=t+":"+e;this.handleViewEventInModel(r,s),this.handleViewEventInView(r,s)}handleModelEventInModel(t,e,r=!1){if(a!==this)throw Error("Island Error");if(r){const s=this.getNextTuttiSeq();if(!0!==this.controller.synced)return;const r=t+u,i=t+p,n=!!o.viewDomain.subscriptions[r],a=!!this.subscriptions[t],h=!!this.subscriptions[i];n&&h&&console.log(`divergence subscription for ${t} overridden by vote subscription`);const c=a?new v(this.time,0,this.id,"handleModelEventInModel",[t,e]):null;let l;l=n?[this.id,"handleModelEventInView",r]:[this.id,"handleTuttiDivergence",i],this.controller.sendTutti(this.time,s,e,c,n,l)}else if(this.subscriptions[t])for(const o of this.subscriptions[t]){const[r,...n]=o.split("."),a=n.join("."),h=this.lookUpModel(r);if(h){if("{"===a[0]){const r=l(a,h);try{r(e)}catch(i){(0,s.displayAppError)(`event ${t} ${h} ${r}`,i)}return}"function"!=typeof h[a]&&(0,s.displayWarning)(`event ${t} ${h}.${a}(): method not found`)}else(0,s.displayWarning)(`event ${t} .${a}(): subscriber not found`);try{h[a](e)}catch(i){(0,s.displayAppError)(`event ${t} ${h}.${a}()`,i)}}}handleViewEventInModel(t,e){if(this.subscriptions[t]){const s=new v(this.time,0,this.id,"handleModelEventInModel",[t,e]);this.controller.sendMessage(s)}}handleModelEventInView(t,e){o.viewDomain.handleEvent(t,e)}handleViewEventInView(t,e){o.viewDomain.handleEvent(t,e)}handleTuttiDivergence(t,e){if(this.subscriptions[t])this.handleModelEventInModel(t,e);else{const s=t.split(":").slice(-1)[0];console.warn(`uncaptured divergence in ${s}:`,e)}}processModelViewEvents(){if(a)throw Error("Island Error");return(0,i.inViewRealm)(this,()=>o.viewDomain.processFrameEvents(!!this.controller.synced))}pollForSnapshot(){this.controller.pollForSnapshot()}handleSnapshotVote(t,e){this.controller.handleSnapshotVote(e)}snapshot(){return new I(this).snapshot(this,"$")}getSummaryHash(){return(new M).getHash(this)}random(){if(a!==this)throw Error("Island Error");return this._random()}randomID(){if(a!==this)throw Error("Island Error");let t="";for(let e=0;e<4;e++)t+=(this._random.int32()>>>0).toString(16).padStart(8,"0");return t}}function y(t,e,s){if(s.length>0){s=(new A).encode(s)}return`${t}>${e}${s.length>0?JSON.stringify(s):""}`}function m(t,e){const[s,r,i]=t.match(/^([^[]+)(\[.*)?$/i),[o,n]=r.split(">");let a=[];if(i){a=new x(e).decode(JSON.parse(i))}return{receiver:o,selector:n,args:a}}function g(t,e){return t.match(new RegExp(`^${e}>`))}function $(t,e){return t.match(new RegExp(`>${e}\\b`))}function b(t,e,s){return t.match(new RegExp(`^${e}>${s}\\b`))}function E(t,e){return(e-t|0)>=0}exports.default=w;class v{static hasReceiver(t,e){return g(t[2],e)}static hasSelector(t,e){return $(t[2],e)}static hasReceiverAndSelector(t,e,s){return b(t[2],e,s)}constructor(t,e,s,r,i){this.time=t,this.seq=e,this.payload=y(s,r,i)}before(t){return this.time!==t.time?this.time<t.time:this.isExternal()!==t.isExternal()?t.isExternal():this.isExternal()?E(this.externalSeq,t.externalSeq):E(this.internalSeq,t.internalSeq)}hasReceiver(t){return g(this.payload,t)}hasSelector(t){return $(this.payload,t)}hasReceiverAndSelector(t,e){return b(this.payload,t,e)}isExternal(){return 1&this.seq}get externalSeq(){return this.seq/2>>>0}set externalSeq(t){this.seq=2*t+1}get internalSeq(){return this.seq/2>>>0}set internalSeq(t){this.seq=2*t}asState(){return[this.time,this.seq,this.payload]}static fromState(t){const[e,s,r]=t,{receiver:i,selector:o,args:n}=m(r);return new v(e,s,i,o,n)}executeOn(t){const{receiver:e,selector:r,args:o}=m(this.payload,t),n=t.lookUpModel(e);if(n)if("{"===r[0]){const e=l(r,n);d(t,()=>{(0,i.inModelRealm)(t,()=>{try{e(...o)}catch(t){(0,s.displayAppError)(`${this.shortString()} ${e}`,t)}})})}else"function"!=typeof n[r]?(0,s.displayWarning)(`${this.shortString()} ${n}.${r}(): method not found`):d(t,()=>{(0,i.inModelRealm)(t,()=>{try{n[r](...o)}catch(t){(0,s.displayAppError)(`${this.shortString()} ${n}.${r}()`,t)}})});else(0,s.displayWarning)(`${this.shortString()} ${r}(): receiver not found`)}shortString(){return`${this.isExternal()?"External":"Future"}Message`}toString(){const{receiver:t,selector:e,args:s}=m(this.payload),r=this.isExternal(),i=r?this.externalSeq:this.internalSeq;return`${r?"External":"Future"}Message[${this.time}${":#"[+r]}${i} ${t}.${e}(${s.map(JSON.stringify).join(", ")})]`}[Symbol.toPrimitive](){return this.toString()}}exports.Message=v;const S=(()=>{const t=new ArrayBuffer(8),e=new DataView(t);return t=>(e.setFloat64(0,t,!0),e.getInt32(0,!0)+e.getInt32(4,!0))})();class M{constructor(){this.refs=new Map,this.todo=[],this.hashers=new Map,this.addHasher("Teatime:Message",v);for(const[t,e]of r.default.allClassTypes())this.addHasher(t,e)}addHasher(t,e){const{cls:s,write:r}=Object.getPrototypeOf(e)===Object.prototype?e:{cls:e,write:t=>Object.assign({},t)};this.hashers.set(s,t=>this.hashStructure(t,r(t)))}getHash(t){this.hashState={oC:0,mC:0,nanC:0,infC:0,zC:0,nC:0,nH:0,sC:0,sL:0,fC:0};for(const[e,s]of Object.entries(t))if("controller"!==e&&"meta"!==e)if("_random"===e)this.hash(s.state(),!1);else if("messages"===e){const t=s.asArray();(this.hashState.fC=t.length)&&this.hash(t,!1)}else this.hashEntry(e,s);return this.hashDeferred(),this.hashState}hashDeferred(){for(;this.todo.length>0;){const{key:t,value:e}=this.todo.shift();this.hashEntry(t,e,!1)}}hash(t,e=!0){switch(typeof t){case"number":return void(Number.isNaN(t)?this.hashState.nanC++:Number.isFinite(t)?0===t?this.hashState.zC++:(this.hashState.nC++,this.hashState.nH+=S(t)):this.hashState.infC++);case"string":return this.hashState.sC++,void(this.hashState.sL+=t.length);case"boolean":case"undefined":return;default:{const s=Object.prototype.toString.call(t).slice(8,-1);switch(s){case"Array":return void this.hashArray(t,e);case"Set":case"Map":case"Uint8Array":case"Uint16Array":case"Float32Array":return void this.hashStructure(t,[...t]);case"Object":if(t instanceof r.default)this.hashModel(t);else if(t.constructor===Object)this.hashObject(t,e);else{const e=this.hashers.get(t.constructor);if(!e)throw Error(`Don't know how to hash ${t.constructor.name}`);e(t)}return;case"Null":return;default:throw Error(`Don't know how to hash ${s}`)}}}}hashModel(t){if(!this.refs.has(t)){this.hashState.mC++,this.refs.set(t,!0);for(const[e,s]of Object.entries(t))"__realm"!==e&&void 0!==s&&this.hashEntry(e,s)}}hashObject(t,e=!0){if(!this.refs.has(t)){this.hashState.oC++,this.refs.set(t,!0);for(const[s,r]of Object.entries(t))void 0!==r&&this.hashEntry(s,r,e)}}hashArray(t,e=!0){if(!this.refs.has(t)){this.refs.set(t,!0);for(let s=0;s<t.length;s++)this.hashEntry(s,t[s],e)}}hashStructure(t,e){void 0!==e&&(this.refs.has(t)||(this.refs.set(t,!0),this.hash(e,!1)))}hashEntry(t,e,s=!0){"$"!==t[0]?s&&"object"==typeof e?this.todo.push({key:t,value:e}):this.hash(e):console.warn(`ignoring property ${t}`)}}const O=new Float64Array(2),j=new Uint32Array(O.buffer);class I{constructor(t){this.island=t,this.nextRef=1,this.refs=new Map,this.todo=[],this.writers=new Map,this.addWriter("Teatime:Message",v);for(const[e,s]of r.default.allClassTypes())this.addWriter(e,s)}addWriter(t,e){const{cls:s,write:r}=Object.getPrototypeOf(e)===Object.prototype?e:{cls:e,write:t=>Object.assign({},t)};this.writers.set(s,(e,s)=>this.writeAs(t,e,r(e),s))}snapshot(t){const e={_random:t._random.state(),messages:this.write(t.messages.asArray())};for(const[s,r]of Object.entries(t))"controller"!==s&&(e[s]||this.writeInto(e,s,r,"$"));return this.writeDeferred(),e}writeDeferred(){for(;this.todo.length>0;){const{state:t,key:e,value:s,path:r}=this.todo.shift();this.writeInto(t,e,s,r,!1)}}write(t,e,s=!0){switch(typeof t){case"number":return Number.isSafeInteger(t)?t:Number.isNaN(t)?{$class:"NaN"}:Number.isFinite(t)?this.writeFloat(t):{$class:"Infinity",$value:Math.sign(t)};case"string":case"boolean":case"undefined":return t;default:{const i=Object.prototype.toString.call(t).slice(8,-1);switch(i){case"Array":return this.writeArray(t,e,s);case"Set":case"Map":case"Uint8Array":case"Uint16Array":case"Float32Array":return this.writeAs(i,t,[...t],e);case"Object":{if(t instanceof r.default)return this.writeModel(t,e);if(t.constructor===Object)return this.writeObject(t,e,s);const i=this.writers.get(t.constructor);if(i)return i(t,e);throw Error(`Don't know how to write ${t.constructor.name} at ${e}`)}case"Null":return t;default:throw Error(`Don't know how to write ${i} at ${e}`)}}}}writeModel(t,e){if(this.refs.has(t))return this.writeRef(t);const s={$model:r.default.classToID(t.constructor)};this.refs.set(t,s);for(const r of Object.keys(t).sort()){if("__realm"===r)continue;const i=t[r];void 0!==i&&this.writeInto(s,r,i,e)}return s}writeObject(t,e,s=!0){if(this.refs.has(t))return this.writeRef(t);const r={};this.refs.set(t,r);for(const i of Object.keys(t).sort()){const o=t[i];void 0!==o&&this.writeInto(r,i,o,e,s)}return r}writeArray(t,e,s=!0){if(this.refs.has(t))return this.writeRef(t);const r=[];this.refs.set(t,r);for(let i=0;i<t.length;i++)this.writeInto(r,i,t[i],e,s);return r}writeFloat(t){return t}writeAs(t,e,s,r){if(void 0===s)return s;if(this.refs.has(e))return this.writeRef(e);const i={$class:t};this.refs.set(e,i);const o=this.write(s,r,!1);return"object"!=typeof o||Array.isArray(o)?i.$value=o:Object.assign(i,o),i}writeRef(t){const e=this.refs.get(t);if("object"!=typeof e)throw Error("Non-object in refs: "+t);return Array.isArray(e)&&(e.toJSON=function(){return{$id:this.$id,$class:"Array",$value:[...this]}}),{$ref:e.$id||(e.$id=this.nextRef++)}}writeInto(t,e,s,r,i=!0){if("$"===e[0])return void console.warn(`ignoring property ${r}`);if(i&&"object"==typeof s)return void this.todo.push({state:t,key:e,value:s,path:r});const o=r+("string"==typeof e&&e.match(/^[_a-z][_a-z0-9]*$/i)?`.${e}`:`[${JSON.stringify(e)}]`),n=this.write(s,o);void 0!==n&&(t[e]=n)}}class q{constructor(t){this.island=t,this.refs=new Map,this.todo=[],this.unresolved=[],this.readers=new Map,this.addReader("Teatime:Message",v);for(const[e,s]of r.default.allClassTypes())this.addReader(e,s);this.readers.set("NaN",()=>NaN),this.readers.set("Infinity",t=>t*(1/0)),this.readers.set("Set",t=>new Set(t)),this.readers.set("Map",t=>new Map(t)),this.readers.set("Array",t=>t.slice(0)),this.readers.set("Uint8Array",t=>new Uint8Array(t)),this.readers.set("Uint16Array",t=>new Uint16Array(t)),this.readers.set("Float32Array",t=>new Float32Array(t))}addReader(t,e){const s="object"==typeof e?e.read:t=>Object.assign(Object.create(e.prototype),t);this.readers.set(t,s)}readIsland(e,s){if("$"!==s)throw Error("Island must be root object");const r={_random:new t.default(null,{state:e._random})};for(const[t,i]of Object.entries(e))r[t]||this.readInto(r,t,i,s);return this.readDeferred(),this.resolveRefs(),r}readDeferred(){for(;this.todo.length>0;){const{object:t,key:e,value:s,path:r}=this.todo.shift();this.readInto(t,e,s,r,1)}}resolveRefs(){for(const{object:t,key:e,ref:s,path:r}of this.unresolved){if(!this.refs.has(s))throw Error(`Unresolved ref: ${s} at ${r}[${JSON.stringify(e)}]`);t[e]=this.refs.get(s)}}read(t,e,s=0){switch(typeof t){case"number":case"string":case"boolean":return t;default:{const r=Object.prototype.toString.call(t).slice(8,-1);switch(r){case"Array":return this.readArray(t,e,s);case"Null":return null;case"Object":{const{$class:r,$model:i,$ref:o}=t;if(o)throw Error("refs should have been handled in readInto()");return i?this.readModel(t,e):r?this.readAs(r,t,e):this.readObject(Object,t,e,s)}default:throw Error(`Don't know how to read ${r} at ${e}`)}}}}readModel(t,e){const s=r.default.instantiateClassID(t.$model,t.id);t.$id&&this.refs.set(t.$id,s);for(const[r,i]of Object.entries(t))"id"!==r&&"$"!==r[0]&&this.readInto(s,r,i,e);return s}readObject(t,e,s,r=0){const i=new t;e.$id&&this.refs.set(e.$id,i);for(const[o,n]of Object.entries(e))"$"!==o[0]&&this.readInto(i,o,n,s,r);return i}readArray(t,e,s=0){const r=[];t.$id&&this.refs.set(t.$id,r);for(let i=0;i<t.length;i++)void 0!==t[i]&&this.readInto(r,i,t[i],e,s);return r}readAs(t,e,s){let r={};const i=new Map;if("$value"in e)r=this.read(e.$value,s,2);else for(const[n,a]of Object.entries(e)){if("$"===n[0])continue;const t=a&&a.$ref;t?this.refs.has(t)?r[n]=this.refs.get(t):(r[n]="placeholder",i.set(t,n)):this.readInto(r,n,a,s,1)}const o=this.readers.get(t)(r,s);e.$id&&this.refs.set(e.$id,o);for(const[n,a]of i.entries())this.unresolved.push({object:o,key:a,ref:n,path:s});return o}readRef(t,e,s,r){if(!s||!s.$ref)return!1;const i=s.$ref;return this.refs.has(i)?t[e]=this.refs.get(i):(t[e]="placeholder",this.unresolved.push({object:t,key:e,ref:i,path:r})),!0}readInto(t,e,s,r,i=0){if(this.readRef(t,e,s,r))return;if(0===i&&"object"==typeof s)return void this.todo.push({object:t,key:e,value:s,path:r});const o=r+("string"==typeof e&&e.match(/^[_a-z][_a-z0-9]*$/i)?`.${e}`:`[${JSON.stringify(e)}]`);t[e]=this.read(s,o,i>0?i-1:0)}}class A extends I{encode(t){const e=this.writeArray(t,"$");return this.writeDeferred(),e}writeModel(t){return{$ref:t.id}}}class x extends q{decode(t){const e=this.readArray(t,"$");return this.readDeferred(),e}resolveRefs(){for(const{object:t,key:e,ref:s,path:r}of this.unresolved)if(this.refs.has(s))t[e]=this.refs.get(s);else{const i=this.island.lookUp(s);if(!i)throw Error(`Unresolved ref: ${s} at ${r}[${JSON.stringify(e)}]`);t[e]=i}}}function N(t,e){const s={};return R({root:t},e,s,new Set),s}function R(t,e="",s={},r=new Set){const i=Object.values(t).filter(t=>{const e=Object.prototype.toString.call(t).slice(8,-1);return("Object"===e||"Array"===e)&&!r.has(t)});for(const o of i){r.add(o);const t=e+"."+o.constructor.name;if(s[t]){if(s[t]!==o.constructor)throw new Error("Class with name "+t+" already gathered, but new one has different identity")}else s[t]=o.constructor}for(const o of i)R(o,e,s,r)}
},{"seedrandom/seedrandom":"J1zm","@croquet/util/priorityQueue":"XDZa","@croquet/math":"ypWm","@croquet/util/html":"vYkp","./model":"QjFl","./realms":"QEgO","./domain":"IfYm"}],"ReEi":[function(require,module,exports) {
"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function t(r,t){return Object.prototype.hasOwnProperty.call(r,t)}exports.assign=function(r){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var a in n)t(n,a)&&(r[a]=n[a])}}return r},exports.shrinkBuf=function(r,t){return r.length===t?r:r.subarray?r.subarray(0,t):(r.length=t,r)};var e={arraySet:function(r,t,e,n,a){if(t.subarray&&r.subarray)r.set(t.subarray(e,e+n),a);else for(var o=0;o<n;o++)r[a+o]=t[e+o]},flattenChunks:function(r){var t,e,n,a,o,s;for(n=0,t=0,e=r.length;t<e;t++)n+=r[t].length;for(s=new Uint8Array(n),a=0,t=0,e=r.length;t<e;t++)o=r[t],s.set(o,a),a+=o.length;return s}},n={arraySet:function(r,t,e,n,a){for(var o=0;o<n;o++)r[a+o]=t[e+o]},flattenChunks:function(r){return[].concat.apply([],r)}};exports.setTyped=function(r){r?(exports.Buf8=Uint8Array,exports.Buf16=Uint16Array,exports.Buf32=Int32Array,exports.assign(exports,e)):(exports.Buf8=Array,exports.Buf16=Array,exports.Buf32=Array,exports.assign(exports,n))},exports.setTyped(r);
},{}],"RJ6c":[function(require,module,exports) {
"use strict";var e=require("../utils/common"),t=4,n=0,_=1,r=2;function a(e){for(var t=e.length;--t>=0;)e[t]=0}var i=0,l=1,d=2,f=3,o=258,b=29,s=256,u=s+1+b,c=30,p=19,h=2*u+1,v=15,y=16,x=7,g=256,m=16,w=17,A=18,k=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],q=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],z=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],S=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],j=512,B=new Array(2*(u+2));a(B);var C=new Array(2*c);a(C);var D=new Array(j);a(D);var E=new Array(o-f+1);a(E);var F=new Array(b);a(F);var G,H,I,J=new Array(c);function K(e,t,n,_,r){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=_,this.max_length=r,this.has_stree=e&&e.length}function L(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function M(e){return e<256?D[e]:D[256+(e>>>7)]}function N(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function O(e,t,n){e.bi_valid>y-n?(e.bi_buf|=t<<e.bi_valid&65535,N(e,e.bi_buf),e.bi_buf=t>>y-e.bi_valid,e.bi_valid+=n-y):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function P(e,t,n){O(e,n[2*t],n[2*t+1])}function Q(e,t){var n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1}function R(e){16===e.bi_valid?(N(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}function T(e,t){var n,_,r,a,i,l,d=t.dyn_tree,f=t.max_code,o=t.stat_desc.static_tree,b=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,u=t.stat_desc.extra_base,c=t.stat_desc.max_length,p=0;for(a=0;a<=v;a++)e.bl_count[a]=0;for(d[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n<h;n++)(a=d[2*d[2*(_=e.heap[n])+1]+1]+1)>c&&(a=c,p++),d[2*_+1]=a,_>f||(e.bl_count[a]++,i=0,_>=u&&(i=s[_-u]),l=d[2*_],e.opt_len+=l*(a+i),b&&(e.static_len+=l*(o[2*_+1]+i)));if(0!==p){do{for(a=c-1;0===e.bl_count[a];)a--;e.bl_count[a]--,e.bl_count[a+1]+=2,e.bl_count[c]--,p-=2}while(p>0);for(a=c;0!==a;a--)for(_=e.bl_count[a];0!==_;)(r=e.heap[--n])>f||(d[2*r+1]!==a&&(e.opt_len+=(a-d[2*r+1])*d[2*r],d[2*r+1]=a),_--)}}function U(e,t,n){var _,r,a=new Array(v+1),i=0;for(_=1;_<=v;_++)a[_]=i=i+n[_-1]<<1;for(r=0;r<=t;r++){var l=e[2*r+1];0!==l&&(e[2*r]=Q(a[l]++,l))}}function V(){var e,t,n,_,r,a=new Array(v+1);for(n=0,_=0;_<b-1;_++)for(F[_]=n,e=0;e<1<<k[_];e++)E[n++]=_;for(E[n-1]=_,r=0,_=0;_<16;_++)for(J[_]=r,e=0;e<1<<q[_];e++)D[r++]=_;for(r>>=7;_<c;_++)for(J[_]=r<<7,e=0;e<1<<q[_]-7;e++)D[256+r++]=_;for(t=0;t<=v;t++)a[t]=0;for(e=0;e<=143;)B[2*e+1]=8,e++,a[8]++;for(;e<=255;)B[2*e+1]=9,e++,a[9]++;for(;e<=279;)B[2*e+1]=7,e++,a[7]++;for(;e<=287;)B[2*e+1]=8,e++,a[8]++;for(U(B,u+1,a),e=0;e<c;e++)C[2*e+1]=5,C[2*e]=Q(e,5);G=new K(B,k,s+1,u,v),H=new K(C,q,0,c,v),I=new K(new Array(0),z,0,p,x)}function W(e){var t;for(t=0;t<u;t++)e.dyn_ltree[2*t]=0;for(t=0;t<c;t++)e.dyn_dtree[2*t]=0;for(t=0;t<p;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*g]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function X(e){e.bi_valid>8?N(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function Y(t,n,_,r){X(t),r&&(N(t,_),N(t,~_)),e.arraySet(t.pending_buf,t.window,n,_,t.pending),t.pending+=_}function Z(e,t,n,_){var r=2*t,a=2*n;return e[r]<e[a]||e[r]===e[a]&&_[t]<=_[n]}function $(e,t,n){for(var _=e.heap[n],r=n<<1;r<=e.heap_len&&(r<e.heap_len&&Z(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!Z(t,_,e.heap[r],e.depth));)e.heap[n]=e.heap[r],n=r,r<<=1;e.heap[n]=_}function ee(e,t,n){var _,r,a,i,l=0;if(0!==e.last_lit)do{_=e.pending_buf[e.d_buf+2*l]<<8|e.pending_buf[e.d_buf+2*l+1],r=e.pending_buf[e.l_buf+l],l++,0===_?P(e,r,t):(P(e,(a=E[r])+s+1,t),0!==(i=k[a])&&O(e,r-=F[a],i),P(e,a=M(--_),n),0!==(i=q[a])&&O(e,_-=J[a],i))}while(l<e.last_lit);P(e,g,t)}function te(e,t){var n,_,r,a=t.dyn_tree,i=t.stat_desc.static_tree,l=t.stat_desc.has_stree,d=t.stat_desc.elems,f=-1;for(e.heap_len=0,e.heap_max=h,n=0;n<d;n++)0!==a[2*n]?(e.heap[++e.heap_len]=f=n,e.depth[n]=0):a[2*n+1]=0;for(;e.heap_len<2;)a[2*(r=e.heap[++e.heap_len]=f<2?++f:0)]=1,e.depth[r]=0,e.opt_len--,l&&(e.static_len-=i[2*r+1]);for(t.max_code=f,n=e.heap_len>>1;n>=1;n--)$(e,a,n);r=d;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],$(e,a,1),_=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=_,a[2*r]=a[2*n]+a[2*_],e.depth[r]=(e.depth[n]>=e.depth[_]?e.depth[n]:e.depth[_])+1,a[2*n+1]=a[2*_+1]=r,e.heap[1]=r++,$(e,a,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],T(e,t),U(a,f,e.bl_count)}function ne(e,t,n){var _,r,a=-1,i=t[1],l=0,d=7,f=4;for(0===i&&(d=138,f=3),t[2*(n+1)+1]=65535,_=0;_<=n;_++)r=i,i=t[2*(_+1)+1],++l<d&&r===i||(l<f?e.bl_tree[2*r]+=l:0!==r?(r!==a&&e.bl_tree[2*r]++,e.bl_tree[2*m]++):l<=10?e.bl_tree[2*w]++:e.bl_tree[2*A]++,l=0,a=r,0===i?(d=138,f=3):r===i?(d=6,f=3):(d=7,f=4))}function _e(e,t,n){var _,r,a=-1,i=t[1],l=0,d=7,f=4;for(0===i&&(d=138,f=3),_=0;_<=n;_++)if(r=i,i=t[2*(_+1)+1],!(++l<d&&r===i)){if(l<f)do{P(e,r,e.bl_tree)}while(0!=--l);else 0!==r?(r!==a&&(P(e,r,e.bl_tree),l--),P(e,m,e.bl_tree),O(e,l-3,2)):l<=10?(P(e,w,e.bl_tree),O(e,l-3,3)):(P(e,A,e.bl_tree),O(e,l-11,7));l=0,a=r,0===i?(d=138,f=3):r===i?(d=6,f=3):(d=7,f=4)}}function re(e){var t;for(ne(e,e.dyn_ltree,e.l_desc.max_code),ne(e,e.dyn_dtree,e.d_desc.max_code),te(e,e.bl_desc),t=p-1;t>=3&&0===e.bl_tree[2*S[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}function ae(e,t,n,_){var r;for(O(e,t-257,5),O(e,n-1,5),O(e,_-4,4),r=0;r<_;r++)O(e,e.bl_tree[2*S[r]+1],3);_e(e,e.dyn_ltree,t-1),_e(e,e.dyn_dtree,n-1)}function ie(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return n;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return _;for(t=32;t<s;t++)if(0!==e.dyn_ltree[2*t])return _;return n}a(J);var le=!1;function de(e){le||(V(),le=!0),e.l_desc=new L(e.dyn_ltree,G),e.d_desc=new L(e.dyn_dtree,H),e.bl_desc=new L(e.bl_tree,I),e.bi_buf=0,e.bi_valid=0,W(e)}function fe(e,t,n,_){O(e,(i<<1)+(_?1:0),3),Y(e,t,n,!0)}function oe(e){O(e,l<<1,3),P(e,g,B),R(e)}function be(e,n,_,a){var i,f,o=0;e.level>0?(e.strm.data_type===r&&(e.strm.data_type=ie(e)),te(e,e.l_desc),te(e,e.d_desc),o=re(e),i=e.opt_len+3+7>>>3,(f=e.static_len+3+7>>>3)<=i&&(i=f)):i=f=_+5,_+4<=i&&-1!==n?fe(e,n,_,a):e.strategy===t||f===i?(O(e,(l<<1)+(a?1:0),3),ee(e,B,C)):(O(e,(d<<1)+(a?1:0),3),ae(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),ee(e,e.dyn_ltree,e.dyn_dtree)),W(e),a&&X(e)}function se(e,t,n){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(E[n]+s+1)]++,e.dyn_dtree[2*M(t)]++),e.last_lit===e.lit_bufsize-1}exports._tr_init=de,exports._tr_stored_block=fe,exports._tr_flush_block=be,exports._tr_tally=se,exports._tr_align=oe;
},{"../utils/common":"ReEi"}],"dbjK":[function(require,module,exports) {
"use strict";function e(e,r,o,t){for(var u=65535&e|0,i=e>>>16&65535|0,n=0;0!==o;){o-=n=o>2e3?2e3:o;do{i=i+(u=u+r[t++]|0)|0}while(--n);u%=65521,i%=65521}return u|i<<16|0}module.exports=e;
},{}],"bDh6":[function(require,module,exports) {
"use strict";function r(){for(var r,o=[],t=0;t<256;t++){r=t;for(var n=0;n<8;n++)r=1&r?3988292384^r>>>1:r>>>1;o[t]=r}return o}var o=r();function t(r,t,n,u){var a=o,e=u+n;r^=-1;for(var f=u;f<e;f++)r=r>>>8^a[255&(r^t[f])];return-1^r}module.exports=t;
},{}],"dGd5":[function(require,module,exports) {
"use strict";module.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};
},{}],"AS18":[function(require,module,exports) {
"use strict";var t,a=require("../utils/common"),e=require("./trees"),s=require("./adler32"),i=require("./crc32"),r=require("./messages"),n=0,h=1,l=3,_=4,d=5,o=0,u=1,g=-2,f=-3,c=-5,p=-1,m=1,w=2,v=3,k=4,z=0,b=2,x=8,y=9,B=15,S=8,q=29,I=256,A=I+1+q,C=30,R=19,j=2*A+1,D=15,E=3,H=258,K=H+E+1,N=32,F=42,G=69,J=73,L=91,M=103,O=113,P=666,Q=1,T=2,U=3,V=4,W=3;function X(t,a){return t.msg=r[a],a}function Y(t){return(t<<1)-(t>4?9:0)}function Z(t){for(var a=t.length;--a>=0;)t[a]=0}function $(t){var e=t.state,s=e.pending;s>t.avail_out&&(s=t.avail_out),0!==s&&(a.arraySet(t.output,e.pending_buf,e.pending_out,s,t.next_out),t.next_out+=s,e.pending_out+=s,t.total_out+=s,t.avail_out-=s,e.pending-=s,0===e.pending&&(e.pending_out=0))}function tt(t,a){e._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,a),t.block_start=t.strstart,$(t.strm)}function at(t,a){t.pending_buf[t.pending++]=a}function et(t,a){t.pending_buf[t.pending++]=a>>>8&255,t.pending_buf[t.pending++]=255&a}function st(t,e,r,n){var h=t.avail_in;return h>n&&(h=n),0===h?0:(t.avail_in-=h,a.arraySet(e,t.input,t.next_in,h,r),1===t.state.wrap?t.adler=s(t.adler,e,h,r):2===t.state.wrap&&(t.adler=i(t.adler,e,h,r)),t.next_in+=h,t.total_in+=h,h)}function it(t,a){var e,s,i=t.max_chain_length,r=t.strstart,n=t.prev_length,h=t.nice_match,l=t.strstart>t.w_size-K?t.strstart-(t.w_size-K):0,_=t.window,d=t.w_mask,o=t.prev,u=t.strstart+H,g=_[r+n-1],f=_[r+n];t.prev_length>=t.good_match&&(i>>=2),h>t.lookahead&&(h=t.lookahead);do{if(_[(e=a)+n]===f&&_[e+n-1]===g&&_[e]===_[r]&&_[++e]===_[r+1]){r+=2,e++;do{}while(_[++r]===_[++e]&&_[++r]===_[++e]&&_[++r]===_[++e]&&_[++r]===_[++e]&&_[++r]===_[++e]&&_[++r]===_[++e]&&_[++r]===_[++e]&&_[++r]===_[++e]&&r<u);if(s=H-(u-r),r=u-H,s>n){if(t.match_start=a,n=s,s>=h)break;g=_[r+n-1],f=_[r+n]}}}while((a=o[a&d])>l&&0!=--i);return n<=t.lookahead?n:t.lookahead}function rt(t){var e,s,i,r,n,h=t.w_size;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=h+(h-K)){a.arraySet(t.window,t.window,h,h,0),t.match_start-=h,t.strstart-=h,t.block_start-=h,e=s=t.hash_size;do{i=t.head[--e],t.head[e]=i>=h?i-h:0}while(--s);e=s=h;do{i=t.prev[--e],t.prev[e]=i>=h?i-h:0}while(--s);r+=h}if(0===t.strm.avail_in)break;if(s=st(t.strm,t.window,t.strstart+t.lookahead,r),t.lookahead+=s,t.lookahead+t.insert>=E)for(n=t.strstart-t.insert,t.ins_h=t.window[n],t.ins_h=(t.ins_h<<t.hash_shift^t.window[n+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[n+E-1])&t.hash_mask,t.prev[n&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=n,n++,t.insert--,!(t.lookahead+t.insert<E)););}while(t.lookahead<K&&0!==t.strm.avail_in)}function nt(t,a){var e=65535;for(e>t.pending_buf_size-5&&(e=t.pending_buf_size-5);;){if(t.lookahead<=1){if(rt(t),0===t.lookahead&&a===n)return Q;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var s=t.block_start+e;if((0===t.strstart||t.strstart>=s)&&(t.lookahead=t.strstart-s,t.strstart=s,tt(t,!1),0===t.strm.avail_out))return Q;if(t.strstart-t.block_start>=t.w_size-K&&(tt(t,!1),0===t.strm.avail_out))return Q}return t.insert=0,a===_?(tt(t,!0),0===t.strm.avail_out?U:V):(t.strstart>t.block_start&&(tt(t,!1),t.strm.avail_out),Q)}function ht(t,a){for(var s,i;;){if(t.lookahead<K){if(rt(t),t.lookahead<K&&a===n)return Q;if(0===t.lookahead)break}if(s=0,t.lookahead>=E&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+E-1])&t.hash_mask,s=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==s&&t.strstart-s<=t.w_size-K&&(t.match_length=it(t,s)),t.match_length>=E)if(i=e._tr_tally(t,t.strstart-t.match_start,t.match_length-E),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=E){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+E-1])&t.hash_mask,s=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else i=e._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(tt(t,!1),0===t.strm.avail_out))return Q}return t.insert=t.strstart<E-1?t.strstart:E-1,a===_?(tt(t,!0),0===t.strm.avail_out?U:V):t.last_lit&&(tt(t,!1),0===t.strm.avail_out)?Q:T}function lt(t,a){for(var s,i,r;;){if(t.lookahead<K){if(rt(t),t.lookahead<K&&a===n)return Q;if(0===t.lookahead)break}if(s=0,t.lookahead>=E&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+E-1])&t.hash_mask,s=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=E-1,0!==s&&t.prev_length<t.max_lazy_match&&t.strstart-s<=t.w_size-K&&(t.match_length=it(t,s),t.match_length<=5&&(t.strategy===m||t.match_length===E&&t.strstart-t.match_start>4096)&&(t.match_length=E-1)),t.prev_length>=E&&t.match_length<=t.prev_length){r=t.strstart+t.lookahead-E,i=e._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-E),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=r&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+E-1])&t.hash_mask,s=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=E-1,t.strstart++,i&&(tt(t,!1),0===t.strm.avail_out))return Q}else if(t.match_available){if((i=e._tr_tally(t,0,t.window[t.strstart-1]))&&tt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return Q}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=e._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<E-1?t.strstart:E-1,a===_?(tt(t,!0),0===t.strm.avail_out?U:V):t.last_lit&&(tt(t,!1),0===t.strm.avail_out)?Q:T}function _t(t,a){for(var s,i,r,h,l=t.window;;){if(t.lookahead<=H){if(rt(t),t.lookahead<=H&&a===n)return Q;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=E&&t.strstart>0&&(i=l[r=t.strstart-1])===l[++r]&&i===l[++r]&&i===l[++r]){h=t.strstart+H;do{}while(i===l[++r]&&i===l[++r]&&i===l[++r]&&i===l[++r]&&i===l[++r]&&i===l[++r]&&i===l[++r]&&i===l[++r]&&r<h);t.match_length=H-(h-r),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=E?(s=e._tr_tally(t,1,t.match_length-E),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(s=e._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),s&&(tt(t,!1),0===t.strm.avail_out))return Q}return t.insert=0,a===_?(tt(t,!0),0===t.strm.avail_out?U:V):t.last_lit&&(tt(t,!1),0===t.strm.avail_out)?Q:T}function dt(t,a){for(var s;;){if(0===t.lookahead&&(rt(t),0===t.lookahead)){if(a===n)return Q;break}if(t.match_length=0,s=e._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,s&&(tt(t,!1),0===t.strm.avail_out))return Q}return t.insert=0,a===_?(tt(t,!0),0===t.strm.avail_out?U:V):t.last_lit&&(tt(t,!1),0===t.strm.avail_out)?Q:T}function ot(t,a,e,s,i){this.good_length=t,this.max_lazy=a,this.nice_length=e,this.max_chain=s,this.func=i}function ut(a){a.window_size=2*a.w_size,Z(a.head),a.max_lazy_match=t[a.level].max_lazy,a.good_match=t[a.level].good_length,a.nice_match=t[a.level].nice_length,a.max_chain_length=t[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=E-1,a.match_available=0,a.ins_h=0}function gt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=x,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new a.Buf16(2*j),this.dyn_dtree=new a.Buf16(2*(2*C+1)),this.bl_tree=new a.Buf16(2*(2*R+1)),Z(this.dyn_ltree),Z(this.dyn_dtree),Z(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new a.Buf16(D+1),this.heap=new a.Buf16(2*A+1),Z(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new a.Buf16(2*A+1),Z(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function ft(t){var a;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=b,(a=t.state).pending=0,a.pending_out=0,a.wrap<0&&(a.wrap=-a.wrap),a.status=a.wrap?F:O,t.adler=2===a.wrap?0:1,a.last_flush=n,e._tr_init(a),o):X(t,g)}function ct(t){var a=ft(t);return a===o&&ut(t.state),a}function pt(t,a){return t&&t.state?2!==t.state.wrap?g:(t.state.gzhead=a,o):g}function mt(t,e,s,i,r,n){if(!t)return g;var h=1;if(e===p&&(e=6),i<0?(h=0,i=-i):i>15&&(h=2,i-=16),r<1||r>y||s!==x||i<8||i>15||e<0||e>9||n<0||n>k)return X(t,g);8===i&&(i=9);var l=new gt;return t.state=l,l.strm=t,l.wrap=h,l.gzhead=null,l.w_bits=i,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=r+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+E-1)/E),l.window=new a.Buf8(2*l.w_size),l.head=new a.Buf16(l.hash_size),l.prev=new a.Buf16(l.w_size),l.lit_bufsize=1<<r+6,l.pending_buf_size=4*l.lit_bufsize,l.pending_buf=new a.Buf8(l.pending_buf_size),l.d_buf=1*l.lit_bufsize,l.l_buf=3*l.lit_bufsize,l.level=e,l.strategy=n,l.method=s,ct(t)}function wt(t,a){return mt(t,a,x,B,S,z)}function vt(a,s){var r,f,p,m;if(!a||!a.state||s>d||s<0)return a?X(a,g):g;if(f=a.state,!a.output||!a.input&&0!==a.avail_in||f.status===P&&s!==_)return X(a,0===a.avail_out?c:g);if(f.strm=a,r=f.last_flush,f.last_flush=s,f.status===F)if(2===f.wrap)a.adler=0,at(f,31),at(f,139),at(f,8),f.gzhead?(at(f,(f.gzhead.text?1:0)+(f.gzhead.hcrc?2:0)+(f.gzhead.extra?4:0)+(f.gzhead.name?8:0)+(f.gzhead.comment?16:0)),at(f,255&f.gzhead.time),at(f,f.gzhead.time>>8&255),at(f,f.gzhead.time>>16&255),at(f,f.gzhead.time>>24&255),at(f,9===f.level?2:f.strategy>=w||f.level<2?4:0),at(f,255&f.gzhead.os),f.gzhead.extra&&f.gzhead.extra.length&&(at(f,255&f.gzhead.extra.length),at(f,f.gzhead.extra.length>>8&255)),f.gzhead.hcrc&&(a.adler=i(a.adler,f.pending_buf,f.pending,0)),f.gzindex=0,f.status=G):(at(f,0),at(f,0),at(f,0),at(f,0),at(f,0),at(f,9===f.level?2:f.strategy>=w||f.level<2?4:0),at(f,W),f.status=O);else{var k=x+(f.w_bits-8<<4)<<8;k|=(f.strategy>=w||f.level<2?0:f.level<6?1:6===f.level?2:3)<<6,0!==f.strstart&&(k|=N),k+=31-k%31,f.status=O,et(f,k),0!==f.strstart&&(et(f,a.adler>>>16),et(f,65535&a.adler)),a.adler=1}if(f.status===G)if(f.gzhead.extra){for(p=f.pending;f.gzindex<(65535&f.gzhead.extra.length)&&(f.pending!==f.pending_buf_size||(f.gzhead.hcrc&&f.pending>p&&(a.adler=i(a.adler,f.pending_buf,f.pending-p,p)),$(a),p=f.pending,f.pending!==f.pending_buf_size));)at(f,255&f.gzhead.extra[f.gzindex]),f.gzindex++;f.gzhead.hcrc&&f.pending>p&&(a.adler=i(a.adler,f.pending_buf,f.pending-p,p)),f.gzindex===f.gzhead.extra.length&&(f.gzindex=0,f.status=J)}else f.status=J;if(f.status===J)if(f.gzhead.name){p=f.pending;do{if(f.pending===f.pending_buf_size&&(f.gzhead.hcrc&&f.pending>p&&(a.adler=i(a.adler,f.pending_buf,f.pending-p,p)),$(a),p=f.pending,f.pending===f.pending_buf_size)){m=1;break}m=f.gzindex<f.gzhead.name.length?255&f.gzhead.name.charCodeAt(f.gzindex++):0,at(f,m)}while(0!==m);f.gzhead.hcrc&&f.pending>p&&(a.adler=i(a.adler,f.pending_buf,f.pending-p,p)),0===m&&(f.gzindex=0,f.status=L)}else f.status=L;if(f.status===L)if(f.gzhead.comment){p=f.pending;do{if(f.pending===f.pending_buf_size&&(f.gzhead.hcrc&&f.pending>p&&(a.adler=i(a.adler,f.pending_buf,f.pending-p,p)),$(a),p=f.pending,f.pending===f.pending_buf_size)){m=1;break}m=f.gzindex<f.gzhead.comment.length?255&f.gzhead.comment.charCodeAt(f.gzindex++):0,at(f,m)}while(0!==m);f.gzhead.hcrc&&f.pending>p&&(a.adler=i(a.adler,f.pending_buf,f.pending-p,p)),0===m&&(f.status=M)}else f.status=M;if(f.status===M&&(f.gzhead.hcrc?(f.pending+2>f.pending_buf_size&&$(a),f.pending+2<=f.pending_buf_size&&(at(f,255&a.adler),at(f,a.adler>>8&255),a.adler=0,f.status=O)):f.status=O),0!==f.pending){if($(a),0===a.avail_out)return f.last_flush=-1,o}else if(0===a.avail_in&&Y(s)<=Y(r)&&s!==_)return X(a,c);if(f.status===P&&0!==a.avail_in)return X(a,c);if(0!==a.avail_in||0!==f.lookahead||s!==n&&f.status!==P){var z=f.strategy===w?dt(f,s):f.strategy===v?_t(f,s):t[f.level].func(f,s);if(z!==U&&z!==V||(f.status=P),z===Q||z===U)return 0===a.avail_out&&(f.last_flush=-1),o;if(z===T&&(s===h?e._tr_align(f):s!==d&&(e._tr_stored_block(f,0,0,!1),s===l&&(Z(f.head),0===f.lookahead&&(f.strstart=0,f.block_start=0,f.insert=0))),$(a),0===a.avail_out))return f.last_flush=-1,o}return s!==_?o:f.wrap<=0?u:(2===f.wrap?(at(f,255&a.adler),at(f,a.adler>>8&255),at(f,a.adler>>16&255),at(f,a.adler>>24&255),at(f,255&a.total_in),at(f,a.total_in>>8&255),at(f,a.total_in>>16&255),at(f,a.total_in>>24&255)):(et(f,a.adler>>>16),et(f,65535&a.adler)),$(a),f.wrap>0&&(f.wrap=-f.wrap),0!==f.pending?o:u)}function kt(t){var a;return t&&t.state?(a=t.state.status)!==F&&a!==G&&a!==J&&a!==L&&a!==M&&a!==O&&a!==P?X(t,g):(t.state=null,a===O?X(t,f):o):g}function zt(t,e){var i,r,n,h,l,_,d,u,f=e.length;if(!t||!t.state)return g;if(2===(h=(i=t.state).wrap)||1===h&&i.status!==F||i.lookahead)return g;for(1===h&&(t.adler=s(t.adler,e,f,0)),i.wrap=0,f>=i.w_size&&(0===h&&(Z(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new a.Buf8(i.w_size),a.arraySet(u,e,f-i.w_size,i.w_size,0),e=u,f=i.w_size),l=t.avail_in,_=t.next_in,d=t.input,t.avail_in=f,t.next_in=0,t.input=e,rt(i);i.lookahead>=E;){r=i.strstart,n=i.lookahead-(E-1);do{i.ins_h=(i.ins_h<<i.hash_shift^i.window[r+E-1])&i.hash_mask,i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++}while(--n);i.strstart=r,i.lookahead=E-1,rt(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=E-1,i.match_available=0,t.next_in=_,t.input=d,t.avail_in=l,i.wrap=h,o}t=[new ot(0,0,0,0,nt),new ot(4,4,8,4,ht),new ot(4,5,16,8,ht),new ot(4,6,32,32,ht),new ot(4,4,16,16,lt),new ot(8,16,32,32,lt),new ot(8,16,128,128,lt),new ot(8,32,128,256,lt),new ot(32,128,258,1024,lt),new ot(32,258,258,4096,lt)],exports.deflateInit=wt,exports.deflateInit2=mt,exports.deflateReset=ct,exports.deflateResetKeep=ft,exports.deflateSetHeader=pt,exports.deflate=vt,exports.deflateEnd=kt,exports.deflateSetDictionary=zt,exports.deflateInfo="pako deflate (from Nodeca project)";
},{"../utils/common":"ReEi","./trees":"RJ6c","./adler32":"dbjK","./crc32":"bDh6","./messages":"dGd5"}],"soZx":[function(require,module,exports) {
"use strict";var r=require("./common"),n=!0,t=!0;try{String.fromCharCode.apply(null,[0])}catch(u){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(u){t=!1}for(var e=new r.Buf8(256),o=0;o<256;o++)e[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;function f(e,o){if(o<65534&&(e.subarray&&t||!e.subarray&&n))return String.fromCharCode.apply(null,r.shrinkBuf(e,o));for(var f="",u=0;u<o;u++)f+=String.fromCharCode(e[u]);return f}e[254]=e[254]=1,exports.string2buf=function(n){var t,e,o,f,u,a=n.length,i=0;for(f=0;f<a;f++)55296==(64512&(e=n.charCodeAt(f)))&&f+1<a&&56320==(64512&(o=n.charCodeAt(f+1)))&&(e=65536+(e-55296<<10)+(o-56320),f++),i+=e<128?1:e<2048?2:e<65536?3:4;for(t=new r.Buf8(i),u=0,f=0;u<i;f++)55296==(64512&(e=n.charCodeAt(f)))&&f+1<a&&56320==(64512&(o=n.charCodeAt(f+1)))&&(e=65536+(e-55296<<10)+(o-56320),f++),e<128?t[u++]=e:e<2048?(t[u++]=192|e>>>6,t[u++]=128|63&e):e<65536?(t[u++]=224|e>>>12,t[u++]=128|e>>>6&63,t[u++]=128|63&e):(t[u++]=240|e>>>18,t[u++]=128|e>>>12&63,t[u++]=128|e>>>6&63,t[u++]=128|63&e);return t},exports.buf2binstring=function(r){return f(r,r.length)},exports.binstring2buf=function(n){for(var t=new r.Buf8(n.length),e=0,o=t.length;e<o;e++)t[e]=n.charCodeAt(e);return t},exports.buf2string=function(r,n){var t,o,u,a,i=n||r.length,h=new Array(2*i);for(o=0,t=0;t<i;)if((u=r[t++])<128)h[o++]=u;else if((a=e[u])>4)h[o++]=65533,t+=a-1;else{for(u&=2===a?31:3===a?15:7;a>1&&t<i;)u=u<<6|63&r[t++],a--;a>1?h[o++]=65533:u<65536?h[o++]=u:(u-=65536,h[o++]=55296|u>>10&1023,h[o++]=56320|1023&u)}return f(h,o)},exports.utf8border=function(r,n){var t;for((n=n||r.length)>r.length&&(n=r.length),t=n-1;t>=0&&128==(192&r[t]);)t--;return t<0?n:0===t?n:t+e[r[t]]>n?t:n};
},{"./common":"ReEi"}],"nymK":[function(require,module,exports) {
"use strict";function t(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}module.exports=t;
},{}],"/omd":[function(require,module,exports) {
"use strict";var t=require("./zlib/deflate"),i=require("./utils/common"),e=require("./utils/strings"),n=require("./zlib/messages"),r=require("./zlib/zstream"),s=Object.prototype.toString,o=0,a=4,u=0,h=1,d=2,l=-1,f=0,p=8;function w(o){if(!(this instanceof w))return new w(o);this.options=i.assign({level:l,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:f,to:""},o||{});var a=this.options;a.raw&&a.windowBits>0?a.windowBits=-a.windowBits:a.gzip&&a.windowBits>0&&a.windowBits<16&&(a.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new r,this.strm.avail_out=0;var h=t.deflateInit2(this.strm,a.level,a.method,a.windowBits,a.memLevel,a.strategy);if(h!==u)throw new Error(n[h]);if(a.header&&t.deflateSetHeader(this.strm,a.header),a.dictionary){var d;if(d="string"==typeof a.dictionary?e.string2buf(a.dictionary):"[object ArrayBuffer]"===s.call(a.dictionary)?new Uint8Array(a.dictionary):a.dictionary,(h=t.deflateSetDictionary(this.strm,d))!==u)throw new Error(n[h]);this._dict_set=!0}}function c(t,i){var e=new w(i);if(e.push(t,!0),e.err)throw e.msg||n[e.err];return e.result}function m(t,i){return(i=i||{}).raw=!0,c(t,i)}function g(t,i){return(i=i||{}).gzip=!0,c(t,i)}w.prototype.push=function(n,r){var l,f,p=this.strm,w=this.options.chunkSize;if(this.ended)return!1;f=r===~~r?r:!0===r?a:o,"string"==typeof n?p.input=e.string2buf(n):"[object ArrayBuffer]"===s.call(n)?p.input=new Uint8Array(n):p.input=n,p.next_in=0,p.avail_in=p.input.length;do{if(0===p.avail_out&&(p.output=new i.Buf8(w),p.next_out=0,p.avail_out=w),(l=t.deflate(p,f))!==h&&l!==u)return this.onEnd(l),this.ended=!0,!1;0!==p.avail_out&&(0!==p.avail_in||f!==a&&f!==d)||("string"===this.options.to?this.onData(e.buf2binstring(i.shrinkBuf(p.output,p.next_out))):this.onData(i.shrinkBuf(p.output,p.next_out)))}while((p.avail_in>0||0===p.avail_out)&&l!==h);return f===a?(l=t.deflateEnd(this.strm),this.onEnd(l),this.ended=!0,l===u):f!==d||(this.onEnd(u),p.avail_out=0,!0)},w.prototype.onData=function(t){this.chunks.push(t)},w.prototype.onEnd=function(t){t===u&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},exports.Deflate=w,exports.deflate=c,exports.deflateRaw=m,exports.gzip=g;
},{"./zlib/deflate":"AS18","./utils/common":"ReEi","./utils/strings":"soZx","./zlib/messages":"dGd5","./zlib/zstream":"nymK"}],"sWNy":[function(require,module,exports) {
"use strict";var i=30,e=12;module.exports=function(o,a){var t,d,n,l,s,f,r,b,c,u,v,m,w,h,k,_,x,g,p,z,j,q,y,A,B;t=o.state,d=o.next_in,A=o.input,n=d+(o.avail_in-5),l=o.next_out,B=o.output,s=l-(a-o.avail_out),f=l+(o.avail_out-257),r=t.dmax,b=t.wsize,c=t.whave,u=t.wnext,v=t.window,m=t.hold,w=t.bits,h=t.lencode,k=t.distcode,_=(1<<t.lenbits)-1,x=(1<<t.distbits)-1;i:do{w<15&&(m+=A[d++]<<w,w+=8,m+=A[d++]<<w,w+=8),g=h[m&_];e:for(;;){if(m>>>=p=g>>>24,w-=p,0===(p=g>>>16&255))B[l++]=65535&g;else{if(!(16&p)){if(0==(64&p)){g=h[(65535&g)+(m&(1<<p)-1)];continue e}if(32&p){t.mode=e;break i}o.msg="invalid literal/length code",t.mode=i;break i}z=65535&g,(p&=15)&&(w<p&&(m+=A[d++]<<w,w+=8),z+=m&(1<<p)-1,m>>>=p,w-=p),w<15&&(m+=A[d++]<<w,w+=8,m+=A[d++]<<w,w+=8),g=k[m&x];o:for(;;){if(m>>>=p=g>>>24,w-=p,!(16&(p=g>>>16&255))){if(0==(64&p)){g=k[(65535&g)+(m&(1<<p)-1)];continue o}o.msg="invalid distance code",t.mode=i;break i}if(j=65535&g,w<(p&=15)&&(m+=A[d++]<<w,(w+=8)<p&&(m+=A[d++]<<w,w+=8)),(j+=m&(1<<p)-1)>r){o.msg="invalid distance too far back",t.mode=i;break i}if(m>>>=p,w-=p,j>(p=l-s)){if((p=j-p)>c&&t.sane){o.msg="invalid distance too far back",t.mode=i;break i}if(q=0,y=v,0===u){if(q+=b-p,p<z){z-=p;do{B[l++]=v[q++]}while(--p);q=l-j,y=B}}else if(u<p){if(q+=b+u-p,(p-=u)<z){z-=p;do{B[l++]=v[q++]}while(--p);if(q=0,u<z){z-=p=u;do{B[l++]=v[q++]}while(--p);q=l-j,y=B}}}else if(q+=u-p,p<z){z-=p;do{B[l++]=v[q++]}while(--p);q=l-j,y=B}for(;z>2;)B[l++]=y[q++],B[l++]=y[q++],B[l++]=y[q++],z-=3;z&&(B[l++]=y[q++],z>1&&(B[l++]=y[q++]))}else{q=l-j;do{B[l++]=B[q++],B[l++]=B[q++],B[l++]=B[q++],z-=3}while(z>2);z&&(B[l++]=B[q++],z>1&&(B[l++]=B[q++]))}break}}break}}while(d<n&&l<f);d-=z=w>>3,m&=(1<<(w-=z<<3))-1,o.next_in=d,o.next_out=l,o.avail_in=d<n?n-d+5:5-(d-n),o.avail_out=l<f?f-l+257:257-(l-f),t.hold=m,t.bits=w};
},{}],"RFAm":[function(require,module,exports) {
"use strict";var r=require("../utils/common"),f=15,i=852,o=592,e=0,u=1,t=2,n=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],s=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],b=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];module.exports=function(a,c,m,w,d,v,B,h){var k,p,q,x,g,j,y,z,A,C=h.bits,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=null,O=0,P=new r.Buf16(f+1),Q=new r.Buf16(f+1),R=null,S=0;for(D=0;D<=f;D++)P[D]=0;for(E=0;E<w;E++)P[c[m+E]]++;for(H=C,G=f;G>=1&&0===P[G];G--);if(H>G&&(H=G),0===G)return d[v++]=20971520,d[v++]=20971520,h.bits=1,0;for(F=1;F<G&&0===P[F];F++);for(H<F&&(H=F),K=1,D=1;D<=f;D++)if(K<<=1,(K-=P[D])<0)return-1;if(K>0&&(a===e||1!==G))return-1;for(Q[1]=0,D=1;D<f;D++)Q[D+1]=Q[D]+P[D];for(E=0;E<w;E++)0!==c[m+E]&&(B[Q[c[m+E]]++]=E);if(a===e?(N=R=B,j=19):a===u?(N=n,O-=257,R=l,S-=257,j=256):(N=s,R=b,j=-1),M=0,E=0,D=F,g=v,I=H,J=0,q=-1,x=(L=1<<H)-1,a===u&&L>i||a===t&&L>o)return 1;for(;;){y=D-J,B[E]<j?(z=0,A=B[E]):B[E]>j?(z=R[S+B[E]],A=N[O+B[E]]):(z=96,A=0),k=1<<D-J,F=p=1<<I;do{d[g+(M>>J)+(p-=k)]=y<<24|z<<16|A|0}while(0!==p);for(k=1<<D-1;M&k;)k>>=1;if(0!==k?(M&=k-1,M+=k):M=0,E++,0==--P[D]){if(D===G)break;D=c[m+B[E]]}if(D>H&&(M&x)!==q){for(0===J&&(J=H),g+=F,K=1<<(I=D-J);I+J<G&&!((K-=P[I+J])<=0);)I++,K<<=1;if(L+=1<<I,a===u&&L>i||a===t&&L>o)return 1;d[q=M&x]=H<<24|I<<16|g-v|0}}return 0!==M&&(d[g+M]=D-J<<24|64<<16|0),h.bits=H,0};
},{"../utils/common":"ReEi"}],"ybQv":[function(require,module,exports) {
"use strict";var e=require("../utils/common"),a=require("./adler32"),t=require("./crc32"),i=require("./inffast"),s=require("./inftrees"),n=0,r=1,o=2,d=4,l=5,f=6,c=0,h=1,k=2,b=-2,m=-3,w=-4,u=-5,g=8,v=1,x=2,p=3,_=4,y=5,z=6,B=7,S=8,q=9,C=10,I=11,R=12,j=13,A=14,D=15,E=16,G=17,H=18,K=19,N=20,F=21,J=22,L=23,M=24,O=25,P=26,Q=27,T=28,U=29,V=30,W=31,X=32,Y=852,Z=592,$=15,ee=$;function ae(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function te(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new e.Buf16(320),this.work=new e.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function ie(a){var t;return a&&a.state?(t=a.state,a.total_in=a.total_out=t.total=0,a.msg="",t.wrap&&(a.adler=1&t.wrap),t.mode=v,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new e.Buf32(Y),t.distcode=t.distdyn=new e.Buf32(Z),t.sane=1,t.back=-1,c):b}function se(e){var a;return e&&e.state?((a=e.state).wsize=0,a.whave=0,a.wnext=0,ie(e)):b}function ne(e,a){var t,i;return e&&e.state?(i=e.state,a<0?(t=0,a=-a):(t=1+(a>>4),a<48&&(a&=15)),a&&(a<8||a>15)?b:(null!==i.window&&i.wbits!==a&&(i.window=null),i.wrap=t,i.wbits=a,se(e))):b}function re(e,a){var t,i;return e?(i=new te,e.state=i,i.window=null,(t=ne(e,a))!==c&&(e.state=null),t):b}function oe(e){return re(e,ee)}var de,le,fe=!0;function ce(a){if(fe){var t;for(de=new e.Buf32(512),le=new e.Buf32(32),t=0;t<144;)a.lens[t++]=8;for(;t<256;)a.lens[t++]=9;for(;t<280;)a.lens[t++]=7;for(;t<288;)a.lens[t++]=8;for(s(r,a.lens,0,288,de,0,a.work,{bits:9}),t=0;t<32;)a.lens[t++]=5;s(o,a.lens,0,32,le,0,a.work,{bits:5}),fe=!1}a.lencode=de,a.lenbits=9,a.distcode=le,a.distbits=5}function he(a,t,i,s){var n,r=a.state;return null===r.window&&(r.wsize=1<<r.wbits,r.wnext=0,r.whave=0,r.window=new e.Buf8(r.wsize)),s>=r.wsize?(e.arraySet(r.window,t,i-r.wsize,r.wsize,0),r.wnext=0,r.whave=r.wsize):((n=r.wsize-r.wnext)>s&&(n=s),e.arraySet(r.window,t,i-s,n,r.wnext),(s-=n)?(e.arraySet(r.window,t,i-s,s,0),r.wnext=s,r.whave=r.wsize):(r.wnext+=n,r.wnext===r.wsize&&(r.wnext=0),r.whave<r.wsize&&(r.whave+=n))),0}function ke(Y,Z){var $,ee,te,ie,se,ne,re,oe,de,le,fe,ke,be,me,we,ue,ge,ve,xe,pe,_e,ye,ze,Be,Se=0,qe=new e.Buf8(4),Ce=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!Y||!Y.state||!Y.output||!Y.input&&0!==Y.avail_in)return b;($=Y.state).mode===R&&($.mode=j),se=Y.next_out,te=Y.output,re=Y.avail_out,ie=Y.next_in,ee=Y.input,ne=Y.avail_in,oe=$.hold,de=$.bits,le=ne,fe=re,ye=c;e:for(;;)switch($.mode){case v:if(0===$.wrap){$.mode=j;break}for(;de<16;){if(0===ne)break e;ne--,oe+=ee[ie++]<<de,de+=8}if(2&$.wrap&&35615===oe){$.check=0,qe[0]=255&oe,qe[1]=oe>>>8&255,$.check=t($.check,qe,2,0),oe=0,de=0,$.mode=x;break}if($.flags=0,$.head&&($.head.done=!1),!(1&$.wrap)||(((255&oe)<<8)+(oe>>8))%31){Y.msg="incorrect header check",$.mode=V;break}if((15&oe)!==g){Y.msg="unknown compression method",$.mode=V;break}if(de-=4,_e=8+(15&(oe>>>=4)),0===$.wbits)$.wbits=_e;else if(_e>$.wbits){Y.msg="invalid window size",$.mode=V;break}$.dmax=1<<_e,Y.adler=$.check=1,$.mode=512&oe?C:R,oe=0,de=0;break;case x:for(;de<16;){if(0===ne)break e;ne--,oe+=ee[ie++]<<de,de+=8}if($.flags=oe,(255&$.flags)!==g){Y.msg="unknown compression method",$.mode=V;break}if(57344&$.flags){Y.msg="unknown header flags set",$.mode=V;break}$.head&&($.head.text=oe>>8&1),512&$.flags&&(qe[0]=255&oe,qe[1]=oe>>>8&255,$.check=t($.check,qe,2,0)),oe=0,de=0,$.mode=p;case p:for(;de<32;){if(0===ne)break e;ne--,oe+=ee[ie++]<<de,de+=8}$.head&&($.head.time=oe),512&$.flags&&(qe[0]=255&oe,qe[1]=oe>>>8&255,qe[2]=oe>>>16&255,qe[3]=oe>>>24&255,$.check=t($.check,qe,4,0)),oe=0,de=0,$.mode=_;case _:for(;de<16;){if(0===ne)break e;ne--,oe+=ee[ie++]<<de,de+=8}$.head&&($.head.xflags=255&oe,$.head.os=oe>>8),512&$.flags&&(qe[0]=255&oe,qe[1]=oe>>>8&255,$.check=t($.check,qe,2,0)),oe=0,de=0,$.mode=y;case y:if(1024&$.flags){for(;de<16;){if(0===ne)break e;ne--,oe+=ee[ie++]<<de,de+=8}$.length=oe,$.head&&($.head.extra_len=oe),512&$.flags&&(qe[0]=255&oe,qe[1]=oe>>>8&255,$.check=t($.check,qe,2,0)),oe=0,de=0}else $.head&&($.head.extra=null);$.mode=z;case z:if(1024&$.flags&&((ke=$.length)>ne&&(ke=ne),ke&&($.head&&(_e=$.head.extra_len-$.length,$.head.extra||($.head.extra=new Array($.head.extra_len)),e.arraySet($.head.extra,ee,ie,ke,_e)),512&$.flags&&($.check=t($.check,ee,ke,ie)),ne-=ke,ie+=ke,$.length-=ke),$.length))break e;$.length=0,$.mode=B;case B:if(2048&$.flags){if(0===ne)break e;ke=0;do{_e=ee[ie+ke++],$.head&&_e&&$.length<65536&&($.head.name+=String.fromCharCode(_e))}while(_e&&ke<ne);if(512&$.flags&&($.check=t($.check,ee,ke,ie)),ne-=ke,ie+=ke,_e)break e}else $.head&&($.head.name=null);$.length=0,$.mode=S;case S:if(4096&$.flags){if(0===ne)break e;ke=0;do{_e=ee[ie+ke++],$.head&&_e&&$.length<65536&&($.head.comment+=String.fromCharCode(_e))}while(_e&&ke<ne);if(512&$.flags&&($.check=t($.check,ee,ke,ie)),ne-=ke,ie+=ke,_e)break e}else $.head&&($.head.comment=null);$.mode=q;case q:if(512&$.flags){for(;de<16;){if(0===ne)break e;ne--,oe+=ee[ie++]<<de,de+=8}if(oe!==(65535&$.check)){Y.msg="header crc mismatch",$.mode=V;break}oe=0,de=0}$.head&&($.head.hcrc=$.flags>>9&1,$.head.done=!0),Y.adler=$.check=0,$.mode=R;break;case C:for(;de<32;){if(0===ne)break e;ne--,oe+=ee[ie++]<<de,de+=8}Y.adler=$.check=ae(oe),oe=0,de=0,$.mode=I;case I:if(0===$.havedict)return Y.next_out=se,Y.avail_out=re,Y.next_in=ie,Y.avail_in=ne,$.hold=oe,$.bits=de,k;Y.adler=$.check=1,$.mode=R;case R:if(Z===l||Z===f)break e;case j:if($.last){oe>>>=7&de,de-=7&de,$.mode=Q;break}for(;de<3;){if(0===ne)break e;ne--,oe+=ee[ie++]<<de,de+=8}switch($.last=1&oe,de-=1,3&(oe>>>=1)){case 0:$.mode=A;break;case 1:if(ce($),$.mode=N,Z===f){oe>>>=2,de-=2;break e}break;case 2:$.mode=G;break;case 3:Y.msg="invalid block type",$.mode=V}oe>>>=2,de-=2;break;case A:for(oe>>>=7&de,de-=7&de;de<32;){if(0===ne)break e;ne--,oe+=ee[ie++]<<de,de+=8}if((65535&oe)!=(oe>>>16^65535)){Y.msg="invalid stored block lengths",$.mode=V;break}if($.length=65535&oe,oe=0,de=0,$.mode=D,Z===f)break e;case D:$.mode=E;case E:if(ke=$.length){if(ke>ne&&(ke=ne),ke>re&&(ke=re),0===ke)break e;e.arraySet(te,ee,ie,ke,se),ne-=ke,ie+=ke,re-=ke,se+=ke,$.length-=ke;break}$.mode=R;break;case G:for(;de<14;){if(0===ne)break e;ne--,oe+=ee[ie++]<<de,de+=8}if($.nlen=257+(31&oe),oe>>>=5,de-=5,$.ndist=1+(31&oe),oe>>>=5,de-=5,$.ncode=4+(15&oe),oe>>>=4,de-=4,$.nlen>286||$.ndist>30){Y.msg="too many length or distance symbols",$.mode=V;break}$.have=0,$.mode=H;case H:for(;$.have<$.ncode;){for(;de<3;){if(0===ne)break e;ne--,oe+=ee[ie++]<<de,de+=8}$.lens[Ce[$.have++]]=7&oe,oe>>>=3,de-=3}for(;$.have<19;)$.lens[Ce[$.have++]]=0;if($.lencode=$.lendyn,$.lenbits=7,ze={bits:$.lenbits},ye=s(n,$.lens,0,19,$.lencode,0,$.work,ze),$.lenbits=ze.bits,ye){Y.msg="invalid code lengths set",$.mode=V;break}$.have=0,$.mode=K;case K:for(;$.have<$.nlen+$.ndist;){for(;ue=(Se=$.lencode[oe&(1<<$.lenbits)-1])>>>16&255,ge=65535&Se,!((we=Se>>>24)<=de);){if(0===ne)break e;ne--,oe+=ee[ie++]<<de,de+=8}if(ge<16)oe>>>=we,de-=we,$.lens[$.have++]=ge;else{if(16===ge){for(Be=we+2;de<Be;){if(0===ne)break e;ne--,oe+=ee[ie++]<<de,de+=8}if(oe>>>=we,de-=we,0===$.have){Y.msg="invalid bit length repeat",$.mode=V;break}_e=$.lens[$.have-1],ke=3+(3&oe),oe>>>=2,de-=2}else if(17===ge){for(Be=we+3;de<Be;){if(0===ne)break e;ne--,oe+=ee[ie++]<<de,de+=8}de-=we,_e=0,ke=3+(7&(oe>>>=we)),oe>>>=3,de-=3}else{for(Be=we+7;de<Be;){if(0===ne)break e;ne--,oe+=ee[ie++]<<de,de+=8}de-=we,_e=0,ke=11+(127&(oe>>>=we)),oe>>>=7,de-=7}if($.have+ke>$.nlen+$.ndist){Y.msg="invalid bit length repeat",$.mode=V;break}for(;ke--;)$.lens[$.have++]=_e}}if($.mode===V)break;if(0===$.lens[256]){Y.msg="invalid code -- missing end-of-block",$.mode=V;break}if($.lenbits=9,ze={bits:$.lenbits},ye=s(r,$.lens,0,$.nlen,$.lencode,0,$.work,ze),$.lenbits=ze.bits,ye){Y.msg="invalid literal/lengths set",$.mode=V;break}if($.distbits=6,$.distcode=$.distdyn,ze={bits:$.distbits},ye=s(o,$.lens,$.nlen,$.ndist,$.distcode,0,$.work,ze),$.distbits=ze.bits,ye){Y.msg="invalid distances set",$.mode=V;break}if($.mode=N,Z===f)break e;case N:$.mode=F;case F:if(ne>=6&&re>=258){Y.next_out=se,Y.avail_out=re,Y.next_in=ie,Y.avail_in=ne,$.hold=oe,$.bits=de,i(Y,fe),se=Y.next_out,te=Y.output,re=Y.avail_out,ie=Y.next_in,ee=Y.input,ne=Y.avail_in,oe=$.hold,de=$.bits,$.mode===R&&($.back=-1);break}for($.back=0;ue=(Se=$.lencode[oe&(1<<$.lenbits)-1])>>>16&255,ge=65535&Se,!((we=Se>>>24)<=de);){if(0===ne)break e;ne--,oe+=ee[ie++]<<de,de+=8}if(ue&&0==(240&ue)){for(ve=we,xe=ue,pe=ge;ue=(Se=$.lencode[pe+((oe&(1<<ve+xe)-1)>>ve)])>>>16&255,ge=65535&Se,!(ve+(we=Se>>>24)<=de);){if(0===ne)break e;ne--,oe+=ee[ie++]<<de,de+=8}oe>>>=ve,de-=ve,$.back+=ve}if(oe>>>=we,de-=we,$.back+=we,$.length=ge,0===ue){$.mode=P;break}if(32&ue){$.back=-1,$.mode=R;break}if(64&ue){Y.msg="invalid literal/length code",$.mode=V;break}$.extra=15&ue,$.mode=J;case J:if($.extra){for(Be=$.extra;de<Be;){if(0===ne)break e;ne--,oe+=ee[ie++]<<de,de+=8}$.length+=oe&(1<<$.extra)-1,oe>>>=$.extra,de-=$.extra,$.back+=$.extra}$.was=$.length,$.mode=L;case L:for(;ue=(Se=$.distcode[oe&(1<<$.distbits)-1])>>>16&255,ge=65535&Se,!((we=Se>>>24)<=de);){if(0===ne)break e;ne--,oe+=ee[ie++]<<de,de+=8}if(0==(240&ue)){for(ve=we,xe=ue,pe=ge;ue=(Se=$.distcode[pe+((oe&(1<<ve+xe)-1)>>ve)])>>>16&255,ge=65535&Se,!(ve+(we=Se>>>24)<=de);){if(0===ne)break e;ne--,oe+=ee[ie++]<<de,de+=8}oe>>>=ve,de-=ve,$.back+=ve}if(oe>>>=we,de-=we,$.back+=we,64&ue){Y.msg="invalid distance code",$.mode=V;break}$.offset=ge,$.extra=15&ue,$.mode=M;case M:if($.extra){for(Be=$.extra;de<Be;){if(0===ne)break e;ne--,oe+=ee[ie++]<<de,de+=8}$.offset+=oe&(1<<$.extra)-1,oe>>>=$.extra,de-=$.extra,$.back+=$.extra}if($.offset>$.dmax){Y.msg="invalid distance too far back",$.mode=V;break}$.mode=O;case O:if(0===re)break e;if(ke=fe-re,$.offset>ke){if((ke=$.offset-ke)>$.whave&&$.sane){Y.msg="invalid distance too far back",$.mode=V;break}ke>$.wnext?(ke-=$.wnext,be=$.wsize-ke):be=$.wnext-ke,ke>$.length&&(ke=$.length),me=$.window}else me=te,be=se-$.offset,ke=$.length;ke>re&&(ke=re),re-=ke,$.length-=ke;do{te[se++]=me[be++]}while(--ke);0===$.length&&($.mode=F);break;case P:if(0===re)break e;te[se++]=$.length,re--,$.mode=F;break;case Q:if($.wrap){for(;de<32;){if(0===ne)break e;ne--,oe|=ee[ie++]<<de,de+=8}if(fe-=re,Y.total_out+=fe,$.total+=fe,fe&&(Y.adler=$.check=$.flags?t($.check,te,fe,se-fe):a($.check,te,fe,se-fe)),fe=re,($.flags?oe:ae(oe))!==$.check){Y.msg="incorrect data check",$.mode=V;break}oe=0,de=0}$.mode=T;case T:if($.wrap&&$.flags){for(;de<32;){if(0===ne)break e;ne--,oe+=ee[ie++]<<de,de+=8}if(oe!==(4294967295&$.total)){Y.msg="incorrect length check",$.mode=V;break}oe=0,de=0}$.mode=U;case U:ye=h;break e;case V:ye=m;break e;case W:return w;case X:default:return b}return Y.next_out=se,Y.avail_out=re,Y.next_in=ie,Y.avail_in=ne,$.hold=oe,$.bits=de,($.wsize||fe!==Y.avail_out&&$.mode<V&&($.mode<Q||Z!==d))&&he(Y,Y.output,Y.next_out,fe-Y.avail_out)?($.mode=W,w):(le-=Y.avail_in,fe-=Y.avail_out,Y.total_in+=le,Y.total_out+=fe,$.total+=fe,$.wrap&&fe&&(Y.adler=$.check=$.flags?t($.check,te,fe,Y.next_out-fe):a($.check,te,fe,Y.next_out-fe)),Y.data_type=$.bits+($.last?64:0)+($.mode===R?128:0)+($.mode===N||$.mode===D?256:0),(0===le&&0===fe||Z===d)&&ye===c&&(ye=u),ye)}function be(e){if(!e||!e.state)return b;var a=e.state;return a.window&&(a.window=null),e.state=null,c}function me(e,a){var t;return e&&e.state?0==(2&(t=e.state).wrap)?b:(t.head=a,a.done=!1,c):b}function we(e,t){var i,s=t.length;return e&&e.state?0!==(i=e.state).wrap&&i.mode!==I?b:i.mode===I&&a(1,t,s,0)!==i.check?m:he(e,t,s,s)?(i.mode=W,w):(i.havedict=1,c):b}exports.inflateReset=se,exports.inflateReset2=ne,exports.inflateResetKeep=ie,exports.inflateInit=oe,exports.inflateInit2=re,exports.inflate=ke,exports.inflateEnd=be,exports.inflateGetHeader=me,exports.inflateSetDictionary=we,exports.inflateInfo="pako inflate (from Nodeca project)";
},{"../utils/common":"ReEi","./adler32":"dbjK","./crc32":"bDh6","./inffast":"sWNy","./inftrees":"RFAm"}],"NxLi":[function(require,module,exports) {
"use strict";module.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};
},{}],"1aVN":[function(require,module,exports) {
"use strict";function t(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}module.exports=t;
},{}],"wICU":[function(require,module,exports) {
"use strict";var t=require("./zlib/inflate"),i=require("./utils/common"),n=require("./utils/strings"),r=require("./zlib/constants"),s=require("./zlib/messages"),o=require("./zlib/zstream"),e=require("./zlib/gzheader"),a=Object.prototype.toString;function u(h){if(!(this instanceof u))return new u(h);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},h||{});var _=this.options;_.raw&&_.windowBits>=0&&_.windowBits<16&&(_.windowBits=-_.windowBits,0===_.windowBits&&(_.windowBits=-15)),!(_.windowBits>=0&&_.windowBits<16)||h&&h.windowBits||(_.windowBits+=32),_.windowBits>15&&_.windowBits<48&&0==(15&_.windowBits)&&(_.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new o,this.strm.avail_out=0;var w=t.inflateInit2(this.strm,_.windowBits);if(w!==r.Z_OK)throw new Error(s[w]);if(this.header=new e,t.inflateGetHeader(this.strm,this.header),_.dictionary&&("string"==typeof _.dictionary?_.dictionary=n.string2buf(_.dictionary):"[object ArrayBuffer]"===a.call(_.dictionary)&&(_.dictionary=new Uint8Array(_.dictionary)),_.raw&&(w=t.inflateSetDictionary(this.strm,_.dictionary))!==r.Z_OK))throw new Error(s[w])}function h(t,i){var n=new u(i);if(n.push(t,!0),n.err)throw n.msg||s[n.err];return n.result}function _(t,i){return(i=i||{}).raw=!0,h(t,i)}u.prototype.push=function(s,o){var e,u,h,_,w,d=this.strm,l=this.options.chunkSize,f=this.options.dictionary,p=!1;if(this.ended)return!1;u=o===~~o?o:!0===o?r.Z_FINISH:r.Z_NO_FLUSH,"string"==typeof s?d.input=n.binstring2buf(s):"[object ArrayBuffer]"===a.call(s)?d.input=new Uint8Array(s):d.input=s,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new i.Buf8(l),d.next_out=0,d.avail_out=l),(e=t.inflate(d,r.Z_NO_FLUSH))===r.Z_NEED_DICT&&f&&(e=t.inflateSetDictionary(this.strm,f)),e===r.Z_BUF_ERROR&&!0===p&&(e=r.Z_OK,p=!1),e!==r.Z_STREAM_END&&e!==r.Z_OK)return this.onEnd(e),this.ended=!0,!1;d.next_out&&(0!==d.avail_out&&e!==r.Z_STREAM_END&&(0!==d.avail_in||u!==r.Z_FINISH&&u!==r.Z_SYNC_FLUSH)||("string"===this.options.to?(h=n.utf8border(d.output,d.next_out),_=d.next_out-h,w=n.buf2string(d.output,h),d.next_out=_,d.avail_out=l-_,_&&i.arraySet(d.output,d.output,h,_,0),this.onData(w)):this.onData(i.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(p=!0)}while((d.avail_in>0||0===d.avail_out)&&e!==r.Z_STREAM_END);return e===r.Z_STREAM_END&&(u=r.Z_FINISH),u===r.Z_FINISH?(e=t.inflateEnd(this.strm),this.onEnd(e),this.ended=!0,e===r.Z_OK):u!==r.Z_SYNC_FLUSH||(this.onEnd(r.Z_OK),d.avail_out=0,!0)},u.prototype.onData=function(t){this.chunks.push(t)},u.prototype.onEnd=function(t){t===r.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},exports.Inflate=u,exports.inflate=h,exports.inflateRaw=_,exports.ungzip=h;
},{"./zlib/inflate":"ybQv","./utils/common":"ReEi","./utils/strings":"soZx","./zlib/constants":"NxLi","./zlib/messages":"dGd5","./zlib/zstream":"nymK","./zlib/gzheader":"1aVN"}],"a5qV":[function(require,module,exports) {
"use strict";var e=require("./lib/utils/common").assign,i=require("./lib/deflate"),r=require("./lib/inflate"),l=require("./lib/zlib/constants"),s={};e(s,i,r,l),module.exports=s;
},{"./lib/utils/common":"ReEi","./lib/deflate":"/omd","./lib/inflate":"wICU","./lib/zlib/constants":"NxLi"}],"jwRz":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.SDK_VERSION=void 0;var t=d(require("fast-json-stable-stringify"));require("@croquet/util/deduplicate");var e=d(require("@croquet/util/asyncQueue")),s=require("@croquet/util/stats"),i=d(require("@croquet/util/urlOptions")),n=require("@croquet/util/user"),o=require("@croquet/util/html"),r=require("@croquet/util/modules"),a=require("./realms"),c=require("./domain"),l=h(require("./island"));function h(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,s):{};i.get||i.set?Object.defineProperty(e,s,i):e[s]=t[s]}return e.default=t,e}function d(t){return t&&t.__esModule?t:{default:t}}const u=require("pako"),p=1,g="0.2.5 (pre-alpha)";exports.SDK_VERSION=g,console.log("Croquet SDK "+g);const m=window.location.hostname.endsWith("croquet.io")?window.location.host:"reflector.croquet.studio",f=`wss://${m}/v${p}`,w=f,S=null;let y=null;function k(){y={messages:i.default.has("debug","messages",!1),sends:i.default.has("debug","sends",!1),ticks:i.default.has("debug","ticks",!1),pong:i.default.has("debug","pong",!1),snapshot:i.default.has("debug","snapshot",!1),session:i.default.has("debug","session",!1),initsnapshot:i.default.has("debug","initsnapshot","localhost"),init:i.default.has("debug","init","localhost")}}const v=i.default.nocheat,C=["tps"],T=5e3,$=5,b=100,O=1e3;function q(){return Math.floor(Math.random()*2**53).toString(36)}const N=new Set;class E{constructor(){this.reset()}reset(){this.island=null,this.connection=this.connection||new P(this),this.networkQueue=new e.default,this.time=0,this.session="",this.viewId=this.viewId||q(),this.users=0,this.usersTotal=0,this.cpuTime=0,this.triggeringCpuTime=null,this.synced=null,this.statistics={id:this.viewId,seq:0,sent:{}},this.latency=0,this.localTicker&&(window.clearInterval(this.localTicker),delete this.localTicker),this.tuttiHistory=[],this.lastSnapshotPoll=0,c.viewDomain.removeAllSubscriptionsFor(this),c.viewDomain.addSubscription(this.viewId,"__users__",this,t=>(0,o.displayStatus)(`users now ${t.count}`),"oncePerFrameWhileSynced"),o.App.showSyncWait(!0)}get id(){return this.island?this.island.id:this.islandCreator.snapshot.id}get user(){return{id:this.viewId,name:(0,n.getUser)("name","GUEST")}}get backlog(){return this.island?this.time-this.island.time:0}get starvation(){return Date.now()-this.lastReceived}get activity(){return Date.now()-this.lastSent}get connected(){return this.connection.connected}checkForConnection(t){this.connection.checkForConnection(t)}dormantDisconnect(){this.connected&&this.connection.dormantDisconnect()}async establishSession(t,e){k();const{optionsFromUrl:s,multiRoom:a,autoSession:c,login:l}=e,h={...e.options};for(const n of[...C,...s||[]])n in i.default&&(h[n]=i.default[n]);if(l&&await(0,n.login)(),c){const e=t,s=i.default.getSession().split("/");let r=a?s[1]:s[0],l=a?s[2]:s[1];const h=!r||!l;h&&(c.user&&(r=c.user),c.random&&(l=c.random),r||(r=(0,n.getUser)("name","").toLowerCase()||"GUEST"),l||(l=q())),this.session=a?`${e}/${r}/${l}`:`${r}/${l}`,a||(i.default.setSession(this.session,h),o.App.sessionURL=window.location.href),t=`${e}/${r}/${l}`,"DEMO"===r&&(this.viewOnly=(0,n.getUser)("demoViewOnly",!0))}const d=Object.keys(h).length?t+"?"+Object.entries(h).map(([t,e])=>`${t}=${e}`).join("&"):t,{hash:u,codeHash:p}=await(0,r.hashNameAndCode)(d);console.log(`Session ID for "${d}": ${u}`),this.islandCreator={...e,options:h,name:t,nameWithOptions:d,codeHash:p};let g=!1;return this.islandCreator.snapshot?this.islandCreator.snapshot.id!==u&&(console.warn("Existing snapshot was for different code base!"),g=!0):g=!0,g&&(this.islandCreator.snapshot={id:u,time:0,meta:{id:u,codeHash:p,created:(new Date).toISOString()}}),await this.join(),(await new Promise(t=>this.islandCreator.resolveIslandPromise=t)).modelsByName}lastKnownTime(t){return Math.max(t.time,t.externalTime)}takeSnapshot(){const t=this.island.snapshot(),e=Math.max(t.time,t.externalTime),s=t.externalSeq;return t.meta={...this.islandCreator.snapshot.meta,options:this.islandCreator.options,time:e,seq:s,date:(new Date).toISOString(),host:window.location.hostname,sdk:g},delete t.meta.hash,S&&(t.meta.code=S),t}scheduleSnapshot(){const t=this.island.time,e=t-this.lastSnapshotPoll;if(e<2500)return void console.log(`not sending snapshot poll request (${e}ms since poll scheduled)`);const s=new l.Message(t,0,this.island.id,"pollForSnapshot",[]);this.sendMessage(s),y.snapshot&&console.log(this.id,"Controller scheduling snapshot via reflector")}pollForSnapshot(){const e=this.island.time,s=e-this.lastSnapshotPoll;if(s<5e3)return void console.log(`rejecting snapshot poll ${s}ms after previous`);this.lastSnapshotPoll=e;const i=this.triggeringCpuTime||this.cpuTime;this.triggeringCpuTime=null,this.cpuTime=0;const n=this.island.getNextTuttiSeq();if(!0!==this.synced)return;const o=Date.now(),r={hash:(0,t.default)(this.island.getSummaryHash()),cpuTime:i+Math.random()},a=Date.now()-o;this.cpuTime-=a;const c=[this.id,"handleSnapshotVote","snapshotVote"];this.sendTutti(this.island.time,n,r,null,!0,c)}handleSnapshotVote(t){if(!0!==this.synced)return void(y.snapshot&&console.log("Ignoring snapshot vote during sync"));const{_local:e,tally:s}=t,i=Object.keys(s);if(!e||!i.includes(e))return y.snapshot&&console.log(this.id,"Snapshot: local vote not found"),void(this.cpuTime=0);const n=(t,s)=>{const n=r[t];n.length>1&&n.sort((t,e)=>o[t].cpuTime-o[e].cpuTime);const a=n[0];i[a]===e&&this.serveSnapshot(s)},o=i.map(t=>JSON.parse(t)),r={};o.forEach(({hash:t},e)=>{r[t]||(r[t]=[]),r[t].push(e)});const a=Object.keys(r);let c=a[0];a.length>1&&(y.snapshot&&console.log(this.id,`Snapshots fall into ${a.length} groups`),a.sort((t,e)=>r[e].length-r[t].length),r[a[0]].length===r[a[1]].length&&(y.snapshot&&console.log(this.id,"Deciding consensus by tie-break"),c=a[0]<a[1]?a[0]:a[1])),a.forEach(t=>n(t,t===c))}serveSnapshot(t){const e=s.Stats.begin("snapshot"),i=this.takeSnapshot(),n=s.Stats.end("snapshot")-e;this.cpuTime-=n,y.snapshot&&console.log(this.id,`Snapshotting took ${Math.ceil(n)} ms`),this.uploadSnapshot(i,t)}snapshotUrl(t,e,s,i,n){const o=`${this.islandCreator.name.split(/[^A-Z0-9]+/i).filter(t=>t).join("-")}-${this.id}`,a=`.json${n?"."+n:""}`;return`${`${(0,r.baseUrl)("snapshots")}${o}`}/${`${(t=>(""+t).padStart(10,"0"))(Math.round(e))}_${s}-${t}-${i}${a}`}`}hashSnapshot(t){return t.meta.hash?t.meta.hash:(t.meta.hashPromise||(t.meta.hashPromise=new Promise(e=>{const s={...t};delete s.meta,(0,r.hashString)(JSON.stringify(s)).then(s=>{t.meta.hash=s,delete t.meta.hashPromise,e(s)})})),t.meta.hashPromise)}async uploadSnapshot(t,e=!0){await this.hashSnapshot(t);const s=Date.now(),i=JSON.stringify(t),n=Date.now()-s,{time:o,seq:r,hash:a}=t.meta,c=this.snapshotUrl("snap",o,r,a,"gz");y.snapshot&&console.log(this.id,`Controller uploading snapshot (${i.length} bytes, ${n}ms) to ${c}`);const l=this.connection.socket,h=await this.uploadGzipped(c,i);this.connection.socket===l?h?e&&this.announceSnapshotUrl(o,r,a,c):console.error("Failed to upload snapshot"):console.error("Controller was reset while trying to upload snapshot")}announceSnapshotUrl(t,e,s,i){y.snapshot&&console.log(this.id,`Controller sending snapshot url to reflector (time: ${t}, seq: ${e}, hash: ${s}): ${i}`);try{this.connection.send(JSON.stringify({id:this.id,action:"SNAP",args:{time:t,seq:e,hash:s,url:i}}))}catch(n){console.error("ERROR while sending",n)}}async fetchJSON(t,e){try{const e=await fetch(t,{mode:"cors"});if(t.endsWith(".gz")){const t=await e.arrayBuffer(),s=u.inflate(new Uint8Array(t),{to:"string"});return JSON.parse(s)}return await e.json()}catch(s){}return e}async uploadJSON(t,e){try{return await fetch(t,{method:"PUT",mode:"cors",headers:{"Content-Type":"application/json"},body:e}),t}catch(s){}return!1}async uploadGzipped(t,e){const s=Date.now(),i=(new TextEncoder).encode(e),n=u.gzip(i,{level:1});y.snapshot&&console.log(`Snapshot gzipping took ${Date.now()-s}ms`);try{return await fetch(t,{method:"PUT",mode:"cors",headers:{"Content-Type":"application/octet-stream"},body:n}),t}catch(o){}return!1}checkMetaMessage(t){}convertReflectorMessage(t){let e=this.id,s="noop",i=[];switch(t[2].what){case"users":{const{joined:n,left:o,active:r,total:a}=t[2];this.users=r,this.usersTotal=a;const l=this.id,h="__users__",d={entered:n||[],exited:o||[],count:r};for(const t of d.entered)t.length>2&&(t.length=2);e=this.id,s="publishFromModel",i=[l,h,d],c.viewDomain.handleEvent(this.viewId+":"+h,d);break}case"tally":{const{tuttiSeq:n,tally:o,tallyTarget:r}=t[2],a={tuttiSeq:n,tally:o},c=this.tuttiHistory.find(t=>t.tuttiSeq===n);let l;c&&(a._local=c.payload),[e,s,l]=r,i=[l,a];break}}const n=new l.Message(0,0,e,s,i);t[2]=n.asState()[2]}async receive(t,e){switch(this.lastReceived=this.connection.lastReceived,t){case"START":{y.session&&console.log(this.id,"Controller received START"),this.install(),this.requestTicks();const t=this.takeSnapshot();return void this.uploadSnapshot(t,!0)}case"SYNC":{const{messages:t,url:s,time:i}=e;y.session&&console.log(this.id,`Controller received SYNC: time ${i}, ${t.length} messages, ${s}`);for(const e of t)"string"!=typeof e[2]&&this.convertReflectorMessage(e);const n=await this.fetchJSON(s);if(this.islandCreator.snapshot=n,!this.connected)return void console.log(this.id,"socket went away during SYNC");for(const e of t)y.messages&&console.log(this.id,"Controller got message in SYNC "+JSON.stringify(e)),e[1]>>>=0;return this.install(t,i),void this.getTickAndMultiplier()}case"RECV":{y.messages&&console.log(this.id,"Controller received RECV "+JSON.stringify(e));const t=e;"string"!=typeof t[2]&&this.convertReflectorMessage(t);const s=t[0];return t[1]>>>=0,t[3]===this.statistics.id&&this.addToStatistics(t[4]),this.networkQueue.put(t),this.timeFromReflector(s),void this.checkMetaMessage(t)}case"TICK":{if(!this.island)return;const t=e;return y.ticks&&console.log(this.id,"Controller received TICK "+t),this.timeFromReflector(t),void(this.tickMultiplier&&this.multiplyTick(t))}case"LEAVE":return console.log(this.id,"Controller received LEAVE"),void this.leave(!1);default:console.warn("Unknown action:",t,e)}}install(t=[],e=0){const{snapshot:s,init:i,options:n,resolveIslandPromise:r}=this.islandCreator;let a=new l.default(s,()=>{try{return i(n)}catch(t){throw(0,o.displayAppError)("init",t),t}});if(y.initsnapshot&&!s.modelsById){const t=JSON.stringify(a.snapshot());a=new l.default(JSON.parse(t),()=>i(n))}if(y.messages){const t=a.externalSeq-a.seq>>>0;console.log(this.id,`Controller expected ${t} unsimulated external messages in snapshot (${a.seq}-${a.externalSeq})`);const e=a.messages.asArray().filter(t=>t.isExternal());console.log(this.id,`Controller found ${e.length} unsimulated external messages in snapshot`,e)}if(t.length>0){y.messages&&console.log(this.id,`Controller scheduling ${t.length} messages after snapshot`,t);for(const e of t)"string"!=typeof e[2]&&this.convertReflectorMessage(e),a.scheduleExternalMessage(e)}const c=a.externalSeq+1>>>0;for(let o=this.networkQueue.peek();o;o=this.networkQueue.peek()){if(!(0,l.inSequence)(o[1],c))throw Error(`Missing message (expected ${c} got ${o[1]})`);if(o[1]===c)break;this.networkQueue.nextNonBlocking()}const h=this.lastKnownTime(a);e&&e<h&&console.warn(`ignoring SYNC time from reflector (time was ${h.time}, received ${e})`),this.time=Math.max(this.time,h,e),this.setIsland(a),r(this.island)}setIsland(t){this.island=t,this.island.controller=this}createCleanIsland(){const{options:t,init:e}=this.islandCreator,s={id:this.id};return new l.default(s,()=>e(t))}async join(){this.checkForConnection(!1),await this.connection.connectionPromise,N.add(this),y.session&&console.log(this.id,"Controller sending JOIN");const{name:t,id:e}=this.user,s={name:this.islandCreator.nameWithOptions,version:p,user:[e,t],url:o.App.sessionURL,codeHash:this.islandCreator.codeHash,sdk:g};this.connection.send(JSON.stringify({id:this.id,action:"JOIN",args:s}))}leave(){this.connected&&(console.log(this.id,`Controller LEAVING session for ${this.islandCreator.name}`),this.connection.send(JSON.stringify({id:this.id,action:"LEAVING"}))),N.delete(this);const{destroyerFn:t}=this.islandCreator;if(this.reset(),!this.islandCreator)throw Error("do not discard islandCreator!");t&&t()}sendMessage(t){this.connected&&(this.viewOnly||(y.sends&&console.log(this.id,`Controller sending SEND ${t.asState()}`),this.lastSent=Date.now(),this.statistics.sent[++this.statistics.seq]=this.lastSent,this.connection.send(JSON.stringify({id:this.id,action:"SEND",args:[...t.asState(),this.statistics.id,this.statistics.seq]}))))}sendTutti(e,s,i,n,o,r){if(!this.connected)return;if(this.viewOnly)return;const a=(0,t.default)(i);y.sends&&console.log(this.id,`Controller sending TUTTI ${a} ${n&&n.asState()} ${r}`),this.tuttiHistory.push({tuttiSeq:s,payload:a}),this.tuttiHistory.length>100&&this.tuttiHistory.shift(),this.lastSent=Date.now(),this.connection.send(JSON.stringify({id:this.id,action:"TUTTI",args:[e,s,a,n&&n.asState(),o,r]}))}sendVote(t,e,s){const i=[this.island.id,"handleModelEventInView",this.island.id+":"+e];this.sendTutti(this.island.time,t,s,null,!0,i)}addToStatistics(t){const{sent:e}=this.statistics;this.latency=Date.now()-e[t],delete e[t]}getTickAndMultiplier(){const t=this.islandCreator.options,e=t.tps?t.tps:this.islandCreator.tps?this.islandCreator.tps:20,[s,i]=(e+"x").split("x").map(t=>Number.parseInt("0"+t,10)),n=1e3/Math.max(1,Math.min(60,s)),o=Math.max(1,i);return o>1&&!v&&(this.tickMultiplier={tick:n,multiplier:o}),{tick:n,multiplier:o}}requestTicks(t={}){if(!this.connected||!this.island)return;const{tick:e,multiplier:s}=this.getTickAndMultiplier(),i=e*(s-1)/s;i?(t.delay=i,t.tick=e):t.tick||(t.tick=e),t.time||(t.time=this.lastKnownTime(this.island),t.seq=this.island.externalSeq),y.session&&console.log(this.id,"Controller requesting TICKS",t);try{this.connection.send(JSON.stringify({id:this.id,action:"TICKS",args:t}))}catch(n){console.error("ERROR while sending",n)}}simulate(t){if(!this.island)return!0;try{const i=s.Stats.begin("simulate");let n=!0;for(;n;){const e=this.networkQueue.nextNonBlocking();if(!e)break;const s=this.island.scheduleExternalMessage(e);this.cpuTime+=$,n=this.island.advanceTo(s.time,t)}n&&(n=this.island.advanceTo(this.time,t)),this.cpuTime+=Math.max(.01,s.Stats.end("simulate")-i);const r=this.backlog;return s.Stats.backlog(r),"boolean"==typeof this.synced&&(this.synced&&r>O||!this.synced&&r<b)&&(this.synced=!this.synced,o.App.showSyncWait(!this.synced),this.island.publishFromView(this.viewId,"synced",this.synced)),n&&this.cpuTime>T&&(this.triggeringCpuTime=this.cpuTime,this.cpuTime=0,setTimeout(()=>this.scheduleSnapshot(),Math.floor(2e3*Math.random()))),n}catch(e){return(0,o.displayAppError)("simulate",e),this.connection.closeConnectionWithError("simulate",e),"error"}}inViewRealm(t){return(0,a.inViewRealm)(this.island,()=>t(this.island))}processModelViewEvents(){return this.island?this.island.processModelViewEvents():0}timeFromReflector(t,e="reflector"){t<this.time?("controller"!==e||y.ticks)&&console.warn(`time is ${this.time}, ignoring time ${t} from ${e}`):("boolean"!=typeof this.synced&&(this.synced=!1),this.time=t,this.island&&s.Stats.backlog(this.backlog))}multiplyTick(t){this.localTicker&&window.clearInterval(this.localTicker);const{tick:e,multiplier:s}=this.tickMultiplier,i=e/s;let n=1;this.localTicker=window.setInterval(()=>{this.timeFromReflector(t+n*i,"controller"),y.ticks&&console.log(this.id,"Controller generate TICK "+this.time,n),++n>=s&&(window.clearInterval(this.localTicker),this.localTicker=0)},i)}}exports.default=E;const M=100,R=100,I=2e4;class P{constructor(t){this.controller=t,this.connectBlocked=!1,this.connectRestricted=!1,this.connectHasBeenCalled=!1,this.setUpConnectionPromise()}setUpConnectionPromise(){this.connectionPromise=new Promise(t=>this.resolveConnection=t)}get connected(){return this.socket&&this.socket.readyState===WebSocket.OPEN}checkForConnection(t){this.socket||this.connectHasBeenCalled||this.connectBlocked||this.connectRestricted&&!t||this.connectToReflector()}async connectToReflector(){this.connectHasBeenCalled=!0,this.connectBlocked=!1,this.connectRestricted=!1;let t=i.default.reflector||w;if(!t.match(/^wss?:/))throw Error("Cannot interpret reflector address "+t);return t.endsWith("/")||(t+="/"),new Promise(e=>{const i=Object.assign(new WebSocket(`${t}${this.controller.id}`),{onopen:t=>{this.socket=i,y.session&&console.log(this.socket.constructor.name,"connected to",this.socket.url),s.Stats.connected(!0),this.resolveConnection(null),e()},onmessage:t=>{this.receive(t.data)},onerror:t=>{(0,o.displayError)("Connection error"),console.log(i.constructor.name,"error")},onclose:t=>{const e=1e3!==t.code&&t.code<4100,n=4110===t.code;n||(0,o.displayError)(`Connection closed: ${t.code} ${t.reason}`,{duration:e?void 0:36e5}),y.session&&console.log(i.constructor.name,"closed:",t.code,t.reason),s.Stats.connected(!1),n?this.connectRestricted=!0:this.connectBlocked=!0,this.disconnected(!0),e&&((0,o.displayWarning)("Reconnecting ..."),window.setTimeout(()=>this.connectToReflector(),2e3))}})})}disconnected(t){this.socket&&(this.socket=null,this.lastReceived=0,this.lastSent=0,this.connectHasBeenCalled=!1,this.setUpConnectionPromise(),this.controller.leave(t))}send(t){this.lastSent=Date.now(),this.socket.send(t)}receive(t){this.lastReceived=Date.now();const{id:e,action:s,args:i}=JSON.parse(t);if(e)try{this.controller.receive(s,i)}catch(n){this.closeConnectionWithError("receive",n)}else switch(s){case"PONG":y.pong&&console.log("PONG after",Date.now()-i,"ms");break;default:console.warn("Unknown action",s)}}dormantDisconnect(){this.connected&&(console.log("dormant; disconnecting from reflector"),this.socket.close(4110,"Going dormant"))}closeConnectionWithError(t,e){console.error(e),console.warn("closing socket"),this.socket.close(4e3,"Error in "+t)}PING(){this.connected&&(this.socket.bufferedAmount?console.log(`Reflector connection stalled: ${this.socket.bufferedAmount} bytes unsent`):this.send(JSON.stringify({action:"PING",args:Date.now()})))}PULSE(){this.connected&&(this.socket.bufferedAmount&&console.log(`Reflector connection stalled: ${this.socket.bufferedAmount} bytes unsent`),this.send(JSON.stringify({action:"PULSE"})))}keepAlive(){0!==this.lastReceived&&(Date.now()-this.lastReceived>M?this.PING():Date.now()-this.lastSent>I&&this.PULSE())}}window.setInterval(()=>{for(const t of N)t.connected&&t.connection.keepAlive()},100);
},{"fast-json-stable-stringify":"YlCk","@croquet/util/deduplicate":"M1T5","@croquet/util/asyncQueue":"XQ2t","@croquet/util/stats":"ISxG","@croquet/util/urlOptions":"zPnd","@croquet/util/user":"5BG1","@croquet/util/html":"vYkp","@croquet/util/modules":"uCN1","./realms":"QEgO","./domain":"IfYm","./island":"dCl0","pako":"a5qV"}],"r2GL":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.startSession=c,Object.defineProperty(exports,"App",{enumerable:!0,get:function(){return e.App}}),Object.defineProperty(exports,"Model",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(exports,"View",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(exports,"Controller",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(exports,"currentRealm",{enumerable:!0,get:function(){return u.currentRealm}}),Object.defineProperty(exports,"QFunc",{enumerable:!0,get:function(){return l.QFunc}}),Object.defineProperty(exports,"gatherInternalClassTypes",{enumerable:!0,get:function(){return l.gatherInternalClassTypes}}),exports.Constants=void 0;var e=require("@croquet/util/html"),t=require("@croquet/util/stats"),n=a(require("@croquet/util/urlOptions")),r=require("@croquet/util/modules"),o=a(require("./src/model")),i=a(require("./src/view")),s=a(require("./src/controller")),u=require("./src/realms"),l=require("./src/island");function a(e){return e&&e.__esModule?e:{default:e}}async function c(t,r=o.default,u=i.default,l){function a(e,t){return e===t||e.prototype instanceof t}if("string"!=typeof t?t=JSON.stringify(t)||"undefined":t||(t="unnamed"),!a(r,o.default))throw Error("ModelRoot must inherit from Croquet.Model");if(!a(u,i.default)){if(!u||Object.getPrototypeOf(u)!==Object.prototype||void 0!==l)throw Error("ViewRoot must inherit from Croquet.View");l=u,u=i.default}l||(l={});const c=n.default.reflector||l.reflector;if(c&&(c.includes("://")?n.default.reflector=c:console.warn(`Not a valid websocket url, ignoring reflector "${c}"`)),l.debug){function d(e){return"string"==typeof e&&(e=e.split(",")),e?Array.isArray(e)?e:[e]:[]}n.default.debug=[...d(l.debug),...d(n.default.debug)].join(",")}let f=null;"autoSleep"in l&&(n.default.autoSleep=l.autoSleep),setInterval(()=>{if("hidden"===document.visibilityState)if(!1===n.default.autoSleep)b(performance.now(),w,v.view);else{const e=Date.now();f?e-f>1e4&&w.dormantDisconnect():f=e}else f=null},1e3);const p=["tps"],m=["optionsFromUrl","login","autoSession"];g();const w=new s.default,y={};for(const[e,n]of Object.entries(l))p.includes(e)&&(y[e]=n);const v={id:"",model:null,view:null,step(e){"hidden"!==document.visibilityState&&(f=null,b(e,w,v.view))}};if(await async function n(r){!function(){v.model=null,v.view&&(v.view.detach(),v.view=null);e.App.clearSessionMoniker()}();const o={snapshot:r,init:h,destroyerFn:n,options:y};for(const[e,t]of Object.entries(l))m.includes(e)&&(o[e]=t);v.model=(await w.establishSession(t,o)).modelRoot;v.id=w.id;e.App.makeSessionWidgets(v.id);w.inViewRealm(()=>{v.view=new u(v.model)})}(),"manual"!==l.step){const e=t=>{v.step(t),window.requestAnimationFrame(e)};window.requestAnimationFrame(e)}return v;function h(e){return{modelRoot:r.create(e,"modelRoot")}}}const d=200,f=[0],p=4,m=p*(1e3/60);function b(e,n,r){n.checkForConnection(!0);const{backlog:o,latency:i,starvation:s,activity:u}=n;if(t.Stats.animationFrame(e,{backlog:o,starvation:s,latency:i,activity:u,users:n.users}),!n.island)return;const l=Date.now(),a=f.reduce((e,t)=>e+t,0)/f.length;n.simulate(l+Math.min(a,d)),n.backlog>m&&n.simulate(l+d-a),f.push(Date.now()-l),f.length>p&&f.shift(),t.Stats.begin("update"),n.processModelViewEvents(),t.Stats.end("update"),r&&(t.Stats.begin("render"),r.update(e),t.Stats.end("render"))}const w={};function y(e){if(!Object.isFrozen(e)){Object.freeze(e);for(const t of Object.values(e))!t||"object"!=typeof t&&"function"!=typeof t||y(t)}}function g(){Object.isFrozen(w)||(y(w),(0,r.addConstantsHash)(w))}exports.Constants=w;
},{"@croquet/util/html":"vYkp","@croquet/util/stats":"ISxG","@croquet/util/urlOptions":"zPnd","@croquet/util/modules":"uCN1","./src/model":"QjFl","./src/view":"Sudw","./src/controller":"jwRz","./src/realms":"QEgO","./src/island":"dCl0"}],"Zs62":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"Model",{enumerable:!0,get:function(){return e.Model}}),Object.defineProperty(exports,"View",{enumerable:!0,get:function(){return e.View}}),Object.defineProperty(exports,"ObservableModel",{enumerable:!0,get:function(){return e.ObservableModel}}),Object.defineProperty(exports,"Constants",{enumerable:!0,get:function(){return e.Constants}}),Object.defineProperty(exports,"QFunc",{enumerable:!0,get:function(){return e.QFunc}}),Object.defineProperty(exports,"App",{enumerable:!0,get:function(){return e.App}}),Object.defineProperty(exports,"startSession",{enumerable:!0,get:function(){return e.startSession}});var e=require("@croquet/teatime");
},{"@croquet/teatime":"r2GL"}]},{},["Zs62"], "Croquet")
//# sourceMappingURL=croquet-0.2.5.min.js.map