@croquet/microverse-library
Version:
An npm package version of Microverse
18 lines (15 loc) • 4.04 MB
JavaScript
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "./node_modules/@croquet/croquet/cjs/croquet-croquet.js":
/*!**************************************************************!*\
!*** ./node_modules/@croquet/croquet/cjs/croquet-croquet.js ***!
\**************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
/**
* Copyright Croquet Labs 2025
* Bundle of @croquet/croquet
* Date: 2025-06-05
* Version: 2.0.3
*/
var e=__webpack_require__(/*! toastify-js */ "./node_modules/toastify-js/src/toastify.js"),t=__webpack_require__(/*! fast-json-stable-stringify */ "./node_modules/fast-json-stable-stringify/index.js"),s=__webpack_require__(/*! fastpriorityqueue */ "./node_modules/fastpriorityqueue/FastPriorityQueue.js"),n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof __webpack_require__.g?__webpack_require__.g:"undefined"!=typeof self?self:{};function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var o,r={exports:{}};o||(o=1,function(e){var t=function(e){var t,s=Object.prototype,n=s.hasOwnProperty,i=Object.defineProperty||function(e,t,s){e[t]=s.value},o="function"==typeof Symbol?Symbol:{},r=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(e,t,s){return Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,s){return e[t]=s}}function d(e,t,s,n){var o=t&&t.prototype instanceof y?t:y,r=Object.create(o.prototype),a=new k(n||[]);return i(r,"_invoke",{value:G(e,s,a)}),r}function h(e,t,s){try{return{type:"normal",arg:e.call(t,s)}}catch(e){return{type:"throw",arg:e}}}e.wrap=d;var u="suspendedStart",m="suspendedYield",p="executing",f="completed",b={};function y(){}function g(){}function w(){}var Z={};c(Z,r,(function(){return this}));var v=Object.getPrototypeOf,X=v&&v(v(P([])));X&&X!==s&&n.call(X,r)&&(Z=X);var x=w.prototype=y.prototype=Object.create(Z);function L(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function s(i,o,r,a){var l=h(e[i],e,o);if("throw"!==l.type){var c=l.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){s("next",e,r,a)}),(function(e){s("throw",e,r,a)})):t.resolve(d).then((function(e){c.value=e,r(c)}),(function(e){return s("throw",e,r,a)}))}a(l.arg)}var o;i(this,"_invoke",{value:function(e,n){function i(){return new t((function(t,i){s(e,n,t,i)}))}return o=o?o.then(i,i):i()}})}function G(e,s,n){var i=u;return function(o,r){if(i===p)throw new Error("Generator is already running");if(i===f){if("throw"===o)throw r;return{value:t,done:!0}}for(n.method=o,n.arg=r;;){var a=n.delegate;if(a){var l=W(a,n);if(l){if(l===b)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===u)throw i=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=p;var c=h(e,s,n);if("normal"===c.type){if(i=n.done?f:m,c.arg===b)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=f,n.method="throw",n.arg=c.arg)}}}function W(e,s){var n=s.method,i=e.iterator[n];if(i===t)return s.delegate=null,"throw"===n&&e.iterator.return&&(s.method="return",s.arg=t,W(e,s),"throw"===s.method)||"return"!==n&&(s.method="throw",s.arg=new TypeError("The iterator does not provide a '"+n+"' method")),b;var o=h(i,e.iterator,s.arg);if("throw"===o.type)return s.method="throw",s.arg=o.arg,s.delegate=null,b;var r=o.arg;return r?r.done?(s[e.resultName]=r.value,s.next=e.nextLoc,"return"!==s.method&&(s.method="next",s.arg=t),s.delegate=null,b):r:(s.method="throw",s.arg=new TypeError("iterator result is not an object"),s.delegate=null,b)}function T(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function P(e){if(null!=e){var s=e[r];if(s)return s.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function s(){for(;++i<e.length;)if(n.call(e,i))return s.value=e[i],s.done=!1,s;return s.value=t,s.done=!0,s};return o.next=o}}throw new TypeError(typeof e+" is not iterable")}return g.prototype=w,i(x,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:g,configurable:!0}),g.displayName=c(w,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,c(e,l,"GeneratorFunction")),e.prototype=Object.create(x),e},e.awrap=function(e){return{__await:e}},L(S.prototype),c(S.prototype,a,(function(){return this})),e.AsyncIterator=S,e.async=function(t,s,n,i,o){void 0===o&&(o=Promise);var r=new S(d(t,s,n,i),o);return e.isGeneratorFunction(s)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},L(x),c(x,l,"Generator"),c(x,r,(function(){return this})),c(x,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),s=[];for(var n in t)s.push(n);return s.reverse(),function e(){for(;s.length;){var n=s.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=P,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var s in this)"t"===s.charAt(0)&&n.call(this,s)&&!isNaN(+s.slice(1))&&(this[s]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var s=this;function i(n,i){return a.type="throw",a.arg=e,s.next=n,i&&(s.method="next",s.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var r=this.tryEntries[o],a=r.completion;if("root"===r.tryLoc)return i("end");if(r.tryLoc<=this.prev){var l=n.call(r,"catchLoc"),c=n.call(r,"finallyLoc");if(l&&c){if(this.prev<r.catchLoc)return i(r.catchLoc,!0);if(this.prev<r.finallyLoc)return i(r.finallyLoc)}else if(l){if(this.prev<r.catchLoc)return i(r.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return i(r.finallyLoc)}}}},abrupt:function(e,t){for(var s=this.tryEntries.length-1;s>=0;--s){var i=this.tryEntries[s];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=e,r.arg=t,o?(this.method="next",this.next=o.finallyLoc,b):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),b},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var s=this.tryEntries[t];if(s.finallyLoc===e)return this.complete(s.completion,s.afterLoc),C(s),b}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var s=this.tryEntries[t];if(s.tryLoc===e){var n=s.completion;if("throw"===n.type){var i=n.arg;C(s)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,s,n){return this.delegate={iterator:P(e),resultName:s,nextLoc:n},"next"===this.method&&(this.arg=t),b}},e}(e.exports);try{globalThis.regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(r));const a={CROQUET_VERSION:"2.0.3"},l=window&&window.location.hostname.endsWith("croquet.studio");let c="",d="";function h(e,t){if(t)for(const s of t.split("&")){const t=s.split("="),n=t[0];let i=!0;if(t.length>1&&(i=decodeURIComponent(t.slice(1).join("=")),i.match(/^(true|false|null|[0-9.]*|["[{].*)$/)))try{i=JSON.parse(i)}catch(e){"["===i[0]&&(i=i.slice(1,-1).split(","))}e[n]=i}}const u=new class{constructor(){this.getSession(),h(this,window.location.search.slice(1)),h(this,l?window.location.hash.slice(1):d),window.location.pathname.indexOf("/ar.html")>=0&&(this.ar=!0)}has(e,t){let s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];"string"==typeof s&&(s=this.isHost(s));const n=this[e];if("string"!=typeof n)return s;const i=n.split(",");return!0===s&&(t=`no${t}`),t.endsWith("s")&&(t=t.slice(0,-1)),i.includes(t)||i.includes(`${t}s`)?!s:s}getSession(){if(l){const e=/^\/([^/]+)\/(.*)$/,t=window.location.pathname.match(e);if(t)return c=t[1],t[2]}else{const e=/^#([^&]+)&?(.*)$/,t=window.location.hash.match(e);if(t)return t[1].includes("=")?(d=`${t[1]}&${t[2]}`,""):(d=t[2],t[1])}return"string"==typeof this.session?(d=window.location.hash.slice(1),this.session):""}setSession(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];null==l&&this.getSession();const{search:s,hash:n}=window.location,i=l?`/${c}/${e}${s}${n}`:`#${e}${d?"&"+d:""}`;t?window.history.replaceState({},"",i):window.history.pushState({},"",i)}isHost(e){const t=window.location.hostname;if(t===e)return!0;if("localhost"!==e)return!1;if(t.endsWith(".ngrok.io"))return!0;if("croquet.io"===t){if(window.location.pathname.match(/^\/(dev|files)\//))return!0}return"file:"===window.location.protocol||["127.0.0.1","[::1]"].includes(t)}isLocalhost(){return this.isHost("localhost")}};var m,p={exports:{}};var f,b,y=(m||(m=1,f=p,function(e,t,s){var n,i=256,o="random",r=s.pow(i,6),a=s.pow(2,52),l=2*a,c=255;function d(c,d,f){var y=[],g=p(m((d=1==d?{entropy:!0}:d||{}).entropy?[c,b(t)]:null==c?function(){try{var s;return n&&(s=n.randomBytes)?s=s(i):(s=new Uint8Array(i),(e.crypto||e.msCrypto).getRandomValues(s)),b(s)}catch(s){var o=e.navigator,r=o&&o.plugins;return[+new Date,e,r,e.screen,b(t)]}}():c,3),y),w=new h(y),Z=function(){for(var e=w.g(6),t=r,s=0;e<a;)e=(e+s)*i,t*=i,s=w.g(1);for(;e>=l;)e/=2,t/=2,s>>>=1;return(e+s)/t};return Z.int32=function(){return 0|w.g(4)},Z.quick=function(){return w.g(4)/4294967296},Z.double=Z,p(b(w.S),t),(d.pass||f||function(e,t,n,i){return i&&(i.S&&u(i,w),e.state=function(){return u(w,{})}),n?(s[o]=e,t):e})(Z,g,"global"in d?d.global:this==s,d.state)}function h(e){var t,s=e.length,n=this,o=0,r=n.i=n.j=0,a=n.S=[];for(s||(e=[s++]);o<i;)a[o]=o++;for(o=0;o<i;o++)a[o]=a[r=c&r+e[o%s]+(t=a[o])],a[r]=t;(n.g=function(e){for(var t,s=0,o=n.i,r=n.j,a=n.S;e--;)t=a[o=c&o+1],s=s*i+a[c&(a[o]=a[r=c&r+t])+(a[r]=t)];return n.i=o,n.j=r,s})(i)}function u(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function m(e,t){var s,n=[],i=typeof e;if(t&&"object"==i)for(s in e)try{n.push(m(e[s],t-1))}catch(e){}return n.length?n:"string"==i?e:e+"\0"}function p(e,t){for(var s,n=e+"",i=0;i<n.length;)t[c&i]=c&(s^=19*t[c&i])+n.charCodeAt(i++);return b(t)}function b(e){return String.fromCharCode.apply(0,e)}if(p(s.random(),t),f.exports){f.exports=d;try{n=undefined}catch(e){}}else s["seed"+o]=d}("undefined"!=typeof self?self:p.exports,[],Math)),p.exports),g=i(y);!function(){function e(e){this.mode=s.MODE_8BIT_BYTE,this.data=e,this.parsedData=[];for(var t=0,n=this.data.length;t<n;t++){var i=[],o=this.data.charCodeAt(t);o>65536?(i[0]=240|(1835008&o)>>>18,i[1]=128|(258048&o)>>>12,i[2]=128|(4032&o)>>>6,i[3]=128|63&o):o>2048?(i[0]=224|(61440&o)>>>12,i[1]=128|(4032&o)>>>6,i[2]=128|63&o):o>128?(i[0]=192|(1984&o)>>>6,i[1]=128|63&o):i[0]=o,this.parsedData.push(i)}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 t(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}e.prototype={getLength:function(e){return this.parsedData.length},write:function(e){for(var t=0,s=this.parsedData.length;t<s;t++)e.put(this.parsedData[t],8)}},t.prototype={addData:function(t){var s=new e(t);this.dataList.push(s),this.dataCache=null},isDark:function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw new Error(e+","+t);return this.modules[e][t]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(e,s){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var n=0;n<this.moduleCount;n++){this.modules[n]=new Array(this.moduleCount);for(var i=0;i<this.moduleCount;i++)this.modules[n][i]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(e,s),this.typeNumber>=7&&this.setupTypeNumber(e),null==this.dataCache&&(this.dataCache=t.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,s)},setupPositionProbePattern:function(e,t){for(var s=-1;s<=7;s++)if(!(e+s<=-1||this.moduleCount<=e+s))for(var n=-1;n<=7;n++)t+n<=-1||this.moduleCount<=t+n||(this.modules[e+s][t+n]=0<=s&&s<=6&&(0==n||6==n)||0<=n&&n<=6&&(0==s||6==s)||2<=s&&s<=4&&2<=n&&n<=4)},getBestMaskPattern:function(){for(var e=0,t=0,s=0;s<8;s++){this.makeImpl(!0,s);var n=u.getLostPoint(this);(0==s||e>n)&&(e=n,t=s)}return t},createMovieClip:function(e,t,s){var n=e.createEmptyMovieClip(t,s);this.make();for(var i=0;i<this.modules.length;i++)for(var o=1*i,r=0;r<this.modules[i].length;r++){var a=1*r;this.modules[i][r]&&(n.beginFill(0,100),n.moveTo(a,o),n.lineTo(a+1,o),n.lineTo(a+1,o+1),n.lineTo(a,o+1),n.endFill())}return n},setupTimingPattern:function(){for(var e=8;e<this.moduleCount-8;e++)null==this.modules[e][6]&&(this.modules[e][6]=e%2==0);for(var t=8;t<this.moduleCount-8;t++)null==this.modules[6][t]&&(this.modules[6][t]=t%2==0)},setupPositionAdjustPattern:function(){for(var e=u.getPatternPosition(this.typeNumber),t=0;t<e.length;t++)for(var s=0;s<e.length;s++){var n=e[t],i=e[s];if(null==this.modules[n][i])for(var o=-2;o<=2;o++)for(var r=-2;r<=2;r++)this.modules[n+o][i+r]=-2==o||2==o||-2==r||2==r||0==o&&0==r}},setupTypeNumber:function(e){for(var t=u.getBCHTypeNumber(this.typeNumber),s=0;s<18;s++){var n=!e&&1==(t>>s&1);this.modules[Math.floor(s/3)][s%3+this.moduleCount-8-3]=n}for(s=0;s<18;s++){n=!e&&1==(t>>s&1);this.modules[s%3+this.moduleCount-8-3][Math.floor(s/3)]=n}},setupTypeInfo:function(e,t){for(var s=this.errorCorrectLevel<<3|t,n=u.getBCHTypeInfo(s),i=0;i<15;i++){var o=!e&&1==(n>>i&1);i<6?this.modules[i][8]=o:i<8?this.modules[i+1][8]=o:this.modules[this.moduleCount-15+i][8]=o}for(i=0;i<15;i++){o=!e&&1==(n>>i&1);i<8?this.modules[8][this.moduleCount-i-1]=o:i<9?this.modules[8][15-i-1+1]=o:this.modules[8][15-i-1]=o}this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var s=-1,n=this.moduleCount-1,i=7,o=0,r=this.moduleCount-1;r>0;r-=2)for(6==r&&r--;;){for(var a=0;a<2;a++)if(null==this.modules[n][r-a]){var l=!1;o<e.length&&(l=1==(e[o]>>>i&1)),u.getMask(t,n,r-a)&&(l=!l),this.modules[n][r-a]=l,-1==--i&&(o++,i=7)}if((n+=s)<0||this.moduleCount<=n){n-=s,s=-s;break}}}},t.PAD0=236,t.PAD1=17,t.createData=function(e,s,n){for(var i=y.getRSBlocks(e,s),o=new g,r=0;r<n.length;r++){var a=n[r];o.put(a.mode,4),o.put(a.getLength(),u.getLengthInBits(a.mode,e)),a.write(o)}var l=0;for(r=0;r<i.length;r++)l+=i[r].dataCount;if(o.getLengthInBits()>8*l)throw new Error("code length overflow. ("+o.getLengthInBits()+">"+8*l+")");for(o.getLengthInBits()+4<=8*l&&o.put(0,4);o.getLengthInBits()%8!=0;)o.putBit(!1);for(;!(o.getLengthInBits()>=8*l||(o.put(t.PAD0,8),o.getLengthInBits()>=8*l));)o.put(t.PAD1,8);return t.createBytes(o,i)},t.createBytes=function(e,t){for(var s=0,n=0,i=0,o=new Array(t.length),r=new Array(t.length),a=0;a<t.length;a++){var l=t[a].dataCount,c=t[a].totalCount-l;n=Math.max(n,l),i=Math.max(i,c),o[a]=new Array(l);for(var d=0;d<o[a].length;d++)o[a][d]=255&e.buffer[d+s];s+=l;var h=u.getErrorCorrectPolynomial(c),m=new f(o[a],h.getLength()-1).mod(h);r[a]=new Array(h.getLength()-1);for(d=0;d<r[a].length;d++){var p=d+m.getLength()-r[a].length;r[a][d]=p>=0?m.get(p):0}}var b=0;for(d=0;d<t.length;d++)b+=t[d].totalCount;var y=new Array(b),g=0;for(d=0;d<n;d++)for(a=0;a<t.length;a++)d<o[a].length&&(y[g++]=o[a][d]);for(d=0;d<i;d++)for(a=0;a<t.length;a++)d<r[a].length&&(y[g++]=r[a][d]);return y};for(var s={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,o=1,r=2,a=3,l=4,c=5,d=6,h=7,u={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(e){for(var t=e<<10;u.getBCHDigit(t)-u.getBCHDigit(u.G15)>=0;)t^=u.G15<<u.getBCHDigit(t)-u.getBCHDigit(u.G15);return(e<<10|t)^u.G15_MASK},getBCHTypeNumber:function(e){for(var t=e<<12;u.getBCHDigit(t)-u.getBCHDigit(u.G18)>=0;)t^=u.G18<<u.getBCHDigit(t)-u.getBCHDigit(u.G18);return e<<12|t},getBCHDigit:function(e){for(var t=0;0!=e;)t++,e>>>=1;return t},getPatternPosition:function(e){return u.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,s){switch(e){case i:return(t+s)%2==0;case o:return t%2==0;case r:return s%3==0;case a:return(t+s)%3==0;case l:return(Math.floor(t/2)+Math.floor(s/3))%2==0;case c:return t*s%2+t*s%3==0;case d:return(t*s%2+t*s%3)%2==0;case h:return(t*s%3+(t+s)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new f([1],0),s=0;s<e;s++)t=t.multiply(new f([1,m.gexp(s)],0));return t},getLengthInBits:function(e,t){if(1<=t&&t<10)switch(e){case s.MODE_NUMBER:return 10;case s.MODE_ALPHA_NUM:return 9;case s.MODE_8BIT_BYTE:case s.MODE_KANJI:return 8;default:throw new Error("mode:"+e)}else if(t<27)switch(e){case s.MODE_NUMBER:return 12;case s.MODE_ALPHA_NUM:return 11;case s.MODE_8BIT_BYTE:return 16;case s.MODE_KANJI:return 10;default:throw new Error("mode:"+e)}else{if(!(t<41))throw new Error("type:"+t);switch(e){case s.MODE_NUMBER:return 14;case s.MODE_ALPHA_NUM:return 13;case s.MODE_8BIT_BYTE:return 16;case s.MODE_KANJI:return 12;default:throw new Error("mode:"+e)}}},getLostPoint:function(e){for(var t=e.getModuleCount(),s=0,n=0;n<t;n++)for(var i=0;i<t;i++){for(var o=0,r=e.isDark(n,i),a=-1;a<=1;a++)if(!(n+a<0||t<=n+a))for(var l=-1;l<=1;l++)i+l<0||t<=i+l||0==a&&0==l||r==e.isDark(n+a,i+l)&&o++;o>5&&(s+=3+o-5)}for(n=0;n<t-1;n++)for(i=0;i<t-1;i++){var c=0;e.isDark(n,i)&&c++,e.isDark(n+1,i)&&c++,e.isDark(n,i+1)&&c++,e.isDark(n+1,i+1)&&c++,0!=c&&4!=c||(s+=3)}for(n=0;n<t;n++)for(i=0;i<t-6;i++)e.isDark(n,i)&&!e.isDark(n,i+1)&&e.isDark(n,i+2)&&e.isDark(n,i+3)&&e.isDark(n,i+4)&&!e.isDark(n,i+5)&&e.isDark(n,i+6)&&(s+=40);for(i=0;i<t;i++)for(n=0;n<t-6;n++)e.isDark(n,i)&&!e.isDark(n+1,i)&&e.isDark(n+2,i)&&e.isDark(n+3,i)&&e.isDark(n+4,i)&&!e.isDark(n+5,i)&&e.isDark(n+6,i)&&(s+=40);var d=0;for(i=0;i<t;i++)for(n=0;n<t;n++)e.isDark(n,i)&&d++;return s+=10*(Math.abs(100*d/t/t-50)/5)}},m={glog:function(e){if(e<1)throw new Error("glog("+e+")");return m.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return m.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},p=0;p<8;p++)m.EXP_TABLE[p]=1<<p;for(p=8;p<256;p++)m.EXP_TABLE[p]=m.EXP_TABLE[p-4]^m.EXP_TABLE[p-5]^m.EXP_TABLE[p-6]^m.EXP_TABLE[p-8];for(p=0;p<255;p++)m.LOG_TABLE[m.EXP_TABLE[p]]=p;function f(e,t){if(null==e.length)throw new Error(e.length+"/"+t);for(var s=0;s<e.length&&0==e[s];)s++;this.num=new Array(e.length-s+t);for(var n=0;n<e.length-s;n++)this.num[n]=e[n+s]}function y(e,t){this.totalCount=e,this.dataCount=t}function g(){this.buffer=[],this.length=0}f.prototype={get:function(e){return this.num[e]},getLength:function(){return this.num.length},multiply:function(e){for(var t=new Array(this.getLength()+e.getLength()-1),s=0;s<this.getLength();s++)for(var n=0;n<e.getLength();n++)t[s+n]^=m.gexp(m.glog(this.get(s))+m.glog(e.get(n)));return new f(t,0)},mod:function(e){if(this.getLength()-e.getLength()<0)return this;for(var t=m.glog(this.get(0))-m.glog(e.get(0)),s=new Array(this.getLength()),n=0;n<this.getLength();n++)s[n]=this.get(n);for(n=0;n<e.getLength();n++)s[n]^=m.gexp(m.glog(e.get(n))+t);return new f(s,0).mod(e)}},y.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]],y.getRSBlocks=function(e,t){var s=y.getRsBlockTable(e,t);if(null==s)throw new Error("bad rs block @ typeNumber:"+e+"/errorCorrectLevel:"+t);for(var n=s.length/3,i=[],o=0;o<n;o++)for(var r=s[3*o+0],a=s[3*o+1],l=s[3*o+2],c=0;c<r;c++)i.push(new y(a,l));return i},y.getRsBlockTable=function(e,t){switch(t){case n.L:return y.RS_BLOCK_TABLE[4*(e-1)+0];case n.M:return y.RS_BLOCK_TABLE[4*(e-1)+1];case n.Q:return y.RS_BLOCK_TABLE[4*(e-1)+2];case n.H:return y.RS_BLOCK_TABLE[4*(e-1)+3];default:return}},g.prototype={get:function(e){var t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(var s=0;s<t;s++)this.putBit(1==(e>>>t-s-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var w=[[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]],Z=function(){var e=function(e,t){this._bIsPainted=!1,this._htOption=t,this._elCanvas=document.createElement("canvas"),this._elCanvas.width=t.width,this._elCanvas.height=t.height,e.appendChild(this._elCanvas),this._el=e,this._oContext=this._elCanvas.getContext("2d"),this._bIsPainted=!1,this._bSupportDataURI=null};return e.prototype.draw=function(e){var t=this._oContext,s=this._htOption,n=e.getModuleCount(),i=s.width/n,o=s.height/n,r=Math.round(i),a=Math.round(o);this.clear();for(var l=0;l<n;l++)for(var c=0;c<n;c++){var d=e.isDark(l,c),h=c*i,u=l*o;t.strokeStyle=d?s.colorDark:s.colorLight,t.lineWidth=1,t.fillStyle=d?s.colorDark:s.colorLight,t.fillRect(h,u,i,o),t.strokeRect(Math.floor(h)+.5,Math.floor(u)+.5,r,a),t.strokeRect(Math.ceil(h)-.5,Math.ceil(u)-.5,r,a)}this._bIsPainted=!0},e.prototype.isPainted=function(){return this._bIsPainted},e.prototype.clear=function(){this._oContext.clearRect(0,0,this._elCanvas.width,this._elCanvas.height),this._bIsPainted=!1},e.prototype.round=function(e){return e?Math.floor(1e3*e)/1e3:e},e}();function v(e,t){for(var s=1,i=function(e){var t=encodeURI(e).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return t.length+(t.length!=e?3:0)}(e),o=0,r=w.length;o<=r;o++){var a=0;switch(t){case n.L:a=w[o][0];break;case n.M:a=w[o][1];break;case n.Q:a=w[o][2];break;case n.H:a=w[o][3]}if(i<=a)break;s++}if(s>w.length)throw new Error("Too long data");return s}b=function(e,t){if(this._htOption={width:256,height:256,typeNumber:4,colorDark:"#000000",colorLight:"#ffffff",correctLevel:n.H},"string"==typeof t&&(t={text:t}),t)for(var s in t)this._htOption[s]=t[s];"string"==typeof e&&(e=document.getElementById(e)),this._htOption.useSVG&&(Z=svgDrawer),this._el=e,this._oQRCode=null,this._oDrawing=new Z(this._el,this._htOption),this._htOption.text&&this.makeCode(this._htOption.text)},b.prototype.makeCode=function(e){this._oQRCode=new t(v(e,this._htOption.correctLevel),this._htOption.correctLevel),this._oQRCode.addData(e),this._oQRCode.make(),this._oDrawing.draw(this._oQRCode)},b.prototype.clear=function(){this._oDrawing.clear()},b.prototype.getCanvas=function(){for(let e=0;e<this._el.children.length;e++){const t=this._el.children[e];if("CANVAS"===t.tagName)return t}return null},b.CorrectLevel=n}();var w=b,Z={exports:{}};var v,X={exports:{}};function x(){return v||(v=1,X.exports=(e=e||function(e,t){var s;if("undefined"!=typeof window&&window.crypto&&(s=window.crypto),"undefined"!=typeof self&&self.crypto&&(s=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(s=globalThis.crypto),!s&&"undefined"!=typeof window&&window.msCrypto&&(s=window.msCrypto),!s&&void 0!==n&&n.crypto&&(s=n.crypto),!s)try{s=__webpack_require__(/*! crypto */ "?985c")}catch(e){}var i=function(){if(s){if("function"==typeof s.getRandomValues)try{return s.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof s.randomBytes)try{return s.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var s;return e.prototype=t,s=new e,e.prototype=null,s}}(),r={},a=r.lib={},l=a.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},c=a.WordArray=l.extend({init:function(e,s){e=this.words=e||[],this.sigBytes=s!=t?s:4*e.length},toString:function(e){return(e||h).stringify(this)},concat:function(e){var t=this.words,s=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o<i;o++){var r=s[o>>>2]>>>24-o%4*8&255;t[n+o>>>2]|=r<<24-(n+o)%4*8}else for(var a=0;a<i;a+=4)t[n+a>>>2]=s[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,s=this.sigBytes;t[s>>>2]&=4294967295<<32-s%4*8,t.length=e.ceil(s/4)},clone:function(){var e=l.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],s=0;s<e;s+=4)t.push(i());return new c.init(t,e)}}),d=r.enc={},h=d.Hex={stringify:function(e){for(var t=e.words,s=e.sigBytes,n=[],i=0;i<s;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,s=[],n=0;n<t;n+=2)s[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new c.init(s,t/2)}},u=d.Latin1={stringify:function(e){for(var t=e.words,s=e.sigBytes,n=[],i=0;i<s;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,s=[],n=0;n<t;n++)s[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new c.init(s,t)}},m=d.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},p=a.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=m.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var s,n=this._data,i=n.words,o=n.sigBytes,r=this.blockSize,a=o/(4*r),l=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*r,d=e.min(4*l,o);if(l){for(var h=0;h<l;h+=r)this._doProcessBlock(i,h);s=i.splice(0,l),n.sigBytes-=d}return new c.init(s,d)},clone:function(){var e=l.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});a.Hasher=p.extend({cfg:l.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,s){return new e.init(s).finalize(t)}},_createHmacHelper:function(e){return function(t,s){return new f.HMAC.init(e,s).finalize(t)}}});var f=r.algo={};return r}(Math),e)),X.exports;var e}var L;var S,G,W=(L||(L=1,Z.exports=(S=x(),function(){if("function"==typeof ArrayBuffer){var e=S.lib.WordArray,t=e.init,s=e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var s=e.byteLength,n=[],i=0;i<s;i++)n[i>>>2]|=e[i]<<24-i%4*8;t.call(this,n,s)}else t.apply(this,arguments)};s.prototype=e}}(),S.lib.WordArray)),Z.exports),T=i(W),C={exports:{}};function k(){return G||(G=1,C.exports=function(e){return function(t){var s=e,n=s.lib,i=n.WordArray,o=n.Hasher,r=s.algo,a=[],l=[];!function(){function e(e){for(var s=t.sqrt(e),n=2;n<=s;n++)if(!(e%n))return!1;return!0}function s(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)e(n)&&(i<8&&(a[i]=s(t.pow(n,.5))),l[i]=s(t.pow(n,1/3)),i++),n++}();var c=[],d=r.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var s=this._hash.words,n=s[0],i=s[1],o=s[2],r=s[3],a=s[4],d=s[5],h=s[6],u=s[7],m=0;m<64;m++){if(m<16)c[m]=0|e[t+m];else{var p=c[m-15],f=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,b=c[m-2],y=(b<<15|b>>>17)^(b<<13|b>>>19)^b>>>10;c[m]=f+c[m-7]+y+c[m-16]}var g=n&i^n&o^i&o,w=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),Z=u+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&d^~a&h)+l[m]+c[m];u=h,h=d,d=a,a=r+Z|0,r=o,o=i,i=n,n=Z+(w+g)|0}s[0]=s[0]+n|0,s[1]=s[1]+i|0,s[2]=s[2]+o|0,s[3]=s[3]+r|0,s[4]=s[4]+a|0,s[5]=s[5]+d|0,s[6]=s[6]+h|0,s[7]=s[7]+u|0},_doFinalize:function(){var e=this._data,s=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return s[i>>>5]|=128<<24-i%32,s[14+(i+64>>>9<<4)]=t.floor(n/4294967296),s[15+(i+64>>>9<<4)]=n,e.sigBytes=4*s.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});s.SHA256=o._createHelper(d),s.HmacSHA256=o._createHmacHelper(d)}(Math),e.SHA256}(x())),C.exports}var P=i(k());const R="node"===a.CROQUET_PLATFORM;let I;function M(e){const t=e.sigBytes,s=e.words,n=new Uint8Array(t);let i=0,o=0;for(;i<t;){const e=s[o++];if(n[i++]=(4278190080&e)>>>24,i===t)break;if(n[i++]=(16711680&e)>>>16,i===t)break;if(n[i++]=(65280&e)>>>8,i===t)break;n[i++]=255&e}return n}function V(e){function t(e){const t=e.indexOf("{"),s=e.lastIndexOf("}");if(-1===t||-1===s||s<t)return e;const n=e.slice(0,t).replace(/\s+/g," ").replace(/\s\(/,"("),i=e.slice(t+1,s);return`${n.trim()}{${i.trim()}}`}let s=t(""+e);if(!s.startsWith("class")){const n=e.prototype;n&&(s+=Object.getOwnPropertyNames(n).map((e=>`${e}:${t(""+n[e])}`)).join(""))}return s}function Y(e){return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function H(){return u.has("debug","hashing",!1)}I=globalThis.crypto&&globalThis.crypto.subtle&&"function"==typeof globalThis.crypto.subtle.digest?globalThis.crypto.subtle.digest.bind(globalThis.crypto.subtle):(e,t)=>{if("SHA-256"!==e)throw Error(`${ze.libName}: only SHA-256 available`);const s=T.create(t);return M(P(s)).buffer};let K={};const N=new TextEncoder;async function z(e){const t=N.encode(e),s=await async function(e){return 0===e.length?"47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU":Y(await I("SHA-256",e))}(t);return K[s]={string:e,buffer:t},s}const _=[],F={};const E=new Set;const J=Date.now();"undefined"==typeof performance&&(window.performance={now:()=>Date.now()-J});const j=["simulate","update","render","snapshot"],Q={total:"black",update:"blue",render:"magenta",simulate:"yellow",snapshot:"green",backlog:"red",network:"lightgray"};let U,D,O=null,B=null,A=null,$=0,q=null,ee=null;function te(e){for(O=e;e.firstChild;)e.removeChild(e.firstChild);e.style.background="#faf0dc",q=document.createElement("canvas"),ee=q.getContext("2d"),q.id="text_stats",q.width=Math.min(140,window.innerWidth),q.height=36,q.style.width=q.width,q.style.height=q.height,ee.font="9.5pt sans-serif",e.appendChild(q),e.title=Object.entries(Q).map((e=>{let[t,s]=e;return`${s}: ${t}`})).join("\n"),B=document.createElement("canvas"),B.width=Math.min(125,window.innerWidth),B.height=125,B.style.width="100%";const t=document.createElement("div");t.id="innerDiv",e.appendChild(t),t.appendChild(B),A=B.getContext("2d")}const se=[];let ne=0,ie=!1,oe=ce(0);const re=1e3/60;function ae(e){return 20*(1-e/re)+60}function le(e){U=function(e){const t=document.createElement("canvas");return t.width=e.width,t.height=e.height,t.style.width="100%",t.style.position="absolute",t.style.left="0px",O.querySelector("#innerDiv").appendChild(t),t}(e),D=U.getContext("2d"),D.strokeStyle="rgba(255, 255, 255, 0.5)";for(let e=0;e<60;e+=re){const t=ae(e);D.moveTo(0,t),D.lineTo(U.width,t),D.stroke()}}function ce(e){return{start:e,total:0,items:{},users:0,backlog:0,network:0,latency:0,activity:1e3,connected:ie}}function de(e){oe.total=e-oe.start;const t=Math.min(120,window.innerWidth);if(se.length>=t&&se.splice(0,se.length-t+1),se.push(oe),se.length<=1)return;if(!O)return;if(0===O.offsetHeight)return;const s=se.slice(1).filter((e=>e.total)),n=s.map((e=>e.total)).reduce(((e,t)=>e+t),0)/s.length,i=Math.max(...s.map((e=>e.total)));Math.max(...s.map((e=>Math.max(e.backlog,e.network)))),ne=1e3,function(e,t){ee.globalCompositeOperation="copy",ee.fillStyle="rgb(255, 255, 255, 0)",ee.fillRect(0,0,q.width,q.height),ee.fillStyle="rgb(0, 0, 0, 1)",ee.globalCompositeOperation="source-over";let s=`${oe.users} users, ${Math.round(1e3/e)} fps`;t>70&&(s+=` ${Math.ceil(t).toLocaleString()}ms`),ee.fillText(s,2,15),s=oe.backlog<100&&oe.activity<1e3?`latency: ${oe.latency} ms`:`backlog: ${oe.backlog<100?"0.0":(oe.backlog/1e3).toFixed(1)} s`,ee.fillText(s,2,33)}(n,i),U||le(B),$===B.width?(A.globalCompositeOperation="copy",A.drawImage(B,1,0,B.width-1,B.height,0,0,B.width-1,B.height),A.globalCompositeOperation="source-over",A.fillStyle="transparent",A.fillRect(B.width-1,0,1,B.height)):$++;const o=e=>ae(e/ne*-2*re)+5;{const e=se[se.length-1],t=$-.5;let s=ae(0);A.beginPath(),A.moveTo(t,s),A.lineTo(t,ae(e.total)),A.strokeStyle=Q[e.connected?"total":"network"],A.stroke(),A.beginPath(),A.moveTo(t,s),s=ae(e.total);let n=0;for(const i of j)e.items[i]&&(n+=e.items[i],s=ae(n),A.lineTo(t,s),A.strokeStyle=Q[i],A.stroke(),A.beginPath(),A.moveTo(t,s));e.network&&(A.beginPath(),A.moveTo(t,o(0)),A.lineTo(t,o(e.network)),A.strokeStyle=Q.network,A.stroke())}}const he=[],ue={};let me={};const pe={frames:se,animationFrame(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};de(e),oe=ce(e);for(const[e,s]of Object.entries(t))this[e](s)},begin(e){const t=performance.now();oe.items[e]=(oe.items[e]||0)-t;const s=he[he.length-1];return s&&(oe.items[s]+=t),he.push(e),t},end(e){const t=performance.now();oe.items[e]+=t;const s=he.pop();if(s!==e)throw Error(`Unmatched stats calls: expected end("${s}"), got end("${e}")`);const n=he[he.length-1];return n&&(oe.items[n]-=t),t},backlog(e){oe.backlog=Math.max(e,oe.backlog)},starvation(e){oe.network=e},latency(e){oe.latency=e},activity(e){oe.activity=e},users(e){oe.users=e},connected(e){const t=ie;oe.connected=ie=e,t&&!ie&&U&&(U.remove(),D=null)},networkTraffic:ue,addNetworkTraffic(e,t){let s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];ue[e]=(ue[e]||0)+t,s&&(ue[`audit_${e}`]=(ue[`audit_${e}`]||0)+t)},resetAuditStats(){for(const e in ue)e.startsWith("audit_")&&(ue[e]=0)},perSecondTally(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(window.logMessageStats)for(const[t,s]of Object.entries(e))me[t]=(me[t]||0)+s},stepSession(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const s=Math.floor(Date.now()/1e3);if(!window.logMessageStats)return me={second:s},null;let n=null;if(s!==me.second){if(me.second&&t&&(me.requestedMessages||me.sentMessagesTotal)){n={...me};const e=s-me.second;1!==e&&(n.sampleSeconds=e),n.sentBundles&&(n.averageDelay=Math.round(10*n.sendDelay/n.sentMessagesTotal)/10,n.averageBundlePayload=Math.round(n.sentBundlePayload/n.sentBundles)),delete n.second,delete n.sendDelay,delete n.sentBundlePayload}me={second:s}}return n}};globalThis.CROQUETSTATS=pe;const fe="ontouchstart"in document.documentElement,be=window&&window.parent!==window,ye=fe?20:12,ge=fe?0:15;let we=!1;let Ze=!1;let ve,Xe=!1;function xe(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e&&ze.showMessage(e,{...t,level:"warning"})}function Le(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e&&ze.showMessage(e,{...t,level:"status"})}function Se(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"error";console.error(`Error during ${e}`,t);const n=(t.stack||"").split("\n").filter((e=>!e.match(/croquet-.*\.min.js/))).join("\n");ze.showMessage(`Error during ${e}: ${t.message}\n\n${n}`,{level:s,duration:"error"===s?1e4:void 0,stopOnFocus:!0})}try{if(ve=window.localStorage,ve["croquet-debug-persist-allowed"]="true","true"!==ve["croquet-debug-persist-allowed"])throw Error("localStorage not persisted");delete ve["croquet-debug-persist-allowed"]}catch(Vr){console.warn("localStorage not allowed"),ve={}}const Ge={get pinned(){return"true"===ve[window.location.pathname+"/croquet-debug-ui-pinned"]},set pinned(e){ve[window.location.pathname+"/croquet-debug-ui-pinned"]=!!e},get activePage(){return ve[window.location.pathname+"/croquet-debug-ui-activePage"]},set activePage(e){ve[window.location.pathname+"/croquet-debug-ui-activePage"]=e}},We=e=>{e.preventDefault(),e.stopPropagation()};function Te(e,t,s){const n=document.createElement("canvas"),i=n.width=40*ye/12,o=n.height=60,r=n.getContext("2d");r.font="36px Arial",r.textAlign="center",r.textBaseline="middle",r.fillStyle="black",r.fillText(e,i/2,.55*o);const a=document.createElement("button");a.id=t,a.className="croquet_dock_button";const l=e=>{e.preventDefault(),e.stopPropagation(),s()};return fe?(a.ontouchstart=l,a.ontouchend=We,a.onpointerdown=We,a.onpointerup=We):(a.onclick=l,a.onpointerdown=We,a.onpointerup=We),a.appendChild(n),a}function Ce(e,t){if(!1===ze.badge)return;const s=function(e){const t=new g(e),s=["bcdfghjklmnpqrstvwxyz","aeiou"];let n="";for(let e=0;e<5;e++)n+=s[e%2][t.quick()*s[e%2].length|0];return n}(t);for(document.title=document.title.replace(/:.*/,""),document.title+=":"+s;e.firstChild;)e.removeChild(e.firstChild);const n=document.createElement("canvas"),i=n.width=120,o=n.height=40;n.style.width="100%",e.appendChild(n);const r=n.getContext("2d"),a=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const s=new g(e),n=[];for(let e=0;e<t;e++)n.push(`hsl(${360*s.quick()}, 50%, 70%)`);return n}(t,2);r.fillStyle=a[0],r.beginPath(),r.moveTo(0,0),r.lineTo(0,o),r.lineTo(i,0),r.closePath(),r.fill(),r.fillStyle=a[1],r.beginPath(),r.moveTo(i,o),r.lineTo(i,0),r.lineTo(0,o),r.closePath(),r.fill(),r.font="30px Arial",r.textAlign="center",r.textBaseline="middle",r.fillStyle="black",r.fillText(s,i/2,o/2)}function ke(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};for(;e.firstChild;)e.removeChild(e.firstChild);return new w(e,{text:t,width:128,height:128,colorDark:"#000000",colorLight:"#ffffff",correctLevel:w.CorrectLevel.L,...s})}function Pe(){if(!1===ze.root||!1===ze.qrcode)return;if(u.noqr)return;const e=ze.sessionURL;if(!e)return void console.warn("App.sessionURL is not set");const t=Ye(ze.qrcode);if(!t)return;fe||(t.onclick=t=>{t.preventDefault(),t.stopPropagation(),t.shiftKey?function(){const e=document.getElementById("croquet_dock");e&&e.classList.toggle("debug")}():window.open(e)});ke(t,e).getCanvas().style.width="100%"}let Re,Ie,Me=0;function Ve(){!function(){if(Ze)return;Ze=!0;const e=`\n ${be?"body { min-height: 100vh }":""}\n #croquet_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 croquet_dots {\n 0%, 80%, 100% { box-shadow: 0 2.5em 0 -1.3em; }\n 40% { box-shadow: 0 2.5em 0 0; }\n }\n #croquet_loader,\n #croquet_loader::before,\n #croquet_loader::after {\n border-radius: 50%;\n width: 2.5em;\n height: 2.5em;\n animation: croquet_dots 1.8s infinite ease-in-out;\n }\n #croquet_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 #croquet_loader::before,\n #croquet_loader::after {\n content: '';\n position: absolute;\n top: 0;\n }\n #croquet_loader::before { left: -3.5em; animation-delay: -0.32s; }\n #croquet_loader::after { left: 3.5em; }\n #croquet_spinnerOverlay.croquet_error>*,\n #croquet_spinnerOverlay.croquet_error>*::before,\n #croquet_spinnerOverlay.croquet_error>*::after {\n color: #f00;\n }\n #croquet_spinnerOverlay.croquet_fatal>*,\n #croquet_spinnerOverlay.croquet_fatal>*::before,\n #croquet_spinnerOverlay.croquet_fatal>*::after {\n color: #f00;\n box-shadow: 0 2.5em 0 0 !important;\n animation: none !important;\n }\n`,t=document.createElement("style");t.innerHTML=e,document.head.insertBefore(t,document.head.querySelector("style,link[rel=stylesheet]"))}();const e=document.createElement("div");e.id="croquet_spinnerOverlay";const t=document.createElement("div");return t.id="croquet_loader",t.innerText="Catching up...",e.appendChild(t),e}function Ye(e,t){if(!1===e)return!1;if(e instanceof Element)return e;if("string"==typeof e){const t=document.getElementById(e);if(t)return t}return t?t():null}function He(){const e=new Uint8Array(arguments.length>0&&void 0!==arguments[0]?arguments[0]:16);return window.crypto.getRandomValues(e),Y(e.buffer)}const Ke=new Set;let Ne=function(){let e=null;const t=document.getElementsByTagName("link");for(const s of t)if("canonical"===s.getAttribute("rel")){e=s.getAttribute("href");break}return e||window.location.href}();const ze={get libName(){return globalThis.__MULTISYNQ__?"Multisynq":"Croquet"},get sessionURL(){return Ne},set sessionURL(e){Ne=e,Pe()},root:null,sync:!0,messages:!1,badge:!1,stats:!1,qrcode:!1,makeWidgetDock:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(u.nodock)return;const t=e.debug||u.debug,s=document.getElementById("croquet_dock");s&&s.parentElement.removeChild(s);const n=Ye(ze.root,(()=>document.body));if(!n)return;!function(){if(we)return;we=!0;const e=`\n #croquet_dock { position: fixed; z-index: 2; border: 3px solid white; bottom: 6px; left: 6px; width: 36px; height: 36px; box-sizing: border-box; background: white; opacity: 0.4; transition: all 0.3s ease; }\n #croquet_dock.active { opacity: 0.95; border-radius: 12px; }\n #croquet_dock.debug { width: 84px; }\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 #croquet_dock:not(.debug) #croquet_badge { display: none; }\n\n .croquet_dock_button { position: absolute; width: ${ye}%; height: 90%; top: 50%; transform: translate(0px, -50%); 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: ${2+ge+ye+2}% }\n #croquet_dock:not(.debug) #croquet_dock_left { display: none; }\n #croquet_dock_right { right: ${2+ge}%; }\n #croquet_dock:not(.debug) #croquet_dock_right { display: none; }\n #croquet_dock_pin { right: 2%; }\n #croquet_dock_pin.pinned { background: #cce6ff; }\n\n #croquet_dock_content { position: absolute; left: 2px; top: 2px; right: 2px; bottom: 2px; background: white; overflow: hidden; }\n #croquet_dock.debug:not(.active) #croquet_dock_content { display: none; }\n #croquet_dock.debug:not(.active) #croquet_dock_content div { display: none; }\n\n #croquet_qrcode { position: absolute; width: 100%; height: 100%;box-sizing: border-box; cursor: crosshair; }\n #croquet_dock.active #croquet_qrcode { border: 6px solid white; }\n #croquet_dock.debug #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`,t=document.createElement("style");t.innerHTML=e,document.head.insertBefore(t,document.head.querySelector("style,link[rel=stylesheet]"))}();const i=document.createElement("div");i.id="croquet_dock",t&&i.classList.add("debug"),be&&!1===e.iframe&&(i.style.display="none"),n.appendChild(i);const o=document.createElement("div");let r;o.id="croquet_dock_bar",i.appendChild(o),!1!==e.badge&&(r=document.createElement("div"),r.id="croquet_badge",o.appendChild(r),ze.badge=r);const a=document.createElement("div");a.id="croquet_dock_content",i.appendChild(a);const l=[];let c,d;if(!1!==e.qrcode){ze.sessionURL&&(c=document.createElement("div"),c.id="croquet_qrcode",a.appendChild(c),l.push(c.id),ze.qrcode=c,t||(Ge.activePage=c.id))}if(!1!==e.stats&&(d=document.createElement("div"),d.id="croquet_stats",a.appendChild(d),l.push(d.id),ze.stats=d),l.length){function b(e){const t=l.length;let s,n=0;if(Ge.activePage){const e=l.indexOf(Ge.activePage);e>=0?(n=e,s=document.getElementById(Ge.activePage)):Ge.activePage=null}const i=l[(n+t+e)%t];let o;i===Ge.activePage?o=s:(s&&s.classList.remove("active"),o=document.getElementById(i)),o&&o.classList.add("active"),Ge.activePage=i}l.length>1&&(o.appendChild(Te("<","croquet_dock_left",(()