@bdelab/roav-ran 1.0.26 → 1.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- ;!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e67a7b9a-c81b-4b28-8f70-3b39db91758c",e._sentryDebugIdIdentifier="sentry-dbid-e67a7b9a-c81b-4b28-8f70-3b39db91758c")}catch(e){}}();import"./_sentry-release-injection-file.0c0c0e19.js";import e from"path";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function i(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})})),n}var a,o={exports:{}};
1
+ ;!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4477d1ac-89e2-4603-8841-1f4cdad36296",e._sentryDebugIdIdentifier="sentry-dbid-4477d1ac-89e2-4603-8841-1f4cdad36296")}catch(e){}}();import"./_sentry-release-injection-file.e102bbf5.js";import e from"path";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function i(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})})),n}var a,o={exports:{}};
2
2
  /*! store2 - v2.14.3 - 2024-02-14
3
3
  * Copyright (c) 2024 Nathan Bubna; Licensed MIT */a=o,function(e,t){var n={version:"2.14.3",areas:{},apis:{},nsdelim:".",inherit:function(e,t){for(var n in e)t.hasOwnProperty(n)||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n));return t},stringify:function(e,t){return void 0===e||"function"==typeof e?e+"":JSON.stringify(e,t||n.replace)},parse:function(e,t){try{return JSON.parse(e,t||n.revive)}catch(t){return e}},fn:function(e,t){for(var i in n.storeAPI[e]=t,n.apis)n.apis[i][e]=t},get:function(e,t){return e.getItem(t)},set:function(e,t,n){e.setItem(t,n)},remove:function(e,t){e.removeItem(t)},key:function(e,t){return e.key(t)},length:function(e){return e.length},clear:function(e){e.clear()},Store:function(e,t,i){var a=n.inherit(n.storeAPI,(function(e,t,n){return 0===arguments.length?a.getAll():"function"==typeof t?a.transact(e,t,n):void 0!==t?a.set(e,t,n):"string"==typeof e||"number"==typeof e?a.get(e):"function"==typeof e?a.each(e):e?a.setAll(e,t):a.clear()}));a._id=e;try{var o="__store2_test";t.setItem(o,"ok"),a._area=t,t.removeItem(o)}catch(e){a._area=n.storage("fake")}return a._ns=i||"",n.areas[e]||(n.areas[e]=a._area),n.apis[a._ns+a._id]||(n.apis[a._ns+a._id]=a),a},storeAPI:{area:function(e,t){var i=this[e];return i&&i.area||(i=n.Store(e,t,this._ns),this[e]||(this[e]=i)),i},namespace:function(e,t,i){if(i=i||this._delim||n.nsdelim,!e)return this._ns?this._ns.substring(0,this._ns.length-i.length):"";var a=e,o=this[a];if(!(o&&o.namespace||((o=n.Store(this._id,this._area,this._ns+a+i))._delim=i,this[a]||(this[a]=o),t)))for(var s in n.areas)o.area(s,n.areas[s]);return o},isFake:function(e){return e?(this._real=this._area,this._area=n.storage("fake")):!1===e&&(this._area=this._real||this._area),"fake"===this._area.name},toString:function(){return"store"+(this._ns?"."+this.namespace():"")+"["+this._id+"]"},has:function(e){return this._area.has?this._area.has(this._in(e)):!!(this._in(e)in this._area)},size:function(){return this.keys().length},each:function(e,t){for(var i=0,a=n.length(this._area);i<a;i++){var o=this._out(n.key(this._area,i));if(void 0!==o&&!1===e.call(this,o,this.get(o),t))break;a>n.length(this._area)&&(a--,i--)}return t||this},keys:function(e){return this.each((function(e,t,n){n.push(e)}),e||[])},get:function(e,t){var i,a=n.get(this._area,this._in(e));return"function"==typeof t&&(i=t,t=null),null!==a?n.parse(a,i):null!=t?t:a},getAll:function(e){return this.each((function(e,t,n){n[e]=t}),e||{})},transact:function(e,t,n){var i=this.get(e,n),a=t(i);return this.set(e,void 0===a?i:a),this},set:function(e,t,i){var a,o=this.get(e);return null!=o&&!1===i?t:("function"==typeof i&&(a=i,i=void 0),n.set(this._area,this._in(e),n.stringify(t,a),i)||o)},setAll:function(e,t){var n,i;for(var a in e)i=e[a],this.set(a,i,t)!==i&&(n=!0);return n},add:function(e,t,i){var a=this.get(e);if(a instanceof Array)t=a.concat(t);else if(null!==a){var o=typeof a;if(o===typeof t&&"object"===o){for(var s in t)a[s]=t[s];t=a}else t=a+t}return n.set(this._area,this._in(e),n.stringify(t,i)),t},remove:function(e,t){var i=this.get(e,t);return n.remove(this._area,this._in(e)),i},clear:function(){return this._ns?this.each((function(e){n.remove(this._area,this._in(e))}),1):n.clear(this._area),this},clearAll:function(){var e=this._area;for(var t in n.areas)n.areas.hasOwnProperty(t)&&(this._area=n.areas[t],this.clear());return this._area=e,this},_in:function(e){return"string"!=typeof e&&(e=n.stringify(e)),this._ns?this._ns+e:e},_out:function(e){return this._ns?e&&0===e.indexOf(this._ns)?e.substring(this._ns.length):void 0:e}},storage:function(e){return n.inherit(n.storageAPI,{items:{},name:e})},storageAPI:{length:0,has:function(e){return this.items.hasOwnProperty(e)},key:function(e){var t=0;for(var n in this.items)if(this.has(n)&&e===t++)return n},setItem:function(e,t){this.has(e)||this.length++,this.items[e]=t},removeItem:function(e){this.has(e)&&(delete this.items[e],this.length--)},getItem:function(e){return this.has(e)?this.items[e]:null},clear:function(){for(var e in this.items)this.removeItem(e)}}},i=n.Store("local",function(){try{return localStorage}catch(e){}}());i.local=i,i._=n,i.area("session",function(){try{return sessionStorage}catch(e){}}()),i.area("page",n.storage("page")),"function"==typeof t&&void 0!==t.amd?t("store2",[],(function(){return i})):a.exports?a.exports=i:(e.store&&(n.conflict=e.store),e.store=i)}(t,t&&t.define);var s=n(o.exports);var r=function(){this.__data__=[],this.size=0};var c=function(e,t){return e===t||e!=e&&t!=t},l=c;var p=function(e,t){for(var n=e.length;n--;)if(l(e[n][0],t))return n;return-1},u=p,d=Array.prototype.splice;var m=p;var h=p;var f=p;var g=r,v=function(e){var t=this.__data__,n=u(t,e);return!(n<0)&&(n==t.length-1?t.pop():d.call(t,n,1),--this.size,!0)},b=function(e){var t=this.__data__,n=m(t,e);return n<0?void 0:t[n][1]},x=function(e){return h(this.__data__,e)>-1},y=function(e,t){var n=this.__data__,i=f(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};function w(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}w.prototype.clear=g,w.prototype.delete=v,w.prototype.get=b,w.prototype.has=x,w.prototype.set=y;var k=w,_=k;var j=function(){this.__data__=new _,this.size=0};var C=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n};var S=function(e){return this.__data__.get(e)};var E=function(e){return this.__data__.has(e)},T="object"==typeof t&&t&&t.Object===Object&&t,M=T,O="object"==typeof self&&self&&self.Object===Object&&self,A=M||O||Function("return this")(),I=A.Symbol,P=I,R=Object.prototype,L=R.hasOwnProperty,N=R.toString,D=P?P.toStringTag:void 0;var q=function(e){var t=L.call(e,D),n=e[D];try{e[D]=void 0;var i=!0}catch(e){}var a=N.call(e);return i&&(t?e[D]=n:delete e[D]),a},F=Object.prototype.toString;var z=q,V=function(e){return F.call(e)},B=I?I.toStringTag:void 0;var U=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":B&&B in Object(e)?z(e):V(e)};var H=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},W=U,$=H;var K,Y=function(e){if(!$(e))return!1;var t=W(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},X=A["__core-js_shared__"],G=(K=/[^.]+$/.exec(X&&X.keys&&X.keys.IE_PROTO||""))?"Symbol(src)_1."+K:"";var J=function(e){return!!G&&G in e},Q=Function.prototype.toString;var Z=function(e){if(null!=e){try{return Q.call(e)}catch(e){}try{return e+""}catch(e){}}return""},ee=Y,te=J,ne=H,ie=Z,ae=/^\[object .+?Constructor\]$/,oe=Function.prototype,se=Object.prototype,re=oe.toString,ce=se.hasOwnProperty,le=RegExp("^"+re.call(ce).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var pe=function(e){return!(!ne(e)||te(e))&&(ee(e)?le:ae).test(ie(e))},ue=function(e,t){return null==e?void 0:e[t]};var de=function(e,t){var n=ue(e,t);return pe(n)?n:void 0},me=de(A,"Map"),he=de(Object,"create"),fe=he;var ge=function(){this.__data__=fe?fe(null):{},this.size=0};var ve=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},be=he,xe=Object.prototype.hasOwnProperty;var ye=function(e){var t=this.__data__;if(be){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return xe.call(t,e)?t[e]:void 0},we=he,ke=Object.prototype.hasOwnProperty;var _e=he;var je=ge,Ce=ve,Se=ye,Ee=function(e){var t=this.__data__;return we?void 0!==t[e]:ke.call(t,e)},Te=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=_e&&void 0===t?"__lodash_hash_undefined__":t,this};function Me(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Me.prototype.clear=je,Me.prototype.delete=Ce,Me.prototype.get=Se,Me.prototype.has=Ee,Me.prototype.set=Te;var Oe=Me,Ae=k,Ie=me;var Pe=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Re=function(e,t){var n=e.__data__;return Pe(t)?n["string"==typeof t?"string":"hash"]:n.map},Le=Re;var Ne=Re;var De=Re;var qe=Re;var Fe=function(){this.size=0,this.__data__={hash:new Oe,map:new(Ie||Ae),string:new Oe}},ze=function(e){var t=Le(this,e).delete(e);return this.size-=t?1:0,t},Ve=function(e){return Ne(this,e).get(e)},Be=function(e){return De(this,e).has(e)},Ue=function(e,t){var n=qe(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};function He(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}He.prototype.clear=Fe,He.prototype.delete=ze,He.prototype.get=Ve,He.prototype.has=Be,He.prototype.set=Ue;var We=He,$e=k,Ke=me,Ye=We;var Xe=k,Ge=j,Je=C,Qe=S,Ze=E,et=function(e,t){var n=this.__data__;if(n instanceof $e){var i=n.__data__;if(!Ke||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ye(i)}return n.set(e,t),this.size=n.size,this};function tt(e){var t=this.__data__=new Xe(e);this.size=t.size}tt.prototype.clear=Ge,tt.prototype.delete=Je,tt.prototype.get=Qe,tt.prototype.has=Ze,tt.prototype.set=et;var nt=tt;var it=We,at=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},ot=function(e){return this.__data__.has(e)};function st(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new it;++t<n;)this.add(e[t])}st.prototype.add=st.prototype.push=at,st.prototype.has=ot;var rt=st,ct=function(e,t){for(var n=-1,i=null==e?0:e.length;++n<i;)if(t(e[n],n,e))return!0;return!1},lt=function(e,t){return e.has(t)};var pt=function(e,t,n,i,a,o){var s=1&n,r=e.length,c=t.length;if(r!=c&&!(s&&c>r))return!1;var l=o.get(e),p=o.get(t);if(l&&p)return l==t&&p==e;var u=-1,d=!0,m=2&n?new rt:void 0;for(o.set(e,t),o.set(t,e);++u<r;){var h=e[u],f=t[u];if(i)var g=s?i(f,h,u,t,e,o):i(h,f,u,e,t,o);if(void 0!==g){if(g)continue;d=!1;break}if(m){if(!ct(t,(function(e,t){if(!lt(m,t)&&(h===e||a(h,e,n,i,o)))return m.push(t)}))){d=!1;break}}else if(h!==f&&!a(h,f,n,i,o)){d=!1;break}}return o.delete(e),o.delete(t),d};var ut=A.Uint8Array,dt=c,mt=pt,ht=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,i){n[++t]=[i,e]})),n},ft=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n},gt=I?I.prototype:void 0,vt=gt?gt.valueOf:void 0;var bt=function(e,t,n,i,a,o,s){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!o(new ut(e),new ut(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return dt(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var r=ht;case"[object Set]":var c=1&i;if(r||(r=ft),e.size!=t.size&&!c)return!1;var l=s.get(e);if(l)return l==t;i|=2,s.set(e,t);var p=mt(r(e),r(t),i,a,o,s);return s.delete(e),p;case"[object Symbol]":if(vt)return vt.call(e)==vt.call(t)}return!1};var xt=function(e,t){for(var n=-1,i=t.length,a=e.length;++n<i;)e[a+n]=t[n];return e},yt=Array.isArray,wt=xt,kt=yt;var _t=function(e,t,n){var i=t(e);return kt(e)?i:wt(i,n(e))};var jt=function(){return[]},Ct=function(e,t){for(var n=-1,i=null==e?0:e.length,a=0,o=[];++n<i;){var s=e[n];t(s,n,e)&&(o[a++]=s)}return o},St=jt,Et=Object.prototype.propertyIsEnumerable,Tt=Object.getOwnPropertySymbols,Mt=Tt?function(e){return null==e?[]:(e=Object(e),Ct(Tt(e),(function(t){return Et.call(e,t)})))}:St;var Ot=function(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i};var At=function(e){return null!=e&&"object"==typeof e},It=U,Pt=At;var Rt=function(e){return Pt(e)&&"[object Arguments]"==It(e)},Lt=At,Nt=Object.prototype,Dt=Nt.hasOwnProperty,qt=Nt.propertyIsEnumerable,Ft=Rt(function(){return arguments}())?Rt:function(e){return Lt(e)&&Dt.call(e,"callee")&&!qt.call(e,"callee")},zt={exports:{}};var Vt=function(){return!1};!function(e,t){var n=A,i=Vt,a=t&&!t.nodeType&&t,o=a&&e&&!e.nodeType&&e,s=o&&o.exports===a?n.Buffer:void 0,r=(s?s.isBuffer:void 0)||i;e.exports=r}(zt,zt.exports);var Bt=zt.exports,Ut=/^(?:0|[1-9]\d*)$/;var Ht=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Ut.test(e))&&e>-1&&e%1==0&&e<t};var Wt=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},$t=U,Kt=Wt,Yt=At,Xt={};Xt["[object Float32Array]"]=Xt["[object Float64Array]"]=Xt["[object Int8Array]"]=Xt["[object Int16Array]"]=Xt["[object Int32Array]"]=Xt["[object Uint8Array]"]=Xt["[object Uint8ClampedArray]"]=Xt["[object Uint16Array]"]=Xt["[object Uint32Array]"]=!0,Xt["[object Arguments]"]=Xt["[object Array]"]=Xt["[object ArrayBuffer]"]=Xt["[object Boolean]"]=Xt["[object DataView]"]=Xt["[object Date]"]=Xt["[object Error]"]=Xt["[object Function]"]=Xt["[object Map]"]=Xt["[object Number]"]=Xt["[object Object]"]=Xt["[object RegExp]"]=Xt["[object Set]"]=Xt["[object String]"]=Xt["[object WeakMap]"]=!1;var Gt=function(e){return Yt(e)&&Kt(e.length)&&!!Xt[$t(e)]};var Jt=function(e){return function(t){return e(t)}},Qt={exports:{}};!function(e,t){var n=T,i=t&&!t.nodeType&&t,a=i&&e&&!e.nodeType&&e,o=a&&a.exports===i&&n.process,s=function(){try{var e=a&&a.require&&a.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=s}(Qt,Qt.exports);var Zt=Qt.exports,en=Gt,tn=Jt,nn=Zt&&Zt.isTypedArray,an=nn?tn(nn):en,on=Ot,sn=Ft,rn=yt,cn=Bt,ln=Ht,pn=an,un=Object.prototype.hasOwnProperty;var dn=function(e,t){var n=rn(e),i=!n&&sn(e),a=!n&&!i&&cn(e),o=!n&&!i&&!a&&pn(e),s=n||i||a||o,r=s?on(e.length,String):[],c=r.length;for(var l in e)!t&&!un.call(e,l)||s&&("length"==l||a&&("offset"==l||"parent"==l)||o&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||ln(l,c))||r.push(l);return r},mn=Object.prototype;var hn=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||mn)};var fn=function(e,t){return function(n){return e(t(n))}},gn=fn(Object.keys,Object),vn=hn,bn=gn,xn=Object.prototype.hasOwnProperty;var yn=Y,wn=Wt;var kn=function(e){return null!=e&&wn(e.length)&&!yn(e)},_n=dn,jn=function(e){if(!vn(e))return bn(e);var t=[];for(var n in Object(e))xn.call(e,n)&&"constructor"!=n&&t.push(n);return t},Cn=kn;var Sn=function(e){return Cn(e)?_n(e):jn(e)},En=_t,Tn=Mt,Mn=Sn;var On=function(e){return En(e,Mn,Tn)},An=Object.prototype.hasOwnProperty;var In=function(e,t,n,i,a,o){var s=1&n,r=On(e),c=r.length;if(c!=On(t).length&&!s)return!1;for(var l=c;l--;){var p=r[l];if(!(s?p in t:An.call(t,p)))return!1}var u=o.get(e),d=o.get(t);if(u&&d)return u==t&&d==e;var m=!0;o.set(e,t),o.set(t,e);for(var h=s;++l<c;){var f=e[p=r[l]],g=t[p];if(i)var v=s?i(g,f,p,t,e,o):i(f,g,p,e,t,o);if(!(void 0===v?f===g||a(f,g,n,i,o):v)){m=!1;break}h||(h="constructor"==p)}if(m&&!h){var b=e.constructor,x=t.constructor;b==x||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof x&&x instanceof x||(m=!1)}return o.delete(e),o.delete(t),m},Pn=de(A,"DataView"),Rn=me,Ln=de(A,"Promise"),Nn=de(A,"Set"),Dn=de(A,"WeakMap"),qn=U,Fn=Z,zn="[object Map]",Vn="[object Promise]",Bn="[object Set]",Un="[object WeakMap]",Hn="[object DataView]",Wn=Fn(Pn),$n=Fn(Rn),Kn=Fn(Ln),Yn=Fn(Nn),Xn=Fn(Dn),Gn=qn;(Pn&&Gn(new Pn(new ArrayBuffer(1)))!=Hn||Rn&&Gn(new Rn)!=zn||Ln&&Gn(Ln.resolve())!=Vn||Nn&&Gn(new Nn)!=Bn||Dn&&Gn(new Dn)!=Un)&&(Gn=function(e){var t=qn(e),n="[object Object]"==t?e.constructor:void 0,i=n?Fn(n):"";if(i)switch(i){case Wn:return Hn;case $n:return zn;case Kn:return Vn;case Yn:return Bn;case Xn:return Un}return t});var Jn=nt,Qn=pt,Zn=bt,ei=In,ti=Gn,ni=yt,ii=Bt,ai=an,oi="[object Arguments]",si="[object Array]",ri="[object Object]",ci=Object.prototype.hasOwnProperty;var li=function(e,t,n,i,a,o){var s=ni(e),r=ni(t),c=s?si:ti(e),l=r?si:ti(t),p=(c=c==oi?ri:c)==ri,u=(l=l==oi?ri:l)==ri,d=c==l;if(d&&ii(e)){if(!ii(t))return!1;s=!0,p=!1}if(d&&!p)return o||(o=new Jn),s||ai(e)?Qn(e,t,n,i,a,o):Zn(e,t,c,n,i,a,o);if(!(1&n)){var m=p&&ci.call(e,"__wrapped__"),h=u&&ci.call(t,"__wrapped__");if(m||h){var f=m?e.value():e,g=h?t.value():t;return o||(o=new Jn),a(f,g,n,i,o)}}return!!d&&(o||(o=new Jn),ei(e,t,n,i,a,o))},pi=At;var ui=function e(t,n,i,a,o){return t===n||(null==t||null==n||!pi(t)&&!pi(n)?t!=t&&n!=n:li(t,n,i,a,e,o))},di=nt,mi=ui;var hi=H;var fi=function(e){return e==e&&!hi(e)},gi=fi,vi=Sn;var bi=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}},xi=function(e,t,n,i){var a=n.length,o=a,s=!i;if(null==e)return!o;for(e=Object(e);a--;){var r=n[a];if(s&&r[2]?r[1]!==e[r[0]]:!(r[0]in e))return!1}for(;++a<o;){var c=(r=n[a])[0],l=e[c],p=r[1];if(s&&r[2]){if(void 0===l&&!(c in e))return!1}else{var u=new di;if(i)var d=i(l,p,c,e,t,u);if(!(void 0===d?mi(p,l,3,i,u):d))return!1}}return!0},yi=function(e){for(var t=vi(e),n=t.length;n--;){var i=t[n],a=e[i];t[n]=[i,a,gi(a)]}return t},wi=bi;var ki=function(e){var t=yi(e);return 1==t.length&&t[0][2]?wi(t[0][0],t[0][1]):function(n){return n===e||xi(n,e,t)}},_i=U,ji=At;var Ci=function(e){return"symbol"==typeof e||ji(e)&&"[object Symbol]"==_i(e)},Si=yt,Ei=Ci,Ti=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Mi=/^\w*$/;var Oi=function(e,t){if(Si(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Ei(e))||(Mi.test(e)||!Ti.test(e)||null!=t&&e in Object(t))},Ai=We;function Ii(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var i=arguments,a=t?t.apply(this,i):i[0],o=n.cache;if(o.has(a))return o.get(a);var s=e.apply(this,i);return n.cache=o.set(a,s)||o,s};return n.cache=new(Ii.Cache||Ai),n}Ii.Cache=Ai;var Pi=Ii;var Ri=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Li=/\\(\\)?/g,Ni=function(e){var t=Pi(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Ri,(function(e,n,i,a){t.push(i?a.replace(Li,"$1"):n||e)})),t}));var Di=function(e,t){for(var n=-1,i=null==e?0:e.length,a=Array(i);++n<i;)a[n]=t(e[n],n,e);return a},qi=Di,Fi=yt,zi=Ci,Vi=I?I.prototype:void 0,Bi=Vi?Vi.toString:void 0;var Ui=function e(t){if("string"==typeof t)return t;if(Fi(t))return qi(t,e)+"";if(zi(t))return Bi?Bi.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n},Hi=Ui;var Wi=yt,$i=Oi,Ki=Ni,Yi=function(e){return null==e?"":Hi(e)};var Xi=function(e,t){return Wi(e)?e:$i(e,t)?[e]:Ki(Yi(e))},Gi=Ci;var Ji=function(e){if("string"==typeof e||Gi(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t},Qi=Xi,Zi=Ji;var ea=function(e,t){for(var n=0,i=(t=Qi(t,e)).length;null!=e&&n<i;)e=e[Zi(t[n++])];return n&&n==i?e:void 0},ta=ea;var na=function(e,t,n){var i=null==e?void 0:ta(e,t);return void 0===i?n:i};var ia=Xi,aa=Ft,oa=yt,sa=Ht,ra=Wt,ca=Ji;var la=function(e,t,n){for(var i=-1,a=(t=ia(t,e)).length,o=!1;++i<a;){var s=ca(t[i]);if(!(o=null!=e&&n(e,s)))break;e=e[s]}return o||++i!=a?o:!!(a=null==e?0:e.length)&&ra(a)&&sa(s,a)&&(oa(e)||aa(e))},pa=function(e,t){return null!=e&&t in Object(e)},ua=la;var da=function(e,t){return null!=e&&ua(e,t,pa)},ma=ui,ha=na,fa=da,ga=Oi,va=fi,ba=bi,xa=Ji;var ya=function(e,t){return ga(e)&&va(t)?ba(xa(e),t):function(n){var i=ha(n,e);return void 0===i&&i===t?fa(n,e):ma(t,i,3)}};var wa=ea;var ka=function(e){return function(t){return wa(t,e)}},_a=function(e){return function(t){return null==t?void 0:t[e]}},ja=ka,Ca=Oi,Sa=Ji;var Ea=function(e){return Ca(e)?_a(Sa(e)):ja(e)},Ta=ki,Ma=ya,Oa=function(e){return e},Aa=yt,Ia=Ea;var Pa=function(e){return"function"==typeof e?e:null==e?Oa:"object"==typeof e?Aa(e)?Ma(e[0],e[1]):Ta(e):Ia(e)};var Ra=function(e){if("function"!=typeof e)throw new TypeError("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}},La=de,Na=function(){try{var e=La(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var Da=function(e,t,n){"__proto__"==t&&Na?Na(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},qa=c,Fa=Object.prototype.hasOwnProperty;var za=function(e,t,n){var i=e[t];Fa.call(e,t)&&qa(i,n)&&(void 0!==n||t in e)||Da(e,t,n)},Va=Xi,Ba=Ht,Ua=H,Ha=Ji;var Wa=function(e,t,n,i){if(!Ua(e))return e;for(var a=-1,o=(t=Va(t,e)).length,s=o-1,r=e;null!=r&&++a<o;){var c=Ha(t[a]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(a!=s){var p=r[c];void 0===(l=i?i(p,c,r):void 0)&&(l=Ua(p)?p:Ba(t[a+1])?[]:{})}za(r,c,l),r=r[c]}return e},$a=ea,Ka=Wa,Ya=Xi;var Xa=function(e,t,n){for(var i=-1,a=t.length,o={};++i<a;){var s=t[i],r=$a(e,s);n(r,s)&&Ka(o,Ya(s,e),r)}return o},Ga=fn(Object.getPrototypeOf,Object),Ja=xt,Qa=Ga,Za=Mt,eo=jt,to=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Ja(t,Za(e)),e=Qa(e);return t}:eo;var no=H,io=hn,ao=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t},oo=Object.prototype.hasOwnProperty;var so=dn,ro=function(e){if(!no(e))return ao(e);var t=io(e),n=[];for(var i in e)("constructor"!=i||!t&&oo.call(e,i))&&n.push(i);return n},co=kn;var lo=_t,po=to,uo=function(e){return co(e)?so(e,!0):ro(e)};var mo=Di,ho=Pa,fo=Xa,go=function(e){return lo(e,uo,po)};var vo=function(e,t){if(null==e)return{};var n=mo(go(e),(function(e){return[e]}));return t=ho(t),fo(e,n,(function(e,n){return t(e,n[0])}))},bo=Pa,xo=Ra,yo=vo;var wo=n((function(e,t){return yo(e,xo(bo(t)))}));var ko=n((function(e){return null===e}));var _o=n((function(e){return void 0===e}));function jo(e){return jo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jo(e)}function Co(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function So(e){var t=function(e,t){if("object"!=jo(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=jo(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==jo(t)?t:t+""}function Eo(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,So(i.key),i)}}function To(e,t,n){return t&&Eo(e.prototype,t),n&&Eo(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Mo(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Oo(e,t){return Oo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Oo(e,t)}function Ao(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Oo(e,t)}function Io(e,t){if(t&&("object"===jo(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Mo(e)}function Po(e){return Po=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Po(e)}function Ro(e,t,n){return(t=So(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Lo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function No(e){return function(e){if(Array.isArray(e))return e}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Lo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Lo(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Do(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function qo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Do(Object(n),!0).forEach((function(t){Ro(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Do(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Fo={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){console&&console[e]&&console[e].apply(console,t)}},zo=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Co(this,e),this.init(t,n)}return To(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||Fo,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,n,i){return i&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(n).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,qo(qo({},{prefix:"".concat(this.prefix,":").concat(t,":")}),this.options))}},{key:"clone",value:function(t){return(t=t||this.options).prefix=t.prefix||this.prefix,new e(this.logger,t)}}]),e}(),Vo=new zo,Bo=function(){function e(){Co(this,e),this.observers={}}return To(e,[{key:"on",value:function(e,t){var n=this;return e.split(" ").forEach((function(e){n.observers[e]=n.observers[e]||[],n.observers[e].push(t)})),this}},{key:"off",value:function(e,t){this.observers[e]&&(t?this.observers[e]=this.observers[e].filter((function(e){return e!==t})):delete this.observers[e])}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];this.observers[e]&&[].concat(this.observers[e]).forEach((function(e){e.apply(void 0,n)}));this.observers["*"]&&[].concat(this.observers["*"]).forEach((function(t){t.apply(t,[e].concat(n))}))}}]),e}();function Uo(){var e,t,n=new Promise((function(n,i){e=n,t=i}));return n.resolve=e,n.reject=t,n}function Ho(e){return null==e?"":""+e}function Wo(e,t,n){function i(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function a(){return!e||"string"==typeof e}for(var o="string"!=typeof t?[].concat(t):t.split(".");o.length>1;){if(a())return{};var s=i(o.shift());!e[s]&&n&&(e[s]=new n),e=Object.prototype.hasOwnProperty.call(e,s)?e[s]:{}}return a()?{}:{obj:e,k:i(o.shift())}}function $o(e,t,n){var i=Wo(e,t,Object);i.obj[i.k]=n}function Ko(e,t){var n=Wo(e,t),i=n.obj,a=n.k;if(i)return i[a]}function Yo(e,t,n){for(var i in t)"__proto__"!==i&&"constructor"!==i&&(i in e?"string"==typeof e[i]||e[i]instanceof String||"string"==typeof t[i]||t[i]instanceof String?n&&(e[i]=t[i]):Yo(e[i],t[i],n):e[i]=t[i]);return e}function Xo(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var Go={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};function Jo(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return Go[e]})):e}var Qo="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,Zo=[" ",",","?","!",";"];function es(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var i=t.split(n),a=e,o=0;o<i.length;++o){if(!a)return;if("string"==typeof a[i[o]]&&o+1<i.length)return;if(void 0===a[i[o]]){for(var s=2,r=i.slice(o,o+s).join(n),c=a[r];void 0===c&&i.length>o+s;)s++,c=a[r=i.slice(o,o+s).join(n)];if(void 0===c)return;if(null===c)return null;if(t.endsWith(r)){if("string"==typeof c)return c;if(r&&"string"==typeof c[r])return c[r]}var l=i.slice(o+s).join(n);return l?es(c,l,n):void 0}a=a[i[o]]}return a}}function ts(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function ns(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ts(Object(n),!0).forEach((function(t){Ro(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ts(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function is(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=Po(e);if(t){var a=Po(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return Io(this,n)}}var as=function(e){Ao(n,Bo);var t=is(n);function n(e){var i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return Co(this,n),i=t.call(this),Qo&&Bo.call(Mo(i)),i.data=e||{},i.options=a,void 0===i.options.keySeparator&&(i.options.keySeparator="."),void 0===i.options.ignoreJSONStructure&&(i.options.ignoreJSONStructure=!0),i}return To(n,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,o=void 0!==i.ignoreJSONStructure?i.ignoreJSONStructure:this.options.ignoreJSONStructure,s=[e,t];n&&"string"!=typeof n&&(s=s.concat(n)),n&&"string"==typeof n&&(s=s.concat(a?n.split(a):n)),e.indexOf(".")>-1&&(s=e.split("."));var r=Ko(this.data,s);return r||!o||"string"!=typeof n?r:es(this.data&&this.data[e]&&this.data[e][t],n,a)}},{key:"addResource",value:function(e,t,n,i){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},o=void 0!==a.keySeparator?a.keySeparator:this.options.keySeparator,s=[e,t];n&&(s=s.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(i=t,t=(s=e.split("."))[1]),this.addNamespaces(t),$o(this.data,s,i),a.silent||this.emit("added",e,t,n,i)}},{key:"addResources",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var a in n)"string"!=typeof n[a]&&"[object Array]"!==Object.prototype.toString.apply(n[a])||this.addResource(e,t,a,n[a],{silent:!0});i.silent||this.emit("added",e,t,n)}},{key:"addResourceBundle",value:function(e,t,n,i,a){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},s=[e,t];e.indexOf(".")>-1&&(i=n,n=t,t=(s=e.split("."))[1]),this.addNamespaces(t);var r=Ko(this.data,s)||{};i?Yo(r,n,a):r=ns(ns({},r),n),$o(this.data,s,r),o.silent||this.emit("added",e,t,n)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?ns(ns({},{}),this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((function(e){return t[e]&&Object.keys(t[e]).length>0}))}},{key:"toJSON",value:function(){return this.data}}]),n}(),os={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,i,a){var o=this;return e.forEach((function(e){o.processors[e]&&(t=o.processors[e].process(t,n,i,a))})),t}};function ss(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function rs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ss(Object(n),!0).forEach((function(t){Ro(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ss(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function cs(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=Po(e);if(t){var a=Po(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return Io(this,n)}}var ls={},ps=function(e){Ao(n,Bo);var t=cs(n);function n(e){var i,a,o,s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Co(this,n),i=t.call(this),Qo&&Bo.call(Mo(i)),a=["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],o=e,s=Mo(i),a.forEach((function(e){o[e]&&(s[e]=o[e])})),i.options=r,void 0===i.options.keySeparator&&(i.options.keySeparator="."),i.logger=Vo.create("translator"),i}return To(n,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var i=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,a=t.ns||this.options.defaultNS||[],o=n&&e.indexOf(n)>-1,s=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,n){t=t||"",n=n||"";var i=Zo.filter((function(e){return t.indexOf(e)<0&&n.indexOf(e)<0}));if(0===i.length)return!0;var a=new RegExp("(".concat(i.map((function(e){return"?"===e?"\\?":e})).join("|"),")")),o=!a.test(e);if(!o){var s=e.indexOf(n);s>0&&!a.test(e.substring(0,s))&&(o=!0)}return o}(e,n,i));if(o&&!s){var r=e.match(this.interpolator.nestingRegexp);if(r&&r.length>0)return{key:e,namespaces:a};var c=e.split(n);(n!==i||n===i&&this.options.ns.indexOf(c[0])>-1)&&(a=c.shift()),e=c.join(i)}return"string"==typeof a&&(a=[a]),{key:e,namespaces:a}}},{key:"translate",value:function(e,t,i){var a=this;if("object"!==jo(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"===jo(t)&&(t=rs({},t)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var o=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,s=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,r=this.extractFromKey(e[e.length-1],t),c=r.key,l=r.namespaces,p=l[l.length-1],u=t.lng||this.language,d=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&"cimode"===u.toLowerCase()){if(d){var m=t.nsSeparator||this.options.nsSeparator;return o?{res:"".concat(p).concat(m).concat(c),usedKey:c,exactUsedKey:c,usedLng:u,usedNS:p}:"".concat(p).concat(m).concat(c)}return o?{res:c,usedKey:c,exactUsedKey:c,usedLng:u,usedNS:p}:c}var h=this.resolve(e,t),f=h&&h.res,g=h&&h.usedKey||c,v=h&&h.exactUsedKey||c,b=Object.prototype.toString.apply(f),x=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject;if(y&&f&&("string"!=typeof f&&"boolean"!=typeof f&&"number"!=typeof f)&&["[object Number]","[object Function]","[object RegExp]"].indexOf(b)<0&&("string"!=typeof x||"[object Array]"!==b)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var w=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,f,rs(rs({},t),{},{ns:l})):"key '".concat(c," (").concat(this.language,")' returned an object instead of string.");return o?(h.res=w,h):w}if(s){var k="[object Array]"===b,_=k?[]:{},j=k?v:g;for(var C in f)if(Object.prototype.hasOwnProperty.call(f,C)){var S="".concat(j).concat(s).concat(C);_[C]=this.translate(S,rs(rs({},t),{joinArrays:!1,ns:l})),_[C]===S&&(_[C]=f[C])}f=_}}else if(y&&"string"==typeof x&&"[object Array]"===b)(f=f.join(x))&&(f=this.extendTranslation(f,e,t,i));else{var E=!1,T=!1,M=void 0!==t.count&&"string"!=typeof t.count,O=n.hasDefaultValue(t),A=M?this.pluralResolver.getSuffix(u,t.count,t):"",I=t["defaultValue".concat(A)]||t.defaultValue;!this.isValidLookup(f)&&O&&(E=!0,f=I),this.isValidLookup(f)||(T=!0,f=c);var P=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&T?void 0:f,R=O&&I!==f&&this.options.updateMissing;if(T||E||R){if(this.logger.log(R?"updateKey":"missingKey",u,p,c,R?I:f),s){var L=this.resolve(c,rs(rs({},t),{},{keySeparator:!1}));L&&L.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var N=[],D=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&D&&D[0])for(var q=0;q<D.length;q++)N.push(D[q]);else"all"===this.options.saveMissingTo?N=this.languageUtils.toResolveHierarchy(t.lng||this.language):N.push(t.lng||this.language);var F=function(e,n,i){var o=O&&i!==f?i:P;a.options.missingKeyHandler?a.options.missingKeyHandler(e,p,n,o,R,t):a.backendConnector&&a.backendConnector.saveMissing&&a.backendConnector.saveMissing(e,p,n,o,R,t),a.emit("missingKey",e,p,n,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&M?N.forEach((function(e){a.pluralResolver.getSuffixes(e,t).forEach((function(n){F([e],c+n,t["defaultValue".concat(n)]||I)}))})):F(N,c,I))}f=this.extendTranslation(f,e,t,h,i),T&&f===c&&this.options.appendNamespaceToMissingKey&&(f="".concat(p,":").concat(c)),(T||E)&&this.options.parseMissingKeyHandler&&(f="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(p,":").concat(c):c,E?f:void 0):this.options.parseMissingKeyHandler(f))}return o?(h.res=f,h):f}},{key:"extendTranslation",value:function(e,t,n,i,a){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,rs(rs({},this.options.interpolation.defaultVariables),n),i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init(rs(rs({},n),{interpolation:rs(rs({},this.options.interpolation),n.interpolation)}));var s,r="string"==typeof e&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(r){var c=e.match(this.interpolator.nestingRegexp);s=c&&c.length}var l=n.replace&&"string"!=typeof n.replace?n.replace:n;if(this.options.interpolation.defaultVariables&&(l=rs(rs({},this.options.interpolation.defaultVariables),l)),e=this.interpolator.interpolate(e,l,n.lng||this.language,n),r){var p=e.match(this.interpolator.nestingRegexp);s<(p&&p.length)&&(n.nest=!1)}!n.lng&&"v1"!==this.options.compatibilityAPI&&i&&i.res&&(n.lng=i.usedLng),!1!==n.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,i=new Array(e),s=0;s<e;s++)i[s]=arguments[s];return a&&a[0]===i[0]&&!n.context?(o.logger.warn("It seems you are nesting recursively key: ".concat(i[0]," in key: ").concat(t[0])),null):o.translate.apply(o,i.concat([t]))}),n)),n.interpolation&&this.interpolator.reset()}var u=n.postProcess||this.options.postProcess,d="string"==typeof u?[u]:u;return null!=e&&d&&d.length&&!1!==n.applyPostProcessor&&(e=os.handle(d,e,t,this.options&&this.options.postProcessPassResolved?rs({i18nResolved:i},n):n,this)),e}},{key:"resolve",value:function(e){var t,n,i,a,o,s=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!s.isValidLookup(t)){var c=s.extractFromKey(e,r),l=c.key;n=l;var p=c.namespaces;s.options.fallbackNS&&(p=p.concat(s.options.fallbackNS));var u=void 0!==r.count&&"string"!=typeof r.count,d=u&&!r.ordinal&&0===r.count&&s.pluralResolver.shouldUseIntlApi(),m=void 0!==r.context&&("string"==typeof r.context||"number"==typeof r.context)&&""!==r.context,h=r.lngs?r.lngs:s.languageUtils.toResolveHierarchy(r.lng||s.language,r.fallbackLng);p.forEach((function(e){s.isValidLookup(t)||(o=e,!ls["".concat(h[0],"-").concat(e)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(o)&&(ls["".concat(h[0],"-").concat(e)]=!0,s.logger.warn('key "'.concat(n,'" for languages "').concat(h.join(", "),'" won\'t get resolved as namespace "').concat(o,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),h.forEach((function(n){if(!s.isValidLookup(t)){a=n;var o,c=[l];if(s.i18nFormat&&s.i18nFormat.addLookupKeys)s.i18nFormat.addLookupKeys(c,l,n,e,r);else{var p;u&&(p=s.pluralResolver.getSuffix(n,r.count,r));var h="".concat(s.options.pluralSeparator,"zero");if(u&&(c.push(l+p),d&&c.push(l+h)),m){var f="".concat(l).concat(s.options.contextSeparator).concat(r.context);c.push(f),u&&(c.push(f+p),d&&c.push(f+h))}}for(;o=c.pop();)s.isValidLookup(t)||(i=o,t=s.getResource(n,e,o,r))}})))}))}})),{res:t,usedKey:n,exactUsedKey:i,usedLng:a,usedNS:o}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,i):this.resourceStore.getResource(e,t,n,i)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,12)&&void 0!==e[n])return!0;return!1}}]),n}();function us(e){return e.charAt(0).toUpperCase()+e.slice(1)}var ds=function(){function e(t){Co(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Vo.create("languageUtils")}return To(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map((function(e){return e.toLowerCase()})):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=us(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=us(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=us(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach((function(e){if(!t){var i=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(i)||(t=i)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var i=n.getLanguagePartFromCode(e);if(n.isSupportedCode(i))return t=i;t=n.options.supportedLngs.find((function(e){return e===i?e:e.indexOf("-")<0&&i.indexOf("-")<0?void 0:0===e.indexOf(i)?e:void 0}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,i=this.getFallbackCodes(t||this.options.fallbackLng||[],e),a=[],o=function(e){e&&(n.isSupportedCode(e)?a.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):"string"==typeof e&&o(this.formatLanguageCode(e)),i.forEach((function(e){a.indexOf(e)<0&&o(n.formatLanguageCode(e))})),a}}]),e}(),ms=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],hs={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},fs=["v1","v2","v3"],gs={zero:0,one:1,two:2,few:3,many:4,other:5};var vs=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Co(this,e),this.languageUtils=t,this.options=i,this.logger=Vo.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=(n={},ms.forEach((function(e){e.lngs.forEach((function(t){n[t]={numbers:e.nr,plurals:hs[e.fc]}}))})),n)}return To(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(e){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map((function(e){return"".concat(t).concat(e)}))}},{key:"getSuffixes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=this.getRule(e,n);return i?this.shouldUseIntlApi()?i.resolvedOptions().pluralCategories.sort((function(e,t){return gs[e]-gs[t]})).map((function(e){return"".concat(t.options.prepend).concat(e)})):i.numbers.map((function(i){return t.getSuffix(e,i,n)})):[]}},{key:"getSuffix",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=this.getRule(e,n);return i?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(i.select(t)):this.getSuffixRetroCompatible(i,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var n=this,i=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),a=e.numbers[i];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===a?a="plural":1===a&&(a=""));var o=function(){return n.options.prepend&&a.toString()?n.options.prepend+a.toString():a.toString()};return"v1"===this.options.compatibilityJSON?1===a?"":"number"==typeof a?"_plural_".concat(a.toString()):o():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?o():this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString()}},{key:"shouldUseIntlApi",value:function(){return!fs.includes(this.options.compatibilityJSON)}}]),e}();function bs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function xs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bs(Object(n),!0).forEach((function(t){Ro(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bs(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ys(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=function(e,t,n){var i=Ko(e,n);return void 0!==i?i:Ko(t,n)}(e,t,n);return!o&&a&&"string"==typeof n&&void 0===(o=es(e,n,i))&&(o=es(t,n,i)),o}var ws=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Co(this,e),this.logger=Vo.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return To(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:Jo,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?Xo(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?Xo(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?Xo(t.nestingPrefix):t.nestingPrefixEscaped||Xo("$t("),this.nestingSuffix=t.nestingSuffix?Xo(t.nestingSuffix):t.nestingSuffixEscaped||Xo(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g")}},{key:"interpolate",value:function(e,t,n,i){var a,o,s,r=this,c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function l(e){return e.replace(/\$/g,"$$$$")}var p=function(e){if(e.indexOf(r.formatSeparator)<0){var a=ys(t,c,e,r.options.keySeparator,r.options.ignoreJSONStructure);return r.alwaysFormat?r.format(a,void 0,n,xs(xs(xs({},i),t),{},{interpolationkey:e})):a}var o=e.split(r.formatSeparator),s=o.shift().trim(),l=o.join(r.formatSeparator).trim();return r.format(ys(t,c,s,r.options.keySeparator,r.options.ignoreJSONStructure),l,n,xs(xs(xs({},i),t),{},{interpolationkey:s}))};this.resetRegExp();var u=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,d=i&&i.interpolation&&void 0!==i.interpolation.skipOnVariables?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return l(e)}},{regex:this.regexp,safeValue:function(e){return r.escapeValue?l(r.escape(e)):l(e)}}].forEach((function(t){for(s=0;a=t.regex.exec(e);){var n=a[1].trim();if(void 0===(o=p(n)))if("function"==typeof u){var c=u(e,a,i);o="string"==typeof c?c:""}else if(i&&Object.prototype.hasOwnProperty.call(i,n))o="";else{if(d){o=a[0];continue}r.logger.warn("missed to pass in variable ".concat(n," for interpolating ").concat(e)),o=""}else"string"==typeof o||r.useRawValueToEscape||(o=Ho(o));var l=t.safeValue(o);if(e=e.replace(a[0],l),d?(t.regex.lastIndex+=o.length,t.regex.lastIndex-=a[0].length):t.regex.lastIndex=0,++s>=r.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var n,i,a,o=this,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};function r(e,t){var n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;var i=e.split(new RegExp("".concat(n,"[ ]*{"))),o="{".concat(i[1]);e=i[0];var s=(o=this.interpolate(o,a)).match(/'/g),r=o.match(/"/g);(s&&s.length%2==0&&!r||r.length%2!=0)&&(o=o.replace(/'/g,'"'));try{a=JSON.parse(o),t&&(a=xs(xs({},t),a))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(n).concat(o)}return delete a.defaultValue,e}for(;n=this.nestingRegexp.exec(e);){var c=[];(a=(a=xs({},s)).replace&&"string"!=typeof a.replace?a.replace:a).applyPostProcessor=!1,delete a.defaultValue;var l=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var p=n[1].split(this.formatSeparator).map((function(e){return e.trim()}));n[1]=p.shift(),c=p,l=!0}if((i=t(r.call(this,n[1].trim(),a),a))&&n[0]===e&&"string"!=typeof i)return i;"string"!=typeof i&&(i=Ho(i)),i||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),i=""),l&&(i=c.reduce((function(e,t){return o.format(e,t,s.lng,xs(xs({},s),{},{interpolationkey:n[1].trim()}))}),i.trim())),e=e.replace(n[0],i),this.regexp.lastIndex=0}return e}}]),e}();function ks(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function _s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ks(Object(n),!0).forEach((function(t){Ro(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ks(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function js(e){var t={};return function(n,i,a){var o=i+JSON.stringify(a),s=t[o];return s||(s=e(i,a),t[o]=s),s(n)}}var Cs=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Co(this,e),this.logger=Vo.create("formatter"),this.options=t,this.formats={number:js((function(e,t){var n=new Intl.NumberFormat(e,_s({},t));return function(e){return n.format(e)}})),currency:js((function(e,t){var n=new Intl.NumberFormat(e,_s(_s({},t),{},{style:"currency"}));return function(e){return n.format(e)}})),datetime:js((function(e,t){var n=new Intl.DateTimeFormat(e,_s({},t));return function(e){return n.format(e)}})),relativetime:js((function(e,t){var n=new Intl.RelativeTimeFormat(e,_s({},t));return function(e){return n.format(e,t.range||"day")}})),list:js((function(e,t){var n=new Intl.ListFormat(e,_s({},t));return function(e){return n.format(e)}}))},this.init(t)}return To(e,[{key:"init",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=js(t)}},{key:"format",value:function(e,t,n){var i=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return t.split(this.formatSeparator).reduce((function(e,t){var o=function(e){var t=e.toLowerCase().trim(),n={};if(e.indexOf("(")>-1){var i=e.split("(");t=i[0].toLowerCase().trim();var a=i[1].substring(0,i[1].length-1);"currency"===t&&a.indexOf(":")<0?n.currency||(n.currency=a.trim()):"relativetime"===t&&a.indexOf(":")<0?n.range||(n.range=a.trim()):a.split(";").forEach((function(e){if(e){var t=No(e.split(":")),i=t[0],a=t.slice(1).join(":").trim().replace(/^'+|'+$/g,"");n[i.trim()]||(n[i.trim()]=a),"false"===a&&(n[i.trim()]=!1),"true"===a&&(n[i.trim()]=!0),isNaN(a)||(n[i.trim()]=parseInt(a,10))}}))}return{formatName:t,formatOptions:n}}(t),s=o.formatName,r=o.formatOptions;if(i.formats[s]){var c=e;try{var l=a&&a.formatParams&&a.formatParams[a.interpolationkey]||{},p=l.locale||l.lng||a.locale||a.lng||n;c=i.formats[s](e,p,_s(_s(_s({},r),a),l))}catch(e){i.logger.warn(e)}return c}return i.logger.warn("there was no format function for ".concat(s)),e}),e)}}]),e}();function Ss(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Es(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ss(Object(n),!0).forEach((function(t){Ro(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ss(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ts(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=Po(e);if(t){var a=Po(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return Io(this,n)}}var Ms=function(e){Ao(n,Bo);var t=Ts(n);function n(e,i,a){var o,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Co(this,n),o=t.call(this),Qo&&Bo.call(Mo(o)),o.backend=e,o.store=i,o.services=a,o.languageUtils=a.languageUtils,o.options=s,o.logger=Vo.create("backendConnector"),o.waitingReads=[],o.maxParallelReads=s.maxParallelReads||10,o.readingCalls=0,o.maxRetries=s.maxRetries>=0?s.maxRetries:5,o.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(a,s.backend,s),o}return To(n,[{key:"queueLoad",value:function(e,t,n,i){var a=this,o={},s={},r={},c={};return e.forEach((function(e){var i=!0;t.forEach((function(t){var r="".concat(e,"|").concat(t);!n.reload&&a.store.hasResourceBundle(e,t)?a.state[r]=2:a.state[r]<0||(1===a.state[r]?void 0===s[r]&&(s[r]=!0):(a.state[r]=1,i=!1,void 0===s[r]&&(s[r]=!0),void 0===o[r]&&(o[r]=!0),void 0===c[t]&&(c[t]=!0)))})),i||(r[e]=!0)})),(Object.keys(o).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(s),toLoadLanguages:Object.keys(r),toLoadNamespaces:Object.keys(c)}}},{key:"loaded",value:function(e,t,n){var i=e.split("|"),a=i[0],o=i[1];t&&this.emit("failedLoading",a,o,t),n&&this.store.addResourceBundle(a,o,n),this.state[e]=t?-1:2;var s={};this.queue.forEach((function(n){!function(e,t,n,i){var a=Wo(e,t,Object),o=a.obj,s=a.k;o[s]=o[s]||[],i&&(o[s]=o[s].concat(n)),i||o[s].push(n)}(n.loaded,[a],o),function(e,t){void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)}(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach((function(e){s[e]||(s[e]={});var t=n.loaded[e];t.length&&t.forEach((function(t){void 0===s[e][t]&&(s[e][t]=!0)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",s),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,n){var i=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,s=arguments.length>5?arguments[5]:void 0;if(!e.length)return s(null,{});if(this.readingCalls>=this.maxParallelReads)this.waitingReads.push({lng:e,ns:t,fcName:n,tried:a,wait:o,callback:s});else{this.readingCalls++;var r=function(r,c){if(i.readingCalls--,i.waitingReads.length>0){var l=i.waitingReads.shift();i.read(l.lng,l.ns,l.fcName,l.tried,l.wait,l.callback)}r&&c&&a<i.maxRetries?setTimeout((function(){i.read.call(i,e,t,n,a+1,2*o,s)}),o):s(r,c)},c=this.backend[n].bind(this.backend);if(2!==c.length)return c(e,t,r);try{var l=c(e,t);l&&"function"==typeof l.then?l.then((function(e){return r(null,e)})).catch(r):r(null,l)}catch(e){r(e)}}}},{key:"prepareLoading",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),a&&a();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var o=this.queueLoad(e,t,i,a);if(!o.toLoad.length)return o.pending.length||a(),null;o.toLoad.forEach((function(e){n.loadOne(e)}))}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n)}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=e.split("|"),a=i[0],o=i[1];this.read(a,o,"read",void 0,void 0,(function(i,s){i&&t.logger.warn("".concat(n,"loading namespace ").concat(o," for language ").concat(a," failed"),i),!i&&s&&t.logger.log("".concat(n,"loaded namespace ").concat(o," for language ").concat(a),s),t.loaded(e,i,s)}))}},{key:"saveMissing",value:function(e,t,n,i,a){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=n&&""!==n){if(this.backend&&this.backend.create){var r=Es(Es({},o),{},{isUpdate:a}),c=this.backend.create.bind(this.backend);if(c.length<6)try{var l;(l=5===c.length?c(e,t,n,i,r):c(e,t,n,i))&&"function"==typeof l.then?l.then((function(e){return s(null,e)})).catch(s):s(null,l)}catch(e){s(e)}else c(e,t,n,i,s,r)}e&&e[0]&&this.store.addResource(e[0],t,n,i)}}}]),n}();function Os(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===jo(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===jo(e[2])||"object"===jo(e[3])){var n=e[3]||e[2];Object.keys(n).forEach((function(e){t[e]=n[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,n,i){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function As(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function Is(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Ps(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Is(Object(n),!0).forEach((function(t){Ro(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Is(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Rs(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=Po(e);if(t){var a=Po(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return Io(this,n)}}function Ls(){}var Ns=function(e){Ao(n,Bo);var t=Rs(n);function n(){var e,i,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;if(Co(this,n),e=t.call(this),Qo&&Bo.call(Mo(e)),e.options=As(a),e.services={},e.logger=Vo,e.modules={external:[]},i=Mo(e),Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach((function(e){"function"==typeof i[e]&&(i[e]=i[e].bind(i))})),o&&!e.isInitialized&&!a.isClone){if(!e.options.initImmediate)return e.init(a,o),Io(e,Mo(e));setTimeout((function(){e.init(a,o)}),0)}return e}return To(n,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));var i=Os();function a(e){return e?"function"==typeof e?new e:e:null}if(this.options=Ps(Ps(Ps({},i),this.options),As(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=Ps(Ps({},i.interpolation),this.options.interpolation)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){var o;this.modules.logger?Vo.init(a(this.modules.logger),this.options):Vo.init(null,this.options),this.modules.formatter?o=this.modules.formatter:"undefined"!=typeof Intl&&(o=Cs);var s=new ds(this.options);this.store=new as(this.options.resources,this.options);var r=this.services;r.logger=Vo,r.resourceStore=this.store,r.languageUtils=s,r.pluralResolver=new vs(s,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!o||this.options.interpolation.format&&this.options.interpolation.format!==i.interpolation.format||(r.formatter=a(o),r.formatter.init(r,this.options),this.options.interpolation.format=r.formatter.format.bind(r.formatter)),r.interpolator=new ws(this.options),r.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},r.backendConnector=new Ms(a(this.modules.backend),r.resourceStore,r,this.options),r.backendConnector.on("*",(function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];e.emit.apply(e,[t].concat(i))})),this.modules.languageDetector&&(r.languageDetector=a(this.modules.languageDetector),r.languageDetector.init&&r.languageDetector.init(r,this.options.detection,this.options)),this.modules.i18nFormat&&(r.i18nFormat=a(this.modules.i18nFormat),r.i18nFormat.init&&r.i18nFormat.init(this)),this.translator=new ps(this.services,this.options),this.translator.on("*",(function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];e.emit.apply(e,[t].concat(i))})),this.modules.external.forEach((function(t){t.init&&t.init(e)}))}if(this.format=this.options.interpolation.format,n||(n=Ls),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&"dev"!==c[0]&&(this.options.lng=c[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments)}}));["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments),e}}));var l=Uo(),p=function(){var t=function(t,i){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),l.resolve(i),n(t,i)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?p():setTimeout(p,0),l}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ls,i="string"==typeof e?e:this.language;if("function"==typeof e&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(i&&"cimode"===i.toLowerCase())return n();var a=[],o=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){a.indexOf(e)<0&&a.push(e)}))};if(i)o(i);else this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((function(e){return o(e)}));this.options.preload&&this.options.preload.forEach((function(e){return o(e)})),this.services.backendConnector.load(a,this.options.ns,(function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),n(e)}))}else n(null)}},{key:"reloadResources",value:function(e,t,n){var i=Uo();return e||(e=this.languages),t||(t=this.options.ns),n||(n=Ls),this.services.backendConnector.reload(e,t,(function(e){i.resolve(),n(e)})),i}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&os.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"setResolvedLanguage",value:function(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t<this.languages.length;t++){var n=this.languages[t];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var i=Uo();this.emit("languageChanging",e);var a=function(e){n.language=e,n.languages=n.services.languageUtils.toResolveHierarchy(e),n.resolvedLanguage=void 0,n.setResolvedLanguage(e)},o=function(o){e||o||!n.services.languageDetector||(o=[]);var s="string"==typeof o?o:n.services.languageUtils.getBestMatchFromCodes(o);s&&(n.language||a(s),n.translator.language||n.translator.changeLanguage(s),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage&&n.services.languageDetector.cacheUserLanguage(s)),n.loadResources(s,(function(e){!function(e,o){o?(a(o),n.translator.changeLanguage(o),n.isLanguageChangingTo=void 0,n.emit("languageChanged",o),n.logger.log("languageChanged",o)):n.isLanguageChangingTo=void 0,i.resolve((function(){return n.t.apply(n,arguments)})),t&&t(e,(function(){return n.t.apply(n,arguments)}))}(e,s)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),i}},{key:"getFixedT",value:function(e,t,n){var i=this,a=function e(t,a){var o;if("object"!==jo(a)){for(var s=arguments.length,r=new Array(s>2?s-2:0),c=2;c<s;c++)r[c-2]=arguments[c];o=i.options.overloadTranslationOptionHandler([t,a].concat(r))}else o=Ps({},a);o.lng=o.lng||e.lng,o.lngs=o.lngs||e.lngs,o.ns=o.ns||e.ns,o.keyPrefix=o.keyPrefix||n||e.keyPrefix;var l,p=i.options.keySeparator||".";return l=o.keyPrefix&&Array.isArray(t)?t.map((function(e){return"".concat(o.keyPrefix).concat(p).concat(e)})):o.keyPrefix?"".concat(o.keyPrefix).concat(p).concat(t):t,i.t(l,o)};return"string"==typeof e?a.lng=e:a.lngs=e,a.ns=t,a.keyPrefix=n,a}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"hasLoadedNamespace",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var i=n.lng||this.resolvedLanguage||this.languages[0],a=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===i.toLowerCase())return!0;var s=function(e,n){var i=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===i||2===i};if(n.precheck){var r=n.precheck(this,s);if(void 0!==r)return r}return!!this.hasResourceBundle(i,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!s(i,e)||a&&!s(o,e)))}},{key:"loadNamespaces",value:function(e,t){var n=this,i=Uo();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e)})),this.loadResources((function(e){i.resolve(),t&&t(e)})),i):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=Uo();"string"==typeof e&&(e=[e]);var i=this.options.preload||[],a=e.filter((function(e){return i.indexOf(e)<0}));return a.length?(this.options.preload=i.concat(a),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";var t=this.services&&this.services.languageUtils||new ds(Os());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ls,a=Ps(Ps(Ps({},this.options),t),{isClone:!0}),o=new n(a);void 0===t.debug&&void 0===t.prefix||(o.logger=o.logger.clone(t));return["store","services","language"].forEach((function(t){o[t]=e[t]})),o.services=Ps({},this.services),o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o.translator=new ps(o.services,o.options),o.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];o.emit.apply(o,[e].concat(n))})),o.init(a,i),o.translator.options=o.options,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),n}();Ro(Ns,"createInstance",(function(){return new Ns(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}));var Ds=Ns.createInstance();function qs(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function Fs(e,t){for(var n,i="",a=0,o=-1,s=0,r=0;r<=e.length;++r){if(r<e.length)n=e.charCodeAt(r);else{if(47===n)break;n=47}if(47===n){if(o===r-1||1===s);else if(o!==r-1&&2===s){if(i.length<2||2!==a||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2))if(i.length>2){var c=i.lastIndexOf("/");if(c!==i.length-1){-1===c?(i="",a=0):a=(i=i.slice(0,c)).length-1-i.lastIndexOf("/"),o=r,s=0;continue}}else if(2===i.length||1===i.length){i="",a=0,o=r,s=0;continue}t&&(i.length>0?i+="/..":i="..",a=2)}else i.length>0?i+="/"+e.slice(o+1,r):i=e.slice(o+1,r),a=r-o-1;o=r,s=0}else 46===n&&-1!==s?++s:s=-1}return i}Ds.createInstance=Ns.createInstance,Ds.createInstance,Ds.dir,Ds.init,Ds.loadResources,Ds.reloadResources,Ds.use,Ds.changeLanguage,Ds.getFixedT,Ds.t,Ds.exists,Ds.setDefaultNamespace,Ds.hasLoadedNamespace,Ds.loadNamespaces,Ds.loadLanguages;var zs={resolve:function(){for(var e,t="",n=!1,i=arguments.length-1;i>=-1&&!n;i--){var a;i>=0?a=arguments[i]:(void 0===e&&(e=process.cwd()),a=e),qs(a),0!==a.length&&(t=a+"/"+t,n=47===a.charCodeAt(0))}return t=Fs(t,!n),n?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(e){if(qs(e),0===e.length)return".";var t=47===e.charCodeAt(0),n=47===e.charCodeAt(e.length-1);return 0!==(e=Fs(e,!t)).length||t||(e="."),e.length>0&&n&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return qs(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var n=arguments[t];qs(n),n.length>0&&(void 0===e?e=n:e+="/"+n)}return void 0===e?".":zs.normalize(e)},relative:function(e,t){if(qs(e),qs(t),e===t)return"";if((e=zs.resolve(e))===(t=zs.resolve(t)))return"";for(var n=1;n<e.length&&47===e.charCodeAt(n);++n);for(var i=e.length,a=i-n,o=1;o<t.length&&47===t.charCodeAt(o);++o);for(var s=t.length-o,r=a<s?a:s,c=-1,l=0;l<=r;++l){if(l===r){if(s>r){if(47===t.charCodeAt(o+l))return t.slice(o+l+1);if(0===l)return t.slice(o+l)}else a>r&&(47===e.charCodeAt(n+l)?c=l:0===l&&(c=0));break}var p=e.charCodeAt(n+l);if(p!==t.charCodeAt(o+l))break;47===p&&(c=l)}var u="";for(l=n+c+1;l<=i;++l)l!==i&&47!==e.charCodeAt(l)||(0===u.length?u+="..":u+="/..");return u.length>0?u+t.slice(o+c):(o+=c,47===t.charCodeAt(o)&&++o,t.slice(o))},_makeLong:function(e){return e},dirname:function(e){if(qs(e),0===e.length)return".";for(var t=e.charCodeAt(0),n=47===t,i=-1,a=!0,o=e.length-1;o>=1;--o)if(47===(t=e.charCodeAt(o))){if(!a){i=o;break}}else a=!1;return-1===i?n?"/":".":n&&1===i?"//":e.slice(0,i)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');qs(e);var n,i=0,a=-1,o=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var s=t.length-1,r=-1;for(n=e.length-1;n>=0;--n){var c=e.charCodeAt(n);if(47===c){if(!o){i=n+1;break}}else-1===r&&(o=!1,r=n+1),s>=0&&(c===t.charCodeAt(s)?-1==--s&&(a=n):(s=-1,a=r))}return i===a?a=r:-1===a&&(a=e.length),e.slice(i,a)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!o){i=n+1;break}}else-1===a&&(o=!1,a=n+1);return-1===a?"":e.slice(i,a)},extname:function(e){qs(e);for(var t=-1,n=0,i=-1,a=!0,o=0,s=e.length-1;s>=0;--s){var r=e.charCodeAt(s);if(47!==r)-1===i&&(a=!1,i=s+1),46===r?-1===t?t=s:1!==o&&(o=1):-1!==t&&(o=-1);else if(!a){n=s+1;break}}return-1===t||-1===i||0===o||1===o&&t===i-1&&t===n+1?"":e.slice(t,i)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var n=t.dir||t.root,i=t.base||(t.name||"")+(t.ext||"");return n?n===t.root?n+i:n+e+i:i}("/",e)},parse:function(e){qs(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var n,i=e.charCodeAt(0),a=47===i;a?(t.root="/",n=1):n=0;for(var o=-1,s=0,r=-1,c=!0,l=e.length-1,p=0;l>=n;--l)if(47!==(i=e.charCodeAt(l)))-1===r&&(c=!1,r=l+1),46===i?-1===o?o=l:1!==p&&(p=1):-1!==o&&(p=-1);else if(!c){s=l+1;break}return-1===o||-1===r||0===p||1===p&&o===r-1&&o===s+1?-1!==r&&(t.base=t.name=0===s&&a?e.slice(1,r):e.slice(s,r)):(0===s&&a?(t.name=e.slice(1,o),t.base=e.slice(1,r)):(t.name=e.slice(s,o),t.base=e.slice(s,r)),t.ext=e.slice(o,r)),s>0?t.dir=e.slice(0,s-1):a&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};zs.posix=zs;var Vs=n(zs),Bs={},Us={"application/1d-interleaved-parityfec":{source:"iana"},"application/3gpdash-qoe-report+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/3gpp-ims+xml":{source:"iana",compressible:!0},"application/3gpphal+json":{source:"iana",compressible:!0},"application/3gpphalforms+json":{source:"iana",compressible:!0},"application/a2l":{source:"iana"},"application/ace+cbor":{source:"iana"},"application/activemessage":{source:"iana"},"application/activity+json":{source:"iana",compressible:!0},"application/alto-costmap+json":{source:"iana",compressible:!0},"application/alto-costmapfilter+json":{source:"iana",compressible:!0},"application/alto-directory+json":{source:"iana",compressible:!0},"application/alto-endpointcost+json":{source:"iana",compressible:!0},"application/alto-endpointcostparams+json":{source:"iana",compressible:!0},"application/alto-endpointprop+json":{source:"iana",compressible:!0},"application/alto-endpointpropparams+json":{source:"iana",compressible:!0},"application/alto-error+json":{source:"iana",compressible:!0},"application/alto-networkmap+json":{source:"iana",compressible:!0},"application/alto-networkmapfilter+json":{source:"iana",compressible:!0},"application/alto-updatestreamcontrol+json":{source:"iana",compressible:!0},"application/alto-updatestreamparams+json":{source:"iana",compressible:!0},"application/aml":{source:"iana"},"application/andrew-inset":{source:"iana",extensions:["ez"]},"application/applefile":{source:"iana"},"application/applixware":{source:"apache",extensions:["aw"]},"application/at+jwt":{source:"iana"},"application/atf":{source:"iana"},"application/atfx":{source:"iana"},"application/atom+xml":{source:"iana",compressible:!0,extensions:["atom"]},"application/atomcat+xml":{source:"iana",compressible:!0,extensions:["atomcat"]},"application/atomdeleted+xml":{source:"iana",compressible:!0,extensions:["atomdeleted"]},"application/atomicmail":{source:"iana"},"application/atomsvc+xml":{source:"iana",compressible:!0,extensions:["atomsvc"]},"application/atsc-dwd+xml":{source:"iana",compressible:!0,extensions:["dwd"]},"application/atsc-dynamic-event-message":{source:"iana"},"application/atsc-held+xml":{source:"iana",compressible:!0,extensions:["held"]},"application/atsc-rdt+json":{source:"iana",compressible:!0},"application/atsc-rsat+xml":{source:"iana",compressible:!0,extensions:["rsat"]},"application/atxml":{source:"iana"},"application/auth-policy+xml":{source:"iana",compressible:!0},"application/bacnet-xdd+zip":{source:"iana",compressible:!1},"application/batch-smtp":{source:"iana"},"application/bdoc":{compressible:!1,extensions:["bdoc"]},"application/beep+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/calendar+json":{source:"iana",compressible:!0},"application/calendar+xml":{source:"iana",compressible:!0,extensions:["xcs"]},"application/call-completion":{source:"iana"},"application/cals-1840":{source:"iana"},"application/captive+json":{source:"iana",compressible:!0},"application/cbor":{source:"iana"},"application/cbor-seq":{source:"iana"},"application/cccex":{source:"iana"},"application/ccmp+xml":{source:"iana",compressible:!0},"application/ccxml+xml":{source:"iana",compressible:!0,extensions:["ccxml"]},"application/cdfx+xml":{source:"iana",compressible:!0,extensions:["cdfx"]},"application/cdmi-capability":{source:"iana",extensions:["cdmia"]},"application/cdmi-container":{source:"iana",extensions:["cdmic"]},"application/cdmi-domain":{source:"iana",extensions:["cdmid"]},"application/cdmi-object":{source:"iana",extensions:["cdmio"]},"application/cdmi-queue":{source:"iana",extensions:["cdmiq"]},"application/cdni":{source:"iana"},"application/cea":{source:"iana"},"application/cea-2018+xml":{source:"iana",compressible:!0},"application/cellml+xml":{source:"iana",compressible:!0},"application/cfw":{source:"iana"},"application/city+json":{source:"iana",compressible:!0},"application/clr":{source:"iana"},"application/clue+xml":{source:"iana",compressible:!0},"application/clue_info+xml":{source:"iana",compressible:!0},"application/cms":{source:"iana"},"application/cnrp+xml":{source:"iana",compressible:!0},"application/coap-group+json":{source:"iana",compressible:!0},"application/coap-payload":{source:"iana"},"application/commonground":{source:"iana"},"application/conference-info+xml":{source:"iana",compressible:!0},"application/cose":{source:"iana"},"application/cose-key":{source:"iana"},"application/cose-key-set":{source:"iana"},"application/cpl+xml":{source:"iana",compressible:!0,extensions:["cpl"]},"application/csrattrs":{source:"iana"},"application/csta+xml":{source:"iana",compressible:!0},"application/cstadata+xml":{source:"iana",compressible:!0},"application/csvm+json":{source:"iana",compressible:!0},"application/cu-seeme":{source:"apache",extensions:["cu"]},"application/cwt":{source:"iana"},"application/cybercash":{source:"iana"},"application/dart":{compressible:!0},"application/dash+xml":{source:"iana",compressible:!0,extensions:["mpd"]},"application/dash-patch+xml":{source:"iana",compressible:!0,extensions:["mpp"]},"application/dashdelta":{source:"iana"},"application/davmount+xml":{source:"iana",compressible:!0,extensions:["davmount"]},"application/dca-rft":{source:"iana"},"application/dcd":{source:"iana"},"application/dec-dx":{source:"iana"},"application/dialog-info+xml":{source:"iana",compressible:!0},"application/dicom":{source:"iana"},"application/dicom+json":{source:"iana",compressible:!0},"application/dicom+xml":{source:"iana",compressible:!0},"application/dii":{source:"iana"},"application/dit":{source:"iana"},"application/dns":{source:"iana"},"application/dns+json":{source:"iana",compressible:!0},"application/dns-message":{source:"iana"},"application/docbook+xml":{source:"apache",compressible:!0,extensions:["dbk"]},"application/dots+cbor":{source:"iana"},"application/dskpp+xml":{source:"iana",compressible:!0},"application/dssc+der":{source:"iana",extensions:["dssc"]},"application/dssc+xml":{source:"iana",compressible:!0,extensions:["xdssc"]},"application/dvcs":{source:"iana"},"application/ecmascript":{source:"iana",compressible:!0,extensions:["es","ecma"]},"application/edi-consent":{source:"iana"},"application/edi-x12":{source:"iana",compressible:!1},"application/edifact":{source:"iana",compressible:!1},"application/efi":{source:"iana"},"application/elm+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/elm+xml":{source:"iana",compressible:!0},"application/emergencycalldata.cap+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/emergencycalldata.comment+xml":{source:"iana",compressible:!0},"application/emergencycalldata.control+xml":{source:"iana",compressible:!0},"application/emergencycalldata.deviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.ecall.msd":{source:"iana"},"application/emergencycalldata.providerinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.serviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.subscriberinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.veds+xml":{source:"iana",compressible:!0},"application/emma+xml":{source:"iana",compressible:!0,extensions:["emma"]},"application/emotionml+xml":{source:"iana",compressible:!0,extensions:["emotionml"]},"application/encaprtp":{source:"iana"},"application/epp+xml":{source:"iana",compressible:!0},"application/epub+zip":{source:"iana",compressible:!1,extensions:["epub"]},"application/eshop":{source:"iana"},"application/exi":{source:"iana",extensions:["exi"]},"application/expect-ct-report+json":{source:"iana",compressible:!0},"application/express":{source:"iana",extensions:["exp"]},"application/fastinfoset":{source:"iana"},"application/fastsoap":{source:"iana"},"application/fdt+xml":{source:"iana",compressible:!0,extensions:["fdt"]},"application/fhir+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/fhir+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/fido.trusted-apps+json":{compressible:!0},"application/fits":{source:"iana"},"application/flexfec":{source:"iana"},"application/font-sfnt":{source:"iana"},"application/font-tdpfr":{source:"iana",extensions:["pfr"]},"application/font-woff":{source:"iana",compressible:!1},"application/framework-attributes+xml":{source:"iana",compressible:!0},"application/geo+json":{source:"iana",compressible:!0,extensions:["geojson"]},"application/geo+json-seq":{source:"iana"},"application/geopackage+sqlite3":{source:"iana"},"application/geoxacml+xml":{source:"iana",compressible:!0},"application/gltf-buffer":{source:"iana"},"application/gml+xml":{source:"iana",compressible:!0,extensions:["gml"]},"application/gpx+xml":{source:"apache",compressible:!0,extensions:["gpx"]},"application/gxf":{source:"apache",extensions:["gxf"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/h224":{source:"iana"},"application/held+xml":{source:"iana",compressible:!0},"application/hjson":{extensions:["hjson"]},"application/http":{source:"iana"},"application/hyperstudio":{source:"iana",extensions:["stk"]},"application/ibe-key-request+xml":{source:"iana",compressible:!0},"application/ibe-pkg-reply+xml":{source:"iana",compressible:!0},"application/ibe-pp-data":{source:"iana"},"application/iges":{source:"iana"},"application/im-iscomposing+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/index":{source:"iana"},"application/index.cmd":{source:"iana"},"application/index.obj":{source:"iana"},"application/index.response":{source:"iana"},"application/index.vnd":{source:"iana"},"application/inkml+xml":{source:"iana",compressible:!0,extensions:["ink","inkml"]},"application/iotp":{source:"iana"},"application/ipfix":{source:"iana",extensions:["ipfix"]},"application/ipp":{source:"iana"},"application/isup":{source:"iana"},"application/its+xml":{source:"iana",compressible:!0,extensions:["its"]},"application/java-archive":{source:"apache",compressible:!1,extensions:["jar","war","ear"]},"application/java-serialized-object":{source:"apache",compressible:!1,extensions:["ser"]},"application/java-vm":{source:"apache",compressible:!1,extensions:["class"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/jf2feed+json":{source:"iana",compressible:!0},"application/jose":{source:"iana"},"application/jose+json":{source:"iana",compressible:!0},"application/jrd+json":{source:"iana",compressible:!0},"application/jscalendar+json":{source:"iana",compressible:!0},"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/json-patch+json":{source:"iana",compressible:!0},"application/json-seq":{source:"iana"},"application/json5":{extensions:["json5"]},"application/jsonml+json":{source:"apache",compressible:!0,extensions:["jsonml"]},"application/jwk+json":{source:"iana",compressible:!0},"application/jwk-set+json":{source:"iana",compressible:!0},"application/jwt":{source:"iana"},"application/kpml-request+xml":{source:"iana",compressible:!0},"application/kpml-response+xml":{source:"iana",compressible:!0},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/lgr+xml":{source:"iana",compressible:!0,extensions:["lgr"]},"application/link-format":{source:"iana"},"application/load-control+xml":{source:"iana",compressible:!0},"application/lost+xml":{source:"iana",compressible:!0,extensions:["lostxml"]},"application/lostsync+xml":{source:"iana",compressible:!0},"application/lpf+zip":{source:"iana",compressible:!1},"application/lxf":{source:"iana"},"application/mac-binhex40":{source:"iana",extensions:["hqx"]},"application/mac-compactpro":{source:"apache",extensions:["cpt"]},"application/macwriteii":{source:"iana"},"application/mads+xml":{source:"iana",compressible:!0,extensions:["mads"]},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/marc":{source:"iana",extensions:["mrc"]},"application/marcxml+xml":{source:"iana",compressible:!0,extensions:["mrcx"]},"application/mathematica":{source:"iana",extensions:["ma","nb","mb"]},"application/mathml+xml":{source:"iana",compressible:!0,extensions:["mathml"]},"application/mathml-content+xml":{source:"iana",compressible:!0},"application/mathml-presentation+xml":{source:"iana",compressible:!0},"application/mbms-associated-procedure-description+xml":{source:"iana",compressible:!0},"application/mbms-deregister+xml":{source:"iana",compressible:!0},"application/mbms-envelope+xml":{source:"iana",compressible:!0},"application/mbms-msk+xml":{source:"iana",compressible:!0},"application/mbms-msk-response+xml":{source:"iana",compressible:!0},"application/mbms-protection-description+xml":{source:"iana",compressible:!0},"application/mbms-reception-report+xml":{source:"iana",compressible:!0},"application/mbms-register+xml":{source:"iana",compressible:!0},"application/mbms-register-response+xml":{source:"iana",compressible:!0},"application/mbms-schedule+xml":{source:"iana",compressible:!0},"application/mbms-user-service-description+xml":{source:"iana",compressible:!0},"application/mbox":{source:"iana",extensions:["mbox"]},"application/media-policy-dataset+xml":{source:"iana",compressible:!0,extensions:["mpf"]},"application/media_control+xml":{source:"iana",compressible:!0},"application/mediaservercontrol+xml":{source:"iana",compressible:!0,extensions:["mscml"]},"application/merge-patch+json":{source:"iana",compressible:!0},"application/metalink+xml":{source:"apache",compressible:!0,extensions:["metalink"]},"application/metalink4+xml":{source:"iana",compressible:!0,extensions:["meta4"]},"application/mets+xml":{source:"iana",compressible:!0,extensions:["mets"]},"application/mf4":{source:"iana"},"application/mikey":{source:"iana"},"application/mipc":{source:"iana"},"application/missing-blocks+cbor-seq":{source:"iana"},"application/mmt-aei+xml":{source:"iana",compressible:!0,extensions:["maei"]},"application/mmt-usd+xml":{source:"iana",compressible:!0,extensions:["musd"]},"application/mods+xml":{source:"iana",compressible:!0,extensions:["mods"]},"application/moss-keys":{source:"iana"},"application/moss-signature":{source:"iana"},"application/mosskey-data":{source:"iana"},"application/mosskey-request":{source:"iana"},"application/mp21":{source:"iana",extensions:["m21","mp21"]},"application/mp4":{source:"iana",extensions:["mp4s","m4p"]},"application/mpeg4-generic":{source:"iana"},"application/mpeg4-iod":{source:"iana"},"application/mpeg4-iod-xmt":{source:"iana"},"application/mrb-consumer+xml":{source:"iana",compressible:!0},"application/mrb-publish+xml":{source:"iana",compressible:!0},"application/msc-ivr+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msc-mixer+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msword":{source:"iana",compressible:!1,extensions:["doc","dot"]},"application/mud+json":{source:"iana",compressible:!0},"application/multipart-core":{source:"iana"},"application/mxf":{source:"iana",extensions:["mxf"]},"application/n-quads":{source:"iana",extensions:["nq"]},"application/n-triples":{source:"iana",extensions:["nt"]},"application/nasdata":{source:"iana"},"application/news-checkgroups":{source:"iana",charset:"US-ASCII"},"application/news-groupinfo":{source:"iana",charset:"US-ASCII"},"application/news-transmission":{source:"iana"},"application/nlsml+xml":{source:"iana",compressible:!0},"application/node":{source:"iana",extensions:["cjs"]},"application/nss":{source:"iana"},"application/oauth-authz-req+jwt":{source:"iana"},"application/oblivious-dns-message":{source:"iana"},"application/ocsp-request":{source:"iana"},"application/ocsp-response":{source:"iana"},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"]},"application/oda":{source:"iana",extensions:["oda"]},"application/odm+xml":{source:"iana",compressible:!0},"application/odx":{source:"iana"},"application/oebps-package+xml":{source:"iana",compressible:!0,extensions:["opf"]},"application/ogg":{source:"iana",compressible:!1,extensions:["ogx"]},"application/omdoc+xml":{source:"apache",compressible:!0,extensions:["omdoc"]},"application/onenote":{source:"apache",extensions:["onetoc","onetoc2","onetmp","onepkg"]},"application/opc-nodeset+xml":{source:"iana",compressible:!0},"application/oscore":{source:"iana"},"application/oxps":{source:"iana",extensions:["oxps"]},"application/p21":{source:"iana"},"application/p21+zip":{source:"iana",compressible:!1},"application/p2p-overlay+xml":{source:"iana",compressible:!0,extensions:["relo"]},"application/parityfec":{source:"iana"},"application/passport":{source:"iana"},"application/patch-ops-error+xml":{source:"iana",compressible:!0,extensions:["xer"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/pdx":{source:"iana"},"application/pem-certificate-chain":{source:"iana"},"application/pgp-encrypted":{source:"iana",compressible:!1,extensions:["pgp"]},"application/pgp-keys":{source:"iana",extensions:["asc"]},"application/pgp-signature":{source:"iana",extensions:["asc","sig"]},"application/pics-rules":{source:"apache",extensions:["prf"]},"application/pidf+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pidf-diff+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pkcs10":{source:"iana",extensions:["p10"]},"application/pkcs12":{source:"iana"},"application/pkcs7-mime":{source:"iana",extensions:["p7m","p7c"]},"application/pkcs7-signature":{source:"iana",extensions:["p7s"]},"application/pkcs8":{source:"iana",extensions:["p8"]},"application/pkcs8-encrypted":{source:"iana"},"application/pkix-attr-cert":{source:"iana",extensions:["ac"]},"application/pkix-cert":{source:"iana",extensions:["cer"]},"application/pkix-crl":{source:"iana",extensions:["crl"]},"application/pkix-pkipath":{source:"iana",extensions:["pkipath"]},"application/pkixcmp":{source:"iana",extensions:["pki"]},"application/pls+xml":{source:"iana",compressible:!0,extensions:["pls"]},"application/poc-settings+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/postscript":{source:"iana",compressible:!0,extensions:["ai","eps","ps"]},"application/ppsp-tracker+json":{source:"iana",compressible:!0},"application/problem+json":{source:"iana",compressible:!0},"application/problem+xml":{source:"iana",compressible:!0},"application/provenance+xml":{source:"iana",compressible:!0,extensions:["provx"]},"application/prs.alvestrand.titrax-sheet":{source:"iana"},"application/prs.cww":{source:"iana",extensions:["cww"]},"application/prs.cyn":{source:"iana",charset:"7-BIT"},"application/prs.hpub+zip":{source:"iana",compressible:!1},"application/prs.nprend":{source:"iana"},"application/prs.plucker":{source:"iana"},"application/prs.rdf-xml-crypt":{source:"iana"},"application/prs.xsf+xml":{source:"iana",compressible:!0},"application/pskc+xml":{source:"iana",compressible:!0,extensions:["pskcxml"]},"application/pvd+json":{source:"iana",compressible:!0},"application/qsig":{source:"iana"},"application/raml+yaml":{compressible:!0,extensions:["raml"]},"application/raptorfec":{source:"iana"},"application/rdap+json":{source:"iana",compressible:!0},"application/rdf+xml":{source:"iana",compressible:!0,extensions:["rdf","owl"]},"application/reginfo+xml":{source:"iana",compressible:!0,extensions:["rif"]},"application/relax-ng-compact-syntax":{source:"iana",extensions:["rnc"]},"application/remote-printing":{source:"iana"},"application/reputon+json":{source:"iana",compressible:!0},"application/resource-lists+xml":{source:"iana",compressible:!0,extensions:["rl"]},"application/resource-lists-diff+xml":{source:"iana",compressible:!0,extensions:["rld"]},"application/rfc+xml":{source:"iana",compressible:!0},"application/riscos":{source:"iana"},"application/rlmi+xml":{source:"iana",compressible:!0},"application/rls-services+xml":{source:"iana",compressible:!0,extensions:["rs"]},"application/route-apd+xml":{source:"iana",compressible:!0,extensions:["rapd"]},"application/route-s-tsid+xml":{source:"iana",compressible:!0,extensions:["sls"]},"application/route-usd+xml":{source:"iana",compressible:!0,extensions:["rusd"]},"application/rpki-ghostbusters":{source:"iana",extensions:["gbr"]},"application/rpki-manifest":{source:"iana",extensions:["mft"]},"application/rpki-publication":{source:"iana"},"application/rpki-roa":{source:"iana",extensions:["roa"]},"application/rpki-updown":{source:"iana"},"application/rsd+xml":{source:"apache",compressible:!0,extensions:["rsd"]},"application/rss+xml":{source:"apache",compressible:!0,extensions:["rss"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/rtploopback":{source:"iana"},"application/rtx":{source:"iana"},"application/samlassertion+xml":{source:"iana",compressible:!0},"application/samlmetadata+xml":{source:"iana",compressible:!0},"application/sarif+json":{source:"iana",compressible:!0},"application/sarif-external-properties+json":{source:"iana",compressible:!0},"application/sbe":{source:"iana"},"application/sbml+xml":{source:"iana",compressible:!0,extensions:["sbml"]},"application/scaip+xml":{source:"iana",compressible:!0},"application/scim+json":{source:"iana",compressible:!0},"application/scvp-cv-request":{source:"iana",extensions:["scq"]},"application/scvp-cv-response":{source:"iana",extensions:["scs"]},"application/scvp-vp-request":{source:"iana",extensions:["spq"]},"application/scvp-vp-response":{source:"iana",extensions:["spp"]},"application/sdp":{source:"iana",extensions:["sdp"]},"application/secevent+jwt":{source:"iana"},"application/senml+cbor":{source:"iana"},"application/senml+json":{source:"iana",compressible:!0},"application/senml+xml":{source:"iana",compressible:!0,extensions:["senmlx"]},"application/senml-etch+cbor":{source:"iana"},"application/senml-etch+json":{source:"iana",compressible:!0},"application/senml-exi":{source:"iana"},"application/sensml+cbor":{source:"iana"},"application/sensml+json":{source:"iana",compressible:!0},"application/sensml+xml":{source:"iana",compressible:!0,extensions:["sensmlx"]},"application/sensml-exi":{source:"iana"},"application/sep+xml":{source:"iana",compressible:!0},"application/sep-exi":{source:"iana"},"application/session-info":{source:"iana"},"application/set-payment":{source:"iana"},"application/set-payment-initiation":{source:"iana",extensions:["setpay"]},"application/set-registration":{source:"iana"},"application/set-registration-initiation":{source:"iana",extensions:["setreg"]},"application/sgml":{source:"iana"},"application/sgml-open-catalog":{source:"iana"},"application/shf+xml":{source:"iana",compressible:!0,extensions:["shf"]},"application/sieve":{source:"iana",extensions:["siv","sieve"]},"application/simple-filter+xml":{source:"iana",compressible:!0},"application/simple-message-summary":{source:"iana"},"application/simplesymbolcontainer":{source:"iana"},"application/sipc":{source:"iana"},"application/slate":{source:"iana"},"application/smil":{source:"iana"},"application/smil+xml":{source:"iana",compressible:!0,extensions:["smi","smil"]},"application/smpte336m":{source:"iana"},"application/soap+fastinfoset":{source:"iana"},"application/soap+xml":{source:"iana",compressible:!0},"application/sparql-query":{source:"iana",extensions:["rq"]},"application/sparql-results+xml":{source:"iana",compressible:!0,extensions:["srx"]},"application/spdx+json":{source:"iana",compressible:!0},"application/spirits-event+xml":{source:"iana",compressible:!0},"application/sql":{source:"iana"},"application/srgs":{source:"iana",extensions:["gram"]},"application/srgs+xml":{source:"iana",compressible:!0,extensions:["grxml"]},"application/sru+xml":{source:"iana",compressible:!0,extensions:["sru"]},"application/ssdl+xml":{source:"apache",compressible:!0,extensions:["ssdl"]},"application/ssml+xml":{source:"iana",compressible:!0,extensions:["ssml"]},"application/stix+json":{source:"iana",compressible:!0},"application/swid+xml":{source:"iana",compressible:!0,extensions:["swidtag"]},"application/tamp-apex-update":{source:"iana"},"application/tamp-apex-update-confirm":{source:"iana"},"application/tamp-community-update":{source:"iana"},"application/tamp-community-update-confirm":{source:"iana"},"application/tamp-error":{source:"iana"},"application/tamp-sequence-adjust":{source:"iana"},"application/tamp-sequence-adjust-confirm":{source:"iana"},"application/tamp-status-query":{source:"iana"},"application/tamp-status-response":{source:"iana"},"application/tamp-update":{source:"iana"},"application/tamp-update-confirm":{source:"iana"},"application/tar":{compressible:!0},"application/taxii+json":{source:"iana",compressible:!0},"application/td+json":{source:"iana",compressible:!0},"application/tei+xml":{source:"iana",compressible:!0,extensions:["tei","teicorpus"]},"application/tetra_isi":{source:"iana"},"application/thraud+xml":{source:"iana",compressible:!0,extensions:["tfi"]},"application/timestamp-query":{source:"iana"},"application/timestamp-reply":{source:"iana"},"application/timestamped-data":{source:"iana",extensions:["tsd"]},"application/tlsrpt+gzip":{source:"iana"},"application/tlsrpt+json":{source:"iana",compressible:!0},"application/tnauthlist":{source:"iana"},"application/token-introspection+jwt":{source:"iana"},"application/toml":{compressible:!0,extensions:["toml"]},"application/trickle-ice-sdpfrag":{source:"iana"},"application/trig":{source:"iana",extensions:["trig"]},"application/ttml+xml":{source:"iana",compressible:!0,extensions:["ttml"]},"application/tve-trigger":{source:"iana"},"application/tzif":{source:"iana"},"application/tzif-leap":{source:"iana"},"application/ubjson":{compressible:!1,extensions:["ubj"]},"application/ulpfec":{source:"iana"},"application/urc-grpsheet+xml":{source:"iana",compressible:!0},"application/urc-ressheet+xml":{source:"iana",compressible:!0,extensions:["rsheet"]},"application/urc-targetdesc+xml":{source:"iana",compressible:!0,extensions:["td"]},"application/urc-uisocketdesc+xml":{source:"iana",compressible:!0},"application/vcard+json":{source:"iana",compressible:!0},"application/vcard+xml":{source:"iana",compressible:!0},"application/vemmi":{source:"iana"},"application/vividence.scriptfile":{source:"apache"},"application/vnd.1000minds.decision-model+xml":{source:"iana",compressible:!0,extensions:["1km"]},"application/vnd.3gpp-prose+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-prose-pc3ch+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-v2x-local-service-information":{source:"iana"},"application/vnd.3gpp.5gnas":{source:"iana"},"application/vnd.3gpp.access-transfer-events+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.bsf+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gmop+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gtpc":{source:"iana"},"application/vnd.3gpp.interworking-data":{source:"iana"},"application/vnd.3gpp.lpp":{source:"iana"},"application/vnd.3gpp.mc-signalling-ear":{source:"iana"},"application/vnd.3gpp.mcdata-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-payload":{source:"iana"},"application/vnd.3gpp.mcdata-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-signalling":{source:"iana"},"application/vnd.3gpp.mcdata-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-floor-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-signed+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-init-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-transmission-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mid-call+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ngap":{source:"iana"},"application/vnd.3gpp.pfcp":{source:"iana"},"application/vnd.3gpp.pic-bw-large":{source:"iana",extensions:["plb"]},"application/vnd.3gpp.pic-bw-small":{source:"iana",extensions:["psb"]},"application/vnd.3gpp.pic-bw-var":{source:"iana",extensions:["pvb"]},"application/vnd.3gpp.s1ap":{source:"iana"},"application/vnd.3gpp.sms":{source:"iana"},"application/vnd.3gpp.sms+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-ext+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.state-and-event-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ussd+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.bcmcsinfo+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.sms":{source:"iana"},"application/vnd.3gpp2.tcap":{source:"iana",extensions:["tcap"]},"application/vnd.3lightssoftware.imagescal":{source:"iana"},"application/vnd.3m.post-it-notes":{source:"iana",extensions:["pwn"]},"application/vnd.accpac.simply.aso":{source:"iana",extensions:["aso"]},"application/vnd.accpac.simply.imp":{source:"iana",extensions:["imp"]},"application/vnd.acucobol":{source:"iana",extensions:["acu"]},"application/vnd.acucorp":{source:"iana",extensions:["atc","acutc"]},"application/vnd.adobe.air-application-installer-package+zip":{source:"apache",compressible:!1,extensions:["air"]},"application/vnd.adobe.flash.movie":{source:"iana"},"application/vnd.adobe.formscentral.fcdt":{source:"iana",extensions:["fcdt"]},"application/vnd.adobe.fxp":{source:"iana",extensions:["fxp","fxpl"]},"application/vnd.adobe.partial-upload":{source:"iana"},"application/vnd.adobe.xdp+xml":{source:"iana",compressible:!0,extensions:["xdp"]},"application/vnd.adobe.xfdf":{source:"iana",extensions:["xfdf"]},"application/vnd.aether.imp":{source:"iana"},"application/vnd.afpc.afplinedata":{source:"iana"},"application/vnd.afpc.afplinedata-pagedef":{source:"iana"},"application/vnd.afpc.cmoca-cmresource":{source:"iana"},"application/vnd.afpc.foca-charset":{source:"iana"},"application/vnd.afpc.foca-codedfont":{source:"iana"},"application/vnd.afpc.foca-codepage":{source:"iana"},"application/vnd.afpc.modca":{source:"iana"},"application/vnd.afpc.modca-cmtable":{source:"iana"},"application/vnd.afpc.modca-formdef":{source:"iana"},"application/vnd.afpc.modca-mediummap":{source:"iana"},"application/vnd.afpc.modca-objectcontainer":{source:"iana"},"application/vnd.afpc.modca-overlay":{source:"iana"},"application/vnd.afpc.modca-pagesegment":{source:"iana"},"application/vnd.age":{source:"iana",extensions:["age"]},"application/vnd.ah-barcode":{source:"iana"},"application/vnd.ahead.space":{source:"iana",extensions:["ahead"]},"application/vnd.airzip.filesecure.azf":{source:"iana",extensions:["azf"]},"application/vnd.airzip.filesecure.azs":{source:"iana",extensions:["azs"]},"application/vnd.amadeus+json":{source:"iana",compressible:!0},"application/vnd.amazon.ebook":{source:"apache",extensions:["azw"]},"application/vnd.amazon.mobi8-ebook":{source:"iana"},"application/vnd.americandynamics.acc":{source:"iana",extensions:["acc"]},"application/vnd.amiga.ami":{source:"iana",extensions:["ami"]},"application/vnd.amundsen.maze+xml":{source:"iana",compressible:!0},"application/vnd.android.ota":{source:"iana"},"application/vnd.android.package-archive":{source:"apache",compressible:!1,extensions:["apk"]},"application/vnd.anki":{source:"iana"},"application/vnd.anser-web-certificate-issue-initiation":{source:"iana",extensions:["cii"]},"application/vnd.anser-web-funds-transfer-initiation":{source:"apache",extensions:["fti"]},"application/vnd.antix.game-component":{source:"iana",extensions:["atx"]},"application/vnd.apache.arrow.file":{source:"iana"},"application/vnd.apache.arrow.stream":{source:"iana"},"application/vnd.apache.thrift.binary":{source:"iana"},"application/vnd.apache.thrift.compact":{source:"iana"},"application/vnd.apache.thrift.json":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/vnd.aplextor.warrp+json":{source:"iana",compressible:!0},"application/vnd.apothekende.reservation+json":{source:"iana",compressible:!0},"application/vnd.apple.installer+xml":{source:"iana",compressible:!0,extensions:["mpkg"]},"application/vnd.apple.keynote":{source:"iana",extensions:["key"]},"application/vnd.apple.mpegurl":{source:"iana",extensions:["m3u8"]},"application/vnd.apple.numbers":{source:"iana",extensions:["numbers"]},"application/vnd.apple.pages":{source:"iana",extensions:["pages"]},"application/vnd.apple.pkpass":{compressible:!1,extensions:["pkpass"]},"application/vnd.arastra.swi":{source:"iana"},"application/vnd.aristanetworks.swi":{source:"iana",extensions:["swi"]},"application/vnd.artisan+json":{source:"iana",compressible:!0},"application/vnd.artsquare":{source:"iana"},"application/vnd.astraea-software.iota":{source:"iana",extensions:["iota"]},"application/vnd.audiograph":{source:"iana",extensions:["aep"]},"application/vnd.autopackage":{source:"iana"},"application/vnd.avalon+json":{source:"iana",compressible:!0},"application/vnd.avistar+xml":{source:"iana",compressible:!0},"application/vnd.balsamiq.bmml+xml":{source:"iana",compressible:!0,extensions:["bmml"]},"application/vnd.balsamiq.bmpr":{source:"iana"},"application/vnd.banana-accounting":{source:"iana"},"application/vnd.bbf.usp.error":{source:"iana"},"application/vnd.bbf.usp.msg":{source:"iana"},"application/vnd.bbf.usp.msg+json":{source:"iana",compressible:!0},"application/vnd.bekitzur-stech+json":{source:"iana",compressible:!0},"application/vnd.bint.med-content":{source:"iana"},"application/vnd.biopax.rdf+xml":{source:"iana",compressible:!0},"application/vnd.blink-idb-value-wrapper":{source:"iana"},"application/vnd.blueice.multipass":{source:"iana",extensions:["mpm"]},"application/vnd.bluetooth.ep.oob":{source:"iana"},"application/vnd.bluetooth.le.oob":{source:"iana"},"application/vnd.bmi":{source:"iana",extensions:["bmi"]},"application/vnd.bpf":{source:"iana"},"application/vnd.bpf3":{source:"iana"},"application/vnd.businessobjects":{source:"iana",extensions:["rep"]},"application/vnd.byu.uapi+json":{source:"iana",compressible:!0},"application/vnd.cab-jscript":{source:"iana"},"application/vnd.canon-cpdl":{source:"iana"},"application/vnd.canon-lips":{source:"iana"},"application/vnd.capasystems-pg+json":{source:"iana",compressible:!0},"application/vnd.cendio.thinlinc.clientconf":{source:"iana"},"application/vnd.century-systems.tcp_stream":{source:"iana"},"application/vnd.chemdraw+xml":{source:"iana",compressible:!0,extensions:["cdxml"]},"application/vnd.chess-pgn":{source:"iana"},"application/vnd.chipnuts.karaoke-mmd":{source:"iana",extensions:["mmd"]},"application/vnd.ciedi":{source:"iana"},"application/vnd.cinderella":{source:"iana",extensions:["cdy"]},"application/vnd.cirpack.isdn-ext":{source:"iana"},"application/vnd.citationstyles.style+xml":{source:"iana",compressible:!0,extensions:["csl"]},"application/vnd.claymore":{source:"iana",extensions:["cla"]},"application/vnd.cloanto.rp9":{source:"iana",extensions:["rp9"]},"application/vnd.clonk.c4group":{source:"iana",extensions:["c4g","c4d","c4f","c4p","c4u"]},"application/vnd.cluetrust.cartomobile-config":{source:"iana",extensions:["c11amc"]},"application/vnd.cluetrust.cartomobile-config-pkg":{source:"iana",extensions:["c11amz"]},"application/vnd.coffeescript":{source:"iana"},"application/vnd.collabio.xodocuments.document":{source:"iana"},"application/vnd.collabio.xodocuments.document-template":{source:"iana"},"application/vnd.collabio.xodocuments.presentation":{source:"iana"},"application/vnd.collabio.xodocuments.presentation-template":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet-template":{source:"iana"},"application/vnd.collection+json":{source:"iana",compressible:!0},"application/vnd.collection.doc+json":{source:"iana",compressible:!0},"application/vnd.collection.next+json":{source:"iana",compressible:!0},"application/vnd.comicbook+zip":{source:"iana",compressible:!1},"application/vnd.comicbook-rar":{source:"iana"},"application/vnd.commerce-battelle":{source:"iana"},"application/vnd.commonspace":{source:"iana",extensions:["csp"]},"application/vnd.contact.cmsg":{source:"iana",extensions:["cdbcmsg"]},"application/vnd.coreos.ignition+json":{source:"iana",compressible:!0},"application/vnd.cosmocaller":{source:"iana",extensions:["cmc"]},"application/vnd.crick.clicker":{source:"iana",extensions:["clkx"]},"application/vnd.crick.clicker.keyboard":{source:"iana",extensions:["clkk"]},"application/vnd.crick.clicker.palette":{source:"iana",extensions:["clkp"]},"application/vnd.crick.clicker.template":{source:"iana",extensions:["clkt"]},"application/vnd.crick.clicker.wordbank":{source:"iana",extensions:["clkw"]},"application/vnd.criticaltools.wbs+xml":{source:"iana",compressible:!0,extensions:["wbs"]},"application/vnd.cryptii.pipe+json":{source:"iana",compressible:!0},"application/vnd.crypto-shade-file":{source:"iana"},"application/vnd.cryptomator.encrypted":{source:"iana"},"application/vnd.cryptomator.vault":{source:"iana"},"application/vnd.ctc-posml":{source:"iana",extensions:["pml"]},"application/vnd.ctct.ws+xml":{source:"iana",compressible:!0},"application/vnd.cups-pdf":{source:"iana"},"application/vnd.cups-postscript":{source:"iana"},"application/vnd.cups-ppd":{source:"iana",extensions:["ppd"]},"application/vnd.cups-raster":{source:"iana"},"application/vnd.cups-raw":{source:"iana"},"application/vnd.curl":{source:"iana"},"application/vnd.curl.car":{source:"apache",extensions:["car"]},"application/vnd.curl.pcurl":{source:"apache",extensions:["pcurl"]},"application/vnd.cyan.dean.root+xml":{source:"iana",compressible:!0},"application/vnd.cybank":{source:"iana"},"application/vnd.cyclonedx+json":{source:"iana",compressible:!0},"application/vnd.cyclonedx+xml":{source:"iana",compressible:!0},"application/vnd.d2l.coursepackage1p0+zip":{source:"iana",compressible:!1},"application/vnd.d3m-dataset":{source:"iana"},"application/vnd.d3m-problem":{source:"iana"},"application/vnd.dart":{source:"iana",compressible:!0,extensions:["dart"]},"application/vnd.data-vision.rdz":{source:"iana",extensions:["rdz"]},"application/vnd.datapackage+json":{source:"iana",compressible:!0},"application/vnd.dataresource+json":{source:"iana",compressible:!0},"application/vnd.dbf":{source:"iana",extensions:["dbf"]},"application/vnd.debian.binary-package":{source:"iana"},"application/vnd.dece.data":{source:"iana",extensions:["uvf","uvvf","uvd","uvvd"]},"application/vnd.dece.ttml+xml":{source:"iana",compressible:!0,extensions:["uvt","uvvt"]},"application/vnd.dece.unspecified":{source:"iana",extensions:["uvx","uvvx"]},"application/vnd.dece.zip":{source:"iana",extensions:["uvz","uvvz"]},"application/vnd.denovo.fcselayout-link":{source:"iana",extensions:["fe_launch"]},"application/vnd.desmume.movie":{source:"iana"},"application/vnd.dir-bi.plate-dl-nosuffix":{source:"iana"},"application/vnd.dm.delegation+xml":{source:"iana",compressible:!0},"application/vnd.dna":{source:"iana",extensions:["dna"]},"application/vnd.document+json":{source:"iana",compressible:!0},"application/vnd.dolby.mlp":{source:"apache",extensions:["mlp"]},"application/vnd.dolby.mobile.1":{source:"iana"},"application/vnd.dolby.mobile.2":{source:"iana"},"application/vnd.doremir.scorecloud-binary-document":{source:"iana"},"application/vnd.dpgraph":{source:"iana",extensions:["dpg"]},"application/vnd.dreamfactory":{source:"iana",extensions:["dfac"]},"application/vnd.drive+json":{source:"iana",compressible:!0},"application/vnd.ds-keypoint":{source:"apache",extensions:["kpxx"]},"application/vnd.dtg.local":{source:"iana"},"application/vnd.dtg.local.flash":{source:"iana"},"application/vnd.dtg.local.html":{source:"iana"},"application/vnd.dvb.ait":{source:"iana",extensions:["ait"]},"application/vnd.dvb.dvbisl+xml":{source:"iana",compressible:!0},"application/vnd.dvb.dvbj":{source:"iana"},"application/vnd.dvb.esgcontainer":{source:"iana"},"application/vnd.dvb.ipdcdftnotifaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess2":{source:"iana"},"application/vnd.dvb.ipdcesgpdd":{source:"iana"},"application/vnd.dvb.ipdcroaming":{source:"iana"},"application/vnd.dvb.iptv.alfec-base":{source:"iana"},"application/vnd.dvb.iptv.alfec-enhancement":{source:"iana"},"application/vnd.dvb.notif-aggregate-root+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-container+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-generic+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-msglist+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-request+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-response+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-init+xml":{source:"iana",compressible:!0},"application/vnd.dvb.pfr":{source:"iana"},"application/vnd.dvb.service":{source:"iana",extensions:["svc"]},"application/vnd.dxr":{source:"iana"},"application/vnd.dynageo":{source:"iana",extensions:["geo"]},"application/vnd.dzr":{source:"iana"},"application/vnd.easykaraoke.cdgdownload":{source:"iana"},"application/vnd.ecdis-update":{source:"iana"},"application/vnd.ecip.rlp":{source:"iana"},"application/vnd.eclipse.ditto+json":{source:"iana",compressible:!0},"application/vnd.ecowin.chart":{source:"iana",extensions:["mag"]},"application/vnd.ecowin.filerequest":{source:"iana"},"application/vnd.ecowin.fileupdate":{source:"iana"},"application/vnd.ecowin.series":{source:"iana"},"application/vnd.ecowin.seriesrequest":{source:"iana"},"application/vnd.ecowin.seriesupdate":{source:"iana"},"application/vnd.efi.img":{source:"iana"},"application/vnd.efi.iso":{source:"iana"},"application/vnd.emclient.accessrequest+xml":{source:"iana",compressible:!0},"application/vnd.enliven":{source:"iana",extensions:["nml"]},"application/vnd.enphase.envoy":{source:"iana"},"application/vnd.eprints.data+xml":{source:"iana",compressible:!0},"application/vnd.epson.esf":{source:"iana",extensions:["esf"]},"application/vnd.epson.msf":{source:"iana",extensions:["msf"]},"application/vnd.epson.quickanime":{source:"iana",extensions:["qam"]},"application/vnd.epson.salt":{source:"iana",extensions:["slt"]},"application/vnd.epson.ssf":{source:"iana",extensions:["ssf"]},"application/vnd.ericsson.quickcall":{source:"iana"},"application/vnd.espass-espass+zip":{source:"iana",compressible:!1},"application/vnd.eszigno3+xml":{source:"iana",compressible:!0,extensions:["es3","et3"]},"application/vnd.etsi.aoc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.asic-e+zip":{source:"iana",compressible:!1},"application/vnd.etsi.asic-s+zip":{source:"iana",compressible:!1},"application/vnd.etsi.cug+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvcommand+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-bc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-cod+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-npvr+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvservice+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsync+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvueprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mcid+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mheg5":{source:"iana"},"application/vnd.etsi.overload-control-policy-dataset+xml":{source:"iana",compressible:!0},"application/vnd.etsi.pstn+xml":{source:"iana",compressible:!0},"application/vnd.etsi.sci+xml":{source:"iana",compressible:!0},"application/vnd.etsi.simservs+xml":{source:"iana",compressible:!0},"application/vnd.etsi.timestamp-token":{source:"iana"},"application/vnd.etsi.tsl+xml":{source:"iana",compressible:!0},"application/vnd.etsi.tsl.der":{source:"iana"},"application/vnd.eu.kasparian.car+json":{source:"iana",compressible:!0},"application/vnd.eudora.data":{source:"iana"},"application/vnd.evolv.ecig.profile":{source:"iana"},"application/vnd.evolv.ecig.settings":{source:"iana"},"application/vnd.evolv.ecig.theme":{source:"iana"},"application/vnd.exstream-empower+zip":{source:"iana",compressible:!1},"application/vnd.exstream-package":{source:"iana"},"application/vnd.ezpix-album":{source:"iana",extensions:["ez2"]},"application/vnd.ezpix-package":{source:"iana",extensions:["ez3"]},"application/vnd.f-secure.mobile":{source:"iana"},"application/vnd.familysearch.gedcom+zip":{source:"iana",compressible:!1},"application/vnd.fastcopy-disk-image":{source:"iana"},"application/vnd.fdf":{source:"iana",extensions:["fdf"]},"application/vnd.fdsn.mseed":{source:"iana",extensions:["mseed"]},"application/vnd.fdsn.seed":{source:"iana",extensions:["seed","dataless"]},"application/vnd.ffsns":{source:"iana"},"application/vnd.ficlab.flb+zip":{source:"iana",compressible:!1},"application/vnd.filmit.zfc":{source:"iana"},"application/vnd.fints":{source:"iana"},"application/vnd.firemonkeys.cloudcell":{source:"iana"},"application/vnd.flographit":{source:"iana",extensions:["gph"]},"application/vnd.fluxtime.clip":{source:"iana",extensions:["ftc"]},"application/vnd.font-fontforge-sfd":{source:"iana"},"application/vnd.framemaker":{source:"iana",extensions:["fm","frame","maker","book"]},"application/vnd.frogans.fnc":{source:"iana",extensions:["fnc"]},"application/vnd.frogans.ltf":{source:"iana",extensions:["ltf"]},"application/vnd.fsc.weblaunch":{source:"iana",extensions:["fsc"]},"application/vnd.fujifilm.fb.docuworks":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.binder":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.container":{source:"iana"},"application/vnd.fujifilm.fb.jfi+xml":{source:"iana",compressible:!0},"application/vnd.fujitsu.oasys":{source:"iana",extensions:["oas"]},"application/vnd.fujitsu.oasys2":{source:"iana",extensions:["oa2"]},"application/vnd.fujitsu.oasys3":{source:"iana",extensions:["oa3"]},"application/vnd.fujitsu.oasysgp":{source:"iana",extensions:["fg5"]},"application/vnd.fujitsu.oasysprs":{source:"iana",extensions:["bh2"]},"application/vnd.fujixerox.art-ex":{source:"iana"},"application/vnd.fujixerox.art4":{source:"iana"},"application/vnd.fujixerox.ddd":{source:"iana",extensions:["ddd"]},"application/vnd.fujixerox.docuworks":{source:"iana",extensions:["xdw"]},"application/vnd.fujixerox.docuworks.binder":{source:"iana",extensions:["xbd"]},"application/vnd.fujixerox.docuworks.container":{source:"iana"},"application/vnd.fujixerox.hbpl":{source:"iana"},"application/vnd.fut-misnet":{source:"iana"},"application/vnd.futoin+cbor":{source:"iana"},"application/vnd.futoin+json":{source:"iana",compressible:!0},"application/vnd.fuzzysheet":{source:"iana",extensions:["fzs"]},"application/vnd.genomatix.tuxedo":{source:"iana",extensions:["txd"]},"application/vnd.gentics.grd+json":{source:"iana",compressible:!0},"application/vnd.geo+json":{source:"iana",compressible:!0},"application/vnd.geocube+xml":{source:"iana",compressible:!0},"application/vnd.geogebra.file":{source:"iana",extensions:["ggb"]},"application/vnd.geogebra.slides":{source:"iana"},"application/vnd.geogebra.tool":{source:"iana",extensions:["ggt"]},"application/vnd.geometry-explorer":{source:"iana",extensions:["gex","gre"]},"application/vnd.geonext":{source:"iana",extensions:["gxt"]},"application/vnd.geoplan":{source:"iana",extensions:["g2w"]},"application/vnd.geospace":{source:"iana",extensions:["g3w"]},"application/vnd.gerber":{source:"iana"},"application/vnd.globalplatform.card-content-mgt":{source:"iana"},"application/vnd.globalplatform.card-content-mgt-response":{source:"iana"},"application/vnd.gmx":{source:"iana",extensions:["gmx"]},"application/vnd.google-apps.document":{compressible:!1,extensions:["gdoc"]},"application/vnd.google-apps.presentation":{compressible:!1,extensions:["gslides"]},"application/vnd.google-apps.spreadsheet":{compressible:!1,extensions:["gsheet"]},"application/vnd.google-earth.kml+xml":{source:"iana",compressible:!0,extensions:["kml"]},"application/vnd.google-earth.kmz":{source:"iana",compressible:!1,extensions:["kmz"]},"application/vnd.gov.sk.e-form+xml":{source:"iana",compressible:!0},"application/vnd.gov.sk.e-form+zip":{source:"iana",compressible:!1},"application/vnd.gov.sk.xmldatacontainer+xml":{source:"iana",compressible:!0},"application/vnd.grafeq":{source:"iana",extensions:["gqf","gqs"]},"application/vnd.gridmp":{source:"iana"},"application/vnd.groove-account":{source:"iana",extensions:["gac"]},"application/vnd.groove-help":{source:"iana",extensions:["ghf"]},"application/vnd.groove-identity-message":{source:"iana",extensions:["gim"]},"application/vnd.groove-injector":{source:"iana",extensions:["grv"]},"application/vnd.groove-tool-message":{source:"iana",extensions:["gtm"]},"application/vnd.groove-tool-template":{source:"iana",extensions:["tpl"]},"application/vnd.groove-vcard":{source:"iana",extensions:["vcg"]},"application/vnd.hal+json":{source:"iana",compressible:!0},"application/vnd.hal+xml":{source:"iana",compressible:!0,extensions:["hal"]},"application/vnd.handheld-entertainment+xml":{source:"iana",compressible:!0,extensions:["zmm"]},"application/vnd.hbci":{source:"iana",extensions:["hbci"]},"application/vnd.hc+json":{source:"iana",compressible:!0},"application/vnd.hcl-bireports":{source:"iana"},"application/vnd.hdt":{source:"iana"},"application/vnd.heroku+json":{source:"iana",compressible:!0},"application/vnd.hhe.lesson-player":{source:"iana",extensions:["les"]},"application/vnd.hl7cda+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hl7v2+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hp-hpgl":{source:"iana",extensions:["hpgl"]},"application/vnd.hp-hpid":{source:"iana",extensions:["hpid"]},"application/vnd.hp-hps":{source:"iana",extensions:["hps"]},"application/vnd.hp-jlyt":{source:"iana",extensions:["jlt"]},"application/vnd.hp-pcl":{source:"iana",extensions:["pcl"]},"application/vnd.hp-pclxl":{source:"iana",extensions:["pclxl"]},"application/vnd.httphone":{source:"iana"},"application/vnd.hydrostatix.sof-data":{source:"iana",extensions:["sfd-hdstx"]},"application/vnd.hyper+json":{source:"iana",compressible:!0},"application/vnd.hyper-item+json":{source:"iana",compressible:!0},"application/vnd.hyperdrive+json":{source:"iana",compressible:!0},"application/vnd.hzn-3d-crossword":{source:"iana"},"application/vnd.ibm.afplinedata":{source:"iana"},"application/vnd.ibm.electronic-media":{source:"iana"},"application/vnd.ibm.minipay":{source:"iana",extensions:["mpy"]},"application/vnd.ibm.modcap":{source:"iana",extensions:["afp","listafp","list3820"]},"application/vnd.ibm.rights-management":{source:"iana",extensions:["irm"]},"application/vnd.ibm.secure-container":{source:"iana",extensions:["sc"]},"application/vnd.iccprofile":{source:"iana",extensions:["icc","icm"]},"application/vnd.ieee.1905":{source:"iana"},"application/vnd.igloader":{source:"iana",extensions:["igl"]},"application/vnd.imagemeter.folder+zip":{source:"iana",compressible:!1},"application/vnd.imagemeter.image+zip":{source:"iana",compressible:!1},"application/vnd.immervision-ivp":{source:"iana",extensions:["ivp"]},"application/vnd.immervision-ivu":{source:"iana",extensions:["ivu"]},"application/vnd.ims.imsccv1p1":{source:"iana"},"application/vnd.ims.imsccv1p2":{source:"iana"},"application/vnd.ims.imsccv1p3":{source:"iana"},"application/vnd.ims.lis.v2.result+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolconsumerprofile+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy.id+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings.simple+json":{source:"iana",compressible:!0},"application/vnd.informedcontrol.rms+xml":{source:"iana",compressible:!0},"application/vnd.informix-visionary":{source:"iana"},"application/vnd.infotech.project":{source:"iana"},"application/vnd.infotech.project+xml":{source:"iana",compressible:!0},"application/vnd.innopath.wamp.notification":{source:"iana"},"application/vnd.insors.igm":{source:"iana",extensions:["igm"]},"application/vnd.intercon.formnet":{source:"iana",extensions:["xpw","xpx"]},"application/vnd.intergeo":{source:"iana",extensions:["i2g"]},"application/vnd.intertrust.digibox":{source:"iana"},"application/vnd.intertrust.nncp":{source:"iana"},"application/vnd.intu.qbo":{source:"iana",extensions:["qbo"]},"application/vnd.intu.qfx":{source:"iana",extensions:["qfx"]},"application/vnd.iptc.g2.catalogitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.conceptitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.knowledgeitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsmessage+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.packageitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.planningitem+xml":{source:"iana",compressible:!0},"application/vnd.ipunplugged.rcprofile":{source:"iana",extensions:["rcprofile"]},"application/vnd.irepository.package+xml":{source:"iana",compressible:!0,extensions:["irp"]},"application/vnd.is-xpr":{source:"iana",extensions:["xpr"]},"application/vnd.isac.fcs":{source:"iana",extensions:["fcs"]},"application/vnd.iso11783-10+zip":{source:"iana",compressible:!1},"application/vnd.jam":{source:"iana",extensions:["jam"]},"application/vnd.japannet-directory-service":{source:"iana"},"application/vnd.japannet-jpnstore-wakeup":{source:"iana"},"application/vnd.japannet-payment-wakeup":{source:"iana"},"application/vnd.japannet-registration":{source:"iana"},"application/vnd.japannet-registration-wakeup":{source:"iana"},"application/vnd.japannet-setstore-wakeup":{source:"iana"},"application/vnd.japannet-verification":{source:"iana"},"application/vnd.japannet-verification-wakeup":{source:"iana"},"application/vnd.jcp.javame.midlet-rms":{source:"iana",extensions:["rms"]},"application/vnd.jisp":{source:"iana",extensions:["jisp"]},"application/vnd.joost.joda-archive":{source:"iana",extensions:["joda"]},"application/vnd.jsk.isdn-ngn":{source:"iana"},"application/vnd.kahootz":{source:"iana",extensions:["ktz","ktr"]},"application/vnd.kde.karbon":{source:"iana",extensions:["karbon"]},"application/vnd.kde.kchart":{source:"iana",extensions:["chrt"]},"application/vnd.kde.kformula":{source:"iana",extensions:["kfo"]},"application/vnd.kde.kivio":{source:"iana",extensions:["flw"]},"application/vnd.kde.kontour":{source:"iana",extensions:["kon"]},"application/vnd.kde.kpresenter":{source:"iana",extensions:["kpr","kpt"]},"application/vnd.kde.kspread":{source:"iana",extensions:["ksp"]},"application/vnd.kde.kword":{source:"iana",extensions:["kwd","kwt"]},"application/vnd.kenameaapp":{source:"iana",extensions:["htke"]},"application/vnd.kidspiration":{source:"iana",extensions:["kia"]},"application/vnd.kinar":{source:"iana",extensions:["kne","knp"]},"application/vnd.koan":{source:"iana",extensions:["skp","skd","skt","skm"]},"application/vnd.kodak-descriptor":{source:"iana",extensions:["sse"]},"application/vnd.las":{source:"iana"},"application/vnd.las.las+json":{source:"iana",compressible:!0},"application/vnd.las.las+xml":{source:"iana",compressible:!0,extensions:["lasxml"]},"application/vnd.laszip":{source:"iana"},"application/vnd.leap+json":{source:"iana",compressible:!0},"application/vnd.liberty-request+xml":{source:"iana",compressible:!0},"application/vnd.llamagraphics.life-balance.desktop":{source:"iana",extensions:["lbd"]},"application/vnd.llamagraphics.life-balance.exchange+xml":{source:"iana",compressible:!0,extensions:["lbe"]},"application/vnd.logipipe.circuit+zip":{source:"iana",compressible:!1},"application/vnd.loom":{source:"iana"},"application/vnd.lotus-1-2-3":{source:"iana",extensions:["123"]},"application/vnd.lotus-approach":{source:"iana",extensions:["apr"]},"application/vnd.lotus-freelance":{source:"iana",extensions:["pre"]},"application/vnd.lotus-notes":{source:"iana",extensions:["nsf"]},"application/vnd.lotus-organizer":{source:"iana",extensions:["org"]},"application/vnd.lotus-screencam":{source:"iana",extensions:["scm"]},"application/vnd.lotus-wordpro":{source:"iana",extensions:["lwp"]},"application/vnd.macports.portpkg":{source:"iana",extensions:["portpkg"]},"application/vnd.mapbox-vector-tile":{source:"iana",extensions:["mvt"]},"application/vnd.marlin.drm.actiontoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.conftoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.license+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.mdcf":{source:"iana"},"application/vnd.mason+json":{source:"iana",compressible:!0},"application/vnd.maxar.archive.3tz+zip":{source:"iana",compressible:!1},"application/vnd.maxmind.maxmind-db":{source:"iana"},"application/vnd.mcd":{source:"iana",extensions:["mcd"]},"application/vnd.medcalcdata":{source:"iana",extensions:["mc1"]},"application/vnd.mediastation.cdkey":{source:"iana",extensions:["cdkey"]},"application/vnd.meridian-slingshot":{source:"iana"},"application/vnd.mfer":{source:"iana",extensions:["mwf"]},"application/vnd.mfmp":{source:"iana",extensions:["mfm"]},"application/vnd.micro+json":{source:"iana",compressible:!0},"application/vnd.micrografx.flo":{source:"iana",extensions:["flo"]},"application/vnd.micrografx.igx":{source:"iana",extensions:["igx"]},"application/vnd.microsoft.portable-executable":{source:"iana"},"application/vnd.microsoft.windows.thumbnail-cache":{source:"iana"},"application/vnd.miele+json":{source:"iana",compressible:!0},"application/vnd.mif":{source:"iana",extensions:["mif"]},"application/vnd.minisoft-hp3000-save":{source:"iana"},"application/vnd.mitsubishi.misty-guard.trustweb":{source:"iana"},"application/vnd.mobius.daf":{source:"iana",extensions:["daf"]},"application/vnd.mobius.dis":{source:"iana",extensions:["dis"]},"application/vnd.mobius.mbk":{source:"iana",extensions:["mbk"]},"application/vnd.mobius.mqy":{source:"iana",extensions:["mqy"]},"application/vnd.mobius.msl":{source:"iana",extensions:["msl"]},"application/vnd.mobius.plc":{source:"iana",extensions:["plc"]},"application/vnd.mobius.txf":{source:"iana",extensions:["txf"]},"application/vnd.mophun.application":{source:"iana",extensions:["mpn"]},"application/vnd.mophun.certificate":{source:"iana",extensions:["mpc"]},"application/vnd.motorola.flexsuite":{source:"iana"},"application/vnd.motorola.flexsuite.adsi":{source:"iana"},"application/vnd.motorola.flexsuite.fis":{source:"iana"},"application/vnd.motorola.flexsuite.gotap":{source:"iana"},"application/vnd.motorola.flexsuite.kmr":{source:"iana"},"application/vnd.motorola.flexsuite.ttc":{source:"iana"},"application/vnd.motorola.flexsuite.wem":{source:"iana"},"application/vnd.motorola.iprm":{source:"iana"},"application/vnd.mozilla.xul+xml":{source:"iana",compressible:!0,extensions:["xul"]},"application/vnd.ms-3mfdocument":{source:"iana"},"application/vnd.ms-artgalry":{source:"iana",extensions:["cil"]},"application/vnd.ms-asf":{source:"iana"},"application/vnd.ms-cab-compressed":{source:"iana",extensions:["cab"]},"application/vnd.ms-color.iccprofile":{source:"apache"},"application/vnd.ms-excel":{source:"iana",compressible:!1,extensions:["xls","xlm","xla","xlc","xlt","xlw"]},"application/vnd.ms-excel.addin.macroenabled.12":{source:"iana",extensions:["xlam"]},"application/vnd.ms-excel.sheet.binary.macroenabled.12":{source:"iana",extensions:["xlsb"]},"application/vnd.ms-excel.sheet.macroenabled.12":{source:"iana",extensions:["xlsm"]},"application/vnd.ms-excel.template.macroenabled.12":{source:"iana",extensions:["xltm"]},"application/vnd.ms-fontobject":{source:"iana",compressible:!0,extensions:["eot"]},"application/vnd.ms-htmlhelp":{source:"iana",extensions:["chm"]},"application/vnd.ms-ims":{source:"iana",extensions:["ims"]},"application/vnd.ms-lrm":{source:"iana",extensions:["lrm"]},"application/vnd.ms-office.activex+xml":{source:"iana",compressible:!0},"application/vnd.ms-officetheme":{source:"iana",extensions:["thmx"]},"application/vnd.ms-opentype":{source:"apache",compressible:!0},"application/vnd.ms-outlook":{compressible:!1,extensions:["msg"]},"application/vnd.ms-package.obfuscated-opentype":{source:"apache"},"application/vnd.ms-pki.seccat":{source:"apache",extensions:["cat"]},"application/vnd.ms-pki.stl":{source:"apache",extensions:["stl"]},"application/vnd.ms-playready.initiator+xml":{source:"iana",compressible:!0},"application/vnd.ms-powerpoint":{source:"iana",compressible:!1,extensions:["ppt","pps","pot"]},"application/vnd.ms-powerpoint.addin.macroenabled.12":{source:"iana",extensions:["ppam"]},"application/vnd.ms-powerpoint.presentation.macroenabled.12":{source:"iana",extensions:["pptm"]},"application/vnd.ms-powerpoint.slide.macroenabled.12":{source:"iana",extensions:["sldm"]},"application/vnd.ms-powerpoint.slideshow.macroenabled.12":{source:"iana",extensions:["ppsm"]},"application/vnd.ms-powerpoint.template.macroenabled.12":{source:"iana",extensions:["potm"]},"application/vnd.ms-printdevicecapabilities+xml":{source:"iana",compressible:!0},"application/vnd.ms-printing.printticket+xml":{source:"apache",compressible:!0},"application/vnd.ms-printschematicket+xml":{source:"iana",compressible:!0},"application/vnd.ms-project":{source:"iana",extensions:["mpp","mpt"]},"application/vnd.ms-tnef":{source:"iana"},"application/vnd.ms-windows.devicepairing":{source:"iana"},"application/vnd.ms-windows.nwprinting.oob":{source:"iana"},"application/vnd.ms-windows.printerpairing":{source:"iana"},"application/vnd.ms-windows.wsd.oob":{source:"iana"},"application/vnd.ms-wmdrm.lic-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.lic-resp":{source:"iana"},"application/vnd.ms-wmdrm.meter-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.meter-resp":{source:"iana"},"application/vnd.ms-word.document.macroenabled.12":{source:"iana",extensions:["docm"]},"application/vnd.ms-word.template.macroenabled.12":{source:"iana",extensions:["dotm"]},"application/vnd.ms-works":{source:"iana",extensions:["wps","wks","wcm","wdb"]},"application/vnd.ms-wpl":{source:"iana",extensions:["wpl"]},"application/vnd.ms-xpsdocument":{source:"iana",compressible:!1,extensions:["xps"]},"application/vnd.msa-disk-image":{source:"iana"},"application/vnd.mseq":{source:"iana",extensions:["mseq"]},"application/vnd.msign":{source:"iana"},"application/vnd.multiad.creator":{source:"iana"},"application/vnd.multiad.creator.cif":{source:"iana"},"application/vnd.music-niff":{source:"iana"},"application/vnd.musician":{source:"iana",extensions:["mus"]},"application/vnd.muvee.style":{source:"iana",extensions:["msty"]},"application/vnd.mynfc":{source:"iana",extensions:["taglet"]},"application/vnd.nacamar.ybrid+json":{source:"iana",compressible:!0},"application/vnd.ncd.control":{source:"iana"},"application/vnd.ncd.reference":{source:"iana"},"application/vnd.nearst.inv+json":{source:"iana",compressible:!0},"application/vnd.nebumind.line":{source:"iana"},"application/vnd.nervana":{source:"iana"},"application/vnd.netfpx":{source:"iana"},"application/vnd.neurolanguage.nlu":{source:"iana",extensions:["nlu"]},"application/vnd.nimn":{source:"iana"},"application/vnd.nintendo.nitro.rom":{source:"iana"},"application/vnd.nintendo.snes.rom":{source:"iana"},"application/vnd.nitf":{source:"iana",extensions:["ntf","nitf"]},"application/vnd.noblenet-directory":{source:"iana",extensions:["nnd"]},"application/vnd.noblenet-sealer":{source:"iana",extensions:["nns"]},"application/vnd.noblenet-web":{source:"iana",extensions:["nnw"]},"application/vnd.nokia.catalogs":{source:"iana"},"application/vnd.nokia.conml+wbxml":{source:"iana"},"application/vnd.nokia.conml+xml":{source:"iana",compressible:!0},"application/vnd.nokia.iptv.config+xml":{source:"iana",compressible:!0},"application/vnd.nokia.isds-radio-presets":{source:"iana"},"application/vnd.nokia.landmark+wbxml":{source:"iana"},"application/vnd.nokia.landmark+xml":{source:"iana",compressible:!0},"application/vnd.nokia.landmarkcollection+xml":{source:"iana",compressible:!0},"application/vnd.nokia.n-gage.ac+xml":{source:"iana",compressible:!0,extensions:["ac"]},"application/vnd.nokia.n-gage.data":{source:"iana",extensions:["ngdat"]},"application/vnd.nokia.n-gage.symbian.install":{source:"iana",extensions:["n-gage"]},"application/vnd.nokia.ncd":{source:"iana"},"application/vnd.nokia.pcd+wbxml":{source:"iana"},"application/vnd.nokia.pcd+xml":{source:"iana",compressible:!0},"application/vnd.nokia.radio-preset":{source:"iana",extensions:["rpst"]},"application/vnd.nokia.radio-presets":{source:"iana",extensions:["rpss"]},"application/vnd.novadigm.edm":{source:"iana",extensions:["edm"]},"application/vnd.novadigm.edx":{source:"iana",extensions:["edx"]},"application/vnd.novadigm.ext":{source:"iana",extensions:["ext"]},"application/vnd.ntt-local.content-share":{source:"iana"},"application/vnd.ntt-local.file-transfer":{source:"iana"},"application/vnd.ntt-local.ogw_remote-access":{source:"iana"},"application/vnd.ntt-local.sip-ta_remote":{source:"iana"},"application/vnd.ntt-local.sip-ta_tcp_stream":{source:"iana"},"application/vnd.oasis.opendocument.chart":{source:"iana",extensions:["odc"]},"application/vnd.oasis.opendocument.chart-template":{source:"iana",extensions:["otc"]},"application/vnd.oasis.opendocument.database":{source:"iana",extensions:["odb"]},"application/vnd.oasis.opendocument.formula":{source:"iana",extensions:["odf"]},"application/vnd.oasis.opendocument.formula-template":{source:"iana",extensions:["odft"]},"application/vnd.oasis.opendocument.graphics":{source:"iana",compressible:!1,extensions:["odg"]},"application/vnd.oasis.opendocument.graphics-template":{source:"iana",extensions:["otg"]},"application/vnd.oasis.opendocument.image":{source:"iana",extensions:["odi"]},"application/vnd.oasis.opendocument.image-template":{source:"iana",extensions:["oti"]},"application/vnd.oasis.opendocument.presentation":{source:"iana",compressible:!1,extensions:["odp"]},"application/vnd.oasis.opendocument.presentation-template":{source:"iana",extensions:["otp"]},"application/vnd.oasis.opendocument.spreadsheet":{source:"iana",compressible:!1,extensions:["ods"]},"application/vnd.oasis.opendocument.spreadsheet-template":{source:"iana",extensions:["ots"]},"application/vnd.oasis.opendocument.text":{source:"iana",compressible:!1,extensions:["odt"]},"application/vnd.oasis.opendocument.text-master":{source:"iana",extensions:["odm"]},"application/vnd.oasis.opendocument.text-template":{source:"iana",extensions:["ott"]},"application/vnd.oasis.opendocument.text-web":{source:"iana",extensions:["oth"]},"application/vnd.obn":{source:"iana"},"application/vnd.ocf+cbor":{source:"iana"},"application/vnd.oci.image.manifest.v1+json":{source:"iana",compressible:!0},"application/vnd.oftn.l10n+json":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessdownload+xml":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessstreaming+xml":{source:"iana",compressible:!0},"application/vnd.oipf.cspg-hexbinary":{source:"iana"},"application/vnd.oipf.dae.svg+xml":{source:"iana",compressible:!0},"application/vnd.oipf.dae.xhtml+xml":{source:"iana",compressible:!0},"application/vnd.oipf.mippvcontrolmessage+xml":{source:"iana",compressible:!0},"application/vnd.oipf.pae.gem":{source:"iana"},"application/vnd.oipf.spdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.oipf.spdlist+xml":{source:"iana",compressible:!0},"application/vnd.oipf.ueprofile+xml":{source:"iana",compressible:!0},"application/vnd.oipf.userprofile+xml":{source:"iana",compressible:!0},"application/vnd.olpc-sugar":{source:"iana",extensions:["xo"]},"application/vnd.oma-scws-config":{source:"iana"},"application/vnd.oma-scws-http-request":{source:"iana"},"application/vnd.oma-scws-http-response":{source:"iana"},"application/vnd.oma.bcast.associated-procedure-parameter+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.drm-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.imd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.ltkm":{source:"iana"},"application/vnd.oma.bcast.notification+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.provisioningtrigger":{source:"iana"},"application/vnd.oma.bcast.sgboot":{source:"iana"},"application/vnd.oma.bcast.sgdd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sgdu":{source:"iana"},"application/vnd.oma.bcast.simple-symbol-container":{source:"iana"},"application/vnd.oma.bcast.smartcard-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sprov+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.stkm":{source:"iana"},"application/vnd.oma.cab-address-book+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-feature-handler+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-pcc+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-subs-invite+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-user-prefs+xml":{source:"iana",compressible:!0},"application/vnd.oma.dcd":{source:"iana"},"application/vnd.oma.dcdc":{source:"iana"},"application/vnd.oma.dd2+xml":{source:"iana",compressible:!0,extensions:["dd2"]},"application/vnd.oma.drm.risd+xml":{source:"iana",compressible:!0},"application/vnd.oma.group-usage-list+xml":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+cbor":{source:"iana"},"application/vnd.oma.lwm2m+json":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+tlv":{source:"iana"},"application/vnd.oma.pal+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.detailed-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.final-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.groups+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.invocation-descriptor+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.optimized-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.push":{source:"iana"},"application/vnd.oma.scidm.messages+xml":{source:"iana",compressible:!0},"application/vnd.oma.xcap-directory+xml":{source:"iana",compressible:!0},"application/vnd.omads-email+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-file+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-folder+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omaloc-supl-init":{source:"iana"},"application/vnd.onepager":{source:"iana"},"application/vnd.onepagertamp":{source:"iana"},"application/vnd.onepagertamx":{source:"iana"},"application/vnd.onepagertat":{source:"iana"},"application/vnd.onepagertatp":{source:"iana"},"application/vnd.onepagertatx":{source:"iana"},"application/vnd.openblox.game+xml":{source:"iana",compressible:!0,extensions:["obgx"]},"application/vnd.openblox.game-binary":{source:"iana"},"application/vnd.openeye.oeb":{source:"iana"},"application/vnd.openofficeorg.extension":{source:"apache",extensions:["oxt"]},"application/vnd.openstreetmap.data+xml":{source:"iana",compressible:!0,extensions:["osm"]},"application/vnd.opentimestamps.ots":{source:"iana"},"application/vnd.openxmlformats-officedocument.custom-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.customxmlproperties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawing+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chart+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.extended-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",compressible:!1,extensions:["pptx"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slide":{source:"iana",extensions:["sldx"]},"application/vnd.openxmlformats-officedocument.presentationml.slide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideshow":{source:"iana",extensions:["ppsx"]},"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tags+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.template":{source:"iana",extensions:["potx"]},"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",compressible:!1,extensions:["xlsx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.template":{source:"iana",extensions:["xltx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.theme+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.themeoverride+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.vmldrawing":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",compressible:!1,extensions:["docx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.template":{source:"iana",extensions:["dotx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.core-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.relationships+xml":{source:"iana",compressible:!0},"application/vnd.oracle.resource+json":{source:"iana",compressible:!0},"application/vnd.orange.indata":{source:"iana"},"application/vnd.osa.netdeploy":{source:"iana"},"application/vnd.osgeo.mapguide.package":{source:"iana",extensions:["mgp"]},"application/vnd.osgi.bundle":{source:"iana"},"application/vnd.osgi.dp":{source:"iana",extensions:["dp"]},"application/vnd.osgi.subsystem":{source:"iana",extensions:["esa"]},"application/vnd.otps.ct-kip+xml":{source:"iana",compressible:!0},"application/vnd.oxli.countgraph":{source:"iana"},"application/vnd.pagerduty+json":{source:"iana",compressible:!0},"application/vnd.palm":{source:"iana",extensions:["pdb","pqa","oprc"]},"application/vnd.panoply":{source:"iana"},"application/vnd.paos.xml":{source:"iana"},"application/vnd.patentdive":{source:"iana"},"application/vnd.patientecommsdoc":{source:"iana"},"application/vnd.pawaafile":{source:"iana",extensions:["paw"]},"application/vnd.pcos":{source:"iana"},"application/vnd.pg.format":{source:"iana",extensions:["str"]},"application/vnd.pg.osasli":{source:"iana",extensions:["ei6"]},"application/vnd.piaccess.application-licence":{source:"iana"},"application/vnd.picsel":{source:"iana",extensions:["efif"]},"application/vnd.pmi.widget":{source:"iana",extensions:["wg"]},"application/vnd.poc.group-advertisement+xml":{source:"iana",compressible:!0},"application/vnd.pocketlearn":{source:"iana",extensions:["plf"]},"application/vnd.powerbuilder6":{source:"iana",extensions:["pbd"]},"application/vnd.powerbuilder6-s":{source:"iana"},"application/vnd.powerbuilder7":{source:"iana"},"application/vnd.powerbuilder7-s":{source:"iana"},"application/vnd.powerbuilder75":{source:"iana"},"application/vnd.powerbuilder75-s":{source:"iana"},"application/vnd.preminet":{source:"iana"},"application/vnd.previewsystems.box":{source:"iana",extensions:["box"]},"application/vnd.proteus.magazine":{source:"iana",extensions:["mgz"]},"application/vnd.psfs":{source:"iana"},"application/vnd.publishare-delta-tree":{source:"iana",extensions:["qps"]},"application/vnd.pvi.ptid1":{source:"iana",extensions:["ptid"]},"application/vnd.pwg-multiplexed":{source:"iana"},"application/vnd.pwg-xhtml-print+xml":{source:"iana",compressible:!0},"application/vnd.qualcomm.brew-app-res":{source:"iana"},"application/vnd.quarantainenet":{source:"iana"},"application/vnd.quark.quarkxpress":{source:"iana",extensions:["qxd","qxt","qwd","qwt","qxl","qxb"]},"application/vnd.quobject-quoxdocument":{source:"iana"},"application/vnd.radisys.moml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conn+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-stream+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-base+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-detect+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-sendrecv+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-group+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-speech+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-transform+xml":{source:"iana",compressible:!0},"application/vnd.rainstor.data":{source:"iana"},"application/vnd.rapid":{source:"iana"},"application/vnd.rar":{source:"iana",extensions:["rar"]},"application/vnd.realvnc.bed":{source:"iana",extensions:["bed"]},"application/vnd.recordare.musicxml":{source:"iana",extensions:["mxl"]},"application/vnd.recordare.musicxml+xml":{source:"iana",compressible:!0,extensions:["musicxml"]},"application/vnd.renlearn.rlprint":{source:"iana"},"application/vnd.resilient.logic":{source:"iana"},"application/vnd.restful+json":{source:"iana",compressible:!0},"application/vnd.rig.cryptonote":{source:"iana",extensions:["cryptonote"]},"application/vnd.rim.cod":{source:"apache",extensions:["cod"]},"application/vnd.rn-realmedia":{source:"apache",extensions:["rm"]},"application/vnd.rn-realmedia-vbr":{source:"apache",extensions:["rmvb"]},"application/vnd.route66.link66+xml":{source:"iana",compressible:!0,extensions:["link66"]},"application/vnd.rs-274x":{source:"iana"},"application/vnd.ruckus.download":{source:"iana"},"application/vnd.s3sms":{source:"iana"},"application/vnd.sailingtracker.track":{source:"iana",extensions:["st"]},"application/vnd.sar":{source:"iana"},"application/vnd.sbm.cid":{source:"iana"},"application/vnd.sbm.mid2":{source:"iana"},"application/vnd.scribus":{source:"iana"},"application/vnd.sealed.3df":{source:"iana"},"application/vnd.sealed.csf":{source:"iana"},"application/vnd.sealed.doc":{source:"iana"},"application/vnd.sealed.eml":{source:"iana"},"application/vnd.sealed.mht":{source:"iana"},"application/vnd.sealed.net":{source:"iana"},"application/vnd.sealed.ppt":{source:"iana"},"application/vnd.sealed.tiff":{source:"iana"},"application/vnd.sealed.xls":{source:"iana"},"application/vnd.sealedmedia.softseal.html":{source:"iana"},"application/vnd.sealedmedia.softseal.pdf":{source:"iana"},"application/vnd.seemail":{source:"iana",extensions:["see"]},"application/vnd.seis+json":{source:"iana",compressible:!0},"application/vnd.sema":{source:"iana",extensions:["sema"]},"application/vnd.semd":{source:"iana",extensions:["semd"]},"application/vnd.semf":{source:"iana",extensions:["semf"]},"application/vnd.shade-save-file":{source:"iana"},"application/vnd.shana.informed.formdata":{source:"iana",extensions:["ifm"]},"application/vnd.shana.informed.formtemplate":{source:"iana",extensions:["itp"]},"application/vnd.shana.informed.interchange":{source:"iana",extensions:["iif"]},"application/vnd.shana.informed.package":{source:"iana",extensions:["ipk"]},"application/vnd.shootproof+json":{source:"iana",compressible:!0},"application/vnd.shopkick+json":{source:"iana",compressible:!0},"application/vnd.shp":{source:"iana"},"application/vnd.shx":{source:"iana"},"application/vnd.sigrok.session":{source:"iana"},"application/vnd.simtech-mindmapper":{source:"iana",extensions:["twd","twds"]},"application/vnd.siren+json":{source:"iana",compressible:!0},"application/vnd.smaf":{source:"iana",extensions:["mmf"]},"application/vnd.smart.notebook":{source:"iana"},"application/vnd.smart.teacher":{source:"iana",extensions:["teacher"]},"application/vnd.snesdev-page-table":{source:"iana"},"application/vnd.software602.filler.form+xml":{source:"iana",compressible:!0,extensions:["fo"]},"application/vnd.software602.filler.form-xml-zip":{source:"iana"},"application/vnd.solent.sdkm+xml":{source:"iana",compressible:!0,extensions:["sdkm","sdkd"]},"application/vnd.spotfire.dxp":{source:"iana",extensions:["dxp"]},"application/vnd.spotfire.sfs":{source:"iana",extensions:["sfs"]},"application/vnd.sqlite3":{source:"iana"},"application/vnd.sss-cod":{source:"iana"},"application/vnd.sss-dtf":{source:"iana"},"application/vnd.sss-ntf":{source:"iana"},"application/vnd.stardivision.calc":{source:"apache",extensions:["sdc"]},"application/vnd.stardivision.draw":{source:"apache",extensions:["sda"]},"application/vnd.stardivision.impress":{source:"apache",extensions:["sdd"]},"application/vnd.stardivision.math":{source:"apache",extensions:["smf"]},"application/vnd.stardivision.writer":{source:"apache",extensions:["sdw","vor"]},"application/vnd.stardivision.writer-global":{source:"apache",extensions:["sgl"]},"application/vnd.stepmania.package":{source:"iana",extensions:["smzip"]},"application/vnd.stepmania.stepchart":{source:"iana",extensions:["sm"]},"application/vnd.street-stream":{source:"iana"},"application/vnd.sun.wadl+xml":{source:"iana",compressible:!0,extensions:["wadl"]},"application/vnd.sun.xml.calc":{source:"apache",extensions:["sxc"]},"application/vnd.sun.xml.calc.template":{source:"apache",extensions:["stc"]},"application/vnd.sun.xml.draw":{source:"apache",extensions:["sxd"]},"application/vnd.sun.xml.draw.template":{source:"apache",extensions:["std"]},"application/vnd.sun.xml.impress":{source:"apache",extensions:["sxi"]},"application/vnd.sun.xml.impress.template":{source:"apache",extensions:["sti"]},"application/vnd.sun.xml.math":{source:"apache",extensions:["sxm"]},"application/vnd.sun.xml.writer":{source:"apache",extensions:["sxw"]},"application/vnd.sun.xml.writer.global":{source:"apache",extensions:["sxg"]},"application/vnd.sun.xml.writer.template":{source:"apache",extensions:["stw"]},"application/vnd.sus-calendar":{source:"iana",extensions:["sus","susp"]},"application/vnd.svd":{source:"iana",extensions:["svd"]},"application/vnd.swiftview-ics":{source:"iana"},"application/vnd.sycle+xml":{source:"iana",compressible:!0},"application/vnd.syft+json":{source:"iana",compressible:!0},"application/vnd.symbian.install":{source:"apache",extensions:["sis","sisx"]},"application/vnd.syncml+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xsm"]},"application/vnd.syncml.dm+wbxml":{source:"iana",charset:"UTF-8",extensions:["bdm"]},"application/vnd.syncml.dm+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xdm"]},"application/vnd.syncml.dm.notification":{source:"iana"},"application/vnd.syncml.dmddf+wbxml":{source:"iana"},"application/vnd.syncml.dmddf+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["ddf"]},"application/vnd.syncml.dmtnds+wbxml":{source:"iana"},"application/vnd.syncml.dmtnds+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.syncml.ds.notification":{source:"iana"},"application/vnd.tableschema+json":{source:"iana",compressible:!0},"application/vnd.tao.intent-module-archive":{source:"iana",extensions:["tao"]},"application/vnd.tcpdump.pcap":{source:"iana",extensions:["pcap","cap","dmp"]},"application/vnd.think-cell.ppttc+json":{source:"iana",compressible:!0},"application/vnd.tmd.mediaflex.api+xml":{source:"iana",compressible:!0},"application/vnd.tml":{source:"iana"},"application/vnd.tmobile-livetv":{source:"iana",extensions:["tmo"]},"application/vnd.tri.onesource":{source:"iana"},"application/vnd.trid.tpt":{source:"iana",extensions:["tpt"]},"application/vnd.triscape.mxs":{source:"iana",extensions:["mxs"]},"application/vnd.trueapp":{source:"iana",extensions:["tra"]},"application/vnd.truedoc":{source:"iana"},"application/vnd.ubisoft.webplayer":{source:"iana"},"application/vnd.ufdl":{source:"iana",extensions:["ufd","ufdl"]},"application/vnd.uiq.theme":{source:"iana",extensions:["utz"]},"application/vnd.umajin":{source:"iana",extensions:["umj"]},"application/vnd.unity":{source:"iana",extensions:["unityweb"]},"application/vnd.uoml+xml":{source:"iana",compressible:!0,extensions:["uoml"]},"application/vnd.uplanet.alert":{source:"iana"},"application/vnd.uplanet.alert-wbxml":{source:"iana"},"application/vnd.uplanet.bearer-choice":{source:"iana"},"application/vnd.uplanet.bearer-choice-wbxml":{source:"iana"},"application/vnd.uplanet.cacheop":{source:"iana"},"application/vnd.uplanet.cacheop-wbxml":{source:"iana"},"application/vnd.uplanet.channel":{source:"iana"},"application/vnd.uplanet.channel-wbxml":{source:"iana"},"application/vnd.uplanet.list":{source:"iana"},"application/vnd.uplanet.list-wbxml":{source:"iana"},"application/vnd.uplanet.listcmd":{source:"iana"},"application/vnd.uplanet.listcmd-wbxml":{source:"iana"},"application/vnd.uplanet.signal":{source:"iana"},"application/vnd.uri-map":{source:"iana"},"application/vnd.valve.source.material":{source:"iana"},"application/vnd.vcx":{source:"iana",extensions:["vcx"]},"application/vnd.vd-study":{source:"iana"},"application/vnd.vectorworks":{source:"iana"},"application/vnd.vel+json":{source:"iana",compressible:!0},"application/vnd.verimatrix.vcas":{source:"iana"},"application/vnd.veritone.aion+json":{source:"iana",compressible:!0},"application/vnd.veryant.thin":{source:"iana"},"application/vnd.ves.encrypted":{source:"iana"},"application/vnd.vidsoft.vidconference":{source:"iana"},"application/vnd.visio":{source:"iana",extensions:["vsd","vst","vss","vsw"]},"application/vnd.visionary":{source:"iana",extensions:["vis"]},"application/vnd.vividence.scriptfile":{source:"iana"},"application/vnd.vsf":{source:"iana",extensions:["vsf"]},"application/vnd.wap.sic":{source:"iana"},"application/vnd.wap.slc":{source:"iana"},"application/vnd.wap.wbxml":{source:"iana",charset:"UTF-8",extensions:["wbxml"]},"application/vnd.wap.wmlc":{source:"iana",extensions:["wmlc"]},"application/vnd.wap.wmlscriptc":{source:"iana",extensions:["wmlsc"]},"application/vnd.webturbo":{source:"iana",extensions:["wtb"]},"application/vnd.wfa.dpp":{source:"iana"},"application/vnd.wfa.p2p":{source:"iana"},"application/vnd.wfa.wsc":{source:"iana"},"application/vnd.windows.devicepairing":{source:"iana"},"application/vnd.wmc":{source:"iana"},"application/vnd.wmf.bootstrap":{source:"iana"},"application/vnd.wolfram.mathematica":{source:"iana"},"application/vnd.wolfram.mathematica.package":{source:"iana"},"application/vnd.wolfram.player":{source:"iana",extensions:["nbp"]},"application/vnd.wordperfect":{source:"iana",extensions:["wpd"]},"application/vnd.wqd":{source:"iana",extensions:["wqd"]},"application/vnd.wrq-hp3000-labelled":{source:"iana"},"application/vnd.wt.stf":{source:"iana",extensions:["stf"]},"application/vnd.wv.csp+wbxml":{source:"iana"},"application/vnd.wv.csp+xml":{source:"iana",compressible:!0},"application/vnd.wv.ssp+xml":{source:"iana",compressible:!0},"application/vnd.xacml+json":{source:"iana",compressible:!0},"application/vnd.xara":{source:"iana",extensions:["xar"]},"application/vnd.xfdl":{source:"iana",extensions:["xfdl"]},"application/vnd.xfdl.webform":{source:"iana"},"application/vnd.xmi+xml":{source:"iana",compressible:!0},"application/vnd.xmpie.cpkg":{source:"iana"},"application/vnd.xmpie.dpkg":{source:"iana"},"application/vnd.xmpie.plan":{source:"iana"},"application/vnd.xmpie.ppkg":{source:"iana"},"application/vnd.xmpie.xlim":{source:"iana"},"application/vnd.yamaha.hv-dic":{source:"iana",extensions:["hvd"]},"application/vnd.yamaha.hv-script":{source:"iana",extensions:["hvs"]},"application/vnd.yamaha.hv-voice":{source:"iana",extensions:["hvp"]},"application/vnd.yamaha.openscoreformat":{source:"iana",extensions:["osf"]},"application/vnd.yamaha.openscoreformat.osfpvg+xml":{source:"iana",compressible:!0,extensions:["osfpvg"]},"application/vnd.yamaha.remote-setup":{source:"iana"},"application/vnd.yamaha.smaf-audio":{source:"iana",extensions:["saf"]},"application/vnd.yamaha.smaf-phrase":{source:"iana",extensions:["spf"]},"application/vnd.yamaha.through-ngn":{source:"iana"},"application/vnd.yamaha.tunnel-udpencap":{source:"iana"},"application/vnd.yaoweme":{source:"iana"},"application/vnd.yellowriver-custom-menu":{source:"iana",extensions:["cmp"]},"application/vnd.youtube.yt":{source:"iana"},"application/vnd.zul":{source:"iana",extensions:["zir","zirz"]},"application/vnd.zzazz.deck+xml":{source:"iana",compressible:!0,extensions:["zaz"]},"application/voicexml+xml":{source:"iana",compressible:!0,extensions:["vxml"]},"application/voucher-cms+json":{source:"iana",compressible:!0},"application/vq-rtcpxr":{source:"iana"},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"application/watcherinfo+xml":{source:"iana",compressible:!0,extensions:["wif"]},"application/webpush-options+json":{source:"iana",compressible:!0},"application/whoispp-query":{source:"iana"},"application/whoispp-response":{source:"iana"},"application/widget":{source:"iana",extensions:["wgt"]},"application/winhlp":{source:"apache",extensions:["hlp"]},"application/wita":{source:"iana"},"application/wordperfect5.1":{source:"iana"},"application/wsdl+xml":{source:"iana",compressible:!0,extensions:["wsdl"]},"application/wspolicy+xml":{source:"iana",compressible:!0,extensions:["wspolicy"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/x-abiword":{source:"apache",extensions:["abw"]},"application/x-ace-compressed":{source:"apache",extensions:["ace"]},"application/x-amf":{source:"apache"},"application/x-apple-diskimage":{source:"apache",extensions:["dmg"]},"application/x-arj":{compressible:!1,extensions:["arj"]},"application/x-authorware-bin":{source:"apache",extensions:["aab","x32","u32","vox"]},"application/x-authorware-map":{source:"apache",extensions:["aam"]},"application/x-authorware-seg":{source:"apache",extensions:["aas"]},"application/x-bcpio":{source:"apache",extensions:["bcpio"]},"application/x-bdoc":{compressible:!1,extensions:["bdoc"]},"application/x-bittorrent":{source:"apache",extensions:["torrent"]},"application/x-blorb":{source:"apache",extensions:["blb","blorb"]},"application/x-bzip":{source:"apache",compressible:!1,extensions:["bz"]},"application/x-bzip2":{source:"apache",compressible:!1,extensions:["bz2","boz"]},"application/x-cbr":{source:"apache",extensions:["cbr","cba","cbt","cbz","cb7"]},"application/x-cdlink":{source:"apache",extensions:["vcd"]},"application/x-cfs-compressed":{source:"apache",extensions:["cfs"]},"application/x-chat":{source:"apache",extensions:["chat"]},"application/x-chess-pgn":{source:"apache",extensions:["pgn"]},"application/x-chrome-extension":{extensions:["crx"]},"application/x-cocoa":{source:"nginx",extensions:["cco"]},"application/x-compress":{source:"apache"},"application/x-conference":{source:"apache",extensions:["nsc"]},"application/x-cpio":{source:"apache",extensions:["cpio"]},"application/x-csh":{source:"apache",extensions:["csh"]},"application/x-deb":{compressible:!1},"application/x-debian-package":{source:"apache",extensions:["deb","udeb"]},"application/x-dgc-compressed":{source:"apache",extensions:["dgc"]},"application/x-director":{source:"apache",extensions:["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"]},"application/x-doom":{source:"apache",extensions:["wad"]},"application/x-dtbncx+xml":{source:"apache",compressible:!0,extensions:["ncx"]},"application/x-dtbook+xml":{source:"apache",compressible:!0,extensions:["dtb"]},"application/x-dtbresource+xml":{source:"apache",compressible:!0,extensions:["res"]},"application/x-dvi":{source:"apache",compressible:!1,extensions:["dvi"]},"application/x-envoy":{source:"apache",extensions:["evy"]},"application/x-eva":{source:"apache",extensions:["eva"]},"application/x-font-bdf":{source:"apache",extensions:["bdf"]},"application/x-font-dos":{source:"apache"},"application/x-font-framemaker":{source:"apache"},"application/x-font-ghostscript":{source:"apache",extensions:["gsf"]},"application/x-font-libgrx":{source:"apache"},"application/x-font-linux-psf":{source:"apache",extensions:["psf"]},"application/x-font-pcf":{source:"apache",extensions:["pcf"]},"application/x-font-snf":{source:"apache",extensions:["snf"]},"application/x-font-speedo":{source:"apache"},"application/x-font-sunos-news":{source:"apache"},"application/x-font-type1":{source:"apache",extensions:["pfa","pfb","pfm","afm"]},"application/x-font-vfont":{source:"apache"},"application/x-freearc":{source:"apache",extensions:["arc"]},"application/x-futuresplash":{source:"apache",extensions:["spl"]},"application/x-gca-compressed":{source:"apache",extensions:["gca"]},"application/x-glulx":{source:"apache",extensions:["ulx"]},"application/x-gnumeric":{source:"apache",extensions:["gnumeric"]},"application/x-gramps-xml":{source:"apache",extensions:["gramps"]},"application/x-gtar":{source:"apache",extensions:["gtar"]},"application/x-gzip":{source:"apache"},"application/x-hdf":{source:"apache",extensions:["hdf"]},"application/x-httpd-php":{compressible:!0,extensions:["php"]},"application/x-install-instructions":{source:"apache",extensions:["install"]},"application/x-iso9660-image":{source:"apache",extensions:["iso"]},"application/x-iwork-keynote-sffkey":{extensions:["key"]},"application/x-iwork-numbers-sffnumbers":{extensions:["numbers"]},"application/x-iwork-pages-sffpages":{extensions:["pages"]},"application/x-java-archive-diff":{source:"nginx",extensions:["jardiff"]},"application/x-java-jnlp-file":{source:"apache",compressible:!1,extensions:["jnlp"]},"application/x-javascript":{compressible:!0},"application/x-keepass2":{extensions:["kdbx"]},"application/x-latex":{source:"apache",compressible:!1,extensions:["latex"]},"application/x-lua-bytecode":{extensions:["luac"]},"application/x-lzh-compressed":{source:"apache",extensions:["lzh","lha"]},"application/x-makeself":{source:"nginx",extensions:["run"]},"application/x-mie":{source:"apache",extensions:["mie"]},"application/x-mobipocket-ebook":{source:"apache",extensions:["prc","mobi"]},"application/x-mpegurl":{compressible:!1},"application/x-ms-application":{source:"apache",extensions:["application"]},"application/x-ms-shortcut":{source:"apache",extensions:["lnk"]},"application/x-ms-wmd":{source:"apache",extensions:["wmd"]},"application/x-ms-wmz":{source:"apache",extensions:["wmz"]},"application/x-ms-xbap":{source:"apache",extensions:["xbap"]},"application/x-msaccess":{source:"apache",extensions:["mdb"]},"application/x-msbinder":{source:"apache",extensions:["obd"]},"application/x-mscardfile":{source:"apache",extensions:["crd"]},"application/x-msclip":{source:"apache",extensions:["clp"]},"application/x-msdos-program":{extensions:["exe"]},"application/x-msdownload":{source:"apache",extensions:["exe","dll","com","bat","msi"]},"application/x-msmediaview":{source:"apache",extensions:["mvb","m13","m14"]},"application/x-msmetafile":{source:"apache",extensions:["wmf","wmz","emf","emz"]},"application/x-msmoney":{source:"apache",extensions:["mny"]},"application/x-mspublisher":{source:"apache",extensions:["pub"]},"application/x-msschedule":{source:"apache",extensions:["scd"]},"application/x-msterminal":{source:"apache",extensions:["trm"]},"application/x-mswrite":{source:"apache",extensions:["wri"]},"application/x-netcdf":{source:"apache",extensions:["nc","cdf"]},"application/x-ns-proxy-autoconfig":{compressible:!0,extensions:["pac"]},"application/x-nzb":{source:"apache",extensions:["nzb"]},"application/x-perl":{source:"nginx",extensions:["pl","pm"]},"application/x-pilot":{source:"nginx",extensions:["prc","pdb"]},"application/x-pkcs12":{source:"apache",compressible:!1,extensions:["p12","pfx"]},"application/x-pkcs7-certificates":{source:"apache",extensions:["p7b","spc"]},"application/x-pkcs7-certreqresp":{source:"apache",extensions:["p7r"]},"application/x-pki-message":{source:"iana"},"application/x-rar-compressed":{source:"apache",compressible:!1,extensions:["rar"]},"application/x-redhat-package-manager":{source:"nginx",extensions:["rpm"]},"application/x-research-info-systems":{source:"apache",extensions:["ris"]},"application/x-sea":{source:"nginx",extensions:["sea"]},"application/x-sh":{source:"apache",compressible:!0,extensions:["sh"]},"application/x-shar":{source:"apache",extensions:["shar"]},"application/x-shockwave-flash":{source:"apache",compressible:!1,extensions:["swf"]},"application/x-silverlight-app":{source:"apache",extensions:["xap"]},"application/x-sql":{source:"apache",extensions:["sql"]},"application/x-stuffit":{source:"apache",compressible:!1,extensions:["sit"]},"application/x-stuffitx":{source:"apache",extensions:["sitx"]},"application/x-subrip":{source:"apache",extensions:["srt"]},"application/x-sv4cpio":{source:"apache",extensions:["sv4cpio"]},"application/x-sv4crc":{source:"apache",extensions:["sv4crc"]},"application/x-t3vm-image":{source:"apache",extensions:["t3"]},"application/x-tads":{source:"apache",extensions:["gam"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-tcl":{source:"apache",extensions:["tcl","tk"]},"application/x-tex":{source:"apache",extensions:["tex"]},"application/x-tex-tfm":{source:"apache",extensions:["tfm"]},"application/x-texinfo":{source:"apache",extensions:["texinfo","texi"]},"application/x-tgif":{source:"apache",extensions:["obj"]},"application/x-ustar":{source:"apache",extensions:["ustar"]},"application/x-virtualbox-hdd":{compressible:!0,extensions:["hdd"]},"application/x-virtualbox-ova":{compressible:!0,extensions:["ova"]},"application/x-virtualbox-ovf":{compressible:!0,extensions:["ovf"]},"application/x-virtualbox-vbox":{compressible:!0,extensions:["vbox"]},"application/x-virtualbox-vbox-extpack":{compressible:!1,extensions:["vbox-extpack"]},"application/x-virtualbox-vdi":{compressible:!0,extensions:["vdi"]},"application/x-virtualbox-vhd":{compressible:!0,extensions:["vhd"]},"application/x-virtualbox-vmdk":{compressible:!0,extensions:["vmdk"]},"application/x-wais-source":{source:"apache",extensions:["src"]},"application/x-web-app-manifest+json":{compressible:!0,extensions:["webapp"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"application/x-x509-ca-cert":{source:"iana",extensions:["der","crt","pem"]},"application/x-x509-ca-ra-cert":{source:"iana"},"application/x-x509-next-ca-cert":{source:"iana"},"application/x-xfig":{source:"apache",extensions:["fig"]},"application/x-xliff+xml":{source:"apache",compressible:!0,extensions:["xlf"]},"application/x-xpinstall":{source:"apache",compressible:!1,extensions:["xpi"]},"application/x-xz":{source:"apache",extensions:["xz"]},"application/x-zmachine":{source:"apache",extensions:["z1","z2","z3","z4","z5","z6","z7","z8"]},"application/x400-bp":{source:"iana"},"application/xacml+xml":{source:"iana",compressible:!0},"application/xaml+xml":{source:"apache",compressible:!0,extensions:["xaml"]},"application/xcap-att+xml":{source:"iana",compressible:!0,extensions:["xav"]},"application/xcap-caps+xml":{source:"iana",compressible:!0,extensions:["xca"]},"application/xcap-diff+xml":{source:"iana",compressible:!0,extensions:["xdf"]},"application/xcap-el+xml":{source:"iana",compressible:!0,extensions:["xel"]},"application/xcap-error+xml":{source:"iana",compressible:!0},"application/xcap-ns+xml":{source:"iana",compressible:!0,extensions:["xns"]},"application/xcon-conference-info+xml":{source:"iana",compressible:!0},"application/xcon-conference-info-diff+xml":{source:"iana",compressible:!0},"application/xenc+xml":{source:"iana",compressible:!0,extensions:["xenc"]},"application/xhtml+xml":{source:"iana",compressible:!0,extensions:["xhtml","xht"]},"application/xhtml-voice+xml":{source:"apache",compressible:!0},"application/xliff+xml":{source:"iana",compressible:!0,extensions:["xlf"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml","xsl","xsd","rng"]},"application/xml-dtd":{source:"iana",compressible:!0,extensions:["dtd"]},"application/xml-external-parsed-entity":{source:"iana"},"application/xml-patch+xml":{source:"iana",compressible:!0},"application/xmpp+xml":{source:"iana",compressible:!0},"application/xop+xml":{source:"iana",compressible:!0,extensions:["xop"]},"application/xproc+xml":{source:"apache",compressible:!0,extensions:["xpl"]},"application/xslt+xml":{source:"iana",compressible:!0,extensions:["xsl","xslt"]},"application/xspf+xml":{source:"apache",compressible:!0,extensions:["xspf"]},"application/xv+xml":{source:"iana",compressible:!0,extensions:["mxml","xhvml","xvml","xvm"]},"application/yang":{source:"iana",extensions:["yang"]},"application/yang-data+json":{source:"iana",compressible:!0},"application/yang-data+xml":{source:"iana",compressible:!0},"application/yang-patch+json":{source:"iana",compressible:!0},"application/yang-patch+xml":{source:"iana",compressible:!0},"application/yin+xml":{source:"iana",compressible:!0,extensions:["yin"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/zlib":{source:"iana"},"application/zstd":{source:"iana"},"audio/1d-interleaved-parityfec":{source:"iana"},"audio/32kadpcm":{source:"iana"},"audio/3gpp":{source:"iana",compressible:!1,extensions:["3gpp"]},"audio/3gpp2":{source:"iana"},"audio/aac":{source:"iana"},"audio/ac3":{source:"iana"},"audio/adpcm":{source:"apache",extensions:["adp"]},"audio/amr":{source:"iana",extensions:["amr"]},"audio/amr-wb":{source:"iana"},"audio/amr-wb+":{source:"iana"},"audio/aptx":{source:"iana"},"audio/asc":{source:"iana"},"audio/atrac-advanced-lossless":{source:"iana"},"audio/atrac-x":{source:"iana"},"audio/atrac3":{source:"iana"},"audio/basic":{source:"iana",compressible:!1,extensions:["au","snd"]},"audio/bv16":{source:"iana"},"audio/bv32":{source:"iana"},"audio/clearmode":{source:"iana"},"audio/cn":{source:"iana"},"audio/dat12":{source:"iana"},"audio/dls":{source:"iana"},"audio/dsr-es201108":{source:"iana"},"audio/dsr-es202050":{source:"iana"},"audio/dsr-es202211":{source:"iana"},"audio/dsr-es202212":{source:"iana"},"audio/dv":{source:"iana"},"audio/dvi4":{source:"iana"},"audio/eac3":{source:"iana"},"audio/encaprtp":{source:"iana"},"audio/evrc":{source:"iana"},"audio/evrc-qcp":{source:"iana"},"audio/evrc0":{source:"iana"},"audio/evrc1":{source:"iana"},"audio/evrcb":{source:"iana"},"audio/evrcb0":{source:"iana"},"audio/evrcb1":{source:"iana"},"audio/evrcnw":{source:"iana"},"audio/evrcnw0":{source:"iana"},"audio/evrcnw1":{source:"iana"},"audio/evrcwb":{source:"iana"},"audio/evrcwb0":{source:"iana"},"audio/evrcwb1":{source:"iana"},"audio/evs":{source:"iana"},"audio/flexfec":{source:"iana"},"audio/fwdred":{source:"iana"},"audio/g711-0":{source:"iana"},"audio/g719":{source:"iana"},"audio/g722":{source:"iana"},"audio/g7221":{source:"iana"},"audio/g723":{source:"iana"},"audio/g726-16":{source:"iana"},"audio/g726-24":{source:"iana"},"audio/g726-32":{source:"iana"},"audio/g726-40":{source:"iana"},"audio/g728":{source:"iana"},"audio/g729":{source:"iana"},"audio/g7291":{source:"iana"},"audio/g729d":{source:"iana"},"audio/g729e":{source:"iana"},"audio/gsm":{source:"iana"},"audio/gsm-efr":{source:"iana"},"audio/gsm-hr-08":{source:"iana"},"audio/ilbc":{source:"iana"},"audio/ip-mr_v2.5":{source:"iana"},"audio/isac":{source:"apache"},"audio/l16":{source:"iana"},"audio/l20":{source:"iana"},"audio/l24":{source:"iana",compressible:!1},"audio/l8":{source:"iana"},"audio/lpc":{source:"iana"},"audio/melp":{source:"iana"},"audio/melp1200":{source:"iana"},"audio/melp2400":{source:"iana"},"audio/melp600":{source:"iana"},"audio/mhas":{source:"iana"},"audio/midi":{source:"apache",extensions:["mid","midi","kar","rmi"]},"audio/mobile-xmf":{source:"iana",extensions:["mxmf"]},"audio/mp3":{compressible:!1,extensions:["mp3"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a","mp4a"]},"audio/mp4a-latm":{source:"iana"},"audio/mpa":{source:"iana"},"audio/mpa-robust":{source:"iana"},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mpga","mp2","mp2a","mp3","m2a","m3a"]},"audio/mpeg4-generic":{source:"iana"},"audio/musepack":{source:"apache"},"audio/ogg":{source:"iana",compressible:!1,extensions:["oga","ogg","spx","opus"]},"audio/opus":{source:"iana"},"audio/parityfec":{source:"iana"},"audio/pcma":{source:"iana"},"audio/pcma-wb":{source:"iana"},"audio/pcmu":{source:"iana"},"audio/pcmu-wb":{source:"iana"},"audio/prs.sid":{source:"iana"},"audio/qcelp":{source:"iana"},"audio/raptorfec":{source:"iana"},"audio/red":{source:"iana"},"audio/rtp-enc-aescm128":{source:"iana"},"audio/rtp-midi":{source:"iana"},"audio/rtploopback":{source:"iana"},"audio/rtx":{source:"iana"},"audio/s3m":{source:"apache",extensions:["s3m"]},"audio/scip":{source:"iana"},"audio/silk":{source:"apache",extensions:["sil"]},"audio/smv":{source:"iana"},"audio/smv-qcp":{source:"iana"},"audio/smv0":{source:"iana"},"audio/sofa":{source:"iana"},"audio/sp-midi":{source:"iana"},"audio/speex":{source:"iana"},"audio/t140c":{source:"iana"},"audio/t38":{source:"iana"},"audio/telephone-event":{source:"iana"},"audio/tetra_acelp":{source:"iana"},"audio/tetra_acelp_bb":{source:"iana"},"audio/tone":{source:"iana"},"audio/tsvcis":{source:"iana"},"audio/uemclip":{source:"iana"},"audio/ulpfec":{source:"iana"},"audio/usac":{source:"iana"},"audio/vdvi":{source:"iana"},"audio/vmr-wb":{source:"iana"},"audio/vnd.3gpp.iufp":{source:"iana"},"audio/vnd.4sb":{source:"iana"},"audio/vnd.audiokoz":{source:"iana"},"audio/vnd.celp":{source:"iana"},"audio/vnd.cisco.nse":{source:"iana"},"audio/vnd.cmles.radio-events":{source:"iana"},"audio/vnd.cns.anp1":{source:"iana"},"audio/vnd.cns.inf1":{source:"iana"},"audio/vnd.dece.audio":{source:"iana",extensions:["uva","uvva"]},"audio/vnd.digital-winds":{source:"iana",extensions:["eol"]},"audio/vnd.dlna.adts":{source:"iana"},"audio/vnd.dolby.heaac.1":{source:"iana"},"audio/vnd.dolby.heaac.2":{source:"iana"},"audio/vnd.dolby.mlp":{source:"iana"},"audio/vnd.dolby.mps":{source:"iana"},"audio/vnd.dolby.pl2":{source:"iana"},"audio/vnd.dolby.pl2x":{source:"iana"},"audio/vnd.dolby.pl2z":{source:"iana"},"audio/vnd.dolby.pulse.1":{source:"iana"},"audio/vnd.dra":{source:"iana",extensions:["dra"]},"audio/vnd.dts":{source:"iana",extensions:["dts"]},"audio/vnd.dts.hd":{source:"iana",extensions:["dtshd"]},"audio/vnd.dts.uhd":{source:"iana"},"audio/vnd.dvb.file":{source:"iana"},"audio/vnd.everad.plj":{source:"iana"},"audio/vnd.hns.audio":{source:"iana"},"audio/vnd.lucent.voice":{source:"iana",extensions:["lvp"]},"audio/vnd.ms-playready.media.pya":{source:"iana",extensions:["pya"]},"audio/vnd.nokia.mobile-xmf":{source:"iana"},"audio/vnd.nortel.vbk":{source:"iana"},"audio/vnd.nuera.ecelp4800":{source:"iana",extensions:["ecelp4800"]},"audio/vnd.nuera.ecelp7470":{source:"iana",extensions:["ecelp7470"]},"audio/vnd.nuera.ecelp9600":{source:"iana",extensions:["ecelp9600"]},"audio/vnd.octel.sbc":{source:"iana"},"audio/vnd.presonus.multitrack":{source:"iana"},"audio/vnd.qcelp":{source:"iana"},"audio/vnd.rhetorex.32kadpcm":{source:"iana"},"audio/vnd.rip":{source:"iana",extensions:["rip"]},"audio/vnd.rn-realaudio":{compressible:!1},"audio/vnd.sealedmedia.softseal.mpeg":{source:"iana"},"audio/vnd.vmx.cvsd":{source:"iana"},"audio/vnd.wave":{compressible:!1},"audio/vorbis":{source:"iana",compressible:!1},"audio/vorbis-config":{source:"iana"},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/wave":{compressible:!1,extensions:["wav"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/x-aac":{source:"apache",compressible:!1,extensions:["aac"]},"audio/x-aiff":{source:"apache",extensions:["aif","aiff","aifc"]},"audio/x-caf":{source:"apache",compressible:!1,extensions:["caf"]},"audio/x-flac":{source:"apache",extensions:["flac"]},"audio/x-m4a":{source:"nginx",extensions:["m4a"]},"audio/x-matroska":{source:"apache",extensions:["mka"]},"audio/x-mpegurl":{source:"apache",extensions:["m3u"]},"audio/x-ms-wax":{source:"apache",extensions:["wax"]},"audio/x-ms-wma":{source:"apache",extensions:["wma"]},"audio/x-pn-realaudio":{source:"apache",extensions:["ram","ra"]},"audio/x-pn-realaudio-plugin":{source:"apache",extensions:["rmp"]},"audio/x-realaudio":{source:"nginx",extensions:["ra"]},"audio/x-tta":{source:"apache"},"audio/x-wav":{source:"apache",extensions:["wav"]},"audio/xm":{source:"apache",extensions:["xm"]},"chemical/x-cdx":{source:"apache",extensions:["cdx"]},"chemical/x-cif":{source:"apache",extensions:["cif"]},"chemical/x-cmdf":{source:"apache",extensions:["cmdf"]},"chemical/x-cml":{source:"apache",extensions:["cml"]},"chemical/x-csml":{source:"apache",extensions:["csml"]},"chemical/x-pdb":{source:"apache"},"chemical/x-xyz":{source:"apache",extensions:["xyz"]},"font/collection":{source:"iana",extensions:["ttc"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"font/sfnt":{source:"iana"},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/woff":{source:"iana",extensions:["woff"]},"font/woff2":{source:"iana",extensions:["woff2"]},"image/aces":{source:"iana",extensions:["exr"]},"image/apng":{compressible:!1,extensions:["apng"]},"image/avci":{source:"iana",extensions:["avci"]},"image/avcs":{source:"iana",extensions:["avcs"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/cgm":{source:"iana",extensions:["cgm"]},"image/dicom-rle":{source:"iana",extensions:["drle"]},"image/emf":{source:"iana",extensions:["emf"]},"image/fits":{source:"iana",extensions:["fits"]},"image/g3fax":{source:"iana",extensions:["g3"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/heic":{source:"iana",extensions:["heic"]},"image/heic-sequence":{source:"iana",extensions:["heics"]},"image/heif":{source:"iana",extensions:["heif"]},"image/heif-sequence":{source:"iana",extensions:["heifs"]},"image/hej2k":{source:"iana",extensions:["hej2"]},"image/hsj2":{source:"iana",extensions:["hsj2"]},"image/ief":{source:"iana",extensions:["ief"]},"image/jls":{source:"iana",extensions:["jls"]},"image/jp2":{source:"iana",compressible:!1,extensions:["jp2","jpg2"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/jph":{source:"iana",extensions:["jph"]},"image/jphc":{source:"iana",extensions:["jhc"]},"image/jpm":{source:"iana",compressible:!1,extensions:["jpm"]},"image/jpx":{source:"iana",compressible:!1,extensions:["jpx","jpf"]},"image/jxr":{source:"iana",extensions:["jxr"]},"image/jxra":{source:"iana",extensions:["jxra"]},"image/jxrs":{source:"iana",extensions:["jxrs"]},"image/jxs":{source:"iana",extensions:["jxs"]},"image/jxsc":{source:"iana",extensions:["jxsc"]},"image/jxsi":{source:"iana",extensions:["jxsi"]},"image/jxss":{source:"iana",extensions:["jxss"]},"image/ktx":{source:"iana",extensions:["ktx"]},"image/ktx2":{source:"iana",extensions:["ktx2"]},"image/naplps":{source:"iana"},"image/pjpeg":{compressible:!1},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/prs.btif":{source:"iana",extensions:["btif"]},"image/prs.pti":{source:"iana",extensions:["pti"]},"image/pwg-raster":{source:"iana"},"image/sgi":{source:"apache",extensions:["sgi"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/t38":{source:"iana",extensions:["t38"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tif","tiff"]},"image/tiff-fx":{source:"iana",extensions:["tfx"]},"image/vnd.adobe.photoshop":{source:"iana",compressible:!0,extensions:["psd"]},"image/vnd.airzip.accelerator.azv":{source:"iana",extensions:["azv"]},"image/vnd.cns.inf2":{source:"iana"},"image/vnd.dece.graphic":{source:"iana",extensions:["uvi","uvvi","uvg","uvvg"]},"image/vnd.djvu":{source:"iana",extensions:["djvu","djv"]},"image/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"image/vnd.dwg":{source:"iana",extensions:["dwg"]},"image/vnd.dxf":{source:"iana",extensions:["dxf"]},"image/vnd.fastbidsheet":{source:"iana",extensions:["fbs"]},"image/vnd.fpx":{source:"iana",extensions:["fpx"]},"image/vnd.fst":{source:"iana",extensions:["fst"]},"image/vnd.fujixerox.edmics-mmr":{source:"iana",extensions:["mmr"]},"image/vnd.fujixerox.edmics-rlc":{source:"iana",extensions:["rlc"]},"image/vnd.globalgraphics.pgb":{source:"iana"},"image/vnd.microsoft.icon":{source:"iana",compressible:!0,extensions:["ico"]},"image/vnd.mix":{source:"iana"},"image/vnd.mozilla.apng":{source:"iana"},"image/vnd.ms-dds":{compressible:!0,extensions:["dds"]},"image/vnd.ms-modi":{source:"iana",extensions:["mdi"]},"image/vnd.ms-photo":{source:"apache",extensions:["wdp"]},"image/vnd.net-fpx":{source:"iana",extensions:["npx"]},"image/vnd.pco.b16":{source:"iana",extensions:["b16"]},"image/vnd.radiance":{source:"iana"},"image/vnd.sealed.png":{source:"iana"},"image/vnd.sealedmedia.softseal.gif":{source:"iana"},"image/vnd.sealedmedia.softseal.jpg":{source:"iana"},"image/vnd.svf":{source:"iana"},"image/vnd.tencent.tap":{source:"iana",extensions:["tap"]},"image/vnd.valve.source.texture":{source:"iana",extensions:["vtf"]},"image/vnd.wap.wbmp":{source:"iana",extensions:["wbmp"]},"image/vnd.xiff":{source:"iana",extensions:["xif"]},"image/vnd.zbrush.pcx":{source:"iana",extensions:["pcx"]},"image/webp":{source:"apache",extensions:["webp"]},"image/wmf":{source:"iana",extensions:["wmf"]},"image/x-3ds":{source:"apache",extensions:["3ds"]},"image/x-cmu-raster":{source:"apache",extensions:["ras"]},"image/x-cmx":{source:"apache",extensions:["cmx"]},"image/x-freehand":{source:"apache",extensions:["fh","fhc","fh4","fh5","fh7"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/x-jng":{source:"nginx",extensions:["jng"]},"image/x-mrsid-image":{source:"apache",extensions:["sid"]},"image/x-ms-bmp":{source:"nginx",compressible:!0,extensions:["bmp"]},"image/x-pcx":{source:"apache",extensions:["pcx"]},"image/x-pict":{source:"apache",extensions:["pic","pct"]},"image/x-portable-anymap":{source:"apache",extensions:["pnm"]},"image/x-portable-bitmap":{source:"apache",extensions:["pbm"]},"image/x-portable-graymap":{source:"apache",extensions:["pgm"]},"image/x-portable-pixmap":{source:"apache",extensions:["ppm"]},"image/x-rgb":{source:"apache",extensions:["rgb"]},"image/x-tga":{source:"apache",extensions:["tga"]},"image/x-xbitmap":{source:"apache",extensions:["xbm"]},"image/x-xcf":{compressible:!1},"image/x-xpixmap":{source:"apache",extensions:["xpm"]},"image/x-xwindowdump":{source:"apache",extensions:["xwd"]},"message/cpim":{source:"iana"},"message/delivery-status":{source:"iana"},"message/disposition-notification":{source:"iana",extensions:["disposition-notification"]},"message/external-body":{source:"iana"},"message/feedback-report":{source:"iana"},"message/global":{source:"iana",extensions:["u8msg"]},"message/global-delivery-status":{source:"iana",extensions:["u8dsn"]},"message/global-disposition-notification":{source:"iana",extensions:["u8mdn"]},"message/global-headers":{source:"iana",extensions:["u8hdr"]},"message/http":{source:"iana",compressible:!1},"message/imdn+xml":{source:"iana",compressible:!0},"message/news":{source:"iana"},"message/partial":{source:"iana",compressible:!1},"message/rfc822":{source:"iana",compressible:!0,extensions:["eml","mime"]},"message/s-http":{source:"iana"},"message/sip":{source:"iana"},"message/sipfrag":{source:"iana"},"message/tracking-status":{source:"iana"},"message/vnd.si.simp":{source:"iana"},"message/vnd.wfa.wsc":{source:"iana",extensions:["wsc"]},"model/3mf":{source:"iana",extensions:["3mf"]},"model/e57":{source:"iana"},"model/gltf+json":{source:"iana",compressible:!0,extensions:["gltf"]},"model/gltf-binary":{source:"iana",compressible:!0,extensions:["glb"]},"model/iges":{source:"iana",compressible:!1,extensions:["igs","iges"]},"model/mesh":{source:"iana",compressible:!1,extensions:["msh","mesh","silo"]},"model/mtl":{source:"iana",extensions:["mtl"]},"model/obj":{source:"iana",extensions:["obj"]},"model/step":{source:"iana"},"model/step+xml":{source:"iana",compressible:!0,extensions:["stpx"]},"model/step+zip":{source:"iana",compressible:!1,extensions:["stpz"]},"model/step-xml+zip":{source:"iana",compressible:!1,extensions:["stpxz"]},"model/stl":{source:"iana",extensions:["stl"]},"model/vnd.collada+xml":{source:"iana",compressible:!0,extensions:["dae"]},"model/vnd.dwf":{source:"iana",extensions:["dwf"]},"model/vnd.flatland.3dml":{source:"iana"},"model/vnd.gdl":{source:"iana",extensions:["gdl"]},"model/vnd.gs-gdl":{source:"apache"},"model/vnd.gs.gdl":{source:"iana"},"model/vnd.gtw":{source:"iana",extensions:["gtw"]},"model/vnd.moml+xml":{source:"iana",compressible:!0},"model/vnd.mts":{source:"iana",extensions:["mts"]},"model/vnd.opengex":{source:"iana",extensions:["ogex"]},"model/vnd.parasolid.transmit.binary":{source:"iana",extensions:["x_b"]},"model/vnd.parasolid.transmit.text":{source:"iana",extensions:["x_t"]},"model/vnd.pytha.pyox":{source:"iana"},"model/vnd.rosette.annotated-data-model":{source:"iana"},"model/vnd.sap.vds":{source:"iana",extensions:["vds"]},"model/vnd.usdz+zip":{source:"iana",compressible:!1,extensions:["usdz"]},"model/vnd.valve.source.compiled-map":{source:"iana",extensions:["bsp"]},"model/vnd.vtu":{source:"iana",extensions:["vtu"]},"model/vrml":{source:"iana",compressible:!1,extensions:["wrl","vrml"]},"model/x3d+binary":{source:"apache",compressible:!1,extensions:["x3db","x3dbz"]},"model/x3d+fastinfoset":{source:"iana",extensions:["x3db"]},"model/x3d+vrml":{source:"apache",compressible:!1,extensions:["x3dv","x3dvz"]},"model/x3d+xml":{source:"iana",compressible:!0,extensions:["x3d","x3dz"]},"model/x3d-vrml":{source:"iana",extensions:["x3dv"]},"multipart/alternative":{source:"iana",compressible:!1},"multipart/appledouble":{source:"iana"},"multipart/byteranges":{source:"iana"},"multipart/digest":{source:"iana"},"multipart/encrypted":{source:"iana",compressible:!1},"multipart/form-data":{source:"iana",compressible:!1},"multipart/header-set":{source:"iana"},"multipart/mixed":{source:"iana"},"multipart/multilingual":{source:"iana"},"multipart/parallel":{source:"iana"},"multipart/related":{source:"iana",compressible:!1},"multipart/report":{source:"iana"},"multipart/signed":{source:"iana",compressible:!1},"multipart/vnd.bint.med-plus":{source:"iana"},"multipart/voice-message":{source:"iana"},"multipart/x-mixed-replace":{source:"iana"},"text/1d-interleaved-parityfec":{source:"iana"},"text/cache-manifest":{source:"iana",compressible:!0,extensions:["appcache","manifest"]},"text/calendar":{source:"iana",extensions:["ics","ifb"]},"text/calender":{compressible:!0},"text/cmd":{compressible:!0},"text/coffeescript":{extensions:["coffee","litcoffee"]},"text/cql":{source:"iana"},"text/cql-expression":{source:"iana"},"text/cql-identifier":{source:"iana"},"text/css":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["css"]},"text/csv":{source:"iana",compressible:!0,extensions:["csv"]},"text/csv-schema":{source:"iana"},"text/directory":{source:"iana"},"text/dns":{source:"iana"},"text/ecmascript":{source:"iana"},"text/encaprtp":{source:"iana"},"text/enriched":{source:"iana"},"text/fhirpath":{source:"iana"},"text/flexfec":{source:"iana"},"text/fwdred":{source:"iana"},"text/gff3":{source:"iana"},"text/grammar-ref-list":{source:"iana"},"text/html":{source:"iana",compressible:!0,extensions:["html","htm","shtml"]},"text/jade":{extensions:["jade"]},"text/javascript":{source:"iana",compressible:!0},"text/jcr-cnd":{source:"iana"},"text/jsx":{compressible:!0,extensions:["jsx"]},"text/less":{compressible:!0,extensions:["less"]},"text/markdown":{source:"iana",compressible:!0,extensions:["markdown","md"]},"text/mathml":{source:"nginx",extensions:["mml"]},"text/mdx":{compressible:!0,extensions:["mdx"]},"text/mizar":{source:"iana"},"text/n3":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["n3"]},"text/parameters":{source:"iana",charset:"UTF-8"},"text/parityfec":{source:"iana"},"text/plain":{source:"iana",compressible:!0,extensions:["txt","text","conf","def","list","log","in","ini"]},"text/provenance-notation":{source:"iana",charset:"UTF-8"},"text/prs.fallenstein.rst":{source:"iana"},"text/prs.lines.tag":{source:"iana",extensions:["dsc"]},"text/prs.prop.logic":{source:"iana"},"text/raptorfec":{source:"iana"},"text/red":{source:"iana"},"text/rfc822-headers":{source:"iana"},"text/richtext":{source:"iana",compressible:!0,extensions:["rtx"]},"text/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"text/rtp-enc-aescm128":{source:"iana"},"text/rtploopback":{source:"iana"},"text/rtx":{source:"iana"},"text/sgml":{source:"iana",extensions:["sgml","sgm"]},"text/shaclc":{source:"iana"},"text/shex":{source:"iana",extensions:["shex"]},"text/slim":{extensions:["slim","slm"]},"text/spdx":{source:"iana",extensions:["spdx"]},"text/strings":{source:"iana"},"text/stylus":{extensions:["stylus","styl"]},"text/t140":{source:"iana"},"text/tab-separated-values":{source:"iana",compressible:!0,extensions:["tsv"]},"text/troff":{source:"iana",extensions:["t","tr","roff","man","me","ms"]},"text/turtle":{source:"iana",charset:"UTF-8",extensions:["ttl"]},"text/ulpfec":{source:"iana"},"text/uri-list":{source:"iana",compressible:!0,extensions:["uri","uris","urls"]},"text/vcard":{source:"iana",compressible:!0,extensions:["vcard"]},"text/vnd.a":{source:"iana"},"text/vnd.abc":{source:"iana"},"text/vnd.ascii-art":{source:"iana"},"text/vnd.curl":{source:"iana",extensions:["curl"]},"text/vnd.curl.dcurl":{source:"apache",extensions:["dcurl"]},"text/vnd.curl.mcurl":{source:"apache",extensions:["mcurl"]},"text/vnd.curl.scurl":{source:"apache",extensions:["scurl"]},"text/vnd.debian.copyright":{source:"iana",charset:"UTF-8"},"text/vnd.dmclientscript":{source:"iana"},"text/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"text/vnd.esmertec.theme-descriptor":{source:"iana",charset:"UTF-8"},"text/vnd.familysearch.gedcom":{source:"iana",extensions:["ged"]},"text/vnd.ficlab.flt":{source:"iana"},"text/vnd.fly":{source:"iana",extensions:["fly"]},"text/vnd.fmi.flexstor":{source:"iana",extensions:["flx"]},"text/vnd.gml":{source:"iana"},"text/vnd.graphviz":{source:"iana",extensions:["gv"]},"text/vnd.hans":{source:"iana"},"text/vnd.hgl":{source:"iana"},"text/vnd.in3d.3dml":{source:"iana",extensions:["3dml"]},"text/vnd.in3d.spot":{source:"iana",extensions:["spot"]},"text/vnd.iptc.newsml":{source:"iana"},"text/vnd.iptc.nitf":{source:"iana"},"text/vnd.latex-z":{source:"iana"},"text/vnd.motorola.reflex":{source:"iana"},"text/vnd.ms-mediapackage":{source:"iana"},"text/vnd.net2phone.commcenter.command":{source:"iana"},"text/vnd.radisys.msml-basic-layout":{source:"iana"},"text/vnd.senx.warpscript":{source:"iana"},"text/vnd.si.uricatalogue":{source:"iana"},"text/vnd.sosi":{source:"iana"},"text/vnd.sun.j2me.app-descriptor":{source:"iana",charset:"UTF-8",extensions:["jad"]},"text/vnd.trolltech.linguist":{source:"iana",charset:"UTF-8"},"text/vnd.wap.si":{source:"iana"},"text/vnd.wap.sl":{source:"iana"},"text/vnd.wap.wml":{source:"iana",extensions:["wml"]},"text/vnd.wap.wmlscript":{source:"iana",extensions:["wmls"]},"text/vtt":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["vtt"]},"text/x-asm":{source:"apache",extensions:["s","asm"]},"text/x-c":{source:"apache",extensions:["c","cc","cxx","cpp","h","hh","dic"]},"text/x-component":{source:"nginx",extensions:["htc"]},"text/x-fortran":{source:"apache",extensions:["f","for","f77","f90"]},"text/x-gwt-rpc":{compressible:!0},"text/x-handlebars-template":{extensions:["hbs"]},"text/x-java-source":{source:"apache",extensions:["java"]},"text/x-jquery-tmpl":{compressible:!0},"text/x-lua":{extensions:["lua"]},"text/x-markdown":{compressible:!0,extensions:["mkd"]},"text/x-nfo":{source:"apache",extensions:["nfo"]},"text/x-opml":{source:"apache",extensions:["opml"]},"text/x-org":{compressible:!0,extensions:["org"]},"text/x-pascal":{source:"apache",extensions:["p","pas"]},"text/x-processing":{compressible:!0,extensions:["pde"]},"text/x-sass":{extensions:["sass"]},"text/x-scss":{extensions:["scss"]},"text/x-setext":{source:"apache",extensions:["etx"]},"text/x-sfv":{source:"apache",extensions:["sfv"]},"text/x-suse-ymp":{compressible:!0,extensions:["ymp"]},"text/x-uuencode":{source:"apache",extensions:["uu"]},"text/x-vcalendar":{source:"apache",extensions:["vcs"]},"text/x-vcard":{source:"apache",extensions:["vcf"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/xml-external-parsed-entity":{source:"iana"},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"video/1d-interleaved-parityfec":{source:"iana"},"video/3gpp":{source:"iana",extensions:["3gp","3gpp"]},"video/3gpp-tt":{source:"iana"},"video/3gpp2":{source:"iana",extensions:["3g2"]},"video/av1":{source:"iana"},"video/bmpeg":{source:"iana"},"video/bt656":{source:"iana"},"video/celb":{source:"iana"},"video/dv":{source:"iana"},"video/encaprtp":{source:"iana"},"video/ffv1":{source:"iana"},"video/flexfec":{source:"iana"},"video/h261":{source:"iana",extensions:["h261"]},"video/h263":{source:"iana",extensions:["h263"]},"video/h263-1998":{source:"iana"},"video/h263-2000":{source:"iana"},"video/h264":{source:"iana",extensions:["h264"]},"video/h264-rcdo":{source:"iana"},"video/h264-svc":{source:"iana"},"video/h265":{source:"iana"},"video/iso.segment":{source:"iana",extensions:["m4s"]},"video/jpeg":{source:"iana",extensions:["jpgv"]},"video/jpeg2000":{source:"iana"},"video/jpm":{source:"apache",extensions:["jpm","jpgm"]},"video/jxsv":{source:"iana"},"video/mj2":{source:"iana",extensions:["mj2","mjp2"]},"video/mp1s":{source:"iana"},"video/mp2p":{source:"iana"},"video/mp2t":{source:"iana",extensions:["ts"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","mp4v","mpg4"]},"video/mp4v-es":{source:"iana"},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg","mpe","m1v","m2v"]},"video/mpeg4-generic":{source:"iana"},"video/mpv":{source:"iana"},"video/nv":{source:"iana"},"video/ogg":{source:"iana",compressible:!1,extensions:["ogv"]},"video/parityfec":{source:"iana"},"video/pointer":{source:"iana"},"video/quicktime":{source:"iana",compressible:!1,extensions:["qt","mov"]},"video/raptorfec":{source:"iana"},"video/raw":{source:"iana"},"video/rtp-enc-aescm128":{source:"iana"},"video/rtploopback":{source:"iana"},"video/rtx":{source:"iana"},"video/scip":{source:"iana"},"video/smpte291":{source:"iana"},"video/smpte292m":{source:"iana"},"video/ulpfec":{source:"iana"},"video/vc1":{source:"iana"},"video/vc2":{source:"iana"},"video/vnd.cctv":{source:"iana"},"video/vnd.dece.hd":{source:"iana",extensions:["uvh","uvvh"]},"video/vnd.dece.mobile":{source:"iana",extensions:["uvm","uvvm"]},"video/vnd.dece.mp4":{source:"iana"},"video/vnd.dece.pd":{source:"iana",extensions:["uvp","uvvp"]},"video/vnd.dece.sd":{source:"iana",extensions:["uvs","uvvs"]},"video/vnd.dece.video":{source:"iana",extensions:["uvv","uvvv"]},"video/vnd.directv.mpeg":{source:"iana"},"video/vnd.directv.mpeg-tts":{source:"iana"},"video/vnd.dlna.mpeg-tts":{source:"iana"},"video/vnd.dvb.file":{source:"iana",extensions:["dvb"]},"video/vnd.fvt":{source:"iana",extensions:["fvt"]},"video/vnd.hns.video":{source:"iana"},"video/vnd.iptvforum.1dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.1dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.2dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.2dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.ttsavc":{source:"iana"},"video/vnd.iptvforum.ttsmpeg2":{source:"iana"},"video/vnd.motorola.video":{source:"iana"},"video/vnd.motorola.videop":{source:"iana"},"video/vnd.mpegurl":{source:"iana",extensions:["mxu","m4u"]},"video/vnd.ms-playready.media.pyv":{source:"iana",extensions:["pyv"]},"video/vnd.nokia.interleaved-multimedia":{source:"iana"},"video/vnd.nokia.mp4vr":{source:"iana"},"video/vnd.nokia.videovoip":{source:"iana"},"video/vnd.objectvideo":{source:"iana"},"video/vnd.radgamettools.bink":{source:"iana"},"video/vnd.radgamettools.smacker":{source:"iana"},"video/vnd.sealed.mpeg1":{source:"iana"},"video/vnd.sealed.mpeg4":{source:"iana"},"video/vnd.sealed.swf":{source:"iana"},"video/vnd.sealedmedia.softseal.mov":{source:"iana"},"video/vnd.uvvu.mp4":{source:"iana",extensions:["uvu","uvvu"]},"video/vnd.vivo":{source:"iana",extensions:["viv"]},"video/vnd.youtube.yt":{source:"iana"},"video/vp8":{source:"iana"},"video/vp9":{source:"iana"},"video/webm":{source:"apache",compressible:!1,extensions:["webm"]},"video/x-f4v":{source:"apache",extensions:["f4v"]},"video/x-fli":{source:"apache",extensions:["fli"]},"video/x-flv":{source:"apache",compressible:!1,extensions:["flv"]},"video/x-m4v":{source:"apache",extensions:["m4v"]},"video/x-matroska":{source:"apache",compressible:!1,extensions:["mkv","mk3d","mks"]},"video/x-mng":{source:"apache",extensions:["mng"]},"video/x-ms-asf":{source:"apache",extensions:["asf","asx"]},"video/x-ms-vob":{source:"apache",extensions:["vob"]},"video/x-ms-wm":{source:"apache",extensions:["wm"]},"video/x-ms-wmv":{source:"apache",compressible:!1,extensions:["wmv"]},"video/x-ms-wmx":{source:"apache",extensions:["wmx"]},"video/x-ms-wvx":{source:"apache",extensions:["wvx"]},"video/x-msvideo":{source:"apache",extensions:["avi"]},"video/x-sgi-movie":{source:"apache",extensions:["movie"]},"video/x-smv":{source:"apache",extensions:["smv"]},"x-conference/x-cooltalk":{source:"apache",extensions:["ice"]},"x-shader/x-fragment":{compressible:!0},"x-shader/x-vertex":{compressible:!0}};
4
4
  /*!
@@ -7,5 +7,5 @@
7
7
  * Copyright(c) 2015 Douglas Christopher Wilson
8
8
  * MIT Licensed
9
9
  */
10
- !function(t){var n,i,a,o=Us,s=e.extname,r=/^\s*([^;\s]*)(?:;|\s|$)/,c=/^text\//i;function l(e){if(!e||"string"!=typeof e)return!1;var t=r.exec(e),n=t&&o[t[1].toLowerCase()];return n&&n.charset?n.charset:!(!t||!c.test(t[1]))&&"UTF-8"}t.charset=l,t.charsets={lookup:l},t.contentType=function(e){if(!e||"string"!=typeof e)return!1;var n=-1===e.indexOf("/")?t.lookup(e):e;if(!n)return!1;if(-1===n.indexOf("charset")){var i=t.charset(n);i&&(n+="; charset="+i.toLowerCase())}return n},t.extension=function(e){if(!e||"string"!=typeof e)return!1;var n=r.exec(e),i=n&&t.extensions[n[1].toLowerCase()];if(!i||!i.length)return!1;return i[0]},t.extensions=Object.create(null),t.lookup=function(e){if(!e||"string"!=typeof e)return!1;var n=s("x."+e).toLowerCase().substr(1);if(!n)return!1;return t.types[n]||!1},t.types=Object.create(null),n=t.extensions,i=t.types,a=["nginx","apache",void 0,"iana"],Object.keys(o).forEach((function(e){var t=o[e],s=t.extensions;if(s&&s.length){n[e]=s;for(var r=0;r<s.length;r++){var c=s[r];if(i[c]){var l=a.indexOf(o[i[c]].source),p=a.indexOf(t.source);if("application/octet-stream"!==i[c]&&(l>p||l===p&&"application/"===i[c].substr(0,12)))continue}i[c]=e}}}))}(Bs);var Hs=n(Bs),Ws="undefined"!=typeof window?window:{screen:{},navigator:{}},$s=(Ws.matchMedia||function(){return{matches:!1}}).bind(Ws),Ks={get passive(){return!0}},Ys=function(){};Ws.addEventListener&&Ws.addEventListener("p",Ys,Ks),Ws.removeEventListener&&Ws.removeEventListener("p",Ys,!1);var Xs="ontouchstart"in Ws,Gs=Xs||"TouchEvent"in Ws&&$s("(any-pointer: coarse)").matches,Js=(Ws.navigator.maxTouchPoints||0)>0||Gs,Qs=Ws.navigator.userAgent||"",Zs=$s("(pointer: coarse)").matches&&/iPad|Macintosh/.test(Qs)&&Math.min(Ws.screen.width||0,Ws.screen.height||0)>=768,er=($s("(pointer: coarse)").matches||!$s("(pointer: fine)").matches&&Xs)&&!/Windows.*Firefox/.test(Qs),tr=$s("(any-pointer: fine)").matches||$s("(any-hover: hover)").matches||Zs||!Xs,nr=!Js||!tr&&er?Js?"touchOnly":"mouseOnly":"hybrid",ir="mouseOnly"===nr?"mouse":"touchOnly"===nr||er?"touch":"mouse";function ar(e){return e||(new URLSearchParams(window.location.search).get("lng")||"en")}function or(){return"touchOnly"===nr||"hybrid"===nr&&"touch"===ir?"mobile":"desktop"}function sr(e,t,n,i,a,o,s){return s&&o&&"device"===a||o&&"device"===a?"".concat(e,"/").concat(n,"/").concat(i,"/").concat(t):s&&o&&"shared"===a||o&&"shared"===a?"".concat(e,"/").concat(n,"/shared/").concat(t):"device"===a?"".concat(e,"/").concat(i,"/").concat(t):"shared/device"===a?"".concat(e,"/shared/").concat(i,"/").concat(t):"languageSpecific"===a?"".concat(e,"/").concat(n,"/").concat(t):"default"===a?"".concat(e,"/").concat(t):"".concat(e,"/shared/").concat(t)}function rr(e){var t=Hs.lookup(e);if(!t)throw new Error("Unrecognized file extension in path: ".concat(e));if(t.startsWith("image/"))return"images";if(t.startsWith("audio/"))return"audio";if(t.startsWith("video/"))return"video";throw new Error("Unsupported MIME type for file: ".concat(e,". Only image, audio, and video files are supported."))}function cr(e,t,n,i){return new(n||(n=Promise))((function(a,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function r(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,r)}c((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var lr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function pr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ur=pr(((e,{include:t,exclude:n}={})=>{const i=e=>{const i=t=>"string"==typeof t?e===t:t.test(e);return t?t.some(i):!n||!n.some(i)};for(const[t,n]of(e=>{const t=new Set;do{for(const n of Reflect.ownKeys(e))t.add([e,n])}while((e=Reflect.getPrototypeOf(e))&&e!==Object.prototype);return t})(e.constructor.prototype)){if("constructor"===n||!i(n))continue;const a=Reflect.getOwnPropertyDescriptor(t,n);a&&"function"==typeof a.value&&(e[n]=e[n].bind(e))}return e}));class dr extends Error{constructor(e="The global `jsPsych` variable is no longer available in jsPsych v7."){super(`${e} Please follow the migration guide at https://www.jspsych.org/7.0/support/migration-v7/ to update your experiment.`),this.name="MigrationError"}}function mr(e){return[...new Set(e)]}function hr(e){if(!e)return e;let t;if(Array.isArray(e)){t=[];for(const n of e)t.push(hr(n));return t}if("object"==typeof e&&null!==e){t={};for(const n in e)e.hasOwnProperty(n)&&(t[n]=hr(e[n]));return t}return e}window.jsPsych={get init(){throw new dr("`jsPsych.init()` was replaced by `initJsPsych()` in jsPsych v7.")},get data(){throw new dr},get randomization(){throw new dr},get turk(){throw new dr},get pluginAPI(){throw new dr},get ALL_KEYS(){throw new dr('jsPsych.ALL_KEYS was replaced by the "ALL_KEYS" string in jsPsych v7.')},get NO_KEYS(){throw new dr('jsPsych.NO_KEYS was replaced by the "NO_KEYS" string in jsPsych v7.')}};var fr,gr=Object.freeze({__proto__:null,deepCopy:hr,deepMerge:function e(t,n){let i={};for(const a in t)t.hasOwnProperty(a)&&("object"==typeof t[a]&&n.hasOwnProperty(a)?i[a]=e(t[a],n[a]):i[a]=t[a]);for(const t in n)n.hasOwnProperty(t)&&(i.hasOwnProperty(t)&&"object"==typeof n[t]?i[t]=e(i[t],n[t]):i[t]=n[t]);return i},unique:mr});class vr{constructor(e=[]){this.values=e}sum(){let e=0;for(const t of this.values)e+=t;return e}mean(){return this.sum()/this.count()}median(){if(0===this.values.length)return;const e=this.values.slice(0).sort((function(e,t){return e-t})),t=Math.floor(e.length/2);return e.length%2==0?(e[t]+e[t-1])/2:e[t]}min(){return Math.min.apply(null,this.values)}max(){return Math.max.apply(null,this.values)}count(){return this.values.length}variance(){const e=this.mean();let t=0;for(const n of this.values)t+=Math.pow(n-e,2);return t/(this.values.length-1)}sd(){const e=this.variance();return Math.sqrt(e)}frequencies(){const e={};for(const t of this.values)void 0===e[t]?e[t]=1:e[t]++;return e}all(e){for(const t of this.values)if(!e(t))return!1;return!0}subset(e){const t=[];for(const n of this.values)e(n)&&t.push(n);return new vr(t)}}class br{constructor(e=[]){this.trials=e}push(e){return this.trials.push(e),this}join(e){return this.trials=this.trials.concat(e.values()),this}top(){return this.trials.length<=1?this:new br([this.trials[this.trials.length-1]])}first(e=1){if(e<1)throw"You must query with a positive nonzero integer. Please use a\n different value for n.";return 0===this.trials.length?new br:(e>this.trials.length&&(e=this.trials.length),new br(this.trials.slice(0,e)))}last(e=1){if(e<1)throw"You must query with a positive nonzero integer. Please use a\n different value for n.";return 0===this.trials.length?new br:(e>this.trials.length&&(e=this.trials.length),new br(this.trials.slice(this.trials.length-e,this.trials.length)))}values(){return this.trials}count(){return this.trials.length}readOnly(){return new br(hr(this.trials))}addToAll(e){for(const t of this.trials)Object.assign(t,e);return this}addToLast(e){return 0!=this.trials.length&&Object.assign(this.trials[this.trials.length-1],e),this}filter(e){let t;t=Array.isArray(e)?hr(e):hr([e]);const n=[];for(const e of this.trials){let i=!1;for(const n of t){let t=!0;for(const i of Object.keys(n))void 0!==e[i]&&e[i]===n[i]||(t=!1);if(t){i=!0;break}}i&&n.push(e)}return new br(n)}filterCustom(e){return new br(this.trials.filter(e))}filterColumns(e){return new br(this.trials.map((t=>Object.fromEntries(e.filter((e=>e in t)).map((e=>[e,t[e]]))))))}select(e){const t=[];for(const n of this.trials)void 0!==n[e]&&t.push(n[e]);return new vr(t)}ignore(e){Array.isArray(e)||(e=[e]);const t=hr(this.trials);for(const n of t)for(const t of e)delete n[t];return new br(t)}uniqueNames(){const e=[];for(const t of this.trials)for(const n of Object.keys(t))e.includes(n)||e.push(n);return e}csv(){return function(e){const t="object"!=typeof e?JSON.parse(e):e;let n="",i="";const a=[];for(const e of t)for(const t in e){let e=t+"";e='"'+e.replace(/"/g,'""')+'",',a.includes(t)||(a.push(t),n+=e)}n=n.slice(0,-1),i+=n+"\r\n";for(const e of t){n="";for(const t of a){let i=void 0===e[t]?"":e[t];"object"==typeof i&&(i=JSON.stringify(i)),n+='"'+(i+"").replace(/"/g,'""')+'",'}n=n.slice(0,-1),i+=n+"\r\n"}return i}(this.trials)}json(e=!1){return e?JSON.stringify(this.trials,null,"\t"):JSON.stringify(this.trials)}localSave(e,t){let n;if("json"===(e=e.toLowerCase()))n=this.json();else{if("csv"!==e)throw new Error('Invalid format specified for localSave. Must be "json" or "csv".');n=this.csv()}!function(e,t){const n=new Blob([e],{type:"text/plain"});let i="";i=void 0!==window.webkitURL?window.webkitURL.createObjectURL(n):window.URL.createObjectURL(n);const a=document.createElement("a");a.id="jspsych-download-as-text-link",a.style.display="none",a.download=t,a.href=i,a.click()}(n,t)}}class xr{constructor(e){this.jsPsych=e,this.dataProperties={},this.reset()}reset(){this.allData=new br,this.interactionData=new br}get(){return this.allData}getInteractionData(){return this.interactionData}write(e){const t=this.jsPsych.getProgress(),n=this.jsPsych.getCurrentTrial(),i={trial_type:n.type.info.name,trial_index:t.current_trial_global,time_elapsed:this.jsPsych.getTotalTime(),internal_node_id:this.jsPsych.getCurrentTimelineNodeID()};this.allData.push(Object.assign(Object.assign(Object.assign(Object.assign({},e),n.data),i),this.dataProperties))}addProperties(e){this.allData.addToAll(e),this.dataProperties=Object.assign({},this.dataProperties,e)}addDataToLastTrial(e){this.allData.addToLast(e)}getDataByTimelineNode(e){return this.allData.filterCustom((t=>t.internal_node_id.slice(0,e.length)===e))}getLastTrialData(){return this.allData.top()}getLastTimelineData(){const e=this.getLastTrialData().select("internal_node_id").values[0];if(void 0===e)return new br;{const t=e.substr(0,e.lastIndexOf("-"));return this.getDataByTimelineNode(t)}}displayData(e="json"){"json"!=(e=e.toLowerCase())&&"csv"!=e&&(console.log("Invalid format declared for displayData function. Using json as default."),e="json");const t="json"===e?this.allData.json(!0):this.allData.csv();this.jsPsych.getDisplayElement().innerHTML='<pre id="jspsych-data-display"></pre>',document.getElementById("jspsych-data-display").textContent=t}urlVariables(){return void 0===this.query_string&&(this.query_string=function(){const e=window.location.search.substr(1).split("&"),t={};for(let n=0;n<e.length;++n){const i=e[n].split("=",2);1==i.length?t[i[0]]="":t[i[0]]=decodeURIComponent(i[1].replace(/\+/g," "))}return t}()),this.query_string}getURLVariable(e){return this.urlVariables()[e]}createInteractionListeners(){window.addEventListener("blur",(()=>{const e={event:"blur",trial:this.jsPsych.getProgress().current_trial_global,time:this.jsPsych.getTotalTime()};this.interactionData.push(e),this.jsPsych.getInitSettings().on_interaction_data_update(e)})),window.addEventListener("focus",(()=>{const e={event:"focus",trial:this.jsPsych.getProgress().current_trial_global,time:this.jsPsych.getTotalTime()};this.interactionData.push(e),this.jsPsych.getInitSettings().on_interaction_data_update(e)}));const e=()=>{const e={event:document.isFullScreen||document.webkitIsFullScreen||document.mozIsFullScreen||document.fullscreenElement?"fullscreenenter":"fullscreenexit",trial:this.jsPsych.getProgress().current_trial_global,time:this.jsPsych.getTotalTime()};this.interactionData.push(e),this.jsPsych.getInitSettings().on_interaction_data_update(e)};document.addEventListener("fullscreenchange",e),document.addEventListener("mozfullscreenchange",e),document.addEventListener("webkitfullscreenchange",e)}_customInsert(e){this.allData=new br(e)}_fullreset(){this.reset(),this.dataProperties={}}}class yr{constructor(){this.hardwareConnected=!1,document.addEventListener("jspsych-activate",(e=>{this.hardwareConnected=!0}))}hardware(e){const t=new CustomEvent("jspsych",{detail:e});document.dispatchEvent(t)}}class wr{constructor(e,t=!1,n=0){this.getRootElement=e,this.areResponsesCaseSensitive=t,this.minimumValidRt=n,this.listeners=new Set,this.heldKeys=new Set,this.areRootListenersRegistered=!1,ur(this),this.registerRootListeners()}registerRootListeners(){if(!this.areRootListenersRegistered){const e=this.getRootElement();e&&(e.addEventListener("keydown",this.rootKeydownListener),e.addEventListener("keyup",this.rootKeyupListener),this.areRootListenersRegistered=!0)}}rootKeydownListener(e){for(const t of Array.from(this.listeners))t(e);this.heldKeys.add(this.toLowerCaseIfInsensitive(e.key))}toLowerCaseIfInsensitive(e){return this.areResponsesCaseSensitive?e:e.toLowerCase()}rootKeyupListener(e){this.heldKeys.delete(this.toLowerCaseIfInsensitive(e.key))}isResponseValid(e,t,n){return!(!t&&this.heldKeys.has(n))&&("ALL_KEYS"===e||"NO_KEYS"!==e&&e.includes(n))}getKeyboardResponse({callback_function:e,valid_responses:t="ALL_KEYS",rt_method:n="performance",persist:i,audio_context:a,audio_context_start_time:o,allow_held_key:s=!1,minimum_valid_rt:r=this.minimumValidRt}){"performance"!==n&&"audio"!==n&&(console.log('Invalid RT method specified in getKeyboardResponse. Defaulting to "performance" method.'),n="performance");const c="performance"===n?performance.now():1e3*o;this.registerRootListeners(),this.areResponsesCaseSensitive||"string"==typeof t||(t=t.map((e=>e.toLowerCase())));const l=o=>{const p=Math.round(("performance"==n?performance.now():1e3*a.currentTime)-c);if(p<r)return;const u=this.toLowerCaseIfInsensitive(o.key);this.isResponseValid(t,s,u)&&(o.preventDefault(),i||this.cancelKeyboardResponse(l),e({key:u,rt:p}))};return this.listeners.add(l),l}cancelKeyboardResponse(e){this.listeners.delete(e)}cancelAllKeyboardResponses(){this.listeners.clear()}compareKeys(e,t){if(!("string"!=typeof e&&null!==e||"string"!=typeof t&&null!==t))return"string"==typeof e&&"string"==typeof t?this.areResponsesCaseSensitive?e===t:e.toLowerCase()===t.toLowerCase():null===e&&null===t;console.error("Error in jsPsych.pluginAPI.compareKeys: arguments must be key strings or null.")}}!function(e){e[e.BOOL=0]="BOOL",e[e.STRING=1]="STRING",e[e.INT=2]="INT",e[e.FLOAT=3]="FLOAT",e[e.FUNCTION=4]="FUNCTION",e[e.KEY=5]="KEY",e[e.KEYS=6]="KEYS",e[e.SELECT=7]="SELECT",e[e.HTML_STRING=8]="HTML_STRING",e[e.IMAGE=9]="IMAGE",e[e.AUDIO=10]="AUDIO",e[e.VIDEO=11]="VIDEO",e[e.OBJECT=12]="OBJECT",e[e.COMPLEX=13]="COMPLEX",e[e.TIMELINE=14]="TIMELINE"}(fr||(fr={}));const kr={data:{type:fr.OBJECT,pretty_name:"Data",default:{}},on_start:{type:fr.FUNCTION,pretty_name:"On start",default:function(){}},on_finish:{type:fr.FUNCTION,pretty_name:"On finish",default:function(){}},on_load:{type:fr.FUNCTION,pretty_name:"On load",default:function(){}},post_trial_gap:{type:fr.INT,pretty_name:"Post trial gap",default:null},css_classes:{type:fr.STRING,pretty_name:"Custom CSS classes",default:null},simulation_options:{type:fr.COMPLEX,default:null}},_r=[fr.AUDIO,fr.IMAGE,fr.VIDEO];class jr{constructor(e,t){this.useWebaudio=e,this.webaudioContext=t,this.video_buffers={},this.context=null,this.audio_buffers=[],this.preload_requests=[],this.img_cache={},this.preloadMap=new Map,this.microphone_recorder=null,this.camera_stream=null,this.camera_recorder=null}getVideoBuffer(e){return e.startsWith("blob:")&&(this.video_buffers[e]=e),this.video_buffers[e]}initAudio(){this.context=this.useWebaudio?this.webaudioContext:null}audioContext(){return null!==this.context&&"running"!==this.context.state&&this.context.resume(),this.context}getAudioBuffer(e){return new Promise(((t,n)=>{void 0===this.audio_buffers[e]||"tmp"==this.audio_buffers[e]?this.preloadAudio([e],(()=>{t(this.audio_buffers[e])}),(()=>{}),(e=>{n(e.error)})):t(this.audio_buffers[e])}))}preloadAudio(e,t=(()=>{}),n=(e=>{}),i=(e=>{})){e=mr(e.flat());let a=0;if(0==e.length)return void t();const o=(o,s=1)=>{const r=new XMLHttpRequest;r.open("GET",o,!0),r.responseType="arraybuffer",r.onload=()=>{this.context.decodeAudioData(r.response,(i=>{this.audio_buffers[o]=i,a++,n(o),a==e.length&&t()}),(e=>{i({source:o,error:e})}))},r.onerror=e=>{let t=e;404==r.status&&(t="404"),i({source:o,error:t})},r.onloadend=e=>{404==r.status&&i({source:o,error:"404"})},r.send(),this.preload_requests.push(r)},s=(o,s=1)=>{const r=new Audio,c=()=>{this.audio_buffers[o]=r,a++,n(o),a==e.length&&t(),r.removeEventListener("canplaythrough",c)};r.addEventListener("canplaythrough",c),r.addEventListener("error",(function e(t){i({source:r.src,error:t}),r.removeEventListener("error",e)})),r.addEventListener("abort",(function e(t){i({source:r.src,error:t}),r.removeEventListener("abort",e)})),r.src=o,this.preload_requests.push(r)};for(const i of e)void 0!==this.audio_buffers[i]?(a++,n(i),a==e.length&&t()):(this.audio_buffers[i]="tmp",null!==this.audioContext()?o(i):s(i))}preloadImages(e,t=(()=>{}),n=(e=>{}),i=(e=>{})){e=mr(e.flat());var a=0;if(0!==e.length)for(let o=0;o<e.length;o++){const s=new Image,r=e[o];s.onload=()=>{a++,n(r),a===e.length&&t()},s.onerror=e=>{i({source:r,error:e})},s.src=r,this.img_cache[r]=s,this.preload_requests.push(s)}else t()}preloadVideo(e,t=(()=>{}),n=(e=>{}),i=(e=>{})){e=mr(e.flat());let a=0;if(0!==e.length)for(const o of e){const s=this.video_buffers,r=new XMLHttpRequest;r.open("GET",o,!0),r.responseType="blob",r.onload=()=>{if(200===r.status||0===r.status){const i=r.response;s[o]=URL.createObjectURL(i),a++,n(o),a===e.length&&t()}},r.onerror=e=>{let t=e;404==r.status&&(t="404"),i({source:o,error:t})},r.onloadend=e=>{404==r.status&&i({source:o,error:"404"})},r.send(),this.preload_requests.push(r)}else t()}getAutoPreloadList(e){const t=Object.fromEntries(_r.map((e=>[e,new Set]))),n=(e,i)=>{var a,o,s,r;if(void 0!==e.timeline)for(const t of e.timeline)n(t,null!==(a=e.type)&&void 0!==a?a:i);else if(null===(s=null!==(o=e.type)&&void 0!==o?o:i)||void 0===s?void 0:s.info){const{name:n,parameters:a}=(null!==(r=e.type)&&void 0!==r?r:i).info;this.preloadMap.has(n)||this.preloadMap.set(n,Object.fromEntries(Object.entries(a).filter((([e,{type:t,preload:n}])=>_r.includes(t)&&(null==n||n))).map((([e,{type:t}])=>[e,t]))));for(const[i,a]of Object.entries(this.preloadMap.get(n))){const n=e[i],o=t[a];if("string"==typeof n)o.add(n);else if(Array.isArray(n))for(const e of n.flat())"string"==typeof e&&o.add(e)}}};return n({timeline:e}),{images:[...t[fr.IMAGE]],audio:[...t[fr.AUDIO]],video:[...t[fr.VIDEO]]}}cancelPreloads(){for(const e of this.preload_requests)e.onload=()=>{},e.onerror=()=>{},e.oncanplaythrough=()=>{},e.onabort=()=>{};this.preload_requests=[]}initializeMicrophoneRecorder(e){const t=new MediaRecorder(e);this.microphone_recorder=t}getMicrophoneRecorder(){return this.microphone_recorder}initializeCameraRecorder(e,t){this.camera_stream=e;const n=new MediaRecorder(e,t);this.camera_recorder=n}getCameraStream(){return this.camera_stream}getCameraRecorder(){return this.camera_recorder}}class Cr{constructor(e,t){this.getDisplayContainerElement=e,this.setJsPsychTimeout=t}dispatchEvent(e){this.getDisplayContainerElement().dispatchEvent(e)}keyDown(e){this.dispatchEvent(new KeyboardEvent("keydown",{key:e}))}keyUp(e){this.dispatchEvent(new KeyboardEvent("keyup",{key:e}))}pressKey(e,t=0){t>0?this.setJsPsychTimeout((()=>{this.keyDown(e),this.keyUp(e)}),t):(this.keyDown(e),this.keyUp(e))}clickTarget(e,t=0){t>0?this.setJsPsychTimeout((()=>{e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0})),e.dispatchEvent(new MouseEvent("click",{bubbles:!0}))}),t):(e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0})),e.dispatchEvent(new MouseEvent("click",{bubbles:!0})))}fillTextInput(e,t,n=0){n>0?this.setJsPsychTimeout((()=>{e.value=t}),n):e.value=t}getValidKey(e){const t=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"," "];let n;if("NO_KEYS"==e)n=null;else if("ALL_KEYS"==e)n=t[Math.floor(Math.random()*t.length)];else{const t=e.flat();n=t[Math.floor(Math.random()*t.length)]}return n}mergeSimulationData(e,t){return Object.assign(Object.assign({},e),null==t?void 0:t.data)}ensureSimulationDataConsistency(e,t){if(t.rt&&(t.rt=Math.round(t.rt)),e.trial_duration&&t.rt&&t.rt>e.trial_duration&&(t.rt=null,t.response&&(t.response=null),t.correct&&(t.correct=!1)),e.choices&&"NO_KEYS"==e.choices&&(t.rt&&(t.rt=null),t.response&&(t.response=null)),e.allow_response_before_complete&&e.sequence_reps&&e.frame_time){const n=e.sequence_reps*e.frame_time*e.stimuli.length;t.rt<n&&(t.rt=null,t.response=null)}}}class Sr{constructor(){this.timeout_handlers=[]}setTimeout(e,t){const n=window.setTimeout(e,t);return this.timeout_handlers.push(n),n}clearAllTimeouts(){for(const e of this.timeout_handlers)clearTimeout(e);this.timeout_handlers=[]}}var Er={exports:{}};!function(e,t,n){function i(e){var t=this,n=function(){var e=4022871197,t=function(t){t=String(t);for(var n=0;n<t.length;n++){var i=.02519603282416938*(e+=t.charCodeAt(n));i-=e=i>>>0,e=(i*=e)>>>0,e+=4294967296*(i-=e)}return 2.3283064365386963e-10*(e>>>0)};return t}();t.next=function(){var e=2091639*t.s0+2.3283064365386963e-10*t.c;return t.s0=t.s1,t.s1=t.s2,t.s2=e-(t.c=0|e)},t.c=1,t.s0=n(" "),t.s1=n(" "),t.s2=n(" "),t.s0-=n(e),t.s0<0&&(t.s0+=1),t.s1-=n(e),t.s1<0&&(t.s1+=1),t.s2-=n(e),t.s2<0&&(t.s2+=1),n=null}function a(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function o(e,t){var n=new i(e),o=t&&t.state,s=n.next;return s.int32=function(){return 4294967296*n.next()|0},s.double=function(){return s()+11102230246251565e-32*(2097152*s()|0)},s.quick=s,o&&("object"==typeof o&&a(o,n),s.state=function(){return a(n,{})}),s}t&&t.exports?t.exports=o:n&&n.amd?n((function(){return o})):this.alea=o}(0,Er,!1);var Tr=Er.exports,Mr=pr(Tr),Or={exports:{}};!function(e,t,n){function i(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var i=0;i<n.length+64;i++)t.x^=0|n.charCodeAt(i),t.next()}function a(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t}function o(e,t){var n=new i(e),o=t&&t.state,s=function(){return(n.next()>>>0)/4294967296};return s.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},s.int32=n.next,s.quick=s,o&&("object"==typeof o&&a(o,n),s.state=function(){return a(n,{})}),s}t&&t.exports?t.exports=o:n&&n.amd?n((function(){return o})):this.xor128=o}(0,Or,!1);var Ar=Or.exports,Ir={exports:{}};!function(e,t,n){function i(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var i=0;i<n.length+64;i++)t.x^=0|n.charCodeAt(i),i==n.length&&(t.d=t.x<<10^t.x>>>4),t.next()}function a(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function o(e,t){var n=new i(e),o=t&&t.state,s=function(){return(n.next()>>>0)/4294967296};return s.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},s.int32=n.next,s.quick=s,o&&("object"==typeof o&&a(o,n),s.state=function(){return a(n,{})}),s}t&&t.exports?t.exports=o:n&&n.amd?n((function(){return o})):this.xorwow=o}(0,Ir,!1);var Pr=Ir.exports,Rr={exports:{}};!function(e,t,n){function i(e){var t=this;t.next=function(){var e,n,i=t.x,a=t.i;return e=i[a],n=(e^=e>>>7)^e<<24,n^=(e=i[a+1&7])^e>>>10,n^=(e=i[a+3&7])^e>>>3,n^=(e=i[a+4&7])^e<<7,e=i[a+7&7],n^=(e^=e<<13)^e<<9,i[a]=n,t.i=a+1&7,n},function(e,t){var n,i=[];if(t===(0|t))i[0]=t;else for(t=""+t,n=0;n<t.length;++n)i[7&n]=i[7&n]<<15^t.charCodeAt(n)+i[n+1&7]<<13;for(;i.length<8;)i.push(0);for(n=0;n<8&&0===i[n];++n);for(8==n?i[7]=-1:i[n],e.x=i,e.i=0,n=256;n>0;--n)e.next()}(t,e)}function a(e,t){return t.x=e.x.slice(),t.i=e.i,t}function o(e,t){null==e&&(e=+new Date);var n=new i(e),o=t&&t.state,s=function(){return(n.next()>>>0)/4294967296};return s.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},s.int32=n.next,s.quick=s,o&&(o.x&&a(o,n),s.state=function(){return a(n,{})}),s}t&&t.exports?t.exports=o:n&&n.amd?n((function(){return o})):this.xorshift7=o}(0,Rr,!1);var Lr=Rr.exports,Nr={exports:{}};!function(e,t,n){function i(e){var t=this;t.next=function(){var e,n,i=t.w,a=t.X,o=t.i;return t.w=i=i+1640531527|0,n=a[o+34&127],e=a[o=o+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=a[o]=n^e,t.i=o,n+(i^i>>>16)|0},function(e,t){var n,i,a,o,s,r=[],c=128;for(t===(0|t)?(i=t,t=null):(t+="\0",i=0,c=Math.max(c,t.length)),a=0,o=-32;o<c;++o)t&&(i^=t.charCodeAt((o+32)%t.length)),0===o&&(s=i),i^=i<<10,i^=i>>>15,i^=i<<4,i^=i>>>13,o>=0&&(s=s+1640531527|0,a=0==(n=r[127&o]^=i+s)?a+1:0);for(a>=128&&(r[127&(t&&t.length||0)]=-1),a=127,o=512;o>0;--o)i=r[a+34&127],n=r[a=a+1&127],i^=i<<13,n^=n<<17,i^=i>>>15,n^=n>>>12,r[a]=i^n;e.w=s,e.X=r,e.i=a}(t,e)}function a(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function o(e,t){null==e&&(e=+new Date);var n=new i(e),o=t&&t.state,s=function(){return(n.next()>>>0)/4294967296};return s.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},s.int32=n.next,s.quick=s,o&&(o.X&&a(o,n),s.state=function(){return a(n,{})}),s}t&&t.exports?t.exports=o:n&&n.amd?n((function(){return o})):this.xor4096=o}(0,Nr,!1);var Dr=Nr.exports,qr={exports:{}};!function(e,t,n){function i(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,i=t.d,a=t.a;return e=e<<25^e>>>7^n,n=n-i|0,i=i<<24^i>>>8^a,a=a-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-i|0,t.d=i<<16^n>>>16^a,t.a=a-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var i=0;i<n.length+20;i++)t.b^=0|n.charCodeAt(i),t.next()}function a(e,t){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t}function o(e,t){var n=new i(e),o=t&&t.state,s=function(){return(n.next()>>>0)/4294967296};return s.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},s.int32=n.next,s.quick=s,o&&("object"==typeof o&&a(o,n),s.state=function(){return a(n,{})}),s}t&&t.exports?t.exports=o:n&&n.amd?n((function(){return o})):this.tychei=o}(0,qr,!1);var Fr=qr.exports,zr={exports:{}};!function(e){!function(t,n,i){var a,o=256,s="random",r=i.pow(o,6),c=i.pow(2,52),l=2*c,p=o-1;function u(e,p,u){var v=[],b=f(h((p=1==p?{entropy:!0}:p||{}).entropy?[e,g(n)]:null==e?function(){try{var e;return a&&(e=a.randomBytes)?e=e(o):(e=new Uint8Array(o),(t.crypto||t.msCrypto).getRandomValues(e)),g(e)}catch(e){var i=t.navigator,s=i&&i.plugins;return[+new Date,t,s,t.screen,g(n)]}}():e,3),v),x=new d(v),y=function(){for(var e=x.g(6),t=r,n=0;e<c;)e=(e+n)*o,t*=o,n=x.g(1);for(;e>=l;)e/=2,t/=2,n>>>=1;return(e+n)/t};return y.int32=function(){return 0|x.g(4)},y.quick=function(){return x.g(4)/4294967296},y.double=y,f(g(x.S),n),(p.pass||u||function(e,t,n,a){return a&&(a.S&&m(a,x),e.state=function(){return m(x,{})}),n?(i[s]=e,t):e})(y,b,"global"in p?p.global:this==i,p.state)}function d(e){var t,n=e.length,i=this,a=0,s=i.i=i.j=0,r=i.S=[];for(n||(e=[n++]);a<o;)r[a]=a++;for(a=0;a<o;a++)r[a]=r[s=p&s+e[a%n]+(t=r[a])],r[s]=t;(i.g=function(e){for(var t,n=0,a=i.i,s=i.j,r=i.S;e--;)t=r[a=p&a+1],n=n*o+r[p&(r[a]=r[s=p&s+t])+(r[s]=t)];return i.i=a,i.j=s,n})(o)}function m(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function h(e,t){var n,i=[],a=typeof e;if(t&&"object"==a)for(n in e)try{i.push(h(e[n],t-1))}catch(e){}return i.length?i:"string"==a?e:e+"\0"}function f(e,t){for(var n,i=e+"",a=0;a<i.length;)t[p&a]=p&(n^=19*t[p&a])+i.charCodeAt(a++);return g(t)}function g(e){return String.fromCharCode.apply(0,e)}if(f(i.random(),n),e.exports){e.exports=u;try{a=require("crypto")}catch(e){}}else i["seed"+s]=u}("undefined"!=typeof self?self:lr,[],Math)}(zr);var Vr=Tr,Br=Ar,Ur=Pr,Hr=Lr,Wr=Dr,$r=Fr,Kr=zr.exports;Kr.alea=Vr,Kr.xor128=Br,Kr.xorwow=Ur,Kr.xorshift7=Hr,Kr.xor4096=Wr,Kr.tychei=$r;var Yr=Kr,Xr=["ability","able","aboard","about","above","accept","accident","according","account","accurate","acres","across","act","action","active","activity","actual","actually","add","addition","additional","adjective","adult","adventure","advice","affect","afraid","after","afternoon","again","against","age","ago","agree","ahead","aid","air","airplane","alike","alive","all","allow","almost","alone","along","aloud","alphabet","already","also","although","am","among","amount","ancient","angle","angry","animal","announced","another","answer","ants","any","anybody","anyone","anything","anyway","anywhere","apart","apartment","appearance","apple","applied","appropriate","are","area","arm","army","around","arrange","arrangement","arrive","arrow","art","article","as","aside","ask","asleep","at","ate","atmosphere","atom","atomic","attached","attack","attempt","attention","audience","author","automobile","available","average","avoid","aware","away","baby","back","bad","badly","bag","balance","ball","balloon","band","bank","bar","bare","bark","barn","base","baseball","basic","basis","basket","bat","battle","be","bean","bear","beat","beautiful","beauty","became","because","become","becoming","bee","been","before","began","beginning","begun","behavior","behind","being","believed","bell","belong","below","belt","bend","beneath","bent","beside","best","bet","better","between","beyond","bicycle","bigger","biggest","bill","birds","birth","birthday","bit","bite","black","blank","blanket","blew","blind","block","blood","blow","blue","board","boat","body","bone","book","border","born","both","bottle","bottom","bound","bow","bowl","box","boy","brain","branch","brass","brave","bread","break","breakfast","breath","breathe","breathing","breeze","brick","bridge","brief","bright","bring","broad","broke","broken","brother","brought","brown","brush","buffalo","build","building","built","buried","burn","burst","bus","bush","business","busy","but","butter","buy","by","cabin","cage","cake","call","calm","came","camera","camp","can","canal","cannot","cap","capital","captain","captured","car","carbon","card","care","careful","carefully","carried","carry","case","cast","castle","cat","catch","cattle","caught","cause","cave","cell","cent","center","central","century","certain","certainly","chain","chair","chamber","chance","change","changing","chapter","character","characteristic","charge","chart","check","cheese","chemical","chest","chicken","chief","child","children","choice","choose","chose","chosen","church","circle","circus","citizen","city","class","classroom","claws","clay","clean","clear","clearly","climate","climb","clock","close","closely","closer","cloth","clothes","clothing","cloud","club","coach","coal","coast","coat","coffee","cold","collect","college","colony","color","column","combination","combine","come","comfortable","coming","command","common","community","company","compare","compass","complete","completely","complex","composed","composition","compound","concerned","condition","congress","connected","consider","consist","consonant","constantly","construction","contain","continent","continued","contrast","control","conversation","cook","cookies","cool","copper","copy","corn","corner","correct","correctly","cost","cotton","could","count","country","couple","courage","course","court","cover","cow","cowboy","crack","cream","create","creature","crew","crop","cross","crowd","cry","cup","curious","current","curve","customs","cut","cutting","daily","damage","dance","danger","dangerous","dark","darkness","date","daughter","dawn","day","dead","deal","dear","death","decide","declared","deep","deeply","deer","definition","degree","depend","depth","describe","desert","design","desk","detail","determine","develop","development","diagram","diameter","did","die","differ","difference","different","difficult","difficulty","dig","dinner","direct","direction","directly","dirt","dirty","disappear","discover","discovery","discuss","discussion","disease","dish","distance","distant","divide","division","do","doctor","does","dog","doing","doll","dollar","done","donkey","door","dot","double","doubt","down","dozen","draw","drawn","dream","dress","drew","dried","drink","drive","driven","driver","driving","drop","dropped","drove","dry","duck","due","dug","dull","during","dust","duty","each","eager","ear","earlier","early","earn","earth","easier","easily","east","easy","eat","eaten","edge","education","effect","effort","egg","eight","either","electric","electricity","element","elephant","eleven","else","empty","end","enemy","energy","engine","engineer","enjoy","enough","enter","entire","entirely","environment","equal","equally","equator","equipment","escape","especially","essential","establish","even","evening","event","eventually","ever","every","everybody","everyone","everything","everywhere","evidence","exact","exactly","examine","example","excellent","except","exchange","excited","excitement","exciting","exclaimed","exercise","exist","expect","experience","experiment","explain","explanation","explore","express","expression","extra","eye","face","facing","fact","factor","factory","failed","fair","fairly","fall","fallen","familiar","family","famous","far","farm","farmer","farther","fast","fastened","faster","fat","father","favorite","fear","feathers","feature","fed","feed","feel","feet","fell","fellow","felt","fence","few","fewer","field","fierce","fifteen","fifth","fifty","fight","fighting","figure","fill","film","final","finally","find","fine","finest","finger","finish","fire","fireplace","firm","first","fish","five","fix","flag","flame","flat","flew","flies","flight","floating","floor","flow","flower","fly","fog","folks","follow","food","foot","football","for","force","foreign","forest","forget","forgot","forgotten","form","former","fort","forth","forty","forward","fought","found","four","fourth","fox","frame","free","freedom","frequently","fresh","friend","friendly","frighten","frog","from","front","frozen","fruit","fuel","full","fully","fun","function","funny","fur","furniture","further","future","gain","game","garage","garden","gas","gasoline","gate","gather","gave","general","generally","gentle","gently","get","getting","giant","gift","girl","give","given","giving","glad","glass","globe","go","goes","gold","golden","gone","good","goose","got","government","grabbed","grade","gradually","grain","grandfather","grandmother","graph","grass","gravity","gray","great","greater","greatest","greatly","green","grew","ground","group","grow","grown","growth","guard","guess","guide","gulf","gun","habit","had","hair","half","halfway","hall","hand","handle","handsome","hang","happen","happened","happily","happy","harbor","hard","harder","hardly","has","hat","have","having","hay","he","headed","heading","health","heard","hearing","heart","heat","heavy","height","held","hello","help","helpful","her","herd","here","herself","hidden","hide","high","higher","highest","highway","hill","him","himself","his","history","hit","hold","hole","hollow","home","honor","hope","horn","horse","hospital","hot","hour","house","how","however","huge","human","hundred","hung","hungry","hunt","hunter","hurried","hurry","hurt","husband","ice","idea","identity","if","ill","image","imagine","immediately","importance","important","impossible","improve","in","inch","include","including","income","increase","indeed","independent","indicate","individual","industrial","industry","influence","information","inside","instance","instant","instead","instrument","interest","interior","into","introduced","invented","involved","iron","is","island","it","its","itself","jack","jar","jet","job","join","joined","journey","joy","judge","jump","jungle","just","keep","kept","key","kids","kill","kind","kitchen","knew","knife","know","knowledge","known","label","labor","lack","lady","laid","lake","lamp","land","language","large","larger","largest","last","late","later","laugh","law","lay","layers","lead","leader","leaf","learn","least","leather","leave","leaving","led","left","leg","length","lesson","let","letter","level","library","lie","life","lift","light","like","likely","limited","line","lion","lips","liquid","list","listen","little","live","living","load","local","locate","location","log","lonely","long","longer","look","loose","lose","loss","lost","lot","loud","love","lovely","low","lower","luck","lucky","lunch","lungs","lying","machine","machinery","mad","made","magic","magnet","mail","main","mainly","major","make","making","man","managed","manner","manufacturing","many","map","mark","market","married","mass","massage","master","material","mathematics","matter","may","maybe","me","meal","mean","means","meant","measure","meat","medicine","meet","melted","member","memory","men","mental","merely","met","metal","method","mice","middle","might","mighty","mile","military","milk","mill","mind","mine","minerals","minute","mirror","missing","mission","mistake","mix","mixture","model","modern","molecular","moment","money","monkey","month","mood","moon","more","morning","most","mostly","mother","motion","motor","mountain","mouse","mouth","move","movement","movie","moving","mud","muscle","music","musical","must","my","myself","mysterious","nails","name","nation","national","native","natural","naturally","nature","near","nearby","nearer","nearest","nearly","necessary","neck","needed","needle","needs","negative","neighbor","neighborhood","nervous","nest","never","new","news","newspaper","next","nice","night","nine","no","nobody","nodded","noise","none","noon","nor","north","nose","not","note","noted","nothing","notice","noun","now","number","numeral","nuts","object","observe","obtain","occasionally","occur","ocean","of","off","offer","office","officer","official","oil","old","older","oldest","on","once","one","only","onto","open","operation","opinion","opportunity","opposite","or","orange","orbit","order","ordinary","organization","organized","origin","original","other","ought","our","ourselves","out","outer","outline","outside","over","own","owner","oxygen","pack","package","page","paid","pain","paint","pair","palace","pale","pan","paper","paragraph","parallel","parent","park","part","particles","particular","particularly","partly","parts","party","pass","passage","past","path","pattern","pay","peace","pen","pencil","people","per","percent","perfect","perfectly","perhaps","period","person","personal","pet","phrase","physical","piano","pick","picture","pictured","pie","piece","pig","pile","pilot","pine","pink","pipe","pitch","place","plain","plan","plane","planet","planned","planning","plant","plastic","plate","plates","play","pleasant","please","pleasure","plenty","plural","plus","pocket","poem","poet","poetry","point","pole","police","policeman","political","pond","pony","pool","poor","popular","population","porch","port","position","positive","possible","possibly","post","pot","potatoes","pound","pour","powder","power","powerful","practical","practice","prepare","present","president","press","pressure","pretty","prevent","previous","price","pride","primitive","principal","principle","printed","private","prize","probably","problem","process","produce","product","production","program","progress","promised","proper","properly","property","protection","proud","prove","provide","public","pull","pupil","pure","purple","purpose","push","put","putting","quarter","queen","question","quick","quickly","quiet","quietly","quite","rabbit","race","radio","railroad","rain","raise","ran","ranch","range","rapidly","rate","rather","raw","rays","reach","read","reader","ready","real","realize","rear","reason","recall","receive","recent","recently","recognize","record","red","refer","refused","region","regular","related","relationship","religious","remain","remarkable","remember","remove","repeat","replace","replied","report","represent","require","research","respect","rest","result","return","review","rhyme","rhythm","rice","rich","ride","riding","right","ring","rise","rising","river","road","roar","rock","rocket","rocky","rod","roll","roof","room","root","rope","rose","rough","round","route","row","rubbed","rubber","rule","ruler","run","running","rush","sad","saddle","safe","safety","said","sail","sale","salmon","salt","same","sand","sang","sat","satellites","satisfied","save","saved","saw","say","scale","scared","scene","school","science","scientific","scientist","score","screen","sea","search","season","seat","second","secret","section","see","seed","seeing","seems","seen","seldom","select","selection","sell","send","sense","sent","sentence","separate","series","serious","serve","service","sets","setting","settle","settlers","seven","several","shade","shadow","shake","shaking","shall","shallow","shape","share","sharp","she","sheep","sheet","shelf","shells","shelter","shine","shinning","ship","shirt","shoe","shoot","shop","shore","short","shorter","shot","should","shoulder","shout","show","shown","shut","sick","sides","sight","sign","signal","silence","silent","silk","silly","silver","similar","simple","simplest","simply","since","sing","single","sink","sister","sit","sitting","situation","six","size","skill","skin","sky","slabs","slave","sleep","slept","slide","slight","slightly","slip","slipped","slope","slow","slowly","small","smaller","smallest","smell","smile","smoke","smooth","snake","snow","so","soap","social","society","soft","softly","soil","solar","sold","soldier","solid","solution","solve","some","somebody","somehow","someone","something","sometime","somewhere","son","song","soon","sort","sound","source","south","southern","space","speak","special","species","specific","speech","speed","spell","spend","spent","spider","spin","spirit","spite","split","spoken","sport","spread","spring","square","stage","stairs","stand","standard","star","stared","start","state","statement","station","stay","steady","steam","steel","steep","stems","step","stepped","stick","stiff","still","stock","stomach","stone","stood","stop","stopped","store","storm","story","stove","straight","strange","stranger","straw","stream","street","strength","stretch","strike","string","strip","strong","stronger","struck","structure","struggle","stuck","student","studied","studying","subject","substance","success","successful","such","sudden","suddenly","sugar","suggest","suit","sum","summer","sun","sunlight","supper","supply","support","suppose","sure","surface","surprise","surrounded","swam","sweet","swept","swim","swimming","swing","swung","syllable","symbol","system","table","tail","take","taken","tales","talk","tall","tank","tape","task","taste","taught","tax","tea","teach","teacher","team","tears","teeth","telephone","television","tell","temperature","ten","tent","term","terrible","test","than","thank","that","thee","them","themselves","then","theory","there","therefore","these","they","thick","thin","thing","think","third","thirty","this","those","thou","though","thought","thousand","thread","three","threw","throat","through","throughout","throw","thrown","thumb","thus","thy","tide","tie","tight","tightly","till","time","tin","tiny","tip","tired","title","to","tobacco","today","together","told","tomorrow","tone","tongue","tonight","too","took","tool","top","topic","torn","total","touch","toward","tower","town","toy","trace","track","trade","traffic","trail","train","transportation","trap","travel","treated","tree","triangle","tribe","trick","tried","trip","troops","tropical","trouble","truck","trunk","truth","try","tube","tune","turn","twelve","twenty","twice","two","type","typical","uncle","under","underline","understanding","unhappy","union","unit","universe","unknown","unless","until","unusual","up","upon","upper","upward","us","use","useful","using","usual","usually","valley","valuable","value","vapor","variety","various","vast","vegetable","verb","vertical","very","vessels","victory","view","village","visit","visitor","voice","volume","vote","vowel","voyage","wagon","wait","walk","wall","want","war","warm","warn","was","wash","waste","watch","water","wave","way","we","weak","wealth","wear","weather","week","weigh","weight","welcome","well","went","were","west","western","wet","whale","what","whatever","wheat","wheel","when","whenever","where","wherever","whether","which","while","whispered","whistle","white","who","whole","whom","whose","why","wide","widely","wife","wild","will","willing","win","wind","window","wing","winter","wire","wise","wish","with","within","without","wolf","women","won","wonder","wonderful","wood","wooden","wool","word","wore","work","worker","world","worried","worry","worse","worth","would","wrapped","write","writer","writing","written","wrong","wrote","yard","year","yellow","yes","yesterday","yet","you","young","younger","your","yourself","youth","zero","zebra","zipper","zoo","zulu"];function Gr(e){const t=e?.seed?new Yr(e.seed):null;function n(){return e&&e.maxLength>1?function(){var t,n=!1;for(;!n;)(t=i()).length<=e.maxLength&&(n=!0);return t}():i()}function i(){return Xr[a(Xr.length)]}function a(e){const n=t?t():Math.random();return Math.floor(n*e)}if(void 0===e)return n();"number"==typeof e&&(e={exactly:e}),e.exactly&&(e.min=e.exactly,e.max=e.exactly),"number"!=typeof e.wordsPerString&&(e.wordsPerString=1),"function"!=typeof e.formatter&&(e.formatter=e=>e),"string"!=typeof e.separator&&(e.separator=" ");for(var o=e.min+a(e.max+1-e.min),s=[],r="",c=0,l=0;l<o*e.wordsPerString;l++)c===e.wordsPerString-1?r+=e.formatter(n(),c):r+=e.formatter(n(),c)+e.separator,c++,(l+1)%e.wordsPerString==0&&(s.push(r),r="",c=0);return"string"==typeof e.join&&(s=s.join(e.join)),s}var Jr=Gr;Gr.wordList=Xr;var Qr=pr(Jr);function Zr(e,t,n=!1){const i=Array.isArray(e),a=Array.isArray(t);if(i)if(a){if(e.length!=t.length)if(console.warn("Unclear parameters given to randomization.repeat. Items and repetitions are unequal lengths. Behavior may not be as expected."),t.length<e.length){let n=[];for(let i=0;i<e.length;i++)n.push(t);t=n}else t=t.slice(0,e.length)}else{let n=[];for(let i=0;i<e.length;i++)n.push(t);t=n}else a?(t=[t[0]],console.log("Unclear parameters given to randomization.repeat. Multiple set sizes specified, but only one item exists to sample. Proceeding using the first set size.")):(e=[e],t=[t]);let o=[];for(let n=0;n<e.length;n++)for(let i=0;i<t[n];i++)null==e[n]||"object"!=typeof e[n]?o.push(e[n]):o.push(Object.assign({},e[n]));let s=ec(o);return n&&(s=function(e){const t={};for(const n of e)for(const e of Object.keys(n))void 0===t[e]&&(t[e]=[]),t[e].push(n[e]);return t}(s)),s}function ec(e){Array.isArray(e)||console.error("Argument to shuffle() must be an array.");const t=e.slice(0);let n,i,a=t.length;for(;a;)i=Math.floor(Math.random()*a--),n=t[a],t[a]=t[i],t[i]=n;return t}function tc(e,t=!1){const n=e.length;if(1==n)return console.warn("shuffleAlternateGroups() was called with only one group. Defaulting to simple shuffle."),ec(e[0]);let i=[];for(let e=0;e<n;e++)i.push(e);t&&(i=ec(i));const a=[];let o=null;for(let t=0;t<n;t++)o=null===o?e[t].length:Math.min(o,e[t].length),a.push(ec(e[t]));const s=[];for(let e=0;e<o;e++)for(let t=0;t<i.length;t++)s.push(a[i[t]][e]);return s}function nc(e,t){return Array.isArray(e)||console.error("First argument to sampleWithoutReplacement() must be an array"),t>e.length&&console.error("Cannot take a sample larger than the size of the set of items to sample."),ec(e).slice(0,t)}function ic(e,t,n){Array.isArray(e)||console.error("First argument to sampleWithReplacement() must be an array");const i=[];if(void 0!==n){n.length!==e.length&&console.error("The length of the weights array must equal the length of the array to be sampled from.");let t=0;for(const e of n)t+=e;for(const e of n)i.push(e/t)}else for(let t=0;t<e.length;t++)i.push(1/e.length);const a=[i[0]];for(let e=1;e<i.length;e++)a.push(i[e]+a[e-1]);const o=[];for(let n=0;n<t;n++){const t=Math.random();let n=0;for(;t>a[n];)n++;o.push(e[n])}return o}function ac(e,t){return function(){var e=0,t=0;for(;0===e;)e=Math.random();for(;0===t;)t=Math.random();return Math.sqrt(-2*Math.log(e))*Math.cos(2*Math.PI*t)}()*t+e}function oc(e){return-Math.log(Math.random())/e}var sc=Object.freeze({__proto__:null,factorial:function(e,t=1,n=!1){let i=[{}];for(const[t,n]of Object.entries(e)){const e=[];for(const a of n)for(const n of i)e.push(Object.assign(Object.assign({},n),{[t]:a}));i=e}return Zr(i,t,n)},randomID:function(e=32){let t="";const n="0123456789abcdefghjklmnopqrstuvwxyz";for(let i=0;i<e;i++)t+=n[Math.floor(35*Math.random())];return t},randomInt:function(e,t){if(t<e)throw new Error("Upper boundary must be less than or equal to lower boundary");return e+Math.floor(Math.random()*(t-e+1))},randomWords:function(e){return Qr(e)},repeat:Zr,sampleBernoulli:function(e){return Math.random()<=e?1:0},sampleExGaussian:function(e,t,n,i=!1){let a=ac(e,t)+oc(n);if(i)for(;a<=0;)a=ac(e,t)+oc(n);return a},sampleExponential:oc,sampleNormal:ac,sampleWithReplacement:ic,sampleWithoutReplacement:nc,setSeed:function(e=Math.random().toString()){return Math.random=Mr(e),e},shuffle:ec,shuffleAlternateGroups:tc,shuffleNoRepeats:function(e,t){Array.isArray(e)||console.error("First argument to shuffleNoRepeats() must be an array."),void 0!==t&&"function"!=typeof t&&console.error("Second argument to shuffleNoRepeats() must be a function."),void 0===t&&(t=function(e,t){return e===t});const n=ec(e);for(let e=0;e<n.length-1;e++)if(t(n[e],n[e+1])){let i=Math.floor(Math.random()*(n.length-2))+1;for(;t(n[e+1],n[i])||t(n[e+1],n[i+1])||t(n[e+1],n[i-1])||t(n[e],n[i]);)i=Math.floor(Math.random()*(n.length-2))+1;const a=n[i];n[i]=n[e+1],n[e+1]=a}return n}});function rc(){const e={previewMode:!1,outsideTurk:!1,hitId:"INVALID_URL_PARAMETER",assignmentId:"INVALID_URL_PARAMETER",workerId:"INVALID_URL_PARAMETER",turkSubmitTo:"INVALID_URL_PARAMETER"},t=function(e,t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");const n=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);return null==n?"":n[1]},n=t(window.location.href,"assignmentId")?window.location.href:document.referrer;return["assignmentId","hitId","workerId","turkSubmitTo"].map((function(i){e[i]=unescape(t(n,i))})),e.previewMode="ASSIGNMENT_ID_NOT_AVAILABLE"==e.assignmentId,e.outsideTurk=!e.previewMode&&""===e.hitId&&""==e.assignmentId&&""==e.workerId,e}var cc=Object.freeze({__proto__:null,submitToTurk:function(e){const t=rc(),n=t.assignmentId,i=t.turkSubmitTo;if(!n||!i)return;const a=document.createElement("form");a.method="POST",a.action=i+"/mturk/externalSubmit?assignmentId="+n;for(const t in e)if(e.hasOwnProperty(t)){const n=document.createElement("input");n.type="hidden",n.name=t,n.id=t,n.value=e[t],a.appendChild(n)}document.body.appendChild(a),a.submit()},turkInfo:rc});class lc{constructor(e,t,n,i){if(this.jsPsych=e,this.progress={current_location:-1,current_variable_set:0,current_repetition:0,current_iteration:0,done:!1},this.parent_node=n,this.relative_id=void 0===n?0:i,void 0!==t.timeline){this.timeline_parameters={timeline:[],loop_function:t.loop_function,conditional_function:t.conditional_function,sample:t.sample,randomize_order:void 0!==t.randomize_order&&t.randomize_order,repetitions:void 0===t.repetitions?1:t.repetitions,timeline_variables:void 0===t.timeline_variables?[{}]:t.timeline_variables,on_timeline_finish:t.on_timeline_finish,on_timeline_start:t.on_timeline_start},this.setTimelineVariablesOrder();var a=Object.assign({},t);delete a.timeline,delete a.conditional_function,delete a.loop_function,delete a.randomize_order,delete a.repetitions,delete a.timeline_variables,delete a.sample,delete a.on_timeline_start,delete a.on_timeline_finish,this.node_trial_data=a;for(var o=0;o<t.timeline.length;o++){var s=Object.assign({},a,t.timeline[o]);if("object"==typeof a.data&&"object"==typeof t.timeline[o].data){var r=Object.assign({},a.data,t.timeline[o].data);s.data=r}this.timeline_parameters.timeline.push(new lc(this.jsPsych,s,this,o))}}else void 0===t.type&&console.error('Trial level node is missing the "type" parameter. The parameters for the node are: '+JSON.stringify(t)),this.trial_parameters=Object.assign({},t)}trial(){return void 0===this.timeline_parameters?hr(this.trial_parameters):this.progress.current_location>=this.timeline_parameters.timeline.length?null:this.timeline_parameters.timeline[this.progress.current_location].trial()}markCurrentTrialComplete(){void 0===this.timeline_parameters?this.progress.done=!0:this.timeline_parameters.timeline[this.progress.current_location].markCurrentTrialComplete()}nextRepetiton(){this.setTimelineVariablesOrder(),this.progress.current_location=-1,this.progress.current_variable_set=0,this.progress.current_repetition++;for(var e=0;e<this.timeline_parameters.timeline.length;e++)this.timeline_parameters.timeline[e].reset()}setTimelineVariablesOrder(){const e=this.timeline_parameters;if(void 0!==e&&void 0!==e.timeline_variables){for(var t=[],n=0;n<e.timeline_variables.length;n++)t.push(n);void 0!==e.sample&&("custom"==e.sample.type?t=e.sample.fn(t):"with-replacement"==e.sample.type?t=ic(t,e.sample.size,e.sample.weights):"without-replacement"==e.sample.type?t=nc(t,e.sample.size):"fixed-repetitions"==e.sample.type?t=Zr(t,e.sample.size,!1):"alternate-groups"==e.sample.type?t=tc(e.sample.groups,e.sample.randomize_group_order):console.error('Invalid type in timeline sample parameters. Valid options for type are "custom", "with-replacement", "without-replacement", "fixed-repetitions", and "alternate-groups"')),e.randomize_order&&(t=ec(t)),this.progress.order=t}}nextSet(){this.progress.current_location=-1,this.progress.current_variable_set++;for(var e=0;e<this.timeline_parameters.timeline.length;e++)this.timeline_parameters.timeline[e].reset()}advance(){const e=this.progress,t=this.timeline_parameters,n=this.jsPsych.internal;if(e.done)return!0;if(-1==e.current_location){if(void 0!==t){if(void 0!==t.conditional_function&&0==e.current_repetition&&0==e.current_variable_set){n.call_immediate=!0;var i=t.conditional_function();if(n.call_immediate=!1,0==i)return e.done=!0,!0}void 0!==t.on_timeline_start&&0==e.current_variable_set&&t.on_timeline_start()}return e.current_location=0,this.advance()}if(void 0!==t){for(var a=!1;e.current_location<t.timeline.length&&0==a;){if(!t.timeline[e.current_location].advance())return a=!0,!1;e.current_location++}return e.current_variable_set<e.order.length-1?(this.nextSet(),this.advance()):e.current_repetition<t.repetitions-1?(this.nextRepetiton(),void 0!==t.on_timeline_finish&&t.on_timeline_finish(),this.advance()):(void 0!==t.on_timeline_finish&&t.on_timeline_finish(),void 0!==t.loop_function?(n.call_immediate=!0,t.loop_function(this.generatedData())?(this.reset(),n.call_immediate=!1,this.parent_node.advance()):(e.done=!0,n.call_immediate=!1,!0)):(e.done=!0,!0))}}isComplete(){return this.progress.done}getTimelineVariableValue(e){if(void 0!==this.timeline_parameters)return this.timeline_parameters.timeline_variables[this.progress.order[this.progress.current_variable_set]][e]}findTimelineVariable(e){var t=this.getTimelineVariableValue(e);return void 0===t?void 0!==this.parent_node?this.parent_node.findTimelineVariable(e):void 0:t}timelineVariable(e){if(void 0===this.timeline_parameters){const t=this.findTimelineVariable(e);return void 0===t&&console.warn("Timeline variable "+e+" not found."),t}{var t=Math.max(0,this.progress.current_location);t==this.timeline_parameters.timeline.length&&(t-=1);const n=this.timeline_parameters.timeline[t].timelineVariable(e);return void 0===n&&console.warn("Timeline variable "+e+" not found."),n}}allTimelineVariables(){for(var e=this.allTimelineVariablesNames(),t={},n=0;n<e.length;n++)t[e[n]]=this.timelineVariable(e[n]);return t}allTimelineVariablesNames(e=[]){if(void 0!==this.timeline_parameters){e=e.concat(Object.keys(this.timeline_parameters.timeline_variables[this.progress.order[this.progress.current_variable_set]]));var t=Math.max(0,this.progress.current_location);return t==this.timeline_parameters.timeline.length&&(t-=1),this.timeline_parameters.timeline[t].allTimelineVariablesNames(e)}if(void 0===this.timeline_parameters)return e}length(){var e=0;if(void 0===this.timeline_parameters)return 1;for(var t=0;t<this.timeline_parameters.timeline.length;t++)e+=this.timeline_parameters.timeline[t].length();return e}percentComplete(){for(var e=this.length(),t=0,n=0;n<this.timeline_parameters.timeline.length;n++)this.timeline_parameters.timeline[n].isComplete()&&(t+=this.timeline_parameters.timeline[n].length());return t/e*100}reset(){if(this.progress.current_location=-1,this.progress.current_repetition=0,this.progress.current_variable_set=0,this.progress.current_iteration++,this.progress.done=!1,this.setTimelineVariablesOrder(),void 0!==this.timeline_parameters)for(var e=0;e<this.timeline_parameters.timeline.length;e++)this.timeline_parameters.timeline[e].reset()}end(){this.progress.done=!0}endActiveNode(){void 0===this.timeline_parameters?(this.end(),this.parent_node.end()):this.timeline_parameters.timeline[this.progress.current_location].endActiveNode()}ID(){var e="";return void 0===this.parent_node?"0."+this.progress.current_iteration:(e+=this.parent_node.ID()+"-",e+=this.relative_id+"."+this.progress.current_iteration)}activeID(){return void 0===this.timeline_parameters?this.ID():this.timeline_parameters.timeline[this.progress.current_location].activeID()}generatedData(){return this.jsPsych.data.getDataByTimelineNode(this.ID())}trialsOfType(e){if(void 0===this.timeline_parameters)return this.trial_parameters.type==e?this.trial_parameters:[];for(var t=[],n=0;n<this.timeline_parameters.timeline.length;n++){var i=this.timeline_parameters.timeline[n].trialsOfType(e);t=t.concat(i)}return t}insert(e){void 0===this.timeline_parameters?console.error("Cannot add new trials to a trial-level node."):this.timeline_parameters.timeline.push(new lc(this.jsPsych,Object.assign(Object.assign({},this.node_trial_data),e),this,this.timeline_parameters.timeline.length))}}function pc(e){return new Promise((t=>setTimeout(t,e)))}class uc{version(){return"7.3.4"}constructor(e){this.extensions={},this.turk=cc,this.randomization=sc,this.utils=gr,this.opts={},this.global_trial_index=0,this.current_trial={},this.current_trial_finished=!1,this.paused=!1,this.waiting=!1,this.file_protocol=!1,this.simulation_mode=null,this.webaudio_context=null,this.internal={call_immediate:!1},this.progress_bar_amount=0,e=Object.assign({display_element:void 0,on_finish:()=>{},on_trial_start:()=>{},on_trial_finish:()=>{},on_data_update:()=>{},on_interaction_data_update:()=>{},on_close:()=>{},use_webaudio:!0,exclusions:{},show_progress_bar:!1,message_progress_bar:"Completion Progress",auto_update_progress_bar:!0,default_iti:0,minimum_valid_rt:0,experiment_width:null,override_safe_mode:!1,case_sensitive_responses:!1,extensions:[]},e),this.opts=e,ur(this),this.webaudio_context="undefined"!=typeof window&&void 0!==window.AudioContext?new AudioContext:null,"file:"!=window.location.protocol||!1!==e.override_safe_mode&&void 0!==e.override_safe_mode||(e.use_webaudio=!1,this.file_protocol=!0,console.warn("jsPsych detected that it is running via the file:// protocol and not on a web server. To prevent issues with cross-origin requests, Web Audio and video preloading have been disabled. If you would like to override this setting, you can set 'override_safe_mode' to 'true' in initJsPsych. For more information, see: https://www.jspsych.org/overview/running-experiments")),this.data=new xr(this),this.pluginAPI=function(e){const t=e.getInitSettings(),n=ur(new wr(e.getDisplayContainerElement,t.case_sensitive_responses,t.minimum_valid_rt)),i=ur(new Sr),a=ur(new jr(t.use_webaudio,e.webaudio_context)),o=ur(new yr),s=ur(new Cr(e.getDisplayContainerElement,i.setTimeout));return Object.assign({},n,i,a,o,s)}(this);for(const t of e.extensions)this.extensions[t.type.info.name]=new t.type(this);this.pluginAPI.initAudio()}run(e){return cr(this,void 0,void 0,(function*(){void 0===e&&console.error("No timeline declared in jsPsych.run. Cannot start experiment."),0===e.length&&console.error("No trials have been added to the timeline (the timeline is an empty array). Cannot start experiment."),this.timelineDescription=e,this.timeline=new lc(this,{timeline:e}),yield this.prepareDom(),yield this.checkExclusions(this.opts.exclusions),yield this.loadExtensions(this.opts.extensions),document.documentElement.setAttribute("jspsych","present"),this.startExperiment(),yield this.finished}))}simulate(e,t="data-only",n={}){return cr(this,void 0,void 0,(function*(){this.simulation_mode=t,this.simulation_options=n,yield this.run(e)}))}getProgress(){return{total_trials:void 0===this.timeline?void 0:this.timeline.length(),current_trial_global:this.global_trial_index,percent_complete:void 0===this.timeline?0:this.timeline.percentComplete()}}getStartTime(){return this.exp_start_time}getTotalTime(){return void 0===this.exp_start_time?0:(new Date).getTime()-this.exp_start_time.getTime()}getDisplayElement(){return this.DOM_target}getDisplayContainerElement(){return this.DOM_container}finishTrial(e={}){var t;if(this.current_trial_finished)return;this.current_trial_finished=!0,void 0!==this.current_trial.css_classes&&Array.isArray(this.current_trial.css_classes)&&this.DOM_target.classList.remove(...this.current_trial.css_classes),this.data.write(e);const n=this.data.getLastTrialData().values()[0],i=this.current_trial;if("object"==typeof i.save_trial_parameters)for(const e of Object.keys(i.save_trial_parameters)){const t=i.save_trial_parameters[e];!0===t&&(void 0===i[e]?console.warn(`Invalid parameter specified in save_trial_parameters. Trial has no property called "${e}".`):"function"==typeof i[e]?n[e]=i[e].toString():n[e]=i[e]),!1===t&&"internal_node_id"!==e&&"trial_index"!==e&&delete n[e]}const a=(null!==(t=i.extensions)&&void 0!==t?t:[]).map((e=>this.extensions[e.type.info.name].on_finish(e.params))),o=()=>{this.internal.call_immediate=!0,"function"==typeof i.on_finish&&i.on_finish(n),this.opts.on_trial_finish(n),this.opts.on_data_update(n),this.internal.call_immediate=!1,"data-only"===this.simulation_mode?this.nextTrial():null===typeof i.post_trial_gap||void 0===i.post_trial_gap?this.opts.default_iti>0?setTimeout(this.nextTrial,this.opts.default_iti):this.nextTrial():i.post_trial_gap>0?setTimeout(this.nextTrial,i.post_trial_gap):this.nextTrial()};if(a.some((e=>"function"==typeof e.then)))Promise.all(a.map((e=>Promise.resolve(e).then((e=>{Object.assign(n,e)}))))).then(o);else{for(const e of a)Object.assign(n,e);o()}}endExperiment(e="",t={}){this.timeline.end_message=e,this.timeline.end(),this.pluginAPI.cancelAllKeyboardResponses(),this.pluginAPI.clearAllTimeouts(),this.finishTrial(t)}endCurrentTimeline(){this.timeline.endActiveNode()}getCurrentTrial(){return this.current_trial}getInitSettings(){return this.opts}getCurrentTimelineNodeID(){return this.timeline.activeID()}timelineVariable(e,t=!1){return this.internal.call_immediate||!0===t?this.timeline.timelineVariable(e):{timelineVariablePlaceholder:!0,timelineVariableFunction:()=>this.timeline.timelineVariable(e)}}getAllTimelineVariables(){return this.timeline.allTimelineVariables()}addNodeToEndOfTimeline(e,t){this.timeline.insert(e)}pauseExperiment(){this.paused=!0}resumeExperiment(){this.paused=!1,this.waiting&&(this.waiting=!1,this.nextTrial())}loadFail(e){e=e||"<p>The experiment failed to load.</p>",this.DOM_target.innerHTML=e}getSafeModeStatus(){return this.file_protocol}getTimeline(){return this.timelineDescription}prepareDom(){return cr(this,void 0,void 0,(function*(){"complete"!==document.readyState&&(yield new Promise((e=>{window.addEventListener("load",e)})));const e=this.opts;if(void 0===e.display_element){null===document.querySelector("body")&&document.documentElement.appendChild(document.createElement("body")),document.querySelector("html").style.height="100%",document.querySelector("body").style.margin="0px",document.querySelector("body").style.height="100%",document.querySelector("body").style.width="100%",e.display_element=document.querySelector("body")}else{const t=e.display_element instanceof Element?e.display_element:document.querySelector("#"+e.display_element);null===t?console.error("The display_element specified in initJsPsych() does not exist in the DOM."):e.display_element=t}e.display_element.innerHTML='<div class="jspsych-content-wrapper"><div id="jspsych-content"></div></div>',this.DOM_container=e.display_element,this.DOM_target=document.querySelector("#jspsych-content"),null!==e.experiment_width&&(this.DOM_target.style.width=e.experiment_width+"px"),e.display_element.tabIndex=0,-1===e.display_element.className.indexOf("jspsych-display-element")&&(e.display_element.className+=" jspsych-display-element"),this.DOM_target.className+="jspsych-content",this.data.createInteractionListeners(),window.addEventListener("beforeunload",e.on_close)}))}loadExtensions(e){return cr(this,void 0,void 0,(function*(){try{yield Promise.all(e.map((e=>this.extensions[e.type.info.name].initialize(e.params||{}))))}catch(e){throw console.error(e),new Error(e)}}))}startExperiment(){this.finished=new Promise((e=>{this.resolveFinishedPromise=e})),!0===this.opts.show_progress_bar&&this.drawProgressBar(this.opts.message_progress_bar),this.exp_start_time=new Date,this.timeline.advance(),this.doTrial(this.timeline.trial())}finishExperiment(){const e=this.opts.on_finish(this.data.get()),t=()=>{void 0!==this.timeline.end_message&&(this.DOM_target.innerHTML=this.timeline.end_message),this.resolveFinishedPromise()};e?Promise.resolve(e).then(t):t()}nextTrial(){if(this.paused)return void(this.waiting=!0);this.global_trial_index++,this.timeline.markCurrentTrialComplete();const e=this.timeline.advance();!0===this.opts.show_progress_bar&&!0===this.opts.auto_update_progress_bar&&this.updateProgressBar(),e?this.finishExperiment():this.doTrial(this.timeline.trial())}doTrial(e){if(this.current_trial=e,this.current_trial_finished=!1,this.evaluateTimelineVariables(e),"string"==typeof e.type)throw new dr("A string was provided as the trial's `type` parameter. Since jsPsych v7, the `type` parameter needs to be a plugin object.");if(e.type=Object.assign(Object.assign({},ur(new e.type(this))),{info:e.type.info}),this.evaluateFunctionParameters(e),this.setDefaultValues(e),this.internal.call_immediate=!0,this.opts.on_trial_start(e),"function"==typeof e.on_start&&e.on_start(e),Array.isArray(e.extensions))for(const t of e.extensions)this.extensions[t.type.info.name].on_start(t.params);this.DOM_container.focus(),this.DOM_target.scrollTop=0,void 0!==e.css_classes&&(Array.isArray(e.css_classes)||"string"!=typeof e.css_classes||(e.css_classes=[e.css_classes]),Array.isArray(e.css_classes)&&this.DOM_target.classList.add(...e.css_classes));const t=()=>{if("function"==typeof e.on_load&&e.on_load(),Array.isArray(e.extensions))for(const t of e.extensions)this.extensions[t.type.info.name].on_load(t.params)};let n,i,a;this.simulation_mode||(n=e.type.trial(this.DOM_target,e,t)),this.simulation_mode&&(e.type.simulate?(e.simulation_options||(i=this.simulation_options.default),e.simulation_options&&("string"==typeof e.simulation_options?this.simulation_options[e.simulation_options]?i=this.simulation_options[e.simulation_options]:this.simulation_options.default?(console.log(`No matching simulation options found for "${e.simulation_options}". Using "default" options.`),i=this.simulation_options.default):(console.log(`No matching simulation options found for "${e.simulation_options}" and no "default" options provided. Using the default values provided by the plugin.`),i={}):i=e.simulation_options),a=this.utils.deepMerge(this.simulation_options.default,i),a=this.utils.deepCopy(a),a=this.replaceFunctionsWithValues(a,null),n=!1===(null==a?void 0:a.simulate)?e.type.trial(this.DOM_target,e,t):e.type.simulate(e,(null==a?void 0:a.mode)||this.simulation_mode,a,t)):n=e.type.trial(this.DOM_target,e,t));n&&"function"==typeof n.then||this.simulation_mode&&(!this.simulation_mode||!1!==(null==a?void 0:a.simulate))||t(),this.internal.call_immediate=!1}evaluateTimelineVariables(e){for(const t of Object.keys(e))"object"==typeof e[t]&&null!==e[t]&&void 0!==e[t].timelineVariablePlaceholder&&(e[t]=e[t].timelineVariableFunction()),"object"==typeof e[t]&&null!==e[t]&&"timeline"!==t&&"timeline_variables"!==t&&this.evaluateTimelineVariables(e[t])}evaluateFunctionParameters(e){this.internal.call_immediate=!0;for(const t of Object.keys(e))"type"!==t&&(void 0!==kr[t]&&kr[t].type!==fr.FUNCTION&&(e[t]=this.replaceFunctionsWithValues(e[t],null)),void 0!==e.type.info.parameters[t]&&e.type.info.parameters[t].type!==fr.FUNCTION&&(e[t]=this.replaceFunctionsWithValues(e[t],e.type.info.parameters[t])));this.internal.call_immediate=!1}replaceFunctionsWithValues(e,t){if(null===e)return e;if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=this.replaceFunctionsWithValues(e[n],t);else if("object"==typeof e)if(null!==t&&t.nested)for(const n of Object.keys(e))"object"==typeof t.nested[n]&&t.nested[n].type!==fr.FUNCTION&&(e[n]=this.replaceFunctionsWithValues(e[n],t.nested[n]));else for(const t of Object.keys(e))"type"!==t&&"timeline"!==t&&"timeline_variables"!==t&&(e[t]=this.replaceFunctionsWithValues(e[t],null));else if("function"==typeof e)return e();return e}setDefaultValues(e){for(const t in e.type.info.parameters)e.type.info.parameters[t].type===fr.COMPLEX?(void 0===e[t]&&e.type.info.parameters[t].default&&(e[t]=e.type.info.parameters[t].default),!0===e.type.info.parameters[t].array&&Array.isArray(e[t])&&e[t].forEach((function(n,i){for(const n in e.type.info.parameters[t].nested)void 0!==e[t][i][n]&&null!==e[t][i][n]||(void 0===e.type.info.parameters[t].nested[n].default?console.error(`You must specify a value for the ${n} parameter (nested in the ${t} parameter) in the ${e.type.info.name} plugin.`):e[t][i][n]=e.type.info.parameters[t].nested[n].default)}))):void 0!==e[t]&&null!==e[t]||(void 0===e.type.info.parameters[t].default?console.error(`You must specify a value for the ${t} parameter in the ${e.type.info.name} plugin.`):e[t]=e.type.info.parameters[t].default)}checkExclusions(e){return cr(this,void 0,void 0,(function*(){if((e.min_width||e.min_height||e.audio)&&console.warn("The exclusions option in `initJsPsych()` is deprecated and will be removed in a future version. We recommend using the browser-check plugin instead. See https://www.jspsych.org/latest/plugins/browser-check/."),e.min_width||e.min_height){const t=e.min_width||0,n=e.min_height||0;if(window.innerWidth<t||window.innerHeight<n){for(this.getDisplayElement().innerHTML="<p>Your browser window is too small to complete this experiment. Please maximize the size of your browser window. If your browser window is already maximized, you will not be able to complete this experiment.</p><p>The minimum width is "+t+"px. Your current width is "+window.innerWidth+"px.</p><p>The minimum height is "+n+"px. Your current height is "+window.innerHeight+"px.</p>";window.innerWidth<t||window.innerHeight<n;)yield pc(100);this.getDisplayElement().innerHTML=""}}if(void 0!==e.audio&&e.audio&&!window.hasOwnProperty("AudioContext")&&!window.hasOwnProperty("webkitAudioContext"))throw this.getDisplayElement().innerHTML="<p>Your browser does not support the WebAudio API, which means that you will not be able to complete the experiment.</p><p>Browsers that support the WebAudio API include Chrome, Firefox, Safari, and Edge.</p>",new Error}))}drawProgressBar(e){document.querySelector(".jspsych-display-element").insertAdjacentHTML("afterbegin",'<div id="jspsych-progressbar-container"><span>'+e+'</span><div id="jspsych-progressbar-outer"><div id="jspsych-progressbar-inner"></div></div></div>')}updateProgressBar(){this.setProgressBar(this.getProgress().percent_complete/100)}setProgressBar(e){e=Math.max(Math.min(1,e),0),document.querySelector("#jspsych-progressbar-inner").style.width=100*e+"%",this.progress_bar_amount=e}getProgressBarCompleted(){return this.progress_bar_amount}}"undefined"!=typeof window&&window.hasOwnProperty("webkitAudioContext")&&!window.hasOwnProperty("AudioContext")&&(window.AudioContext=webkitAudioContext);const dc={name:"preload",parameters:{auto_preload:{type:fr.BOOL,pretty_name:"Auto-preload",default:!1},trials:{type:fr.TIMELINE,pretty_name:"Trials",default:[]},images:{type:fr.STRING,pretty_name:"Images",default:[],array:!0},audio:{type:fr.STRING,pretty_name:"Audio",default:[],array:!0},video:{type:fr.STRING,pretty_name:"Video",default:[],array:!0},message:{type:fr.HTML_STRING,pretty_name:"Message",default:null},show_progress_bar:{type:fr.BOOL,pretty_name:"Show progress bar",default:!0},continue_after_error:{type:fr.BOOL,pretty_name:"Continue after error",default:!1},error_message:{type:fr.HTML_STRING,pretty_name:"Error message",default:"The experiment failed to load."},show_detailed_errors:{type:fr.BOOL,pretty_name:"Show detailed errors",default:!1},max_load_time:{type:fr.INT,pretty_name:"Max load time",default:null},on_error:{type:fr.FUNCTION,pretty_name:"On error",default:null},on_success:{type:fr.FUNCTION,pretty_name:"On success",default:null}}};class mc{constructor(e){this.jsPsych=e}trial(e,t){var n=null,i=!1,a=[],o=[],s=[],r=[],c=this.jsPsych.getSafeModeStatus(),l=[],p=[],u=[];if(t.auto_preload){var d=this.jsPsych.getTimeline(),m=this.jsPsych.pluginAPI.getAutoPreloadList(d);l=l.concat(m.images),p=p.concat(m.audio),u=u.concat(m.video)}if(t.trials.length>0){var h=this.jsPsych.pluginAPI.getAutoPreloadList(t.trials);l=l.concat(h.images),p=p.concat(h.audio),u=u.concat(h.video)}l=l.concat(t.images),p=p.concat(t.audio),u=u.concat(t.video),l=this.jsPsych.utils.unique(l.flat()),p=this.jsPsych.utils.unique(p.flat()),u=this.jsPsych.utils.unique(u.flat()),c&&(u=[]);var f="";null!==t.message&&(f+=t.message),t.show_progress_bar&&(f+="\n <div id='jspsych-loading-progress-bar-container' style='height: 10px; width: 300px; background-color: #ddd; margin: auto;'>\n <div id='jspsych-loading-progress-bar' style='height: 10px; width: 0%; background-color: #777;'></div>\n </div>"),e.innerHTML=f;const g=()=>{if(k++,t.show_progress_bar){var n=k/w*100,i=e.querySelector("#jspsych-loading-progress-bar");null!==i&&(i.style.width=n+"%")}},v=()=>{void 0!==i&&!1===i&&(this.jsPsych.pluginAPI.clearAllTimeouts(),this.jsPsych.pluginAPI.cancelPreloads(),n=!0,y())},b=()=>{this.jsPsych.pluginAPI.cancelPreloads(),void 0===n||!1!==n&&null!==n||(i=!0,_<w&&(n=!1),S("timeout"),r.push("<p><strong>Loading timed out.</strong><br>Consider compressing your stimuli files, loading your files in smaller batches,<br>and/or increasing the <i>max_load_time</i> parameter.</p>"),t.continue_after_error?y():x())},x=()=>{this.jsPsych.pluginAPI.clearAllTimeouts(),this.jsPsych.pluginAPI.cancelPreloads(),e.innerHTML=t.error_message,t.show_detailed_errors&&(e.innerHTML+="<p><strong>Error details:</strong></p>",r.forEach((t=>{e.innerHTML+=t})))},y=()=>{this.jsPsych.pluginAPI.clearAllTimeouts();var t={success:n,timeout:i,failed_images:a,failed_audio:o,failed_video:s};e.innerHTML="",this.jsPsych.finishTrial(t)};null!==t.max_load_time&&this.jsPsych.pluginAPI.setTimeout(b,t.max_load_time);var w=l.length+p.length+u.length,k=0,_=0;if(0==w)v();else{const e=e=>{this.jsPsych.pluginAPI.preloadVideo(u,e,C,j)},t=e=>{this.jsPsych.pluginAPI.preloadAudio(p,e,C,j)},n=e=>{this.jsPsych.pluginAPI.preloadImages(l,e,C,j)};u.length>0&&e((()=>{})),p.length>0&&t((()=>{})),l.length>0&&n((()=>{}))}function j(e){g(),null==n&&(n=!1);var i="unknown file";e.source&&(i=e.source),e.error&&e.error.path&&e.error.path.length>0&&("img"==e.error.path[0].localName?a.push(i):"audio"==e.error.path[0].localName?o.push(i):"video"==e.error.path[0].localName&&s.push(i));var c="<p><strong>Error loading file: "+i+"</strong><br>";e.error.statusText&&(c+="File request response status: "+e.error.statusText+"<br>"),"404"==e.error&&(c+="404 - file not found.<br>"),void 0!==e.error.loaded&&null!==e.error.loaded&&0!==e.error.loaded?c+=e.error.loaded+" bytes transferred.":c+="File did not begin loading. Check that file path is correct and reachable by the browser,<br>and that loading is not blocked by cross-origin resource sharing (CORS) errors.",c+="</p>",r.push(c),S(i),k==w&&(t.continue_after_error?y():x())}function C(e){g(),function(e){null!==t.on_success&&t.on_success(e)}(e),++_==w?v():k==w&&(t.continue_after_error?y():x())}function S(e){null!==t.on_error&&t.on_error(e)}}simulate(e,t,n,i){"data-only"==t&&(i(),this.simulate_data_only(e,n)),"visual"==t&&this.simulate_visual(e,n,i)}create_simulation_data(e,t){return this.jsPsych.pluginAPI.mergeSimulationData({success:!0,timeout:!1,failed_images:[],failed_audio:[],failed_video:[]},t)}simulate_data_only(e,t){const n=this.create_simulation_data(e,t);this.jsPsych.finishTrial(n)}simulate_visual(e,t,n){const i=this.jsPsych.getDisplayElement();this.trial(i,e),n()}}function hc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,a,o,s,r=[],c=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(i=o.call(n)).done)&&(r.push(i.value),r.length!==t);c=!0);}catch(e){l=!0,a=e}finally{try{if(!c&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw a}}return r}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return fc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fc(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}mc.info=dc,fr.BOOL,fr.HTML_STRING,fr.STRING,fr.INT;var gc=[],vc=gc.forEach,bc=gc.slice;var xc=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,yc=function(e,t,n,i){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{path:"/",sameSite:"strict"};n&&(a.expires=new Date,a.expires.setTime(a.expires.getTime()+60*n*1e3)),i&&(a.domain=i),document.cookie=function(e,t,n){var i=n||{};i.path=i.path||"/";var a=encodeURIComponent(t),o="".concat(e,"=").concat(a);if(i.maxAge>0){var s=i.maxAge-0;if(Number.isNaN(s))throw new Error("maxAge should be a Number");o+="; Max-Age=".concat(Math.floor(s))}if(i.domain){if(!xc.test(i.domain))throw new TypeError("option domain is invalid");o+="; Domain=".concat(i.domain)}if(i.path){if(!xc.test(i.path))throw new TypeError("option path is invalid");o+="; Path=".concat(i.path)}if(i.expires){if("function"!=typeof i.expires.toUTCString)throw new TypeError("option expires is invalid");o+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(o+="; HttpOnly"),i.secure&&(o+="; Secure"),i.sameSite)switch("string"==typeof i.sameSite?i.sameSite.toLowerCase():i.sameSite){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return o}(e,encodeURIComponent(t),a)},wc=function(e){for(var t="".concat(e,"="),n=document.cookie.split(";"),i=0;i<n.length;i++){for(var a=n[i];" "===a.charAt(0);)a=a.substring(1,a.length);if(0===a.indexOf(t))return a.substring(t.length,a.length)}return null},kc={name:"cookie",lookup:function(e){var t;if(e.lookupCookie&&"undefined"!=typeof document){var n=wc(e.lookupCookie);n&&(t=n)}return t},cacheUserLanguage:function(e,t){t.lookupCookie&&"undefined"!=typeof document&&yc(t.lookupCookie,e,t.cookieMinutes,t.cookieDomain,t.cookieOptions)}},_c={name:"querystring",lookup:function(e){var t;if("undefined"!=typeof window){var n=window.location.search;!window.location.search&&window.location.hash&&window.location.hash.indexOf("?")>-1&&(n=window.location.hash.substring(window.location.hash.indexOf("?")));for(var i=n.substring(1).split("&"),a=0;a<i.length;a++){var o=i[a].indexOf("=");if(o>0)i[a].substring(0,o)===e.lookupQuerystring&&(t=i[a].substring(o+1))}}return t}},jc=null,Cc=function(){if(null!==jc)return jc;try{jc="undefined"!==window&&null!==window.localStorage;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch(e){jc=!1}return jc},Sc={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&Cc()){var n=window.localStorage.getItem(e.lookupLocalStorage);n&&(t=n)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&Cc()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},Ec=null,Tc=function(){if(null!==Ec)return Ec;try{Ec="undefined"!==window&&null!==window.sessionStorage;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch(e){Ec=!1}return Ec},Mc={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&Tc()){var n=window.sessionStorage.getItem(e.lookupSessionStorage);n&&(t=n)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&Tc()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},Oc={name:"navigator",lookup:function(e){var t=[];if("undefined"!=typeof navigator){if(navigator.languages)for(var n=0;n<navigator.languages.length;n++)t.push(navigator.languages[n]);navigator.userLanguage&&t.push(navigator.userLanguage),navigator.language&&t.push(navigator.language)}return t.length>0?t:void 0}},Ac={name:"htmlTag",lookup:function(e){var t,n=e.htmlTag||("undefined"!=typeof document?document.documentElement:null);return n&&"function"==typeof n.getAttribute&&(t=n.getAttribute("lang")),t}},Ic={name:"path",lookup:function(e){var t;if("undefined"!=typeof window){var n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(n instanceof Array)if("number"==typeof e.lookupFromPathIndex){if("string"!=typeof n[e.lookupFromPathIndex])return;t=n[e.lookupFromPathIndex].replace("/","")}else t=n[0].replace("/","")}return t}},Pc={name:"subdomain",lookup:function(e){var t="number"==typeof e.lookupFromSubdomainIndex?e.lookupFromSubdomainIndex+1:1,n="undefined"!=typeof window&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(n)return n[t]}};var Rc=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Co(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return To(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=e||{languageUtils:{}},this.options=function(e){return vc.call(bc.call(arguments,1),(function(t){if(t)for(var n in t)void 0===e[n]&&(e[n]=t[n])})),e}(t,this.options||{},{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(e){return e}}),"string"==typeof this.options.convertDetectedLanguage&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(e){return e.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(kc),this.addDetector(_c),this.addDetector(Sc),this.addDetector(Mc),this.addDetector(Oc),this.addDetector(Ac),this.addDetector(Ic),this.addDetector(Pc)}},{key:"addDetector",value:function(e){return this.detectors[e.name]=e,this}},{key:"detect",value:function(e){var t=this;e||(e=this.options.order);var n=[];return e.forEach((function(e){if(t.detectors[e]){var i=t.detectors[e].lookup(t.options);i&&"string"==typeof i&&(i=[i]),i&&(n=n.concat(i))}})),n=n.map((function(e){return t.options.convertDetectedLanguage(e)})),this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}},{key:"cacheUserLanguage",value:function(e,t){var n=this;t||(t=this.options.caches),t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach((function(t){n.detectors[t]&&n.detectors[t].cacheUserLanguage(e,n.options)})))}}]),e}();Rc.type="languageDetector";var Lc={progressBar:"Progress Complete",fullScreenTrial:{prompt:"Switching to full screen mode.",buttonText:"Go"},instructions:{intro:{header:"Welcome to ROAR Multichoice!",topText:"In this activity, you're going to help me complete some sentences.",bottomText:""},instructions:{header:"What word completes the sentence?",topText:"Choose the best option to fill in the blank.",bottomText:""},practice:{header:"Let's practice!",topText:"Remember, your job is to choose the right word that fills in the blank.",bottomText:""},postPractice:{header:"Great job!",topText:"Now you're ready to try on your own. Try your best to choose the word that completes the sentence.",bottomText:""},practiceCorrect:{header:"That's right!",topText:"",bottomText:""},break1:{header:"Keep up the good work!",topText:"",bottomText:""},break2:{header:"You are doing great!",topText:"",bottomText:""},break3:{header:"Let's keep going.",topText:"",bottomText:""},break4:{header:"You are an expert at this!",topText:"",bottomText:""},break5:{header:"You can do it!",topText:"",bottomText:""},ending:{header:"You're all done! Thank you for helping me find those words!",topText:"",bottomText:""}}};(new Rc).addDetector({name:"defaultToEnglish",lookup:e=>"en"}),Ds.use(Rc).init({debug:!1,load:"languageOnly",fallbackLng:"en",detection:{order:["defaultToEnglish","querystring"]},resources:{en:{translation:Lc}}}),function(e){const t=new uc(e);Object.defineProperties(t,Object.fromEntries(Object.entries({init:"`jsPsych.init()` was replaced by `initJsPsych()` in jsPsych v7.",ALL_KEYS:'jsPsych.ALL_KEYS was replaced by the "ALL_KEYS" string in jsPsych v7.',NO_KEYS:'jsPsych.NO_KEYS was replaced by the "NO_KEYS" string in jsPsych v7.',currentTimelineNodeID:"`currentTimelineNodeID()` was renamed to `getCurrentTimelineNodeID()` in jsPsych v7.",progress:"`progress()` was renamed to `getProgress()` in jsPsych v7.",startTime:"`startTime()` was renamed to `getStartTime()` in jsPsych v7.",totalTime:"`totalTime()` was renamed to `getTotalTime()` in jsPsych v7.",currentTrial:"`currentTrial()` was renamed to `getCurrentTrial()` in jsPsych v7.",initSettings:"`initSettings()` was renamed to `getInitSettings()` in jsPsych v7.",allTimelineVariables:"`allTimelineVariables()` was renamed to `getAllTimelineVariables()` in jsPsych v7."}).map((([e,t])=>[e,{get(){throw new dr(t)}}]))))}({show_progress_bar:!1,auto_update_progress_bar:!1,message_progress_bar:`${Ds.t("progressBar")}`});var Nc={default:{languageSpecific:{device:[],shared:["tryAgain.mp3","thatsRight.mp3","clickButton.jpg","intro.mp3","ins.mp3","surveyPractice.mp3","surveyPostPractice.mp3","great-job-click.mp3","break1.mp3","break2.mp3","break3.mp3","break4.mp3","break5.mp3","ending.mp3"]},shared:["nullAudio.mp3","select.mp3","goButton.png","coin.mp3","countdown0.mp3","countdown1.mp3","countdown2.mp3","countdown3.mp3","fail.mp3","fairyCoin.mp3","coin_bag.gif","ROARLion.gif"]}};const Dc="https://storage.googleapis.com/egma-math";!function(e,t,n){var i={images:{},video:{},audio:{}},a=ar(n),o=or(),s=function(e,n){var s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];e.forEach((function(e){var c=rr(e),l=Vs.parse(e).name,p=l.replace(/^([A-Z])|[\s-_](\w)/g,(function(e,t,n,i){return n?n.toUpperCase():t.toLowerCase()})),u=sr(t,e,a,o,n,s,r);i[c][p]=u}))},r=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];Array.isArray(e)?s(e,"default"):(e.languageSpecific&&(Array.isArray(e.languageSpecific)?s(e.languageSpecific,"languageSpecific"):function(e,t){Object.entries(e).forEach((function(e){var n=hc(e,2),i=n[0],a=n[1];s(a,i,!0,t)}))}(e.languageSpecific,n)),e.device&&s(e.device,"device"),e.shared&&(t=e.shared,Array.isArray(t)?s(t,"shared"):Object.entries(t).forEach((function(e){var t=hc(e,2),n=t[0],i=t[1];s(i,"device"===n?"shared/device":"shared")}))))};e.preload&&Object.entries(e.preload).forEach((function(e){var t=hc(e,2)[1];r(t)})),e.default&&r(e.default,!0)}(Nc,Dc),function(e,t,n){var i={},a=ar(n),o=or();function s(e,n,s){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],c=arguments.length>4&&void 0!==arguments[4]&&arguments[4];e.forEach((function(e){var l=rr(e),p=sr(t,e,a,o,s,r,c);i[n]||(i[n]={type:mc,message:"The experiment is loading",show_progress_bar:!0,continue_after_error:!1,error_message:"",show_detailed_errors:!0,max_load_time:null,on_error:null,on_success:null,images:[],audio:[],video:[]}),i[n][l].push(p)}))}function r(e,t,n){Array.isArray(t)?s(t,e,"languageSpecific"):function(e,t,n){Object.entries(t).forEach((function(t){var i=hc(t,2),a=i[0];s(i[1],e,a,!0,n)}))}(e,t,n)}function c(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];Array.isArray(t)?s(t,e,"default"):(t.languageSpecific&&r(e,t.languageSpecific,n),t.device&&s(t.device,e,"device"),t.shared&&function(e,t){Array.isArray(t)?s(t,e,"shared"):Object.entries(t).forEach((function(t){var n=hc(t,2),i=n[0];s(n[1],e,"device"===i?"shared/device":"shared")}))}(e,t.shared))}return e.preload&&Object.entries(e.preload).forEach((function(e){var t=hc(e,2);c(t[0],t[1])})),e.default&&c("default",e.default,!0),i}(Nc,Dc).default;const qc=(e,t)=>{let n;var i,a=("string"!=typeof(i=e)&&(i=String(i)),i.toLocaleLowerCase());return n=["true","false"].includes(a)?function(e,t=!1){return null==e?t:"true"===e.trim().toLowerCase()}(a):!(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:13,i=Number(e);if(null!=e){if(Number.isNaN(i)){var a={k:0,tk:0,pk:0,preschool:0,prekindergarten:0,transitionalkindergarten:0,kindergarten:0,infanttoddler:0,infant:0,toddler:0,first:1,firstgrade:1,second:2,secondgrade:2,third:3,thirdgrade:3,fourth:4,fourthgrade:4,fifth:5,fifthgrade:5,sixth:6,sixthgrade:6,seventh:7,seventhgrade:7,eighth:8,eighthgrade:8,ninth:9,ninthgrade:9,tenth:10,tenthgrade:10,eleventh:11,eleventhgrade:11,twelfth:12,twelfthgrade:12,freshman:9,sophomore:10,junior:11,senior:12,postgraduate:13,university:13,graduate:13,master:13,doctorate:13,masters:13}[e.toLowerCase().replace(/\s/g,"").replace(/-/g,"")];if(void 0===a)return;return a<t?t:a>n?n:a}return i<t?t:i>n?n:i}}(t)>=6),n};async function Fc(){const e=document.createElement("div");e.innerHTML='<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">\n\n\x3c!-- <h5 style="text-align:left;">\n Stanford University Research Consent Form\n <span style="float:right;">\n For IRB Use Only\n </span>\n</h5>\n\n<h5 style="text-align:left;">\n Protocol Director: Jason D. Yeatman, Ph.D.\n <span style="float:right;">\n Approval Date: October 31, 2023\n </span>\n</h5>\n\n<h5 style="text-align:left;">\n Protocol Title: Plasticity and Reading\n <span style="float:right;">\n Expiration Date: October 31, 2024\n </span>\n</h5> --\x3e\n\n<style>\n body {\n margin: 20px; /* Adjust the margin size as needed */\n }\n</style>\n\n<body>\n<h3 style="text-align: center;"> STANFORD UNIVERSITY CONSENT FORM </h3>\n\n<h4 style="text-align: center;"> Stanford University Reading &amp; Dyslexia Research Program: Behavioral Testing </h4>\n\n<blockquote>\n<h4 id="principal-investigator-">Principal Investigator:</h4>\n<p>Jason D. Yeatman </p>\n<p>Associate Professor</p>\n<p>Graduate School of Education</p>\n<p>School of Medicine, Division of Developmental Behavioral Pediatrics</p>\n<h4 id="contact-">Contact:</h4>\n<p>readingresearch@stanford.edu</p>\n<p><a href="https://dyslexia.stanford.edu/">https://dyslexia.stanford.edu/</a> </p>\n</blockquote>\n<h4 id="purpose-of-the-study">PURPOSE OF THE STUDY</h4>\n<p>Data collected through games in the web-browser will help researchers understand relationships between academic skills, reading proficiency, cognition, perception, and/or attitudes towards reading and school in individuals with a broad range of reading skills.</p>\n<h4 id="study-procedures">STUDY PROCEDURES</h4>\n<p>In this study, you or your child will be asked to complete computer tasks via a computer screen. An eye-tracking software will request access to your webcam and will be used to measure eye movements. You will be asked to provide verbal responses in which case the web browser will request access to your computer microphone. You or your child may be asked to complete multiple activities in one session depending on the study. </p>\n<h4 id="privacy-or-data-collection">PRIVACY OR DATA COLLECTION</h4>\n<p>We will do our best to ensure your privacy. Data that is collected through this online experiment is stored separately from identifying information such as your name. For the sake of payment, sometimes we store an email address you provide, but this is stored separately from the responses that are recorded in the online experiment. Each participant is assigned a code and that is used rather than names. This is called “coded data” and we try to ensure that the identity of our research participants is kept confidential. Data collected as part of this study may be used for many years to help discover trends in the population and explore changes due to development and education. In addition, coded data may be shared online or with collaborators to allow for new and unforeseen discoveries. Researchers may choose to include coded data in publications to support findings, or they may choose to release coded data alongside findings for replicability.</p>\n<p>We will collect mouse and click data, scrolling behavior, scores earned, button presses and their timestamps, time spent on each page, audio recordings, or other data that may be derived from your behavior on our page. This data will be stored on servers. The eye-tracking software will use your webcam to track your eyes. This software will record and save video data for future analysis. Once analysis has been completed, the video data will be deleted. Incomplete data may be logged if you quit out of the experiment early. If you would like to void your data, you may request it through our contact email.</p>\n<h4 id="compensation">COMPENSATION</h4>\n<p>We value [your/your child’s] participation. A Tango gift card will be sent through email upon completion of this study. Specific reward amounts will be indicated on the task card and/or study invitation, which you can view before launching the task or scheduling the appointment. If you or your child is completing these activities as part of another study, the compensation rate will remain consistent with the rate of the study you or your child is enrolled in. </p>\n<p>Please note that the gift card system we use to pay participants is not affiliated with Stanford and we will need to input your name and email into this system to send you the electronic gift card payment. If you feel uncomfortable with this process, please let us know before signing the consent form. Depending on the study, we may be able to look into other forms of payment for you.</p>\n<h4 id="risks-stress-or-discomfort">RISKS, STRESS, OR DISCOMFORT</h4>\n<p>If there is any reason to believe you are/your child is not safe to participate in any of the tasks, please contact us at readingresearch@stanford.edu. Some people may experience some physical discomfort or boredom due to being asked to sit for long periods. For computer tasks, some people may also experience dry eyes or eye fatigue. For some tasks that are untimed, breaks can be taken as needed during the session.</p>\n<h4 id="contact-information">CONTACT INFORMATION</h4>\n<p>If you have any additional questions or concerns about our research, feel free to email us at readingresearch@stanford.edu. We will be more than happy to help!</p>\n<p>For general information regarding questions or concerns about [your/your child’s] rights as a research participant, please call 1-866-680-2906 to reach the Administrative Panel on Human Subjects in Medical Research, Stanford University.</p>\n<form id="consentForm">\n <p>\n <input type="checkbox" id="webcamConsent" name="consent">\n I confirm that I have a webcam, and I agree to have my webcam track my eyes. I understand that the webcam will record or save video data and that it will be deleted once analysis is complete.\n </p>\n <p>\n <input type="checkbox" id="voiceConsent" name="consent">\n I agree to have my voice recorded. This data will only be used for data scoring purposes, will be stored securely, and will not be shared with others outside the lab.\n </p>\n <p>\n <input type="checkbox" id="participationConsent" name="consent">\n I agree to participate in this research. Participation in this research is voluntary, and I can stop at any time without penalty. I feel that I understand what I am getting into, and I know I am free to leave the experiment at any time by simply closing the web browser.\n </p>\n <button id="confirmButton" disabled>Continue to test</button>\n</form>\n</body>\n\n<h5 class="card-title" style="display: none;"></h5>\n\n<script>\n document.getElementById(\'consentForm\').addEventListener(\'change\', function() {\n var checkboxes = document.querySelectorAll(\'input[type="checkbox"][name="consent"]\');\n var allChecked = Array.from(checkboxes).every(checkbox => checkbox.checked);\n document.getElementById(\'confirmButton\').disabled = !allChecked;\n });\n<\/script>\n\n',document.body.appendChild(e),await async function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=t[e];n.src&&await zc(n.src)}}(e),function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=document.createElement("script");n.text=t[e].text,document.head.appendChild(n).parentNode.removeChild(n)}}(e),await new Promise((t=>{const n=document.getElementById("confirmButton");n&&n.addEventListener("click",(()=>{document.querySelectorAll("script[data-dynamic]").forEach((e=>e.parentNode.removeChild(e))),e.remove(),t()}))}))}function zc(e){return new Promise(((t,n)=>{const i=document.createElement("script");i.src=e,i.onload=t,i.onerror=n,document.head.appendChild(i)}))}window.store=s;var Vc='<!DOCTYPE html>\n<html lang="en">\n<head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">\n <style>\n body {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100vh;\n margin: 0;\n background-color: #ffffff; /* White background */\n color: #000000; /* Black text */\n }\n\n .loading-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n padding: 20px;\n border-radius: 10px;\n background: rgba(0, 0, 0, 0.05); /* Slight gray tint to differentiate from the white background */\n box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Soft shadow for depth */\n }\n\n .loading-spinner {\n border: 8px solid rgba(0, 0, 0, 0.1); /* Lighter border for the spinner */\n border-top: 8px solid #0d6efd; /* Blue color for active part of the spinner */\n border-radius: 50%;\n width: 80px;\n height: 80px;\n animation: spin 1s linear infinite;\n margin-bottom: 20px;\n }\n\n h2 {\n font-weight: 400;\n letter-spacing: 1px;\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n </style>\n</head>\n<body>\n <div class="loading-container">\n <div class="loading-spinner"></div>\n <h2>Loading...</h2>\n </div>\n</body>\n</html>\n',Bc={};function Uc(){const e=document.getElementById("deviceList"),t=document.getElementById("findDevice-collapsableCards");e.innerHTML="";const n=document.createElement("option");n.value="",n.text="",e.add(n);const i=Object.keys(deviceConfigs);if(i.forEach((t=>{const n=document.createElement("option");n.value=t,n.text=t.charAt(0).toUpperCase()+t.slice(1),e.add(n)})),console.log(i.length),1===i.length){Hc(deviceConfigs[i[0]]),t&&(t.style.display="none",Wc())}else t&&(t.style.display="block")}function Hc(e){console.log("You selected a "+e.deviceName),screenHeight=e.screenHeight,screenWidth=e.screenWidth,webcamHeight=e.webcamHeight,screenSizeCalibrated=e.screenSizeCalibrated,webcamCentered=e.webcamCentered,HeightWebcamEntered=e.HeightWebcamEntered,heightInput_textbox.value=webcamHeight,heightInput_textbox.disabled=HeightWebcamEntered,e.hasOwnProperty("normalizedFocalLength")&&(normalizedFocalLength=e.normalizedFocalLength),checkAllComplete()}function Wc(){var e=document.querySelectorAll(".card-title"),t=1;e.forEach((function(e){"none"!==e.parentElement.parentElement.style.display&&null!==e.parentElement.parentElement.offsetParent&&(e.textContent=e.textContent.replace(/\(\d+\)/,"("+t+")"),t++)}))}var $c=Object.freeze({__proto__:null,collapseCamera:function(e=!0){const t=document.querySelectorAll('[id*="-cameracollapsableCards"]');console.log(t),t.forEach((t=>{t.style.display=e?"none":""})),Wc()},collapseCards:function(e=!0){const t=document.querySelectorAll('[id*="-collapsableCards"]');console.log(t),t.forEach((t=>{t.style.display="Toggle"===e?"none"===t.style.display?"":"none":e?"none":""})),Wc()},deviceConfig:Bc,handleDevice:Hc,inputParticipantName:function(e){var t=document.getElementById("idInput");t.value=e,t.disabled=!0},updateCardNumbers:Wc,updateDeviceConfigFromJSON:async function(e){try{const t=await fetch(e),n=await t.json();console.log(n),deviceConfigs=n,Uc()}catch(e){console.error("Error fetching or parsing JSON:",e)}},updateDropdownOptions:Uc});function Kc(){const e=window.navigator,t=window.screen,n={userAgent:e.userAgent,platform:e.platform,language:e.language,deviceMemory:e.deviceMemory||"Not available",hardwareConcurrency:e.hardwareConcurrency,maxTouchPoints:e.maxTouchPoints,cookiesEnabled:e.cookieEnabled,webDriver:e.webdriver,onlineStatus:e.onLine,gpu:"Not available"},i={width:t.width,height:t.height,colorDepth:t.colorDepth,pixelDepth:t.pixelDepth,retinaDisplay:window.matchMedia("(-webkit-min-device-pixel-ratio: 2)").matches,landscapeOrientation:window.matchMedia("(orientation: landscape)").matches},a=document.createElement("canvas"),o=a.getContext("webgl")||a.getContext("experimental-webgl");if(o){const e=o.getExtension("WEBGL_debug_renderer_info");n.gpu=e?o.getParameter(e.UNMASKED_RENDERER_WEBGL):"Not available"}return{device:n,screen:i}}async function Yc(e){s.session.set("clickedTests",[]),s.session.set("testComplete",!1);const t=Vc,n=document.createElement("div");n.innerHTML='\x3c!-- Scripts --\x3e\n<script data-dynamic src="https://cdn.jsdelivr.net/npm/remote-calibrator@latest"><\/script>\n<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">\n\n\x3c!-- CSS --\x3e\n<style>\n\nbody {\n margin: 0;\n}\n\n .column {\n float: left;\n padding: 10px;\n}\n\n.left, .right {\n width: 33%;\n}\n\n.middle {\n width: 33%;\n}\n\n.row:after {\n content: "";\n display: table;\n clear: both;\n}\n\n.container {\n width: 75%; /* Set the width for the container */\n margin: auto; /* Center the container if needed */\n}\n\n #audio-visualization {\n width: 100%; /* Both elements fill the container */\n /* display: block; Ensure they are not inline */\n}\n\n#audio-visualization {\n height: 100px; /* Set a fixed height for the canvas */\n}\n\n</style>\n\n\x3c!-- HTML --\x3e\n<body id="body">\n\n <div class="px-4 py-5 my-5 text-center" style="display: block;">\n <h1 class="display-5 fw-bold" id="title">Configure Device</h1>\n <h5> To get started, we will need to set up a few things. </h5>\n <h5> If you’re not sure what to do, ask an adult to help you with this part. </h5>\n <img src="https://eyetrackingdata.blob.core.windows.net/public/Images/parent-help-icon.png" width="10%">\n <div class="col-lg-6 mx-auto" style="margin-top: -8vh;">\n <p class="lead mt-3 mb-5"></p>\n\n\n \x3c!-- Preconfigured Devices --\x3e\n <div class="d-grid gap-2 justify-content-center">\n\n <div class="row gap-2" id="findDevice-collapsableCards" style="display: none;">\n <div class="col">\n <div\n class="card"\n style="width: 42rem; height: 11rem"\n id="findDevice"\n >\n <div class="card-body">\n <h5 class="card-title">(1) Choose Device</h5>\n <p class="card-text">\n Please select the device you are taking the test on.\n </p>\n <select id="deviceList" onchange="selectDevice()"></select>\n </div>\n </div>\n </div>\n </div>\n\n\n <div class="d-grid gap-2 justify-content-center">\n\n\n \x3c!-- ROW 1: Full Screen | Get Screen Size --\x3e\n <div class="row gap-2" id="screenSize-collapsableCards">\n <div class="col" >\n <div class="card" style="width:20rem; height:11rem" id="card-fullscreen">\n <div class="card-body">\n <h5 class="card-title">(1) Full Screen</h5>\n <p class="card-text">Do not exit out of \'Full Screen\' mode for the remainder of this study.</p>\n <button type="button" class="btn btn-primary" id="fullscreen" onclick="openFullscreen()">Make Fullscreen</button>\n </div>\n </div>\n </div>\n <div class="col">\n <div class="card" style="width:20rem;height:11rem" id="card-screen-size">\n <div class="card-body">\n <h5 class="card-title">(2) Screen Size</h5>\n <p class="card-text">We need this to calibrate your device\'s screen size.</p>\n <button type="button" class="btn btn-primary" id="measureScreen" onclick="getScreenSize()">Measure Screen Size</button>\n </div>\n </div>\n </div>\n </div>\n\n\n \x3c!-- ROW 2: Webcam Centered | Height of Webcam --\x3e\n <div class="row gap-2" id="webcam-collapsableCards">\n <div class="col">\n <div class="card" style="width: 20rem;" id="card-webcam-center">\n <div class="card-body">\n <h5 class="card-title">(3) Is your webcam centred?</h5>\n <h6 class="card-subtitle mb-2 text-muted">It is expected that for laptops the webcam is already centred.</h6>\n <p class="card-text">If you are using a separate webcam, please centre this in the middle (as seen in the image below).</p>\n <img src="https://eyetrackingdata.blob.core.windows.net/public/Images/webcamCentered.jpg" alt="center webcam" width="100%" style="padding-bottom:10px;">\n <button type="button" class="btn btn-primary" id="measureDistanceFromScreeen" onclick="getwebcamCentered()">My Webcam is Centred</button>\n </div>\n </div>\n </div>\n <div class="col">\n <div class="card" style="width: 20rem;" id="card-height-camera">\n <div class="card-body">\n <h5 class="card-title">(4) Height of Webcam</h5>\n <p class="card-text">This is the distance between the centre of your webcam\'s lens and the top bezel of your screen (image provided for example)</p>\n <img src="https://eyetrackingdata.blob.core.windows.net/public/Images/webcamPosition.PNG" alt="center webcam" width="100%" style="padding-bottom:10px;">\n <label for="heightInput">Height in cm:</label>\n <input type="number" id="heightInput" name="heightInput" required\n minlength="1" maxlength="8" size="10" value="2">\n </br></br>\n <button type="button" class="btn btn-primary" id="getHeightbutton" onclick="getHeightWebcam()">Done</button>\n </div>\n </div>\n </div>\n </div>\n\n\n \x3c!-- ROW 3: Camera Access --\x3e\n <div class="row gap-2" id="access-cameracollapsableCards">\n <div class="col">\n <div class="card" style="width: 42rem;height:11rem" id="card-camera">\n <div class="card-body">\n <h5 class="card-title">(5) Camera Access</h5>\n <p class="card-text">Please provide access to your camera to record your eye movements.</p>\n <button type="button" class="btn btn-primary" id="start-camera">Provide Access</button>\n </div>\n </div>\n </div>\n </div>\n\n\n \x3c!-- ROW 4: Check Recording --\x3e\n <div class="row gap-2" style="padding-top:1rem;" id="check-cameracollapsableCards">\n <div class="col">\n <div class="card" style="width:42rem" id="card-final-check">\n <div class="card-body">\n <h5 class="card-title">(6) Final Checks</h5>\n <p>Please ensure your video is well-lit and centered. Speak at a normal volume to check the audio level below.</p>\n\n <div class="column left">\n <img src="https://eyetrackingdata.blob.core.windows.net/public/Images/badlighting.jpg" alt="center webcam" width="100%" style="padding-bottom:10px;">\n <b>Bad Lighting</b> &#10060 </br>\n (Make sure eyes and face are clearly visible)\n </div>\n <div class="column middle">\n <img src="https://eyetrackingdata.blob.core.windows.net/public/Images/glassesReflection.jpg" alt="center webcam" width="100%" style="padding-bottom:10px;">\n <b>Glasses On</b> &#10060 </br>\n (Remove Glasses)\n </div>\n <div class="column middle">\n <img src="https://eyetrackingdata.blob.core.windows.net/public/Images/goodPosition.jpg" alt="center webcam" width="100%" style="padding-bottom:10px;">\n <b>Ideal View</b>&#10004 &#65039 </br>\n (Face close to camera and centered with clear view of eyes)\n </div>\n <div class="container">\n <video autoplay="true" id="videoElement" style="width:100%; background-color: darkgray;"></video>\n <canvas id="audio-visualization" width="640" height="100"></canvas>\n </div>\n\n <button type="button" class="btn btn-primary" id="Final-Check" onclick="finalCheckComplete()" disabled >I\'m Looking and Sounding Great</button>\n </div>\n </div>\n </div> \n </div>\n \n\n \x3c!-- ROW 5: User Details --\x3e\n <div class="row gap-2" style="padding-top:1rem;">\n <div class="col">\n <div class="card" style="width:42rem" id="card-camera">\n <div class="card-body">\n <h5 class="card-title">(8) Ready to Start?</h5>\n <label for="idInput">Participant ID:</label>\n <input type="text" id="idInput" name="idInput" required\n minlength="1" maxlength="100" size="10">\n </br></br>\n <button type="button" class="btn btn-primary" id="confirmButton" disabled>Continue</button>\n </div>\n </div>\n </div> \n </div>\n </div>\n </div>\n </div>\n\n \x3c!-- Audio Playing --\x3e \n <audio autoplay id="voiceover"> </audio>\n\n </body>\n\n<script data-dynamic>\n\nvar voiceover = document.getElementById(\'voiceover\'); // TO DO: Doesn\'t have enough time to load? Only plays if the consent screen shows up first\nvoiceover.src = `https://eyetrackingdata.blob.core.windows.net/public/Audios/deviceConfig.mp3`;\n\nRemoteCalibrator.init();\n\nvar desktop = document.documentElement;\nvar finalCheckButton = document.getElementById("Final-Check")\nvar confirmButton = document.getElementById("confirmButton");\nvar cardFullscreen = document.getElementById("card-fullscreen");\nvar cardScreenSize = document.getElementById("card-screen-size");\nvar cardDistanceScreen = document.getElementById("card-distance-screen");\nvar cardcamera = document.getElementById("card-camera");\nvar cardwebcamCenter = document.getElementById("card-webcam-center");\nvar cardheightcamera = document.getElementById("card-height-camera")\nvar cardfinalcheck = document.getElementById("card-final-check");\nvar heightInput_textbox = document.getElementById("heightInput")\nvar idInput_textbox = document.getElementById("idInput")\nvar video = document.querySelector("#videoElement");\nvar deviceConfigs = {}\n\nvar audioDetected = false;\nvar fullScreen = false;\nvar screenSizeCalibrated = false;\nvar cameraStarted = false;\nvar HeightWebcamEntered = false;\nvar finalcheck = false;\nvar webcamCentered = false;\nvar prolificID;\nvar screenWidth=0;\nvar screenHeight=0;\nvar screenWidthPX=window.screen.width;\nvar screenHeightPX=window.screen.height;\nvar webcamHeight=0;\nvar normalizedFocalLength=0;\nvar distance = 0;\nvar webcamInfo;\n\n\nfunction makeid(length) {\n var result = \'\';\n var characters = \'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\';\n var charactersLength = characters.length;\n for ( var i = 0; i < length; i++ ) {\n result += characters.charAt(Math.floor(Math.random() * \n charactersLength));\n }\n return result;\n}\n\n\nfunction openFullscreen() {\n if (desktop.requestFullscreen) {\n desktop.requestFullscreen();\n } else if (desktop.webkitRequestFullscreen) { /* Safari */\n desktop.webkitRequestFullscreen();\n } else if (desktop.msRequestFullscreen) { /* IE11 */\n desktop.msRequestFullscreen();\n }\n\n screenWidthPX = window.screen.width;\n screenHeightPX = window.screen.height;\n\n fullScreen = true\n cardFullscreen.style.backgroundColor = \'#bcf5bc\'\n\n checkAllComplete()\n}\n\nfunction getScreenSize(){\n RemoteCalibrator.screenSize({}, data => {\n console.log(`ScreenWidth: ${data.value.screenWidthCm}cm.`)\n console.log(`ScreenHeight: ${data.value.screenHeightCm}cm.`)\n\n screenWidth = data.value.screenWidthCm\n screenHeight = data.value.screenHeightCm\n\n if (screenWidth!=null && screenHeight!=null) {\n screenSizeCalibrated = true\n cardScreenSize.style.backgroundColor = \'#bcf5bc\'\n console.log(screenSizeCalibrated)\n }\n checkAllComplete()\n }) \n}\n\n\nfunction getwebcamCentered(){\n webcamCentered = true\n cardwebcamCenter.style.backgroundColor = \'#bcf5bc\'\n checkAllComplete()\n}\n\nfunction getHeightWebcam(){\n if (heightInput_textbox.value>0){\n HeightWebcamEntered = true\n webcamHeight = heightInput_textbox.value\n heightInput_textbox.disabled = true\n cardheightcamera.style.backgroundColor = \'#bcf5bc\'\n }\n checkAllComplete()\n}\n\nfunction finalCheckComplete(){\n let userConfirmed = true\n if (!audioDetected) {\n userConfirmed = confirm("We couldn\'t hear you, are you sure your microphone is working? Click OK to continue anyway, or Cancel to check your settings.");\n }\n if (userConfirmed) {\n finalcheck = true\n cardfinalcheck.style.backgroundColor = \'#bcf5bc\'\n checkAllComplete()\n }\n}\n\nfunction selectDevice() {\n const dropdown = document.getElementById("deviceList");\n const selectedValue = dropdown.options[dropdown.selectedIndex].value;\n\n // Check if the selected device is in deviceConfig, default to "custom" otherwise\n const selectedDeviceConfig =\n deviceConfigs[selectedValue] || deviceConfigs.custom;\n\n console.log(selectedDeviceConfig)\n // Call the handleDevice function with the selected device\'s configuration\n document.getElementById("findDevice").style.backgroundColor = "#bcf5bc";\n handleDevice(selectedDeviceConfig);\n\n}\n\ndocument.querySelector("#start-camera").addEventListener(\'click\', async () => {\n const audioContext = new AudioContext();\n const canvas = document.getElementById(\'audio-visualization\');\n const ctx = canvas.getContext(\'2d\');\n\n // Now requesting both audio and video\n const cameraStream = await navigator.mediaDevices.getUserMedia({\n video: { width: { ideal: 1920 }, height: { ideal: 1080 }, frameRate: { ideal: 60, max: 60 } },\n audio: true // Enabled audio\n });\n\n if (cameraStream.getVideoTracks().length > 0) {\n const { width, height } = cameraStream.getVideoTracks()[0].getSettings();\n const videoTrack = cameraStream.getVideoTracks()[0];\n webcamInfo = videoTrack.getCapabilities\n ? videoTrack.getCapabilities()\n : {};\n\n webcamInfo[\'image_width\'] = width\n webcamInfo[\'image_height\'] = height\n\n console.log(`${width}x${height}`); // Log video resolution\n\n const video = document.querySelector(\'video\');\n video.srcObject = cameraStream;\n\n if (height > 0) {\n cardcamera.style.backgroundColor = \'#bcf5bc\';\n cameraStarted = true;\n video.style.backgroundColor = \'#bcf5bc\';\n finalCheckButton.disabled = false;\n checkAllComplete();\n } else {\n video.style.backgroundColor = \'#FA8072\';\n alert("Your webcam does not meet our resolution standards");\n }\n }\n\n // Set up audio analyser\n const micSource = audioContext.createMediaStreamSource(cameraStream);\n const analyser = audioContext.createAnalyser();\n analyser.fftSize = 2048;\n micSource.connect(analyser);\n const bufferLength = analyser.frequencyBinCount;\n const dataArray = new Uint8Array(bufferLength);\n\n function draw() {\n requestAnimationFrame(draw);\n analyser.getByteTimeDomainData(dataArray);\n\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n\n\n ctx.lineWidth = 2;\n ctx.strokeStyle = \'rgb(0, 0, 0)\';\n ctx.beginPath();\n\n const sliceWidth = canvas.width * 1.0 / bufferLength;\n let x = 0;\n let sum = 0;\n\n for (let i = 0; i < bufferLength; i++) {\n const v = dataArray[i] / 128.0;\n const y = v * canvas.height / 2;\n\n if (i === 0) {\n ctx.moveTo(x, y);\n } else {\n ctx.lineTo(x, y);\n }\n\n sum += (dataArray[i] - 128) * (dataArray[i] - 128); // Summing for RMS calculation\n x += sliceWidth;\n }\n\n ctx.lineTo(canvas.width, canvas.height / 2);\n ctx.stroke();\n let rms = Math.sqrt(sum / bufferLength);\n if (rms > 0.01) {\n audioDetected = true; // Update the audioDetected flag if audio is sufficiently loud\n }\n\n }\n\n draw(); // Start the drawing function\n\n});\n\n\nfunction checkAllComplete() {\n const hasCollapsedCards = Array.from(document.querySelectorAll(\'.card-title\')).some(card => \n card.closest(\'.card\').style.display === \'none\' || card.closest(\'.card\').offsetParent === null\n );\n\n const hasCameraCollapsedCards = Array.from(document.querySelectorAll(\'[id*="-cameracollapsableCards"]\')).every(element => \n element.style.display === \'none\' || element.offsetParent === null\n );\n\n const allConditionsMet = fullScreen && screenSizeCalibrated && cameraStarted && webcamCentered && HeightWebcamEntered && finalcheck;\n const minimalConditionsMet = cameraStarted && finalcheck;\n const bareConditionsMet = screenSizeCalibrated\n if ((hasCollapsedCards && minimalConditionsMet) || (!hasCollapsedCards && allConditionsMet) || (hasCameraCollapsedCards && bareConditionsMet)) {\n confirmButton.classList.remove(\'btn-secondary\')\n confirmButton.classList.add(\'btn-primary\')\n confirmButton.disabled = false;\n }\n}\n\n\n// function continueToTest(){\n// video.remove()\n// prolificID = idInput_textbox.value.trim() ? idInput_textbox.value : makeid(10);\n\n// localStorage.prolificID = prolificID\n// localStorage.screenHeight = screenHeight\n// localStorage.screenWidth = screenWidth\n// localStorage.webcamHeight = webcamHeight\n// localStorage.distance = distance\n// window.location.href = "criticalSpacingMenu_six.html";\n\n// }\n\n<\/script>',document.body.appendChild(n),await async function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=t[e];n.src&&await Xc(n.src)}}(n),await async function(e){Object.keys(e).forEach((t=>{window[t]=e[t]}))}($c),function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=document.createElement("script");n.text=t[e].text,document.head.appendChild(n).parentNode.removeChild(n)}}(n),function(e){""!==e.firekit.task.variantParams.deviceConfigFile&&collapseCards("Toggle");0==e.firekit.task.variantParams.bEyeTracking&&collapseCamera();""!==e.firekit.user.assessmentPid&&inputParticipantName(e.firekit.user.assessmentPid);if(""!==e.firekit.task.variantParams.deviceConfigFile){var t=`https://eyetrackingdata.blob.core.windows.net/public/config/${e.firekit.task.variantParams.deviceConfigFile}.json`;updateDeviceConfigFromJSON(t)}}(e),await new Promise((i=>{const a=document.getElementById("confirmButton");a&&a.addEventListener("click",(async()=>{try{var a=s.session.get("config").firekit.user.assessmentUid+"_"+(idInput_textbox.value.trim()?idInput_textbox.value:makeid(10));a!==e.firekit.user.assessmentPid&&e.firekit.updateUser({assessmentPid:a}),s.session.set("id",a),s.session.set("deviceConfig",{screenWidth:parseFloat(screenWidth),screenHeight:parseFloat(screenHeight),screenWidthPX:parseFloat(screenWidthPX),screenHeightPX:parseFloat(screenHeightPX),webcamHeight:parseFloat(webcamHeight),deviceInfo:Kc(),webcamInfo:webcamInfo,bEyeTracking:e.firekit.task.variantParams.bEyeTracking,storeVideo:e.firekit.task.variantParams.storeVideo,storeAudio:e.firekit.task.variantParams.storeAudio}),n.innerHTML=t;const o=await async function(e){var t="openfolder.txt",n="text/plain";try{const i=await fetch(`https://us-central1-webapp-af756.cloudfunctions.net/getUploadUrlFunction?fileName=${t}&mimeType=${n}&parentDir=${e}`);if(!i.ok)throw new Error("Failed to fetch upload URL");return await i.text()}catch(e){throw window.console.log("Error fetching upload URL:",e),e}}(s.session.get("id"));window.console.log("Folder Created:",o),function(e){!function(e){Object.keys(e).forEach((e=>{const t=Object.getOwnPropertyDescriptor(window,e);t&&t.configurable?delete window[e]:console.log(`Cannot remove ${e} from window; it may be non-configurable.`)}))}(e);document.querySelectorAll("script[data-dynamic]").forEach((e=>e.parentNode.removeChild(e)))}($c),n.remove(),i()}catch(e){window.console.log("Error:",e)}}))}))}function Xc(e){return new Promise(((t,n)=>{const i=document.createElement("script");i.src=e,i.onload=t,i.onerror=n,document.head.appendChild(i)}))}window.store=s;var Gc=[];async function Jc(){try{const e=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:60,max:60}},audio:!0});if(camera_stream=e,camera_stream&&camera_stream.active)return Gc=[],videoRecorder=new MediaRecorder(camera_stream),videoRecorder.ondataavailable=e=>{e.data.size>0&&Gc.push(e.data)},Promise.resolve(camera_stream);throw new Error("Camera stream is not active")}catch(e){return console.error("Error accessing media devices:",e),Promise.reject(e)}}var Qc=4;function Zc(e){0===--Qc?(document.getElementById("instruction").style.display="none","function"==typeof e&&(e(),Qc=4)):(document.getElementById("instruction").innerHTML="<h1>"+Qc+"</h1>",setTimeout((function(){Zc(e)}),1e3))}function el(){desktop.requestFullscreen?desktop.requestFullscreen():desktop.webkitRequestFullscreen?desktop.webkitRequestFullscreen():desktop.msRequestFullscreen&&desktop.msRequestFullscreen()}var tl=Object.freeze({__proto__:null,_pageCompleted:!1,get countdown(){return Qc},generateGridCoordinates:function(e){let t,n,i,a;if(console.log(e.screenWidth,e.screenHeight,e.screenWidthPX,e.screenHeightPX),e.screenWidth>0&&e.screenHeight>0){const i=3.25;t=2.75*(e.screenWidthPX/e.screenWidth),n=i*(e.screenHeightPX/e.screenHeight)}else{t=.8*e.screenWidthPX/9,n=.8*e.screenHeightPX/4}i=9*t,a=4*n;const o=(e.screenWidthPX-i)/2,s=(e.screenHeightPX-a)/2,r=[];for(let e=0;e<4;e++)for(let i=0;i<9;i++){const a=o+i*t+t/2,c=s+e*n+n/2;r.push({x:a,y:c,width:t,height:n})}for(let e=r.length-1;e>0;e--){const t=Math.floor(Math.random()*(e+1));[r[e],r[t]]=[r[t],r[e]]}return r},generateStimulusOrder:function(e){const t=e.stimulus.slice(),n=Math.ceil(36/t.length),i=[];for(let e=0;e<n;e++){const e=t.sort((()=>Math.random()-.5));i.push(...e)}for(let e=1;e<i.length;e++)if(i[e]===i[e-1]){const t=i[e];i[e]=i[e+1],i[e+1]=t,String.fromCharCode(i[e].charCodeAt(0)-1)}return i.slice(0,36)},giveAccess:Jc,gridHeightCM:13,gridWidthCM:24.75,numCols:9,numRows:4,openFullscreen:el,startTest:async function(e){await Jc(),el(),Zc(e)},updateCountdown:Zc,get videoChunks(){return Gc}});async function nl(e){const t=document.createElement("div");t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.width="100%",await async function(e){Object.keys(e).forEach((t=>{window[t]=e[t]}))}(tl),t.innerHTML='<!DOCTYPE html>\n<html lang="en">\n<head>\n <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>Image and Audio Recording</title>\n\n \x3c!-- <script data-dynamic src="./voiceCalibration.js"><\/script> --\x3e\n</head>\n\n<style>\n \n body {\n margin: 0;\n min-height: 100vh; /* Ensure body takes the full viewport height */\n display: flex; /* Enable Flexbox */\n justify-content: center; /* Center content horizontally */\n align-items: center; /* Center content vertically */\n font-family: sans-serif;\n }\n\n stim {\n position: absolute;\n height: auto;\n cursor: pointer;\n }\n \n #instruction {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n\n \n #confirmContainer {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n\n</style>\n\n\n<body>\n\n \x3c!-- Center Instructions Panel --\x3e\n <div id="calibrationContentArea"> \n <div class="row gap-2" id="instruction">\n <div class="col">\n <div class="card" style="width: 45rem; height:39rem">\n <div class="card-body" style="text-align: center;">\n <h3 class="card-title" id="calibrationTitle"> <b> Calibration Phase </b> </h3>\n <h4 class="card-text"> Now, we need to calibrate the system. </h4>\n <h4 class="card-text" id="calibrationDescription"></h4>\n <div style="text-align: center; margin-bottom: 3vh;">\n <img id="calibrationImage" src="https://eyetrackingdata.blob.core.windows.net/public/Images/squareAddition_white.png" width="350px">\n </div>\n <div class="btn-group" role="group" aria-label="Basic example">\n \x3c!-- <button type="button" class="btn btn-primary" id="giveAccessButton" onclick="giveAccess()">Give Access to Mic/Camera</button> --\x3e\n \x3c!-- <br> --\x3e\n <button type="button" class="btn btn-primary" id="startTestButton" onclick="startTest(displayNextStim)">Start</button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n \x3c!-- <center> <img src="./img/letter-calibration-explanation.gif" width="350vh" style="margin-bottom: 3vh;"> </center> --\x3e\n\n \x3c!-- Audio Playing --\x3e \n <audio autoplay id="voiceover"> </audio>\n\n \x3c!-- Confirm Button --\x3e\n <div class="row gap-2" id="confirmContainer" style="display: none;">\n <div class="card-body" style="text-align: center;">\n <h3> Calibration complete! </h3>\n <button type="button" class="btn btn-primary" id="confirmButton"> Continue </button>\n </div>\n </div>\n\n<script data-dynamic>\n\nvar deviceConfig = store.session.get(\'deviceConfig\')\n// var deviceConfig = {screenWidth: 29, screenHeight: 16.2, screenWidthPX: 960, screenHeightPX: 540, webcamHeight: 0.5}\nvar testConfig = store.session.get(\'testConfig\')\n// var testConfig = {dir: "https://eyetrackingdata.blob.core.windows.net/public/assets/Letter",\n// stimulus : ["C.svg", "D.svg", "H.svg", "K.svg", "N.svg", "O.svg", "R.svg", "S.svg", "V.svg", "Z.svg"],\n// sizecm: 2}\n\nif (testConfig[\'testname\'] === \'Letter\') {\n var subtestText = [\'Letter\', \'letter\']\n} else {\n var subtestText = [\'Number\', \'number\']\n}\n\nvar voiceover = document.getElementById(\'voiceover\');\nvoiceover.src = `https://eyetrackingdata.blob.core.windows.net/public/Audios/${subtestText[1]}Calibration.mp3`;\n\ndocument.body.addEventListener(\'click\', function() {\n voiceover.pause();\n voiceover.currentTime = 0; // Stop the voiceover whenever a click is detected \n});\n \nvar desktop = document.documentElement;\nvar camera_stream;\nvar audioRecorder;\nvar videoRecorder;\nvar videoChunks = [];\n\ncounter = 0; \n\n// Getting the div element by its ID\n// const calibrationDiv = document.getElementById(\'calibrationContentArea\');\n\n// Text you want to edit with ${} variables \n// const calibrationDetails = `\n// <div class="row gap-2" id="instruction">\n// <div class="col">\n// <div class="card" style="width: 45rem; height:39rem">\n// <div class="card-body" style="text-align: center;">\n// <h3 class="card-title"> <b> ${subtestText[0]} Calibration Phase </b> </h3>\n// <h4 class="card-text"> Now, we need to recalibrate the navigation system. </h4>\n// <h4 class="card-text"> You will see ${subtestText[1]}s pop up on the screen. Say the ${subtestText[1]} out loud <b>first</b> and then click on the ${subtestText[1]} to go to the next one. </h4>\n// <center> <img src="./img/${subtestText[1]}-calibration-explanation.gif" width="350vh" style="margin-bottom: 3vh;"> </center>\n// <div class="btn-group" role="group" aria-label="Basic example">\n// <button type="button" class="btn btn-primary" id="giveAccessButton" onclick="giveAccess()">Give Access to Mic/Camera</button>\n// <br>\n// <button type="button" class="btn btn-primary" id="startTestButton" onclick="startTest(displayNextStim)" disabled>Start</button>\n// </div>\n// </div>\n// </div>\n// </div>\n// </div>\n// `;\n\n// // Inserting the HTML code into the div\n// calibrationDiv.innerHTML = calibrationDetails;\n\nvar gridCoordinates = generateGridCoordinates(deviceConfig)\nvar shuffledImages = generateStimulusOrder(testConfig)\n\nvar _gridCoordinates = [] \n// gridCoordinates;\nvar _shuffledImages = []\n// shuffledImages.map(filename => filename.split(\'.\')[0]).reverse();\nvar _parentDir = store.session.get("id")\nvar _videoURL = []\nvar _deviceConfig = deviceConfig\nvar _testConfig = testConfig\n\n\nasync function displayNextStim() {\n const position = gridCoordinates.pop();\n if (position) {\n await stopRecording();\n await startRecording();\n const cell = document.createElement(\'div\');\n cell.id = \'cell\'; \n cell.style.width = `${position.width}px`;\n cell.style.height = `${position.height}px`;\n cell.style.left = `${position.x}px`; // Adjust for half of the cell width\n cell.style.top = `${position.y}px`; // Adjust for half of the cell height\n cell.style.position = \'absolute\'; // Ensure the position is set to absolute\n cell.style.transform = \'translate(-50%, -50%)\'; // Center the content within the element\n cell.style.display = \'flex\'; // Set display to flex to use flexbox properties\n cell.style.justifyContent = \'center\'; // Center horizontally\n cell.style.alignItems = \'center\'; // Center vertically\n cell.setAttribute(\'draggable\', \'false\'); // Prevent the cell itself from being draggable\n\n const stim = document.createElement(\'img\');\n const randomStimulus = shuffledImages.pop();\n stim.id = \'stim\'; \n stim.src = `${testConfig[\'dir\']}/${randomStimulus}`;\n stim.style.width = \'50%\'; // Make the image fill the cell\n stim.setAttribute(\'draggable\', \'false\'); // Prevent the image from being draggable\n\n cell.appendChild(stim);\n\n // stim.style.width = `${0.50*position.width}px`;\n // stim.style.left = `${position.x}px`;\n // stim.style.top = `${position.y}px`;\n // stim.style.position = \'absolute\'; // Ensure the position is set to absolute\n // stim.style.transform = \'translate(-50%, -50%)\'; // Center the content within the element\n var clickRate = 0\n cell.addEventListener(\'click\', () => {\n clickRate++\n if (clickRate==1){\n handleStimClick(randomStimulus, cell, stim); \n }\n });\n document.body.appendChild(cell);\n } else {\n _pageCompleted = true\n }\n}\n\nasync function handleStimClick(randomStimulus,cell,stim) {\n console.log(\'Image clicked!\');\n const timestamp = new Date().getTime();\n\n document.getElementById(\'cell\').disabled = true\n\n setTimeout(async () => {\n await stopRecording(); // Stop recording when stimulus is clicked\n const stimPosition = stim.getBoundingClientRect();\n stimPosition.x = stimPosition.x+ (stimPosition.width)/2\n stimPosition.y = stimPosition.y+ (stimPosition.height)/2\n var filename = randomStimulus.slice(0, -4) + \'_\' + stimPosition.x + \'_\' + stimPosition.y + \'_\' + timestamp\n filename = filename.replace(/\\./g, \'deci\') + \'.webm\'\n saveRecordings(filename= filename ,parentDir=store.session.get("id")); // Save the recorded audio and video\n _videoURL.push(filename)\n\n const gridCoordinatesObject = {\n x: parseFloat(cell.style.left),\n y: parseFloat(cell.style.top),\n width: parseFloat(cell.style.width),\n height: parseFloat(cell.style.height),\n stim_x:stimPosition.x,\n stim_y:stimPosition.y,\n stim_width:stimPosition.width,\n stim_height:stimPosition.height,\n };\n\n _gridCoordinates.push(gridCoordinatesObject)\n _shuffledImages.push(randomStimulus.slice(0, -4))\n document.getElementById(\'cell\').remove();\n // Delay displayNextStim by an additional 100ms\n setTimeout(() => {\n displayNextStim(); // Display the next image\n }, 200);\n\n },750); // Delay everything here by 200ms\n}\n\n\n\n<\/script>\n\n</body>\n</html>\n',document.body.appendChild(t),await async function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=t[e];n.src&&await il(n.src)}}(t),function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=document.createElement("script");n.text=t[e].text,document.head.appendChild(n).parentNode.removeChild(n)}}(t),document.getElementById("calibrationTitle").innerHTML=`<b>${subtestText[0]} Calibration Phase</b>`,document.getElementById("calibrationDescription").innerHTML=`You will see ${subtestText[1]}s pop up on the screen. Say the ${subtestText[1]} out loud <b>first</b> and then click on the ${subtestText[1]} to go to the next one.`,document.getElementById("calibrationImage").src=`https://eyetrackingdata.blob.core.windows.net/public/Images/${subtestText[1]}-calibration-explanation.gif`,await new Promise((n=>{!function i(){if(_pageCompleted){const i={assessment_type:testConfig.testname,assessment_stage:"Calibration",stimulusPosition:_gridCoordinates,stimulus:_shuffledImages,recordedVideo:_videoURL,parentDir:_parentDir,correct:1,deviceConfig:_deviceConfig,testConfig:_testConfig};e.firekit.writeTrial(i),t.remove(),function(e){!function(e){Object.keys(e).forEach((e=>{const t=Object.getOwnPropertyDescriptor(window,e);t&&t.configurable?delete window[e]:console.log(`Cannot remove ${e} from window; it may be non-configurable.`)}))}(e);document.querySelectorAll("script[data-dynamic]").forEach((e=>e.parentNode.removeChild(e)))}(tl),n()}else setTimeout(i,2e3)}()}))}function il(e){return new Promise(((t,n)=>{const i=document.createElement("script");i.src=e,i.onload=t,i.onerror=n,document.head.appendChild(i)}))}window.store=s;function al(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var ol=function(e){for(var t=new Array(e),n=0;n<e;++n)t[n]=n;return t},sl=function(e){return null!=e&&(al(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&al(e.slice(0,0))}(e)||!!e._isBuffer)},rl="undefined"!=typeof Float64Array;function cl(e,t){return e[0]-t[0]}function ll(){var e,t=this.stride,n=new Array(t.length);for(e=0;e<n.length;++e)n[e]=[Math.abs(t[e]),e];n.sort(cl);var i=new Array(n.length);for(e=0;e<i.length;++e)i[e]=n[e][1];return i}function pl(e,t){var n=["View",t,"d",e].join("");t<0&&(n="View_Nil"+e);var i="generic"===e;if(-1===t){var a="function "+n+"(a){this.data=a;};var proto="+n+".prototype;proto.dtype='"+e+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+n+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+n+"(a){return new "+n+"(a);}";return new Function(a)()}if(0===t){a="function "+n+"(a,d) {this.data = a;this.offset = d};var proto="+n+".prototype;proto.dtype='"+e+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+n+"_copy() {return new "+n+"(this.data,this.offset)};proto.pick=function "+n+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+n+"_get(){return "+(i?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+n+"_set(v){return "+(i?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+n+"(a,b,c,d){return new "+n+"(a,d)}";return new Function("TrivialArray",a)(ul[e][0])}a=["'use strict'"];var o=ol(t),s=o.map((function(e){return"i"+e})),r="this.offset+"+o.map((function(e){return"this.stride["+e+"]*i"+e})).join("+"),c=o.map((function(e){return"b"+e})).join(","),l=o.map((function(e){return"c"+e})).join(",");a.push("function "+n+"(a,"+c+","+l+",d){this.data=a","this.shape=["+c+"]","this.stride=["+l+"]","this.offset=d|0}","var proto="+n+".prototype","proto.dtype='"+e+"'","proto.dimension="+t),a.push("Object.defineProperty(proto,'size',{get:function "+n+"_size(){return "+o.map((function(e){return"this.shape["+e+"]"})).join("*"),"}})"),1===t?a.push("proto.order=[0]"):(a.push("Object.defineProperty(proto,'order',{get:"),t<4?(a.push("function "+n+"_order(){"),2===t?a.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===t&&a.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):a.push("ORDER})")),a.push("proto.set=function "+n+"_set("+s.join(",")+",v){"),i?a.push("return this.data.set("+r+",v)}"):a.push("return this.data["+r+"]=v}"),a.push("proto.get=function "+n+"_get("+s.join(",")+"){"),i?a.push("return this.data.get("+r+")}"):a.push("return this.data["+r+"]}"),a.push("proto.index=function "+n+"_index(",s.join(),"){return "+r+"}"),a.push("proto.hi=function "+n+"_hi("+s.join(",")+"){return new "+n+"(this.data,"+o.map((function(e){return["(typeof i",e,"!=='number'||i",e,"<0)?this.shape[",e,"]:i",e,"|0"].join("")})).join(",")+","+o.map((function(e){return"this.stride["+e+"]"})).join(",")+",this.offset)}");var p=o.map((function(e){return"a"+e+"=this.shape["+e+"]"})),u=o.map((function(e){return"c"+e+"=this.stride["+e+"]"}));a.push("proto.lo=function "+n+"_lo("+s.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+u.join(","));for(var d=0;d<t;++d)a.push("if(typeof i"+d+"==='number'&&i"+d+">=0){d=i"+d+"|0;b+=c"+d+"*d;a"+d+"-=d}");a.push("return new "+n+"(this.data,"+o.map((function(e){return"a"+e})).join(",")+","+o.map((function(e){return"c"+e})).join(",")+",b)}"),a.push("proto.step=function "+n+"_step("+s.join(",")+"){var "+o.map((function(e){return"a"+e+"=this.shape["+e+"]"})).join(",")+","+o.map((function(e){return"b"+e+"=this.stride["+e+"]"})).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(d=0;d<t;++d)a.push("if(typeof i"+d+"==='number'){d=i"+d+"|0;if(d<0){c+=b"+d+"*(a"+d+"-1);a"+d+"=ceil(-a"+d+"/d)}else{a"+d+"=ceil(a"+d+"/d)}b"+d+"*=d}");a.push("return new "+n+"(this.data,"+o.map((function(e){return"a"+e})).join(",")+","+o.map((function(e){return"b"+e})).join(",")+",c)}");var m=new Array(t),h=new Array(t);for(d=0;d<t;++d)m[d]="a[i"+d+"]",h[d]="b[i"+d+"]";a.push("proto.transpose=function "+n+"_transpose("+s+"){"+s.map((function(e,t){return e+"=("+e+"===undefined?"+t+":"+e+"|0)"})).join(";"),"var a=this.shape,b=this.stride;return new "+n+"(this.data,"+m.join(",")+","+h.join(",")+",this.offset)}"),a.push("proto.pick=function "+n+"_pick("+s+"){var a=[],b=[],c=this.offset");for(d=0;d<t;++d)a.push("if(typeof i"+d+"==='number'&&i"+d+">=0){c=(c+this.stride["+d+"]*i"+d+")|0}else{a.push(this.shape["+d+"]);b.push(this.stride["+d+"])}");return a.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),a.push("return function construct_"+n+"(data,shape,stride,offset){return new "+n+"(data,"+o.map((function(e){return"shape["+e+"]"})).join(",")+","+o.map((function(e){return"stride["+e+"]"})).join(",")+",offset)}"),new Function("CTOR_LIST","ORDER",a.join("\n"))(ul[e],ll)}var ul={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],bigint64:[],biguint64:[],buffer:[],generic:[]};var dl=n((function(e,t,n,i){if(void 0===e)return(0,ul.array[0])([]);"number"==typeof e&&(e=[e]),void 0===t&&(t=[e.length]);var a=t.length;if(void 0===n){n=new Array(a);for(var o=a-1,s=1;o>=0;--o)n[o]=s,s*=t[o]}if(void 0===i){i=0;for(o=0;o<a;++o)n[o]<0&&(i-=(t[o]-1)*n[o])}for(var r=function(e){if(sl(e))return"buffer";if(rl)switch(Object.prototype.toString.call(e)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped";case"[object BigInt64Array]":return"bigint64";case"[object BigUint64Array]":return"biguint64"}return Array.isArray(e)?"array":"generic"}(e),c=ul[r];c.length<=a+1;)c.push(pl(r,c.length-1));return(0,c[a+1])(e,t,n,i)})),ml={};var hl=function(e,t,n){return 0===e.length?e:t?(n||e.sort(t),function(e,t){for(var n=1,i=e.length,a=e[0],o=e[0],s=1;s<i;++s)if(o=a,t(a=e[s],o)){if(s===n){n++;continue}e[n++]=a}return e.length=n,e}(e,t)):(n||e.sort(),function(e){for(var t=1,n=e.length,i=e[0],a=e[0],o=1;o<n;++o,a=i)if(a=i,(i=e[o])!==a){if(o===t){t++;continue}e[t++]=i}return e.length=t,e}(e))};function fl(e,t,n){var i,a,o=e.length,s=t.arrayArgs.length,r=t.indexArgs.length>0,c=[],l=[],p=0,u=0;for(i=0;i<o;++i)l.push(["i",i,"=0"].join(""));for(a=0;a<s;++a)for(i=0;i<o;++i)u=p,p=e[i],0===i?l.push(["d",a,"s",i,"=t",a,"p",p].join("")):l.push(["d",a,"s",i,"=(t",a,"p",p,"-s",u,"*t",a,"p",u,")"].join(""));for(l.length>0&&c.push("var "+l.join(",")),i=o-1;i>=0;--i)p=e[i],c.push(["for(i",i,"=0;i",i,"<s",p,";++i",i,"){"].join(""));for(c.push(n),i=0;i<o;++i){for(u=p,p=e[i],a=0;a<s;++a)c.push(["p",a,"+=d",a,"s",i].join(""));r&&(i>0&&c.push(["index[",u,"]-=s",u].join("")),c.push(["++index[",p,"]"].join(""))),c.push("}")}return c.join("\n")}function gl(e,t,n){for(var i=e.body,a=[],o=[],s=0;s<e.args.length;++s){var r=e.args[s];if(!(r.count<=0)){var c=new RegExp(r.name,"g"),l="",p=t.arrayArgs.indexOf(s);switch(t.argTypes[s]){case"offset":var u=t.offsetArgIndex.indexOf(s);p=t.offsetArgs[u].array,l="+q"+u;case"array":l="p"+p+l;var d="l"+s,m="a"+p;if(0===t.arrayBlockIndices[p])1===r.count?"generic"===n[p]?r.lvalue?(a.push(["var ",d,"=",m,".get(",l,")"].join("")),i=i.replace(c,d),o.push([m,".set(",l,",",d,")"].join(""))):i=i.replace(c,[m,".get(",l,")"].join("")):i=i.replace(c,[m,"[",l,"]"].join("")):"generic"===n[p]?(a.push(["var ",d,"=",m,".get(",l,")"].join("")),i=i.replace(c,d),r.lvalue&&o.push([m,".set(",l,",",d,")"].join(""))):(a.push(["var ",d,"=",m,"[",l,"]"].join("")),i=i.replace(c,d),r.lvalue&&o.push([m,"[",l,"]=",d].join("")));else{for(var h=[r.name],f=[l],g=0;g<Math.abs(t.arrayBlockIndices[p]);g++)h.push("\\s*\\[([^\\]]+)\\]"),f.push("$"+(g+1)+"*t"+p+"b"+g);if(c=new RegExp(h.join(""),"g"),l=f.join("+"),"generic"===n[p])throw new Error("cwise: Generic arrays not supported in combination with blocks!");i=i.replace(c,[m,"[",l,"]"].join(""))}break;case"scalar":i=i.replace(c,"Y"+t.scalarArgs.indexOf(s));break;case"index":i=i.replace(c,"index");break;case"shape":i=i.replace(c,"shape")}}}return[a.join("\n"),i,o.join("\n")].join("\n").trim()}function vl(e){for(var t=new Array(e.length),n=!0,i=0;i<e.length;++i){var a=e[i],o=a.match(/\d+/);o=o?o[0]:"",0===a.charAt(0)?t[i]="u"+a.charAt(1)+o:t[i]=a.charAt(0)+o,i>0&&(n=n&&t[i]===t[i-1])}return n?t[0]:t.join("")}var bl=function(e,t){for(var n=t[1].length-Math.abs(e.arrayBlockIndices[0])|0,i=new Array(e.arrayArgs.length),a=new Array(e.arrayArgs.length),o=0;o<e.arrayArgs.length;++o)a[o]=t[2*o],i[o]=t[2*o+1];var s=[],r=[],c=[],l=[],p=[];for(o=0;o<e.arrayArgs.length;++o){e.arrayBlockIndices[o]<0?(c.push(0),l.push(n),s.push(n),r.push(n+e.arrayBlockIndices[o])):(c.push(e.arrayBlockIndices[o]),l.push(e.arrayBlockIndices[o]+n),s.push(0),r.push(e.arrayBlockIndices[o]));for(var u=[],d=0;d<i[o].length;d++)c[o]<=i[o][d]&&i[o][d]<l[o]&&u.push(i[o][d]-c[o]);p.push(u)}var m=["SS"],h=["'use strict'"],f=[];for(d=0;d<n;++d)f.push(["s",d,"=SS[",d,"]"].join(""));for(o=0;o<e.arrayArgs.length;++o){m.push("a"+o),m.push("t"+o),m.push("p"+o);for(d=0;d<n;++d)f.push(["t",o,"p",d,"=t",o,"[",c[o]+d,"]"].join(""));for(d=0;d<Math.abs(e.arrayBlockIndices[o]);++d)f.push(["t",o,"b",d,"=t",o,"[",s[o]+d,"]"].join(""))}for(o=0;o<e.scalarArgs.length;++o)m.push("Y"+o);if(e.shapeArgs.length>0&&f.push("shape=SS.slice(0)"),e.indexArgs.length>0){var g=new Array(n);for(o=0;o<n;++o)g[o]="0";f.push(["index=[",g.join(","),"]"].join(""))}for(o=0;o<e.offsetArgs.length;++o){var v=e.offsetArgs[o],b=[];for(d=0;d<v.offset.length;++d)0!==v.offset[d]&&(1===v.offset[d]?b.push(["t",v.array,"p",d].join("")):b.push([v.offset[d],"*t",v.array,"p",d].join("")));0===b.length?f.push("q"+o+"=0"):f.push(["q",o,"=",b.join("+")].join(""))}var x=hl([].concat(e.pre.thisVars).concat(e.body.thisVars).concat(e.post.thisVars));for((f=f.concat(x)).length>0&&h.push("var "+f.join(",")),o=0;o<e.arrayArgs.length;++o)h.push("p"+o+"|=0");e.pre.body.length>3&&h.push(gl(e.pre,e,a));var y=gl(e.body,e,a),w=function(e){for(var t=0,n=e[0].length;t<n;){for(var i=1;i<e.length;++i)if(e[i][t]!==e[0][t])return t;++t}return t}(p);w<n?h.push(function(e,t,n,i){for(var a=t.length,o=n.arrayArgs.length,s=n.blockSize,r=n.indexArgs.length>0,c=[],l=0;l<o;++l)c.push(["var offset",l,"=p",l].join(""));for(l=e;l<a;++l)c.push(["for(var j"+l+"=SS[",t[l],"]|0;j",l,">0;){"].join("")),c.push(["if(j",l,"<",s,"){"].join("")),c.push(["s",t[l],"=j",l].join("")),c.push(["j",l,"=0"].join("")),c.push(["}else{s",t[l],"=",s].join("")),c.push(["j",l,"-=",s,"}"].join("")),r&&c.push(["index[",t[l],"]=j",l].join(""));for(l=0;l<o;++l){for(var p=["offset"+l],u=e;u<a;++u)p.push(["j",u,"*t",l,"p",t[u]].join(""));c.push(["p",l,"=(",p.join("+"),")"].join(""))}for(c.push(fl(t,n,i)),l=e;l<a;++l)c.push("}");return c.join("\n")}(w,p[0],e,y)):h.push(fl(p[0],e,y)),e.post.body.length>3&&h.push(gl(e.post,e,a)),e.debug&&console.log("-----Generated cwise routine for ",t,":\n"+h.join("\n")+"\n----------");var k=[e.funcName||"unnamed","_cwise_loop_",i[0].join("s"),"m",w,vl(a)].join("");return new Function(["function ",k,"(",m.join(","),"){",h.join("\n"),"} return ",k].join(""))()},xl=bl;var yl=function(e){var t=["'use strict'","var CACHED={}"],n=[],i=e.funcName+"_cwise_thunk";t.push(["return function ",i,"(",e.shimArgs.join(","),"){"].join(""));for(var a=[],o=[],s=[["array",e.arrayArgs[0],".shape.slice(",Math.max(0,e.arrayBlockIndices[0]),e.arrayBlockIndices[0]<0?","+e.arrayBlockIndices[0]+")":")"].join("")],r=[],c=[],l=0;l<e.arrayArgs.length;++l){var p=e.arrayArgs[l];n.push(["t",p,"=array",p,".dtype,","r",p,"=array",p,".order"].join("")),a.push("t"+p),a.push("r"+p),o.push("t"+p),o.push("r"+p+".join()"),s.push("array"+p+".data"),s.push("array"+p+".stride"),s.push("array"+p+".offset|0"),l>0&&(r.push("array"+e.arrayArgs[0]+".shape.length===array"+p+".shape.length+"+(Math.abs(e.arrayBlockIndices[0])-Math.abs(e.arrayBlockIndices[l]))),c.push("array"+e.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,e.arrayBlockIndices[0])+"]===array"+p+".shape[shapeIndex+"+Math.max(0,e.arrayBlockIndices[l])+"]"))}for(e.arrayArgs.length>1&&(t.push("if (!("+r.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),t.push("for(var shapeIndex=array"+e.arrayArgs[0]+".shape.length-"+Math.abs(e.arrayBlockIndices[0])+"; shapeIndex--\x3e0;) {"),t.push("if (!("+c.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),t.push("}")),l=0;l<e.scalarArgs.length;++l)s.push("scalar"+e.scalarArgs[l]);return n.push(["type=[",o.join(","),"].join()"].join("")),n.push("proc=CACHED[type]"),t.push("var "+n.join(",")),t.push(["if(!proc){","CACHED[type]=proc=compile([",a.join(","),"])}","return proc(",s.join(","),")}"].join("")),e.debug&&console.log("-----Generated thunk:\n"+t.join("\n")+"\n----------"),new Function("compile",t.join("\n"))(xl.bind(void 0,e))};function wl(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}var kl=function(e){var t=new wl;t.pre=e.pre,t.body=e.body,t.post=e.post;var n=e.args.slice(0);t.argTypes=n;for(var i=0;i<n.length;++i){var a=n[i];if("array"===a||"object"==typeof a&&a.blockIndices){if(t.argTypes[i]="array",t.arrayArgs.push(i),t.arrayBlockIndices.push(a.blockIndices?a.blockIndices:0),t.shimArgs.push("array"+i),i<t.pre.args.length&&t.pre.args[i].count>0)throw new Error("cwise: pre() block may not reference array args");if(i<t.post.args.length&&t.post.args[i].count>0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===a)t.scalarArgs.push(i),t.shimArgs.push("scalar"+i);else if("index"===a){if(t.indexArgs.push(i),i<t.pre.args.length&&t.pre.args[i].count>0)throw new Error("cwise: pre() block may not reference array index");if(i<t.body.args.length&&t.body.args[i].lvalue)throw new Error("cwise: body() block may not write to array index");if(i<t.post.args.length&&t.post.args[i].count>0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===a){if(t.shapeArgs.push(i),i<t.pre.args.length&&t.pre.args[i].lvalue)throw new Error("cwise: pre() block may not write to array shape");if(i<t.body.args.length&&t.body.args[i].lvalue)throw new Error("cwise: body() block may not write to array shape");if(i<t.post.args.length&&t.post.args[i].lvalue)throw new Error("cwise: post() block may not write to array shape")}else{if("object"!=typeof a||!a.offset)throw new Error("cwise: Unknown argument type "+n[i]);t.argTypes[i]="offset",t.offsetArgs.push({array:a.array,offset:a.offset}),t.offsetArgIndex.push(i)}}if(t.arrayArgs.length<=0)throw new Error("cwise: No array arguments specified");if(t.pre.args.length>n.length)throw new Error("cwise: Too many arguments in pre() block");if(t.body.args.length>n.length)throw new Error("cwise: Too many arguments in body() block");if(t.post.args.length>n.length)throw new Error("cwise: Too many arguments in post() block");return t.debug=!!e.printCode||!!e.debug,t.funcName=e.funcName||"cwise",t.blockSize=e.blockSize||64,yl(t)};!function(e){var t=kl,n={body:"",args:[],thisVars:[],localVars:[]};function i(e){if(!e)return n;for(var t=0;t<e.args.length;++t){var i=e.args[t];e.args[t]=0===t?{name:i,lvalue:!0,rvalue:!!e.rvalue,count:e.count||1}:{name:i,lvalue:!1,rvalue:!0,count:1}}return e.thisVars||(e.thisVars=[]),e.localVars||(e.localVars=[]),e}function a(e){for(var n=[],a=0;a<e.args.length;++a)n.push("a"+a);return new Function("P",["return function ",e.funcName,"_ndarrayops(",n.join(","),") {P(",n.join(","),");return a0}"].join(""))(function(e){return t({args:e.args,pre:i(e.pre),body:i(e.body),post:i(e.proc),funcName:e.funcName})}(e))}var o={add:"+",sub:"-",mul:"*",div:"/",mod:"%",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"};!function(){for(var t in o){var n=o[t];e[t]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+n+"c"},funcName:t}),e[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a"+n+"=b"},rvalue:!0,funcName:t+"eq"}),e[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+n+"s"},funcName:t+"s"}),e[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a"+n+"=s"},rvalue:!0,funcName:t+"seq"})}}();var s={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in s){var n=s[t];e[t]=a({args:["array","array"],body:{args:["a","b"],body:"a="+n+"b"},funcName:t}),e[t+"eq"]=a({args:["array"],body:{args:["a"],body:"a="+n+"a"},rvalue:!0,count:2,funcName:t+"eq"})}}();var r={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in r){var n=r[t];e[t]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+n+"c"},funcName:t}),e[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+n+"s"},funcName:t+"s"}),e[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a=a"+n+"b"},rvalue:!0,count:2,funcName:t+"eq"}),e[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+n+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var c=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;t<c.length;++t){var n=c[t];e[n]=a({args:["array","array"],pre:{args:[],body:"this_f=Math."+n,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b)",thisVars:["this_f"]},funcName:n}),e[n+"eq"]=a({args:["array"],pre:{args:[],body:"this_f=Math."+n,thisVars:["this_f"]},body:{args:["a"],body:"a=this_f(a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:n+"eq"})}}();var l=["max","min","atan2","pow"];!function(){for(var t=0;t<l.length;++t){var n=l[t];e[n]=a({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+n,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:n}),e[n+"s"]=a({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+n,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:n+"s"}),e[n+"eq"]=a({args:["array","array"],pre:{args:[],body:"this_f=Math."+n,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:n+"eq"}),e[n+"seq"]=a({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+n,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:n+"seq"})}}();var p=["atan2","pow"];!function(){for(var t=0;t<p.length;++t){var n=p[t];e[n+"op"]=a({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+n,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:n+"op"}),e[n+"ops"]=a({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+n,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:n+"ops"}),e[n+"opeq"]=a({args:["array","array"],pre:{args:[],body:"this_f=Math."+n,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:n+"opeq"}),e[n+"opseq"]=a({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+n,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:n+"opseq"})}}(),e.any=t({args:["array"],pre:n,body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"if(a){return true}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return false"},funcName:"any"}),e.all=t({args:["array"],pre:n,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1}],body:"if(!x){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"all"}),e.sum=t({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s+=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"sum"}),e.prod=t({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=1"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s*=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"prod"}),e.norm2squared=t({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm2squared"}),e.norm2=t({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return Math.sqrt(this_s)"},funcName:"norm2"}),e.norminf=t({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:4}],body:"if(-a>this_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),e.norm1=t({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),e.sup=t({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),e.inf=t({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_<this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),e.argmin=t({args:["index","array","shape"],pre:{body:"{this_v=Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_<this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),e.argmax=t({args:["index","array","shape"],pre:{body:"{this_v=-Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_>this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),e.random=a({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),e.assign=a({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),e.assigns=a({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),e.equals=t({args:["array","array"],pre:n,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})}(ml);var _l=n(ml),jl=[[474,475],[475,476],[476,477],[477,474]],Cl=[[469,470],[470,471],[471,472],[472,469]],Sl=[[10,338],[338,297],[297,332],[332,284],[284,251],[251,389],[389,356],[356,454],[454,323],[323,361],[361,288],[288,397],[397,365],[365,379],[379,378],[378,400],[400,377],[377,152],[152,148],[148,176],[176,149],[149,150],[150,136],[136,172],[172,58],[58,132],[132,93],[93,234],[234,127],[127,162],[162,21],[21,54],[54,103],[103,67],[67,109],[109,10]];function El(e,t,n,i){e.forEach((e=>{const a=t[e[0]].x*n;i(a)}))}function Tl(e,t,n){t.forEach((t=>{const i=e[t];n.push([i.x,i.y])}))}function Ml(e,t,n,i,a){return Math.min(e,t)*a*(n/i)/10}function Ol(e){let t=1/0,n=-1/0,i=1/0,a=-1/0;e.forEach((e=>{t=Math.min(t,e[0]),n=Math.max(n,e[0]),i=Math.min(i,e[1]),a=Math.max(a,e[1])}));return{headWidth:n-t,headHeight:a-i,headCenterX:(t+n)/2,headCenterY:(i+a)/2}}function Al(e){let t=0;for(let n=0;n<e.length;n++){const i=(n+1)%e.length;t+=e[n][0]*e[i][1],t-=e[i][0]*e[n][1]}return Math.abs(t/2)}var Il,Pl,Rl=Object.freeze({__proto__:null,FACEMESH_FACE_OVAL:Sl,FACEMESH_LEFT_IRIS:jl,FACEMESH_RIGHT_IRIS:Cl,calculateHeadMetrics:Ol,convertToYolo:function(e,t,n){let i=(e[0][0]+e[2][0])/2,a=(e[1][1]+e[3][1])/2,o=e[2][0]-e[0][0],s=e[3][1]-e[1][1],r=[i,a,o,s];return o=r[2]*t,s=r[3]*n,[(r[0]-r[2]/2)*t,(r[1]-r[3]/2)*n,o,s]},defaultDeviceConfig:{screenWidth:30.2,screenHeight:19.6,screenWidthPX:1512,screenHeightPX:892,webcamHeight:2,normalizedFocalLength:1.3},defaultParticipantConfig:{headCenterX:.4383369982242584,headCenterY:.6562557443976402,headHeight:.3467509150505066,headWidth:.17240141332149506,widthLeftIris:29.442644119262695,widthRightIris:29.782133102416992,canvasContour:[[.4412970542907715,.4813721179962158],[.4646510183811188,.4823227524757385],[.48430705070495605,.48748111724853516],[.5025681853294373,.4987863302230835],[.5136374235153198,.5169670581817627],[.5202310681343079,.5401103496551514],[.5239146947860718,.5652479529380798],[.5248485207557678,.5970170497894287],[.5236638784408569,.6280523538589478],[.5220870971679688,.6599369645118713],[.519332766532898,.6945410370826721],[.5138625502586365,.7309722304344177],[.5065117478370667,.7603253722190857],[.4982540011405945,.7814207673072815],[.48702606558799744,.7993608713150024],[.4769010543823242,.8114907741546631],[.46630799770355225,.8215509057044983],[.4544796049594879,.8288376331329346],[.4395001232624054,.8312488794326782],[.42436403036117554,.8285082578659058],[.41225385665893555,.8210300207138062],[.40132373571395874,.8104891777038574],[.3908883333206177,.7982432246208191],[.3792901039123535,.7797933220863342],[.3707539737224579,.7583227753639221],[.36319053173065186,.728979766368866],[.35756009817123413,.6924722790718079],[.35495781898498535,.6577485203742981],[.35378265380859375,.6259740591049194],[.35298871994018555,.594894528388977],[.35470905900001526,.5631847381591797],[.3590857684612274,.5380555391311646],[.3667783737182617,.5149739384651184],[.37868133187294006,.4971347451210022],[.3973395824432373,.4863966703414917],[.41754668951034546,.4818713068962097]]},initEyeTracking:function(e=!1,t=!1){blueCircle=window.document.createElement("div"),blueCircle.setAttribute("id","blueCircle"),blueCircle.style.position="absolute",blueCircle.style.width="20px",blueCircle.style.height="20px",blueCircle.style.backgroundColor="blue",blueCircle.style.borderRadius="50%",blueCircle.style.transform="translate(-50%, -50%)",blueCircle.style.display="none",document.body.appendChild(blueCircle);const n=document.createElement("canvas");n.setAttribute("id","leftEye"),n.setAttribute("width","128"),n.setAttribute("height","128"),n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.display="none",document.body.appendChild(n);const i=document.createElement("canvas");i.setAttribute("id","rightEye"),i.setAttribute("width","128"),i.setAttribute("height","128"),i.style.position="absolute",i.style.top="0",i.style.left="128px",i.style.display="none",document.body.appendChild(i),e&&(n.style.display="block",i.style.display="block"),t&&(blueCircle.style.display="block"),leftEyectx=n.getContext("2d",{willReadFrequently:!0}),rightEyectx=i.getContext("2d",{willReadFrequently:!0})},isAreaWithinRange:function(e,t){const n=Al(e),i=Al(t);return i>=.9*n&&i<=1.1*n},isCentroidInsidePath:function(e,t){return function(e,t){let n=!1;const i=e[0],a=e[1];for(let e=0,o=t.length-1;e<t.length;o=e++){const s=t[e][0],r=t[e][1],c=t[o][0],l=t[o][1];r>a!=l>a&&i<(c-s)*(a-r)/(l-r)+s&&(n=!n)}return n}(function(e){let t=0,n=0;for(let i=0;i<e.length;i++)t+=e[i][0],n+=e[i][1];return[t/e.length,n/e.length]}(t),e)},onResultsFaceMesh:function(e){const t=e.image.width,n=e.image.height,i=[],a=[],o=[];let s=1/0,r=-1/0,c=1/0,l=-1/0;if(headCtx.save(),headCtx.clearRect(0,0,headCanvas.width,headCanvas.height),e.multiFaceLandmarks&&e.multiFaceLandmarks.forEach((e=>{if(El(jl,e,t,(e=>{s=Math.min(s,e),r=Math.max(r,e)})),El(Cl,e,t,(e=>{c=Math.min(c,e),l=Math.max(l,e)})),Tl(e,[130,27,243,23],i),Tl(e,[463,257,359,253],a),"undefined"!=typeof canvasContour&&canvasContour){var p=function(e,t,n,i,a,o,s){if(!e)return;const r=[],c=e.map((e=>[e[0]*n,e[1]*i]));return t.beginPath(),c.forEach((([e,n],i)=>{r.push([e,n]),t[0===i?"moveTo":"lineTo"](e,n)})),t.closePath(),t.strokeStyle=a,t.lineWidth=o,t.fillStyle=s,t.stroke(),r}(canvasContour,headCtx,t,n,"rgba(13, 110, 253, 1.0)",3,"transparent");fixedContour=p}var u=function(e,t,n,i,a,o){const s=e.map((e=>{const n=t[e[0]];return o.push([n.x,n.y]),[n.x*i,n.y*a]})),r=[];return n.beginPath(),s.forEach((([e,t],i)=>{r.push([e,t]),n[0===i?"moveTo":"lineTo"](e,t)})),n.closePath(),n.fillStyle="rgba(13, 110, 253, 1.0)",n.fill(),r}(Sl,e,headCtx,t,n,o);movingContour=u})),headCtx.restore(),normalizedFocalLength>0){const e=((Ml(t,n,11.7,r-s,normalizedFocalLength)+Ml(t,n,11.7,l-c,normalizedFocalLength))/2).toFixed(0);current_viewingDistance=e}focalLengthMultiple=Math.min(t,n),irisMetrics={widthLeftIris:r-s,widthRightIris:l-c},headMetrics=Ol(o),leftEyeCoordinates=i,rightEyeCoordinates=a,headCoordinates=o},preprocess:function(e,t,n){const i=dl(new Float32Array(e),[t,n,4]),a=dl(new Float32Array(t*n*3),[1,3,n,t]);return _l.divseq(i,255),_l.assign(a.pick(0,0,null,null),i.pick(null,null,2)),_l.assign(a.pick(0,1,null,null),i.pick(null,null,1)),_l.assign(a.pick(0,2,null,null),i.pick(null,null,0)),new Float32Array(a.data)},preprocess_kps:function(e,t,n){const i=dl(new Float32Array(e),[e.length]),a=dl(new Float32Array(e.length),[1,e.length]);return _l.assign(a.pick(0,null),i),new Float32Array(a.data)}}),Ll=document.documentElement;var Nl=4;async function Dl(e,t,n){try{const i=await fetch(`https://us-central1-webapp-af756.cloudfunctions.net/getUploadUrlFunction?fileName=${e}&mimeType=${t}&parentDir=${n}`);if(!i.ok)throw new Error("Failed to fetch upload URL");return(await i.json()).result}catch(e){throw console.error("Error fetching upload URL:",e),e}}async function ql(e,t){try{const n=await fetch(t,{method:"PUT",headers:{"Content-Type":e.type,"Content-Length":e.size},body:e});if(!n.ok){const e=await n.text();throw new Error(`Upload failed: ${n.status} ${n.statusText}\nResponse headers: ${JSON.stringify(n.headers)}\nResponse body: ${e}`)}console.log("Upload complete:",await n.text())}catch(e){console.error("Error:",e)}}var Fl=Object.freeze({__proto__:null,get countdown(){return Nl},getUploadUrl:Dl,giveAccess:async function(e=!1){try{const t=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:60,max:60}},audio:e});inputVideo&&(inputVideo.srcObject=t,inputVideo.play(),inputVideo.addEventListener("loadedmetadata",(function(){Il=inputVideo.videoWidth,Pl=inputVideo.videoHeight,headCanvas&&(headCanvas.width=Il,headCanvas.height=Pl)}))),videoRecorder=new MediaRecorder(t),videoRecorder.ondataavailable=e=>{e.data.size>0&&videoChunks.push(e.data)},videoRecorder.onstop=async()=>{console.log("Recording stopped, blob created")}}catch(e){console.error("Error accessing media devices:",e)}},openFullscreen:function(){Ll.requestFullscreen?Ll.requestFullscreen():Ll.webkitRequestFullscreen?Ll.webkitRequestFullscreen():Ll.msRequestFullscreen&&Ll.msRequestFullscreen()},get orig_img_height(){return Pl},get orig_img_width(){return Il},saveRecordings:async function(e,t,n="video/webm"){await new Promise((e=>{videoRecorder.onstop=e,videoRecorder.stop()}));const i=new Blob(videoChunks,{type:"video/webm"});if(i.size>0){console.log("Video recorded successfully. Size:",i.size,"bytes");try{var a=store.session.get("deviceConfig")??defaultDeviceConfig;a.storeAudio&&a.storeVideo?n="video/webm":a.storeAudio&&(n="audio/webm");const o=await Dl(e,n,t);await ql(i,o)}catch(e){console.error("Error getting video upload URL:",e)}}else console.error("No video data recorded.")},startRecording:async function(){videoChunks=[],videoRecorder.stop(),videoRecorder.start()},stopRecording:async function(){videoRecorder.stop()},updateCountdown:function e(t){0===--Nl?(document.getElementById("instruction").style.display="none","function"==typeof t&&(t(),Nl=4)):(document.getElementById("instruction").innerHTML="<h1>"+Nl+"</h1>",setTimeout((function(){e(t)}),1e3))},uploadFile:ql}),zl={};const Vl=Object.prototype.toString;function Bl(e){const t=Vl.call(e);return t.endsWith("Array]")&&!t.includes("Big")}var Ul=i(Object.freeze({__proto__:null,isAnyArray:Bl}));var Hl=Object.freeze({__proto__:null,default:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Bl(e))throw new TypeError("input must be an array");if(0===e.length)throw new TypeError("input must not be empty");if(void 0!==n.output){if(!Bl(n.output))throw new TypeError("output option must be an array if specified");t=n.output}else t=new Array(e.length);var i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Bl(e))throw new TypeError("input must be an array");if(0===e.length)throw new TypeError("input must not be empty");var n=t.fromIndex,i=void 0===n?0:n,a=t.toIndex,o=void 0===a?e.length:a;if(i<0||i>=e.length||!Number.isInteger(i))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=i||o>e.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var s=e[i],r=i+1;r<o;r++)e[r]<s&&(s=e[r]);return s}(e),a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Bl(e))throw new TypeError("input must be an array");if(0===e.length)throw new TypeError("input must not be empty");var n=t.fromIndex,i=void 0===n?0:n,a=t.toIndex,o=void 0===a?e.length:a;if(i<0||i>=e.length||!Number.isInteger(i))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=i||o>e.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var s=e[i],r=i+1;r<o;r++)e[r]>s&&(s=e[r]);return s}(e);if(i===a)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var o=n.min,s=void 0===o?n.autoMinMax?i:0:o,r=n.max,c=void 0===r?n.autoMinMax?a:1:r;if(s>=c)throw new RangeError("min option must be smaller than max option");for(var l=(c-s)/(a-i),p=0;p<e.length;p++)t[p]=(e[p]-i)*l+s;return t}}),Wl=i(Hl);Object.defineProperty(zl,"__esModule",{value:!0});var $l=Ul,Kl=Wl;const Yl=" ".repeat(2),Xl=" ".repeat(4);function Gl(e,t={}){const{maxRows:n=15,maxColumns:i=10,maxNumSize:a=8,padMinus:o="auto"}=t;return`${e.constructor.name} {\n${Yl}[\n${Xl}${function(e,t,n,i,a){const{rows:o,columns:s}=e,r=Math.min(o,t),c=Math.min(s,n),l=[];if("auto"===a){a=!1;e:for(let t=0;t<r;t++)for(let n=0;n<c;n++)if(e.get(t,n)<0){a=!0;break e}}for(let t=0;t<r;t++){let n=[];for(let o=0;o<c;o++)n.push(Jl(e.get(t,o),i,a));l.push(`${n.join(" ")}`)}c!==s&&(l[l.length-1]+=` ... ${s-n} more columns`);r!==o&&l.push(`... ${o-t} more rows`);return l.join(`\n${Xl}`)}(e,n,i,a,o)}\n${Yl}]\n${Yl}rows: ${e.rows}\n${Yl}columns: ${e.columns}\n}`}function Jl(e,t,n){return(e>=0&&n?` ${Ql(e,t-1)}`:Ql(e,t)).padEnd(t)}function Ql(e,t){let n=e.toString();if(n.length<=t)return n;let i=e.toFixed(t);if(i.length>t&&(i=e.toFixed(Math.max(0,t-(i.length-t)))),i.length<=t&&!i.startsWith("0.000")&&!i.startsWith("-0.000"))return i;let a=e.toExponential(t);return a.length>t&&(a=e.toExponential(Math.max(0,t-(a.length-t)))),a.slice(0)}function Zl(e,t,n){let i=n?e.rows:e.rows-1;if(t<0||t>i)throw new RangeError("Row index out of range")}function ep(e,t,n){let i=n?e.columns:e.columns-1;if(t<0||t>i)throw new RangeError("Column index out of range")}function tp(e,t){if(t.to1DArray&&(t=t.to1DArray()),t.length!==e.columns)throw new RangeError("vector size must be the same as the number of columns");return t}function np(e,t){if(t.to1DArray&&(t=t.to1DArray()),t.length!==e.rows)throw new RangeError("vector size must be the same as the number of rows");return t}function ip(e,t){if(!$l.isAnyArray(t))throw new TypeError("row indices must be an array");for(let n=0;n<t.length;n++)if(t[n]<0||t[n]>=e.rows)throw new RangeError("row indices are out of range")}function ap(e,t){if(!$l.isAnyArray(t))throw new TypeError("column indices must be an array");for(let n=0;n<t.length;n++)if(t[n]<0||t[n]>=e.columns)throw new RangeError("column indices are out of range")}function op(e,t,n,i,a){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(rp("startRow",t),rp("endRow",n),rp("startColumn",i),rp("endColumn",a),t>n||i>a||t<0||t>=e.rows||n<0||n>=e.rows||i<0||i>=e.columns||a<0||a>=e.columns)throw new RangeError("Submatrix indices are out of range")}function sp(e,t=0){let n=[];for(let i=0;i<e;i++)n.push(t);return n}function rp(e,t){if("number"!=typeof t)throw new TypeError(`${e} must be a number`)}function cp(e){if(e.isEmpty())throw new Error("Empty matrix has no elements to index")}class lp{static from1DArray(e,t,n){if(e*t!==n.length)throw new RangeError("data length does not match given dimensions");let i=new up(e,t);for(let a=0;a<e;a++)for(let e=0;e<t;e++)i.set(a,e,n[a*t+e]);return i}static rowVector(e){let t=new up(1,e.length);for(let n=0;n<e.length;n++)t.set(0,n,e[n]);return t}static columnVector(e){let t=new up(e.length,1);for(let n=0;n<e.length;n++)t.set(n,0,e[n]);return t}static zeros(e,t){return new up(e,t)}static ones(e,t){return new up(e,t).fill(1)}static rand(e,t,n={}){if("object"!=typeof n)throw new TypeError("options must be an object");const{random:i=Math.random}=n;let a=new up(e,t);for(let n=0;n<e;n++)for(let e=0;e<t;e++)a.set(n,e,i());return a}static randInt(e,t,n={}){if("object"!=typeof n)throw new TypeError("options must be an object");const{min:i=0,max:a=1e3,random:o=Math.random}=n;if(!Number.isInteger(i))throw new TypeError("min must be an integer");if(!Number.isInteger(a))throw new TypeError("max must be an integer");if(i>=a)throw new RangeError("min must be smaller than max");let s=a-i,r=new up(e,t);for(let n=0;n<e;n++)for(let e=0;e<t;e++){let t=i+Math.round(o()*s);r.set(n,e,t)}return r}static eye(e,t,n){void 0===t&&(t=e),void 0===n&&(n=1);let i=Math.min(e,t),a=this.zeros(e,t);for(let e=0;e<i;e++)a.set(e,e,n);return a}static diag(e,t,n){let i=e.length;void 0===t&&(t=i),void 0===n&&(n=t);let a=Math.min(i,t,n),o=this.zeros(t,n);for(let t=0;t<a;t++)o.set(t,t,e[t]);return o}static min(e,t){e=this.checkMatrix(e),t=this.checkMatrix(t);let n=e.rows,i=e.columns,a=new up(n,i);for(let o=0;o<n;o++)for(let n=0;n<i;n++)a.set(o,n,Math.min(e.get(o,n),t.get(o,n)));return a}static max(e,t){e=this.checkMatrix(e),t=this.checkMatrix(t);let n=e.rows,i=e.columns,a=new this(n,i);for(let o=0;o<n;o++)for(let n=0;n<i;n++)a.set(o,n,Math.max(e.get(o,n),t.get(o,n)));return a}static checkMatrix(e){return lp.isMatrix(e)?e:new up(e)}static isMatrix(e){return null!=e&&"Matrix"===e.klass}get size(){return this.rows*this.columns}apply(e){if("function"!=typeof e)throw new TypeError("callback must be a function");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e.call(this,t,n);return this}to1DArray(){let e=[];for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e.push(this.get(t,n));return e}to2DArray(){let e=[];for(let t=0;t<this.rows;t++){e.push([]);for(let n=0;n<this.columns;n++)e[t].push(this.get(t,n))}return e}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let e=0;e<this.rows;e++)for(let t=0;t<=e;t++)if(this.get(e,t)!==this.get(t,e))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let e=0;e<this.rows;e++)if(0!==this.get(e,e))return!1;return!0}isEchelonForm(){let e=0,t=0,n=-1,i=!0,a=!1;for(;e<this.rows&&i;){for(t=0,a=!1;t<this.columns&&!1===a;)0===this.get(e,t)?t++:1===this.get(e,t)&&t>n?(a=!0,n=t):(i=!1,a=!0);e++}return i}isReducedEchelonForm(){let e=0,t=0,n=-1,i=!0,a=!1;for(;e<this.rows&&i;){for(t=0,a=!1;t<this.columns&&!1===a;)0===this.get(e,t)?t++:1===this.get(e,t)&&t>n?(a=!0,n=t):(i=!1,a=!0);for(let n=t+1;n<this.rows;n++)0!==this.get(e,n)&&(i=!1);e++}return i}echelonForm(){let e=this.clone(),t=0,n=0;for(;t<e.rows&&n<e.columns;){let i=t;for(let a=t;a<e.rows;a++)e.get(a,n)>e.get(i,n)&&(i=a);if(0===e.get(i,n))n++;else{e.swapRows(t,i);let a=e.get(t,n);for(let i=n;i<e.columns;i++)e.set(t,i,e.get(t,i)/a);for(let i=t+1;i<e.rows;i++){let a=e.get(i,n)/e.get(t,n);e.set(i,n,0);for(let o=n+1;o<e.columns;o++)e.set(i,o,e.get(i,o)-e.get(t,o)*a)}t++,n++}}return e}reducedEchelonForm(){let e=this.echelonForm(),t=e.columns,n=e.rows,i=n-1;for(;i>=0;)if(0===e.maxRow(i))i--;else{let a=0,o=!1;for(;a<n&&!1===o;)1===e.get(i,a)?o=!0:a++;for(let n=0;n<i;n++){let o=e.get(n,a);for(let s=a;s<t;s++){let t=e.get(n,s)-o*e.get(i,s);e.set(n,s,t)}}i--}return e}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(e={}){if("object"!=typeof e)throw new TypeError("options must be an object");const{rows:t=1,columns:n=1}=e;if(!Number.isInteger(t)||t<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(n)||n<=0)throw new TypeError("columns must be a positive integer");let i=new up(this.rows*t,this.columns*n);for(let e=0;e<t;e++)for(let t=0;t<n;t++)i.setSubMatrix(this,this.rows*e,this.columns*t);return i}fill(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,e);return this}neg(){return this.mulS(-1)}getRow(e){Zl(this,e);let t=[];for(let n=0;n<this.columns;n++)t.push(this.get(e,n));return t}getRowVector(e){return up.rowVector(this.getRow(e))}setRow(e,t){Zl(this,e),t=tp(this,t);for(let n=0;n<this.columns;n++)this.set(e,n,t[n]);return this}swapRows(e,t){Zl(this,e),Zl(this,t);for(let n=0;n<this.columns;n++){let i=this.get(e,n);this.set(e,n,this.get(t,n)),this.set(t,n,i)}return this}getColumn(e){ep(this,e);let t=[];for(let n=0;n<this.rows;n++)t.push(this.get(n,e));return t}getColumnVector(e){return up.columnVector(this.getColumn(e))}setColumn(e,t){ep(this,e),t=np(this,t);for(let n=0;n<this.rows;n++)this.set(n,e,t[n]);return this}swapColumns(e,t){ep(this,e),ep(this,t);for(let n=0;n<this.rows;n++){let i=this.get(n,e);this.set(n,e,this.get(n,t)),this.set(n,t,i)}return this}addRowVector(e){e=tp(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)+e[n]);return this}subRowVector(e){e=tp(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)-e[n]);return this}mulRowVector(e){e=tp(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e[n]);return this}divRowVector(e){e=tp(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)/e[n]);return this}addColumnVector(e){e=np(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)+e[t]);return this}subColumnVector(e){e=np(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)-e[t]);return this}mulColumnVector(e){e=np(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e[t]);return this}divColumnVector(e){e=np(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)/e[t]);return this}mulRow(e,t){Zl(this,e);for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t);return this}mulColumn(e,t){ep(this,e);for(let n=0;n<this.rows;n++)this.set(n,e,this.get(n,e)*t);return this}max(e){if(this.isEmpty())return NaN;switch(e){case"row":{const e=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.get(t,n)>e[t]&&(e[t]=this.get(t,n));return e}case"column":{const e=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.get(t,n)>e[n]&&(e[n]=this.get(t,n));return e}case void 0:{let e=this.get(0,0);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n));return e}default:throw new Error(`invalid option: ${e}`)}}maxIndex(){cp(this);let e=this.get(0,0),t=[0,0];for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)>e&&(e=this.get(n,i),t[0]=n,t[1]=i);return t}min(e){if(this.isEmpty())return NaN;switch(e){case"row":{const e=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.get(t,n)<e[t]&&(e[t]=this.get(t,n));return e}case"column":{const e=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.get(t,n)<e[n]&&(e[n]=this.get(t,n));return e}case void 0:{let e=this.get(0,0);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n));return e}default:throw new Error(`invalid option: ${e}`)}}minIndex(){cp(this);let e=this.get(0,0),t=[0,0];for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)<e&&(e=this.get(n,i),t[0]=n,t[1]=i);return t}maxRow(e){if(Zl(this,e),this.isEmpty())return NaN;let t=this.get(e,0);for(let n=1;n<this.columns;n++)this.get(e,n)>t&&(t=this.get(e,n));return t}maxRowIndex(e){Zl(this,e),cp(this);let t=this.get(e,0),n=[e,0];for(let i=1;i<this.columns;i++)this.get(e,i)>t&&(t=this.get(e,i),n[1]=i);return n}minRow(e){if(Zl(this,e),this.isEmpty())return NaN;let t=this.get(e,0);for(let n=1;n<this.columns;n++)this.get(e,n)<t&&(t=this.get(e,n));return t}minRowIndex(e){Zl(this,e),cp(this);let t=this.get(e,0),n=[e,0];for(let i=1;i<this.columns;i++)this.get(e,i)<t&&(t=this.get(e,i),n[1]=i);return n}maxColumn(e){if(ep(this,e),this.isEmpty())return NaN;let t=this.get(0,e);for(let n=1;n<this.rows;n++)this.get(n,e)>t&&(t=this.get(n,e));return t}maxColumnIndex(e){ep(this,e),cp(this);let t=this.get(0,e),n=[0,e];for(let i=1;i<this.rows;i++)this.get(i,e)>t&&(t=this.get(i,e),n[0]=i);return n}minColumn(e){if(ep(this,e),this.isEmpty())return NaN;let t=this.get(0,e);for(let n=1;n<this.rows;n++)this.get(n,e)<t&&(t=this.get(n,e));return t}minColumnIndex(e){ep(this,e),cp(this);let t=this.get(0,e),n=[0,e];for(let i=1;i<this.rows;i++)this.get(i,e)<t&&(t=this.get(i,e),n[0]=i);return n}diag(){let e=Math.min(this.rows,this.columns),t=[];for(let n=0;n<e;n++)t.push(this.get(n,n));return t}norm(e="frobenius"){switch(e){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${e}`)}}cumulativeSum(){let e=0;for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e+=this.get(t,n),this.set(t,n,e);return this}dot(e){lp.isMatrix(e)&&(e=e.to1DArray());let t=this.to1DArray();if(t.length!==e.length)throw new RangeError("vectors do not have the same size");let n=0;for(let i=0;i<t.length;i++)n+=t[i]*e[i];return n}mmul(e){e=up.checkMatrix(e);let t=this.rows,n=this.columns,i=e.columns,a=new up(t,i),o=new Float64Array(n);for(let s=0;s<i;s++){for(let t=0;t<n;t++)o[t]=e.get(t,s);for(let e=0;e<t;e++){let t=0;for(let i=0;i<n;i++)t+=this.get(e,i)*o[i];a.set(e,s,t)}}return a}strassen2x2(e){e=up.checkMatrix(e);let t=new up(2,2);const n=this.get(0,0),i=e.get(0,0),a=this.get(0,1),o=e.get(0,1),s=this.get(1,0),r=e.get(1,0),c=this.get(1,1),l=e.get(1,1),p=(n+c)*(i+l),u=(s+c)*i,d=n*(o-l),m=c*(r-i),h=(n+a)*l,f=p+m-h+(a-c)*(r+l),g=d+h,v=u+m,b=p-u+d+(s-n)*(i+o);return t.set(0,0,f),t.set(0,1,g),t.set(1,0,v),t.set(1,1,b),t}strassen3x3(e){e=up.checkMatrix(e);let t=new up(3,3);const n=this.get(0,0),i=this.get(0,1),a=this.get(0,2),o=this.get(1,0),s=this.get(1,1),r=this.get(1,2),c=this.get(2,0),l=this.get(2,1),p=this.get(2,2),u=e.get(0,0),d=e.get(0,1),m=e.get(0,2),h=e.get(1,0),f=e.get(1,1),g=e.get(1,2),v=e.get(2,0),b=e.get(2,1),x=e.get(2,2),y=(n-o)*(-d+f),w=(-n+o+s)*(u-d+f),k=(o+s)*(-u+d),_=n*u,j=(-n+c+l)*(u-m+g),C=(-n+c)*(m-g),S=(c+l)*(-u+m),E=(-a+l+p)*(f+v-b),T=(a-p)*(f-b),M=a*v,O=(l+p)*(-v+b),A=(-a+s+r)*(g+v-x),I=(a-r)*(g-x),P=(s+r)*(-v+x),R=_+M+i*h,L=(n+i+a-o-s-l-p)*f+w+k+_+E+M+O,N=_+j+S+(n+i+a-s-r-c-l)*g+M+A+P,D=y+s*(-u+d+h-f-g-v+x)+w+_+M+A+I,q=y+w+k+_+r*b,F=M+A+I+P+o*m,z=_+j+C+l*(-u+m+h-f-g-v+b)+E+T+M,V=E+T+M+O+c*d,B=_+j+C+S+p*x;return t.set(0,0,R),t.set(0,1,L),t.set(0,2,N),t.set(1,0,D),t.set(1,1,q),t.set(1,2,F),t.set(2,0,z),t.set(2,1,V),t.set(2,2,B),t}mmulStrassen(e){e=up.checkMatrix(e);let t=this.clone(),n=t.rows,i=t.columns,a=e.rows,o=e.columns;function s(e,t,n){let i=e.rows,a=e.columns;if(i===t&&a===n)return e;{let i=lp.zeros(t,n);return i=i.setSubMatrix(e,0,0),i}}i!==a&&console.warn(`Multiplying ${n} x ${i} and ${a} x ${o} matrix: dimensions do not match.`);let r=Math.max(n,a),c=Math.max(i,o);return t=s(t,r,c),function e(t,n,i,a){if(i<=512||a<=512)return t.mmul(n);i%2==1&&a%2==1?(t=s(t,i+1,a+1),n=s(n,i+1,a+1)):i%2==1?(t=s(t,i+1,a),n=s(n,i+1,a)):a%2==1&&(t=s(t,i,a+1),n=s(n,i,a+1));let o=parseInt(t.rows/2,10),r=parseInt(t.columns/2,10),c=t.subMatrix(0,o-1,0,r-1),l=n.subMatrix(0,o-1,0,r-1),p=t.subMatrix(0,o-1,r,t.columns-1),u=n.subMatrix(0,o-1,r,n.columns-1),d=t.subMatrix(o,t.rows-1,0,r-1),m=n.subMatrix(o,n.rows-1,0,r-1),h=t.subMatrix(o,t.rows-1,r,t.columns-1),f=n.subMatrix(o,n.rows-1,r,n.columns-1),g=e(lp.add(c,h),lp.add(l,f),o,r),v=e(lp.add(d,h),l,o,r),b=e(c,lp.sub(u,f),o,r),x=e(h,lp.sub(m,l),o,r),y=e(lp.add(c,p),f,o,r),w=e(lp.sub(d,c),lp.add(l,u),o,r),k=e(lp.sub(p,h),lp.add(m,f),o,r),_=lp.add(g,x);_.sub(y),_.add(k);let j=lp.add(b,y),C=lp.add(v,x),S=lp.sub(g,v);S.add(b),S.add(w);let E=lp.zeros(2*_.rows,2*_.columns);return E=E.setSubMatrix(_,0,0),E=E.setSubMatrix(j,_.rows,0),E=E.setSubMatrix(C,0,_.columns),E=E.setSubMatrix(S,_.rows,_.columns),E.subMatrix(0,i-1,0,a-1)}(t,e=s(e,r,c),r,c)}scaleRows(e={}){if("object"!=typeof e)throw new TypeError("options must be an object");const{min:t=0,max:n=1}=e;if(!Number.isFinite(t))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(t>=n)throw new RangeError("min must be smaller than max");let i=new up(this.rows,this.columns);for(let e=0;e<this.rows;e++){const a=this.getRow(e);a.length>0&&Kl(a,{min:t,max:n,output:a}),i.setRow(e,a)}return i}scaleColumns(e={}){if("object"!=typeof e)throw new TypeError("options must be an object");const{min:t=0,max:n=1}=e;if(!Number.isFinite(t))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(t>=n)throw new RangeError("min must be smaller than max");let i=new up(this.rows,this.columns);for(let e=0;e<this.columns;e++){const a=this.getColumn(e);a.length&&Kl(a,{min:t,max:n,output:a}),i.setColumn(e,a)}return i}flipRows(){const e=Math.ceil(this.columns/2);for(let t=0;t<this.rows;t++)for(let n=0;n<e;n++){let e=this.get(t,n),i=this.get(t,this.columns-1-n);this.set(t,n,i),this.set(t,this.columns-1-n,e)}return this}flipColumns(){const e=Math.ceil(this.rows/2);for(let t=0;t<this.columns;t++)for(let n=0;n<e;n++){let e=this.get(n,t),i=this.get(this.rows-1-n,t);this.set(n,t,i),this.set(this.rows-1-n,t,e)}return this}kroneckerProduct(e){e=up.checkMatrix(e);let t=this.rows,n=this.columns,i=e.rows,a=e.columns,o=new up(t*i,n*a);for(let s=0;s<t;s++)for(let t=0;t<n;t++)for(let n=0;n<i;n++)for(let r=0;r<a;r++)o.set(i*s+n,a*t+r,this.get(s,t)*e.get(n,r));return o}kroneckerSum(e){if(e=up.checkMatrix(e),!this.isSquare()||!e.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let t=this.rows,n=e.rows,i=this.kroneckerProduct(up.eye(n,n)),a=up.eye(t,t).kroneckerProduct(e);return i.add(a)}transpose(){let e=new up(this.columns,this.rows);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e.set(n,t,this.get(t,n));return e}sortRows(e=pp){for(let t=0;t<this.rows;t++)this.setRow(t,this.getRow(t).sort(e));return this}sortColumns(e=pp){for(let t=0;t<this.columns;t++)this.setColumn(t,this.getColumn(t).sort(e));return this}subMatrix(e,t,n,i){op(this,e,t,n,i);let a=new up(t-e+1,i-n+1);for(let o=e;o<=t;o++)for(let t=n;t<=i;t++)a.set(o-e,t-n,this.get(o,t));return a}subMatrixRow(e,t,n){if(void 0===t&&(t=0),void 0===n&&(n=this.columns-1),t>n||t<0||t>=this.columns||n<0||n>=this.columns)throw new RangeError("Argument out of range");let i=new up(e.length,n-t+1);for(let a=0;a<e.length;a++)for(let o=t;o<=n;o++){if(e[a]<0||e[a]>=this.rows)throw new RangeError(`Row index out of range: ${e[a]}`);i.set(a,o-t,this.get(e[a],o))}return i}subMatrixColumn(e,t,n){if(void 0===t&&(t=0),void 0===n&&(n=this.rows-1),t>n||t<0||t>=this.rows||n<0||n>=this.rows)throw new RangeError("Argument out of range");let i=new up(n-t+1,e.length);for(let a=0;a<e.length;a++)for(let o=t;o<=n;o++){if(e[a]<0||e[a]>=this.columns)throw new RangeError(`Column index out of range: ${e[a]}`);i.set(o-t,a,this.get(o,e[a]))}return i}setSubMatrix(e,t,n){if((e=up.checkMatrix(e)).isEmpty())return this;op(this,t,t+e.rows-1,n,n+e.columns-1);for(let i=0;i<e.rows;i++)for(let a=0;a<e.columns;a++)this.set(t+i,n+a,e.get(i,a));return this}selection(e,t){ip(this,e),ap(this,t);let n=new up(e.length,t.length);for(let i=0;i<e.length;i++){let a=e[i];for(let e=0;e<t.length;e++){let o=t[e];n.set(i,e,this.get(a,o))}}return n}trace(){let e=Math.min(this.rows,this.columns),t=0;for(let n=0;n<e;n++)t+=this.get(n,n);return t}clone(){return this.constructor.copy(this,new up(this.rows,this.columns))}static copy(e,t){for(const[n,i,a]of e.entries())t.set(n,i,a);return t}sum(e){switch(e){case"row":return function(e){let t=sp(e.rows);for(let n=0;n<e.rows;++n)for(let i=0;i<e.columns;++i)t[n]+=e.get(n,i);return t}(this);case"column":return function(e){let t=sp(e.columns);for(let n=0;n<e.rows;++n)for(let i=0;i<e.columns;++i)t[i]+=e.get(n,i);return t}(this);case void 0:return function(e){let t=0;for(let n=0;n<e.rows;n++)for(let i=0;i<e.columns;i++)t+=e.get(n,i);return t}(this);default:throw new Error(`invalid option: ${e}`)}}product(e){switch(e){case"row":return function(e){let t=sp(e.rows,1);for(let n=0;n<e.rows;++n)for(let i=0;i<e.columns;++i)t[n]*=e.get(n,i);return t}(this);case"column":return function(e){let t=sp(e.columns,1);for(let n=0;n<e.rows;++n)for(let i=0;i<e.columns;++i)t[i]*=e.get(n,i);return t}(this);case void 0:return function(e){let t=1;for(let n=0;n<e.rows;n++)for(let i=0;i<e.columns;i++)t*=e.get(n,i);return t}(this);default:throw new Error(`invalid option: ${e}`)}}mean(e){const t=this.sum(e);switch(e){case"row":for(let e=0;e<this.rows;e++)t[e]/=this.columns;return t;case"column":for(let e=0;e<this.columns;e++)t[e]/=this.rows;return t;case void 0:return t/this.size;default:throw new Error(`invalid option: ${e}`)}}variance(e,t={}){if("object"==typeof e&&(t=e,e=void 0),"object"!=typeof t)throw new TypeError("options must be an object");const{unbiased:n=!0,mean:i=this.mean(e)}=t;if("boolean"!=typeof n)throw new TypeError("unbiased must be a boolean");switch(e){case"row":if(!$l.isAnyArray(i))throw new TypeError("mean must be an array");return function(e,t,n){const i=e.rows,a=e.columns,o=[];for(let s=0;s<i;s++){let i=0,r=0,c=0;for(let t=0;t<a;t++)c=e.get(s,t)-n[s],i+=c,r+=c*c;t?o.push((r-i*i/a)/(a-1)):o.push((r-i*i/a)/a)}return o}(this,n,i);case"column":if(!$l.isAnyArray(i))throw new TypeError("mean must be an array");return function(e,t,n){const i=e.rows,a=e.columns,o=[];for(let s=0;s<a;s++){let a=0,r=0,c=0;for(let t=0;t<i;t++)c=e.get(t,s)-n[s],a+=c,r+=c*c;t?o.push((r-a*a/i)/(i-1)):o.push((r-a*a/i)/i)}return o}(this,n,i);case void 0:if("number"!=typeof i)throw new TypeError("mean must be a number");return function(e,t,n){const i=e.rows,a=e.columns,o=i*a;let s=0,r=0,c=0;for(let t=0;t<i;t++)for(let i=0;i<a;i++)c=e.get(t,i)-n,s+=c,r+=c*c;return t?(r-s*s/o)/(o-1):(r-s*s/o)/o}(this,n,i);default:throw new Error(`invalid option: ${e}`)}}standardDeviation(e,t){"object"==typeof e&&(t=e,e=void 0);const n=this.variance(e,t);if(void 0===e)return Math.sqrt(n);for(let e=0;e<n.length;e++)n[e]=Math.sqrt(n[e]);return n}center(e,t={}){if("object"==typeof e&&(t=e,e=void 0),"object"!=typeof t)throw new TypeError("options must be an object");const{center:n=this.mean(e)}=t;switch(e){case"row":if(!$l.isAnyArray(n))throw new TypeError("center must be an array");return function(e,t){for(let n=0;n<e.rows;n++)for(let i=0;i<e.columns;i++)e.set(n,i,e.get(n,i)-t[n])}(this,n),this;case"column":if(!$l.isAnyArray(n))throw new TypeError("center must be an array");return function(e,t){for(let n=0;n<e.rows;n++)for(let i=0;i<e.columns;i++)e.set(n,i,e.get(n,i)-t[i])}(this,n),this;case void 0:if("number"!=typeof n)throw new TypeError("center must be a number");return function(e,t){for(let n=0;n<e.rows;n++)for(let i=0;i<e.columns;i++)e.set(n,i,e.get(n,i)-t)}(this,n),this;default:throw new Error(`invalid option: ${e}`)}}scale(e,t={}){if("object"==typeof e&&(t=e,e=void 0),"object"!=typeof t)throw new TypeError("options must be an object");let n=t.scale;switch(e){case"row":if(void 0===n)n=function(e){const t=[];for(let n=0;n<e.rows;n++){let i=0;for(let t=0;t<e.columns;t++)i+=e.get(n,t)**2/(e.columns-1);t.push(Math.sqrt(i))}return t}(this);else if(!$l.isAnyArray(n))throw new TypeError("scale must be an array");return function(e,t){for(let n=0;n<e.rows;n++)for(let i=0;i<e.columns;i++)e.set(n,i,e.get(n,i)/t[n])}(this,n),this;case"column":if(void 0===n)n=function(e){const t=[];for(let n=0;n<e.columns;n++){let i=0;for(let t=0;t<e.rows;t++)i+=e.get(t,n)**2/(e.rows-1);t.push(Math.sqrt(i))}return t}(this);else if(!$l.isAnyArray(n))throw new TypeError("scale must be an array");return function(e,t){for(let n=0;n<e.rows;n++)for(let i=0;i<e.columns;i++)e.set(n,i,e.get(n,i)/t[i])}(this,n),this;case void 0:if(void 0===n)n=function(e){const t=e.size-1;let n=0;for(let i=0;i<e.columns;i++)for(let a=0;a<e.rows;a++)n+=e.get(a,i)**2/t;return Math.sqrt(n)}(this);else if("number"!=typeof n)throw new TypeError("scale must be a number");return function(e,t){for(let n=0;n<e.rows;n++)for(let i=0;i<e.columns;i++)e.set(n,i,e.get(n,i)/t)}(this,n),this;default:throw new Error(`invalid option: ${e}`)}}toString(e){return Gl(this,e)}[Symbol.iterator](){return this.entries()}*entries(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)yield[e,t,this.get(e,t)]}*values(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)yield this.get(e,t)}}function pp(e,t){return e-t}lp.prototype.klass="Matrix","undefined"!=typeof Symbol&&(lp.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return Gl(this)}),lp.random=lp.rand,lp.randomInt=lp.randInt,lp.diagonal=lp.diag,lp.prototype.diagonal=lp.prototype.diag,lp.identity=lp.eye,lp.prototype.negate=lp.prototype.neg,lp.prototype.tensorProduct=lp.prototype.kroneckerProduct;let up=class e extends lp{data;#e(e,t){if(this.data=[],!(Number.isInteger(t)&&t>=0))throw new TypeError("nColumns must be a positive integer");for(let n=0;n<e;n++)this.data.push(new Float64Array(t));this.rows=e,this.columns=t}constructor(t,n){if(super(),e.isMatrix(t))this.#e(t.rows,t.columns),e.copy(t,this);else if(Number.isInteger(t)&&t>=0)this.#e(t,n);else{if(!$l.isAnyArray(t))throw new TypeError("First argument must be a positive number or an array");{const e=t;if("number"!=typeof(n=(t=e.length)?e[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let i=0;i<t;i++){if(e[i].length!==n)throw new RangeError("Inconsistent array dimensions");if(!e[i].every((e=>"number"==typeof e)))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(e[i]))}this.rows=t,this.columns=n}}}set(e,t,n){return this.data[e][t]=n,this}get(e,t){return this.data[e][t]}removeRow(e){return Zl(this,e),this.data.splice(e,1),this.rows-=1,this}addRow(e,t){return void 0===t&&(t=e,e=this.rows),Zl(this,e,!0),t=Float64Array.from(tp(this,t)),this.data.splice(e,0,t),this.rows+=1,this}removeColumn(e){ep(this,e);for(let t=0;t<this.rows;t++){const n=new Float64Array(this.columns-1);for(let i=0;i<e;i++)n[i]=this.data[t][i];for(let i=e+1;i<this.columns;i++)n[i-1]=this.data[t][i];this.data[t]=n}return this.columns-=1,this}addColumn(e,t){void 0===t&&(t=e,e=this.columns),ep(this,e,!0),t=np(this,t);for(let n=0;n<this.rows;n++){const i=new Float64Array(this.columns+1);let a=0;for(;a<e;a++)i[a]=this.data[n][a];for(i[a++]=t[n];a<this.columns+1;a++)i[a]=this.data[n][a-1];this.data[n]=i}return this.columns+=1,this}};!function(e,t){e.prototype.add=function(e){return"number"==typeof e?this.addS(e):this.addM(e)},e.prototype.addS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)+e);return this},e.prototype.addM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)+e.get(t,n));return this},e.add=function(e,n){return new t(e).add(n)},e.prototype.sub=function(e){return"number"==typeof e?this.subS(e):this.subM(e)},e.prototype.subS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)-e);return this},e.prototype.subM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)-e.get(t,n));return this},e.sub=function(e,n){return new t(e).sub(n)},e.prototype.subtract=e.prototype.sub,e.prototype.subtractS=e.prototype.subS,e.prototype.subtractM=e.prototype.subM,e.subtract=e.sub,e.prototype.mul=function(e){return"number"==typeof e?this.mulS(e):this.mulM(e)},e.prototype.mulS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e);return this},e.prototype.mulM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e.get(t,n));return this},e.mul=function(e,n){return new t(e).mul(n)},e.prototype.multiply=e.prototype.mul,e.prototype.multiplyS=e.prototype.mulS,e.prototype.multiplyM=e.prototype.mulM,e.multiply=e.mul,e.prototype.div=function(e){return"number"==typeof e?this.divS(e):this.divM(e)},e.prototype.divS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)/e);return this},e.prototype.divM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)/e.get(t,n));return this},e.div=function(e,n){return new t(e).div(n)},e.prototype.divide=e.prototype.div,e.prototype.divideS=e.prototype.divS,e.prototype.divideM=e.prototype.divM,e.divide=e.div,e.prototype.mod=function(e){return"number"==typeof e?this.modS(e):this.modM(e)},e.prototype.modS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)%e);return this},e.prototype.modM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)%e.get(t,n));return this},e.mod=function(e,n){return new t(e).mod(n)},e.prototype.modulus=e.prototype.mod,e.prototype.modulusS=e.prototype.modS,e.prototype.modulusM=e.prototype.modM,e.modulus=e.mod,e.prototype.and=function(e){return"number"==typeof e?this.andS(e):this.andM(e)},e.prototype.andS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)&e);return this},e.prototype.andM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)&e.get(t,n));return this},e.and=function(e,n){return new t(e).and(n)},e.prototype.or=function(e){return"number"==typeof e?this.orS(e):this.orM(e)},e.prototype.orS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)|e);return this},e.prototype.orM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)|e.get(t,n));return this},e.or=function(e,n){return new t(e).or(n)},e.prototype.xor=function(e){return"number"==typeof e?this.xorS(e):this.xorM(e)},e.prototype.xorS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)^e);return this},e.prototype.xorM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)^e.get(t,n));return this},e.xor=function(e,n){return new t(e).xor(n)},e.prototype.leftShift=function(e){return"number"==typeof e?this.leftShiftS(e):this.leftShiftM(e)},e.prototype.leftShiftS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)<<e);return this},e.prototype.leftShiftM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)<<e.get(t,n));return this},e.leftShift=function(e,n){return new t(e).leftShift(n)},e.prototype.signPropagatingRightShift=function(e){return"number"==typeof e?this.signPropagatingRightShiftS(e):this.signPropagatingRightShiftM(e)},e.prototype.signPropagatingRightShiftS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)>>e);return this},e.prototype.signPropagatingRightShiftM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)>>e.get(t,n));return this},e.signPropagatingRightShift=function(e,n){return new t(e).signPropagatingRightShift(n)},e.prototype.rightShift=function(e){return"number"==typeof e?this.rightShiftS(e):this.rightShiftM(e)},e.prototype.rightShiftS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)>>>e);return this},e.prototype.rightShiftM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)>>>e.get(t,n));return this},e.rightShift=function(e,n){return new t(e).rightShift(n)},e.prototype.zeroFillRightShift=e.prototype.rightShift,e.prototype.zeroFillRightShiftS=e.prototype.rightShiftS,e.prototype.zeroFillRightShiftM=e.prototype.rightShiftM,e.zeroFillRightShift=e.rightShift,e.prototype.not=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,~this.get(e,t));return this},e.not=function(e){return new t(e).not()},e.prototype.abs=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.abs(this.get(e,t)));return this},e.abs=function(e){return new t(e).abs()},e.prototype.acos=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.acos(this.get(e,t)));return this},e.acos=function(e){return new t(e).acos()},e.prototype.acosh=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.acosh(this.get(e,t)));return this},e.acosh=function(e){return new t(e).acosh()},e.prototype.asin=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.asin(this.get(e,t)));return this},e.asin=function(e){return new t(e).asin()},e.prototype.asinh=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.asinh(this.get(e,t)));return this},e.asinh=function(e){return new t(e).asinh()},e.prototype.atan=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.atan(this.get(e,t)));return this},e.atan=function(e){return new t(e).atan()},e.prototype.atanh=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.atanh(this.get(e,t)));return this},e.atanh=function(e){return new t(e).atanh()},e.prototype.cbrt=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.cbrt(this.get(e,t)));return this},e.cbrt=function(e){return new t(e).cbrt()},e.prototype.ceil=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.ceil(this.get(e,t)));return this},e.ceil=function(e){return new t(e).ceil()},e.prototype.clz32=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.clz32(this.get(e,t)));return this},e.clz32=function(e){return new t(e).clz32()},e.prototype.cos=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.cos(this.get(e,t)));return this},e.cos=function(e){return new t(e).cos()},e.prototype.cosh=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.cosh(this.get(e,t)));return this},e.cosh=function(e){return new t(e).cosh()},e.prototype.exp=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.exp(this.get(e,t)));return this},e.exp=function(e){return new t(e).exp()},e.prototype.expm1=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.expm1(this.get(e,t)));return this},e.expm1=function(e){return new t(e).expm1()},e.prototype.floor=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.floor(this.get(e,t)));return this},e.floor=function(e){return new t(e).floor()},e.prototype.fround=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.fround(this.get(e,t)));return this},e.fround=function(e){return new t(e).fround()},e.prototype.log=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.log(this.get(e,t)));return this},e.log=function(e){return new t(e).log()},e.prototype.log1p=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.log1p(this.get(e,t)));return this},e.log1p=function(e){return new t(e).log1p()},e.prototype.log10=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.log10(this.get(e,t)));return this},e.log10=function(e){return new t(e).log10()},e.prototype.log2=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.log2(this.get(e,t)));return this},e.log2=function(e){return new t(e).log2()},e.prototype.round=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.round(this.get(e,t)));return this},e.round=function(e){return new t(e).round()},e.prototype.sign=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.sign(this.get(e,t)));return this},e.sign=function(e){return new t(e).sign()},e.prototype.sin=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.sin(this.get(e,t)));return this},e.sin=function(e){return new t(e).sin()},e.prototype.sinh=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.sinh(this.get(e,t)));return this},e.sinh=function(e){return new t(e).sinh()},e.prototype.sqrt=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.sqrt(this.get(e,t)));return this},e.sqrt=function(e){return new t(e).sqrt()},e.prototype.tan=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.tan(this.get(e,t)));return this},e.tan=function(e){return new t(e).tan()},e.prototype.tanh=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.tanh(this.get(e,t)));return this},e.tanh=function(e){return new t(e).tanh()},e.prototype.trunc=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.trunc(this.get(e,t)));return this},e.trunc=function(e){return new t(e).trunc()},e.pow=function(e,n){return new t(e).pow(n)},e.prototype.pow=function(e){return"number"==typeof e?this.powS(e):this.powM(e)},e.prototype.powS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)**e);return this},e.prototype.powM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)**e.get(t,n));return this}}(lp,up);class dp extends lp{#t;get size(){return this.#t.size}get rows(){return this.#t.rows}get columns(){return this.#t.columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(e){return up.isMatrix(e)&&"SymmetricMatrix"===e.klassType}static zeros(e){return new this(e)}static ones(e){return new this(e).fill(1)}constructor(e){if(super(),up.isMatrix(e)){if(!e.isSymmetric())throw new TypeError("not symmetric data");this.#t=up.copy(e,new up(e.rows,e.rows))}else if(Number.isInteger(e)&&e>=0)this.#t=new up(e,e);else if(this.#t=new up(e),!this.isSymmetric())throw new TypeError("not symmetric data")}clone(){const e=new dp(this.diagonalSize);for(const[t,n,i]of this.upperRightEntries())e.set(t,n,i);return e}toMatrix(){return new up(this)}get(e,t){return this.#t.get(e,t)}set(e,t,n){return this.#t.set(e,t,n),this.#t.set(t,e,n),this}removeCross(e){return this.#t.removeRow(e),this.#t.removeColumn(e),this}addCross(e,t){void 0===t&&(t=e,e=this.diagonalSize);const n=t.slice();return n.splice(e,1),this.#t.addRow(e,n),this.#t.addColumn(e,t),this}applyMask(e){if(e.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const t=[];for(const[n,i]of e.entries())i||t.push(n);t.reverse();for(const e of t)this.removeCross(e);return this}toCompact(){const{diagonalSize:e}=this,t=new Array(e*(e+1)/2);for(let n=0,i=0,a=0;a<t.length;a++)t[a]=this.get(i,n),++n>=e&&(n=++i);return t}static fromCompact(e){const t=e.length,n=(Math.sqrt(8*t+1)-1)/2;if(!Number.isInteger(n))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(e)}`);const i=new dp(n);for(let a=0,o=0,s=0;s<t;s++)i.set(a,o,e[s]),++a>=n&&(a=++o);return i}*upperRightEntries(){for(let e=0,t=0;e<this.diagonalSize;void 0){const n=this.get(e,t);yield[e,t,n],++t>=this.diagonalSize&&(t=++e)}}*upperRightValues(){for(let e=0,t=0;e<this.diagonalSize;void 0){const n=this.get(e,t);yield n,++t>=this.diagonalSize&&(t=++e)}}}dp.prototype.klassType="SymmetricMatrix";class mp extends dp{static isDistanceMatrix(e){return dp.isSymmetricMatrix(e)&&"DistanceMatrix"===e.klassSubType}constructor(e){if(super(e),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(e,t,n){return e===t&&(n=0),super.set(e,t,n)}addCross(e,t){return void 0===t&&(t=e,e=this.diagonalSize),(t=t.slice())[e]=0,super.addCross(e,t)}toSymmetricMatrix(){return new dp(this)}clone(){const e=new mp(this.diagonalSize);for(const[t,n,i]of this.upperRightEntries())t!==n&&e.set(t,n,i);return e}toCompact(){const{diagonalSize:e}=this,t=new Array((e-1)*e/2);for(let n=1,i=0,a=0;a<t.length;a++)t[a]=this.get(i,n),++n>=e&&(n=1+ ++i);return t}static fromCompact(e){const t=e.length;if(0===t)return new this(0);const n=(Math.sqrt(8*t+1)+1)/2;if(!Number.isInteger(n))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(e)}`);const i=new this(n);for(let a=1,o=0,s=0;s<t;s++)i.set(a,o,e[s]),++a>=n&&(a=1+ ++o);return i}}mp.prototype.klassSubType="DistanceMatrix";class hp extends lp{constructor(e,t,n){super(),this.matrix=e,this.rows=t,this.columns=n}}class fp extends hp{constructor(e,t,n){ip(e,t),ap(e,n),super(e,t.length,n.length),this.rowIndices=t,this.columnIndices=n}set(e,t,n){return this.matrix.set(this.rowIndices[e],this.columnIndices[t],n),this}get(e,t){return this.matrix.get(this.rowIndices[e],this.columnIndices[t])}}class gp extends lp{constructor(e,t={}){const{rows:n=1}=t;if(e.length%n!=0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=n,this.columns=e.length/n,this.data=e}set(e,t,n){let i=this._calculateIndex(e,t);return this.data[i]=n,this}get(e,t){let n=this._calculateIndex(e,t);return this.data[n]}_calculateIndex(e,t){return e*this.columns+t}}class vp extends lp{constructor(e){super(),this.data=e,this.rows=e.length,this.columns=e[0].length}set(e,t,n){return this.data[e][t]=n,this}get(e,t){return this.data[e][t]}}class bp{constructor(e){let t,n,i,a,o,s,r,c,l,p=(e=vp.checkMatrix(e)).clone(),u=p.rows,d=p.columns,m=new Float64Array(u),h=1;for(t=0;t<u;t++)m[t]=t;for(c=new Float64Array(u),n=0;n<d;n++){for(t=0;t<u;t++)c[t]=p.get(t,n);for(t=0;t<u;t++){for(l=Math.min(t,n),o=0,i=0;i<l;i++)o+=p.get(t,i)*c[i];c[t]-=o,p.set(t,n,c[t])}for(a=n,t=n+1;t<u;t++)Math.abs(c[t])>Math.abs(c[a])&&(a=t);if(a!==n){for(i=0;i<d;i++)s=p.get(a,i),p.set(a,i,p.get(n,i)),p.set(n,i,s);r=m[a],m[a]=m[n],m[n]=r,h=-h}if(n<u&&0!==p.get(n,n))for(t=n+1;t<u;t++)p.set(t,n,p.get(t,n)/p.get(n,n))}this.LU=p,this.pivotVector=m,this.pivotSign=h}isSingular(){let e=this.LU,t=e.columns;for(let n=0;n<t;n++)if(0===e.get(n,n))return!0;return!1}solve(e){e=up.checkMatrix(e);let t=this.LU;if(t.rows!==e.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let n,i,a,o=e.columns,s=e.subMatrixRow(this.pivotVector,0,o-1),r=t.columns;for(a=0;a<r;a++)for(n=a+1;n<r;n++)for(i=0;i<o;i++)s.set(n,i,s.get(n,i)-s.get(a,i)*t.get(n,a));for(a=r-1;a>=0;a--){for(i=0;i<o;i++)s.set(a,i,s.get(a,i)/t.get(a,a));for(n=0;n<a;n++)for(i=0;i<o;i++)s.set(n,i,s.get(n,i)-s.get(a,i)*t.get(n,a))}return s}get determinant(){let e=this.LU;if(!e.isSquare())throw new Error("Matrix must be square");let t=this.pivotSign,n=e.columns;for(let i=0;i<n;i++)t*=e.get(i,i);return t}get lowerTriangularMatrix(){let e=this.LU,t=e.rows,n=e.columns,i=new up(t,n);for(let a=0;a<t;a++)for(let t=0;t<n;t++)a>t?i.set(a,t,e.get(a,t)):a===t?i.set(a,t,1):i.set(a,t,0);return i}get upperTriangularMatrix(){let e=this.LU,t=e.rows,n=e.columns,i=new up(t,n);for(let a=0;a<t;a++)for(let t=0;t<n;t++)a<=t?i.set(a,t,e.get(a,t)):i.set(a,t,0);return i}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function xp(e,t){let n=0;return Math.abs(e)>Math.abs(t)?(n=t/e,Math.abs(e)*Math.sqrt(1+n*n)):0!==t?(n=e/t,Math.abs(t)*Math.sqrt(1+n*n)):0}class yp{constructor(e){let t,n,i,a,o=(e=vp.checkMatrix(e)).clone(),s=e.rows,r=e.columns,c=new Float64Array(r);for(i=0;i<r;i++){let e=0;for(t=i;t<s;t++)e=xp(e,o.get(t,i));if(0!==e){for(o.get(i,i)<0&&(e=-e),t=i;t<s;t++)o.set(t,i,o.get(t,i)/e);for(o.set(i,i,o.get(i,i)+1),n=i+1;n<r;n++){for(a=0,t=i;t<s;t++)a+=o.get(t,i)*o.get(t,n);for(a=-a/o.get(i,i),t=i;t<s;t++)o.set(t,n,o.get(t,n)+a*o.get(t,i))}}c[i]=-e}this.QR=o,this.Rdiag=c}solve(e){e=up.checkMatrix(e);let t=this.QR,n=t.rows;if(e.rows!==n)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let i,a,o,s,r=e.columns,c=e.clone(),l=t.columns;for(o=0;o<l;o++)for(a=0;a<r;a++){for(s=0,i=o;i<n;i++)s+=t.get(i,o)*c.get(i,a);for(s=-s/t.get(o,o),i=o;i<n;i++)c.set(i,a,c.get(i,a)+s*t.get(i,o))}for(o=l-1;o>=0;o--){for(a=0;a<r;a++)c.set(o,a,c.get(o,a)/this.Rdiag[o]);for(i=0;i<o;i++)for(a=0;a<r;a++)c.set(i,a,c.get(i,a)-c.get(o,a)*t.get(i,o))}return c.subMatrix(0,l-1,0,r-1)}isFullRank(){let e=this.QR.columns;for(let t=0;t<e;t++)if(0===this.Rdiag[t])return!1;return!0}get upperTriangularMatrix(){let e,t,n=this.QR,i=n.columns,a=new up(i,i);for(e=0;e<i;e++)for(t=0;t<i;t++)e<t?a.set(e,t,n.get(e,t)):e===t?a.set(e,t,this.Rdiag[e]):a.set(e,t,0);return a}get orthogonalMatrix(){let e,t,n,i,a=this.QR,o=a.rows,s=a.columns,r=new up(o,s);for(n=s-1;n>=0;n--){for(e=0;e<o;e++)r.set(e,n,0);for(r.set(n,n,1),t=n;t<s;t++)if(0!==a.get(n,n)){for(i=0,e=n;e<o;e++)i+=a.get(e,n)*r.get(e,t);for(i=-i/a.get(n,n),e=n;e<o;e++)r.set(e,t,r.get(e,t)+i*a.get(e,n))}}return r}}class wp{constructor(e,t={}){if((e=vp.checkMatrix(e)).isEmpty())throw new Error("Matrix must be non-empty");let n=e.rows,i=e.columns;const{computeLeftSingularVectors:a=!0,computeRightSingularVectors:o=!0,autoTranspose:s=!1}=t;let r,c=Boolean(a),l=Boolean(o),p=!1;if(n<i)if(s){r=e.transpose(),n=r.rows,i=r.columns,p=!0;let t=c;c=l,l=t}else r=e.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else r=e.clone();let u=Math.min(n,i),d=Math.min(n+1,i),m=new Float64Array(d),h=new up(n,u),f=new up(i,i),g=new Float64Array(i),v=new Float64Array(n),b=new Float64Array(d);for(let e=0;e<d;e++)b[e]=e;let x=Math.min(n-1,i),y=Math.max(0,Math.min(i-2,n)),w=Math.max(x,y);for(let e=0;e<w;e++){if(e<x){m[e]=0;for(let t=e;t<n;t++)m[e]=xp(m[e],r.get(t,e));if(0!==m[e]){r.get(e,e)<0&&(m[e]=-m[e]);for(let t=e;t<n;t++)r.set(t,e,r.get(t,e)/m[e]);r.set(e,e,r.get(e,e)+1)}m[e]=-m[e]}for(let t=e+1;t<i;t++){if(e<x&&0!==m[e]){let i=0;for(let a=e;a<n;a++)i+=r.get(a,e)*r.get(a,t);i=-i/r.get(e,e);for(let a=e;a<n;a++)r.set(a,t,r.get(a,t)+i*r.get(a,e))}g[t]=r.get(e,t)}if(c&&e<x)for(let t=e;t<n;t++)h.set(t,e,r.get(t,e));if(e<y){g[e]=0;for(let t=e+1;t<i;t++)g[e]=xp(g[e],g[t]);if(0!==g[e]){g[e+1]<0&&(g[e]=0-g[e]);for(let t=e+1;t<i;t++)g[t]/=g[e];g[e+1]+=1}if(g[e]=-g[e],e+1<n&&0!==g[e]){for(let t=e+1;t<n;t++)v[t]=0;for(let t=e+1;t<n;t++)for(let n=e+1;n<i;n++)v[t]+=g[n]*r.get(t,n);for(let t=e+1;t<i;t++){let i=-g[t]/g[e+1];for(let a=e+1;a<n;a++)r.set(a,t,r.get(a,t)+i*v[a])}}if(l)for(let t=e+1;t<i;t++)f.set(t,e,g[t])}}let k=Math.min(i,n+1);if(x<i&&(m[x]=r.get(x,x)),n<k&&(m[k-1]=0),y+1<k&&(g[y]=r.get(y,k-1)),g[k-1]=0,c){for(let e=x;e<u;e++){for(let t=0;t<n;t++)h.set(t,e,0);h.set(e,e,1)}for(let e=x-1;e>=0;e--)if(0!==m[e]){for(let t=e+1;t<u;t++){let i=0;for(let a=e;a<n;a++)i+=h.get(a,e)*h.get(a,t);i=-i/h.get(e,e);for(let a=e;a<n;a++)h.set(a,t,h.get(a,t)+i*h.get(a,e))}for(let t=e;t<n;t++)h.set(t,e,-h.get(t,e));h.set(e,e,1+h.get(e,e));for(let t=0;t<e-1;t++)h.set(t,e,0)}else{for(let t=0;t<n;t++)h.set(t,e,0);h.set(e,e,1)}}if(l)for(let e=i-1;e>=0;e--){if(e<y&&0!==g[e])for(let t=e+1;t<i;t++){let n=0;for(let a=e+1;a<i;a++)n+=f.get(a,e)*f.get(a,t);n=-n/f.get(e+1,e);for(let a=e+1;a<i;a++)f.set(a,t,f.get(a,t)+n*f.get(a,e))}for(let t=0;t<i;t++)f.set(t,e,0);f.set(e,e,1)}let _=k-1,j=Number.EPSILON;for(;k>0;){let e,t;for(e=k-2;e>=-1&&-1!==e;e--){const t=Number.MIN_VALUE+j*Math.abs(m[e]+Math.abs(m[e+1]));if(Math.abs(g[e])<=t||Number.isNaN(g[e])){g[e]=0;break}}if(e===k-2)t=4;else{let n;for(n=k-1;n>=e&&n!==e;n--){let t=(n!==k?Math.abs(g[n]):0)+(n!==e+1?Math.abs(g[n-1]):0);if(Math.abs(m[n])<=j*t){m[n]=0;break}}n===e?t=3:n===k-1?t=1:(t=2,e=n)}switch(e++,t){case 1:{let t=g[k-2];g[k-2]=0;for(let n=k-2;n>=e;n--){let a=xp(m[n],t),o=m[n]/a,s=t/a;if(m[n]=a,n!==e&&(t=-s*g[n-1],g[n-1]=o*g[n-1]),l)for(let e=0;e<i;e++)a=o*f.get(e,n)+s*f.get(e,k-1),f.set(e,k-1,-s*f.get(e,n)+o*f.get(e,k-1)),f.set(e,n,a)}break}case 2:{let t=g[e-1];g[e-1]=0;for(let i=e;i<k;i++){let a=xp(m[i],t),o=m[i]/a,s=t/a;if(m[i]=a,t=-s*g[i],g[i]=o*g[i],c)for(let t=0;t<n;t++)a=o*h.get(t,i)+s*h.get(t,e-1),h.set(t,e-1,-s*h.get(t,i)+o*h.get(t,e-1)),h.set(t,i,a)}break}case 3:{const t=Math.max(Math.abs(m[k-1]),Math.abs(m[k-2]),Math.abs(g[k-2]),Math.abs(m[e]),Math.abs(g[e])),a=m[k-1]/t,o=m[k-2]/t,s=g[k-2]/t,r=m[e]/t,p=g[e]/t,u=((o+a)*(o-a)+s*s)/2,d=a*s*(a*s);let v=0;0===u&&0===d||(v=u<0?0-Math.sqrt(u*u+d):Math.sqrt(u*u+d),v=d/(u+v));let b=(r+a)*(r-a)+v,x=r*p;for(let t=e;t<k-1;t++){let a=xp(b,x);0===a&&(a=Number.MIN_VALUE);let o=b/a,s=x/a;if(t!==e&&(g[t-1]=a),b=o*m[t]+s*g[t],g[t]=o*g[t]-s*m[t],x=s*m[t+1],m[t+1]=o*m[t+1],l)for(let e=0;e<i;e++)a=o*f.get(e,t)+s*f.get(e,t+1),f.set(e,t+1,-s*f.get(e,t)+o*f.get(e,t+1)),f.set(e,t,a);if(a=xp(b,x),0===a&&(a=Number.MIN_VALUE),o=b/a,s=x/a,m[t]=a,b=o*g[t]+s*m[t+1],m[t+1]=-s*g[t]+o*m[t+1],x=s*g[t+1],g[t+1]=o*g[t+1],c&&t<n-1)for(let e=0;e<n;e++)a=o*h.get(e,t)+s*h.get(e,t+1),h.set(e,t+1,-s*h.get(e,t)+o*h.get(e,t+1)),h.set(e,t,a)}g[k-2]=b;break}case 4:if(m[e]<=0&&(m[e]=m[e]<0?-m[e]:0,l))for(let t=0;t<=_;t++)f.set(t,e,-f.get(t,e));for(;e<_&&!(m[e]>=m[e+1]);){let t=m[e];if(m[e]=m[e+1],m[e+1]=t,l&&e<i-1)for(let n=0;n<i;n++)t=f.get(n,e+1),f.set(n,e+1,f.get(n,e)),f.set(n,e,t);if(c&&e<n-1)for(let i=0;i<n;i++)t=h.get(i,e+1),h.set(i,e+1,h.get(i,e)),h.set(i,e,t);e++}k--}}if(p){let e=f;f=h,h=e}this.m=n,this.n=i,this.s=m,this.U=h,this.V=f}solve(e){let t=e,n=this.threshold,i=this.s.length,a=up.zeros(i,i);for(let e=0;e<i;e++)Math.abs(this.s[e])<=n?a.set(e,e,0):a.set(e,e,1/this.s[e]);let o=this.U,s=this.rightSingularVectors,r=s.mmul(a),c=s.rows,l=o.rows,p=up.zeros(c,l);for(let e=0;e<c;e++)for(let t=0;t<l;t++){let n=0;for(let a=0;a<i;a++)n+=r.get(e,a)*o.get(t,a);p.set(e,t,n)}return p.mmul(t)}solveForDiagonal(e){return this.solve(up.diag(e))}inverse(){let e=this.V,t=this.threshold,n=e.rows,i=e.columns,a=new up(n,this.s.length);for(let o=0;o<n;o++)for(let n=0;n<i;n++)Math.abs(this.s[n])>t&&a.set(o,n,e.get(o,n)/this.s[n]);let o=this.U,s=o.rows,r=o.columns,c=new up(n,s);for(let e=0;e<n;e++)for(let t=0;t<s;t++){let n=0;for(let i=0;i<r;i++)n+=a.get(e,i)*o.get(t,i);c.set(e,t,n)}return c}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let e=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,t=0,n=this.s;for(let i=0,a=n.length;i<a;i++)n[i]>e&&t++;return t}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return up.diag(this.s)}}function kp(e,t,n=!1){return e=vp.checkMatrix(e),t=vp.checkMatrix(t),n?new wp(e).solve(t):e.isSquare()?new bp(e).solve(t):new yp(e).solve(t)}function _p(e,t){let n=[];for(let i=0;i<e;i++)i!==t&&n.push(i);return n}function jp(e,t,n,i=1e-9,a=1e-9){if(e>a)return new Array(t.rows+1).fill(0);{let e=t.addRow(n,[0]);for(let t=0;t<e.rows;t++)Math.abs(e.get(t,0))<i&&e.set(t,0,0);return e.to1DArray()}}class Cp{constructor(e,t={}){const{assumeSymmetric:n=!1}=t;if(!(e=vp.checkMatrix(e)).isSquare())throw new Error("Matrix is not a square matrix");if(e.isEmpty())throw new Error("Matrix must be non-empty");let i,a,o=e.columns,s=new up(o,o),r=new Float64Array(o),c=new Float64Array(o),l=e,p=!1;if(p=!!n||e.isSymmetric(),p){for(i=0;i<o;i++)for(a=0;a<o;a++)s.set(i,a,l.get(i,a));!function(e,t,n,i){let a,o,s,r,c,l,p,u;for(c=0;c<e;c++)n[c]=i.get(e-1,c);for(r=e-1;r>0;r--){for(u=0,s=0,l=0;l<r;l++)u+=Math.abs(n[l]);if(0===u)for(t[r]=n[r-1],c=0;c<r;c++)n[c]=i.get(r-1,c),i.set(r,c,0),i.set(c,r,0);else{for(l=0;l<r;l++)n[l]/=u,s+=n[l]*n[l];for(a=n[r-1],o=Math.sqrt(s),a>0&&(o=-o),t[r]=u*o,s-=a*o,n[r-1]=a-o,c=0;c<r;c++)t[c]=0;for(c=0;c<r;c++){for(a=n[c],i.set(c,r,a),o=t[c]+i.get(c,c)*a,l=c+1;l<=r-1;l++)o+=i.get(l,c)*n[l],t[l]+=i.get(l,c)*a;t[c]=o}for(a=0,c=0;c<r;c++)t[c]/=s,a+=t[c]*n[c];for(p=a/(s+s),c=0;c<r;c++)t[c]-=p*n[c];for(c=0;c<r;c++){for(a=n[c],o=t[c],l=c;l<=r-1;l++)i.set(l,c,i.get(l,c)-(a*t[l]+o*n[l]));n[c]=i.get(r-1,c),i.set(r,c,0)}}n[r]=s}for(r=0;r<e-1;r++){if(i.set(e-1,r,i.get(r,r)),i.set(r,r,1),s=n[r+1],0!==s){for(l=0;l<=r;l++)n[l]=i.get(l,r+1)/s;for(c=0;c<=r;c++){for(o=0,l=0;l<=r;l++)o+=i.get(l,r+1)*i.get(l,c);for(l=0;l<=r;l++)i.set(l,c,i.get(l,c)-o*n[l])}}for(l=0;l<=r;l++)i.set(l,r+1,0)}for(c=0;c<e;c++)n[c]=i.get(e-1,c),i.set(e-1,c,0);i.set(e-1,e-1,1),t[0]=0}(o,c,r,s),function(e,t,n,i){let a,o,s,r,c,l,p,u,d,m,h,f,g,v,b,x;for(s=1;s<e;s++)t[s-1]=t[s];t[e-1]=0;let y=0,w=0,k=Number.EPSILON;for(l=0;l<e;l++){for(w=Math.max(w,Math.abs(n[l])+Math.abs(t[l])),p=l;p<e&&!(Math.abs(t[p])<=k*w);)p++;if(p>l)do{for(a=n[l],u=(n[l+1]-a)/(2*t[l]),d=xp(u,1),u<0&&(d=-d),n[l]=t[l]/(u+d),n[l+1]=t[l]*(u+d),m=n[l+1],o=a-n[l],s=l+2;s<e;s++)n[s]-=o;for(y+=o,u=n[p],h=1,f=h,g=h,v=t[l+1],b=0,x=0,s=p-1;s>=l;s--)for(g=f,f=h,x=b,a=h*t[s],o=h*u,d=xp(u,t[s]),t[s+1]=b*d,b=t[s]/d,h=u/d,u=h*n[s]-b*a,n[s+1]=o+b*(h*a+b*n[s]),c=0;c<e;c++)o=i.get(c,s+1),i.set(c,s+1,b*i.get(c,s)+h*o),i.set(c,s,h*i.get(c,s)-b*o);u=-b*x*g*v*t[l]/m,t[l]=b*u,n[l]=h*u}while(Math.abs(t[l])>k*w);n[l]=n[l]+y,t[l]=0}for(s=0;s<e-1;s++){for(c=s,u=n[s],r=s+1;r<e;r++)n[r]<u&&(c=r,u=n[r]);if(c!==s)for(n[c]=n[s],n[s]=u,r=0;r<e;r++)u=i.get(r,s),i.set(r,s,i.get(r,c)),i.set(r,c,u)}}(o,c,r,s)}else{let e=new up(o,o),t=new Float64Array(o);for(a=0;a<o;a++)for(i=0;i<o;i++)e.set(i,a,l.get(i,a));!function(e,t,n,i){let a,o,s,r,c,l,p,u=0,d=e-1;for(l=u+1;l<=d-1;l++){for(p=0,r=l;r<=d;r++)p+=Math.abs(t.get(r,l-1));if(0!==p){for(s=0,r=d;r>=l;r--)n[r]=t.get(r,l-1)/p,s+=n[r]*n[r];for(o=Math.sqrt(s),n[l]>0&&(o=-o),s-=n[l]*o,n[l]=n[l]-o,c=l;c<e;c++){for(a=0,r=d;r>=l;r--)a+=n[r]*t.get(r,c);for(a/=s,r=l;r<=d;r++)t.set(r,c,t.get(r,c)-a*n[r])}for(r=0;r<=d;r++){for(a=0,c=d;c>=l;c--)a+=n[c]*t.get(r,c);for(a/=s,c=l;c<=d;c++)t.set(r,c,t.get(r,c)-a*n[c])}n[l]=p*n[l],t.set(l,l-1,p*o)}}for(r=0;r<e;r++)for(c=0;c<e;c++)i.set(r,c,r===c?1:0);for(l=d-1;l>=u+1;l--)if(0!==t.get(l,l-1)){for(r=l+1;r<=d;r++)n[r]=t.get(r,l-1);for(c=l;c<=d;c++){for(o=0,r=l;r<=d;r++)o+=n[r]*i.get(r,c);for(o=o/n[l]/t.get(l,l-1),r=l;r<=d;r++)i.set(r,c,i.get(r,c)+o*n[r])}}}(o,e,t,s),function(e,t,n,i,a){let o,s,r,c,l,p,u,d,m,h,f,g,v,b,x,y=e-1,w=0,k=e-1,_=Number.EPSILON,j=0,C=0,S=0,E=0,T=0,M=0,O=0,A=0;for(o=0;o<e;o++)for((o<w||o>k)&&(n[o]=a.get(o,o),t[o]=0),s=Math.max(o-1,0);s<e;s++)C+=Math.abs(a.get(o,s));for(;y>=w;){for(c=y;c>w&&(M=Math.abs(a.get(c-1,c-1))+Math.abs(a.get(c,c)),0===M&&(M=C),!(Math.abs(a.get(c,c-1))<_*M));)c--;if(c===y)a.set(y,y,a.get(y,y)+j),n[y]=a.get(y,y),t[y]=0,y--,A=0;else if(c===y-1){if(u=a.get(y,y-1)*a.get(y-1,y),S=(a.get(y-1,y-1)-a.get(y,y))/2,E=S*S+u,O=Math.sqrt(Math.abs(E)),a.set(y,y,a.get(y,y)+j),a.set(y-1,y-1,a.get(y-1,y-1)+j),d=a.get(y,y),E>=0){for(O=S>=0?S+O:S-O,n[y-1]=d+O,n[y]=n[y-1],0!==O&&(n[y]=d-u/O),t[y-1]=0,t[y]=0,d=a.get(y,y-1),M=Math.abs(d)+Math.abs(O),S=d/M,E=O/M,T=Math.sqrt(S*S+E*E),S/=T,E/=T,s=y-1;s<e;s++)O=a.get(y-1,s),a.set(y-1,s,E*O+S*a.get(y,s)),a.set(y,s,E*a.get(y,s)-S*O);for(o=0;o<=y;o++)O=a.get(o,y-1),a.set(o,y-1,E*O+S*a.get(o,y)),a.set(o,y,E*a.get(o,y)-S*O);for(o=w;o<=k;o++)O=i.get(o,y-1),i.set(o,y-1,E*O+S*i.get(o,y)),i.set(o,y,E*i.get(o,y)-S*O)}else n[y-1]=d+S,n[y]=d+S,t[y-1]=O,t[y]=-O;y-=2,A=0}else{if(d=a.get(y,y),m=0,u=0,c<y&&(m=a.get(y-1,y-1),u=a.get(y,y-1)*a.get(y-1,y)),10===A){for(j+=d,o=w;o<=y;o++)a.set(o,o,a.get(o,o)-d);M=Math.abs(a.get(y,y-1))+Math.abs(a.get(y-1,y-2)),d=m=.75*M,u=-.4375*M*M}if(30===A&&(M=(m-d)/2,M=M*M+u,M>0)){for(M=Math.sqrt(M),m<d&&(M=-M),M=d-u/((m-d)/2+M),o=w;o<=y;o++)a.set(o,o,a.get(o,o)-M);j+=M,d=m=u=.964}for(A+=1,l=y-2;l>=c&&(O=a.get(l,l),T=d-O,M=m-O,S=(T*M-u)/a.get(l+1,l)+a.get(l,l+1),E=a.get(l+1,l+1)-O-T-M,T=a.get(l+2,l+1),M=Math.abs(S)+Math.abs(E)+Math.abs(T),S/=M,E/=M,T/=M,l!==c)&&!(Math.abs(a.get(l,l-1))*(Math.abs(E)+Math.abs(T))<_*(Math.abs(S)*(Math.abs(a.get(l-1,l-1))+Math.abs(O)+Math.abs(a.get(l+1,l+1)))));)l--;for(o=l+2;o<=y;o++)a.set(o,o-2,0),o>l+2&&a.set(o,o-3,0);for(r=l;r<=y-1&&(b=r!==y-1,r!==l&&(S=a.get(r,r-1),E=a.get(r+1,r-1),T=b?a.get(r+2,r-1):0,d=Math.abs(S)+Math.abs(E)+Math.abs(T),0!==d&&(S/=d,E/=d,T/=d)),0!==d);r++)if(M=Math.sqrt(S*S+E*E+T*T),S<0&&(M=-M),0!==M){for(r!==l?a.set(r,r-1,-M*d):c!==l&&a.set(r,r-1,-a.get(r,r-1)),S+=M,d=S/M,m=E/M,O=T/M,E/=S,T/=S,s=r;s<e;s++)S=a.get(r,s)+E*a.get(r+1,s),b&&(S+=T*a.get(r+2,s),a.set(r+2,s,a.get(r+2,s)-S*O)),a.set(r,s,a.get(r,s)-S*d),a.set(r+1,s,a.get(r+1,s)-S*m);for(o=0;o<=Math.min(y,r+3);o++)S=d*a.get(o,r)+m*a.get(o,r+1),b&&(S+=O*a.get(o,r+2),a.set(o,r+2,a.get(o,r+2)-S*T)),a.set(o,r,a.get(o,r)-S),a.set(o,r+1,a.get(o,r+1)-S*E);for(o=w;o<=k;o++)S=d*i.get(o,r)+m*i.get(o,r+1),b&&(S+=O*i.get(o,r+2),i.set(o,r+2,i.get(o,r+2)-S*T)),i.set(o,r,i.get(o,r)-S),i.set(o,r+1,i.get(o,r+1)-S*E)}}}if(0===C)return;for(y=e-1;y>=0;y--)if(S=n[y],E=t[y],0===E)for(c=y,a.set(y,y,1),o=y-1;o>=0;o--){for(u=a.get(o,o)-S,T=0,s=c;s<=y;s++)T+=a.get(o,s)*a.get(s,y);if(t[o]<0)O=u,M=T;else if(c=o,0===t[o]?a.set(o,y,0!==u?-T/u:-T/(_*C)):(d=a.get(o,o+1),m=a.get(o+1,o),E=(n[o]-S)*(n[o]-S)+t[o]*t[o],p=(d*M-O*T)/E,a.set(o,y,p),a.set(o+1,y,Math.abs(d)>Math.abs(O)?(-T-u*p)/d:(-M-m*p)/O)),p=Math.abs(a.get(o,y)),_*p*p>1)for(s=o;s<=y;s++)a.set(s,y,a.get(s,y)/p)}else if(E<0)for(c=y-1,Math.abs(a.get(y,y-1))>Math.abs(a.get(y-1,y))?(a.set(y-1,y-1,E/a.get(y,y-1)),a.set(y-1,y,-(a.get(y,y)-S)/a.get(y,y-1))):(x=Sp(0,-a.get(y-1,y),a.get(y-1,y-1)-S,E),a.set(y-1,y-1,x[0]),a.set(y-1,y,x[1])),a.set(y,y-1,0),a.set(y,y,1),o=y-2;o>=0;o--){for(h=0,f=0,s=c;s<=y;s++)h+=a.get(o,s)*a.get(s,y-1),f+=a.get(o,s)*a.get(s,y);if(u=a.get(o,o)-S,t[o]<0)O=u,T=h,M=f;else if(c=o,0===t[o]?(x=Sp(-h,-f,u,E),a.set(o,y-1,x[0]),a.set(o,y,x[1])):(d=a.get(o,o+1),m=a.get(o+1,o),g=(n[o]-S)*(n[o]-S)+t[o]*t[o]-E*E,v=2*(n[o]-S)*E,0===g&&0===v&&(g=_*C*(Math.abs(u)+Math.abs(E)+Math.abs(d)+Math.abs(m)+Math.abs(O))),x=Sp(d*T-O*h+E*f,d*M-O*f-E*h,g,v),a.set(o,y-1,x[0]),a.set(o,y,x[1]),Math.abs(d)>Math.abs(O)+Math.abs(E)?(a.set(o+1,y-1,(-h-u*a.get(o,y-1)+E*a.get(o,y))/d),a.set(o+1,y,(-f-u*a.get(o,y)-E*a.get(o,y-1))/d)):(x=Sp(-T-m*a.get(o,y-1),-M-m*a.get(o,y),O,E),a.set(o+1,y-1,x[0]),a.set(o+1,y,x[1]))),p=Math.max(Math.abs(a.get(o,y-1)),Math.abs(a.get(o,y))),_*p*p>1)for(s=o;s<=y;s++)a.set(s,y-1,a.get(s,y-1)/p),a.set(s,y,a.get(s,y)/p)}for(o=0;o<e;o++)if(o<w||o>k)for(s=o;s<e;s++)i.set(o,s,a.get(o,s));for(s=e-1;s>=w;s--)for(o=w;o<=k;o++){for(O=0,r=w;r<=Math.min(s,k);r++)O+=i.get(o,r)*a.get(r,s);i.set(o,s,O)}}(o,c,r,s,e)}this.n=o,this.e=c,this.d=r,this.V=s}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let e,t,n=this.n,i=this.e,a=this.d,o=new up(n,n);for(e=0;e<n;e++){for(t=0;t<n;t++)o.set(e,t,0);o.set(e,e,a[e]),i[e]>0?o.set(e,e+1,i[e]):i[e]<0&&o.set(e,e-1,i[e])}return o}}function Sp(e,t,n,i){let a,o;return Math.abs(n)>Math.abs(i)?(a=i/n,o=n+a*i,[(e+a*t)/o,(t-a*e)/o]):(a=n/i,o=i+a*n,[(a*e+t)/o,(a*t-e)/o])}class Ep{constructor(e){if(!(e=vp.checkMatrix(e)).isSymmetric())throw new Error("Matrix is not symmetric");let t,n,i,a=e,o=a.rows,s=new up(o,o),r=!0;for(n=0;n<o;n++){let e=0;for(i=0;i<n;i++){let o=0;for(t=0;t<i;t++)o+=s.get(i,t)*s.get(n,t);o=(a.get(n,i)-o)/s.get(i,i),s.set(n,i,o),e+=o*o}for(e=a.get(n,n)-e,r&=e>0,s.set(n,n,Math.sqrt(Math.max(e,0))),i=n+1;i<o;i++)s.set(n,i,0)}this.L=s,this.positiveDefinite=Boolean(r)}isPositiveDefinite(){return this.positiveDefinite}solve(e){e=vp.checkMatrix(e);let t=this.L,n=t.rows;if(e.rows!==n)throw new Error("Matrix dimensions do not match");if(!1===this.isPositiveDefinite())throw new Error("Matrix is not positive definite");let i,a,o,s=e.columns,r=e.clone();for(o=0;o<n;o++)for(a=0;a<s;a++){for(i=0;i<o;i++)r.set(o,a,r.get(o,a)-r.get(i,a)*t.get(o,i));r.set(o,a,r.get(o,a)/t.get(o,o))}for(o=n-1;o>=0;o--)for(a=0;a<s;a++){for(i=o+1;i<n;i++)r.set(o,a,r.get(o,a)-r.get(i,a)*t.get(i,o));r.set(o,a,r.get(o,a)/t.get(o,o))}return r}get lowerTriangularMatrix(){return this.L}}class Tp{constructor(e,t={}){e=vp.checkMatrix(e);let{Y:n}=t;const{scaleScores:i=!1,maxIterations:a=1e3,terminationCriteria:o=1e-10}=t;let s;if(n){if(n=$l.isAnyArray(n)&&"number"==typeof n[0]?up.columnVector(n):vp.checkMatrix(n),n.rows!==e.rows)throw new Error("Y should have the same number of rows as X");s=n.getColumnVector(0)}else s=e.getColumnVector(0);let r,c,l,p,u=1;for(let t=0;t<a&&u>o;t++)l=e.transpose().mmul(s).div(s.transpose().mmul(s).get(0,0)),l=l.div(l.norm()),r=e.mmul(l).div(l.transpose().mmul(l).get(0,0)),t>0&&(u=r.clone().sub(p).pow(2).sum()),p=r.clone(),n?(c=n.transpose().mmul(r).div(r.transpose().mmul(r).get(0,0)),c=c.div(c.norm()),s=n.mmul(c).div(c.transpose().mmul(c).get(0,0))):s=r;if(n){let t=e.transpose().mmul(r).div(r.transpose().mmul(r).get(0,0));t=t.div(t.norm());let i=e.clone().sub(r.clone().mmul(t.transpose())),a=s.transpose().mmul(r).div(r.transpose().mmul(r).get(0,0)),o=n.clone().sub(r.clone().mulS(a.get(0,0)).mmul(c.transpose()));this.t=r,this.p=t.transpose(),this.w=l.transpose(),this.q=c,this.u=s,this.s=r.transpose().mmul(r),this.xResidual=i,this.yResidual=o,this.betas=a}else this.w=l.transpose(),this.s=r.transpose().mmul(r).sqrt(),this.t=i?r.clone().div(this.s.get(0,0)):r,this.xResidual=e.sub(r.mmul(l.transpose()))}}zl.AbstractMatrix=lp,zl.CHO=Ep,zl.CholeskyDecomposition=Ep,zl.DistanceMatrix=mp,zl.EVD=Cp,zl.EigenvalueDecomposition=Cp,zl.LU=bp,zl.LuDecomposition=bp;var Mp=zl.Matrix=up;zl.MatrixColumnSelectionView=class extends hp{constructor(e,t){ap(e,t),super(e,e.rows,t.length),this.columnIndices=t}set(e,t,n){return this.matrix.set(e,this.columnIndices[t],n),this}get(e,t){return this.matrix.get(e,this.columnIndices[t])}},zl.MatrixColumnView=class extends hp{constructor(e,t){ep(e,t),super(e,e.rows,1),this.column=t}set(e,t,n){return this.matrix.set(e,this.column,n),this}get(e){return this.matrix.get(e,this.column)}},zl.MatrixFlipColumnView=class extends hp{constructor(e){super(e,e.rows,e.columns)}set(e,t,n){return this.matrix.set(e,this.columns-t-1,n),this}get(e,t){return this.matrix.get(e,this.columns-t-1)}},zl.MatrixFlipRowView=class extends hp{constructor(e){super(e,e.rows,e.columns)}set(e,t,n){return this.matrix.set(this.rows-e-1,t,n),this}get(e,t){return this.matrix.get(this.rows-e-1,t)}},zl.MatrixRowSelectionView=class extends hp{constructor(e,t){ip(e,t),super(e,t.length,e.columns),this.rowIndices=t}set(e,t,n){return this.matrix.set(this.rowIndices[e],t,n),this}get(e,t){return this.matrix.get(this.rowIndices[e],t)}},zl.MatrixRowView=class extends hp{constructor(e,t){Zl(e,t),super(e,1,e.columns),this.row=t}set(e,t,n){return this.matrix.set(this.row,t,n),this}get(e,t){return this.matrix.get(this.row,t)}},zl.MatrixSelectionView=fp,zl.MatrixSubView=class extends hp{constructor(e,t,n,i,a){op(e,t,n,i,a),super(e,n-t+1,a-i+1),this.startRow=t,this.startColumn=i}set(e,t,n){return this.matrix.set(this.startRow+e,this.startColumn+t,n),this}get(e,t){return this.matrix.get(this.startRow+e,this.startColumn+t)}};var Op=zl.MatrixTransposeView=class extends hp{constructor(e){super(e,e.columns,e.rows)}set(e,t,n){return this.matrix.set(t,e,n),this}get(e,t){return this.matrix.get(t,e)}};zl.NIPALS=Tp,zl.Nipals=Tp,zl.QR=yp,zl.QrDecomposition=yp,zl.SVD=wp,zl.SingularValueDecomposition=wp,zl.SymmetricMatrix=dp,zl.WrapperMatrix1D=gp,zl.WrapperMatrix2D=vp,zl.correlation=function(e,t=e,n={}){e=new up(e);let i=!1;if("object"!=typeof t||up.isMatrix(t)||$l.isAnyArray(t)?t=new up(t):(n=t,t=e,i=!0),e.rows!==t.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:a=!0,scale:o=!0}=n;a&&(e.center("column"),i||t.center("column")),o&&(e.scale("column"),i||t.scale("column"));const s=e.standardDeviation("column",{unbiased:!0}),r=i?s:t.standardDeviation("column",{unbiased:!0}),c=e.transpose().mmul(t);for(let t=0;t<c.rows;t++)for(let n=0;n<c.columns;n++)c.set(t,n,c.get(t,n)*(1/(s[t]*r[n]))*(1/(e.rows-1)));return c},zl.covariance=function(e,t=e,n={}){e=new up(e);let i=!1;if("object"!=typeof t||up.isMatrix(t)||$l.isAnyArray(t)?t=new up(t):(n=t,t=e,i=!0),e.rows!==t.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:a=!0}=n;a&&(e=e.center("column"),i||(t=t.center("column")));const o=e.transpose().mmul(t);for(let t=0;t<o.rows;t++)for(let n=0;n<o.columns;n++)o.set(t,n,o.get(t,n)*(1/(e.rows-1)));return o};var Ap=zl.default=up;zl.determinant=function e(t){if((t=up.checkMatrix(t)).isSquare()){if(0===t.columns)return 1;let n,i,a,o;if(2===t.columns)return n=t.get(0,0),i=t.get(0,1),a=t.get(1,0),o=t.get(1,1),n*o-i*a;if(3===t.columns){let o,s,r;return o=new fp(t,[1,2],[1,2]),s=new fp(t,[1,2],[0,2]),r=new fp(t,[1,2],[0,1]),n=t.get(0,0),i=t.get(0,1),a=t.get(0,2),n*e(o)-i*e(s)+a*e(r)}return new bp(t).determinant}throw Error("determinant can only be calculated for a square matrix")},zl.inverse=function(e,t=!1){return e=vp.checkMatrix(e),t?new wp(e).inverse():kp(e,up.eye(e.rows))},zl.linearDependencies=function(e,t={}){const{thresholdValue:n=1e-9,thresholdError:i=1e-9}=t;let a=(e=up.checkMatrix(e)).rows,o=new up(a,a);for(let t=0;t<a;t++){let s=up.columnVector(e.getRow(t)),r=e.subMatrixRow(_p(a,t)).transpose(),c=new wp(r).solve(s),l=up.sub(s,r.mmul(c)).abs().max();o.setRow(t,jp(l,c,t,n,i))}return o},zl.pseudoInverse=function(e,t=Number.EPSILON){if((e=up.checkMatrix(e)).isEmpty())return e.transpose();let n=new wp(e,{autoTranspose:!0}),i=n.leftSingularVectors,a=n.rightSingularVectors,o=n.diagonal;for(let e=0;e<o.length;e++)Math.abs(o[e])>t?o[e]=1/o[e]:o[e]=0;return a.mmul(up.diag(o).mmul(i.transpose()))};var Ip=zl.solve=kp;zl.wrap=function(e,t){if($l.isAnyArray(e))return e[0]&&$l.isAnyArray(e[0])?new vp(e):new gp(e,t);throw new Error("the argument is not an array")};const Pp=Mp,Rp=Op;Ap.Matrix&&Ap.Matrix;const Lp=Ip;function Np(e,t){if(!Bl(e)||!Bl(t))throw new TypeError("x and y must be arrays");if(e.length!==t.length)throw new RangeError("x and y arrays must have the same length")}class Dp{constructor(){if(new.target===Dp)throw new Error("BaseRegression must be subclassed")}predict(e){if("number"==typeof e)return this._predict(e);if(Bl(e)){const t=[];for(const n of e)t.push(this._predict(n));return t}throw new TypeError("x must be a number or array")}_predict(e){throw new Error("_predict must be implemented")}train(){}toString(e){return""}toLaTeX(e){return""}score(e,t){Np(e,t);const n=e.length,i=new Array(n);for(let t=0;t<n;t++)i[t]=this._predict(e[t]);let a=0,o=0,s=0,r=0,c=0,l=0,p=0;for(let e=0;e<n;e++)a+=i[e],o+=t[e],c+=i[e]*i[e],l+=t[e]*t[e],p+=i[e]*t[e],0!==t[e]&&(s+=(t[e]-i[e])*(t[e]-i[e])/t[e]),r+=(t[e]-i[e])*(t[e]-i[e]);const u=(n*p-a*o)/Math.sqrt((n*c-a*a)*(n*l-o*o));return{r:u,r2:u*u,chi2:s,rmsd:Math.sqrt(r/n)}}}function qp(e,t){return e<0?(e=0-e,"number"==typeof t?`- ${e.toPrecision(t)}`:`- ${e.toString()}`):"number"==typeof t?e.toPrecision(t):e.toString()}class Fp extends Dp{constructor(e,t,n,i={}){if(super(),!0===e)this.degree=t.degree,this.powers=t.powers,this.coefficients=t.coefficients;else{Np(e,t);const a=function(e,t,n,i={}){const a=e.length;let{interceptAtZero:o=!1}=i,s=[];if(Array.isArray(n))s=n,o=!1;else if("number"==typeof n)if(o){s=new Array(n);for(let e=0;e<n;e++)s[e]=e+1}else{s=new Array(n+1);for(let e=0;e<=n;e++)s[e]=e}const r=s.length,c=new Pp(a,r),l=new Pp([t]);for(let t=0;t<r;t++)for(let n=0;n<a;n++)0===s[t]?c.set(n,t,1):c.set(n,t,e[n]**s[t]);const p=new Rp(c),u=p.mmul(c),d=p.mmul(new Rp(l));return{coefficients:Lp(u,d).to1DArray(),degree:Math.max(...s),powers:s}}(e,t,n,i);this.degree=a.degree,this.powers=a.powers,this.coefficients=a.coefficients}}_predict(e){let t=0;for(let n=0;n<this.powers.length;n++)t+=this.coefficients[n]*e**this.powers[n];return t}toJSON(){return{name:"polynomialRegression",degree:this.degree,powers:this.powers,coefficients:this.coefficients}}toString(e){return this._toFormula(e,!1)}toLaTeX(e){return this._toFormula(e,!0)}_toFormula(e,t){let n="^",i="",a=" * ";t&&(n="^{",i="}",a="");let o="",s="";for(let t=0;t<this.coefficients.length;t++)s="",0!==this.coefficients[t]&&(s=0===this.powers[t]?qp(this.coefficients[t],e):1===this.powers[t]?`${qp(this.coefficients[t],e)+a}x`:`${qp(this.coefficients[t],e)+a}x${n}${this.powers[t]}${i}`,this.coefficients[t]>0&&t!==this.coefficients.length-1?s=` + ${s}`:t!==this.coefficients.length-1&&(s=` ${s}`)),o=s+o;return o.startsWith("+")&&(o=o.slice(1)),`f(x) = ${o}`}static load(e){if("polynomialRegression"!==e.name)throw new TypeError("not a polynomial regression model");return new Fp(!0,e)}}async function zp(e){var t=new Worker(new URL("worker.cc1c60e9.js",import.meta.url),{type:"module"});window.myWorker=t;var n='<!doctype html>\n<html lang="en">\n <head>\n <link\n href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"\n rel="stylesheet"\n integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"\n crossorigin="anonymous"\n />\n <meta charset="UTF-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <script src="https://cdn.jsdelivr.net/npm/onnxjs/dist/onnx.min.js"><\/script>\n </head>\n\n <style>\n body {\n margin: 0;\n min-height: 100vh; /* Ensure body takes the full viewport height */\n display: flex; /* Enable Flexbox */\n justify-content: center; /* Center content horizontally */\n align-items: center; /* Center content vertically */\n font-family: sans-serif;\n }\n\n stim {\n position: absolute;\n height: auto;\n cursor: pointer;\n }\n\n #instruction {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n\n #confirmContainer {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n\n #stimulus {\n position: absolute;\n width: 25px;\n height: 25px;\n background-color: #1e90ff;\n border-radius: 50%;\n display: block; /* Initially hidden */\n transform: translate(-50%, -50%);\n }\n\n #headCanvas {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n #canvas-container {\n position: relative;\n width: 300px;\n height: 300px;\n top: 30px;\n margin: 0 auto;\n }\n </style>\n\n <body>\n \x3c!-- Center Instructions Panel --\x3e\n <div id="calibrationContentArea">\n <div class="row gap-2" id="instruction">\n <div class="col">\n <div class="card" style="width: 45rem; height: 39rem">\n <div class="card-body" style="text-align: center">\n <h3 class="card-title" id="calibrationTitle">\n <b> Calibration Phase </b>\n </h3>\n <h4 class="card-text">Now, we need to calibrate our systems.</h4>\n <h4 class="card-text" id="calibrationDescription"></h4>\n <div style="text-align: center; margin-bottom: 3vh">\n <img\n id="calibrationImage"\n src="https://eyetrackingdata.blob.core.windows.net/public/Images/squareAddition_white.png"\n width="350px"\n />\n </div>\n <div class="btn-group" role="group" aria-label="Basic example">\n <button\n type="button"\n class="btn btn-primary"\n id="startTestButton"\n onclick="startTest()"\n >\n Start\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div id="stimulus"></div>\n <div id="canvas-container" style="display: none">\n <canvas\n id="headCanvas"\n class="frame"\n style="position: relative; display: none"\n ></canvas>\n </div>\n\n \x3c!-- Confirm Button --\x3e\n <div class="row gap-2" id="confirmContainer" style="display: none">\n <div class="card-body" style="text-align: center">\n <h3>Calibration complete!</h3>\n <button type="button" class="btn btn-primary" id="confirmButton">\n Continue\n </button>\n </div>\n </div>\n\n <div class="panel-block" style="display: block" ;>\n <video class="inputVideo" style="display: none"></video>\n </div>\n\n <audio autoplay id="voiceover"></audio>\n\n <script data-dynamic>\n voiceover = document.getElementById("voiceover");\n document.body.addEventListener("click", function () {\n voiceover.pause();\n voiceover.currentTime = 0; // Stop the voiceover whenever a click is detected\n });\n\n // ----------- required -------------------\n function runAfterEveryFrame(output) {\n if (recordEyeMovements) {\n _gridCoordinates.push({\n x: parseFloat(stimulus.style.left),\n y: parseFloat(stimulus.style.top),\n });\n _eyeCoordinates.push({\n x: output.output.cpuData[0] * 100 - 50,\n y: output.output.cpuData[1] * 100,\n });\n _calibrationData.push(calibrationData);\n let time = new Date().getTime();\n _timeData.push(time);\n }\n }\n\n function pageCompleted() {\n continueProcessing = false;\n recordEyeMovements = false;\n const event = new Event("pageComplete");\n document.dispatchEvent(event);\n }\n\n var recordEyeMovements = false;\n var calibrationData = 1;\n var continueProcessing = true;\n\n var deviceConfig = store.session.get("deviceConfig");\n var _gridCoordinates = [];\n var _parentDir = store.session.get("id");\n var _videoURL = "";\n\n var IMAGE_SIZE = 640;\n var upperbound_x = 96;\n var lowerbound_x = 2;\n var upperbound_y = 96;\n var lowerbound_y = 2;\n var stimulus = document.getElementById("stimulus");\n var x = 0;\n var y = 0;\n var counter = 0;\n var incX = 0.15 * 2;\n var incY = 0.02 * 2;\n var timeArray = [];\n var xArray = [];\n var yArray = [];\n var _eyeCoordinates = [];\n var _calibrationData = [];\n var _timeData = [];\n var fixationStimulus_x = [30, 50, 70];\n var fixationStimulus_y = [20, 40, 60];\n\n async function startTest() {\n await runInference();\n openFullscreen();\n updateCountdown(initStimulus);\n }\n\n async function initStimulus() {\n document.getElementById("stimulus").style.display = "block";\n await startRecording();\n recordEyeMovements = true;\n moveStimulus();\n }\n\n async function moveStimulus() {\n counter = counter + 1;\n if (x > upperbound_x) {\n incX = -0.15 * 2;\n } else if (x < lowerbound_x) {\n incX = 0.15 * 2;\n }\n\n if (y > upperbound_y) {\n incY = -0.02 * 2;\n } else if (y < lowerbound_y) {\n incY = 0.02 * 2;\n }\n x = x + incX;\n y = y + incY;\n let time = new Date().getTime();\n\n timeArray.push(time);\n xArray.push(x);\n yArray.push(y);\n\n stimulus.style.left = `${x}%`; // Adjust for half of the cell width\n stimulus.style.top = `${y}%`; // Adjust for half of the cell height\n\n if (y < 75) {\n setTimeout(moveStimulus, 10);\n } else {\n calibrationData = 0;\n\n await stopRecording();\n pageCompleted();\n // setTimeout(fixationStimulus, 10);\n }\n }\n\n async function fixationStimulus() {\n for (let x of fixationStimulus_x) {\n for (let y of fixationStimulus_y) {\n let time = new Date().getTime();\n timeArray.push(time);\n xArray.push(x);\n yArray.push(y);\n\n stimulus.style.left = `${x}%`; // Adjust for half of the cell width\n stimulus.style.top = `${y}%`; // Adjust for half of the cell height\n\n // Wait for 4 seconds before moving to the next position\n await new Promise((resolve) => setTimeout(resolve, 4000));\n }\n }\n\n await stopRecording();\n pageCompleted();\n }\n <\/script>\n </body>\n</html>\n';"short"===e.firekit.task.variantParams.calibrationType&&(n='<!doctype html>\n<html lang="en">\n <head>\n <link\n href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"\n rel="stylesheet"\n integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"\n crossorigin="anonymous"\n />\n <meta charset="UTF-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <script src="https://cdn.jsdelivr.net/npm/onnxjs/dist/onnx.min.js"><\/script>\n </head>\n\n <style>\n body {\n margin: 0;\n min-height: 100vh; /* Ensure body takes the full viewport height */\n display: flex; /* Enable Flexbox */\n justify-content: center; /* Center content horizontally */\n align-items: center; /* Center content vertically */\n font-family: sans-serif;\n }\n\n\n\n stim {\n position: absolute;\n height: auto;\n cursor: pointer;\n }\n\n #instruction {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n\n #confirmContainer {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n\n #stimulus {\n position: absolute;\n animation: pulsate 1s infinite;\n width: 25px;\n height: 25px;\n background-color: #1e90ff;\n border-radius: 50%;\n display: block; /* Initially hidden */\n transform: translate(-50%, -50%);\n }\n\n #headCanvas {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n #canvas-container {\n position: relative;\n width: 300px;\n height: 300px;\n top: 30px;\n margin: 0 auto;\n }\n\n @keyframes pulsate {\n 0% {\n transform: scale(1) translate(-50%, -50%);\n }\n 50% {\n transform: scale(1.2) translate(-50%, -50%);\n }\n 100% {\n transform: scale(1) translate(-50%, -50%);\n }\n\n}\n\n </style>\n\n <body>\n \x3c!-- Center Instructions Panel --\x3e\n <div id="calibrationContentArea">\n <div class="row gap-2" id="instruction">\n <div class="col">\n <div class="card" style="width: 45rem; height: 39rem">\n <div class="card-body" style="text-align: center">\n <h3 class="card-title" id="calibrationTitle">\n <b> Calibration Phase </b>\n </h3>\n <h4 class="card-text">Now, we need to calibrate our systems.</h4>\n <h4 class="card-text" id="calibrationDescription"></h4>\n <div style="text-align: center; margin-bottom: 3vh">\n <img\n id="calibrationImage"\n src="https://eyetrackingdata.blob.core.windows.net/public/Images/squareAddition_white.png"\n width="350px"\n />\n </div>\n <div class="btn-group" role="group" aria-label="Basic example">\n <button\n type="button"\n class="btn btn-primary"\n id="startTestButton"\n onclick="startTest()"\n >\n Start\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div id="stimulus" class="pulsating-disc"></div>\n <div id="canvas-container" style="display: none">\n <canvas\n id="headCanvas"\n class="frame"\n style="position: relative; display: none"\n ></canvas>\n </div>\n\n \x3c!-- Confirm Button --\x3e\n <div class="row gap-2" id="confirmContainer" style="display: none">\n <div class="card-body" style="text-align: center">\n <h3>Calibration complete!</h3>\n <button type="button" class="btn btn-primary" id="confirmButton">\n Continue\n </button>\n </div>\n </div>\n\n <div class="panel-block" style="display: block" ;>\n <video class="inputVideo" style="display: none"></video>\n </div>\n\n <audio autoplay id="voiceover"></audio>\n\n <script data-dynamic>\n voiceover = document.getElementById("voiceover");\n document.body.addEventListener("click", function () {\n voiceover.pause();\n voiceover.currentTime = 0; // Stop the voiceover whenever a click is detected\n });\n\n // ----------- required -------------------\n function runAfterEveryFrame(output) {\n if (recordEyeMovements) {\n _gridCoordinates.push({\n x: parseFloat(stimulus.style.left),\n y: parseFloat(stimulus.style.top),\n });\n _eyeCoordinates.push({\n x: output.output.cpuData[0] * 100 - 50,\n y: output.output.cpuData[1] * 100,\n });\n _calibrationData.push(calibrationData);\n let time = new Date().getTime();\n _timeData.push(time);\n }\n }\n\n function pageCompleted() {\n continueProcessing = false;\n recordEyeMovements = false;\n const event = new Event("pageComplete");\n document.dispatchEvent(event);\n }\n\n var current_viewingDistance= 0\n var recordEyeMovements = false;\n var calibrationData = 1;\n var continueProcessing = true;\n\n var deviceConfig = store.session.get("deviceConfig");\n var _gridCoordinates = [];\n var _parentDir = store.session.get("id");\n var _videoURL = "";\n\n var IMAGE_SIZE = 640;\n var upperbound_x = 96;\n var lowerbound_x = 2;\n var upperbound_y = 96;\n var lowerbound_y = 2;\n var stimulus = document.getElementById("stimulus");\n var x = 0;\n var y = 0;\n var counter = 0;\n var incX = 0.15 * 2;\n var incY = 0.02 * 2;\n var timeArray = [];\n var xArray = [];\n var yArray = [];\n var _eyeCoordinates = [];\n var _calibrationData = [];\n var _timeData = [];\n var fixationStimulus_x = [30, 50, 70];\n var fixationStimulus_y = [20, 40, 60];\n\n async function startTest() {\n await runInference();\n openFullscreen();\n updateCountdown(initStimulus);\n }\n\n async function initStimulus() {\n document.getElementById("stimulus").style.display = "block";\n await startRecording();\n recordEyeMovements = true;\n moveStimulus();\n }\n\n\n // Define the locations with repetition to cover 3 seconds at 10ms intervals\n var locations = [\n { x: 25, y: 25 }, // Location 1 (25,25)\n { x: 75, y: 25 }, // Location 2 (25,25)\n { x: 25, y: 65 }, // Location 3 (25,25)\n { x: 75, y: 65 }, // Location 4 (25,25)\n { x: 50, y: 50 } // Location 5 (25,50)\n ];\n\n // Create an array that repeats each location enough times to cover 3 seconds at 10ms intervals\n var sequence = [];\n locations.forEach(loc => {\n for (let i = 0; i < 200; i++) { // 300 * 10ms = 3000ms = 3 seconds\n sequence.push(loc);\n }\n });\n\n\n async function moveStimulus() {\n if (counter < sequence.length) {\n let point = document.getElementById(\'point\');\n stimulus.style.left = `${sequence[counter].x}%`; // Adjust for half of the cell width\n stimulus.style.top = `${sequence[counter].y}%`; // Adjust for half of the cell height\n counter++;\n // Only append to arrays if more than 500ms has passed\n if (counter % 300 > 50) { \n let time = new Date().getTime();\n timeArray.push(time);\n xArray.push(sequence[counter].x); // Use the current x value from the sequence\n yArray.push(sequence[counter].y); // Use the current y value from the sequence\n }\n setTimeout(moveStimulus, 10); // Call this function every 10ms\n } else {\n calibrationData = 0;\n await stopRecording();\n pageCompleted();\n }\n }\n\n\n // async function moveStimulus() {\n // counter = counter + 1;\n // if (x > upperbound_x) {\n // incX = -0.15 * 2;\n // } else if (x < lowerbound_x) {\n // incX = 0.15 * 2;\n // }\n\n // if (y > upperbound_y) {\n // incY = -0.02 * 2;\n // } else if (y < lowerbound_y) {\n // incY = 0.02 * 2;\n // }\n // x = x + incX;\n // y = y + incY;\n // let time = new Date().getTime();\n\n // timeArray.push(time);\n // xArray.push(x);\n // yArray.push(y);\n\n // stimulus.style.left = `${x}%`; // Adjust for half of the cell width\n // stimulus.style.top = `${y}%`; // Adjust for half of the cell height\n\n // if (y < 75) {\n // setTimeout(moveStimulus, 10);\n // } else {\n // calibrationData = 0;\n\n // await stopRecording();\n // pageCompleted();\n // // setTimeout(fixationStimulus, 10);\n // }\n // }\n\n async function fixationStimulus() {\n for (let x of fixationStimulus_x) {\n for (let y of fixationStimulus_y) {\n let time = new Date().getTime();\n timeArray.push(time);\n xArray.push(x);\n yArray.push(y);\n\n stimulus.style.left = `${x}%`; // Adjust for half of the cell width\n stimulus.style.top = `${y}%`; // Adjust for half of the cell height\n\n // Wait for 4 seconds before moving to the next position\n await new Promise((resolve) => setTimeout(resolve, 4000));\n }\n }\n\n await stopRecording();\n pageCompleted();\n }\n <\/script>\n </body>\n</html>\n');const i=document.createElement("div");i.innerHTML='<script src="https://cdn.jsdelivr.net/npm/@mediapipe/face_mesh@0.4/face_mesh.min.js"><\/script>\n\n<script data-dynamic>\n var irisMetrics;\n var headMetrics;\n var headCoordinates;\n var leftEyeCoordinates;\n var rightEyeCoordinates;\n var movingContour;\n var fixedContour;\n var canvasContour;\n var focalLengthMultiple;\n var headMetrics_array = [];\n var irisMetrics_array = [];\n var videoRecorder;\n var videoChunks = [];\n var leftEyectx;\n var rightEyectx;\n var normalizedFocalLength;\n var blueCircle;\n\n var inputVideo = document.getElementsByClassName("inputVideo")[0];\n var headCanvas = document.getElementById("headCanvas");\n var headCtx = headCanvas.getContext("2d");\n\n var faceMesh = new FaceMesh({\n locateFile: (file) => {\n return `https://cdn.jsdelivr.net/npm/@mediapipe/face_mesh@0.4/${file}`;\n },\n });\n\n faceMesh.setOptions({\n selfieMode: true,\n enableFaceGeometry: false,\n maxNumFaces: 1,\n refineLandmarks: true,\n minDetectionConfidence: 0.5,\n minTrackingConfidence: 0.5,\n });\n\n faceMesh.onResults(onResultsFaceMesh);\n\n async function runInference() {\n await faceMesh.send({ image: inputVideo });\n try {\n if (!leftEyeCoordinates || !rightEyeCoordinates) {\n throw new Error("No face detected");\n }\n let input1, input2, kpsTensor;\n let [upper_left_x, upper_left_y, width, height] = convertToYolo(\n leftEyeCoordinates,\n inputVideo.videoWidth,\n inputVideo.videoHeight,\n );\n let kps = [\n upper_left_x / inputVideo.videoWidth,\n upper_left_y / inputVideo.videoHeight,\n width / inputVideo.videoWidth,\n height / inputVideo.videoHeight,\n ];\n\n leftEyectx.drawImage(\n inputVideo,\n Math.max(0, inputVideo.videoWidth - upper_left_x - width),\n Math.max(0, upper_left_y),\n Math.max(0, width),\n Math.max(0, height),\n 0,\n 0,\n 128,\n 128,\n );\n\n [upper_left_x, upper_left_y, width, height] = convertToYolo(\n rightEyeCoordinates,\n inputVideo.videoWidth,\n inputVideo.videoHeight,\n );\n kps.push(\n upper_left_x / inputVideo.videoWidth,\n upper_left_y / inputVideo.videoHeight,\n width / inputVideo.videoWidth,\n height / inputVideo.videoHeight,\n );\n rightEyectx.drawImage(\n inputVideo,\n Math.max(0, inputVideo.videoWidth - upper_left_x - width),\n Math.max(0, upper_left_y),\n Math.max(0, width),\n Math.max(0, height),\n 0,\n 0,\n 128,\n 128,\n );\n\n imageData = leftEyectx.getImageData(0, 0, 128, 128);\n let preprocessedData = preprocess(imageData.data, 128, 128);\n input1 = new Tensor(preprocessedData, "float32", [1, 3, 128, 128]);\n imageData = rightEyectx.getImageData(0, 0, 128, 128);\n preprocessedData = preprocess(imageData.data, 128, 128);\n input2 = new Tensor(preprocessedData, "float32", [1, 3, 128, 128]);\n preprocessedData = preprocess_kps(kps);\n kpsTensor = new Tensor(preprocessedData, "float32", [1, 8]);\n\n myWorker.postMessage({\n input1: input1,\n input2: input2,\n kpsTensor: kpsTensor,\n });\n } catch (error) {\n setTimeout(runInference, 50);\n }\n }\n\n myWorker.onmessage = async (e) => {\n if (e.data.error) {\n console.error("Error from worker:", e.data.error);\n } else {\n runAfterEveryFrame((output = e.data));\n }\n\n if (continueProcessing) {\n runInference();\n }\n };\n<\/script>\n';const a=document.createElement("div");a.style.position="fixed",a.style.top="0",a.style.left="0",a.style.width="100%",a.style.height="100%",await Vp(Fl),await Vp(Rl),a.innerHTML=n;const o=Vc;document.body.appendChild(a),await Up(a),await Up(i),Hp(i),Hp(a),async function(e){var t=document.getElementById("voiceover");t.src="https://eyetrackingdata.blob.core.windows.net/public/Audios/calibration.mp3",t.play(),document.getElementById("calibrationTitle").innerHTML="<b>Calibration Phase</b>",document.getElementById("calibrationDescription").innerHTML="You will see a blue disc pop up on the screen. Follow it with your eyes <b>without</b> moving your head.";var n=document.getElementById("calibrationImage");n.src="https://eyetrackingdata.blob.core.windows.net/public/Images/eyecalibration.gif","short"===e.firekit.task.variantParams.calibrationType&&(n.src="https://eyetrackingdata.blob.core.windows.net/public/Images/eyecalibration_short.gif");initEyeTracking(!1),await giveAccess()}(e),await new Promise((t=>{document.addEventListener("pageComplete",(async()=>{var n;a.innerHTML=o,(n=a).style.position="",n.style.top="",n.style.left="",n.style.width="",n.style.height="";const i=function(e,t){const n=new Fp(e.map((e=>e.x)),t.map((e=>e.x)),1),i=new Fp(e.map((e=>e.y)),t.map((e=>e.y)),1);return{x_regressor:n.coefficients,y_regressor:i.coefficients}}(_eyeCoordinates.filter(((e,t)=>1==_calibrationData[t])),_gridCoordinates.filter(((e,t)=>1==_calibrationData[t])));!function(e){s.session.set("x_coef",e.x_regressor[1]),s.session.set("x_intercept",e.x_regressor[0]),s.session.set("y_coef",e.y_regressor[1]),s.session.set("y_intercept",e.y_regressor[0])}(i),await async function(e){console.log("Test Finished");const t=(new Date).getTime();var n="RAN_eyeCalibration_"+e.toString()+"_"+t+".webm";_videoURL=n;try{await saveRecordings(n,s.session.get("id"))}catch(e){console.error("Error in saveRecordings:",e)}}(50);const r={assessment_type:"RAN",assessment_stage:"eyeCalibration",recordedVideo:_videoURL,distance:50,regressors:i,stimulusPosition:_gridCoordinates,eyeCoordinates:_eyeCoordinates,calibrationData:_calibrationData,_timeData:_timeData,parentDir:s.session.get("id"),deviceConfig:s.session.get("deviceConfig"),participantConfig:s.session.get("participantConfig"),correct:1};e.firekit.writeTrial(r),Bp(Fl),Bp(Rl),a.remove(),document.querySelectorAll("script[data-dynamic]").forEach((e=>e.parentNode.removeChild(e))),t()}),{once:!0})}))}async function Vp(e){Object.keys(e).forEach((t=>{window[t]=e[t]}))}function Bp(e){Object.keys(e).forEach((e=>{const t=Object.getOwnPropertyDescriptor(window,e);t&&t.configurable?delete window[e]:console.log(`Cannot remove ${e} from window; it may be non-configurable.`)}))}async function Up(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=t[e];n.src&&await Wp(n.src)}}function Hp(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=document.createElement("script");n.text=t[e].text,document.head.appendChild(n).parentNode.removeChild(n)}}function Wp(e){return new Promise(((t,n)=>{const i=document.createElement("script");i.src=e,i.onload=t,i.onerror=n,document.head.appendChild(i)}))}window.store=s;async function $p(e,t){const n=document.createElement("div");n.innerHTML='<!DOCTYPE html>\n<html lang="en">\n<head>\n <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n</head>\n\n<style>\n \n body {\n margin: 0;\n min-height: 100vh; /* Ensure body takes the full viewport height */\n display: flex; /* Enable Flexbox */\n justify-content: center; /* Center content horizontally */\n align-items: center; /* Center content vertically */\n font-family: sans-serif;\n overflow: hidden;\n }\n\n .character {\n position: absolute;\n top: 65%;\n left: 70%;\n margin-right: -50%;\n transform: translate(-50%, -50%);\n width: 45%;\n }\n\n .speechBubble {\n border-style: solid;\n border-width: 5px;\n border-color: rgb(255, 232, 128);\n border-radius: 10px;\n text-align: center;\n padding: 5vh;\n background-color: rgb(253 246 234);\n }\n\n stim {\n position: absolute;\n height: auto;\n cursor: pointer;\n }\n\n #instruction {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n \n #confirmContainer {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n \n </style>\n\n\n<body>\n\n \x3c!-- Center Instructions Panel --\x3e\n <div id="storyContentArea">\n <img id="bg" style="object-fit: contain; position: relative;">\n <img id="char" class="character">\n <div style="position: absolute; top: 40%; right: 50%;">\n <h4 class="speechBubble" id="text"> </h4>\n </div>\n </div>\n\n \x3c!-- Audio Playing --\x3e \n <audio id="voiceover"> </audio>\n \n </body>\n\n<script data-dynamic>\n\n var counter = 0;\n\n var testConfig = store.session.get(\'testConfig\');\n\n document.body.addEventListener(\'click\', function() {\n startNextView(); // Call startNextView function whenever a click is detected \n });\n\n document.getElementById(\'voiceover\').addEventListener(\'ended\', function() {\n voiceover.currentTime = 0; // Added this so the story will automatically progress once the audio ends, not only dependent on participant clicks\n startNextView();\n })\n\n if (testConfig[\'testname\'] === \'Letter\') {\n var calibrationText = "Ah! I think my navigation system broke <br> on the way here. Could you help me fix it? </br>"\n var practiceText = "Awesome! Thank you for calibrating my <br> navigation system. We can practice reading out the </br> letter directions to Rantopia now."\n var testText = "Perfect! Let\'s enter them for real. <br> Can you read me the letter directions </br> as fast as you can?"\n var testLower = "letter";\n } else {\n var calibrationText = "Darn, the radar is completely broken. <br> Let\'s fix it together! </br>"\n var practiceText = "You are an expert engineer! <br> We can practice reading out </br> the number coordinates to Rantopia now."\n var testText = "Amazing! Let\'s enter them for real. <br> Can you read me the number coordinates </br> as fast as you can?"\n var testLower = "number";\n }\n\n function startNextView() {\n counter++;\n var char = document.getElementById(\'char\');\n var bg = document.getElementById(\'bg\');\n var text = document.getElementById(\'text\');\n var voiceover = document.getElementById(\'voiceover\');\n\n if (stage === "Introduction"){\n console.log(stage, counter);\n switch (counter) {\n case 1:\n char.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/astronaut-girl-default.png`;\n bg.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/space-ship-control.png`;\n voiceover.src = `https://eyetrackingdata.blob.core.windows.net/public/Audios/intro.mp3`;\n text.innerHTML = `Hi! My name is Stella. <br> It\'s always great to meet a fellow astronaut. </br>`;\n break;\n case 2:\n char.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/astronaut-girl-panicked.png`;\n bg.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/space-ship-control.png`;\n voiceover.src = `https://eyetrackingdata.blob.core.windows.net/public/Audios/intro2.mp3`;\n text.innerHTML = `I was doing some errands for my mom, <br> but then I got lost. </br> She\'s probably so worried about me!`;\n break;\n case 3:\n char.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/astronaut-girl-unsure.png`;\n bg.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/space-ship-control.png`;\n voiceover.src = `https://eyetrackingdata.blob.core.windows.net/public/Audios/intro3.mp3`;\n text.innerHTML = `Could you help me calibrate my <br> navigation system so I can get to Rantopia? </br>`;\n break;\n default:\n // Reset or end\n counter = 0; \n pageCompleted()\n }\n } else if (stage === "Calibration") {\n console.log(stage, counter);\n switch (counter) {\n case 1:\n char.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/astronaut-girl-confused.png`;\n bg.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/space-ship-control.png`;\n voiceover.src = `https://eyetrackingdata.blob.core.windows.net/public/Audios/${testLower}StoryCalibration.mp3`;\n text.innerHTML = calibrationText;\n break;\n default:\n // Reset or end\n counter = 0; \n pageCompleted()\n }\n } else if (stage === "Practice"){\n console.log(stage, counter);\n switch (counter) {\n case 1:\n char.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/astronaut-girl-smile.png`;\n bg.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/space-ship-control.png`;\n voiceover.src = `https://eyetrackingdata.blob.core.windows.net/public/Audios/${testLower}StoryPractice.mp3`;\n text.innerHTML = practiceText;\n break;\n default:\n // Reset or end\n counter = 0; \n pageCompleted()\n }\n } else if (stage === "Test"){\n console.log(stage, counter);\n switch (counter) {\n case 1:\n char.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/astronaut-girl-smile.png`;\n bg.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/purple-planet.png`;\n voiceover.src = `https://eyetrackingdata.blob.core.windows.net/public/Audios/${testLower}StoryTest.mp3`;\n text.innerHTML = testText;\n break;\n default:\n // Reset or end\n counter = 0; \n pageCompleted()\n }\n } else if (stage === "Ending"){\n console.log(stage, counter);\n switch (counter) {\n case 1:\n char.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/astronaut-girl-happy.png`;\n bg.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/orange-planet.png`;\n voiceover.src = `https://eyetrackingdata.blob.core.windows.net/public/Audios/end.mp3`;\n text.innerHTML = `We made it to Rantopia! <br> I can finish grabbing all </br> the things I need for my mom.`;\n break;\n case 2:\n char.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/astronaut-girl-bye.png`;\n bg.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/orange-planet.png`;\n voiceover.src = `https://eyetrackingdata.blob.core.windows.net/public/Audios/end2.mp3`;\n text.innerHTML = `I couldn’t have done this <br> without your help. </br> Come visit me again sometime!`;\n break;\n default:\n // Reset or end\n counter = 0; \n pageCompleted()\n }\n }\n\n // playing the voiceover \n if (voiceover.src !== ""){\n voiceover.play(); \n }\n\n }\n\n function pageCompleted(){\n const event = new Event(\'pageComplete\');\n document.dispatchEvent(event);\n }\n \n <\/script>',document.body.appendChild(n),window.stage=e,await async function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=t[e];n.src&&await Kp(n.src)}}(n),function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=document.createElement("script");n.text=t[e].text,document.head.appendChild(n).parentNode.removeChild(n)}}(n),startNextView(),await new Promise((e=>{document.addEventListener("pageComplete",(()=>{n.remove(),function(){e=document.body,t=e.cloneNode(!0),e.parentNode.replaceChild(t,e);var e,t;document.querySelectorAll("script[data-dynamic]").forEach((e=>{(e.textContent||e.innerText).includes("voiceover.addEventListener('ended'")||e.parentNode.removeChild(e)}))}(),e()}),{once:!0})}))}function Kp(e){return new Promise(((t,n)=>{const i=document.createElement("script");i.src=e,i.onload=t,i.onerror=n,document.head.appendChild(i)}))}window.store=s;async function Yp(e){window.tests_url=e;const t=document.createElement("div");t.innerHTML="\x3c!-- Scripts --\x3e\n<link href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css\" rel=\"stylesheet\" integrity=\"sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3\" crossorigin=\"anonymous\">\n\n\x3c!-- CSS --\x3e\n<style>\n\nbody {\n margin: 0;\n}\n\n .column {\n float: left;\n padding: 10px;\n}\n\n.left, .right {\n width: 33%;\n}\n\n.middle {\n width: 33%;\n}\n\n.row:after {\n content: \"\";\n display: table;\n clear: both;\n}\n\n</style>\n\n\x3c!-- HTML --\x3e\n<body id=\"body\">\n <div class=\"px-4 py-5 my-5 text-center\" style=\"display: block;\">\n <h1 class=\"display-5 fw-bold\" id=\"title\"> Activity Selection Menu </h1>\n <div class=\"col-lg-6 mx-auto\">\n <p class=\"lead mt-3 mb-5\"></p>\n <h4 class=\"card-text\"> Select an activity. Click on one of the options below to continue with the activity: </h4>\n <div class=\"row gap-2\" id=\"menuButtons\">\n </div>\n </div>\n </div>\n\n \x3c!-- Audio Playing --\x3e \n <audio autoplay src=\"https://eyetrackingdata.blob.core.windows.net/public/Audios/activityMenu.mp3\"> </audio>\n\n</body>\n\n<script data-dynamic>\n\ndocument.body.addEventListener('click', function() {\n voiceover.pause();\n voiceover.currentTime = 0;; // Stop the voiceover whenever a click is detected \n});\n\n // var jsonUrl = 'https://eyetrackingdata.blob.core.windows.net/public/config/tests.json';\n\n fetch(tests_url)\n .then(response => response.json())\n .then(data => {\n // Extract test names from the JSON data\n const testNames = Object.keys(data);\n // Create buttons dynamically based on test names\n const menuButtonsContainer = document.getElementById('menuButtons');\n const clickedTests = store.session.get('clickedTests') || [];\n testNames.forEach(testName => {\n console.log(testName)\n console.log(data[testName])\n\n const button = document.createElement('button');\n button.type = 'button';\n button.id = `button_${testName}`; \n button.className = 'btn btn-primary';\n button.textContent = testName;\n\n if (clickedTests.includes(testName)) {\n button.classList.add('btn-secondary'); // Grayish color\n button.disabled = true\n }\n\n button.addEventListener('click', () => {\n console.log(`CLICKED ${testName}`)\n // Set the selected testType\n store.session.set('testConfig', data[testName]);\n console.log(`Stored testType: ${testName}`);\n \n // Highlight the clicked button and remove highlighting from others\n const buttons = menuButtonsContainer.getElementsByTagName('button');\n for (const otherButton of buttons) {\n otherButton.classList.remove('btn-success');\n }\n\n button.classList.add('btn-success');\n // Store the clicked test name in the array\n store.session.set('clickedTests', clickedTests);\n\n });\n menuButtonsContainer.appendChild(button);\n });\n\n if ((clickedTests.length+1) >= document.querySelectorAll('button').length){\n console.log((clickedTests.length+1),document.querySelectorAll('button').length)\n store.session.set('testComplete',true)\n }\n })\n .catch(error => console.error('Error fetching JSON:', error));\n\n<\/script>\n ",document.body.appendChild(t),await async function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=t[e];n.src&&await Xp(n.src)}}(t),function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=document.createElement("script");n.text=t[e].text,document.head.appendChild(n).parentNode.removeChild(n)}}(t),await new Promise((e=>{document.body.addEventListener("click",(function(n){n.target.id.startsWith("button_")&&(console.log("Button clicked:",n.target.id),document.querySelectorAll("script[data-dynamic]").forEach((e=>e.parentNode.removeChild(e))),t.remove(),e())}))}))}function Xp(e){return new Promise(((t,n)=>{const i=document.createElement("script");i.src=e,i.onload=t,i.onerror=n,document.head.appendChild(i)}))}window.store=s;var Gp=4,Jp=9;function Qp(e,t,n){const i=document.getElementById("grid-container"),a=Gp*Jp;for(let o=0;o<a;o++){if("Practice"===type&&(o<Jp||o>=2*Jp))continue;const a=document.createElement("div"),{x:s,y:r,width:c,height:l}=e[o];a.style.width=`${c}px`,a.style.height=`${l}px`,a.style.left=`${s}px`,a.style.top=`${r}px`,a.style.position="absolute",a.style.transform="translate(-50%, -50%)",a.style.display="flex",a.style.justifyContent="center",a.style.alignItems="center";const p=t[o],u=document.createElement("img");u.src=`${n.dir}/${p}`,u.style.width="50%",u.style.height="auto",a.appendChild(u),i.appendChild(a);const d=u.getBoundingClientRect();d.x=d.x+d.width/2,d.y=d.y+d.height/2;const m={x:parseFloat(a.style.left),y:parseFloat(a.style.top),width:parseFloat(a.style.width),height:parseFloat(a.style.height),stim_x:d.x,stim_y:d.y,stim_width:d.width,stim_height:d.height};_gridCoordinates.push(m),_shuffledImages.push(p.slice(0,-4))}}async function Zp(e=!1){try{const t=e?{audio:!0}:{video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:60,max:60}},audio:!0},n=await navigator.mediaDevices.getUserMedia(t);if(camera_stream=n,camera_stream&&camera_stream.active)return videoChunks=[],videoRecorder=new MediaRecorder(camera_stream),videoRecorder.ondataavailable=e=>{e.data.size>0&&videoChunks.push(e.data)},Promise.resolve(camera_stream);throw new Error("Camera stream is not active")}catch(e){return console.error("Error accessing media devices:",e),Promise.reject(e)}}async function eu(){audioChunks=[],videoChunks=[],videoRecorder.start()}async function tu(e,t,n){try{const i=await fetch(`https://us-central1-webapp-af756.cloudfunctions.net/getUploadUrlFunction?fileName=${e}&mimeType=${t}&parentDir=${n}`);if(!i.ok)throw new Error("Failed to fetch upload URL");return(await i.json()).result}catch(e){throw console.error("Error fetching upload URL:",e),e}}async function nu(e,t){try{const n=await fetch(t,{method:"PUT",headers:{"Content-Type":e.type,"Content-Length":e.size},body:e});if(!n.ok)throw new Error("Upload failed: "+n.statusText);console.log("Upload complete:",await n.text())}catch(e){console.error("Error:",e)}}var iu=4;function au(e){0==--iu?(document.getElementById("instruction").style.display="none",document.getElementById("grid-container").style.visibility="visible",iu=4):(document.getElementById("instruction").innerHTML="<h1>"+iu+"</h1>",setTimeout((function(){au()}),1e3))}function ou(){desktop.requestFullscreen?desktop.requestFullscreen():desktop.webkitRequestFullscreen?desktop.webkitRequestFullscreen():desktop.msRequestFullscreen&&desktop.msRequestFullscreen()}var su=Object.freeze({__proto__:null,get countdown(){return iu},generateGridCoordinates:function(e){let t,n,i,a;if(console.log(e.screenWidth,e.screenHeight,e.screenWidthPX,e.screenHeightPX),e.screenWidth>0&&e.screenHeight>0){const i=13/Gp;t=24.75/Jp*(e.screenWidthPX/e.screenWidth),n=i*(e.screenHeightPX/e.screenHeight)}else{const i=.8*e.screenWidthPX,a=.8*e.screenHeightPX;t=i/Jp,n=a/Gp}i=t*Jp,a=n*Gp;const o=(e.screenWidthPX-i)/2,s=(e.screenHeightPX-a)/2,r=[];for(let e=0;e<Gp;e++)for(let i=0;i<Jp;i++){const a=o+i*t+t/2,c=s+e*n+n/2;r.push({x:a,y:c,width:t,height:n})}return r},generateStimulusOrder:function(e){const t=Gp*Jp,n=e.stimulus.slice(),i=Math.ceil(t/n.length),a=[];for(let e=0;e<i;e++){const e=n.sort((()=>Math.random()-.5));a.push(...e)}for(let e=1;e<a.length;e++)if(a[e]===a[e-1]){const t=a[e];a[e]=a[e+1],a[e+1]=t}return a.slice(0,t)},getUploadUrl:tu,giveAccess:Zp,gridHeightCM:13,gridWidthCM:24.75,numCols:Jp,numRows:Gp,openFullscreen:ou,populateGrid:Qp,saveRecordings:async function(e,t,n="video/webm"){await new Promise((e=>{videoRecorder.onstop=e,videoRecorder.stop()}));const i=new Blob(videoChunks,{type:"video/webm"});if(i.size>0){console.log("Video recorded successfully. Size:",i.size,"bytes");try{Bc.storeAudio&&Bc.storeVideo?n="video/webm":Bc.storeAudio&&(n="audio/webm"),console.log("mimie",n);const a=await tu(e,n,t);await nu(i,a)}catch(e){console.error("Error getting video upload URL:",e)}}else console.error("No video data recorded.")},startRecording:eu,startTest:async function(){await Zp(!Bc.bEyeTracking),document.getElementById("finishButton").disabled=!1,ou(),eu(),Qp(gridCoordinates,shuffledImages,testConfig),au()},stopRecording:async function(){videoRecorder.stop()},updateCountdown:au,uploadFile:nu});async function ru(e,t){const n=document.createElement("div");n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.height="100%",await async function(e){Object.keys(e).forEach((t=>{window[t]=e[t]}))}(su),console.log("countdown",countdown),n.innerHTML='<!DOCTYPE html>\n<html lang="en">\n<head>\n <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>Image and Audio Recording</title>\n\n \x3c!-- <script data-dynamic src="./RAN.js"><\/script> --\x3e\n</head>\n\n<style>\n \n body {\n margin: 0;\n min-height: 100vh; /* Ensure body takes the full viewport height */\n display: flex; /* Enable Flexbox */\n justify-content: center; /* Center content horizontally */\n align-items: center; /* Center content vertically */\n font-family: sans-serif;\n }\n\n stim {\n position: absolute;\n height: auto;\n cursor: pointer;\n }\n\n #instruction {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n \n #confirmContainer {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n</style>\n\n\n<body>\n\n <div id="grid-container" style="position: absolute; width: 100%; height: 100%; visibility: hidden;"></div>\n\n \x3c!-- Center Instructions Panel --\x3e\n <div id="instructionsContentArea">\n <div class="row gap-2" id="instruction">\n <div class="col">\n <div class="card" style="width:45rem; height:39rem">\n <div class="card-body" id="cardthing" style="text-align: center;">\n <h3 class="card-title" id="instructionTitle"></h3>\n <h4 class="card-text" id="instructionSubtitle"></h4>\n <h4 class="card-text" id="instructionDescription"></h4>\n <div style="text-align: center; margin-bottom: 3vh;">\n <img id="explanationGif" src="https://eyetrackingdata.blob.core.windows.net/public/Images/squareAddition_white.png" width="350px">\n </div>\n \x3c!-- <div class="btn-group" role="group" aria-label="Basic example" style="margin-bottom: 2vh;"> --\x3e\n \x3c!-- <button type="button" class="btn btn-primary" id="giveAccessButton" onclick="giveAccess()">Give Access to Mic/Camera</button> --\x3e\n \x3c!-- <br> --\x3e\n <button type="button" class="btn btn-primary" id="startTestButton" onclick="startTest()">Start</button>\n </div>\n </div>\n </div>\n </div>\n </div> \n \n </div>\n \n \x3c!-- Audio Playing --\x3e \n <audio autoplay id="voiceover"> </audio>\n \n \x3c!-- Confirm Button --\x3e\n <div class="row gap-2" id="confirmContainer" style="display: none;">\n <div class="card-body" style="text-align: center;">\n <h3> <span id="capName"></span> Test Complete </h3>\n <button type="button" class="btn btn-primary" id="confirmButton">Back to Menu</button>\n </div>\n </div>\n\n \x3c!-- Finish Button --\x3e\n <div id="finishButtonContainer" style="position: fixed; bottom: 10px; right: 10px; z-index: 1;">\n <button type="button" class="btn btn-primary" id="finishButton" disabled>Finish</button>\n </div>\n\n<script data-dynamic>\n\nvar deviceConfig = store.session.get(\'deviceConfig\')\n// var deviceConfig = {screenWidth: 29, screenHeight: 16.2, screenWidthPX: 960, screenHeightPX: 540, webcamHeight: 0.5}\nvar testConfig = store.session.get(\'testConfig\')\n// var testConfig = {dir: "https://eyetrackingdata.blob.core.windows.net/public/assets/Letter",\n// stimulus : ["C.svg", "D.svg", "H.svg", "K.svg", "N.svg", "O.svg", "R.svg", "S.svg", "V.svg", "Z.svg"],\n// sizecm: 2}\n\nif (testConfig[\'testname\'] === \'Letter\') {\n var subtestText = [\'Letter\', \'letter\']\n} else {\n var subtestText = [\'Number\', \'number\']\n}\n\nvar voiceover = document.getElementById(\'voiceover\');\nvoiceover.src = `https://eyetrackingdata.blob.core.windows.net/public/Audios/${subtestText[1]}Calibration.mp3`;\n\ndocument.body.addEventListener(\'click\', function() {\n voiceover.pause();\n voiceover.currentTime = 0;; // Stop the voiceover whenever a click is detected \n});\n\nvar desktop = document.documentElement;\nvar camera_stream;\nvar videoRecorder;\nvar audioChunks = [];\nvar videoChunks = [];\n\nvar clickedTests = store.session.get(\'clickedTests\') || [];\nif (type!==\'Practice\') {\nclickedTests.push(testConfig[\'testname\'])\n}\n\nstore.session.set(\'clickedTests\',clickedTests)\n\nvar gridCoordinates = generateGridCoordinates(deviceConfig)\nvar shuffledImages = generateStimulusOrder(testConfig)\n \nvar _gridCoordinates = []\n// gridCoordinates\nvar _shuffledImages = []\n// shuffledImages.map(filename => filename.split(\'.\')[0]);\nvar _parentDir = store.session.get("id")\nvar _videoURL = \'\'\nvar _deviceConfig = deviceConfig\nvar _testConfig = testConfig\n\n// async function finishTest() {\n// console.log(\'Test Finished\');\n// // Remove the clicked image\n// await stopRecording(); // Stop recording when stimulus is clicked\n// const timestamp = new Date().getTime();\n// document.getElementById("finishButton").disabled=true\n \n// var filename = \'RAN\' + \'_\' + testConfig[\'testname\'] + \'_\' + timestamp + \'.webm\'\n// _videoURL.push(filename)\n\n// document.getElementById("confirmContainer").style.display = "block"\n// document.getElementById("grid-container").style.display = "none"\n// document.getElementById("finishButtonContainer").style.display = "none"\n\n\n// if (type!==\'Practice\') {\n// try{\n// await saveRecordings(filename= filename ,parentDir=store.session.get("id")); // Save the recorded audio and video\n// } catch (error) {\n// console.error(\'Error in saveRecordings:\', error);\n// }\n// }\n\n// }\n\n\n<\/script>\n\n</body>\n</html>\n';const i=Vc;document.body.appendChild(n),window.type=e,await async function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=t[e];n.src&&await cu(n.src)}}(n),function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=document.createElement("script");n.text=t[e].text,document.head.appendChild(n).parentNode.removeChild(n)}}(n),function(e){document.getElementById("instructionTitle").innerHTML=`<b>${subtestText[0]} ${e} Phase</b>`,document.getElementById("explanationGif").src=`https://eyetrackingdata.blob.core.windows.net/public/Images/${subtestText[1]}-${e.toLowerCase()}-reading-order.gif`;var t=document.getElementById("voiceover");if("Practice"===e){document.getElementById("instructionSubtitle").innerHTML="Let's do some practice!",document.getElementById("instructionDescription").innerHTML=`You’re going to see a row of ${subtestText[1]}s. <span id="distance-span"> </span> </h4>\n Read them out loud as fast as you can without making mistakes. <span id="distance-span"> </span> </h4>\n Remember to read like you normally do by going from <b> left to right. </b> <span id="distance-span"> </span> </h4>\n Click the "Finish" button (bottom right) when you are done. <span id="distance-span"> </span> </h4>`,t.src=`https://eyetrackingdata.blob.core.windows.net/public/Audios/${subtestText[1]}${e}.mp3`}else{document.getElementById("instructionSubtitle").innerHTML="Let’s start for real now.",document.getElementById("instructionDescription").innerHTML=`Read the ${subtestText[1]}s as fast as you can without making mistakes. Remember to read in the right direction. <span id="distance-span"> </span> </h4>\n Click the "Finish" button (bottom right) when you are done.<span id="distance-span"> </span> </h4>`,t.src=`https://eyetrackingdata.blob.core.windows.net/public/Audios/${subtestText[1]}${e}.mp3`}}(e),await new Promise((e=>{document.body.addEventListener("click",(async function(a){if("finishButton"===a.target.id){console.log("Button clicked:",a.target.id),n.innerHTML=i,(o=n).style.position="",o.style.top="",o.style.left="",o.style.width="",o.style.height="",await async function(){console.log("Test Finished");const e=(new Date).getTime();await stopRecording();var t="RAN_"+testConfig.testname+"_"+e+".webm";_videoURL=t,console.log(s.session.get("id"));try{await saveRecordings(t,s.session.get("id"))}catch(e){console.error("Error in saveRecordings:",e)}}();const r={assessment_type:testConfig.testname,assessment_stage:"Test",stimulusPosition:_gridCoordinates,stimulus:_shuffledImages,recordedVideo:_videoURL,parentDir:_parentDir,correct:1,deviceConfig:_deviceConfig,testConfig:_testConfig};t.firekit.writeTrial(r),n.remove(),function(e){function t(e){const t=e,n=t.cloneNode(!0);t.parentNode.replaceChild(n,t)}!function(e){Object.keys(e).forEach((e=>{const t=Object.getOwnPropertyDescriptor(window,e);t&&t.configurable?delete window[e]:console.log(`Cannot remove ${e} from window; it may be non-configurable.`)}))}(e);document.querySelectorAll("button").forEach((e=>{t(e)}));for(;document.body.firstChild;)document.body.removeChild(document.body.firstChild);document.querySelectorAll("script[data-dynamic]").forEach((e=>e.parentNode.removeChild(e)))}(su),e()}var o}))}))}function cu(e){return new Promise(((t,n)=>{const i=document.createElement("script");i.src=e,i.onload=t,i.onerror=n,document.head.appendChild(i)}))}window.store=s;class lu{constructor(e,t,n,i){this.gameParams=t,this.userParams=n,this.firekit=e,this.displayElement=i,this.jsPsych=null}async init(){}async run(){this.gameParams.consent&&await Fc(),await this.firekit.startRun();const e=await(async(e,t,n,i)=>{const a=wo(wo({...t,...n},ko),_o),{userMetadata:o={},audioFeedback:s,grade:r,language:c=Ds.language,skipInstructions:l,practiceCorpus:p,stimulusCorpus:u,sequentialPractice:d,sequentialStimulus:m,buttonLayout:h,numberOfTrials:f,storyCorpus:g,taskName:v,stimulusBlocks:b,numOfPracticeTrials:x,storyOption:y,keyHelpers:w}=a;"en"!==c&&Ds.changeLanguage(c);const k={userMetadata:{...o,grade:r},audioFeedback:s||"neutral",skipInstructions:l??!0,startTime:new Date,firekit:e,displayElement:i||null,practiceCorpus:p??"math-item-bank-practice-pz",stimulusCorpus:u??"math-item-bank-pz",sequentialPractice:d??!0,sequentialStimulus:m??!0,buttonLayout:h||"default",numberOfTrials:f??10,task:v??"egma-math",stimulusBlocks:b??3,numOfPracticeTrials:x??2,storyOption:y,story:qc(y,r),keyHelpers:w??!0};console.log("this is grade:",r),console.log("this is storyOption:",y);const _=Object.fromEntries(Object.entries(t).map((([e,t])=>[e,"story"===e?t:k[e]??t])));return await k.firekit.updateTaskParams(_),null!==k.pid&&await k.firekit.updateUser({assessmentPid:k.pid,...o}),k})(this.firekit,this.gameParams,this.userParams,this.displayElement);e.story=!0,s.session.set("config",e),await Yc(e),e.story&&await $p("Introduction");let t=!1;do{await Yp(`https://eyetrackingdata.blob.core.windows.net/public/config/${this.gameParams.testConfigFile}.json`),e.story&&await $p("Calibration"),1==this.gameParams.bEyeTracking&&("short"===this.gameParams.calibrationType?await zp(e):await nl(e)),e.story&&await $p("Practice"),await ru("Practice",e),e.story&&await $p("Test"),await ru("Test",e),t="true"===sessionStorage.getItem("testComplete")}while(!t);e.story&&await $p("Ending")}}export{lu as default};
11
- //# sourceMappingURL=index.22a6eb82.js.map
10
+ !function(t){var n,i,a,o=Us,s=e.extname,r=/^\s*([^;\s]*)(?:;|\s|$)/,c=/^text\//i;function l(e){if(!e||"string"!=typeof e)return!1;var t=r.exec(e),n=t&&o[t[1].toLowerCase()];return n&&n.charset?n.charset:!(!t||!c.test(t[1]))&&"UTF-8"}t.charset=l,t.charsets={lookup:l},t.contentType=function(e){if(!e||"string"!=typeof e)return!1;var n=-1===e.indexOf("/")?t.lookup(e):e;if(!n)return!1;if(-1===n.indexOf("charset")){var i=t.charset(n);i&&(n+="; charset="+i.toLowerCase())}return n},t.extension=function(e){if(!e||"string"!=typeof e)return!1;var n=r.exec(e),i=n&&t.extensions[n[1].toLowerCase()];if(!i||!i.length)return!1;return i[0]},t.extensions=Object.create(null),t.lookup=function(e){if(!e||"string"!=typeof e)return!1;var n=s("x."+e).toLowerCase().substr(1);if(!n)return!1;return t.types[n]||!1},t.types=Object.create(null),n=t.extensions,i=t.types,a=["nginx","apache",void 0,"iana"],Object.keys(o).forEach((function(e){var t=o[e],s=t.extensions;if(s&&s.length){n[e]=s;for(var r=0;r<s.length;r++){var c=s[r];if(i[c]){var l=a.indexOf(o[i[c]].source),p=a.indexOf(t.source);if("application/octet-stream"!==i[c]&&(l>p||l===p&&"application/"===i[c].substr(0,12)))continue}i[c]=e}}}))}(Bs);var Hs=n(Bs),Ws="undefined"!=typeof window?window:{screen:{},navigator:{}},$s=(Ws.matchMedia||function(){return{matches:!1}}).bind(Ws),Ks={get passive(){return!0}},Ys=function(){};Ws.addEventListener&&Ws.addEventListener("p",Ys,Ks),Ws.removeEventListener&&Ws.removeEventListener("p",Ys,!1);var Xs="ontouchstart"in Ws,Gs=Xs||"TouchEvent"in Ws&&$s("(any-pointer: coarse)").matches,Js=(Ws.navigator.maxTouchPoints||0)>0||Gs,Qs=Ws.navigator.userAgent||"",Zs=$s("(pointer: coarse)").matches&&/iPad|Macintosh/.test(Qs)&&Math.min(Ws.screen.width||0,Ws.screen.height||0)>=768,er=($s("(pointer: coarse)").matches||!$s("(pointer: fine)").matches&&Xs)&&!/Windows.*Firefox/.test(Qs),tr=$s("(any-pointer: fine)").matches||$s("(any-hover: hover)").matches||Zs||!Xs,nr=!Js||!tr&&er?Js?"touchOnly":"mouseOnly":"hybrid",ir="mouseOnly"===nr?"mouse":"touchOnly"===nr||er?"touch":"mouse";function ar(e){return e||(new URLSearchParams(window.location.search).get("lng")||"en")}function or(){return"touchOnly"===nr||"hybrid"===nr&&"touch"===ir?"mobile":"desktop"}function sr(e,t,n,i,a,o,s){return s&&o&&"device"===a||o&&"device"===a?"".concat(e,"/").concat(n,"/").concat(i,"/").concat(t):s&&o&&"shared"===a||o&&"shared"===a?"".concat(e,"/").concat(n,"/shared/").concat(t):"device"===a?"".concat(e,"/").concat(i,"/").concat(t):"shared/device"===a?"".concat(e,"/shared/").concat(i,"/").concat(t):"languageSpecific"===a?"".concat(e,"/").concat(n,"/").concat(t):"default"===a?"".concat(e,"/").concat(t):"".concat(e,"/shared/").concat(t)}function rr(e){var t=Hs.lookup(e);if(!t)throw new Error("Unrecognized file extension in path: ".concat(e));if(t.startsWith("image/"))return"images";if(t.startsWith("audio/"))return"audio";if(t.startsWith("video/"))return"video";throw new Error("Unsupported MIME type for file: ".concat(e,". Only image, audio, and video files are supported."))}function cr(e,t,n,i){return new(n||(n=Promise))((function(a,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function r(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,r)}c((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var lr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function pr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ur=pr(((e,{include:t,exclude:n}={})=>{const i=e=>{const i=t=>"string"==typeof t?e===t:t.test(e);return t?t.some(i):!n||!n.some(i)};for(const[t,n]of(e=>{const t=new Set;do{for(const n of Reflect.ownKeys(e))t.add([e,n])}while((e=Reflect.getPrototypeOf(e))&&e!==Object.prototype);return t})(e.constructor.prototype)){if("constructor"===n||!i(n))continue;const a=Reflect.getOwnPropertyDescriptor(t,n);a&&"function"==typeof a.value&&(e[n]=e[n].bind(e))}return e}));class dr extends Error{constructor(e="The global `jsPsych` variable is no longer available in jsPsych v7."){super(`${e} Please follow the migration guide at https://www.jspsych.org/7.0/support/migration-v7/ to update your experiment.`),this.name="MigrationError"}}function mr(e){return[...new Set(e)]}function hr(e){if(!e)return e;let t;if(Array.isArray(e)){t=[];for(const n of e)t.push(hr(n));return t}if("object"==typeof e&&null!==e){t={};for(const n in e)e.hasOwnProperty(n)&&(t[n]=hr(e[n]));return t}return e}window.jsPsych={get init(){throw new dr("`jsPsych.init()` was replaced by `initJsPsych()` in jsPsych v7.")},get data(){throw new dr},get randomization(){throw new dr},get turk(){throw new dr},get pluginAPI(){throw new dr},get ALL_KEYS(){throw new dr('jsPsych.ALL_KEYS was replaced by the "ALL_KEYS" string in jsPsych v7.')},get NO_KEYS(){throw new dr('jsPsych.NO_KEYS was replaced by the "NO_KEYS" string in jsPsych v7.')}};var fr,gr=Object.freeze({__proto__:null,deepCopy:hr,deepMerge:function e(t,n){let i={};for(const a in t)t.hasOwnProperty(a)&&("object"==typeof t[a]&&n.hasOwnProperty(a)?i[a]=e(t[a],n[a]):i[a]=t[a]);for(const t in n)n.hasOwnProperty(t)&&(i.hasOwnProperty(t)&&"object"==typeof n[t]?i[t]=e(i[t],n[t]):i[t]=n[t]);return i},unique:mr});class vr{constructor(e=[]){this.values=e}sum(){let e=0;for(const t of this.values)e+=t;return e}mean(){return this.sum()/this.count()}median(){if(0===this.values.length)return;const e=this.values.slice(0).sort((function(e,t){return e-t})),t=Math.floor(e.length/2);return e.length%2==0?(e[t]+e[t-1])/2:e[t]}min(){return Math.min.apply(null,this.values)}max(){return Math.max.apply(null,this.values)}count(){return this.values.length}variance(){const e=this.mean();let t=0;for(const n of this.values)t+=Math.pow(n-e,2);return t/(this.values.length-1)}sd(){const e=this.variance();return Math.sqrt(e)}frequencies(){const e={};for(const t of this.values)void 0===e[t]?e[t]=1:e[t]++;return e}all(e){for(const t of this.values)if(!e(t))return!1;return!0}subset(e){const t=[];for(const n of this.values)e(n)&&t.push(n);return new vr(t)}}class br{constructor(e=[]){this.trials=e}push(e){return this.trials.push(e),this}join(e){return this.trials=this.trials.concat(e.values()),this}top(){return this.trials.length<=1?this:new br([this.trials[this.trials.length-1]])}first(e=1){if(e<1)throw"You must query with a positive nonzero integer. Please use a\n different value for n.";return 0===this.trials.length?new br:(e>this.trials.length&&(e=this.trials.length),new br(this.trials.slice(0,e)))}last(e=1){if(e<1)throw"You must query with a positive nonzero integer. Please use a\n different value for n.";return 0===this.trials.length?new br:(e>this.trials.length&&(e=this.trials.length),new br(this.trials.slice(this.trials.length-e,this.trials.length)))}values(){return this.trials}count(){return this.trials.length}readOnly(){return new br(hr(this.trials))}addToAll(e){for(const t of this.trials)Object.assign(t,e);return this}addToLast(e){return 0!=this.trials.length&&Object.assign(this.trials[this.trials.length-1],e),this}filter(e){let t;t=Array.isArray(e)?hr(e):hr([e]);const n=[];for(const e of this.trials){let i=!1;for(const n of t){let t=!0;for(const i of Object.keys(n))void 0!==e[i]&&e[i]===n[i]||(t=!1);if(t){i=!0;break}}i&&n.push(e)}return new br(n)}filterCustom(e){return new br(this.trials.filter(e))}filterColumns(e){return new br(this.trials.map((t=>Object.fromEntries(e.filter((e=>e in t)).map((e=>[e,t[e]]))))))}select(e){const t=[];for(const n of this.trials)void 0!==n[e]&&t.push(n[e]);return new vr(t)}ignore(e){Array.isArray(e)||(e=[e]);const t=hr(this.trials);for(const n of t)for(const t of e)delete n[t];return new br(t)}uniqueNames(){const e=[];for(const t of this.trials)for(const n of Object.keys(t))e.includes(n)||e.push(n);return e}csv(){return function(e){const t="object"!=typeof e?JSON.parse(e):e;let n="",i="";const a=[];for(const e of t)for(const t in e){let e=t+"";e='"'+e.replace(/"/g,'""')+'",',a.includes(t)||(a.push(t),n+=e)}n=n.slice(0,-1),i+=n+"\r\n";for(const e of t){n="";for(const t of a){let i=void 0===e[t]?"":e[t];"object"==typeof i&&(i=JSON.stringify(i)),n+='"'+(i+"").replace(/"/g,'""')+'",'}n=n.slice(0,-1),i+=n+"\r\n"}return i}(this.trials)}json(e=!1){return e?JSON.stringify(this.trials,null,"\t"):JSON.stringify(this.trials)}localSave(e,t){let n;if("json"===(e=e.toLowerCase()))n=this.json();else{if("csv"!==e)throw new Error('Invalid format specified for localSave. Must be "json" or "csv".');n=this.csv()}!function(e,t){const n=new Blob([e],{type:"text/plain"});let i="";i=void 0!==window.webkitURL?window.webkitURL.createObjectURL(n):window.URL.createObjectURL(n);const a=document.createElement("a");a.id="jspsych-download-as-text-link",a.style.display="none",a.download=t,a.href=i,a.click()}(n,t)}}class xr{constructor(e){this.jsPsych=e,this.dataProperties={},this.reset()}reset(){this.allData=new br,this.interactionData=new br}get(){return this.allData}getInteractionData(){return this.interactionData}write(e){const t=this.jsPsych.getProgress(),n=this.jsPsych.getCurrentTrial(),i={trial_type:n.type.info.name,trial_index:t.current_trial_global,time_elapsed:this.jsPsych.getTotalTime(),internal_node_id:this.jsPsych.getCurrentTimelineNodeID()};this.allData.push(Object.assign(Object.assign(Object.assign(Object.assign({},e),n.data),i),this.dataProperties))}addProperties(e){this.allData.addToAll(e),this.dataProperties=Object.assign({},this.dataProperties,e)}addDataToLastTrial(e){this.allData.addToLast(e)}getDataByTimelineNode(e){return this.allData.filterCustom((t=>t.internal_node_id.slice(0,e.length)===e))}getLastTrialData(){return this.allData.top()}getLastTimelineData(){const e=this.getLastTrialData().select("internal_node_id").values[0];if(void 0===e)return new br;{const t=e.substr(0,e.lastIndexOf("-"));return this.getDataByTimelineNode(t)}}displayData(e="json"){"json"!=(e=e.toLowerCase())&&"csv"!=e&&(console.log("Invalid format declared for displayData function. Using json as default."),e="json");const t="json"===e?this.allData.json(!0):this.allData.csv();this.jsPsych.getDisplayElement().innerHTML='<pre id="jspsych-data-display"></pre>',document.getElementById("jspsych-data-display").textContent=t}urlVariables(){return void 0===this.query_string&&(this.query_string=function(){const e=window.location.search.substr(1).split("&"),t={};for(let n=0;n<e.length;++n){const i=e[n].split("=",2);1==i.length?t[i[0]]="":t[i[0]]=decodeURIComponent(i[1].replace(/\+/g," "))}return t}()),this.query_string}getURLVariable(e){return this.urlVariables()[e]}createInteractionListeners(){window.addEventListener("blur",(()=>{const e={event:"blur",trial:this.jsPsych.getProgress().current_trial_global,time:this.jsPsych.getTotalTime()};this.interactionData.push(e),this.jsPsych.getInitSettings().on_interaction_data_update(e)})),window.addEventListener("focus",(()=>{const e={event:"focus",trial:this.jsPsych.getProgress().current_trial_global,time:this.jsPsych.getTotalTime()};this.interactionData.push(e),this.jsPsych.getInitSettings().on_interaction_data_update(e)}));const e=()=>{const e={event:document.isFullScreen||document.webkitIsFullScreen||document.mozIsFullScreen||document.fullscreenElement?"fullscreenenter":"fullscreenexit",trial:this.jsPsych.getProgress().current_trial_global,time:this.jsPsych.getTotalTime()};this.interactionData.push(e),this.jsPsych.getInitSettings().on_interaction_data_update(e)};document.addEventListener("fullscreenchange",e),document.addEventListener("mozfullscreenchange",e),document.addEventListener("webkitfullscreenchange",e)}_customInsert(e){this.allData=new br(e)}_fullreset(){this.reset(),this.dataProperties={}}}class yr{constructor(){this.hardwareConnected=!1,document.addEventListener("jspsych-activate",(e=>{this.hardwareConnected=!0}))}hardware(e){const t=new CustomEvent("jspsych",{detail:e});document.dispatchEvent(t)}}class wr{constructor(e,t=!1,n=0){this.getRootElement=e,this.areResponsesCaseSensitive=t,this.minimumValidRt=n,this.listeners=new Set,this.heldKeys=new Set,this.areRootListenersRegistered=!1,ur(this),this.registerRootListeners()}registerRootListeners(){if(!this.areRootListenersRegistered){const e=this.getRootElement();e&&(e.addEventListener("keydown",this.rootKeydownListener),e.addEventListener("keyup",this.rootKeyupListener),this.areRootListenersRegistered=!0)}}rootKeydownListener(e){for(const t of Array.from(this.listeners))t(e);this.heldKeys.add(this.toLowerCaseIfInsensitive(e.key))}toLowerCaseIfInsensitive(e){return this.areResponsesCaseSensitive?e:e.toLowerCase()}rootKeyupListener(e){this.heldKeys.delete(this.toLowerCaseIfInsensitive(e.key))}isResponseValid(e,t,n){return!(!t&&this.heldKeys.has(n))&&("ALL_KEYS"===e||"NO_KEYS"!==e&&e.includes(n))}getKeyboardResponse({callback_function:e,valid_responses:t="ALL_KEYS",rt_method:n="performance",persist:i,audio_context:a,audio_context_start_time:o,allow_held_key:s=!1,minimum_valid_rt:r=this.minimumValidRt}){"performance"!==n&&"audio"!==n&&(console.log('Invalid RT method specified in getKeyboardResponse. Defaulting to "performance" method.'),n="performance");const c="performance"===n?performance.now():1e3*o;this.registerRootListeners(),this.areResponsesCaseSensitive||"string"==typeof t||(t=t.map((e=>e.toLowerCase())));const l=o=>{const p=Math.round(("performance"==n?performance.now():1e3*a.currentTime)-c);if(p<r)return;const u=this.toLowerCaseIfInsensitive(o.key);this.isResponseValid(t,s,u)&&(o.preventDefault(),i||this.cancelKeyboardResponse(l),e({key:u,rt:p}))};return this.listeners.add(l),l}cancelKeyboardResponse(e){this.listeners.delete(e)}cancelAllKeyboardResponses(){this.listeners.clear()}compareKeys(e,t){if(!("string"!=typeof e&&null!==e||"string"!=typeof t&&null!==t))return"string"==typeof e&&"string"==typeof t?this.areResponsesCaseSensitive?e===t:e.toLowerCase()===t.toLowerCase():null===e&&null===t;console.error("Error in jsPsych.pluginAPI.compareKeys: arguments must be key strings or null.")}}!function(e){e[e.BOOL=0]="BOOL",e[e.STRING=1]="STRING",e[e.INT=2]="INT",e[e.FLOAT=3]="FLOAT",e[e.FUNCTION=4]="FUNCTION",e[e.KEY=5]="KEY",e[e.KEYS=6]="KEYS",e[e.SELECT=7]="SELECT",e[e.HTML_STRING=8]="HTML_STRING",e[e.IMAGE=9]="IMAGE",e[e.AUDIO=10]="AUDIO",e[e.VIDEO=11]="VIDEO",e[e.OBJECT=12]="OBJECT",e[e.COMPLEX=13]="COMPLEX",e[e.TIMELINE=14]="TIMELINE"}(fr||(fr={}));const kr={data:{type:fr.OBJECT,pretty_name:"Data",default:{}},on_start:{type:fr.FUNCTION,pretty_name:"On start",default:function(){}},on_finish:{type:fr.FUNCTION,pretty_name:"On finish",default:function(){}},on_load:{type:fr.FUNCTION,pretty_name:"On load",default:function(){}},post_trial_gap:{type:fr.INT,pretty_name:"Post trial gap",default:null},css_classes:{type:fr.STRING,pretty_name:"Custom CSS classes",default:null},simulation_options:{type:fr.COMPLEX,default:null}},_r=[fr.AUDIO,fr.IMAGE,fr.VIDEO];class jr{constructor(e,t){this.useWebaudio=e,this.webaudioContext=t,this.video_buffers={},this.context=null,this.audio_buffers=[],this.preload_requests=[],this.img_cache={},this.preloadMap=new Map,this.microphone_recorder=null,this.camera_stream=null,this.camera_recorder=null}getVideoBuffer(e){return e.startsWith("blob:")&&(this.video_buffers[e]=e),this.video_buffers[e]}initAudio(){this.context=this.useWebaudio?this.webaudioContext:null}audioContext(){return null!==this.context&&"running"!==this.context.state&&this.context.resume(),this.context}getAudioBuffer(e){return new Promise(((t,n)=>{void 0===this.audio_buffers[e]||"tmp"==this.audio_buffers[e]?this.preloadAudio([e],(()=>{t(this.audio_buffers[e])}),(()=>{}),(e=>{n(e.error)})):t(this.audio_buffers[e])}))}preloadAudio(e,t=(()=>{}),n=(e=>{}),i=(e=>{})){e=mr(e.flat());let a=0;if(0==e.length)return void t();const o=(o,s=1)=>{const r=new XMLHttpRequest;r.open("GET",o,!0),r.responseType="arraybuffer",r.onload=()=>{this.context.decodeAudioData(r.response,(i=>{this.audio_buffers[o]=i,a++,n(o),a==e.length&&t()}),(e=>{i({source:o,error:e})}))},r.onerror=e=>{let t=e;404==r.status&&(t="404"),i({source:o,error:t})},r.onloadend=e=>{404==r.status&&i({source:o,error:"404"})},r.send(),this.preload_requests.push(r)},s=(o,s=1)=>{const r=new Audio,c=()=>{this.audio_buffers[o]=r,a++,n(o),a==e.length&&t(),r.removeEventListener("canplaythrough",c)};r.addEventListener("canplaythrough",c),r.addEventListener("error",(function e(t){i({source:r.src,error:t}),r.removeEventListener("error",e)})),r.addEventListener("abort",(function e(t){i({source:r.src,error:t}),r.removeEventListener("abort",e)})),r.src=o,this.preload_requests.push(r)};for(const i of e)void 0!==this.audio_buffers[i]?(a++,n(i),a==e.length&&t()):(this.audio_buffers[i]="tmp",null!==this.audioContext()?o(i):s(i))}preloadImages(e,t=(()=>{}),n=(e=>{}),i=(e=>{})){e=mr(e.flat());var a=0;if(0!==e.length)for(let o=0;o<e.length;o++){const s=new Image,r=e[o];s.onload=()=>{a++,n(r),a===e.length&&t()},s.onerror=e=>{i({source:r,error:e})},s.src=r,this.img_cache[r]=s,this.preload_requests.push(s)}else t()}preloadVideo(e,t=(()=>{}),n=(e=>{}),i=(e=>{})){e=mr(e.flat());let a=0;if(0!==e.length)for(const o of e){const s=this.video_buffers,r=new XMLHttpRequest;r.open("GET",o,!0),r.responseType="blob",r.onload=()=>{if(200===r.status||0===r.status){const i=r.response;s[o]=URL.createObjectURL(i),a++,n(o),a===e.length&&t()}},r.onerror=e=>{let t=e;404==r.status&&(t="404"),i({source:o,error:t})},r.onloadend=e=>{404==r.status&&i({source:o,error:"404"})},r.send(),this.preload_requests.push(r)}else t()}getAutoPreloadList(e){const t=Object.fromEntries(_r.map((e=>[e,new Set]))),n=(e,i)=>{var a,o,s,r;if(void 0!==e.timeline)for(const t of e.timeline)n(t,null!==(a=e.type)&&void 0!==a?a:i);else if(null===(s=null!==(o=e.type)&&void 0!==o?o:i)||void 0===s?void 0:s.info){const{name:n,parameters:a}=(null!==(r=e.type)&&void 0!==r?r:i).info;this.preloadMap.has(n)||this.preloadMap.set(n,Object.fromEntries(Object.entries(a).filter((([e,{type:t,preload:n}])=>_r.includes(t)&&(null==n||n))).map((([e,{type:t}])=>[e,t]))));for(const[i,a]of Object.entries(this.preloadMap.get(n))){const n=e[i],o=t[a];if("string"==typeof n)o.add(n);else if(Array.isArray(n))for(const e of n.flat())"string"==typeof e&&o.add(e)}}};return n({timeline:e}),{images:[...t[fr.IMAGE]],audio:[...t[fr.AUDIO]],video:[...t[fr.VIDEO]]}}cancelPreloads(){for(const e of this.preload_requests)e.onload=()=>{},e.onerror=()=>{},e.oncanplaythrough=()=>{},e.onabort=()=>{};this.preload_requests=[]}initializeMicrophoneRecorder(e){const t=new MediaRecorder(e);this.microphone_recorder=t}getMicrophoneRecorder(){return this.microphone_recorder}initializeCameraRecorder(e,t){this.camera_stream=e;const n=new MediaRecorder(e,t);this.camera_recorder=n}getCameraStream(){return this.camera_stream}getCameraRecorder(){return this.camera_recorder}}class Cr{constructor(e,t){this.getDisplayContainerElement=e,this.setJsPsychTimeout=t}dispatchEvent(e){this.getDisplayContainerElement().dispatchEvent(e)}keyDown(e){this.dispatchEvent(new KeyboardEvent("keydown",{key:e}))}keyUp(e){this.dispatchEvent(new KeyboardEvent("keyup",{key:e}))}pressKey(e,t=0){t>0?this.setJsPsychTimeout((()=>{this.keyDown(e),this.keyUp(e)}),t):(this.keyDown(e),this.keyUp(e))}clickTarget(e,t=0){t>0?this.setJsPsychTimeout((()=>{e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0})),e.dispatchEvent(new MouseEvent("click",{bubbles:!0}))}),t):(e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0})),e.dispatchEvent(new MouseEvent("click",{bubbles:!0})))}fillTextInput(e,t,n=0){n>0?this.setJsPsychTimeout((()=>{e.value=t}),n):e.value=t}getValidKey(e){const t=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"," "];let n;if("NO_KEYS"==e)n=null;else if("ALL_KEYS"==e)n=t[Math.floor(Math.random()*t.length)];else{const t=e.flat();n=t[Math.floor(Math.random()*t.length)]}return n}mergeSimulationData(e,t){return Object.assign(Object.assign({},e),null==t?void 0:t.data)}ensureSimulationDataConsistency(e,t){if(t.rt&&(t.rt=Math.round(t.rt)),e.trial_duration&&t.rt&&t.rt>e.trial_duration&&(t.rt=null,t.response&&(t.response=null),t.correct&&(t.correct=!1)),e.choices&&"NO_KEYS"==e.choices&&(t.rt&&(t.rt=null),t.response&&(t.response=null)),e.allow_response_before_complete&&e.sequence_reps&&e.frame_time){const n=e.sequence_reps*e.frame_time*e.stimuli.length;t.rt<n&&(t.rt=null,t.response=null)}}}class Sr{constructor(){this.timeout_handlers=[]}setTimeout(e,t){const n=window.setTimeout(e,t);return this.timeout_handlers.push(n),n}clearAllTimeouts(){for(const e of this.timeout_handlers)clearTimeout(e);this.timeout_handlers=[]}}var Er={exports:{}};!function(e,t,n){function i(e){var t=this,n=function(){var e=4022871197,t=function(t){t=String(t);for(var n=0;n<t.length;n++){var i=.02519603282416938*(e+=t.charCodeAt(n));i-=e=i>>>0,e=(i*=e)>>>0,e+=4294967296*(i-=e)}return 2.3283064365386963e-10*(e>>>0)};return t}();t.next=function(){var e=2091639*t.s0+2.3283064365386963e-10*t.c;return t.s0=t.s1,t.s1=t.s2,t.s2=e-(t.c=0|e)},t.c=1,t.s0=n(" "),t.s1=n(" "),t.s2=n(" "),t.s0-=n(e),t.s0<0&&(t.s0+=1),t.s1-=n(e),t.s1<0&&(t.s1+=1),t.s2-=n(e),t.s2<0&&(t.s2+=1),n=null}function a(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function o(e,t){var n=new i(e),o=t&&t.state,s=n.next;return s.int32=function(){return 4294967296*n.next()|0},s.double=function(){return s()+11102230246251565e-32*(2097152*s()|0)},s.quick=s,o&&("object"==typeof o&&a(o,n),s.state=function(){return a(n,{})}),s}t&&t.exports?t.exports=o:n&&n.amd?n((function(){return o})):this.alea=o}(0,Er,!1);var Tr=Er.exports,Mr=pr(Tr),Or={exports:{}};!function(e,t,n){function i(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var i=0;i<n.length+64;i++)t.x^=0|n.charCodeAt(i),t.next()}function a(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t}function o(e,t){var n=new i(e),o=t&&t.state,s=function(){return(n.next()>>>0)/4294967296};return s.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},s.int32=n.next,s.quick=s,o&&("object"==typeof o&&a(o,n),s.state=function(){return a(n,{})}),s}t&&t.exports?t.exports=o:n&&n.amd?n((function(){return o})):this.xor128=o}(0,Or,!1);var Ar=Or.exports,Ir={exports:{}};!function(e,t,n){function i(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var i=0;i<n.length+64;i++)t.x^=0|n.charCodeAt(i),i==n.length&&(t.d=t.x<<10^t.x>>>4),t.next()}function a(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function o(e,t){var n=new i(e),o=t&&t.state,s=function(){return(n.next()>>>0)/4294967296};return s.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},s.int32=n.next,s.quick=s,o&&("object"==typeof o&&a(o,n),s.state=function(){return a(n,{})}),s}t&&t.exports?t.exports=o:n&&n.amd?n((function(){return o})):this.xorwow=o}(0,Ir,!1);var Pr=Ir.exports,Rr={exports:{}};!function(e,t,n){function i(e){var t=this;t.next=function(){var e,n,i=t.x,a=t.i;return e=i[a],n=(e^=e>>>7)^e<<24,n^=(e=i[a+1&7])^e>>>10,n^=(e=i[a+3&7])^e>>>3,n^=(e=i[a+4&7])^e<<7,e=i[a+7&7],n^=(e^=e<<13)^e<<9,i[a]=n,t.i=a+1&7,n},function(e,t){var n,i=[];if(t===(0|t))i[0]=t;else for(t=""+t,n=0;n<t.length;++n)i[7&n]=i[7&n]<<15^t.charCodeAt(n)+i[n+1&7]<<13;for(;i.length<8;)i.push(0);for(n=0;n<8&&0===i[n];++n);for(8==n?i[7]=-1:i[n],e.x=i,e.i=0,n=256;n>0;--n)e.next()}(t,e)}function a(e,t){return t.x=e.x.slice(),t.i=e.i,t}function o(e,t){null==e&&(e=+new Date);var n=new i(e),o=t&&t.state,s=function(){return(n.next()>>>0)/4294967296};return s.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},s.int32=n.next,s.quick=s,o&&(o.x&&a(o,n),s.state=function(){return a(n,{})}),s}t&&t.exports?t.exports=o:n&&n.amd?n((function(){return o})):this.xorshift7=o}(0,Rr,!1);var Lr=Rr.exports,Nr={exports:{}};!function(e,t,n){function i(e){var t=this;t.next=function(){var e,n,i=t.w,a=t.X,o=t.i;return t.w=i=i+1640531527|0,n=a[o+34&127],e=a[o=o+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=a[o]=n^e,t.i=o,n+(i^i>>>16)|0},function(e,t){var n,i,a,o,s,r=[],c=128;for(t===(0|t)?(i=t,t=null):(t+="\0",i=0,c=Math.max(c,t.length)),a=0,o=-32;o<c;++o)t&&(i^=t.charCodeAt((o+32)%t.length)),0===o&&(s=i),i^=i<<10,i^=i>>>15,i^=i<<4,i^=i>>>13,o>=0&&(s=s+1640531527|0,a=0==(n=r[127&o]^=i+s)?a+1:0);for(a>=128&&(r[127&(t&&t.length||0)]=-1),a=127,o=512;o>0;--o)i=r[a+34&127],n=r[a=a+1&127],i^=i<<13,n^=n<<17,i^=i>>>15,n^=n>>>12,r[a]=i^n;e.w=s,e.X=r,e.i=a}(t,e)}function a(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function o(e,t){null==e&&(e=+new Date);var n=new i(e),o=t&&t.state,s=function(){return(n.next()>>>0)/4294967296};return s.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},s.int32=n.next,s.quick=s,o&&(o.X&&a(o,n),s.state=function(){return a(n,{})}),s}t&&t.exports?t.exports=o:n&&n.amd?n((function(){return o})):this.xor4096=o}(0,Nr,!1);var Dr=Nr.exports,qr={exports:{}};!function(e,t,n){function i(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,i=t.d,a=t.a;return e=e<<25^e>>>7^n,n=n-i|0,i=i<<24^i>>>8^a,a=a-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-i|0,t.d=i<<16^n>>>16^a,t.a=a-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var i=0;i<n.length+20;i++)t.b^=0|n.charCodeAt(i),t.next()}function a(e,t){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t}function o(e,t){var n=new i(e),o=t&&t.state,s=function(){return(n.next()>>>0)/4294967296};return s.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},s.int32=n.next,s.quick=s,o&&("object"==typeof o&&a(o,n),s.state=function(){return a(n,{})}),s}t&&t.exports?t.exports=o:n&&n.amd?n((function(){return o})):this.tychei=o}(0,qr,!1);var Fr=qr.exports,zr={exports:{}};!function(e){!function(t,n,i){var a,o=256,s="random",r=i.pow(o,6),c=i.pow(2,52),l=2*c,p=o-1;function u(e,p,u){var v=[],b=f(h((p=1==p?{entropy:!0}:p||{}).entropy?[e,g(n)]:null==e?function(){try{var e;return a&&(e=a.randomBytes)?e=e(o):(e=new Uint8Array(o),(t.crypto||t.msCrypto).getRandomValues(e)),g(e)}catch(e){var i=t.navigator,s=i&&i.plugins;return[+new Date,t,s,t.screen,g(n)]}}():e,3),v),x=new d(v),y=function(){for(var e=x.g(6),t=r,n=0;e<c;)e=(e+n)*o,t*=o,n=x.g(1);for(;e>=l;)e/=2,t/=2,n>>>=1;return(e+n)/t};return y.int32=function(){return 0|x.g(4)},y.quick=function(){return x.g(4)/4294967296},y.double=y,f(g(x.S),n),(p.pass||u||function(e,t,n,a){return a&&(a.S&&m(a,x),e.state=function(){return m(x,{})}),n?(i[s]=e,t):e})(y,b,"global"in p?p.global:this==i,p.state)}function d(e){var t,n=e.length,i=this,a=0,s=i.i=i.j=0,r=i.S=[];for(n||(e=[n++]);a<o;)r[a]=a++;for(a=0;a<o;a++)r[a]=r[s=p&s+e[a%n]+(t=r[a])],r[s]=t;(i.g=function(e){for(var t,n=0,a=i.i,s=i.j,r=i.S;e--;)t=r[a=p&a+1],n=n*o+r[p&(r[a]=r[s=p&s+t])+(r[s]=t)];return i.i=a,i.j=s,n})(o)}function m(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function h(e,t){var n,i=[],a=typeof e;if(t&&"object"==a)for(n in e)try{i.push(h(e[n],t-1))}catch(e){}return i.length?i:"string"==a?e:e+"\0"}function f(e,t){for(var n,i=e+"",a=0;a<i.length;)t[p&a]=p&(n^=19*t[p&a])+i.charCodeAt(a++);return g(t)}function g(e){return String.fromCharCode.apply(0,e)}if(f(i.random(),n),e.exports){e.exports=u;try{a=require("crypto")}catch(e){}}else i["seed"+s]=u}("undefined"!=typeof self?self:lr,[],Math)}(zr);var Vr=Tr,Br=Ar,Ur=Pr,Hr=Lr,Wr=Dr,$r=Fr,Kr=zr.exports;Kr.alea=Vr,Kr.xor128=Br,Kr.xorwow=Ur,Kr.xorshift7=Hr,Kr.xor4096=Wr,Kr.tychei=$r;var Yr=Kr,Xr=["ability","able","aboard","about","above","accept","accident","according","account","accurate","acres","across","act","action","active","activity","actual","actually","add","addition","additional","adjective","adult","adventure","advice","affect","afraid","after","afternoon","again","against","age","ago","agree","ahead","aid","air","airplane","alike","alive","all","allow","almost","alone","along","aloud","alphabet","already","also","although","am","among","amount","ancient","angle","angry","animal","announced","another","answer","ants","any","anybody","anyone","anything","anyway","anywhere","apart","apartment","appearance","apple","applied","appropriate","are","area","arm","army","around","arrange","arrangement","arrive","arrow","art","article","as","aside","ask","asleep","at","ate","atmosphere","atom","atomic","attached","attack","attempt","attention","audience","author","automobile","available","average","avoid","aware","away","baby","back","bad","badly","bag","balance","ball","balloon","band","bank","bar","bare","bark","barn","base","baseball","basic","basis","basket","bat","battle","be","bean","bear","beat","beautiful","beauty","became","because","become","becoming","bee","been","before","began","beginning","begun","behavior","behind","being","believed","bell","belong","below","belt","bend","beneath","bent","beside","best","bet","better","between","beyond","bicycle","bigger","biggest","bill","birds","birth","birthday","bit","bite","black","blank","blanket","blew","blind","block","blood","blow","blue","board","boat","body","bone","book","border","born","both","bottle","bottom","bound","bow","bowl","box","boy","brain","branch","brass","brave","bread","break","breakfast","breath","breathe","breathing","breeze","brick","bridge","brief","bright","bring","broad","broke","broken","brother","brought","brown","brush","buffalo","build","building","built","buried","burn","burst","bus","bush","business","busy","but","butter","buy","by","cabin","cage","cake","call","calm","came","camera","camp","can","canal","cannot","cap","capital","captain","captured","car","carbon","card","care","careful","carefully","carried","carry","case","cast","castle","cat","catch","cattle","caught","cause","cave","cell","cent","center","central","century","certain","certainly","chain","chair","chamber","chance","change","changing","chapter","character","characteristic","charge","chart","check","cheese","chemical","chest","chicken","chief","child","children","choice","choose","chose","chosen","church","circle","circus","citizen","city","class","classroom","claws","clay","clean","clear","clearly","climate","climb","clock","close","closely","closer","cloth","clothes","clothing","cloud","club","coach","coal","coast","coat","coffee","cold","collect","college","colony","color","column","combination","combine","come","comfortable","coming","command","common","community","company","compare","compass","complete","completely","complex","composed","composition","compound","concerned","condition","congress","connected","consider","consist","consonant","constantly","construction","contain","continent","continued","contrast","control","conversation","cook","cookies","cool","copper","copy","corn","corner","correct","correctly","cost","cotton","could","count","country","couple","courage","course","court","cover","cow","cowboy","crack","cream","create","creature","crew","crop","cross","crowd","cry","cup","curious","current","curve","customs","cut","cutting","daily","damage","dance","danger","dangerous","dark","darkness","date","daughter","dawn","day","dead","deal","dear","death","decide","declared","deep","deeply","deer","definition","degree","depend","depth","describe","desert","design","desk","detail","determine","develop","development","diagram","diameter","did","die","differ","difference","different","difficult","difficulty","dig","dinner","direct","direction","directly","dirt","dirty","disappear","discover","discovery","discuss","discussion","disease","dish","distance","distant","divide","division","do","doctor","does","dog","doing","doll","dollar","done","donkey","door","dot","double","doubt","down","dozen","draw","drawn","dream","dress","drew","dried","drink","drive","driven","driver","driving","drop","dropped","drove","dry","duck","due","dug","dull","during","dust","duty","each","eager","ear","earlier","early","earn","earth","easier","easily","east","easy","eat","eaten","edge","education","effect","effort","egg","eight","either","electric","electricity","element","elephant","eleven","else","empty","end","enemy","energy","engine","engineer","enjoy","enough","enter","entire","entirely","environment","equal","equally","equator","equipment","escape","especially","essential","establish","even","evening","event","eventually","ever","every","everybody","everyone","everything","everywhere","evidence","exact","exactly","examine","example","excellent","except","exchange","excited","excitement","exciting","exclaimed","exercise","exist","expect","experience","experiment","explain","explanation","explore","express","expression","extra","eye","face","facing","fact","factor","factory","failed","fair","fairly","fall","fallen","familiar","family","famous","far","farm","farmer","farther","fast","fastened","faster","fat","father","favorite","fear","feathers","feature","fed","feed","feel","feet","fell","fellow","felt","fence","few","fewer","field","fierce","fifteen","fifth","fifty","fight","fighting","figure","fill","film","final","finally","find","fine","finest","finger","finish","fire","fireplace","firm","first","fish","five","fix","flag","flame","flat","flew","flies","flight","floating","floor","flow","flower","fly","fog","folks","follow","food","foot","football","for","force","foreign","forest","forget","forgot","forgotten","form","former","fort","forth","forty","forward","fought","found","four","fourth","fox","frame","free","freedom","frequently","fresh","friend","friendly","frighten","frog","from","front","frozen","fruit","fuel","full","fully","fun","function","funny","fur","furniture","further","future","gain","game","garage","garden","gas","gasoline","gate","gather","gave","general","generally","gentle","gently","get","getting","giant","gift","girl","give","given","giving","glad","glass","globe","go","goes","gold","golden","gone","good","goose","got","government","grabbed","grade","gradually","grain","grandfather","grandmother","graph","grass","gravity","gray","great","greater","greatest","greatly","green","grew","ground","group","grow","grown","growth","guard","guess","guide","gulf","gun","habit","had","hair","half","halfway","hall","hand","handle","handsome","hang","happen","happened","happily","happy","harbor","hard","harder","hardly","has","hat","have","having","hay","he","headed","heading","health","heard","hearing","heart","heat","heavy","height","held","hello","help","helpful","her","herd","here","herself","hidden","hide","high","higher","highest","highway","hill","him","himself","his","history","hit","hold","hole","hollow","home","honor","hope","horn","horse","hospital","hot","hour","house","how","however","huge","human","hundred","hung","hungry","hunt","hunter","hurried","hurry","hurt","husband","ice","idea","identity","if","ill","image","imagine","immediately","importance","important","impossible","improve","in","inch","include","including","income","increase","indeed","independent","indicate","individual","industrial","industry","influence","information","inside","instance","instant","instead","instrument","interest","interior","into","introduced","invented","involved","iron","is","island","it","its","itself","jack","jar","jet","job","join","joined","journey","joy","judge","jump","jungle","just","keep","kept","key","kids","kill","kind","kitchen","knew","knife","know","knowledge","known","label","labor","lack","lady","laid","lake","lamp","land","language","large","larger","largest","last","late","later","laugh","law","lay","layers","lead","leader","leaf","learn","least","leather","leave","leaving","led","left","leg","length","lesson","let","letter","level","library","lie","life","lift","light","like","likely","limited","line","lion","lips","liquid","list","listen","little","live","living","load","local","locate","location","log","lonely","long","longer","look","loose","lose","loss","lost","lot","loud","love","lovely","low","lower","luck","lucky","lunch","lungs","lying","machine","machinery","mad","made","magic","magnet","mail","main","mainly","major","make","making","man","managed","manner","manufacturing","many","map","mark","market","married","mass","massage","master","material","mathematics","matter","may","maybe","me","meal","mean","means","meant","measure","meat","medicine","meet","melted","member","memory","men","mental","merely","met","metal","method","mice","middle","might","mighty","mile","military","milk","mill","mind","mine","minerals","minute","mirror","missing","mission","mistake","mix","mixture","model","modern","molecular","moment","money","monkey","month","mood","moon","more","morning","most","mostly","mother","motion","motor","mountain","mouse","mouth","move","movement","movie","moving","mud","muscle","music","musical","must","my","myself","mysterious","nails","name","nation","national","native","natural","naturally","nature","near","nearby","nearer","nearest","nearly","necessary","neck","needed","needle","needs","negative","neighbor","neighborhood","nervous","nest","never","new","news","newspaper","next","nice","night","nine","no","nobody","nodded","noise","none","noon","nor","north","nose","not","note","noted","nothing","notice","noun","now","number","numeral","nuts","object","observe","obtain","occasionally","occur","ocean","of","off","offer","office","officer","official","oil","old","older","oldest","on","once","one","only","onto","open","operation","opinion","opportunity","opposite","or","orange","orbit","order","ordinary","organization","organized","origin","original","other","ought","our","ourselves","out","outer","outline","outside","over","own","owner","oxygen","pack","package","page","paid","pain","paint","pair","palace","pale","pan","paper","paragraph","parallel","parent","park","part","particles","particular","particularly","partly","parts","party","pass","passage","past","path","pattern","pay","peace","pen","pencil","people","per","percent","perfect","perfectly","perhaps","period","person","personal","pet","phrase","physical","piano","pick","picture","pictured","pie","piece","pig","pile","pilot","pine","pink","pipe","pitch","place","plain","plan","plane","planet","planned","planning","plant","plastic","plate","plates","play","pleasant","please","pleasure","plenty","plural","plus","pocket","poem","poet","poetry","point","pole","police","policeman","political","pond","pony","pool","poor","popular","population","porch","port","position","positive","possible","possibly","post","pot","potatoes","pound","pour","powder","power","powerful","practical","practice","prepare","present","president","press","pressure","pretty","prevent","previous","price","pride","primitive","principal","principle","printed","private","prize","probably","problem","process","produce","product","production","program","progress","promised","proper","properly","property","protection","proud","prove","provide","public","pull","pupil","pure","purple","purpose","push","put","putting","quarter","queen","question","quick","quickly","quiet","quietly","quite","rabbit","race","radio","railroad","rain","raise","ran","ranch","range","rapidly","rate","rather","raw","rays","reach","read","reader","ready","real","realize","rear","reason","recall","receive","recent","recently","recognize","record","red","refer","refused","region","regular","related","relationship","religious","remain","remarkable","remember","remove","repeat","replace","replied","report","represent","require","research","respect","rest","result","return","review","rhyme","rhythm","rice","rich","ride","riding","right","ring","rise","rising","river","road","roar","rock","rocket","rocky","rod","roll","roof","room","root","rope","rose","rough","round","route","row","rubbed","rubber","rule","ruler","run","running","rush","sad","saddle","safe","safety","said","sail","sale","salmon","salt","same","sand","sang","sat","satellites","satisfied","save","saved","saw","say","scale","scared","scene","school","science","scientific","scientist","score","screen","sea","search","season","seat","second","secret","section","see","seed","seeing","seems","seen","seldom","select","selection","sell","send","sense","sent","sentence","separate","series","serious","serve","service","sets","setting","settle","settlers","seven","several","shade","shadow","shake","shaking","shall","shallow","shape","share","sharp","she","sheep","sheet","shelf","shells","shelter","shine","shinning","ship","shirt","shoe","shoot","shop","shore","short","shorter","shot","should","shoulder","shout","show","shown","shut","sick","sides","sight","sign","signal","silence","silent","silk","silly","silver","similar","simple","simplest","simply","since","sing","single","sink","sister","sit","sitting","situation","six","size","skill","skin","sky","slabs","slave","sleep","slept","slide","slight","slightly","slip","slipped","slope","slow","slowly","small","smaller","smallest","smell","smile","smoke","smooth","snake","snow","so","soap","social","society","soft","softly","soil","solar","sold","soldier","solid","solution","solve","some","somebody","somehow","someone","something","sometime","somewhere","son","song","soon","sort","sound","source","south","southern","space","speak","special","species","specific","speech","speed","spell","spend","spent","spider","spin","spirit","spite","split","spoken","sport","spread","spring","square","stage","stairs","stand","standard","star","stared","start","state","statement","station","stay","steady","steam","steel","steep","stems","step","stepped","stick","stiff","still","stock","stomach","stone","stood","stop","stopped","store","storm","story","stove","straight","strange","stranger","straw","stream","street","strength","stretch","strike","string","strip","strong","stronger","struck","structure","struggle","stuck","student","studied","studying","subject","substance","success","successful","such","sudden","suddenly","sugar","suggest","suit","sum","summer","sun","sunlight","supper","supply","support","suppose","sure","surface","surprise","surrounded","swam","sweet","swept","swim","swimming","swing","swung","syllable","symbol","system","table","tail","take","taken","tales","talk","tall","tank","tape","task","taste","taught","tax","tea","teach","teacher","team","tears","teeth","telephone","television","tell","temperature","ten","tent","term","terrible","test","than","thank","that","thee","them","themselves","then","theory","there","therefore","these","they","thick","thin","thing","think","third","thirty","this","those","thou","though","thought","thousand","thread","three","threw","throat","through","throughout","throw","thrown","thumb","thus","thy","tide","tie","tight","tightly","till","time","tin","tiny","tip","tired","title","to","tobacco","today","together","told","tomorrow","tone","tongue","tonight","too","took","tool","top","topic","torn","total","touch","toward","tower","town","toy","trace","track","trade","traffic","trail","train","transportation","trap","travel","treated","tree","triangle","tribe","trick","tried","trip","troops","tropical","trouble","truck","trunk","truth","try","tube","tune","turn","twelve","twenty","twice","two","type","typical","uncle","under","underline","understanding","unhappy","union","unit","universe","unknown","unless","until","unusual","up","upon","upper","upward","us","use","useful","using","usual","usually","valley","valuable","value","vapor","variety","various","vast","vegetable","verb","vertical","very","vessels","victory","view","village","visit","visitor","voice","volume","vote","vowel","voyage","wagon","wait","walk","wall","want","war","warm","warn","was","wash","waste","watch","water","wave","way","we","weak","wealth","wear","weather","week","weigh","weight","welcome","well","went","were","west","western","wet","whale","what","whatever","wheat","wheel","when","whenever","where","wherever","whether","which","while","whispered","whistle","white","who","whole","whom","whose","why","wide","widely","wife","wild","will","willing","win","wind","window","wing","winter","wire","wise","wish","with","within","without","wolf","women","won","wonder","wonderful","wood","wooden","wool","word","wore","work","worker","world","worried","worry","worse","worth","would","wrapped","write","writer","writing","written","wrong","wrote","yard","year","yellow","yes","yesterday","yet","you","young","younger","your","yourself","youth","zero","zebra","zipper","zoo","zulu"];function Gr(e){const t=e?.seed?new Yr(e.seed):null;function n(){return e&&e.maxLength>1?function(){var t,n=!1;for(;!n;)(t=i()).length<=e.maxLength&&(n=!0);return t}():i()}function i(){return Xr[a(Xr.length)]}function a(e){const n=t?t():Math.random();return Math.floor(n*e)}if(void 0===e)return n();"number"==typeof e&&(e={exactly:e}),e.exactly&&(e.min=e.exactly,e.max=e.exactly),"number"!=typeof e.wordsPerString&&(e.wordsPerString=1),"function"!=typeof e.formatter&&(e.formatter=e=>e),"string"!=typeof e.separator&&(e.separator=" ");for(var o=e.min+a(e.max+1-e.min),s=[],r="",c=0,l=0;l<o*e.wordsPerString;l++)c===e.wordsPerString-1?r+=e.formatter(n(),c):r+=e.formatter(n(),c)+e.separator,c++,(l+1)%e.wordsPerString==0&&(s.push(r),r="",c=0);return"string"==typeof e.join&&(s=s.join(e.join)),s}var Jr=Gr;Gr.wordList=Xr;var Qr=pr(Jr);function Zr(e,t,n=!1){const i=Array.isArray(e),a=Array.isArray(t);if(i)if(a){if(e.length!=t.length)if(console.warn("Unclear parameters given to randomization.repeat. Items and repetitions are unequal lengths. Behavior may not be as expected."),t.length<e.length){let n=[];for(let i=0;i<e.length;i++)n.push(t);t=n}else t=t.slice(0,e.length)}else{let n=[];for(let i=0;i<e.length;i++)n.push(t);t=n}else a?(t=[t[0]],console.log("Unclear parameters given to randomization.repeat. Multiple set sizes specified, but only one item exists to sample. Proceeding using the first set size.")):(e=[e],t=[t]);let o=[];for(let n=0;n<e.length;n++)for(let i=0;i<t[n];i++)null==e[n]||"object"!=typeof e[n]?o.push(e[n]):o.push(Object.assign({},e[n]));let s=ec(o);return n&&(s=function(e){const t={};for(const n of e)for(const e of Object.keys(n))void 0===t[e]&&(t[e]=[]),t[e].push(n[e]);return t}(s)),s}function ec(e){Array.isArray(e)||console.error("Argument to shuffle() must be an array.");const t=e.slice(0);let n,i,a=t.length;for(;a;)i=Math.floor(Math.random()*a--),n=t[a],t[a]=t[i],t[i]=n;return t}function tc(e,t=!1){const n=e.length;if(1==n)return console.warn("shuffleAlternateGroups() was called with only one group. Defaulting to simple shuffle."),ec(e[0]);let i=[];for(let e=0;e<n;e++)i.push(e);t&&(i=ec(i));const a=[];let o=null;for(let t=0;t<n;t++)o=null===o?e[t].length:Math.min(o,e[t].length),a.push(ec(e[t]));const s=[];for(let e=0;e<o;e++)for(let t=0;t<i.length;t++)s.push(a[i[t]][e]);return s}function nc(e,t){return Array.isArray(e)||console.error("First argument to sampleWithoutReplacement() must be an array"),t>e.length&&console.error("Cannot take a sample larger than the size of the set of items to sample."),ec(e).slice(0,t)}function ic(e,t,n){Array.isArray(e)||console.error("First argument to sampleWithReplacement() must be an array");const i=[];if(void 0!==n){n.length!==e.length&&console.error("The length of the weights array must equal the length of the array to be sampled from.");let t=0;for(const e of n)t+=e;for(const e of n)i.push(e/t)}else for(let t=0;t<e.length;t++)i.push(1/e.length);const a=[i[0]];for(let e=1;e<i.length;e++)a.push(i[e]+a[e-1]);const o=[];for(let n=0;n<t;n++){const t=Math.random();let n=0;for(;t>a[n];)n++;o.push(e[n])}return o}function ac(e,t){return function(){var e=0,t=0;for(;0===e;)e=Math.random();for(;0===t;)t=Math.random();return Math.sqrt(-2*Math.log(e))*Math.cos(2*Math.PI*t)}()*t+e}function oc(e){return-Math.log(Math.random())/e}var sc=Object.freeze({__proto__:null,factorial:function(e,t=1,n=!1){let i=[{}];for(const[t,n]of Object.entries(e)){const e=[];for(const a of n)for(const n of i)e.push(Object.assign(Object.assign({},n),{[t]:a}));i=e}return Zr(i,t,n)},randomID:function(e=32){let t="";const n="0123456789abcdefghjklmnopqrstuvwxyz";for(let i=0;i<e;i++)t+=n[Math.floor(35*Math.random())];return t},randomInt:function(e,t){if(t<e)throw new Error("Upper boundary must be less than or equal to lower boundary");return e+Math.floor(Math.random()*(t-e+1))},randomWords:function(e){return Qr(e)},repeat:Zr,sampleBernoulli:function(e){return Math.random()<=e?1:0},sampleExGaussian:function(e,t,n,i=!1){let a=ac(e,t)+oc(n);if(i)for(;a<=0;)a=ac(e,t)+oc(n);return a},sampleExponential:oc,sampleNormal:ac,sampleWithReplacement:ic,sampleWithoutReplacement:nc,setSeed:function(e=Math.random().toString()){return Math.random=Mr(e),e},shuffle:ec,shuffleAlternateGroups:tc,shuffleNoRepeats:function(e,t){Array.isArray(e)||console.error("First argument to shuffleNoRepeats() must be an array."),void 0!==t&&"function"!=typeof t&&console.error("Second argument to shuffleNoRepeats() must be a function."),void 0===t&&(t=function(e,t){return e===t});const n=ec(e);for(let e=0;e<n.length-1;e++)if(t(n[e],n[e+1])){let i=Math.floor(Math.random()*(n.length-2))+1;for(;t(n[e+1],n[i])||t(n[e+1],n[i+1])||t(n[e+1],n[i-1])||t(n[e],n[i]);)i=Math.floor(Math.random()*(n.length-2))+1;const a=n[i];n[i]=n[e+1],n[e+1]=a}return n}});function rc(){const e={previewMode:!1,outsideTurk:!1,hitId:"INVALID_URL_PARAMETER",assignmentId:"INVALID_URL_PARAMETER",workerId:"INVALID_URL_PARAMETER",turkSubmitTo:"INVALID_URL_PARAMETER"},t=function(e,t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");const n=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);return null==n?"":n[1]},n=t(window.location.href,"assignmentId")?window.location.href:document.referrer;return["assignmentId","hitId","workerId","turkSubmitTo"].map((function(i){e[i]=unescape(t(n,i))})),e.previewMode="ASSIGNMENT_ID_NOT_AVAILABLE"==e.assignmentId,e.outsideTurk=!e.previewMode&&""===e.hitId&&""==e.assignmentId&&""==e.workerId,e}var cc=Object.freeze({__proto__:null,submitToTurk:function(e){const t=rc(),n=t.assignmentId,i=t.turkSubmitTo;if(!n||!i)return;const a=document.createElement("form");a.method="POST",a.action=i+"/mturk/externalSubmit?assignmentId="+n;for(const t in e)if(e.hasOwnProperty(t)){const n=document.createElement("input");n.type="hidden",n.name=t,n.id=t,n.value=e[t],a.appendChild(n)}document.body.appendChild(a),a.submit()},turkInfo:rc});class lc{constructor(e,t,n,i){if(this.jsPsych=e,this.progress={current_location:-1,current_variable_set:0,current_repetition:0,current_iteration:0,done:!1},this.parent_node=n,this.relative_id=void 0===n?0:i,void 0!==t.timeline){this.timeline_parameters={timeline:[],loop_function:t.loop_function,conditional_function:t.conditional_function,sample:t.sample,randomize_order:void 0!==t.randomize_order&&t.randomize_order,repetitions:void 0===t.repetitions?1:t.repetitions,timeline_variables:void 0===t.timeline_variables?[{}]:t.timeline_variables,on_timeline_finish:t.on_timeline_finish,on_timeline_start:t.on_timeline_start},this.setTimelineVariablesOrder();var a=Object.assign({},t);delete a.timeline,delete a.conditional_function,delete a.loop_function,delete a.randomize_order,delete a.repetitions,delete a.timeline_variables,delete a.sample,delete a.on_timeline_start,delete a.on_timeline_finish,this.node_trial_data=a;for(var o=0;o<t.timeline.length;o++){var s=Object.assign({},a,t.timeline[o]);if("object"==typeof a.data&&"object"==typeof t.timeline[o].data){var r=Object.assign({},a.data,t.timeline[o].data);s.data=r}this.timeline_parameters.timeline.push(new lc(this.jsPsych,s,this,o))}}else void 0===t.type&&console.error('Trial level node is missing the "type" parameter. The parameters for the node are: '+JSON.stringify(t)),this.trial_parameters=Object.assign({},t)}trial(){return void 0===this.timeline_parameters?hr(this.trial_parameters):this.progress.current_location>=this.timeline_parameters.timeline.length?null:this.timeline_parameters.timeline[this.progress.current_location].trial()}markCurrentTrialComplete(){void 0===this.timeline_parameters?this.progress.done=!0:this.timeline_parameters.timeline[this.progress.current_location].markCurrentTrialComplete()}nextRepetiton(){this.setTimelineVariablesOrder(),this.progress.current_location=-1,this.progress.current_variable_set=0,this.progress.current_repetition++;for(var e=0;e<this.timeline_parameters.timeline.length;e++)this.timeline_parameters.timeline[e].reset()}setTimelineVariablesOrder(){const e=this.timeline_parameters;if(void 0!==e&&void 0!==e.timeline_variables){for(var t=[],n=0;n<e.timeline_variables.length;n++)t.push(n);void 0!==e.sample&&("custom"==e.sample.type?t=e.sample.fn(t):"with-replacement"==e.sample.type?t=ic(t,e.sample.size,e.sample.weights):"without-replacement"==e.sample.type?t=nc(t,e.sample.size):"fixed-repetitions"==e.sample.type?t=Zr(t,e.sample.size,!1):"alternate-groups"==e.sample.type?t=tc(e.sample.groups,e.sample.randomize_group_order):console.error('Invalid type in timeline sample parameters. Valid options for type are "custom", "with-replacement", "without-replacement", "fixed-repetitions", and "alternate-groups"')),e.randomize_order&&(t=ec(t)),this.progress.order=t}}nextSet(){this.progress.current_location=-1,this.progress.current_variable_set++;for(var e=0;e<this.timeline_parameters.timeline.length;e++)this.timeline_parameters.timeline[e].reset()}advance(){const e=this.progress,t=this.timeline_parameters,n=this.jsPsych.internal;if(e.done)return!0;if(-1==e.current_location){if(void 0!==t){if(void 0!==t.conditional_function&&0==e.current_repetition&&0==e.current_variable_set){n.call_immediate=!0;var i=t.conditional_function();if(n.call_immediate=!1,0==i)return e.done=!0,!0}void 0!==t.on_timeline_start&&0==e.current_variable_set&&t.on_timeline_start()}return e.current_location=0,this.advance()}if(void 0!==t){for(var a=!1;e.current_location<t.timeline.length&&0==a;){if(!t.timeline[e.current_location].advance())return a=!0,!1;e.current_location++}return e.current_variable_set<e.order.length-1?(this.nextSet(),this.advance()):e.current_repetition<t.repetitions-1?(this.nextRepetiton(),void 0!==t.on_timeline_finish&&t.on_timeline_finish(),this.advance()):(void 0!==t.on_timeline_finish&&t.on_timeline_finish(),void 0!==t.loop_function?(n.call_immediate=!0,t.loop_function(this.generatedData())?(this.reset(),n.call_immediate=!1,this.parent_node.advance()):(e.done=!0,n.call_immediate=!1,!0)):(e.done=!0,!0))}}isComplete(){return this.progress.done}getTimelineVariableValue(e){if(void 0!==this.timeline_parameters)return this.timeline_parameters.timeline_variables[this.progress.order[this.progress.current_variable_set]][e]}findTimelineVariable(e){var t=this.getTimelineVariableValue(e);return void 0===t?void 0!==this.parent_node?this.parent_node.findTimelineVariable(e):void 0:t}timelineVariable(e){if(void 0===this.timeline_parameters){const t=this.findTimelineVariable(e);return void 0===t&&console.warn("Timeline variable "+e+" not found."),t}{var t=Math.max(0,this.progress.current_location);t==this.timeline_parameters.timeline.length&&(t-=1);const n=this.timeline_parameters.timeline[t].timelineVariable(e);return void 0===n&&console.warn("Timeline variable "+e+" not found."),n}}allTimelineVariables(){for(var e=this.allTimelineVariablesNames(),t={},n=0;n<e.length;n++)t[e[n]]=this.timelineVariable(e[n]);return t}allTimelineVariablesNames(e=[]){if(void 0!==this.timeline_parameters){e=e.concat(Object.keys(this.timeline_parameters.timeline_variables[this.progress.order[this.progress.current_variable_set]]));var t=Math.max(0,this.progress.current_location);return t==this.timeline_parameters.timeline.length&&(t-=1),this.timeline_parameters.timeline[t].allTimelineVariablesNames(e)}if(void 0===this.timeline_parameters)return e}length(){var e=0;if(void 0===this.timeline_parameters)return 1;for(var t=0;t<this.timeline_parameters.timeline.length;t++)e+=this.timeline_parameters.timeline[t].length();return e}percentComplete(){for(var e=this.length(),t=0,n=0;n<this.timeline_parameters.timeline.length;n++)this.timeline_parameters.timeline[n].isComplete()&&(t+=this.timeline_parameters.timeline[n].length());return t/e*100}reset(){if(this.progress.current_location=-1,this.progress.current_repetition=0,this.progress.current_variable_set=0,this.progress.current_iteration++,this.progress.done=!1,this.setTimelineVariablesOrder(),void 0!==this.timeline_parameters)for(var e=0;e<this.timeline_parameters.timeline.length;e++)this.timeline_parameters.timeline[e].reset()}end(){this.progress.done=!0}endActiveNode(){void 0===this.timeline_parameters?(this.end(),this.parent_node.end()):this.timeline_parameters.timeline[this.progress.current_location].endActiveNode()}ID(){var e="";return void 0===this.parent_node?"0."+this.progress.current_iteration:(e+=this.parent_node.ID()+"-",e+=this.relative_id+"."+this.progress.current_iteration)}activeID(){return void 0===this.timeline_parameters?this.ID():this.timeline_parameters.timeline[this.progress.current_location].activeID()}generatedData(){return this.jsPsych.data.getDataByTimelineNode(this.ID())}trialsOfType(e){if(void 0===this.timeline_parameters)return this.trial_parameters.type==e?this.trial_parameters:[];for(var t=[],n=0;n<this.timeline_parameters.timeline.length;n++){var i=this.timeline_parameters.timeline[n].trialsOfType(e);t=t.concat(i)}return t}insert(e){void 0===this.timeline_parameters?console.error("Cannot add new trials to a trial-level node."):this.timeline_parameters.timeline.push(new lc(this.jsPsych,Object.assign(Object.assign({},this.node_trial_data),e),this,this.timeline_parameters.timeline.length))}}function pc(e){return new Promise((t=>setTimeout(t,e)))}class uc{version(){return"7.3.4"}constructor(e){this.extensions={},this.turk=cc,this.randomization=sc,this.utils=gr,this.opts={},this.global_trial_index=0,this.current_trial={},this.current_trial_finished=!1,this.paused=!1,this.waiting=!1,this.file_protocol=!1,this.simulation_mode=null,this.webaudio_context=null,this.internal={call_immediate:!1},this.progress_bar_amount=0,e=Object.assign({display_element:void 0,on_finish:()=>{},on_trial_start:()=>{},on_trial_finish:()=>{},on_data_update:()=>{},on_interaction_data_update:()=>{},on_close:()=>{},use_webaudio:!0,exclusions:{},show_progress_bar:!1,message_progress_bar:"Completion Progress",auto_update_progress_bar:!0,default_iti:0,minimum_valid_rt:0,experiment_width:null,override_safe_mode:!1,case_sensitive_responses:!1,extensions:[]},e),this.opts=e,ur(this),this.webaudio_context="undefined"!=typeof window&&void 0!==window.AudioContext?new AudioContext:null,"file:"!=window.location.protocol||!1!==e.override_safe_mode&&void 0!==e.override_safe_mode||(e.use_webaudio=!1,this.file_protocol=!0,console.warn("jsPsych detected that it is running via the file:// protocol and not on a web server. To prevent issues with cross-origin requests, Web Audio and video preloading have been disabled. If you would like to override this setting, you can set 'override_safe_mode' to 'true' in initJsPsych. For more information, see: https://www.jspsych.org/overview/running-experiments")),this.data=new xr(this),this.pluginAPI=function(e){const t=e.getInitSettings(),n=ur(new wr(e.getDisplayContainerElement,t.case_sensitive_responses,t.minimum_valid_rt)),i=ur(new Sr),a=ur(new jr(t.use_webaudio,e.webaudio_context)),o=ur(new yr),s=ur(new Cr(e.getDisplayContainerElement,i.setTimeout));return Object.assign({},n,i,a,o,s)}(this);for(const t of e.extensions)this.extensions[t.type.info.name]=new t.type(this);this.pluginAPI.initAudio()}run(e){return cr(this,void 0,void 0,(function*(){void 0===e&&console.error("No timeline declared in jsPsych.run. Cannot start experiment."),0===e.length&&console.error("No trials have been added to the timeline (the timeline is an empty array). Cannot start experiment."),this.timelineDescription=e,this.timeline=new lc(this,{timeline:e}),yield this.prepareDom(),yield this.checkExclusions(this.opts.exclusions),yield this.loadExtensions(this.opts.extensions),document.documentElement.setAttribute("jspsych","present"),this.startExperiment(),yield this.finished}))}simulate(e,t="data-only",n={}){return cr(this,void 0,void 0,(function*(){this.simulation_mode=t,this.simulation_options=n,yield this.run(e)}))}getProgress(){return{total_trials:void 0===this.timeline?void 0:this.timeline.length(),current_trial_global:this.global_trial_index,percent_complete:void 0===this.timeline?0:this.timeline.percentComplete()}}getStartTime(){return this.exp_start_time}getTotalTime(){return void 0===this.exp_start_time?0:(new Date).getTime()-this.exp_start_time.getTime()}getDisplayElement(){return this.DOM_target}getDisplayContainerElement(){return this.DOM_container}finishTrial(e={}){var t;if(this.current_trial_finished)return;this.current_trial_finished=!0,void 0!==this.current_trial.css_classes&&Array.isArray(this.current_trial.css_classes)&&this.DOM_target.classList.remove(...this.current_trial.css_classes),this.data.write(e);const n=this.data.getLastTrialData().values()[0],i=this.current_trial;if("object"==typeof i.save_trial_parameters)for(const e of Object.keys(i.save_trial_parameters)){const t=i.save_trial_parameters[e];!0===t&&(void 0===i[e]?console.warn(`Invalid parameter specified in save_trial_parameters. Trial has no property called "${e}".`):"function"==typeof i[e]?n[e]=i[e].toString():n[e]=i[e]),!1===t&&"internal_node_id"!==e&&"trial_index"!==e&&delete n[e]}const a=(null!==(t=i.extensions)&&void 0!==t?t:[]).map((e=>this.extensions[e.type.info.name].on_finish(e.params))),o=()=>{this.internal.call_immediate=!0,"function"==typeof i.on_finish&&i.on_finish(n),this.opts.on_trial_finish(n),this.opts.on_data_update(n),this.internal.call_immediate=!1,"data-only"===this.simulation_mode?this.nextTrial():null===typeof i.post_trial_gap||void 0===i.post_trial_gap?this.opts.default_iti>0?setTimeout(this.nextTrial,this.opts.default_iti):this.nextTrial():i.post_trial_gap>0?setTimeout(this.nextTrial,i.post_trial_gap):this.nextTrial()};if(a.some((e=>"function"==typeof e.then)))Promise.all(a.map((e=>Promise.resolve(e).then((e=>{Object.assign(n,e)}))))).then(o);else{for(const e of a)Object.assign(n,e);o()}}endExperiment(e="",t={}){this.timeline.end_message=e,this.timeline.end(),this.pluginAPI.cancelAllKeyboardResponses(),this.pluginAPI.clearAllTimeouts(),this.finishTrial(t)}endCurrentTimeline(){this.timeline.endActiveNode()}getCurrentTrial(){return this.current_trial}getInitSettings(){return this.opts}getCurrentTimelineNodeID(){return this.timeline.activeID()}timelineVariable(e,t=!1){return this.internal.call_immediate||!0===t?this.timeline.timelineVariable(e):{timelineVariablePlaceholder:!0,timelineVariableFunction:()=>this.timeline.timelineVariable(e)}}getAllTimelineVariables(){return this.timeline.allTimelineVariables()}addNodeToEndOfTimeline(e,t){this.timeline.insert(e)}pauseExperiment(){this.paused=!0}resumeExperiment(){this.paused=!1,this.waiting&&(this.waiting=!1,this.nextTrial())}loadFail(e){e=e||"<p>The experiment failed to load.</p>",this.DOM_target.innerHTML=e}getSafeModeStatus(){return this.file_protocol}getTimeline(){return this.timelineDescription}prepareDom(){return cr(this,void 0,void 0,(function*(){"complete"!==document.readyState&&(yield new Promise((e=>{window.addEventListener("load",e)})));const e=this.opts;if(void 0===e.display_element){null===document.querySelector("body")&&document.documentElement.appendChild(document.createElement("body")),document.querySelector("html").style.height="100%",document.querySelector("body").style.margin="0px",document.querySelector("body").style.height="100%",document.querySelector("body").style.width="100%",e.display_element=document.querySelector("body")}else{const t=e.display_element instanceof Element?e.display_element:document.querySelector("#"+e.display_element);null===t?console.error("The display_element specified in initJsPsych() does not exist in the DOM."):e.display_element=t}e.display_element.innerHTML='<div class="jspsych-content-wrapper"><div id="jspsych-content"></div></div>',this.DOM_container=e.display_element,this.DOM_target=document.querySelector("#jspsych-content"),null!==e.experiment_width&&(this.DOM_target.style.width=e.experiment_width+"px"),e.display_element.tabIndex=0,-1===e.display_element.className.indexOf("jspsych-display-element")&&(e.display_element.className+=" jspsych-display-element"),this.DOM_target.className+="jspsych-content",this.data.createInteractionListeners(),window.addEventListener("beforeunload",e.on_close)}))}loadExtensions(e){return cr(this,void 0,void 0,(function*(){try{yield Promise.all(e.map((e=>this.extensions[e.type.info.name].initialize(e.params||{}))))}catch(e){throw console.error(e),new Error(e)}}))}startExperiment(){this.finished=new Promise((e=>{this.resolveFinishedPromise=e})),!0===this.opts.show_progress_bar&&this.drawProgressBar(this.opts.message_progress_bar),this.exp_start_time=new Date,this.timeline.advance(),this.doTrial(this.timeline.trial())}finishExperiment(){const e=this.opts.on_finish(this.data.get()),t=()=>{void 0!==this.timeline.end_message&&(this.DOM_target.innerHTML=this.timeline.end_message),this.resolveFinishedPromise()};e?Promise.resolve(e).then(t):t()}nextTrial(){if(this.paused)return void(this.waiting=!0);this.global_trial_index++,this.timeline.markCurrentTrialComplete();const e=this.timeline.advance();!0===this.opts.show_progress_bar&&!0===this.opts.auto_update_progress_bar&&this.updateProgressBar(),e?this.finishExperiment():this.doTrial(this.timeline.trial())}doTrial(e){if(this.current_trial=e,this.current_trial_finished=!1,this.evaluateTimelineVariables(e),"string"==typeof e.type)throw new dr("A string was provided as the trial's `type` parameter. Since jsPsych v7, the `type` parameter needs to be a plugin object.");if(e.type=Object.assign(Object.assign({},ur(new e.type(this))),{info:e.type.info}),this.evaluateFunctionParameters(e),this.setDefaultValues(e),this.internal.call_immediate=!0,this.opts.on_trial_start(e),"function"==typeof e.on_start&&e.on_start(e),Array.isArray(e.extensions))for(const t of e.extensions)this.extensions[t.type.info.name].on_start(t.params);this.DOM_container.focus(),this.DOM_target.scrollTop=0,void 0!==e.css_classes&&(Array.isArray(e.css_classes)||"string"!=typeof e.css_classes||(e.css_classes=[e.css_classes]),Array.isArray(e.css_classes)&&this.DOM_target.classList.add(...e.css_classes));const t=()=>{if("function"==typeof e.on_load&&e.on_load(),Array.isArray(e.extensions))for(const t of e.extensions)this.extensions[t.type.info.name].on_load(t.params)};let n,i,a;this.simulation_mode||(n=e.type.trial(this.DOM_target,e,t)),this.simulation_mode&&(e.type.simulate?(e.simulation_options||(i=this.simulation_options.default),e.simulation_options&&("string"==typeof e.simulation_options?this.simulation_options[e.simulation_options]?i=this.simulation_options[e.simulation_options]:this.simulation_options.default?(console.log(`No matching simulation options found for "${e.simulation_options}". Using "default" options.`),i=this.simulation_options.default):(console.log(`No matching simulation options found for "${e.simulation_options}" and no "default" options provided. Using the default values provided by the plugin.`),i={}):i=e.simulation_options),a=this.utils.deepMerge(this.simulation_options.default,i),a=this.utils.deepCopy(a),a=this.replaceFunctionsWithValues(a,null),n=!1===(null==a?void 0:a.simulate)?e.type.trial(this.DOM_target,e,t):e.type.simulate(e,(null==a?void 0:a.mode)||this.simulation_mode,a,t)):n=e.type.trial(this.DOM_target,e,t));n&&"function"==typeof n.then||this.simulation_mode&&(!this.simulation_mode||!1!==(null==a?void 0:a.simulate))||t(),this.internal.call_immediate=!1}evaluateTimelineVariables(e){for(const t of Object.keys(e))"object"==typeof e[t]&&null!==e[t]&&void 0!==e[t].timelineVariablePlaceholder&&(e[t]=e[t].timelineVariableFunction()),"object"==typeof e[t]&&null!==e[t]&&"timeline"!==t&&"timeline_variables"!==t&&this.evaluateTimelineVariables(e[t])}evaluateFunctionParameters(e){this.internal.call_immediate=!0;for(const t of Object.keys(e))"type"!==t&&(void 0!==kr[t]&&kr[t].type!==fr.FUNCTION&&(e[t]=this.replaceFunctionsWithValues(e[t],null)),void 0!==e.type.info.parameters[t]&&e.type.info.parameters[t].type!==fr.FUNCTION&&(e[t]=this.replaceFunctionsWithValues(e[t],e.type.info.parameters[t])));this.internal.call_immediate=!1}replaceFunctionsWithValues(e,t){if(null===e)return e;if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=this.replaceFunctionsWithValues(e[n],t);else if("object"==typeof e)if(null!==t&&t.nested)for(const n of Object.keys(e))"object"==typeof t.nested[n]&&t.nested[n].type!==fr.FUNCTION&&(e[n]=this.replaceFunctionsWithValues(e[n],t.nested[n]));else for(const t of Object.keys(e))"type"!==t&&"timeline"!==t&&"timeline_variables"!==t&&(e[t]=this.replaceFunctionsWithValues(e[t],null));else if("function"==typeof e)return e();return e}setDefaultValues(e){for(const t in e.type.info.parameters)e.type.info.parameters[t].type===fr.COMPLEX?(void 0===e[t]&&e.type.info.parameters[t].default&&(e[t]=e.type.info.parameters[t].default),!0===e.type.info.parameters[t].array&&Array.isArray(e[t])&&e[t].forEach((function(n,i){for(const n in e.type.info.parameters[t].nested)void 0!==e[t][i][n]&&null!==e[t][i][n]||(void 0===e.type.info.parameters[t].nested[n].default?console.error(`You must specify a value for the ${n} parameter (nested in the ${t} parameter) in the ${e.type.info.name} plugin.`):e[t][i][n]=e.type.info.parameters[t].nested[n].default)}))):void 0!==e[t]&&null!==e[t]||(void 0===e.type.info.parameters[t].default?console.error(`You must specify a value for the ${t} parameter in the ${e.type.info.name} plugin.`):e[t]=e.type.info.parameters[t].default)}checkExclusions(e){return cr(this,void 0,void 0,(function*(){if((e.min_width||e.min_height||e.audio)&&console.warn("The exclusions option in `initJsPsych()` is deprecated and will be removed in a future version. We recommend using the browser-check plugin instead. See https://www.jspsych.org/latest/plugins/browser-check/."),e.min_width||e.min_height){const t=e.min_width||0,n=e.min_height||0;if(window.innerWidth<t||window.innerHeight<n){for(this.getDisplayElement().innerHTML="<p>Your browser window is too small to complete this experiment. Please maximize the size of your browser window. If your browser window is already maximized, you will not be able to complete this experiment.</p><p>The minimum width is "+t+"px. Your current width is "+window.innerWidth+"px.</p><p>The minimum height is "+n+"px. Your current height is "+window.innerHeight+"px.</p>";window.innerWidth<t||window.innerHeight<n;)yield pc(100);this.getDisplayElement().innerHTML=""}}if(void 0!==e.audio&&e.audio&&!window.hasOwnProperty("AudioContext")&&!window.hasOwnProperty("webkitAudioContext"))throw this.getDisplayElement().innerHTML="<p>Your browser does not support the WebAudio API, which means that you will not be able to complete the experiment.</p><p>Browsers that support the WebAudio API include Chrome, Firefox, Safari, and Edge.</p>",new Error}))}drawProgressBar(e){document.querySelector(".jspsych-display-element").insertAdjacentHTML("afterbegin",'<div id="jspsych-progressbar-container"><span>'+e+'</span><div id="jspsych-progressbar-outer"><div id="jspsych-progressbar-inner"></div></div></div>')}updateProgressBar(){this.setProgressBar(this.getProgress().percent_complete/100)}setProgressBar(e){e=Math.max(Math.min(1,e),0),document.querySelector("#jspsych-progressbar-inner").style.width=100*e+"%",this.progress_bar_amount=e}getProgressBarCompleted(){return this.progress_bar_amount}}"undefined"!=typeof window&&window.hasOwnProperty("webkitAudioContext")&&!window.hasOwnProperty("AudioContext")&&(window.AudioContext=webkitAudioContext);const dc={name:"preload",parameters:{auto_preload:{type:fr.BOOL,pretty_name:"Auto-preload",default:!1},trials:{type:fr.TIMELINE,pretty_name:"Trials",default:[]},images:{type:fr.STRING,pretty_name:"Images",default:[],array:!0},audio:{type:fr.STRING,pretty_name:"Audio",default:[],array:!0},video:{type:fr.STRING,pretty_name:"Video",default:[],array:!0},message:{type:fr.HTML_STRING,pretty_name:"Message",default:null},show_progress_bar:{type:fr.BOOL,pretty_name:"Show progress bar",default:!0},continue_after_error:{type:fr.BOOL,pretty_name:"Continue after error",default:!1},error_message:{type:fr.HTML_STRING,pretty_name:"Error message",default:"The experiment failed to load."},show_detailed_errors:{type:fr.BOOL,pretty_name:"Show detailed errors",default:!1},max_load_time:{type:fr.INT,pretty_name:"Max load time",default:null},on_error:{type:fr.FUNCTION,pretty_name:"On error",default:null},on_success:{type:fr.FUNCTION,pretty_name:"On success",default:null}}};class mc{constructor(e){this.jsPsych=e}trial(e,t){var n=null,i=!1,a=[],o=[],s=[],r=[],c=this.jsPsych.getSafeModeStatus(),l=[],p=[],u=[];if(t.auto_preload){var d=this.jsPsych.getTimeline(),m=this.jsPsych.pluginAPI.getAutoPreloadList(d);l=l.concat(m.images),p=p.concat(m.audio),u=u.concat(m.video)}if(t.trials.length>0){var h=this.jsPsych.pluginAPI.getAutoPreloadList(t.trials);l=l.concat(h.images),p=p.concat(h.audio),u=u.concat(h.video)}l=l.concat(t.images),p=p.concat(t.audio),u=u.concat(t.video),l=this.jsPsych.utils.unique(l.flat()),p=this.jsPsych.utils.unique(p.flat()),u=this.jsPsych.utils.unique(u.flat()),c&&(u=[]);var f="";null!==t.message&&(f+=t.message),t.show_progress_bar&&(f+="\n <div id='jspsych-loading-progress-bar-container' style='height: 10px; width: 300px; background-color: #ddd; margin: auto;'>\n <div id='jspsych-loading-progress-bar' style='height: 10px; width: 0%; background-color: #777;'></div>\n </div>"),e.innerHTML=f;const g=()=>{if(k++,t.show_progress_bar){var n=k/w*100,i=e.querySelector("#jspsych-loading-progress-bar");null!==i&&(i.style.width=n+"%")}},v=()=>{void 0!==i&&!1===i&&(this.jsPsych.pluginAPI.clearAllTimeouts(),this.jsPsych.pluginAPI.cancelPreloads(),n=!0,y())},b=()=>{this.jsPsych.pluginAPI.cancelPreloads(),void 0===n||!1!==n&&null!==n||(i=!0,_<w&&(n=!1),S("timeout"),r.push("<p><strong>Loading timed out.</strong><br>Consider compressing your stimuli files, loading your files in smaller batches,<br>and/or increasing the <i>max_load_time</i> parameter.</p>"),t.continue_after_error?y():x())},x=()=>{this.jsPsych.pluginAPI.clearAllTimeouts(),this.jsPsych.pluginAPI.cancelPreloads(),e.innerHTML=t.error_message,t.show_detailed_errors&&(e.innerHTML+="<p><strong>Error details:</strong></p>",r.forEach((t=>{e.innerHTML+=t})))},y=()=>{this.jsPsych.pluginAPI.clearAllTimeouts();var t={success:n,timeout:i,failed_images:a,failed_audio:o,failed_video:s};e.innerHTML="",this.jsPsych.finishTrial(t)};null!==t.max_load_time&&this.jsPsych.pluginAPI.setTimeout(b,t.max_load_time);var w=l.length+p.length+u.length,k=0,_=0;if(0==w)v();else{const e=e=>{this.jsPsych.pluginAPI.preloadVideo(u,e,C,j)},t=e=>{this.jsPsych.pluginAPI.preloadAudio(p,e,C,j)},n=e=>{this.jsPsych.pluginAPI.preloadImages(l,e,C,j)};u.length>0&&e((()=>{})),p.length>0&&t((()=>{})),l.length>0&&n((()=>{}))}function j(e){g(),null==n&&(n=!1);var i="unknown file";e.source&&(i=e.source),e.error&&e.error.path&&e.error.path.length>0&&("img"==e.error.path[0].localName?a.push(i):"audio"==e.error.path[0].localName?o.push(i):"video"==e.error.path[0].localName&&s.push(i));var c="<p><strong>Error loading file: "+i+"</strong><br>";e.error.statusText&&(c+="File request response status: "+e.error.statusText+"<br>"),"404"==e.error&&(c+="404 - file not found.<br>"),void 0!==e.error.loaded&&null!==e.error.loaded&&0!==e.error.loaded?c+=e.error.loaded+" bytes transferred.":c+="File did not begin loading. Check that file path is correct and reachable by the browser,<br>and that loading is not blocked by cross-origin resource sharing (CORS) errors.",c+="</p>",r.push(c),S(i),k==w&&(t.continue_after_error?y():x())}function C(e){g(),function(e){null!==t.on_success&&t.on_success(e)}(e),++_==w?v():k==w&&(t.continue_after_error?y():x())}function S(e){null!==t.on_error&&t.on_error(e)}}simulate(e,t,n,i){"data-only"==t&&(i(),this.simulate_data_only(e,n)),"visual"==t&&this.simulate_visual(e,n,i)}create_simulation_data(e,t){return this.jsPsych.pluginAPI.mergeSimulationData({success:!0,timeout:!1,failed_images:[],failed_audio:[],failed_video:[]},t)}simulate_data_only(e,t){const n=this.create_simulation_data(e,t);this.jsPsych.finishTrial(n)}simulate_visual(e,t,n){const i=this.jsPsych.getDisplayElement();this.trial(i,e),n()}}function hc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,a,o,s,r=[],c=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(i=o.call(n)).done)&&(r.push(i.value),r.length!==t);c=!0);}catch(e){l=!0,a=e}finally{try{if(!c&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw a}}return r}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return fc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fc(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}mc.info=dc,fr.BOOL,fr.HTML_STRING,fr.STRING,fr.INT;var gc=[],vc=gc.forEach,bc=gc.slice;var xc=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,yc=function(e,t,n,i){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{path:"/",sameSite:"strict"};n&&(a.expires=new Date,a.expires.setTime(a.expires.getTime()+60*n*1e3)),i&&(a.domain=i),document.cookie=function(e,t,n){var i=n||{};i.path=i.path||"/";var a=encodeURIComponent(t),o="".concat(e,"=").concat(a);if(i.maxAge>0){var s=i.maxAge-0;if(Number.isNaN(s))throw new Error("maxAge should be a Number");o+="; Max-Age=".concat(Math.floor(s))}if(i.domain){if(!xc.test(i.domain))throw new TypeError("option domain is invalid");o+="; Domain=".concat(i.domain)}if(i.path){if(!xc.test(i.path))throw new TypeError("option path is invalid");o+="; Path=".concat(i.path)}if(i.expires){if("function"!=typeof i.expires.toUTCString)throw new TypeError("option expires is invalid");o+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(o+="; HttpOnly"),i.secure&&(o+="; Secure"),i.sameSite)switch("string"==typeof i.sameSite?i.sameSite.toLowerCase():i.sameSite){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return o}(e,encodeURIComponent(t),a)},wc=function(e){for(var t="".concat(e,"="),n=document.cookie.split(";"),i=0;i<n.length;i++){for(var a=n[i];" "===a.charAt(0);)a=a.substring(1,a.length);if(0===a.indexOf(t))return a.substring(t.length,a.length)}return null},kc={name:"cookie",lookup:function(e){var t;if(e.lookupCookie&&"undefined"!=typeof document){var n=wc(e.lookupCookie);n&&(t=n)}return t},cacheUserLanguage:function(e,t){t.lookupCookie&&"undefined"!=typeof document&&yc(t.lookupCookie,e,t.cookieMinutes,t.cookieDomain,t.cookieOptions)}},_c={name:"querystring",lookup:function(e){var t;if("undefined"!=typeof window){var n=window.location.search;!window.location.search&&window.location.hash&&window.location.hash.indexOf("?")>-1&&(n=window.location.hash.substring(window.location.hash.indexOf("?")));for(var i=n.substring(1).split("&"),a=0;a<i.length;a++){var o=i[a].indexOf("=");if(o>0)i[a].substring(0,o)===e.lookupQuerystring&&(t=i[a].substring(o+1))}}return t}},jc=null,Cc=function(){if(null!==jc)return jc;try{jc="undefined"!==window&&null!==window.localStorage;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch(e){jc=!1}return jc},Sc={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&Cc()){var n=window.localStorage.getItem(e.lookupLocalStorage);n&&(t=n)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&Cc()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},Ec=null,Tc=function(){if(null!==Ec)return Ec;try{Ec="undefined"!==window&&null!==window.sessionStorage;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch(e){Ec=!1}return Ec},Mc={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&Tc()){var n=window.sessionStorage.getItem(e.lookupSessionStorage);n&&(t=n)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&Tc()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},Oc={name:"navigator",lookup:function(e){var t=[];if("undefined"!=typeof navigator){if(navigator.languages)for(var n=0;n<navigator.languages.length;n++)t.push(navigator.languages[n]);navigator.userLanguage&&t.push(navigator.userLanguage),navigator.language&&t.push(navigator.language)}return t.length>0?t:void 0}},Ac={name:"htmlTag",lookup:function(e){var t,n=e.htmlTag||("undefined"!=typeof document?document.documentElement:null);return n&&"function"==typeof n.getAttribute&&(t=n.getAttribute("lang")),t}},Ic={name:"path",lookup:function(e){var t;if("undefined"!=typeof window){var n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(n instanceof Array)if("number"==typeof e.lookupFromPathIndex){if("string"!=typeof n[e.lookupFromPathIndex])return;t=n[e.lookupFromPathIndex].replace("/","")}else t=n[0].replace("/","")}return t}},Pc={name:"subdomain",lookup:function(e){var t="number"==typeof e.lookupFromSubdomainIndex?e.lookupFromSubdomainIndex+1:1,n="undefined"!=typeof window&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(n)return n[t]}};var Rc=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Co(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return To(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=e||{languageUtils:{}},this.options=function(e){return vc.call(bc.call(arguments,1),(function(t){if(t)for(var n in t)void 0===e[n]&&(e[n]=t[n])})),e}(t,this.options||{},{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(e){return e}}),"string"==typeof this.options.convertDetectedLanguage&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(e){return e.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(kc),this.addDetector(_c),this.addDetector(Sc),this.addDetector(Mc),this.addDetector(Oc),this.addDetector(Ac),this.addDetector(Ic),this.addDetector(Pc)}},{key:"addDetector",value:function(e){return this.detectors[e.name]=e,this}},{key:"detect",value:function(e){var t=this;e||(e=this.options.order);var n=[];return e.forEach((function(e){if(t.detectors[e]){var i=t.detectors[e].lookup(t.options);i&&"string"==typeof i&&(i=[i]),i&&(n=n.concat(i))}})),n=n.map((function(e){return t.options.convertDetectedLanguage(e)})),this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}},{key:"cacheUserLanguage",value:function(e,t){var n=this;t||(t=this.options.caches),t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach((function(t){n.detectors[t]&&n.detectors[t].cacheUserLanguage(e,n.options)})))}}]),e}();Rc.type="languageDetector";var Lc={progressBar:"Progress Complete",fullScreenTrial:{prompt:"Switching to full screen mode.",buttonText:"Go"},instructions:{intro:{header:"Welcome to ROAR Multichoice!",topText:"In this activity, you're going to help me complete some sentences.",bottomText:""},instructions:{header:"What word completes the sentence?",topText:"Choose the best option to fill in the blank.",bottomText:""},practice:{header:"Let's practice!",topText:"Remember, your job is to choose the right word that fills in the blank.",bottomText:""},postPractice:{header:"Great job!",topText:"Now you're ready to try on your own. Try your best to choose the word that completes the sentence.",bottomText:""},practiceCorrect:{header:"That's right!",topText:"",bottomText:""},break1:{header:"Keep up the good work!",topText:"",bottomText:""},break2:{header:"You are doing great!",topText:"",bottomText:""},break3:{header:"Let's keep going.",topText:"",bottomText:""},break4:{header:"You are an expert at this!",topText:"",bottomText:""},break5:{header:"You can do it!",topText:"",bottomText:""},ending:{header:"You're all done! Thank you for helping me find those words!",topText:"",bottomText:""}}};(new Rc).addDetector({name:"defaultToEnglish",lookup:e=>"en"}),Ds.use(Rc).init({debug:!1,load:"languageOnly",fallbackLng:"en",detection:{order:["defaultToEnglish","querystring"]},resources:{en:{translation:Lc}}}),function(e){const t=new uc(e);Object.defineProperties(t,Object.fromEntries(Object.entries({init:"`jsPsych.init()` was replaced by `initJsPsych()` in jsPsych v7.",ALL_KEYS:'jsPsych.ALL_KEYS was replaced by the "ALL_KEYS" string in jsPsych v7.',NO_KEYS:'jsPsych.NO_KEYS was replaced by the "NO_KEYS" string in jsPsych v7.',currentTimelineNodeID:"`currentTimelineNodeID()` was renamed to `getCurrentTimelineNodeID()` in jsPsych v7.",progress:"`progress()` was renamed to `getProgress()` in jsPsych v7.",startTime:"`startTime()` was renamed to `getStartTime()` in jsPsych v7.",totalTime:"`totalTime()` was renamed to `getTotalTime()` in jsPsych v7.",currentTrial:"`currentTrial()` was renamed to `getCurrentTrial()` in jsPsych v7.",initSettings:"`initSettings()` was renamed to `getInitSettings()` in jsPsych v7.",allTimelineVariables:"`allTimelineVariables()` was renamed to `getAllTimelineVariables()` in jsPsych v7."}).map((([e,t])=>[e,{get(){throw new dr(t)}}]))))}({show_progress_bar:!1,auto_update_progress_bar:!1,message_progress_bar:`${Ds.t("progressBar")}`});var Nc={default:{languageSpecific:{device:[],shared:["tryAgain.mp3","thatsRight.mp3","clickButton.jpg","intro.mp3","ins.mp3","surveyPractice.mp3","surveyPostPractice.mp3","great-job-click.mp3","break1.mp3","break2.mp3","break3.mp3","break4.mp3","break5.mp3","ending.mp3"]},shared:["nullAudio.mp3","select.mp3","goButton.png","coin.mp3","countdown0.mp3","countdown1.mp3","countdown2.mp3","countdown3.mp3","fail.mp3","fairyCoin.mp3","coin_bag.gif","ROARLion.gif"]}};const Dc="https://storage.googleapis.com/egma-math";!function(e,t,n){var i={images:{},video:{},audio:{}},a=ar(n),o=or(),s=function(e,n){var s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];e.forEach((function(e){var c=rr(e),l=Vs.parse(e).name,p=l.replace(/^([A-Z])|[\s-_](\w)/g,(function(e,t,n,i){return n?n.toUpperCase():t.toLowerCase()})),u=sr(t,e,a,o,n,s,r);i[c][p]=u}))},r=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];Array.isArray(e)?s(e,"default"):(e.languageSpecific&&(Array.isArray(e.languageSpecific)?s(e.languageSpecific,"languageSpecific"):function(e,t){Object.entries(e).forEach((function(e){var n=hc(e,2),i=n[0],a=n[1];s(a,i,!0,t)}))}(e.languageSpecific,n)),e.device&&s(e.device,"device"),e.shared&&(t=e.shared,Array.isArray(t)?s(t,"shared"):Object.entries(t).forEach((function(e){var t=hc(e,2),n=t[0],i=t[1];s(i,"device"===n?"shared/device":"shared")}))))};e.preload&&Object.entries(e.preload).forEach((function(e){var t=hc(e,2)[1];r(t)})),e.default&&r(e.default,!0)}(Nc,Dc),function(e,t,n){var i={},a=ar(n),o=or();function s(e,n,s){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],c=arguments.length>4&&void 0!==arguments[4]&&arguments[4];e.forEach((function(e){var l=rr(e),p=sr(t,e,a,o,s,r,c);i[n]||(i[n]={type:mc,message:"The experiment is loading",show_progress_bar:!0,continue_after_error:!1,error_message:"",show_detailed_errors:!0,max_load_time:null,on_error:null,on_success:null,images:[],audio:[],video:[]}),i[n][l].push(p)}))}function r(e,t,n){Array.isArray(t)?s(t,e,"languageSpecific"):function(e,t,n){Object.entries(t).forEach((function(t){var i=hc(t,2),a=i[0];s(i[1],e,a,!0,n)}))}(e,t,n)}function c(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];Array.isArray(t)?s(t,e,"default"):(t.languageSpecific&&r(e,t.languageSpecific,n),t.device&&s(t.device,e,"device"),t.shared&&function(e,t){Array.isArray(t)?s(t,e,"shared"):Object.entries(t).forEach((function(t){var n=hc(t,2),i=n[0];s(n[1],e,"device"===i?"shared/device":"shared")}))}(e,t.shared))}return e.preload&&Object.entries(e.preload).forEach((function(e){var t=hc(e,2);c(t[0],t[1])})),e.default&&c("default",e.default,!0),i}(Nc,Dc).default;const qc=(e,t)=>{let n;var i,a=("string"!=typeof(i=e)&&(i=String(i)),i.toLocaleLowerCase());return n=["true","false"].includes(a)?function(e,t=!1){return null==e?t:"true"===e.trim().toLowerCase()}(a):!(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:13,i=Number(e);if(null!=e){if(Number.isNaN(i)){var a={k:0,tk:0,pk:0,preschool:0,prekindergarten:0,transitionalkindergarten:0,kindergarten:0,infanttoddler:0,infant:0,toddler:0,first:1,firstgrade:1,second:2,secondgrade:2,third:3,thirdgrade:3,fourth:4,fourthgrade:4,fifth:5,fifthgrade:5,sixth:6,sixthgrade:6,seventh:7,seventhgrade:7,eighth:8,eighthgrade:8,ninth:9,ninthgrade:9,tenth:10,tenthgrade:10,eleventh:11,eleventhgrade:11,twelfth:12,twelfthgrade:12,freshman:9,sophomore:10,junior:11,senior:12,postgraduate:13,university:13,graduate:13,master:13,doctorate:13,masters:13}[e.toLowerCase().replace(/\s/g,"").replace(/-/g,"")];if(void 0===a)return;return a<t?t:a>n?n:a}return i<t?t:i>n?n:i}}(t)>=6),n};async function Fc(){const e=document.createElement("div");e.innerHTML='<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">\n\n\x3c!-- <h5 style="text-align:left;">\n Stanford University Research Consent Form\n <span style="float:right;">\n For IRB Use Only\n </span>\n</h5>\n\n<h5 style="text-align:left;">\n Protocol Director: Jason D. Yeatman, Ph.D.\n <span style="float:right;">\n Approval Date: October 31, 2023\n </span>\n</h5>\n\n<h5 style="text-align:left;">\n Protocol Title: Plasticity and Reading\n <span style="float:right;">\n Expiration Date: October 31, 2024\n </span>\n</h5> --\x3e\n\n<style>\n body {\n margin: 20px; /* Adjust the margin size as needed */\n }\n</style>\n\n<body>\n<h3 style="text-align: center;"> STANFORD UNIVERSITY CONSENT FORM </h3>\n\n<h4 style="text-align: center;"> Stanford University Reading &amp; Dyslexia Research Program: Behavioral Testing </h4>\n\n<blockquote>\n<h4 id="principal-investigator-">Principal Investigator:</h4>\n<p>Jason D. Yeatman </p>\n<p>Associate Professor</p>\n<p>Graduate School of Education</p>\n<p>School of Medicine, Division of Developmental Behavioral Pediatrics</p>\n<h4 id="contact-">Contact:</h4>\n<p>readingresearch@stanford.edu</p>\n<p><a href="https://dyslexia.stanford.edu/">https://dyslexia.stanford.edu/</a> </p>\n</blockquote>\n<h4 id="purpose-of-the-study">PURPOSE OF THE STUDY</h4>\n<p>Data collected through games in the web-browser will help researchers understand relationships between academic skills, reading proficiency, cognition, perception, and/or attitudes towards reading and school in individuals with a broad range of reading skills.</p>\n<h4 id="study-procedures">STUDY PROCEDURES</h4>\n<p>In this study, you or your child will be asked to complete computer tasks via a computer screen. An eye-tracking software will request access to your webcam and will be used to measure eye movements. You will be asked to provide verbal responses in which case the web browser will request access to your computer microphone. You or your child may be asked to complete multiple activities in one session depending on the study. </p>\n<h4 id="privacy-or-data-collection">PRIVACY OR DATA COLLECTION</h4>\n<p>We will do our best to ensure your privacy. Data that is collected through this online experiment is stored separately from identifying information such as your name. For the sake of payment, sometimes we store an email address you provide, but this is stored separately from the responses that are recorded in the online experiment. Each participant is assigned a code and that is used rather than names. This is called “coded data” and we try to ensure that the identity of our research participants is kept confidential. Data collected as part of this study may be used for many years to help discover trends in the population and explore changes due to development and education. In addition, coded data may be shared online or with collaborators to allow for new and unforeseen discoveries. Researchers may choose to include coded data in publications to support findings, or they may choose to release coded data alongside findings for replicability.</p>\n<p>We will collect mouse and click data, scrolling behavior, scores earned, button presses and their timestamps, time spent on each page, audio recordings, or other data that may be derived from your behavior on our page. This data will be stored on servers. The eye-tracking software will use your webcam to track your eyes. This software will record and save video data for future analysis. Once analysis has been completed, the video data will be deleted. Incomplete data may be logged if you quit out of the experiment early. If you would like to void your data, you may request it through our contact email.</p>\n<h4 id="compensation">COMPENSATION</h4>\n<p>We value [your/your child’s] participation. A Tango gift card will be sent through email upon completion of this study. Specific reward amounts will be indicated on the task card and/or study invitation, which you can view before launching the task or scheduling the appointment. If you or your child is completing these activities as part of another study, the compensation rate will remain consistent with the rate of the study you or your child is enrolled in. </p>\n<p>Please note that the gift card system we use to pay participants is not affiliated with Stanford and we will need to input your name and email into this system to send you the electronic gift card payment. If you feel uncomfortable with this process, please let us know before signing the consent form. Depending on the study, we may be able to look into other forms of payment for you.</p>\n<h4 id="risks-stress-or-discomfort">RISKS, STRESS, OR DISCOMFORT</h4>\n<p>If there is any reason to believe you are/your child is not safe to participate in any of the tasks, please contact us at readingresearch@stanford.edu. Some people may experience some physical discomfort or boredom due to being asked to sit for long periods. For computer tasks, some people may also experience dry eyes or eye fatigue. For some tasks that are untimed, breaks can be taken as needed during the session.</p>\n<h4 id="contact-information">CONTACT INFORMATION</h4>\n<p>If you have any additional questions or concerns about our research, feel free to email us at readingresearch@stanford.edu. We will be more than happy to help!</p>\n<p>For general information regarding questions or concerns about [your/your child’s] rights as a research participant, please call 1-866-680-2906 to reach the Administrative Panel on Human Subjects in Medical Research, Stanford University.</p>\n<form id="consentForm">\n <p>\n <input type="checkbox" id="webcamConsent" name="consent">\n I confirm that I have a webcam, and I agree to have my webcam track my eyes. I understand that the webcam will record or save video data and that it will be deleted once analysis is complete.\n </p>\n <p>\n <input type="checkbox" id="voiceConsent" name="consent">\n I agree to have my voice recorded. This data will only be used for data scoring purposes, will be stored securely, and will not be shared with others outside the lab.\n </p>\n <p>\n <input type="checkbox" id="participationConsent" name="consent">\n I agree to participate in this research. Participation in this research is voluntary, and I can stop at any time without penalty. I feel that I understand what I am getting into, and I know I am free to leave the experiment at any time by simply closing the web browser.\n </p>\n <button id="confirmButton" disabled>Continue to test</button>\n</form>\n</body>\n\n<h5 class="card-title" style="display: none;"></h5>\n\n<script>\n document.getElementById(\'consentForm\').addEventListener(\'change\', function() {\n var checkboxes = document.querySelectorAll(\'input[type="checkbox"][name="consent"]\');\n var allChecked = Array.from(checkboxes).every(checkbox => checkbox.checked);\n document.getElementById(\'confirmButton\').disabled = !allChecked;\n });\n<\/script>\n\n',document.body.appendChild(e),await async function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=t[e];n.src&&await zc(n.src)}}(e),function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=document.createElement("script");n.text=t[e].text,document.head.appendChild(n).parentNode.removeChild(n)}}(e),await new Promise((t=>{const n=document.getElementById("confirmButton");n&&n.addEventListener("click",(()=>{document.querySelectorAll("script[data-dynamic]").forEach((e=>e.parentNode.removeChild(e))),e.remove(),t()}))}))}function zc(e){return new Promise(((t,n)=>{const i=document.createElement("script");i.src=e,i.onload=t,i.onerror=n,document.head.appendChild(i)}))}window.store=s;var Vc='<!DOCTYPE html>\n<html lang="en">\n<head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">\n <style>\n body {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100vh;\n margin: 0;\n background-color: #ffffff; /* White background */\n color: #000000; /* Black text */\n }\n\n .loading-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n padding: 20px;\n border-radius: 10px;\n background: rgba(0, 0, 0, 0.05); /* Slight gray tint to differentiate from the white background */\n box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Soft shadow for depth */\n }\n\n .loading-spinner {\n border: 8px solid rgba(0, 0, 0, 0.1); /* Lighter border for the spinner */\n border-top: 8px solid #0d6efd; /* Blue color for active part of the spinner */\n border-radius: 50%;\n width: 80px;\n height: 80px;\n animation: spin 1s linear infinite;\n margin-bottom: 20px;\n }\n\n h2 {\n font-weight: 400;\n letter-spacing: 1px;\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n </style>\n</head>\n<body>\n <div class="loading-container">\n <div class="loading-spinner"></div>\n <h2>Loading...</h2>\n </div>\n</body>\n</html>\n',Bc={};function Uc(){const e=document.getElementById("deviceList"),t=document.getElementById("findDevice-collapsableCards");e.innerHTML="";const n=document.createElement("option");n.value="",n.text="",e.add(n);const i=Object.keys(deviceConfigs);if(i.forEach((t=>{const n=document.createElement("option");n.value=t,n.text=t.charAt(0).toUpperCase()+t.slice(1),e.add(n)})),console.log(i.length),1===i.length){Hc(deviceConfigs[i[0]]),t&&(t.style.display="none",Wc())}else t&&(t.style.display="block")}function Hc(e){console.log("You selected a "+e.deviceName),screenHeight=e.screenHeight,screenWidth=e.screenWidth,webcamHeight=e.webcamHeight,screenSizeCalibrated=e.screenSizeCalibrated,webcamCentered=e.webcamCentered,HeightWebcamEntered=e.HeightWebcamEntered,heightInput_textbox.value=webcamHeight,heightInput_textbox.disabled=HeightWebcamEntered,e.hasOwnProperty("normalizedFocalLength")&&(normalizedFocalLength=e.normalizedFocalLength),checkAllComplete()}function Wc(){var e=document.querySelectorAll(".card-title"),t=1;e.forEach((function(e){"none"!==e.parentElement.parentElement.style.display&&null!==e.parentElement.parentElement.offsetParent&&(e.textContent=e.textContent.replace(/\(\d+\)/,"("+t+")"),t++)}))}var $c=Object.freeze({__proto__:null,collapseCamera:function(e=!0){const t=document.querySelectorAll('[id*="-cameracollapsableCards"]');console.log(t),t.forEach((t=>{t.style.display=e?"none":""})),Wc()},collapseCards:function(e=!0){const t=document.querySelectorAll('[id*="-collapsableCards"]');console.log(t),t.forEach((t=>{t.style.display="Toggle"===e?"none"===t.style.display?"":"none":e?"none":""})),Wc()},deviceConfig:Bc,handleDevice:Hc,inputParticipantName:function(e){var t=document.getElementById("idInput");t.value=e,t.disabled=!0},updateCardNumbers:Wc,updateDeviceConfigFromJSON:async function(e){try{const t=await fetch(e),n=await t.json();console.log(n),deviceConfigs=n,Uc()}catch(e){console.error("Error fetching or parsing JSON:",e)}},updateDropdownOptions:Uc});function Kc(){const e=window.navigator,t=window.screen,n={userAgent:e.userAgent,platform:e.platform,language:e.language,deviceMemory:e.deviceMemory||"Not available",hardwareConcurrency:e.hardwareConcurrency,maxTouchPoints:e.maxTouchPoints,cookiesEnabled:e.cookieEnabled,webDriver:e.webdriver,onlineStatus:e.onLine,gpu:"Not available"},i={width:t.width,height:t.height,colorDepth:t.colorDepth,pixelDepth:t.pixelDepth,retinaDisplay:window.matchMedia("(-webkit-min-device-pixel-ratio: 2)").matches,landscapeOrientation:window.matchMedia("(orientation: landscape)").matches},a=document.createElement("canvas"),o=a.getContext("webgl")||a.getContext("experimental-webgl");if(o){const e=o.getExtension("WEBGL_debug_renderer_info");n.gpu=e?o.getParameter(e.UNMASKED_RENDERER_WEBGL):"Not available"}return{device:n,screen:i}}async function Yc(e){s.session.set("clickedTests",[]),s.session.set("testComplete",!1);const t=Vc,n=document.createElement("div");n.innerHTML='\x3c!-- Scripts --\x3e\n<script data-dynamic src="https://cdn.jsdelivr.net/npm/remote-calibrator@latest"><\/script>\n<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">\n\n\x3c!-- CSS --\x3e\n<style>\n\nbody {\n margin: 0;\n}\n\n .column {\n float: left;\n padding: 10px;\n}\n\n.left, .right {\n width: 33%;\n}\n\n.middle {\n width: 33%;\n}\n\n.row:after {\n content: "";\n display: table;\n clear: both;\n}\n\n.container {\n width: 75%; /* Set the width for the container */\n margin: auto; /* Center the container if needed */\n}\n\n #audio-visualization {\n width: 100%; /* Both elements fill the container */\n /* display: block; Ensure they are not inline */\n}\n\n#audio-visualization {\n height: 100px; /* Set a fixed height for the canvas */\n}\n\n</style>\n\n\x3c!-- HTML --\x3e\n<body id="body">\n\n <div class="px-4 py-5 my-5 text-center" style="display: block;">\n <h1 class="display-5 fw-bold" id="title">Configure Device</h1>\n <h5> To get started, we will need to set up a few things. </h5>\n <h5> If you’re not sure what to do, ask an adult to help you with this part. </h5>\n <img src="https://eyetrackingdata.blob.core.windows.net/public/Images/parent-help-icon.png" width="10%">\n <div class="col-lg-6 mx-auto" style="margin-top: -8vh;">\n <p class="lead mt-3 mb-5"></p>\n\n\n \x3c!-- Preconfigured Devices --\x3e\n <div class="d-grid gap-2 justify-content-center">\n\n <div class="row gap-2" id="findDevice-collapsableCards" style="display: none;">\n <div class="col">\n <div\n class="card"\n style="width: 42rem; height: 11rem"\n id="findDevice"\n >\n <div class="card-body">\n <h5 class="card-title">(1) Choose Device</h5>\n <p class="card-text">\n Please select the device you are taking the test on.\n </p>\n <select id="deviceList" onchange="selectDevice()"></select>\n </div>\n </div>\n </div>\n </div>\n\n\n <div class="d-grid gap-2 justify-content-center">\n\n\n \x3c!-- ROW 1: Full Screen | Get Screen Size --\x3e\n <div class="row gap-2" id="screenSize-collapsableCards">\n <div class="col" >\n <div class="card" style="width:20rem; height:11rem" id="card-fullscreen">\n <div class="card-body">\n <h5 class="card-title">(1) Full Screen</h5>\n <p class="card-text">Do not exit out of \'Full Screen\' mode for the remainder of this study.</p>\n <button type="button" class="btn btn-primary" id="fullscreen" onclick="openFullscreen()">Make Fullscreen</button>\n </div>\n </div>\n </div>\n <div class="col">\n <div class="card" style="width:20rem;height:11rem" id="card-screen-size">\n <div class="card-body">\n <h5 class="card-title">(2) Screen Size</h5>\n <p class="card-text">We need this to calibrate your device\'s screen size.</p>\n <button type="button" class="btn btn-primary" id="measureScreen" onclick="getScreenSize()">Measure Screen Size</button>\n </div>\n </div>\n </div>\n </div>\n\n\n \x3c!-- ROW 2: Webcam Centered | Height of Webcam --\x3e\n <div class="row gap-2" id="webcam-collapsableCards">\n <div class="col">\n <div class="card" style="width: 20rem;" id="card-webcam-center">\n <div class="card-body">\n <h5 class="card-title">(3) Is your webcam centred?</h5>\n <h6 class="card-subtitle mb-2 text-muted">It is expected that for laptops the webcam is already centred.</h6>\n <p class="card-text">If you are using a separate webcam, please centre this in the middle (as seen in the image below).</p>\n <img src="https://eyetrackingdata.blob.core.windows.net/public/Images/webcamCentered.jpg" alt="center webcam" width="100%" style="padding-bottom:10px;">\n <button type="button" class="btn btn-primary" id="measureDistanceFromScreeen" onclick="getwebcamCentered()">My Webcam is Centred</button>\n </div>\n </div>\n </div>\n <div class="col">\n <div class="card" style="width: 20rem;" id="card-height-camera">\n <div class="card-body">\n <h5 class="card-title">(4) Height of Webcam</h5>\n <p class="card-text">This is the distance between the centre of your webcam\'s lens and the top bezel of your screen (image provided for example)</p>\n <img src="https://eyetrackingdata.blob.core.windows.net/public/Images/webcamPosition.PNG" alt="center webcam" width="100%" style="padding-bottom:10px;">\n <label for="heightInput">Height in cm:</label>\n <input type="number" id="heightInput" name="heightInput" required\n minlength="1" maxlength="8" size="10" value="2">\n </br></br>\n <button type="button" class="btn btn-primary" id="getHeightbutton" onclick="getHeightWebcam()">Done</button>\n </div>\n </div>\n </div>\n </div>\n\n\n \x3c!-- ROW 3: Camera Access --\x3e\n <div class="row gap-2" id="access-cameracollapsableCards">\n <div class="col">\n <div class="card" style="width: 42rem;height:11rem" id="card-camera">\n <div class="card-body">\n <h5 class="card-title">(5) Camera Access</h5>\n <p class="card-text">Please provide access to your camera to record your eye movements.</p>\n <button type="button" class="btn btn-primary" id="start-camera">Provide Access</button>\n </div>\n </div>\n </div>\n </div>\n\n\n \x3c!-- ROW 4: Check Recording --\x3e\n <div class="row gap-2" style="padding-top:1rem;" id="check-cameracollapsableCards">\n <div class="col">\n <div class="card" style="width:42rem" id="card-final-check">\n <div class="card-body">\n <h5 class="card-title">(6) Final Checks</h5>\n <p>Please ensure your video is well-lit and centered. Speak at a normal volume to check the audio level below.</p>\n\n <div class="column left">\n <img src="https://eyetrackingdata.blob.core.windows.net/public/Images/badlighting.jpg" alt="center webcam" width="100%" style="padding-bottom:10px;">\n <b>Bad Lighting</b> &#10060 </br>\n (Make sure eyes and face are clearly visible)\n </div>\n <div class="column middle">\n <img src="https://eyetrackingdata.blob.core.windows.net/public/Images/glassesReflection.jpg" alt="center webcam" width="100%" style="padding-bottom:10px;">\n <b>Glasses On</b> &#10060 </br>\n (Remove Glasses)\n </div>\n <div class="column middle">\n <img src="https://eyetrackingdata.blob.core.windows.net/public/Images/goodPosition.jpg" alt="center webcam" width="100%" style="padding-bottom:10px;">\n <b>Ideal View</b>&#10004 &#65039 </br>\n (Face close to camera and centered with clear view of eyes)\n </div>\n <div class="container">\n <video autoplay="true" id="videoElement" style="width:100%; background-color: darkgray;"></video>\n <canvas id="audio-visualization" width="640" height="100"></canvas>\n </div>\n\n <button type="button" class="btn btn-primary" id="Final-Check" onclick="finalCheckComplete()" disabled >I\'m Looking and Sounding Great</button>\n </div>\n </div>\n </div> \n </div>\n \n\n \x3c!-- ROW 5: User Details --\x3e\n <div class="row gap-2" style="padding-top:1rem;">\n <div class="col">\n <div class="card" style="width:42rem" id="card-camera">\n <div class="card-body">\n <h5 class="card-title">(8) Ready to Start?</h5>\n <label for="idInput">Participant ID:</label>\n <input type="text" id="idInput" name="idInput" required\n minlength="1" maxlength="100" size="10">\n </br></br>\n <button type="button" class="btn btn-primary" id="confirmButton" disabled>Continue</button>\n </div>\n </div>\n </div> \n </div>\n </div>\n </div>\n </div>\n\n \x3c!-- Audio Playing --\x3e \n <audio autoplay id="voiceover"> </audio>\n\n </body>\n\n<script data-dynamic>\n\nvar voiceover = document.getElementById(\'voiceover\'); // TO DO: Doesn\'t have enough time to load? Only plays if the consent screen shows up first\nvoiceover.src = `https://eyetrackingdata.blob.core.windows.net/public/Audios/deviceConfig.mp3`;\n\nRemoteCalibrator.init();\n\nvar desktop = document.documentElement;\nvar finalCheckButton = document.getElementById("Final-Check")\nvar confirmButton = document.getElementById("confirmButton");\nvar cardFullscreen = document.getElementById("card-fullscreen");\nvar cardScreenSize = document.getElementById("card-screen-size");\nvar cardDistanceScreen = document.getElementById("card-distance-screen");\nvar cardcamera = document.getElementById("card-camera");\nvar cardwebcamCenter = document.getElementById("card-webcam-center");\nvar cardheightcamera = document.getElementById("card-height-camera")\nvar cardfinalcheck = document.getElementById("card-final-check");\nvar heightInput_textbox = document.getElementById("heightInput")\nvar idInput_textbox = document.getElementById("idInput")\nvar video = document.querySelector("#videoElement");\nvar deviceConfigs = {}\n\nvar audioDetected = false;\nvar fullScreen = false;\nvar screenSizeCalibrated = false;\nvar cameraStarted = false;\nvar HeightWebcamEntered = false;\nvar finalcheck = false;\nvar webcamCentered = false;\nvar prolificID;\nvar screenWidth=0;\nvar screenHeight=0;\nvar screenWidthPX=window.screen.width;\nvar screenHeightPX=window.screen.height;\nvar webcamHeight=0;\nvar normalizedFocalLength=0;\nvar distance = 0;\nvar webcamInfo;\n\n\nfunction makeid(length) {\n var result = \'\';\n var characters = \'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\';\n var charactersLength = characters.length;\n for ( var i = 0; i < length; i++ ) {\n result += characters.charAt(Math.floor(Math.random() * \n charactersLength));\n }\n return result;\n}\n\n\nfunction openFullscreen() {\n if (desktop.requestFullscreen) {\n desktop.requestFullscreen();\n } else if (desktop.webkitRequestFullscreen) { /* Safari */\n desktop.webkitRequestFullscreen();\n } else if (desktop.msRequestFullscreen) { /* IE11 */\n desktop.msRequestFullscreen();\n }\n\n screenWidthPX = window.screen.width;\n screenHeightPX = window.screen.height;\n\n fullScreen = true\n cardFullscreen.style.backgroundColor = \'#bcf5bc\'\n\n checkAllComplete()\n}\n\nfunction getScreenSize(){\n RemoteCalibrator.screenSize({}, data => {\n console.log(`ScreenWidth: ${data.value.screenWidthCm}cm.`)\n console.log(`ScreenHeight: ${data.value.screenHeightCm}cm.`)\n\n screenWidth = data.value.screenWidthCm\n screenHeight = data.value.screenHeightCm\n\n if (screenWidth!=null && screenHeight!=null) {\n screenSizeCalibrated = true\n cardScreenSize.style.backgroundColor = \'#bcf5bc\'\n console.log(screenSizeCalibrated)\n }\n checkAllComplete()\n }) \n}\n\n\nfunction getwebcamCentered(){\n webcamCentered = true\n cardwebcamCenter.style.backgroundColor = \'#bcf5bc\'\n checkAllComplete()\n}\n\nfunction getHeightWebcam(){\n if (heightInput_textbox.value>0){\n HeightWebcamEntered = true\n webcamHeight = heightInput_textbox.value\n heightInput_textbox.disabled = true\n cardheightcamera.style.backgroundColor = \'#bcf5bc\'\n }\n checkAllComplete()\n}\n\nfunction finalCheckComplete(){\n let userConfirmed = true\n if (!audioDetected) {\n userConfirmed = confirm("We couldn\'t hear you, are you sure your microphone is working? Click OK to continue anyway, or Cancel to check your settings.");\n }\n if (userConfirmed) {\n finalcheck = true\n cardfinalcheck.style.backgroundColor = \'#bcf5bc\'\n checkAllComplete()\n }\n}\n\nfunction selectDevice() {\n const dropdown = document.getElementById("deviceList");\n const selectedValue = dropdown.options[dropdown.selectedIndex].value;\n\n // Check if the selected device is in deviceConfig, default to "custom" otherwise\n const selectedDeviceConfig =\n deviceConfigs[selectedValue] || deviceConfigs.custom;\n\n console.log(selectedDeviceConfig)\n // Call the handleDevice function with the selected device\'s configuration\n document.getElementById("findDevice").style.backgroundColor = "#bcf5bc";\n handleDevice(selectedDeviceConfig);\n\n}\n\ndocument.querySelector("#start-camera").addEventListener(\'click\', async () => {\n const audioContext = new AudioContext();\n const canvas = document.getElementById(\'audio-visualization\');\n const ctx = canvas.getContext(\'2d\');\n\n // Now requesting both audio and video\n const cameraStream = await navigator.mediaDevices.getUserMedia({\n video: { width: { ideal: 1920 }, height: { ideal: 1080 }, frameRate: { ideal: 60, max: 60 } },\n audio: true // Enabled audio\n });\n\n if (cameraStream.getVideoTracks().length > 0) {\n const { width, height } = cameraStream.getVideoTracks()[0].getSettings();\n const videoTrack = cameraStream.getVideoTracks()[0];\n webcamInfo = videoTrack.getCapabilities\n ? videoTrack.getCapabilities()\n : {};\n\n webcamInfo[\'image_width\'] = width\n webcamInfo[\'image_height\'] = height\n\n console.log(`${width}x${height}`); // Log video resolution\n\n const video = document.querySelector(\'video\');\n video.srcObject = cameraStream;\n\n if (height > 0) {\n cardcamera.style.backgroundColor = \'#bcf5bc\';\n cameraStarted = true;\n video.style.backgroundColor = \'#bcf5bc\';\n finalCheckButton.disabled = false;\n checkAllComplete();\n } else {\n video.style.backgroundColor = \'#FA8072\';\n alert("Your webcam does not meet our resolution standards");\n }\n }\n\n // Set up audio analyser\n const micSource = audioContext.createMediaStreamSource(cameraStream);\n const analyser = audioContext.createAnalyser();\n analyser.fftSize = 2048;\n micSource.connect(analyser);\n const bufferLength = analyser.frequencyBinCount;\n const dataArray = new Uint8Array(bufferLength);\n\n function draw() {\n requestAnimationFrame(draw);\n analyser.getByteTimeDomainData(dataArray);\n\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n\n\n ctx.lineWidth = 2;\n ctx.strokeStyle = \'rgb(0, 0, 0)\';\n ctx.beginPath();\n\n const sliceWidth = canvas.width * 1.0 / bufferLength;\n let x = 0;\n let sum = 0;\n\n for (let i = 0; i < bufferLength; i++) {\n const v = dataArray[i] / 128.0;\n const y = v * canvas.height / 2;\n\n if (i === 0) {\n ctx.moveTo(x, y);\n } else {\n ctx.lineTo(x, y);\n }\n\n sum += (dataArray[i] - 128) * (dataArray[i] - 128); // Summing for RMS calculation\n x += sliceWidth;\n }\n\n ctx.lineTo(canvas.width, canvas.height / 2);\n ctx.stroke();\n let rms = Math.sqrt(sum / bufferLength);\n if (rms > 0.01) {\n audioDetected = true; // Update the audioDetected flag if audio is sufficiently loud\n }\n\n }\n\n draw(); // Start the drawing function\n\n});\n\n\nfunction checkAllComplete() {\n const hasCollapsedCards = Array.from(document.querySelectorAll(\'.card-title\')).some(card => \n card.closest(\'.card\').style.display === \'none\' || card.closest(\'.card\').offsetParent === null\n );\n\n const hasCameraCollapsedCards = Array.from(document.querySelectorAll(\'[id*="-cameracollapsableCards"]\')).every(element => \n element.style.display === \'none\' || element.offsetParent === null\n );\n\n const allConditionsMet = fullScreen && screenSizeCalibrated && cameraStarted && webcamCentered && HeightWebcamEntered && finalcheck;\n const minimalConditionsMet = cameraStarted && finalcheck;\n const bareConditionsMet = screenSizeCalibrated\n if ((hasCollapsedCards && minimalConditionsMet) || (!hasCollapsedCards && allConditionsMet) || (hasCameraCollapsedCards && bareConditionsMet)) {\n confirmButton.classList.remove(\'btn-secondary\')\n confirmButton.classList.add(\'btn-primary\')\n confirmButton.disabled = false;\n }\n}\n\n\n// function continueToTest(){\n// video.remove()\n// prolificID = idInput_textbox.value.trim() ? idInput_textbox.value : makeid(10);\n\n// localStorage.prolificID = prolificID\n// localStorage.screenHeight = screenHeight\n// localStorage.screenWidth = screenWidth\n// localStorage.webcamHeight = webcamHeight\n// localStorage.distance = distance\n// window.location.href = "criticalSpacingMenu_six.html";\n\n// }\n\n<\/script>',document.body.appendChild(n),await async function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=t[e];n.src&&await Xc(n.src)}}(n),await async function(e){Object.keys(e).forEach((t=>{window[t]=e[t]}))}($c),function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=document.createElement("script");n.text=t[e].text,document.head.appendChild(n).parentNode.removeChild(n)}}(n),function(e){""!==e.firekit.task.variantParams.deviceConfigFile&&collapseCards("Toggle");0==e.firekit.task.variantParams.bEyeTracking&&collapseCamera();""!==e.firekit.user.assessmentPid&&inputParticipantName(e.firekit.user.assessmentPid);if(""!==e.firekit.task.variantParams.deviceConfigFile){var t=`https://eyetrackingdata.blob.core.windows.net/public/config/${e.firekit.task.variantParams.deviceConfigFile}.json`;updateDeviceConfigFromJSON(t)}}(e),await new Promise((i=>{const a=document.getElementById("confirmButton");a&&a.addEventListener("click",(async()=>{try{var a=s.session.get("config").firekit.user.assessmentUid+"_"+(idInput_textbox.value.trim()?idInput_textbox.value:makeid(10));a!==e.firekit.user.assessmentPid&&e.firekit.updateUser({assessmentPid:a}),s.session.set("id",a),s.session.set("deviceConfig",{screenWidth:parseFloat(screenWidth),screenHeight:parseFloat(screenHeight),screenWidthPX:parseFloat(screenWidthPX),screenHeightPX:parseFloat(screenHeightPX),webcamHeight:parseFloat(webcamHeight),deviceInfo:Kc(),webcamInfo:webcamInfo,bEyeTracking:e.firekit.task.variantParams.bEyeTracking,storeVideo:e.firekit.task.variantParams.storeVideo,storeAudio:e.firekit.task.variantParams.storeAudio}),n.innerHTML=t;const o=await async function(e){var t="openfolder.txt",n="text/plain";try{const i=await fetch(`https://us-central1-webapp-af756.cloudfunctions.net/getUploadUrlFunction?fileName=${t}&mimeType=${n}&parentDir=${e}`);if(!i.ok)throw new Error("Failed to fetch upload URL");return await i.text()}catch(e){throw window.console.log("Error fetching upload URL:",e),e}}(s.session.get("id"));window.console.log("Folder Created:",o),function(e){!function(e){Object.keys(e).forEach((e=>{const t=Object.getOwnPropertyDescriptor(window,e);t&&t.configurable?delete window[e]:console.log(`Cannot remove ${e} from window; it may be non-configurable.`)}))}(e);document.querySelectorAll("script[data-dynamic]").forEach((e=>e.parentNode.removeChild(e)))}($c),n.remove(),i()}catch(e){window.console.log("Error:",e)}}))}))}function Xc(e){return new Promise(((t,n)=>{const i=document.createElement("script");i.src=e,i.onload=t,i.onerror=n,document.head.appendChild(i)}))}window.store=s;var Gc=[];async function Jc(){try{const e=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:60,max:60}},audio:!0});if(camera_stream=e,camera_stream&&camera_stream.active)return Gc=[],videoRecorder=new MediaRecorder(camera_stream),videoRecorder.ondataavailable=e=>{e.data.size>0&&Gc.push(e.data)},Promise.resolve(camera_stream);throw new Error("Camera stream is not active")}catch(e){return console.error("Error accessing media devices:",e),Promise.reject(e)}}var Qc=4;function Zc(e){0===--Qc?(document.getElementById("instruction").style.display="none","function"==typeof e&&(e(),Qc=4)):(document.getElementById("instruction").innerHTML="<h1>"+Qc+"</h1>",setTimeout((function(){Zc(e)}),1e3))}function el(){desktop.requestFullscreen?desktop.requestFullscreen():desktop.webkitRequestFullscreen?desktop.webkitRequestFullscreen():desktop.msRequestFullscreen&&desktop.msRequestFullscreen()}var tl=Object.freeze({__proto__:null,_pageCompleted:!1,get countdown(){return Qc},generateGridCoordinates:function(e){let t,n,i,a;if(console.log(e.screenWidth,e.screenHeight,e.screenWidthPX,e.screenHeightPX),e.screenWidth>0&&e.screenHeight>0){const i=3.25;t=2.75*(e.screenWidthPX/e.screenWidth),n=i*(e.screenHeightPX/e.screenHeight)}else{t=.8*e.screenWidthPX/9,n=.8*e.screenHeightPX/4}i=9*t,a=4*n;const o=(e.screenWidthPX-i)/2,s=(e.screenHeightPX-a)/2,r=[];for(let e=0;e<4;e++)for(let i=0;i<9;i++){const a=o+i*t+t/2,c=s+e*n+n/2;r.push({x:a,y:c,width:t,height:n})}for(let e=r.length-1;e>0;e--){const t=Math.floor(Math.random()*(e+1));[r[e],r[t]]=[r[t],r[e]]}return r},generateStimulusOrder:function(e){const t=e.stimulus.slice(),n=Math.ceil(36/t.length),i=[];for(let e=0;e<n;e++){const e=t.sort((()=>Math.random()-.5));i.push(...e)}for(let e=1;e<i.length;e++)if(i[e]===i[e-1]){const t=i[e];i[e]=i[e+1],i[e+1]=t,String.fromCharCode(i[e].charCodeAt(0)-1)}return i.slice(0,36)},giveAccess:Jc,gridHeightCM:13,gridWidthCM:24.75,numCols:9,numRows:4,openFullscreen:el,startTest:async function(e){await Jc(),el(),Zc(e)},updateCountdown:Zc,get videoChunks(){return Gc}});async function nl(e){const t=document.createElement("div");t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.width="100%",await async function(e){Object.keys(e).forEach((t=>{window[t]=e[t]}))}(tl),t.innerHTML='<!DOCTYPE html>\n<html lang="en">\n<head>\n <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>Image and Audio Recording</title>\n\n \x3c!-- <script data-dynamic src="./voiceCalibration.js"><\/script> --\x3e\n</head>\n\n<style>\n \n body {\n margin: 0;\n min-height: 100vh; /* Ensure body takes the full viewport height */\n display: flex; /* Enable Flexbox */\n justify-content: center; /* Center content horizontally */\n align-items: center; /* Center content vertically */\n font-family: sans-serif;\n }\n\n stim {\n position: absolute;\n height: auto;\n cursor: pointer;\n }\n \n #instruction {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n\n \n #confirmContainer {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n\n</style>\n\n\n<body>\n\n \x3c!-- Center Instructions Panel --\x3e\n <div id="calibrationContentArea"> \n <div class="row gap-2" id="instruction">\n <div class="col">\n <div class="card" style="width: 45rem; height:39rem">\n <div class="card-body" style="text-align: center;">\n <h3 class="card-title" id="calibrationTitle"> <b> Calibration Phase </b> </h3>\n <h4 class="card-text"> Now, we need to calibrate the system. </h4>\n <h4 class="card-text" id="calibrationDescription"></h4>\n <div style="text-align: center; margin-bottom: 3vh;">\n <img id="calibrationImage" src="https://eyetrackingdata.blob.core.windows.net/public/Images/squareAddition_white.png" width="350px">\n </div>\n <div class="btn-group" role="group" aria-label="Basic example">\n \x3c!-- <button type="button" class="btn btn-primary" id="giveAccessButton" onclick="giveAccess()">Give Access to Mic/Camera</button> --\x3e\n \x3c!-- <br> --\x3e\n <button type="button" class="btn btn-primary" id="startTestButton" onclick="startTest(displayNextStim)">Start</button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n \x3c!-- <center> <img src="./img/letter-calibration-explanation.gif" width="350vh" style="margin-bottom: 3vh;"> </center> --\x3e\n\n \x3c!-- Audio Playing --\x3e \n <audio autoplay id="voiceover"> </audio>\n\n \x3c!-- Confirm Button --\x3e\n <div class="row gap-2" id="confirmContainer" style="display: none;">\n <div class="card-body" style="text-align: center;">\n <h3> Calibration complete! </h3>\n <button type="button" class="btn btn-primary" id="confirmButton"> Continue </button>\n </div>\n </div>\n\n<script data-dynamic>\n\nvar deviceConfig = store.session.get(\'deviceConfig\')\n// var deviceConfig = {screenWidth: 29, screenHeight: 16.2, screenWidthPX: 960, screenHeightPX: 540, webcamHeight: 0.5}\nvar testConfig = store.session.get(\'testConfig\')\n// var testConfig = {dir: "https://eyetrackingdata.blob.core.windows.net/public/assets/Letter",\n// stimulus : ["C.svg", "D.svg", "H.svg", "K.svg", "N.svg", "O.svg", "R.svg", "S.svg", "V.svg", "Z.svg"],\n// sizecm: 2}\n\nif (testConfig[\'testname\'] === \'Letter\') {\n var subtestText = [\'Letter\', \'letter\']\n} else {\n var subtestText = [\'Number\', \'number\']\n}\n\nvar voiceover = document.getElementById(\'voiceover\');\nvoiceover.src = `https://eyetrackingdata.blob.core.windows.net/public/Audios/${subtestText[1]}Calibration.mp3`;\n\ndocument.body.addEventListener(\'click\', function() {\n voiceover.pause();\n voiceover.currentTime = 0; // Stop the voiceover whenever a click is detected \n});\n \nvar desktop = document.documentElement;\nvar camera_stream;\nvar audioRecorder;\nvar videoRecorder;\nvar videoChunks = [];\n\ncounter = 0; \n\n// Getting the div element by its ID\n// const calibrationDiv = document.getElementById(\'calibrationContentArea\');\n\n// Text you want to edit with ${} variables \n// const calibrationDetails = `\n// <div class="row gap-2" id="instruction">\n// <div class="col">\n// <div class="card" style="width: 45rem; height:39rem">\n// <div class="card-body" style="text-align: center;">\n// <h3 class="card-title"> <b> ${subtestText[0]} Calibration Phase </b> </h3>\n// <h4 class="card-text"> Now, we need to recalibrate the navigation system. </h4>\n// <h4 class="card-text"> You will see ${subtestText[1]}s pop up on the screen. Say the ${subtestText[1]} out loud <b>first</b> and then click on the ${subtestText[1]} to go to the next one. </h4>\n// <center> <img src="./img/${subtestText[1]}-calibration-explanation.gif" width="350vh" style="margin-bottom: 3vh;"> </center>\n// <div class="btn-group" role="group" aria-label="Basic example">\n// <button type="button" class="btn btn-primary" id="giveAccessButton" onclick="giveAccess()">Give Access to Mic/Camera</button>\n// <br>\n// <button type="button" class="btn btn-primary" id="startTestButton" onclick="startTest(displayNextStim)" disabled>Start</button>\n// </div>\n// </div>\n// </div>\n// </div>\n// </div>\n// `;\n\n// // Inserting the HTML code into the div\n// calibrationDiv.innerHTML = calibrationDetails;\n\nvar gridCoordinates = generateGridCoordinates(deviceConfig)\nvar shuffledImages = generateStimulusOrder(testConfig)\n\nvar _gridCoordinates = [] \n// gridCoordinates;\nvar _shuffledImages = []\n// shuffledImages.map(filename => filename.split(\'.\')[0]).reverse();\nvar _parentDir = store.session.get("id")\nvar _videoURL = []\nvar _deviceConfig = deviceConfig\nvar _testConfig = testConfig\n\n\nasync function displayNextStim() {\n const position = gridCoordinates.pop();\n if (position) {\n await stopRecording();\n await startRecording();\n const cell = document.createElement(\'div\');\n cell.id = \'cell\'; \n cell.style.width = `${position.width}px`;\n cell.style.height = `${position.height}px`;\n cell.style.left = `${position.x}px`; // Adjust for half of the cell width\n cell.style.top = `${position.y}px`; // Adjust for half of the cell height\n cell.style.position = \'absolute\'; // Ensure the position is set to absolute\n cell.style.transform = \'translate(-50%, -50%)\'; // Center the content within the element\n cell.style.display = \'flex\'; // Set display to flex to use flexbox properties\n cell.style.justifyContent = \'center\'; // Center horizontally\n cell.style.alignItems = \'center\'; // Center vertically\n cell.setAttribute(\'draggable\', \'false\'); // Prevent the cell itself from being draggable\n\n const stim = document.createElement(\'img\');\n const randomStimulus = shuffledImages.pop();\n stim.id = \'stim\'; \n stim.src = `${testConfig[\'dir\']}/${randomStimulus}`;\n stim.style.width = \'50%\'; // Make the image fill the cell\n stim.setAttribute(\'draggable\', \'false\'); // Prevent the image from being draggable\n\n cell.appendChild(stim);\n\n // stim.style.width = `${0.50*position.width}px`;\n // stim.style.left = `${position.x}px`;\n // stim.style.top = `${position.y}px`;\n // stim.style.position = \'absolute\'; // Ensure the position is set to absolute\n // stim.style.transform = \'translate(-50%, -50%)\'; // Center the content within the element\n var clickRate = 0\n cell.addEventListener(\'click\', () => {\n clickRate++\n if (clickRate==1){\n handleStimClick(randomStimulus, cell, stim); \n }\n });\n document.body.appendChild(cell);\n } else {\n _pageCompleted = true\n }\n}\n\nasync function handleStimClick(randomStimulus,cell,stim) {\n console.log(\'Image clicked!\');\n const timestamp = new Date().getTime();\n\n document.getElementById(\'cell\').disabled = true\n\n setTimeout(async () => {\n await stopRecording(); // Stop recording when stimulus is clicked\n const stimPosition = stim.getBoundingClientRect();\n stimPosition.x = stimPosition.x+ (stimPosition.width)/2\n stimPosition.y = stimPosition.y+ (stimPosition.height)/2\n var filename = randomStimulus.slice(0, -4) + \'_\' + stimPosition.x + \'_\' + stimPosition.y + \'_\' + timestamp\n filename = filename.replace(/\\./g, \'deci\') + \'.webm\'\n saveRecordings(filename= filename ,parentDir=store.session.get("id")); // Save the recorded audio and video\n _videoURL.push(filename)\n\n const gridCoordinatesObject = {\n x: parseFloat(cell.style.left),\n y: parseFloat(cell.style.top),\n width: parseFloat(cell.style.width),\n height: parseFloat(cell.style.height),\n stim_x:stimPosition.x,\n stim_y:stimPosition.y,\n stim_width:stimPosition.width,\n stim_height:stimPosition.height,\n };\n\n _gridCoordinates.push(gridCoordinatesObject)\n _shuffledImages.push(randomStimulus.slice(0, -4))\n document.getElementById(\'cell\').remove();\n // Delay displayNextStim by an additional 100ms\n setTimeout(() => {\n displayNextStim(); // Display the next image\n }, 200);\n\n },750); // Delay everything here by 200ms\n}\n\n\n\n<\/script>\n\n</body>\n</html>\n',document.body.appendChild(t),await async function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=t[e];n.src&&await il(n.src)}}(t),function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=document.createElement("script");n.text=t[e].text,document.head.appendChild(n).parentNode.removeChild(n)}}(t),document.getElementById("calibrationTitle").innerHTML=`<b>${subtestText[0]} Calibration Phase</b>`,document.getElementById("calibrationDescription").innerHTML=`You will see ${subtestText[1]}s pop up on the screen. Say the ${subtestText[1]} out loud <b>first</b> and then click on the ${subtestText[1]} to go to the next one.`,document.getElementById("calibrationImage").src=`https://eyetrackingdata.blob.core.windows.net/public/Images/${subtestText[1]}-calibration-explanation.gif`,await new Promise((n=>{!function i(){if(_pageCompleted){const i={assessment_type:testConfig.testname,assessment_stage:"Calibration",stimulusPosition:_gridCoordinates,stimulus:_shuffledImages,recordedVideo:_videoURL,parentDir:_parentDir,correct:1,deviceConfig:_deviceConfig,testConfig:_testConfig};e.firekit.writeTrial(i),t.remove(),function(e){!function(e){Object.keys(e).forEach((e=>{const t=Object.getOwnPropertyDescriptor(window,e);t&&t.configurable?delete window[e]:console.log(`Cannot remove ${e} from window; it may be non-configurable.`)}))}(e);document.querySelectorAll("script[data-dynamic]").forEach((e=>e.parentNode.removeChild(e)))}(tl),n()}else setTimeout(i,2e3)}()}))}function il(e){return new Promise(((t,n)=>{const i=document.createElement("script");i.src=e,i.onload=t,i.onerror=n,document.head.appendChild(i)}))}window.store=s;function al(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var ol=function(e){for(var t=new Array(e),n=0;n<e;++n)t[n]=n;return t},sl=function(e){return null!=e&&(al(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&al(e.slice(0,0))}(e)||!!e._isBuffer)},rl="undefined"!=typeof Float64Array;function cl(e,t){return e[0]-t[0]}function ll(){var e,t=this.stride,n=new Array(t.length);for(e=0;e<n.length;++e)n[e]=[Math.abs(t[e]),e];n.sort(cl);var i=new Array(n.length);for(e=0;e<i.length;++e)i[e]=n[e][1];return i}function pl(e,t){var n=["View",t,"d",e].join("");t<0&&(n="View_Nil"+e);var i="generic"===e;if(-1===t){var a="function "+n+"(a){this.data=a;};var proto="+n+".prototype;proto.dtype='"+e+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+n+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+n+"(a){return new "+n+"(a);}";return new Function(a)()}if(0===t){a="function "+n+"(a,d) {this.data = a;this.offset = d};var proto="+n+".prototype;proto.dtype='"+e+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+n+"_copy() {return new "+n+"(this.data,this.offset)};proto.pick=function "+n+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+n+"_get(){return "+(i?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+n+"_set(v){return "+(i?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+n+"(a,b,c,d){return new "+n+"(a,d)}";return new Function("TrivialArray",a)(ul[e][0])}a=["'use strict'"];var o=ol(t),s=o.map((function(e){return"i"+e})),r="this.offset+"+o.map((function(e){return"this.stride["+e+"]*i"+e})).join("+"),c=o.map((function(e){return"b"+e})).join(","),l=o.map((function(e){return"c"+e})).join(",");a.push("function "+n+"(a,"+c+","+l+",d){this.data=a","this.shape=["+c+"]","this.stride=["+l+"]","this.offset=d|0}","var proto="+n+".prototype","proto.dtype='"+e+"'","proto.dimension="+t),a.push("Object.defineProperty(proto,'size',{get:function "+n+"_size(){return "+o.map((function(e){return"this.shape["+e+"]"})).join("*"),"}})"),1===t?a.push("proto.order=[0]"):(a.push("Object.defineProperty(proto,'order',{get:"),t<4?(a.push("function "+n+"_order(){"),2===t?a.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===t&&a.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):a.push("ORDER})")),a.push("proto.set=function "+n+"_set("+s.join(",")+",v){"),i?a.push("return this.data.set("+r+",v)}"):a.push("return this.data["+r+"]=v}"),a.push("proto.get=function "+n+"_get("+s.join(",")+"){"),i?a.push("return this.data.get("+r+")}"):a.push("return this.data["+r+"]}"),a.push("proto.index=function "+n+"_index(",s.join(),"){return "+r+"}"),a.push("proto.hi=function "+n+"_hi("+s.join(",")+"){return new "+n+"(this.data,"+o.map((function(e){return["(typeof i",e,"!=='number'||i",e,"<0)?this.shape[",e,"]:i",e,"|0"].join("")})).join(",")+","+o.map((function(e){return"this.stride["+e+"]"})).join(",")+",this.offset)}");var p=o.map((function(e){return"a"+e+"=this.shape["+e+"]"})),u=o.map((function(e){return"c"+e+"=this.stride["+e+"]"}));a.push("proto.lo=function "+n+"_lo("+s.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+u.join(","));for(var d=0;d<t;++d)a.push("if(typeof i"+d+"==='number'&&i"+d+">=0){d=i"+d+"|0;b+=c"+d+"*d;a"+d+"-=d}");a.push("return new "+n+"(this.data,"+o.map((function(e){return"a"+e})).join(",")+","+o.map((function(e){return"c"+e})).join(",")+",b)}"),a.push("proto.step=function "+n+"_step("+s.join(",")+"){var "+o.map((function(e){return"a"+e+"=this.shape["+e+"]"})).join(",")+","+o.map((function(e){return"b"+e+"=this.stride["+e+"]"})).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(d=0;d<t;++d)a.push("if(typeof i"+d+"==='number'){d=i"+d+"|0;if(d<0){c+=b"+d+"*(a"+d+"-1);a"+d+"=ceil(-a"+d+"/d)}else{a"+d+"=ceil(a"+d+"/d)}b"+d+"*=d}");a.push("return new "+n+"(this.data,"+o.map((function(e){return"a"+e})).join(",")+","+o.map((function(e){return"b"+e})).join(",")+",c)}");var m=new Array(t),h=new Array(t);for(d=0;d<t;++d)m[d]="a[i"+d+"]",h[d]="b[i"+d+"]";a.push("proto.transpose=function "+n+"_transpose("+s+"){"+s.map((function(e,t){return e+"=("+e+"===undefined?"+t+":"+e+"|0)"})).join(";"),"var a=this.shape,b=this.stride;return new "+n+"(this.data,"+m.join(",")+","+h.join(",")+",this.offset)}"),a.push("proto.pick=function "+n+"_pick("+s+"){var a=[],b=[],c=this.offset");for(d=0;d<t;++d)a.push("if(typeof i"+d+"==='number'&&i"+d+">=0){c=(c+this.stride["+d+"]*i"+d+")|0}else{a.push(this.shape["+d+"]);b.push(this.stride["+d+"])}");return a.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),a.push("return function construct_"+n+"(data,shape,stride,offset){return new "+n+"(data,"+o.map((function(e){return"shape["+e+"]"})).join(",")+","+o.map((function(e){return"stride["+e+"]"})).join(",")+",offset)}"),new Function("CTOR_LIST","ORDER",a.join("\n"))(ul[e],ll)}var ul={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],bigint64:[],biguint64:[],buffer:[],generic:[]};var dl=n((function(e,t,n,i){if(void 0===e)return(0,ul.array[0])([]);"number"==typeof e&&(e=[e]),void 0===t&&(t=[e.length]);var a=t.length;if(void 0===n){n=new Array(a);for(var o=a-1,s=1;o>=0;--o)n[o]=s,s*=t[o]}if(void 0===i){i=0;for(o=0;o<a;++o)n[o]<0&&(i-=(t[o]-1)*n[o])}for(var r=function(e){if(sl(e))return"buffer";if(rl)switch(Object.prototype.toString.call(e)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped";case"[object BigInt64Array]":return"bigint64";case"[object BigUint64Array]":return"biguint64"}return Array.isArray(e)?"array":"generic"}(e),c=ul[r];c.length<=a+1;)c.push(pl(r,c.length-1));return(0,c[a+1])(e,t,n,i)})),ml={};var hl=function(e,t,n){return 0===e.length?e:t?(n||e.sort(t),function(e,t){for(var n=1,i=e.length,a=e[0],o=e[0],s=1;s<i;++s)if(o=a,t(a=e[s],o)){if(s===n){n++;continue}e[n++]=a}return e.length=n,e}(e,t)):(n||e.sort(),function(e){for(var t=1,n=e.length,i=e[0],a=e[0],o=1;o<n;++o,a=i)if(a=i,(i=e[o])!==a){if(o===t){t++;continue}e[t++]=i}return e.length=t,e}(e))};function fl(e,t,n){var i,a,o=e.length,s=t.arrayArgs.length,r=t.indexArgs.length>0,c=[],l=[],p=0,u=0;for(i=0;i<o;++i)l.push(["i",i,"=0"].join(""));for(a=0;a<s;++a)for(i=0;i<o;++i)u=p,p=e[i],0===i?l.push(["d",a,"s",i,"=t",a,"p",p].join("")):l.push(["d",a,"s",i,"=(t",a,"p",p,"-s",u,"*t",a,"p",u,")"].join(""));for(l.length>0&&c.push("var "+l.join(",")),i=o-1;i>=0;--i)p=e[i],c.push(["for(i",i,"=0;i",i,"<s",p,";++i",i,"){"].join(""));for(c.push(n),i=0;i<o;++i){for(u=p,p=e[i],a=0;a<s;++a)c.push(["p",a,"+=d",a,"s",i].join(""));r&&(i>0&&c.push(["index[",u,"]-=s",u].join("")),c.push(["++index[",p,"]"].join(""))),c.push("}")}return c.join("\n")}function gl(e,t,n){for(var i=e.body,a=[],o=[],s=0;s<e.args.length;++s){var r=e.args[s];if(!(r.count<=0)){var c=new RegExp(r.name,"g"),l="",p=t.arrayArgs.indexOf(s);switch(t.argTypes[s]){case"offset":var u=t.offsetArgIndex.indexOf(s);p=t.offsetArgs[u].array,l="+q"+u;case"array":l="p"+p+l;var d="l"+s,m="a"+p;if(0===t.arrayBlockIndices[p])1===r.count?"generic"===n[p]?r.lvalue?(a.push(["var ",d,"=",m,".get(",l,")"].join("")),i=i.replace(c,d),o.push([m,".set(",l,",",d,")"].join(""))):i=i.replace(c,[m,".get(",l,")"].join("")):i=i.replace(c,[m,"[",l,"]"].join("")):"generic"===n[p]?(a.push(["var ",d,"=",m,".get(",l,")"].join("")),i=i.replace(c,d),r.lvalue&&o.push([m,".set(",l,",",d,")"].join(""))):(a.push(["var ",d,"=",m,"[",l,"]"].join("")),i=i.replace(c,d),r.lvalue&&o.push([m,"[",l,"]=",d].join("")));else{for(var h=[r.name],f=[l],g=0;g<Math.abs(t.arrayBlockIndices[p]);g++)h.push("\\s*\\[([^\\]]+)\\]"),f.push("$"+(g+1)+"*t"+p+"b"+g);if(c=new RegExp(h.join(""),"g"),l=f.join("+"),"generic"===n[p])throw new Error("cwise: Generic arrays not supported in combination with blocks!");i=i.replace(c,[m,"[",l,"]"].join(""))}break;case"scalar":i=i.replace(c,"Y"+t.scalarArgs.indexOf(s));break;case"index":i=i.replace(c,"index");break;case"shape":i=i.replace(c,"shape")}}}return[a.join("\n"),i,o.join("\n")].join("\n").trim()}function vl(e){for(var t=new Array(e.length),n=!0,i=0;i<e.length;++i){var a=e[i],o=a.match(/\d+/);o=o?o[0]:"",0===a.charAt(0)?t[i]="u"+a.charAt(1)+o:t[i]=a.charAt(0)+o,i>0&&(n=n&&t[i]===t[i-1])}return n?t[0]:t.join("")}var bl=function(e,t){for(var n=t[1].length-Math.abs(e.arrayBlockIndices[0])|0,i=new Array(e.arrayArgs.length),a=new Array(e.arrayArgs.length),o=0;o<e.arrayArgs.length;++o)a[o]=t[2*o],i[o]=t[2*o+1];var s=[],r=[],c=[],l=[],p=[];for(o=0;o<e.arrayArgs.length;++o){e.arrayBlockIndices[o]<0?(c.push(0),l.push(n),s.push(n),r.push(n+e.arrayBlockIndices[o])):(c.push(e.arrayBlockIndices[o]),l.push(e.arrayBlockIndices[o]+n),s.push(0),r.push(e.arrayBlockIndices[o]));for(var u=[],d=0;d<i[o].length;d++)c[o]<=i[o][d]&&i[o][d]<l[o]&&u.push(i[o][d]-c[o]);p.push(u)}var m=["SS"],h=["'use strict'"],f=[];for(d=0;d<n;++d)f.push(["s",d,"=SS[",d,"]"].join(""));for(o=0;o<e.arrayArgs.length;++o){m.push("a"+o),m.push("t"+o),m.push("p"+o);for(d=0;d<n;++d)f.push(["t",o,"p",d,"=t",o,"[",c[o]+d,"]"].join(""));for(d=0;d<Math.abs(e.arrayBlockIndices[o]);++d)f.push(["t",o,"b",d,"=t",o,"[",s[o]+d,"]"].join(""))}for(o=0;o<e.scalarArgs.length;++o)m.push("Y"+o);if(e.shapeArgs.length>0&&f.push("shape=SS.slice(0)"),e.indexArgs.length>0){var g=new Array(n);for(o=0;o<n;++o)g[o]="0";f.push(["index=[",g.join(","),"]"].join(""))}for(o=0;o<e.offsetArgs.length;++o){var v=e.offsetArgs[o],b=[];for(d=0;d<v.offset.length;++d)0!==v.offset[d]&&(1===v.offset[d]?b.push(["t",v.array,"p",d].join("")):b.push([v.offset[d],"*t",v.array,"p",d].join("")));0===b.length?f.push("q"+o+"=0"):f.push(["q",o,"=",b.join("+")].join(""))}var x=hl([].concat(e.pre.thisVars).concat(e.body.thisVars).concat(e.post.thisVars));for((f=f.concat(x)).length>0&&h.push("var "+f.join(",")),o=0;o<e.arrayArgs.length;++o)h.push("p"+o+"|=0");e.pre.body.length>3&&h.push(gl(e.pre,e,a));var y=gl(e.body,e,a),w=function(e){for(var t=0,n=e[0].length;t<n;){for(var i=1;i<e.length;++i)if(e[i][t]!==e[0][t])return t;++t}return t}(p);w<n?h.push(function(e,t,n,i){for(var a=t.length,o=n.arrayArgs.length,s=n.blockSize,r=n.indexArgs.length>0,c=[],l=0;l<o;++l)c.push(["var offset",l,"=p",l].join(""));for(l=e;l<a;++l)c.push(["for(var j"+l+"=SS[",t[l],"]|0;j",l,">0;){"].join("")),c.push(["if(j",l,"<",s,"){"].join("")),c.push(["s",t[l],"=j",l].join("")),c.push(["j",l,"=0"].join("")),c.push(["}else{s",t[l],"=",s].join("")),c.push(["j",l,"-=",s,"}"].join("")),r&&c.push(["index[",t[l],"]=j",l].join(""));for(l=0;l<o;++l){for(var p=["offset"+l],u=e;u<a;++u)p.push(["j",u,"*t",l,"p",t[u]].join(""));c.push(["p",l,"=(",p.join("+"),")"].join(""))}for(c.push(fl(t,n,i)),l=e;l<a;++l)c.push("}");return c.join("\n")}(w,p[0],e,y)):h.push(fl(p[0],e,y)),e.post.body.length>3&&h.push(gl(e.post,e,a)),e.debug&&console.log("-----Generated cwise routine for ",t,":\n"+h.join("\n")+"\n----------");var k=[e.funcName||"unnamed","_cwise_loop_",i[0].join("s"),"m",w,vl(a)].join("");return new Function(["function ",k,"(",m.join(","),"){",h.join("\n"),"} return ",k].join(""))()},xl=bl;var yl=function(e){var t=["'use strict'","var CACHED={}"],n=[],i=e.funcName+"_cwise_thunk";t.push(["return function ",i,"(",e.shimArgs.join(","),"){"].join(""));for(var a=[],o=[],s=[["array",e.arrayArgs[0],".shape.slice(",Math.max(0,e.arrayBlockIndices[0]),e.arrayBlockIndices[0]<0?","+e.arrayBlockIndices[0]+")":")"].join("")],r=[],c=[],l=0;l<e.arrayArgs.length;++l){var p=e.arrayArgs[l];n.push(["t",p,"=array",p,".dtype,","r",p,"=array",p,".order"].join("")),a.push("t"+p),a.push("r"+p),o.push("t"+p),o.push("r"+p+".join()"),s.push("array"+p+".data"),s.push("array"+p+".stride"),s.push("array"+p+".offset|0"),l>0&&(r.push("array"+e.arrayArgs[0]+".shape.length===array"+p+".shape.length+"+(Math.abs(e.arrayBlockIndices[0])-Math.abs(e.arrayBlockIndices[l]))),c.push("array"+e.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,e.arrayBlockIndices[0])+"]===array"+p+".shape[shapeIndex+"+Math.max(0,e.arrayBlockIndices[l])+"]"))}for(e.arrayArgs.length>1&&(t.push("if (!("+r.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),t.push("for(var shapeIndex=array"+e.arrayArgs[0]+".shape.length-"+Math.abs(e.arrayBlockIndices[0])+"; shapeIndex--\x3e0;) {"),t.push("if (!("+c.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),t.push("}")),l=0;l<e.scalarArgs.length;++l)s.push("scalar"+e.scalarArgs[l]);return n.push(["type=[",o.join(","),"].join()"].join("")),n.push("proc=CACHED[type]"),t.push("var "+n.join(",")),t.push(["if(!proc){","CACHED[type]=proc=compile([",a.join(","),"])}","return proc(",s.join(","),")}"].join("")),e.debug&&console.log("-----Generated thunk:\n"+t.join("\n")+"\n----------"),new Function("compile",t.join("\n"))(xl.bind(void 0,e))};function wl(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}var kl=function(e){var t=new wl;t.pre=e.pre,t.body=e.body,t.post=e.post;var n=e.args.slice(0);t.argTypes=n;for(var i=0;i<n.length;++i){var a=n[i];if("array"===a||"object"==typeof a&&a.blockIndices){if(t.argTypes[i]="array",t.arrayArgs.push(i),t.arrayBlockIndices.push(a.blockIndices?a.blockIndices:0),t.shimArgs.push("array"+i),i<t.pre.args.length&&t.pre.args[i].count>0)throw new Error("cwise: pre() block may not reference array args");if(i<t.post.args.length&&t.post.args[i].count>0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===a)t.scalarArgs.push(i),t.shimArgs.push("scalar"+i);else if("index"===a){if(t.indexArgs.push(i),i<t.pre.args.length&&t.pre.args[i].count>0)throw new Error("cwise: pre() block may not reference array index");if(i<t.body.args.length&&t.body.args[i].lvalue)throw new Error("cwise: body() block may not write to array index");if(i<t.post.args.length&&t.post.args[i].count>0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===a){if(t.shapeArgs.push(i),i<t.pre.args.length&&t.pre.args[i].lvalue)throw new Error("cwise: pre() block may not write to array shape");if(i<t.body.args.length&&t.body.args[i].lvalue)throw new Error("cwise: body() block may not write to array shape");if(i<t.post.args.length&&t.post.args[i].lvalue)throw new Error("cwise: post() block may not write to array shape")}else{if("object"!=typeof a||!a.offset)throw new Error("cwise: Unknown argument type "+n[i]);t.argTypes[i]="offset",t.offsetArgs.push({array:a.array,offset:a.offset}),t.offsetArgIndex.push(i)}}if(t.arrayArgs.length<=0)throw new Error("cwise: No array arguments specified");if(t.pre.args.length>n.length)throw new Error("cwise: Too many arguments in pre() block");if(t.body.args.length>n.length)throw new Error("cwise: Too many arguments in body() block");if(t.post.args.length>n.length)throw new Error("cwise: Too many arguments in post() block");return t.debug=!!e.printCode||!!e.debug,t.funcName=e.funcName||"cwise",t.blockSize=e.blockSize||64,yl(t)};!function(e){var t=kl,n={body:"",args:[],thisVars:[],localVars:[]};function i(e){if(!e)return n;for(var t=0;t<e.args.length;++t){var i=e.args[t];e.args[t]=0===t?{name:i,lvalue:!0,rvalue:!!e.rvalue,count:e.count||1}:{name:i,lvalue:!1,rvalue:!0,count:1}}return e.thisVars||(e.thisVars=[]),e.localVars||(e.localVars=[]),e}function a(e){for(var n=[],a=0;a<e.args.length;++a)n.push("a"+a);return new Function("P",["return function ",e.funcName,"_ndarrayops(",n.join(","),") {P(",n.join(","),");return a0}"].join(""))(function(e){return t({args:e.args,pre:i(e.pre),body:i(e.body),post:i(e.proc),funcName:e.funcName})}(e))}var o={add:"+",sub:"-",mul:"*",div:"/",mod:"%",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"};!function(){for(var t in o){var n=o[t];e[t]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+n+"c"},funcName:t}),e[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a"+n+"=b"},rvalue:!0,funcName:t+"eq"}),e[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+n+"s"},funcName:t+"s"}),e[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a"+n+"=s"},rvalue:!0,funcName:t+"seq"})}}();var s={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in s){var n=s[t];e[t]=a({args:["array","array"],body:{args:["a","b"],body:"a="+n+"b"},funcName:t}),e[t+"eq"]=a({args:["array"],body:{args:["a"],body:"a="+n+"a"},rvalue:!0,count:2,funcName:t+"eq"})}}();var r={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in r){var n=r[t];e[t]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+n+"c"},funcName:t}),e[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+n+"s"},funcName:t+"s"}),e[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a=a"+n+"b"},rvalue:!0,count:2,funcName:t+"eq"}),e[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+n+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var c=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;t<c.length;++t){var n=c[t];e[n]=a({args:["array","array"],pre:{args:[],body:"this_f=Math."+n,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b)",thisVars:["this_f"]},funcName:n}),e[n+"eq"]=a({args:["array"],pre:{args:[],body:"this_f=Math."+n,thisVars:["this_f"]},body:{args:["a"],body:"a=this_f(a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:n+"eq"})}}();var l=["max","min","atan2","pow"];!function(){for(var t=0;t<l.length;++t){var n=l[t];e[n]=a({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+n,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:n}),e[n+"s"]=a({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+n,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:n+"s"}),e[n+"eq"]=a({args:["array","array"],pre:{args:[],body:"this_f=Math."+n,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:n+"eq"}),e[n+"seq"]=a({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+n,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:n+"seq"})}}();var p=["atan2","pow"];!function(){for(var t=0;t<p.length;++t){var n=p[t];e[n+"op"]=a({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+n,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:n+"op"}),e[n+"ops"]=a({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+n,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:n+"ops"}),e[n+"opeq"]=a({args:["array","array"],pre:{args:[],body:"this_f=Math."+n,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:n+"opeq"}),e[n+"opseq"]=a({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+n,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:n+"opseq"})}}(),e.any=t({args:["array"],pre:n,body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"if(a){return true}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return false"},funcName:"any"}),e.all=t({args:["array"],pre:n,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1}],body:"if(!x){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"all"}),e.sum=t({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s+=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"sum"}),e.prod=t({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=1"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s*=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"prod"}),e.norm2squared=t({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm2squared"}),e.norm2=t({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return Math.sqrt(this_s)"},funcName:"norm2"}),e.norminf=t({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:4}],body:"if(-a>this_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),e.norm1=t({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),e.sup=t({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),e.inf=t({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_<this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),e.argmin=t({args:["index","array","shape"],pre:{body:"{this_v=Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_<this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),e.argmax=t({args:["index","array","shape"],pre:{body:"{this_v=-Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_>this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),e.random=a({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),e.assign=a({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),e.assigns=a({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),e.equals=t({args:["array","array"],pre:n,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})}(ml);var _l=n(ml),jl=[[474,475],[475,476],[476,477],[477,474]],Cl=[[469,470],[470,471],[471,472],[472,469]],Sl=[[10,338],[338,297],[297,332],[332,284],[284,251],[251,389],[389,356],[356,454],[454,323],[323,361],[361,288],[288,397],[397,365],[365,379],[379,378],[378,400],[400,377],[377,152],[152,148],[148,176],[176,149],[149,150],[150,136],[136,172],[172,58],[58,132],[132,93],[93,234],[234,127],[127,162],[162,21],[21,54],[54,103],[103,67],[67,109],[109,10]];function El(e,t,n,i){e.forEach((e=>{const a=t[e[0]].x*n;i(a)}))}function Tl(e,t,n){t.forEach((t=>{const i=e[t];n.push([i.x,i.y])}))}function Ml(e,t,n,i,a){return Math.min(e,t)*a*(n/i)/10}function Ol(e){let t=1/0,n=-1/0,i=1/0,a=-1/0;e.forEach((e=>{t=Math.min(t,e[0]),n=Math.max(n,e[0]),i=Math.min(i,e[1]),a=Math.max(a,e[1])}));return{headWidth:n-t,headHeight:a-i,headCenterX:(t+n)/2,headCenterY:(i+a)/2}}function Al(e){let t=0;for(let n=0;n<e.length;n++){const i=(n+1)%e.length;t+=e[n][0]*e[i][1],t-=e[i][0]*e[n][1]}return Math.abs(t/2)}var Il,Pl,Rl=Object.freeze({__proto__:null,FACEMESH_FACE_OVAL:Sl,FACEMESH_LEFT_IRIS:jl,FACEMESH_RIGHT_IRIS:Cl,calculateHeadMetrics:Ol,convertToYolo:function(e,t,n){let i=(e[0][0]+e[2][0])/2,a=(e[1][1]+e[3][1])/2,o=e[2][0]-e[0][0],s=e[3][1]-e[1][1],r=[i,a,o,s];return o=r[2]*t,s=r[3]*n,[(r[0]-r[2]/2)*t,(r[1]-r[3]/2)*n,o,s]},defaultDeviceConfig:{screenWidth:30.2,screenHeight:19.6,screenWidthPX:1512,screenHeightPX:892,webcamHeight:2,normalizedFocalLength:1.3},defaultParticipantConfig:{headCenterX:.4383369982242584,headCenterY:.6562557443976402,headHeight:.3467509150505066,headWidth:.17240141332149506,widthLeftIris:29.442644119262695,widthRightIris:29.782133102416992,canvasContour:[[.4412970542907715,.4813721179962158],[.4646510183811188,.4823227524757385],[.48430705070495605,.48748111724853516],[.5025681853294373,.4987863302230835],[.5136374235153198,.5169670581817627],[.5202310681343079,.5401103496551514],[.5239146947860718,.5652479529380798],[.5248485207557678,.5970170497894287],[.5236638784408569,.6280523538589478],[.5220870971679688,.6599369645118713],[.519332766532898,.6945410370826721],[.5138625502586365,.7309722304344177],[.5065117478370667,.7603253722190857],[.4982540011405945,.7814207673072815],[.48702606558799744,.7993608713150024],[.4769010543823242,.8114907741546631],[.46630799770355225,.8215509057044983],[.4544796049594879,.8288376331329346],[.4395001232624054,.8312488794326782],[.42436403036117554,.8285082578659058],[.41225385665893555,.8210300207138062],[.40132373571395874,.8104891777038574],[.3908883333206177,.7982432246208191],[.3792901039123535,.7797933220863342],[.3707539737224579,.7583227753639221],[.36319053173065186,.728979766368866],[.35756009817123413,.6924722790718079],[.35495781898498535,.6577485203742981],[.35378265380859375,.6259740591049194],[.35298871994018555,.594894528388977],[.35470905900001526,.5631847381591797],[.3590857684612274,.5380555391311646],[.3667783737182617,.5149739384651184],[.37868133187294006,.4971347451210022],[.3973395824432373,.4863966703414917],[.41754668951034546,.4818713068962097]]},initEyeTracking:function(e=!1,t=!1){blueCircle=window.document.createElement("div"),blueCircle.setAttribute("id","blueCircle"),blueCircle.style.position="absolute",blueCircle.style.width="20px",blueCircle.style.height="20px",blueCircle.style.backgroundColor="blue",blueCircle.style.borderRadius="50%",blueCircle.style.transform="translate(-50%, -50%)",blueCircle.style.display="none",document.body.appendChild(blueCircle);const n=document.createElement("canvas");n.setAttribute("id","leftEye"),n.setAttribute("width","128"),n.setAttribute("height","128"),n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.display="none",document.body.appendChild(n);const i=document.createElement("canvas");i.setAttribute("id","rightEye"),i.setAttribute("width","128"),i.setAttribute("height","128"),i.style.position="absolute",i.style.top="0",i.style.left="128px",i.style.display="none",document.body.appendChild(i),e&&(n.style.display="block",i.style.display="block"),t&&(blueCircle.style.display="block"),leftEyectx=n.getContext("2d",{willReadFrequently:!0}),rightEyectx=i.getContext("2d",{willReadFrequently:!0})},isAreaWithinRange:function(e,t){const n=Al(e),i=Al(t);return i>=.9*n&&i<=1.1*n},isCentroidInsidePath:function(e,t){return function(e,t){let n=!1;const i=e[0],a=e[1];for(let e=0,o=t.length-1;e<t.length;o=e++){const s=t[e][0],r=t[e][1],c=t[o][0],l=t[o][1];r>a!=l>a&&i<(c-s)*(a-r)/(l-r)+s&&(n=!n)}return n}(function(e){let t=0,n=0;for(let i=0;i<e.length;i++)t+=e[i][0],n+=e[i][1];return[t/e.length,n/e.length]}(t),e)},onResultsFaceMesh:function(e){const t=e.image.width,n=e.image.height,i=[],a=[],o=[];let s=1/0,r=-1/0,c=1/0,l=-1/0;if(headCtx.save(),headCtx.clearRect(0,0,headCanvas.width,headCanvas.height),e.multiFaceLandmarks&&e.multiFaceLandmarks.forEach((e=>{if(El(jl,e,t,(e=>{s=Math.min(s,e),r=Math.max(r,e)})),El(Cl,e,t,(e=>{c=Math.min(c,e),l=Math.max(l,e)})),Tl(e,[130,27,243,23],i),Tl(e,[463,257,359,253],a),"undefined"!=typeof canvasContour&&canvasContour){var p=function(e,t,n,i,a,o,s){if(!e)return;const r=[],c=e.map((e=>[e[0]*n,e[1]*i]));return t.beginPath(),c.forEach((([e,n],i)=>{r.push([e,n]),t[0===i?"moveTo":"lineTo"](e,n)})),t.closePath(),t.strokeStyle=a,t.lineWidth=o,t.fillStyle=s,t.stroke(),r}(canvasContour,headCtx,t,n,"rgba(13, 110, 253, 1.0)",3,"transparent");fixedContour=p}var u=function(e,t,n,i,a,o){const s=e.map((e=>{const n=t[e[0]];return o.push([n.x,n.y]),[n.x*i,n.y*a]})),r=[];return n.beginPath(),s.forEach((([e,t],i)=>{r.push([e,t]),n[0===i?"moveTo":"lineTo"](e,t)})),n.closePath(),n.fillStyle="rgba(13, 110, 253, 1.0)",n.fill(),r}(Sl,e,headCtx,t,n,o);movingContour=u})),headCtx.restore(),normalizedFocalLength>0){const e=((Ml(t,n,11.7,r-s,normalizedFocalLength)+Ml(t,n,11.7,l-c,normalizedFocalLength))/2).toFixed(0);current_viewingDistance=e}focalLengthMultiple=Math.min(t,n),irisMetrics={widthLeftIris:r-s,widthRightIris:l-c},headMetrics=Ol(o),leftEyeCoordinates=i,rightEyeCoordinates=a,headCoordinates=o},preprocess:function(e,t,n){const i=dl(new Float32Array(e),[t,n,4]),a=dl(new Float32Array(t*n*3),[1,3,n,t]);return _l.divseq(i,255),_l.assign(a.pick(0,0,null,null),i.pick(null,null,2)),_l.assign(a.pick(0,1,null,null),i.pick(null,null,1)),_l.assign(a.pick(0,2,null,null),i.pick(null,null,0)),new Float32Array(a.data)},preprocess_kps:function(e,t,n){const i=dl(new Float32Array(e),[e.length]),a=dl(new Float32Array(e.length),[1,e.length]);return _l.assign(a.pick(0,null),i),new Float32Array(a.data)}}),Ll=document.documentElement;var Nl=4;async function Dl(e,t,n){try{const i=await fetch(`https://us-central1-webapp-af756.cloudfunctions.net/getUploadUrlFunction?fileName=${e}&mimeType=${t}&parentDir=${n}`);if(!i.ok)throw new Error("Failed to fetch upload URL");return(await i.json()).result}catch(e){throw console.error("Error fetching upload URL:",e),e}}async function ql(e,t){try{const n=await fetch(t,{method:"PUT",headers:{"Content-Type":e.type,"Content-Length":e.size},body:e});if(!n.ok){const e=await n.text();throw new Error(`Upload failed: ${n.status} ${n.statusText}\nResponse headers: ${JSON.stringify(n.headers)}\nResponse body: ${e}`)}console.log("Upload complete:",await n.text())}catch(e){console.error("Error:",e)}}var Fl=Object.freeze({__proto__:null,get countdown(){return Nl},getUploadUrl:Dl,giveAccess:async function(e=!1){try{const t=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:60,max:60}},audio:e});inputVideo&&(inputVideo.srcObject=t,inputVideo.play(),inputVideo.addEventListener("loadedmetadata",(function(){Il=inputVideo.videoWidth,Pl=inputVideo.videoHeight,headCanvas&&(headCanvas.width=Il,headCanvas.height=Pl)}))),videoRecorder=new MediaRecorder(t),videoRecorder.ondataavailable=e=>{e.data.size>0&&videoChunks.push(e.data)},videoRecorder.onstop=async()=>{console.log("Recording stopped, blob created")}}catch(e){console.error("Error accessing media devices:",e)}},openFullscreen:function(){Ll.requestFullscreen?Ll.requestFullscreen():Ll.webkitRequestFullscreen?Ll.webkitRequestFullscreen():Ll.msRequestFullscreen&&Ll.msRequestFullscreen()},get orig_img_height(){return Pl},get orig_img_width(){return Il},saveRecordings:async function(e,t,n="video/webm"){await new Promise((e=>{videoRecorder.onstop=e,videoRecorder.stop()}));const i=new Blob(videoChunks,{type:"video/webm"});if(i.size>0){console.log("Video recorded successfully. Size:",i.size,"bytes");try{var a=store.session.get("deviceConfig")??defaultDeviceConfig;a.storeAudio&&a.storeVideo?n="video/webm":a.storeAudio&&(n="audio/webm");const o=await Dl(e,n,t);await ql(i,o)}catch(e){console.error("Error getting video upload URL:",e)}}else console.error("No video data recorded.")},startRecording:async function(){videoChunks=[],videoRecorder.stop(),videoRecorder.start()},stopRecording:async function(){videoRecorder.stop()},updateCountdown:function e(t){0===--Nl?(document.getElementById("instruction").style.display="none","function"==typeof t&&(t(),Nl=4)):(document.getElementById("instruction").innerHTML="<h1>"+Nl+"</h1>",setTimeout((function(){e(t)}),1e3))},uploadFile:ql}),zl={};const Vl=Object.prototype.toString;function Bl(e){const t=Vl.call(e);return t.endsWith("Array]")&&!t.includes("Big")}var Ul=i(Object.freeze({__proto__:null,isAnyArray:Bl}));var Hl=Object.freeze({__proto__:null,default:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Bl(e))throw new TypeError("input must be an array");if(0===e.length)throw new TypeError("input must not be empty");if(void 0!==n.output){if(!Bl(n.output))throw new TypeError("output option must be an array if specified");t=n.output}else t=new Array(e.length);var i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Bl(e))throw new TypeError("input must be an array");if(0===e.length)throw new TypeError("input must not be empty");var n=t.fromIndex,i=void 0===n?0:n,a=t.toIndex,o=void 0===a?e.length:a;if(i<0||i>=e.length||!Number.isInteger(i))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=i||o>e.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var s=e[i],r=i+1;r<o;r++)e[r]<s&&(s=e[r]);return s}(e),a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Bl(e))throw new TypeError("input must be an array");if(0===e.length)throw new TypeError("input must not be empty");var n=t.fromIndex,i=void 0===n?0:n,a=t.toIndex,o=void 0===a?e.length:a;if(i<0||i>=e.length||!Number.isInteger(i))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=i||o>e.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var s=e[i],r=i+1;r<o;r++)e[r]>s&&(s=e[r]);return s}(e);if(i===a)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var o=n.min,s=void 0===o?n.autoMinMax?i:0:o,r=n.max,c=void 0===r?n.autoMinMax?a:1:r;if(s>=c)throw new RangeError("min option must be smaller than max option");for(var l=(c-s)/(a-i),p=0;p<e.length;p++)t[p]=(e[p]-i)*l+s;return t}}),Wl=i(Hl);Object.defineProperty(zl,"__esModule",{value:!0});var $l=Ul,Kl=Wl;const Yl=" ".repeat(2),Xl=" ".repeat(4);function Gl(e,t={}){const{maxRows:n=15,maxColumns:i=10,maxNumSize:a=8,padMinus:o="auto"}=t;return`${e.constructor.name} {\n${Yl}[\n${Xl}${function(e,t,n,i,a){const{rows:o,columns:s}=e,r=Math.min(o,t),c=Math.min(s,n),l=[];if("auto"===a){a=!1;e:for(let t=0;t<r;t++)for(let n=0;n<c;n++)if(e.get(t,n)<0){a=!0;break e}}for(let t=0;t<r;t++){let n=[];for(let o=0;o<c;o++)n.push(Jl(e.get(t,o),i,a));l.push(`${n.join(" ")}`)}c!==s&&(l[l.length-1]+=` ... ${s-n} more columns`);r!==o&&l.push(`... ${o-t} more rows`);return l.join(`\n${Xl}`)}(e,n,i,a,o)}\n${Yl}]\n${Yl}rows: ${e.rows}\n${Yl}columns: ${e.columns}\n}`}function Jl(e,t,n){return(e>=0&&n?` ${Ql(e,t-1)}`:Ql(e,t)).padEnd(t)}function Ql(e,t){let n=e.toString();if(n.length<=t)return n;let i=e.toFixed(t);if(i.length>t&&(i=e.toFixed(Math.max(0,t-(i.length-t)))),i.length<=t&&!i.startsWith("0.000")&&!i.startsWith("-0.000"))return i;let a=e.toExponential(t);return a.length>t&&(a=e.toExponential(Math.max(0,t-(a.length-t)))),a.slice(0)}function Zl(e,t,n){let i=n?e.rows:e.rows-1;if(t<0||t>i)throw new RangeError("Row index out of range")}function ep(e,t,n){let i=n?e.columns:e.columns-1;if(t<0||t>i)throw new RangeError("Column index out of range")}function tp(e,t){if(t.to1DArray&&(t=t.to1DArray()),t.length!==e.columns)throw new RangeError("vector size must be the same as the number of columns");return t}function np(e,t){if(t.to1DArray&&(t=t.to1DArray()),t.length!==e.rows)throw new RangeError("vector size must be the same as the number of rows");return t}function ip(e,t){if(!$l.isAnyArray(t))throw new TypeError("row indices must be an array");for(let n=0;n<t.length;n++)if(t[n]<0||t[n]>=e.rows)throw new RangeError("row indices are out of range")}function ap(e,t){if(!$l.isAnyArray(t))throw new TypeError("column indices must be an array");for(let n=0;n<t.length;n++)if(t[n]<0||t[n]>=e.columns)throw new RangeError("column indices are out of range")}function op(e,t,n,i,a){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(rp("startRow",t),rp("endRow",n),rp("startColumn",i),rp("endColumn",a),t>n||i>a||t<0||t>=e.rows||n<0||n>=e.rows||i<0||i>=e.columns||a<0||a>=e.columns)throw new RangeError("Submatrix indices are out of range")}function sp(e,t=0){let n=[];for(let i=0;i<e;i++)n.push(t);return n}function rp(e,t){if("number"!=typeof t)throw new TypeError(`${e} must be a number`)}function cp(e){if(e.isEmpty())throw new Error("Empty matrix has no elements to index")}class lp{static from1DArray(e,t,n){if(e*t!==n.length)throw new RangeError("data length does not match given dimensions");let i=new up(e,t);for(let a=0;a<e;a++)for(let e=0;e<t;e++)i.set(a,e,n[a*t+e]);return i}static rowVector(e){let t=new up(1,e.length);for(let n=0;n<e.length;n++)t.set(0,n,e[n]);return t}static columnVector(e){let t=new up(e.length,1);for(let n=0;n<e.length;n++)t.set(n,0,e[n]);return t}static zeros(e,t){return new up(e,t)}static ones(e,t){return new up(e,t).fill(1)}static rand(e,t,n={}){if("object"!=typeof n)throw new TypeError("options must be an object");const{random:i=Math.random}=n;let a=new up(e,t);for(let n=0;n<e;n++)for(let e=0;e<t;e++)a.set(n,e,i());return a}static randInt(e,t,n={}){if("object"!=typeof n)throw new TypeError("options must be an object");const{min:i=0,max:a=1e3,random:o=Math.random}=n;if(!Number.isInteger(i))throw new TypeError("min must be an integer");if(!Number.isInteger(a))throw new TypeError("max must be an integer");if(i>=a)throw new RangeError("min must be smaller than max");let s=a-i,r=new up(e,t);for(let n=0;n<e;n++)for(let e=0;e<t;e++){let t=i+Math.round(o()*s);r.set(n,e,t)}return r}static eye(e,t,n){void 0===t&&(t=e),void 0===n&&(n=1);let i=Math.min(e,t),a=this.zeros(e,t);for(let e=0;e<i;e++)a.set(e,e,n);return a}static diag(e,t,n){let i=e.length;void 0===t&&(t=i),void 0===n&&(n=t);let a=Math.min(i,t,n),o=this.zeros(t,n);for(let t=0;t<a;t++)o.set(t,t,e[t]);return o}static min(e,t){e=this.checkMatrix(e),t=this.checkMatrix(t);let n=e.rows,i=e.columns,a=new up(n,i);for(let o=0;o<n;o++)for(let n=0;n<i;n++)a.set(o,n,Math.min(e.get(o,n),t.get(o,n)));return a}static max(e,t){e=this.checkMatrix(e),t=this.checkMatrix(t);let n=e.rows,i=e.columns,a=new this(n,i);for(let o=0;o<n;o++)for(let n=0;n<i;n++)a.set(o,n,Math.max(e.get(o,n),t.get(o,n)));return a}static checkMatrix(e){return lp.isMatrix(e)?e:new up(e)}static isMatrix(e){return null!=e&&"Matrix"===e.klass}get size(){return this.rows*this.columns}apply(e){if("function"!=typeof e)throw new TypeError("callback must be a function");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e.call(this,t,n);return this}to1DArray(){let e=[];for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e.push(this.get(t,n));return e}to2DArray(){let e=[];for(let t=0;t<this.rows;t++){e.push([]);for(let n=0;n<this.columns;n++)e[t].push(this.get(t,n))}return e}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let e=0;e<this.rows;e++)for(let t=0;t<=e;t++)if(this.get(e,t)!==this.get(t,e))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let e=0;e<this.rows;e++)if(0!==this.get(e,e))return!1;return!0}isEchelonForm(){let e=0,t=0,n=-1,i=!0,a=!1;for(;e<this.rows&&i;){for(t=0,a=!1;t<this.columns&&!1===a;)0===this.get(e,t)?t++:1===this.get(e,t)&&t>n?(a=!0,n=t):(i=!1,a=!0);e++}return i}isReducedEchelonForm(){let e=0,t=0,n=-1,i=!0,a=!1;for(;e<this.rows&&i;){for(t=0,a=!1;t<this.columns&&!1===a;)0===this.get(e,t)?t++:1===this.get(e,t)&&t>n?(a=!0,n=t):(i=!1,a=!0);for(let n=t+1;n<this.rows;n++)0!==this.get(e,n)&&(i=!1);e++}return i}echelonForm(){let e=this.clone(),t=0,n=0;for(;t<e.rows&&n<e.columns;){let i=t;for(let a=t;a<e.rows;a++)e.get(a,n)>e.get(i,n)&&(i=a);if(0===e.get(i,n))n++;else{e.swapRows(t,i);let a=e.get(t,n);for(let i=n;i<e.columns;i++)e.set(t,i,e.get(t,i)/a);for(let i=t+1;i<e.rows;i++){let a=e.get(i,n)/e.get(t,n);e.set(i,n,0);for(let o=n+1;o<e.columns;o++)e.set(i,o,e.get(i,o)-e.get(t,o)*a)}t++,n++}}return e}reducedEchelonForm(){let e=this.echelonForm(),t=e.columns,n=e.rows,i=n-1;for(;i>=0;)if(0===e.maxRow(i))i--;else{let a=0,o=!1;for(;a<n&&!1===o;)1===e.get(i,a)?o=!0:a++;for(let n=0;n<i;n++){let o=e.get(n,a);for(let s=a;s<t;s++){let t=e.get(n,s)-o*e.get(i,s);e.set(n,s,t)}}i--}return e}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(e={}){if("object"!=typeof e)throw new TypeError("options must be an object");const{rows:t=1,columns:n=1}=e;if(!Number.isInteger(t)||t<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(n)||n<=0)throw new TypeError("columns must be a positive integer");let i=new up(this.rows*t,this.columns*n);for(let e=0;e<t;e++)for(let t=0;t<n;t++)i.setSubMatrix(this,this.rows*e,this.columns*t);return i}fill(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,e);return this}neg(){return this.mulS(-1)}getRow(e){Zl(this,e);let t=[];for(let n=0;n<this.columns;n++)t.push(this.get(e,n));return t}getRowVector(e){return up.rowVector(this.getRow(e))}setRow(e,t){Zl(this,e),t=tp(this,t);for(let n=0;n<this.columns;n++)this.set(e,n,t[n]);return this}swapRows(e,t){Zl(this,e),Zl(this,t);for(let n=0;n<this.columns;n++){let i=this.get(e,n);this.set(e,n,this.get(t,n)),this.set(t,n,i)}return this}getColumn(e){ep(this,e);let t=[];for(let n=0;n<this.rows;n++)t.push(this.get(n,e));return t}getColumnVector(e){return up.columnVector(this.getColumn(e))}setColumn(e,t){ep(this,e),t=np(this,t);for(let n=0;n<this.rows;n++)this.set(n,e,t[n]);return this}swapColumns(e,t){ep(this,e),ep(this,t);for(let n=0;n<this.rows;n++){let i=this.get(n,e);this.set(n,e,this.get(n,t)),this.set(n,t,i)}return this}addRowVector(e){e=tp(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)+e[n]);return this}subRowVector(e){e=tp(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)-e[n]);return this}mulRowVector(e){e=tp(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e[n]);return this}divRowVector(e){e=tp(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)/e[n]);return this}addColumnVector(e){e=np(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)+e[t]);return this}subColumnVector(e){e=np(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)-e[t]);return this}mulColumnVector(e){e=np(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e[t]);return this}divColumnVector(e){e=np(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)/e[t]);return this}mulRow(e,t){Zl(this,e);for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t);return this}mulColumn(e,t){ep(this,e);for(let n=0;n<this.rows;n++)this.set(n,e,this.get(n,e)*t);return this}max(e){if(this.isEmpty())return NaN;switch(e){case"row":{const e=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.get(t,n)>e[t]&&(e[t]=this.get(t,n));return e}case"column":{const e=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.get(t,n)>e[n]&&(e[n]=this.get(t,n));return e}case void 0:{let e=this.get(0,0);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n));return e}default:throw new Error(`invalid option: ${e}`)}}maxIndex(){cp(this);let e=this.get(0,0),t=[0,0];for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)>e&&(e=this.get(n,i),t[0]=n,t[1]=i);return t}min(e){if(this.isEmpty())return NaN;switch(e){case"row":{const e=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.get(t,n)<e[t]&&(e[t]=this.get(t,n));return e}case"column":{const e=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.get(t,n)<e[n]&&(e[n]=this.get(t,n));return e}case void 0:{let e=this.get(0,0);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n));return e}default:throw new Error(`invalid option: ${e}`)}}minIndex(){cp(this);let e=this.get(0,0),t=[0,0];for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)<e&&(e=this.get(n,i),t[0]=n,t[1]=i);return t}maxRow(e){if(Zl(this,e),this.isEmpty())return NaN;let t=this.get(e,0);for(let n=1;n<this.columns;n++)this.get(e,n)>t&&(t=this.get(e,n));return t}maxRowIndex(e){Zl(this,e),cp(this);let t=this.get(e,0),n=[e,0];for(let i=1;i<this.columns;i++)this.get(e,i)>t&&(t=this.get(e,i),n[1]=i);return n}minRow(e){if(Zl(this,e),this.isEmpty())return NaN;let t=this.get(e,0);for(let n=1;n<this.columns;n++)this.get(e,n)<t&&(t=this.get(e,n));return t}minRowIndex(e){Zl(this,e),cp(this);let t=this.get(e,0),n=[e,0];for(let i=1;i<this.columns;i++)this.get(e,i)<t&&(t=this.get(e,i),n[1]=i);return n}maxColumn(e){if(ep(this,e),this.isEmpty())return NaN;let t=this.get(0,e);for(let n=1;n<this.rows;n++)this.get(n,e)>t&&(t=this.get(n,e));return t}maxColumnIndex(e){ep(this,e),cp(this);let t=this.get(0,e),n=[0,e];for(let i=1;i<this.rows;i++)this.get(i,e)>t&&(t=this.get(i,e),n[0]=i);return n}minColumn(e){if(ep(this,e),this.isEmpty())return NaN;let t=this.get(0,e);for(let n=1;n<this.rows;n++)this.get(n,e)<t&&(t=this.get(n,e));return t}minColumnIndex(e){ep(this,e),cp(this);let t=this.get(0,e),n=[0,e];for(let i=1;i<this.rows;i++)this.get(i,e)<t&&(t=this.get(i,e),n[0]=i);return n}diag(){let e=Math.min(this.rows,this.columns),t=[];for(let n=0;n<e;n++)t.push(this.get(n,n));return t}norm(e="frobenius"){switch(e){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${e}`)}}cumulativeSum(){let e=0;for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e+=this.get(t,n),this.set(t,n,e);return this}dot(e){lp.isMatrix(e)&&(e=e.to1DArray());let t=this.to1DArray();if(t.length!==e.length)throw new RangeError("vectors do not have the same size");let n=0;for(let i=0;i<t.length;i++)n+=t[i]*e[i];return n}mmul(e){e=up.checkMatrix(e);let t=this.rows,n=this.columns,i=e.columns,a=new up(t,i),o=new Float64Array(n);for(let s=0;s<i;s++){for(let t=0;t<n;t++)o[t]=e.get(t,s);for(let e=0;e<t;e++){let t=0;for(let i=0;i<n;i++)t+=this.get(e,i)*o[i];a.set(e,s,t)}}return a}strassen2x2(e){e=up.checkMatrix(e);let t=new up(2,2);const n=this.get(0,0),i=e.get(0,0),a=this.get(0,1),o=e.get(0,1),s=this.get(1,0),r=e.get(1,0),c=this.get(1,1),l=e.get(1,1),p=(n+c)*(i+l),u=(s+c)*i,d=n*(o-l),m=c*(r-i),h=(n+a)*l,f=p+m-h+(a-c)*(r+l),g=d+h,v=u+m,b=p-u+d+(s-n)*(i+o);return t.set(0,0,f),t.set(0,1,g),t.set(1,0,v),t.set(1,1,b),t}strassen3x3(e){e=up.checkMatrix(e);let t=new up(3,3);const n=this.get(0,0),i=this.get(0,1),a=this.get(0,2),o=this.get(1,0),s=this.get(1,1),r=this.get(1,2),c=this.get(2,0),l=this.get(2,1),p=this.get(2,2),u=e.get(0,0),d=e.get(0,1),m=e.get(0,2),h=e.get(1,0),f=e.get(1,1),g=e.get(1,2),v=e.get(2,0),b=e.get(2,1),x=e.get(2,2),y=(n-o)*(-d+f),w=(-n+o+s)*(u-d+f),k=(o+s)*(-u+d),_=n*u,j=(-n+c+l)*(u-m+g),C=(-n+c)*(m-g),S=(c+l)*(-u+m),E=(-a+l+p)*(f+v-b),T=(a-p)*(f-b),M=a*v,O=(l+p)*(-v+b),A=(-a+s+r)*(g+v-x),I=(a-r)*(g-x),P=(s+r)*(-v+x),R=_+M+i*h,L=(n+i+a-o-s-l-p)*f+w+k+_+E+M+O,N=_+j+S+(n+i+a-s-r-c-l)*g+M+A+P,D=y+s*(-u+d+h-f-g-v+x)+w+_+M+A+I,q=y+w+k+_+r*b,F=M+A+I+P+o*m,z=_+j+C+l*(-u+m+h-f-g-v+b)+E+T+M,V=E+T+M+O+c*d,B=_+j+C+S+p*x;return t.set(0,0,R),t.set(0,1,L),t.set(0,2,N),t.set(1,0,D),t.set(1,1,q),t.set(1,2,F),t.set(2,0,z),t.set(2,1,V),t.set(2,2,B),t}mmulStrassen(e){e=up.checkMatrix(e);let t=this.clone(),n=t.rows,i=t.columns,a=e.rows,o=e.columns;function s(e,t,n){let i=e.rows,a=e.columns;if(i===t&&a===n)return e;{let i=lp.zeros(t,n);return i=i.setSubMatrix(e,0,0),i}}i!==a&&console.warn(`Multiplying ${n} x ${i} and ${a} x ${o} matrix: dimensions do not match.`);let r=Math.max(n,a),c=Math.max(i,o);return t=s(t,r,c),function e(t,n,i,a){if(i<=512||a<=512)return t.mmul(n);i%2==1&&a%2==1?(t=s(t,i+1,a+1),n=s(n,i+1,a+1)):i%2==1?(t=s(t,i+1,a),n=s(n,i+1,a)):a%2==1&&(t=s(t,i,a+1),n=s(n,i,a+1));let o=parseInt(t.rows/2,10),r=parseInt(t.columns/2,10),c=t.subMatrix(0,o-1,0,r-1),l=n.subMatrix(0,o-1,0,r-1),p=t.subMatrix(0,o-1,r,t.columns-1),u=n.subMatrix(0,o-1,r,n.columns-1),d=t.subMatrix(o,t.rows-1,0,r-1),m=n.subMatrix(o,n.rows-1,0,r-1),h=t.subMatrix(o,t.rows-1,r,t.columns-1),f=n.subMatrix(o,n.rows-1,r,n.columns-1),g=e(lp.add(c,h),lp.add(l,f),o,r),v=e(lp.add(d,h),l,o,r),b=e(c,lp.sub(u,f),o,r),x=e(h,lp.sub(m,l),o,r),y=e(lp.add(c,p),f,o,r),w=e(lp.sub(d,c),lp.add(l,u),o,r),k=e(lp.sub(p,h),lp.add(m,f),o,r),_=lp.add(g,x);_.sub(y),_.add(k);let j=lp.add(b,y),C=lp.add(v,x),S=lp.sub(g,v);S.add(b),S.add(w);let E=lp.zeros(2*_.rows,2*_.columns);return E=E.setSubMatrix(_,0,0),E=E.setSubMatrix(j,_.rows,0),E=E.setSubMatrix(C,0,_.columns),E=E.setSubMatrix(S,_.rows,_.columns),E.subMatrix(0,i-1,0,a-1)}(t,e=s(e,r,c),r,c)}scaleRows(e={}){if("object"!=typeof e)throw new TypeError("options must be an object");const{min:t=0,max:n=1}=e;if(!Number.isFinite(t))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(t>=n)throw new RangeError("min must be smaller than max");let i=new up(this.rows,this.columns);for(let e=0;e<this.rows;e++){const a=this.getRow(e);a.length>0&&Kl(a,{min:t,max:n,output:a}),i.setRow(e,a)}return i}scaleColumns(e={}){if("object"!=typeof e)throw new TypeError("options must be an object");const{min:t=0,max:n=1}=e;if(!Number.isFinite(t))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(t>=n)throw new RangeError("min must be smaller than max");let i=new up(this.rows,this.columns);for(let e=0;e<this.columns;e++){const a=this.getColumn(e);a.length&&Kl(a,{min:t,max:n,output:a}),i.setColumn(e,a)}return i}flipRows(){const e=Math.ceil(this.columns/2);for(let t=0;t<this.rows;t++)for(let n=0;n<e;n++){let e=this.get(t,n),i=this.get(t,this.columns-1-n);this.set(t,n,i),this.set(t,this.columns-1-n,e)}return this}flipColumns(){const e=Math.ceil(this.rows/2);for(let t=0;t<this.columns;t++)for(let n=0;n<e;n++){let e=this.get(n,t),i=this.get(this.rows-1-n,t);this.set(n,t,i),this.set(this.rows-1-n,t,e)}return this}kroneckerProduct(e){e=up.checkMatrix(e);let t=this.rows,n=this.columns,i=e.rows,a=e.columns,o=new up(t*i,n*a);for(let s=0;s<t;s++)for(let t=0;t<n;t++)for(let n=0;n<i;n++)for(let r=0;r<a;r++)o.set(i*s+n,a*t+r,this.get(s,t)*e.get(n,r));return o}kroneckerSum(e){if(e=up.checkMatrix(e),!this.isSquare()||!e.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let t=this.rows,n=e.rows,i=this.kroneckerProduct(up.eye(n,n)),a=up.eye(t,t).kroneckerProduct(e);return i.add(a)}transpose(){let e=new up(this.columns,this.rows);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e.set(n,t,this.get(t,n));return e}sortRows(e=pp){for(let t=0;t<this.rows;t++)this.setRow(t,this.getRow(t).sort(e));return this}sortColumns(e=pp){for(let t=0;t<this.columns;t++)this.setColumn(t,this.getColumn(t).sort(e));return this}subMatrix(e,t,n,i){op(this,e,t,n,i);let a=new up(t-e+1,i-n+1);for(let o=e;o<=t;o++)for(let t=n;t<=i;t++)a.set(o-e,t-n,this.get(o,t));return a}subMatrixRow(e,t,n){if(void 0===t&&(t=0),void 0===n&&(n=this.columns-1),t>n||t<0||t>=this.columns||n<0||n>=this.columns)throw new RangeError("Argument out of range");let i=new up(e.length,n-t+1);for(let a=0;a<e.length;a++)for(let o=t;o<=n;o++){if(e[a]<0||e[a]>=this.rows)throw new RangeError(`Row index out of range: ${e[a]}`);i.set(a,o-t,this.get(e[a],o))}return i}subMatrixColumn(e,t,n){if(void 0===t&&(t=0),void 0===n&&(n=this.rows-1),t>n||t<0||t>=this.rows||n<0||n>=this.rows)throw new RangeError("Argument out of range");let i=new up(n-t+1,e.length);for(let a=0;a<e.length;a++)for(let o=t;o<=n;o++){if(e[a]<0||e[a]>=this.columns)throw new RangeError(`Column index out of range: ${e[a]}`);i.set(o-t,a,this.get(o,e[a]))}return i}setSubMatrix(e,t,n){if((e=up.checkMatrix(e)).isEmpty())return this;op(this,t,t+e.rows-1,n,n+e.columns-1);for(let i=0;i<e.rows;i++)for(let a=0;a<e.columns;a++)this.set(t+i,n+a,e.get(i,a));return this}selection(e,t){ip(this,e),ap(this,t);let n=new up(e.length,t.length);for(let i=0;i<e.length;i++){let a=e[i];for(let e=0;e<t.length;e++){let o=t[e];n.set(i,e,this.get(a,o))}}return n}trace(){let e=Math.min(this.rows,this.columns),t=0;for(let n=0;n<e;n++)t+=this.get(n,n);return t}clone(){return this.constructor.copy(this,new up(this.rows,this.columns))}static copy(e,t){for(const[n,i,a]of e.entries())t.set(n,i,a);return t}sum(e){switch(e){case"row":return function(e){let t=sp(e.rows);for(let n=0;n<e.rows;++n)for(let i=0;i<e.columns;++i)t[n]+=e.get(n,i);return t}(this);case"column":return function(e){let t=sp(e.columns);for(let n=0;n<e.rows;++n)for(let i=0;i<e.columns;++i)t[i]+=e.get(n,i);return t}(this);case void 0:return function(e){let t=0;for(let n=0;n<e.rows;n++)for(let i=0;i<e.columns;i++)t+=e.get(n,i);return t}(this);default:throw new Error(`invalid option: ${e}`)}}product(e){switch(e){case"row":return function(e){let t=sp(e.rows,1);for(let n=0;n<e.rows;++n)for(let i=0;i<e.columns;++i)t[n]*=e.get(n,i);return t}(this);case"column":return function(e){let t=sp(e.columns,1);for(let n=0;n<e.rows;++n)for(let i=0;i<e.columns;++i)t[i]*=e.get(n,i);return t}(this);case void 0:return function(e){let t=1;for(let n=0;n<e.rows;n++)for(let i=0;i<e.columns;i++)t*=e.get(n,i);return t}(this);default:throw new Error(`invalid option: ${e}`)}}mean(e){const t=this.sum(e);switch(e){case"row":for(let e=0;e<this.rows;e++)t[e]/=this.columns;return t;case"column":for(let e=0;e<this.columns;e++)t[e]/=this.rows;return t;case void 0:return t/this.size;default:throw new Error(`invalid option: ${e}`)}}variance(e,t={}){if("object"==typeof e&&(t=e,e=void 0),"object"!=typeof t)throw new TypeError("options must be an object");const{unbiased:n=!0,mean:i=this.mean(e)}=t;if("boolean"!=typeof n)throw new TypeError("unbiased must be a boolean");switch(e){case"row":if(!$l.isAnyArray(i))throw new TypeError("mean must be an array");return function(e,t,n){const i=e.rows,a=e.columns,o=[];for(let s=0;s<i;s++){let i=0,r=0,c=0;for(let t=0;t<a;t++)c=e.get(s,t)-n[s],i+=c,r+=c*c;t?o.push((r-i*i/a)/(a-1)):o.push((r-i*i/a)/a)}return o}(this,n,i);case"column":if(!$l.isAnyArray(i))throw new TypeError("mean must be an array");return function(e,t,n){const i=e.rows,a=e.columns,o=[];for(let s=0;s<a;s++){let a=0,r=0,c=0;for(let t=0;t<i;t++)c=e.get(t,s)-n[s],a+=c,r+=c*c;t?o.push((r-a*a/i)/(i-1)):o.push((r-a*a/i)/i)}return o}(this,n,i);case void 0:if("number"!=typeof i)throw new TypeError("mean must be a number");return function(e,t,n){const i=e.rows,a=e.columns,o=i*a;let s=0,r=0,c=0;for(let t=0;t<i;t++)for(let i=0;i<a;i++)c=e.get(t,i)-n,s+=c,r+=c*c;return t?(r-s*s/o)/(o-1):(r-s*s/o)/o}(this,n,i);default:throw new Error(`invalid option: ${e}`)}}standardDeviation(e,t){"object"==typeof e&&(t=e,e=void 0);const n=this.variance(e,t);if(void 0===e)return Math.sqrt(n);for(let e=0;e<n.length;e++)n[e]=Math.sqrt(n[e]);return n}center(e,t={}){if("object"==typeof e&&(t=e,e=void 0),"object"!=typeof t)throw new TypeError("options must be an object");const{center:n=this.mean(e)}=t;switch(e){case"row":if(!$l.isAnyArray(n))throw new TypeError("center must be an array");return function(e,t){for(let n=0;n<e.rows;n++)for(let i=0;i<e.columns;i++)e.set(n,i,e.get(n,i)-t[n])}(this,n),this;case"column":if(!$l.isAnyArray(n))throw new TypeError("center must be an array");return function(e,t){for(let n=0;n<e.rows;n++)for(let i=0;i<e.columns;i++)e.set(n,i,e.get(n,i)-t[i])}(this,n),this;case void 0:if("number"!=typeof n)throw new TypeError("center must be a number");return function(e,t){for(let n=0;n<e.rows;n++)for(let i=0;i<e.columns;i++)e.set(n,i,e.get(n,i)-t)}(this,n),this;default:throw new Error(`invalid option: ${e}`)}}scale(e,t={}){if("object"==typeof e&&(t=e,e=void 0),"object"!=typeof t)throw new TypeError("options must be an object");let n=t.scale;switch(e){case"row":if(void 0===n)n=function(e){const t=[];for(let n=0;n<e.rows;n++){let i=0;for(let t=0;t<e.columns;t++)i+=e.get(n,t)**2/(e.columns-1);t.push(Math.sqrt(i))}return t}(this);else if(!$l.isAnyArray(n))throw new TypeError("scale must be an array");return function(e,t){for(let n=0;n<e.rows;n++)for(let i=0;i<e.columns;i++)e.set(n,i,e.get(n,i)/t[n])}(this,n),this;case"column":if(void 0===n)n=function(e){const t=[];for(let n=0;n<e.columns;n++){let i=0;for(let t=0;t<e.rows;t++)i+=e.get(t,n)**2/(e.rows-1);t.push(Math.sqrt(i))}return t}(this);else if(!$l.isAnyArray(n))throw new TypeError("scale must be an array");return function(e,t){for(let n=0;n<e.rows;n++)for(let i=0;i<e.columns;i++)e.set(n,i,e.get(n,i)/t[i])}(this,n),this;case void 0:if(void 0===n)n=function(e){const t=e.size-1;let n=0;for(let i=0;i<e.columns;i++)for(let a=0;a<e.rows;a++)n+=e.get(a,i)**2/t;return Math.sqrt(n)}(this);else if("number"!=typeof n)throw new TypeError("scale must be a number");return function(e,t){for(let n=0;n<e.rows;n++)for(let i=0;i<e.columns;i++)e.set(n,i,e.get(n,i)/t)}(this,n),this;default:throw new Error(`invalid option: ${e}`)}}toString(e){return Gl(this,e)}[Symbol.iterator](){return this.entries()}*entries(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)yield[e,t,this.get(e,t)]}*values(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)yield this.get(e,t)}}function pp(e,t){return e-t}lp.prototype.klass="Matrix","undefined"!=typeof Symbol&&(lp.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return Gl(this)}),lp.random=lp.rand,lp.randomInt=lp.randInt,lp.diagonal=lp.diag,lp.prototype.diagonal=lp.prototype.diag,lp.identity=lp.eye,lp.prototype.negate=lp.prototype.neg,lp.prototype.tensorProduct=lp.prototype.kroneckerProduct;let up=class e extends lp{data;#e(e,t){if(this.data=[],!(Number.isInteger(t)&&t>=0))throw new TypeError("nColumns must be a positive integer");for(let n=0;n<e;n++)this.data.push(new Float64Array(t));this.rows=e,this.columns=t}constructor(t,n){if(super(),e.isMatrix(t))this.#e(t.rows,t.columns),e.copy(t,this);else if(Number.isInteger(t)&&t>=0)this.#e(t,n);else{if(!$l.isAnyArray(t))throw new TypeError("First argument must be a positive number or an array");{const e=t;if("number"!=typeof(n=(t=e.length)?e[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let i=0;i<t;i++){if(e[i].length!==n)throw new RangeError("Inconsistent array dimensions");if(!e[i].every((e=>"number"==typeof e)))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(e[i]))}this.rows=t,this.columns=n}}}set(e,t,n){return this.data[e][t]=n,this}get(e,t){return this.data[e][t]}removeRow(e){return Zl(this,e),this.data.splice(e,1),this.rows-=1,this}addRow(e,t){return void 0===t&&(t=e,e=this.rows),Zl(this,e,!0),t=Float64Array.from(tp(this,t)),this.data.splice(e,0,t),this.rows+=1,this}removeColumn(e){ep(this,e);for(let t=0;t<this.rows;t++){const n=new Float64Array(this.columns-1);for(let i=0;i<e;i++)n[i]=this.data[t][i];for(let i=e+1;i<this.columns;i++)n[i-1]=this.data[t][i];this.data[t]=n}return this.columns-=1,this}addColumn(e,t){void 0===t&&(t=e,e=this.columns),ep(this,e,!0),t=np(this,t);for(let n=0;n<this.rows;n++){const i=new Float64Array(this.columns+1);let a=0;for(;a<e;a++)i[a]=this.data[n][a];for(i[a++]=t[n];a<this.columns+1;a++)i[a]=this.data[n][a-1];this.data[n]=i}return this.columns+=1,this}};!function(e,t){e.prototype.add=function(e){return"number"==typeof e?this.addS(e):this.addM(e)},e.prototype.addS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)+e);return this},e.prototype.addM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)+e.get(t,n));return this},e.add=function(e,n){return new t(e).add(n)},e.prototype.sub=function(e){return"number"==typeof e?this.subS(e):this.subM(e)},e.prototype.subS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)-e);return this},e.prototype.subM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)-e.get(t,n));return this},e.sub=function(e,n){return new t(e).sub(n)},e.prototype.subtract=e.prototype.sub,e.prototype.subtractS=e.prototype.subS,e.prototype.subtractM=e.prototype.subM,e.subtract=e.sub,e.prototype.mul=function(e){return"number"==typeof e?this.mulS(e):this.mulM(e)},e.prototype.mulS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e);return this},e.prototype.mulM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e.get(t,n));return this},e.mul=function(e,n){return new t(e).mul(n)},e.prototype.multiply=e.prototype.mul,e.prototype.multiplyS=e.prototype.mulS,e.prototype.multiplyM=e.prototype.mulM,e.multiply=e.mul,e.prototype.div=function(e){return"number"==typeof e?this.divS(e):this.divM(e)},e.prototype.divS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)/e);return this},e.prototype.divM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)/e.get(t,n));return this},e.div=function(e,n){return new t(e).div(n)},e.prototype.divide=e.prototype.div,e.prototype.divideS=e.prototype.divS,e.prototype.divideM=e.prototype.divM,e.divide=e.div,e.prototype.mod=function(e){return"number"==typeof e?this.modS(e):this.modM(e)},e.prototype.modS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)%e);return this},e.prototype.modM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)%e.get(t,n));return this},e.mod=function(e,n){return new t(e).mod(n)},e.prototype.modulus=e.prototype.mod,e.prototype.modulusS=e.prototype.modS,e.prototype.modulusM=e.prototype.modM,e.modulus=e.mod,e.prototype.and=function(e){return"number"==typeof e?this.andS(e):this.andM(e)},e.prototype.andS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)&e);return this},e.prototype.andM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)&e.get(t,n));return this},e.and=function(e,n){return new t(e).and(n)},e.prototype.or=function(e){return"number"==typeof e?this.orS(e):this.orM(e)},e.prototype.orS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)|e);return this},e.prototype.orM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)|e.get(t,n));return this},e.or=function(e,n){return new t(e).or(n)},e.prototype.xor=function(e){return"number"==typeof e?this.xorS(e):this.xorM(e)},e.prototype.xorS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)^e);return this},e.prototype.xorM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)^e.get(t,n));return this},e.xor=function(e,n){return new t(e).xor(n)},e.prototype.leftShift=function(e){return"number"==typeof e?this.leftShiftS(e):this.leftShiftM(e)},e.prototype.leftShiftS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)<<e);return this},e.prototype.leftShiftM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)<<e.get(t,n));return this},e.leftShift=function(e,n){return new t(e).leftShift(n)},e.prototype.signPropagatingRightShift=function(e){return"number"==typeof e?this.signPropagatingRightShiftS(e):this.signPropagatingRightShiftM(e)},e.prototype.signPropagatingRightShiftS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)>>e);return this},e.prototype.signPropagatingRightShiftM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)>>e.get(t,n));return this},e.signPropagatingRightShift=function(e,n){return new t(e).signPropagatingRightShift(n)},e.prototype.rightShift=function(e){return"number"==typeof e?this.rightShiftS(e):this.rightShiftM(e)},e.prototype.rightShiftS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)>>>e);return this},e.prototype.rightShiftM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)>>>e.get(t,n));return this},e.rightShift=function(e,n){return new t(e).rightShift(n)},e.prototype.zeroFillRightShift=e.prototype.rightShift,e.prototype.zeroFillRightShiftS=e.prototype.rightShiftS,e.prototype.zeroFillRightShiftM=e.prototype.rightShiftM,e.zeroFillRightShift=e.rightShift,e.prototype.not=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,~this.get(e,t));return this},e.not=function(e){return new t(e).not()},e.prototype.abs=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.abs(this.get(e,t)));return this},e.abs=function(e){return new t(e).abs()},e.prototype.acos=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.acos(this.get(e,t)));return this},e.acos=function(e){return new t(e).acos()},e.prototype.acosh=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.acosh(this.get(e,t)));return this},e.acosh=function(e){return new t(e).acosh()},e.prototype.asin=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.asin(this.get(e,t)));return this},e.asin=function(e){return new t(e).asin()},e.prototype.asinh=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.asinh(this.get(e,t)));return this},e.asinh=function(e){return new t(e).asinh()},e.prototype.atan=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.atan(this.get(e,t)));return this},e.atan=function(e){return new t(e).atan()},e.prototype.atanh=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.atanh(this.get(e,t)));return this},e.atanh=function(e){return new t(e).atanh()},e.prototype.cbrt=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.cbrt(this.get(e,t)));return this},e.cbrt=function(e){return new t(e).cbrt()},e.prototype.ceil=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.ceil(this.get(e,t)));return this},e.ceil=function(e){return new t(e).ceil()},e.prototype.clz32=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.clz32(this.get(e,t)));return this},e.clz32=function(e){return new t(e).clz32()},e.prototype.cos=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.cos(this.get(e,t)));return this},e.cos=function(e){return new t(e).cos()},e.prototype.cosh=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.cosh(this.get(e,t)));return this},e.cosh=function(e){return new t(e).cosh()},e.prototype.exp=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.exp(this.get(e,t)));return this},e.exp=function(e){return new t(e).exp()},e.prototype.expm1=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.expm1(this.get(e,t)));return this},e.expm1=function(e){return new t(e).expm1()},e.prototype.floor=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.floor(this.get(e,t)));return this},e.floor=function(e){return new t(e).floor()},e.prototype.fround=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.fround(this.get(e,t)));return this},e.fround=function(e){return new t(e).fround()},e.prototype.log=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.log(this.get(e,t)));return this},e.log=function(e){return new t(e).log()},e.prototype.log1p=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.log1p(this.get(e,t)));return this},e.log1p=function(e){return new t(e).log1p()},e.prototype.log10=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.log10(this.get(e,t)));return this},e.log10=function(e){return new t(e).log10()},e.prototype.log2=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.log2(this.get(e,t)));return this},e.log2=function(e){return new t(e).log2()},e.prototype.round=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.round(this.get(e,t)));return this},e.round=function(e){return new t(e).round()},e.prototype.sign=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.sign(this.get(e,t)));return this},e.sign=function(e){return new t(e).sign()},e.prototype.sin=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.sin(this.get(e,t)));return this},e.sin=function(e){return new t(e).sin()},e.prototype.sinh=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.sinh(this.get(e,t)));return this},e.sinh=function(e){return new t(e).sinh()},e.prototype.sqrt=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.sqrt(this.get(e,t)));return this},e.sqrt=function(e){return new t(e).sqrt()},e.prototype.tan=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.tan(this.get(e,t)));return this},e.tan=function(e){return new t(e).tan()},e.prototype.tanh=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.tanh(this.get(e,t)));return this},e.tanh=function(e){return new t(e).tanh()},e.prototype.trunc=function(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)this.set(e,t,Math.trunc(this.get(e,t)));return this},e.trunc=function(e){return new t(e).trunc()},e.pow=function(e,n){return new t(e).pow(n)},e.prototype.pow=function(e){return"number"==typeof e?this.powS(e):this.powM(e)},e.prototype.powS=function(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)**e);return this},e.prototype.powM=function(e){if(e=t.checkMatrix(e),this.rows!==e.rows||this.columns!==e.columns)throw new RangeError("Matrices dimensions must be equal");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)**e.get(t,n));return this}}(lp,up);class dp extends lp{#t;get size(){return this.#t.size}get rows(){return this.#t.rows}get columns(){return this.#t.columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(e){return up.isMatrix(e)&&"SymmetricMatrix"===e.klassType}static zeros(e){return new this(e)}static ones(e){return new this(e).fill(1)}constructor(e){if(super(),up.isMatrix(e)){if(!e.isSymmetric())throw new TypeError("not symmetric data");this.#t=up.copy(e,new up(e.rows,e.rows))}else if(Number.isInteger(e)&&e>=0)this.#t=new up(e,e);else if(this.#t=new up(e),!this.isSymmetric())throw new TypeError("not symmetric data")}clone(){const e=new dp(this.diagonalSize);for(const[t,n,i]of this.upperRightEntries())e.set(t,n,i);return e}toMatrix(){return new up(this)}get(e,t){return this.#t.get(e,t)}set(e,t,n){return this.#t.set(e,t,n),this.#t.set(t,e,n),this}removeCross(e){return this.#t.removeRow(e),this.#t.removeColumn(e),this}addCross(e,t){void 0===t&&(t=e,e=this.diagonalSize);const n=t.slice();return n.splice(e,1),this.#t.addRow(e,n),this.#t.addColumn(e,t),this}applyMask(e){if(e.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const t=[];for(const[n,i]of e.entries())i||t.push(n);t.reverse();for(const e of t)this.removeCross(e);return this}toCompact(){const{diagonalSize:e}=this,t=new Array(e*(e+1)/2);for(let n=0,i=0,a=0;a<t.length;a++)t[a]=this.get(i,n),++n>=e&&(n=++i);return t}static fromCompact(e){const t=e.length,n=(Math.sqrt(8*t+1)-1)/2;if(!Number.isInteger(n))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(e)}`);const i=new dp(n);for(let a=0,o=0,s=0;s<t;s++)i.set(a,o,e[s]),++a>=n&&(a=++o);return i}*upperRightEntries(){for(let e=0,t=0;e<this.diagonalSize;void 0){const n=this.get(e,t);yield[e,t,n],++t>=this.diagonalSize&&(t=++e)}}*upperRightValues(){for(let e=0,t=0;e<this.diagonalSize;void 0){const n=this.get(e,t);yield n,++t>=this.diagonalSize&&(t=++e)}}}dp.prototype.klassType="SymmetricMatrix";class mp extends dp{static isDistanceMatrix(e){return dp.isSymmetricMatrix(e)&&"DistanceMatrix"===e.klassSubType}constructor(e){if(super(e),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(e,t,n){return e===t&&(n=0),super.set(e,t,n)}addCross(e,t){return void 0===t&&(t=e,e=this.diagonalSize),(t=t.slice())[e]=0,super.addCross(e,t)}toSymmetricMatrix(){return new dp(this)}clone(){const e=new mp(this.diagonalSize);for(const[t,n,i]of this.upperRightEntries())t!==n&&e.set(t,n,i);return e}toCompact(){const{diagonalSize:e}=this,t=new Array((e-1)*e/2);for(let n=1,i=0,a=0;a<t.length;a++)t[a]=this.get(i,n),++n>=e&&(n=1+ ++i);return t}static fromCompact(e){const t=e.length;if(0===t)return new this(0);const n=(Math.sqrt(8*t+1)+1)/2;if(!Number.isInteger(n))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(e)}`);const i=new this(n);for(let a=1,o=0,s=0;s<t;s++)i.set(a,o,e[s]),++a>=n&&(a=1+ ++o);return i}}mp.prototype.klassSubType="DistanceMatrix";class hp extends lp{constructor(e,t,n){super(),this.matrix=e,this.rows=t,this.columns=n}}class fp extends hp{constructor(e,t,n){ip(e,t),ap(e,n),super(e,t.length,n.length),this.rowIndices=t,this.columnIndices=n}set(e,t,n){return this.matrix.set(this.rowIndices[e],this.columnIndices[t],n),this}get(e,t){return this.matrix.get(this.rowIndices[e],this.columnIndices[t])}}class gp extends lp{constructor(e,t={}){const{rows:n=1}=t;if(e.length%n!=0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=n,this.columns=e.length/n,this.data=e}set(e,t,n){let i=this._calculateIndex(e,t);return this.data[i]=n,this}get(e,t){let n=this._calculateIndex(e,t);return this.data[n]}_calculateIndex(e,t){return e*this.columns+t}}class vp extends lp{constructor(e){super(),this.data=e,this.rows=e.length,this.columns=e[0].length}set(e,t,n){return this.data[e][t]=n,this}get(e,t){return this.data[e][t]}}class bp{constructor(e){let t,n,i,a,o,s,r,c,l,p=(e=vp.checkMatrix(e)).clone(),u=p.rows,d=p.columns,m=new Float64Array(u),h=1;for(t=0;t<u;t++)m[t]=t;for(c=new Float64Array(u),n=0;n<d;n++){for(t=0;t<u;t++)c[t]=p.get(t,n);for(t=0;t<u;t++){for(l=Math.min(t,n),o=0,i=0;i<l;i++)o+=p.get(t,i)*c[i];c[t]-=o,p.set(t,n,c[t])}for(a=n,t=n+1;t<u;t++)Math.abs(c[t])>Math.abs(c[a])&&(a=t);if(a!==n){for(i=0;i<d;i++)s=p.get(a,i),p.set(a,i,p.get(n,i)),p.set(n,i,s);r=m[a],m[a]=m[n],m[n]=r,h=-h}if(n<u&&0!==p.get(n,n))for(t=n+1;t<u;t++)p.set(t,n,p.get(t,n)/p.get(n,n))}this.LU=p,this.pivotVector=m,this.pivotSign=h}isSingular(){let e=this.LU,t=e.columns;for(let n=0;n<t;n++)if(0===e.get(n,n))return!0;return!1}solve(e){e=up.checkMatrix(e);let t=this.LU;if(t.rows!==e.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let n,i,a,o=e.columns,s=e.subMatrixRow(this.pivotVector,0,o-1),r=t.columns;for(a=0;a<r;a++)for(n=a+1;n<r;n++)for(i=0;i<o;i++)s.set(n,i,s.get(n,i)-s.get(a,i)*t.get(n,a));for(a=r-1;a>=0;a--){for(i=0;i<o;i++)s.set(a,i,s.get(a,i)/t.get(a,a));for(n=0;n<a;n++)for(i=0;i<o;i++)s.set(n,i,s.get(n,i)-s.get(a,i)*t.get(n,a))}return s}get determinant(){let e=this.LU;if(!e.isSquare())throw new Error("Matrix must be square");let t=this.pivotSign,n=e.columns;for(let i=0;i<n;i++)t*=e.get(i,i);return t}get lowerTriangularMatrix(){let e=this.LU,t=e.rows,n=e.columns,i=new up(t,n);for(let a=0;a<t;a++)for(let t=0;t<n;t++)a>t?i.set(a,t,e.get(a,t)):a===t?i.set(a,t,1):i.set(a,t,0);return i}get upperTriangularMatrix(){let e=this.LU,t=e.rows,n=e.columns,i=new up(t,n);for(let a=0;a<t;a++)for(let t=0;t<n;t++)a<=t?i.set(a,t,e.get(a,t)):i.set(a,t,0);return i}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function xp(e,t){let n=0;return Math.abs(e)>Math.abs(t)?(n=t/e,Math.abs(e)*Math.sqrt(1+n*n)):0!==t?(n=e/t,Math.abs(t)*Math.sqrt(1+n*n)):0}class yp{constructor(e){let t,n,i,a,o=(e=vp.checkMatrix(e)).clone(),s=e.rows,r=e.columns,c=new Float64Array(r);for(i=0;i<r;i++){let e=0;for(t=i;t<s;t++)e=xp(e,o.get(t,i));if(0!==e){for(o.get(i,i)<0&&(e=-e),t=i;t<s;t++)o.set(t,i,o.get(t,i)/e);for(o.set(i,i,o.get(i,i)+1),n=i+1;n<r;n++){for(a=0,t=i;t<s;t++)a+=o.get(t,i)*o.get(t,n);for(a=-a/o.get(i,i),t=i;t<s;t++)o.set(t,n,o.get(t,n)+a*o.get(t,i))}}c[i]=-e}this.QR=o,this.Rdiag=c}solve(e){e=up.checkMatrix(e);let t=this.QR,n=t.rows;if(e.rows!==n)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let i,a,o,s,r=e.columns,c=e.clone(),l=t.columns;for(o=0;o<l;o++)for(a=0;a<r;a++){for(s=0,i=o;i<n;i++)s+=t.get(i,o)*c.get(i,a);for(s=-s/t.get(o,o),i=o;i<n;i++)c.set(i,a,c.get(i,a)+s*t.get(i,o))}for(o=l-1;o>=0;o--){for(a=0;a<r;a++)c.set(o,a,c.get(o,a)/this.Rdiag[o]);for(i=0;i<o;i++)for(a=0;a<r;a++)c.set(i,a,c.get(i,a)-c.get(o,a)*t.get(i,o))}return c.subMatrix(0,l-1,0,r-1)}isFullRank(){let e=this.QR.columns;for(let t=0;t<e;t++)if(0===this.Rdiag[t])return!1;return!0}get upperTriangularMatrix(){let e,t,n=this.QR,i=n.columns,a=new up(i,i);for(e=0;e<i;e++)for(t=0;t<i;t++)e<t?a.set(e,t,n.get(e,t)):e===t?a.set(e,t,this.Rdiag[e]):a.set(e,t,0);return a}get orthogonalMatrix(){let e,t,n,i,a=this.QR,o=a.rows,s=a.columns,r=new up(o,s);for(n=s-1;n>=0;n--){for(e=0;e<o;e++)r.set(e,n,0);for(r.set(n,n,1),t=n;t<s;t++)if(0!==a.get(n,n)){for(i=0,e=n;e<o;e++)i+=a.get(e,n)*r.get(e,t);for(i=-i/a.get(n,n),e=n;e<o;e++)r.set(e,t,r.get(e,t)+i*a.get(e,n))}}return r}}class wp{constructor(e,t={}){if((e=vp.checkMatrix(e)).isEmpty())throw new Error("Matrix must be non-empty");let n=e.rows,i=e.columns;const{computeLeftSingularVectors:a=!0,computeRightSingularVectors:o=!0,autoTranspose:s=!1}=t;let r,c=Boolean(a),l=Boolean(o),p=!1;if(n<i)if(s){r=e.transpose(),n=r.rows,i=r.columns,p=!0;let t=c;c=l,l=t}else r=e.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else r=e.clone();let u=Math.min(n,i),d=Math.min(n+1,i),m=new Float64Array(d),h=new up(n,u),f=new up(i,i),g=new Float64Array(i),v=new Float64Array(n),b=new Float64Array(d);for(let e=0;e<d;e++)b[e]=e;let x=Math.min(n-1,i),y=Math.max(0,Math.min(i-2,n)),w=Math.max(x,y);for(let e=0;e<w;e++){if(e<x){m[e]=0;for(let t=e;t<n;t++)m[e]=xp(m[e],r.get(t,e));if(0!==m[e]){r.get(e,e)<0&&(m[e]=-m[e]);for(let t=e;t<n;t++)r.set(t,e,r.get(t,e)/m[e]);r.set(e,e,r.get(e,e)+1)}m[e]=-m[e]}for(let t=e+1;t<i;t++){if(e<x&&0!==m[e]){let i=0;for(let a=e;a<n;a++)i+=r.get(a,e)*r.get(a,t);i=-i/r.get(e,e);for(let a=e;a<n;a++)r.set(a,t,r.get(a,t)+i*r.get(a,e))}g[t]=r.get(e,t)}if(c&&e<x)for(let t=e;t<n;t++)h.set(t,e,r.get(t,e));if(e<y){g[e]=0;for(let t=e+1;t<i;t++)g[e]=xp(g[e],g[t]);if(0!==g[e]){g[e+1]<0&&(g[e]=0-g[e]);for(let t=e+1;t<i;t++)g[t]/=g[e];g[e+1]+=1}if(g[e]=-g[e],e+1<n&&0!==g[e]){for(let t=e+1;t<n;t++)v[t]=0;for(let t=e+1;t<n;t++)for(let n=e+1;n<i;n++)v[t]+=g[n]*r.get(t,n);for(let t=e+1;t<i;t++){let i=-g[t]/g[e+1];for(let a=e+1;a<n;a++)r.set(a,t,r.get(a,t)+i*v[a])}}if(l)for(let t=e+1;t<i;t++)f.set(t,e,g[t])}}let k=Math.min(i,n+1);if(x<i&&(m[x]=r.get(x,x)),n<k&&(m[k-1]=0),y+1<k&&(g[y]=r.get(y,k-1)),g[k-1]=0,c){for(let e=x;e<u;e++){for(let t=0;t<n;t++)h.set(t,e,0);h.set(e,e,1)}for(let e=x-1;e>=0;e--)if(0!==m[e]){for(let t=e+1;t<u;t++){let i=0;for(let a=e;a<n;a++)i+=h.get(a,e)*h.get(a,t);i=-i/h.get(e,e);for(let a=e;a<n;a++)h.set(a,t,h.get(a,t)+i*h.get(a,e))}for(let t=e;t<n;t++)h.set(t,e,-h.get(t,e));h.set(e,e,1+h.get(e,e));for(let t=0;t<e-1;t++)h.set(t,e,0)}else{for(let t=0;t<n;t++)h.set(t,e,0);h.set(e,e,1)}}if(l)for(let e=i-1;e>=0;e--){if(e<y&&0!==g[e])for(let t=e+1;t<i;t++){let n=0;for(let a=e+1;a<i;a++)n+=f.get(a,e)*f.get(a,t);n=-n/f.get(e+1,e);for(let a=e+1;a<i;a++)f.set(a,t,f.get(a,t)+n*f.get(a,e))}for(let t=0;t<i;t++)f.set(t,e,0);f.set(e,e,1)}let _=k-1,j=Number.EPSILON;for(;k>0;){let e,t;for(e=k-2;e>=-1&&-1!==e;e--){const t=Number.MIN_VALUE+j*Math.abs(m[e]+Math.abs(m[e+1]));if(Math.abs(g[e])<=t||Number.isNaN(g[e])){g[e]=0;break}}if(e===k-2)t=4;else{let n;for(n=k-1;n>=e&&n!==e;n--){let t=(n!==k?Math.abs(g[n]):0)+(n!==e+1?Math.abs(g[n-1]):0);if(Math.abs(m[n])<=j*t){m[n]=0;break}}n===e?t=3:n===k-1?t=1:(t=2,e=n)}switch(e++,t){case 1:{let t=g[k-2];g[k-2]=0;for(let n=k-2;n>=e;n--){let a=xp(m[n],t),o=m[n]/a,s=t/a;if(m[n]=a,n!==e&&(t=-s*g[n-1],g[n-1]=o*g[n-1]),l)for(let e=0;e<i;e++)a=o*f.get(e,n)+s*f.get(e,k-1),f.set(e,k-1,-s*f.get(e,n)+o*f.get(e,k-1)),f.set(e,n,a)}break}case 2:{let t=g[e-1];g[e-1]=0;for(let i=e;i<k;i++){let a=xp(m[i],t),o=m[i]/a,s=t/a;if(m[i]=a,t=-s*g[i],g[i]=o*g[i],c)for(let t=0;t<n;t++)a=o*h.get(t,i)+s*h.get(t,e-1),h.set(t,e-1,-s*h.get(t,i)+o*h.get(t,e-1)),h.set(t,i,a)}break}case 3:{const t=Math.max(Math.abs(m[k-1]),Math.abs(m[k-2]),Math.abs(g[k-2]),Math.abs(m[e]),Math.abs(g[e])),a=m[k-1]/t,o=m[k-2]/t,s=g[k-2]/t,r=m[e]/t,p=g[e]/t,u=((o+a)*(o-a)+s*s)/2,d=a*s*(a*s);let v=0;0===u&&0===d||(v=u<0?0-Math.sqrt(u*u+d):Math.sqrt(u*u+d),v=d/(u+v));let b=(r+a)*(r-a)+v,x=r*p;for(let t=e;t<k-1;t++){let a=xp(b,x);0===a&&(a=Number.MIN_VALUE);let o=b/a,s=x/a;if(t!==e&&(g[t-1]=a),b=o*m[t]+s*g[t],g[t]=o*g[t]-s*m[t],x=s*m[t+1],m[t+1]=o*m[t+1],l)for(let e=0;e<i;e++)a=o*f.get(e,t)+s*f.get(e,t+1),f.set(e,t+1,-s*f.get(e,t)+o*f.get(e,t+1)),f.set(e,t,a);if(a=xp(b,x),0===a&&(a=Number.MIN_VALUE),o=b/a,s=x/a,m[t]=a,b=o*g[t]+s*m[t+1],m[t+1]=-s*g[t]+o*m[t+1],x=s*g[t+1],g[t+1]=o*g[t+1],c&&t<n-1)for(let e=0;e<n;e++)a=o*h.get(e,t)+s*h.get(e,t+1),h.set(e,t+1,-s*h.get(e,t)+o*h.get(e,t+1)),h.set(e,t,a)}g[k-2]=b;break}case 4:if(m[e]<=0&&(m[e]=m[e]<0?-m[e]:0,l))for(let t=0;t<=_;t++)f.set(t,e,-f.get(t,e));for(;e<_&&!(m[e]>=m[e+1]);){let t=m[e];if(m[e]=m[e+1],m[e+1]=t,l&&e<i-1)for(let n=0;n<i;n++)t=f.get(n,e+1),f.set(n,e+1,f.get(n,e)),f.set(n,e,t);if(c&&e<n-1)for(let i=0;i<n;i++)t=h.get(i,e+1),h.set(i,e+1,h.get(i,e)),h.set(i,e,t);e++}k--}}if(p){let e=f;f=h,h=e}this.m=n,this.n=i,this.s=m,this.U=h,this.V=f}solve(e){let t=e,n=this.threshold,i=this.s.length,a=up.zeros(i,i);for(let e=0;e<i;e++)Math.abs(this.s[e])<=n?a.set(e,e,0):a.set(e,e,1/this.s[e]);let o=this.U,s=this.rightSingularVectors,r=s.mmul(a),c=s.rows,l=o.rows,p=up.zeros(c,l);for(let e=0;e<c;e++)for(let t=0;t<l;t++){let n=0;for(let a=0;a<i;a++)n+=r.get(e,a)*o.get(t,a);p.set(e,t,n)}return p.mmul(t)}solveForDiagonal(e){return this.solve(up.diag(e))}inverse(){let e=this.V,t=this.threshold,n=e.rows,i=e.columns,a=new up(n,this.s.length);for(let o=0;o<n;o++)for(let n=0;n<i;n++)Math.abs(this.s[n])>t&&a.set(o,n,e.get(o,n)/this.s[n]);let o=this.U,s=o.rows,r=o.columns,c=new up(n,s);for(let e=0;e<n;e++)for(let t=0;t<s;t++){let n=0;for(let i=0;i<r;i++)n+=a.get(e,i)*o.get(t,i);c.set(e,t,n)}return c}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let e=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,t=0,n=this.s;for(let i=0,a=n.length;i<a;i++)n[i]>e&&t++;return t}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return up.diag(this.s)}}function kp(e,t,n=!1){return e=vp.checkMatrix(e),t=vp.checkMatrix(t),n?new wp(e).solve(t):e.isSquare()?new bp(e).solve(t):new yp(e).solve(t)}function _p(e,t){let n=[];for(let i=0;i<e;i++)i!==t&&n.push(i);return n}function jp(e,t,n,i=1e-9,a=1e-9){if(e>a)return new Array(t.rows+1).fill(0);{let e=t.addRow(n,[0]);for(let t=0;t<e.rows;t++)Math.abs(e.get(t,0))<i&&e.set(t,0,0);return e.to1DArray()}}class Cp{constructor(e,t={}){const{assumeSymmetric:n=!1}=t;if(!(e=vp.checkMatrix(e)).isSquare())throw new Error("Matrix is not a square matrix");if(e.isEmpty())throw new Error("Matrix must be non-empty");let i,a,o=e.columns,s=new up(o,o),r=new Float64Array(o),c=new Float64Array(o),l=e,p=!1;if(p=!!n||e.isSymmetric(),p){for(i=0;i<o;i++)for(a=0;a<o;a++)s.set(i,a,l.get(i,a));!function(e,t,n,i){let a,o,s,r,c,l,p,u;for(c=0;c<e;c++)n[c]=i.get(e-1,c);for(r=e-1;r>0;r--){for(u=0,s=0,l=0;l<r;l++)u+=Math.abs(n[l]);if(0===u)for(t[r]=n[r-1],c=0;c<r;c++)n[c]=i.get(r-1,c),i.set(r,c,0),i.set(c,r,0);else{for(l=0;l<r;l++)n[l]/=u,s+=n[l]*n[l];for(a=n[r-1],o=Math.sqrt(s),a>0&&(o=-o),t[r]=u*o,s-=a*o,n[r-1]=a-o,c=0;c<r;c++)t[c]=0;for(c=0;c<r;c++){for(a=n[c],i.set(c,r,a),o=t[c]+i.get(c,c)*a,l=c+1;l<=r-1;l++)o+=i.get(l,c)*n[l],t[l]+=i.get(l,c)*a;t[c]=o}for(a=0,c=0;c<r;c++)t[c]/=s,a+=t[c]*n[c];for(p=a/(s+s),c=0;c<r;c++)t[c]-=p*n[c];for(c=0;c<r;c++){for(a=n[c],o=t[c],l=c;l<=r-1;l++)i.set(l,c,i.get(l,c)-(a*t[l]+o*n[l]));n[c]=i.get(r-1,c),i.set(r,c,0)}}n[r]=s}for(r=0;r<e-1;r++){if(i.set(e-1,r,i.get(r,r)),i.set(r,r,1),s=n[r+1],0!==s){for(l=0;l<=r;l++)n[l]=i.get(l,r+1)/s;for(c=0;c<=r;c++){for(o=0,l=0;l<=r;l++)o+=i.get(l,r+1)*i.get(l,c);for(l=0;l<=r;l++)i.set(l,c,i.get(l,c)-o*n[l])}}for(l=0;l<=r;l++)i.set(l,r+1,0)}for(c=0;c<e;c++)n[c]=i.get(e-1,c),i.set(e-1,c,0);i.set(e-1,e-1,1),t[0]=0}(o,c,r,s),function(e,t,n,i){let a,o,s,r,c,l,p,u,d,m,h,f,g,v,b,x;for(s=1;s<e;s++)t[s-1]=t[s];t[e-1]=0;let y=0,w=0,k=Number.EPSILON;for(l=0;l<e;l++){for(w=Math.max(w,Math.abs(n[l])+Math.abs(t[l])),p=l;p<e&&!(Math.abs(t[p])<=k*w);)p++;if(p>l)do{for(a=n[l],u=(n[l+1]-a)/(2*t[l]),d=xp(u,1),u<0&&(d=-d),n[l]=t[l]/(u+d),n[l+1]=t[l]*(u+d),m=n[l+1],o=a-n[l],s=l+2;s<e;s++)n[s]-=o;for(y+=o,u=n[p],h=1,f=h,g=h,v=t[l+1],b=0,x=0,s=p-1;s>=l;s--)for(g=f,f=h,x=b,a=h*t[s],o=h*u,d=xp(u,t[s]),t[s+1]=b*d,b=t[s]/d,h=u/d,u=h*n[s]-b*a,n[s+1]=o+b*(h*a+b*n[s]),c=0;c<e;c++)o=i.get(c,s+1),i.set(c,s+1,b*i.get(c,s)+h*o),i.set(c,s,h*i.get(c,s)-b*o);u=-b*x*g*v*t[l]/m,t[l]=b*u,n[l]=h*u}while(Math.abs(t[l])>k*w);n[l]=n[l]+y,t[l]=0}for(s=0;s<e-1;s++){for(c=s,u=n[s],r=s+1;r<e;r++)n[r]<u&&(c=r,u=n[r]);if(c!==s)for(n[c]=n[s],n[s]=u,r=0;r<e;r++)u=i.get(r,s),i.set(r,s,i.get(r,c)),i.set(r,c,u)}}(o,c,r,s)}else{let e=new up(o,o),t=new Float64Array(o);for(a=0;a<o;a++)for(i=0;i<o;i++)e.set(i,a,l.get(i,a));!function(e,t,n,i){let a,o,s,r,c,l,p,u=0,d=e-1;for(l=u+1;l<=d-1;l++){for(p=0,r=l;r<=d;r++)p+=Math.abs(t.get(r,l-1));if(0!==p){for(s=0,r=d;r>=l;r--)n[r]=t.get(r,l-1)/p,s+=n[r]*n[r];for(o=Math.sqrt(s),n[l]>0&&(o=-o),s-=n[l]*o,n[l]=n[l]-o,c=l;c<e;c++){for(a=0,r=d;r>=l;r--)a+=n[r]*t.get(r,c);for(a/=s,r=l;r<=d;r++)t.set(r,c,t.get(r,c)-a*n[r])}for(r=0;r<=d;r++){for(a=0,c=d;c>=l;c--)a+=n[c]*t.get(r,c);for(a/=s,c=l;c<=d;c++)t.set(r,c,t.get(r,c)-a*n[c])}n[l]=p*n[l],t.set(l,l-1,p*o)}}for(r=0;r<e;r++)for(c=0;c<e;c++)i.set(r,c,r===c?1:0);for(l=d-1;l>=u+1;l--)if(0!==t.get(l,l-1)){for(r=l+1;r<=d;r++)n[r]=t.get(r,l-1);for(c=l;c<=d;c++){for(o=0,r=l;r<=d;r++)o+=n[r]*i.get(r,c);for(o=o/n[l]/t.get(l,l-1),r=l;r<=d;r++)i.set(r,c,i.get(r,c)+o*n[r])}}}(o,e,t,s),function(e,t,n,i,a){let o,s,r,c,l,p,u,d,m,h,f,g,v,b,x,y=e-1,w=0,k=e-1,_=Number.EPSILON,j=0,C=0,S=0,E=0,T=0,M=0,O=0,A=0;for(o=0;o<e;o++)for((o<w||o>k)&&(n[o]=a.get(o,o),t[o]=0),s=Math.max(o-1,0);s<e;s++)C+=Math.abs(a.get(o,s));for(;y>=w;){for(c=y;c>w&&(M=Math.abs(a.get(c-1,c-1))+Math.abs(a.get(c,c)),0===M&&(M=C),!(Math.abs(a.get(c,c-1))<_*M));)c--;if(c===y)a.set(y,y,a.get(y,y)+j),n[y]=a.get(y,y),t[y]=0,y--,A=0;else if(c===y-1){if(u=a.get(y,y-1)*a.get(y-1,y),S=(a.get(y-1,y-1)-a.get(y,y))/2,E=S*S+u,O=Math.sqrt(Math.abs(E)),a.set(y,y,a.get(y,y)+j),a.set(y-1,y-1,a.get(y-1,y-1)+j),d=a.get(y,y),E>=0){for(O=S>=0?S+O:S-O,n[y-1]=d+O,n[y]=n[y-1],0!==O&&(n[y]=d-u/O),t[y-1]=0,t[y]=0,d=a.get(y,y-1),M=Math.abs(d)+Math.abs(O),S=d/M,E=O/M,T=Math.sqrt(S*S+E*E),S/=T,E/=T,s=y-1;s<e;s++)O=a.get(y-1,s),a.set(y-1,s,E*O+S*a.get(y,s)),a.set(y,s,E*a.get(y,s)-S*O);for(o=0;o<=y;o++)O=a.get(o,y-1),a.set(o,y-1,E*O+S*a.get(o,y)),a.set(o,y,E*a.get(o,y)-S*O);for(o=w;o<=k;o++)O=i.get(o,y-1),i.set(o,y-1,E*O+S*i.get(o,y)),i.set(o,y,E*i.get(o,y)-S*O)}else n[y-1]=d+S,n[y]=d+S,t[y-1]=O,t[y]=-O;y-=2,A=0}else{if(d=a.get(y,y),m=0,u=0,c<y&&(m=a.get(y-1,y-1),u=a.get(y,y-1)*a.get(y-1,y)),10===A){for(j+=d,o=w;o<=y;o++)a.set(o,o,a.get(o,o)-d);M=Math.abs(a.get(y,y-1))+Math.abs(a.get(y-1,y-2)),d=m=.75*M,u=-.4375*M*M}if(30===A&&(M=(m-d)/2,M=M*M+u,M>0)){for(M=Math.sqrt(M),m<d&&(M=-M),M=d-u/((m-d)/2+M),o=w;o<=y;o++)a.set(o,o,a.get(o,o)-M);j+=M,d=m=u=.964}for(A+=1,l=y-2;l>=c&&(O=a.get(l,l),T=d-O,M=m-O,S=(T*M-u)/a.get(l+1,l)+a.get(l,l+1),E=a.get(l+1,l+1)-O-T-M,T=a.get(l+2,l+1),M=Math.abs(S)+Math.abs(E)+Math.abs(T),S/=M,E/=M,T/=M,l!==c)&&!(Math.abs(a.get(l,l-1))*(Math.abs(E)+Math.abs(T))<_*(Math.abs(S)*(Math.abs(a.get(l-1,l-1))+Math.abs(O)+Math.abs(a.get(l+1,l+1)))));)l--;for(o=l+2;o<=y;o++)a.set(o,o-2,0),o>l+2&&a.set(o,o-3,0);for(r=l;r<=y-1&&(b=r!==y-1,r!==l&&(S=a.get(r,r-1),E=a.get(r+1,r-1),T=b?a.get(r+2,r-1):0,d=Math.abs(S)+Math.abs(E)+Math.abs(T),0!==d&&(S/=d,E/=d,T/=d)),0!==d);r++)if(M=Math.sqrt(S*S+E*E+T*T),S<0&&(M=-M),0!==M){for(r!==l?a.set(r,r-1,-M*d):c!==l&&a.set(r,r-1,-a.get(r,r-1)),S+=M,d=S/M,m=E/M,O=T/M,E/=S,T/=S,s=r;s<e;s++)S=a.get(r,s)+E*a.get(r+1,s),b&&(S+=T*a.get(r+2,s),a.set(r+2,s,a.get(r+2,s)-S*O)),a.set(r,s,a.get(r,s)-S*d),a.set(r+1,s,a.get(r+1,s)-S*m);for(o=0;o<=Math.min(y,r+3);o++)S=d*a.get(o,r)+m*a.get(o,r+1),b&&(S+=O*a.get(o,r+2),a.set(o,r+2,a.get(o,r+2)-S*T)),a.set(o,r,a.get(o,r)-S),a.set(o,r+1,a.get(o,r+1)-S*E);for(o=w;o<=k;o++)S=d*i.get(o,r)+m*i.get(o,r+1),b&&(S+=O*i.get(o,r+2),i.set(o,r+2,i.get(o,r+2)-S*T)),i.set(o,r,i.get(o,r)-S),i.set(o,r+1,i.get(o,r+1)-S*E)}}}if(0===C)return;for(y=e-1;y>=0;y--)if(S=n[y],E=t[y],0===E)for(c=y,a.set(y,y,1),o=y-1;o>=0;o--){for(u=a.get(o,o)-S,T=0,s=c;s<=y;s++)T+=a.get(o,s)*a.get(s,y);if(t[o]<0)O=u,M=T;else if(c=o,0===t[o]?a.set(o,y,0!==u?-T/u:-T/(_*C)):(d=a.get(o,o+1),m=a.get(o+1,o),E=(n[o]-S)*(n[o]-S)+t[o]*t[o],p=(d*M-O*T)/E,a.set(o,y,p),a.set(o+1,y,Math.abs(d)>Math.abs(O)?(-T-u*p)/d:(-M-m*p)/O)),p=Math.abs(a.get(o,y)),_*p*p>1)for(s=o;s<=y;s++)a.set(s,y,a.get(s,y)/p)}else if(E<0)for(c=y-1,Math.abs(a.get(y,y-1))>Math.abs(a.get(y-1,y))?(a.set(y-1,y-1,E/a.get(y,y-1)),a.set(y-1,y,-(a.get(y,y)-S)/a.get(y,y-1))):(x=Sp(0,-a.get(y-1,y),a.get(y-1,y-1)-S,E),a.set(y-1,y-1,x[0]),a.set(y-1,y,x[1])),a.set(y,y-1,0),a.set(y,y,1),o=y-2;o>=0;o--){for(h=0,f=0,s=c;s<=y;s++)h+=a.get(o,s)*a.get(s,y-1),f+=a.get(o,s)*a.get(s,y);if(u=a.get(o,o)-S,t[o]<0)O=u,T=h,M=f;else if(c=o,0===t[o]?(x=Sp(-h,-f,u,E),a.set(o,y-1,x[0]),a.set(o,y,x[1])):(d=a.get(o,o+1),m=a.get(o+1,o),g=(n[o]-S)*(n[o]-S)+t[o]*t[o]-E*E,v=2*(n[o]-S)*E,0===g&&0===v&&(g=_*C*(Math.abs(u)+Math.abs(E)+Math.abs(d)+Math.abs(m)+Math.abs(O))),x=Sp(d*T-O*h+E*f,d*M-O*f-E*h,g,v),a.set(o,y-1,x[0]),a.set(o,y,x[1]),Math.abs(d)>Math.abs(O)+Math.abs(E)?(a.set(o+1,y-1,(-h-u*a.get(o,y-1)+E*a.get(o,y))/d),a.set(o+1,y,(-f-u*a.get(o,y)-E*a.get(o,y-1))/d)):(x=Sp(-T-m*a.get(o,y-1),-M-m*a.get(o,y),O,E),a.set(o+1,y-1,x[0]),a.set(o+1,y,x[1]))),p=Math.max(Math.abs(a.get(o,y-1)),Math.abs(a.get(o,y))),_*p*p>1)for(s=o;s<=y;s++)a.set(s,y-1,a.get(s,y-1)/p),a.set(s,y,a.get(s,y)/p)}for(o=0;o<e;o++)if(o<w||o>k)for(s=o;s<e;s++)i.set(o,s,a.get(o,s));for(s=e-1;s>=w;s--)for(o=w;o<=k;o++){for(O=0,r=w;r<=Math.min(s,k);r++)O+=i.get(o,r)*a.get(r,s);i.set(o,s,O)}}(o,c,r,s,e)}this.n=o,this.e=c,this.d=r,this.V=s}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let e,t,n=this.n,i=this.e,a=this.d,o=new up(n,n);for(e=0;e<n;e++){for(t=0;t<n;t++)o.set(e,t,0);o.set(e,e,a[e]),i[e]>0?o.set(e,e+1,i[e]):i[e]<0&&o.set(e,e-1,i[e])}return o}}function Sp(e,t,n,i){let a,o;return Math.abs(n)>Math.abs(i)?(a=i/n,o=n+a*i,[(e+a*t)/o,(t-a*e)/o]):(a=n/i,o=i+a*n,[(a*e+t)/o,(a*t-e)/o])}class Ep{constructor(e){if(!(e=vp.checkMatrix(e)).isSymmetric())throw new Error("Matrix is not symmetric");let t,n,i,a=e,o=a.rows,s=new up(o,o),r=!0;for(n=0;n<o;n++){let e=0;for(i=0;i<n;i++){let o=0;for(t=0;t<i;t++)o+=s.get(i,t)*s.get(n,t);o=(a.get(n,i)-o)/s.get(i,i),s.set(n,i,o),e+=o*o}for(e=a.get(n,n)-e,r&=e>0,s.set(n,n,Math.sqrt(Math.max(e,0))),i=n+1;i<o;i++)s.set(n,i,0)}this.L=s,this.positiveDefinite=Boolean(r)}isPositiveDefinite(){return this.positiveDefinite}solve(e){e=vp.checkMatrix(e);let t=this.L,n=t.rows;if(e.rows!==n)throw new Error("Matrix dimensions do not match");if(!1===this.isPositiveDefinite())throw new Error("Matrix is not positive definite");let i,a,o,s=e.columns,r=e.clone();for(o=0;o<n;o++)for(a=0;a<s;a++){for(i=0;i<o;i++)r.set(o,a,r.get(o,a)-r.get(i,a)*t.get(o,i));r.set(o,a,r.get(o,a)/t.get(o,o))}for(o=n-1;o>=0;o--)for(a=0;a<s;a++){for(i=o+1;i<n;i++)r.set(o,a,r.get(o,a)-r.get(i,a)*t.get(i,o));r.set(o,a,r.get(o,a)/t.get(o,o))}return r}get lowerTriangularMatrix(){return this.L}}class Tp{constructor(e,t={}){e=vp.checkMatrix(e);let{Y:n}=t;const{scaleScores:i=!1,maxIterations:a=1e3,terminationCriteria:o=1e-10}=t;let s;if(n){if(n=$l.isAnyArray(n)&&"number"==typeof n[0]?up.columnVector(n):vp.checkMatrix(n),n.rows!==e.rows)throw new Error("Y should have the same number of rows as X");s=n.getColumnVector(0)}else s=e.getColumnVector(0);let r,c,l,p,u=1;for(let t=0;t<a&&u>o;t++)l=e.transpose().mmul(s).div(s.transpose().mmul(s).get(0,0)),l=l.div(l.norm()),r=e.mmul(l).div(l.transpose().mmul(l).get(0,0)),t>0&&(u=r.clone().sub(p).pow(2).sum()),p=r.clone(),n?(c=n.transpose().mmul(r).div(r.transpose().mmul(r).get(0,0)),c=c.div(c.norm()),s=n.mmul(c).div(c.transpose().mmul(c).get(0,0))):s=r;if(n){let t=e.transpose().mmul(r).div(r.transpose().mmul(r).get(0,0));t=t.div(t.norm());let i=e.clone().sub(r.clone().mmul(t.transpose())),a=s.transpose().mmul(r).div(r.transpose().mmul(r).get(0,0)),o=n.clone().sub(r.clone().mulS(a.get(0,0)).mmul(c.transpose()));this.t=r,this.p=t.transpose(),this.w=l.transpose(),this.q=c,this.u=s,this.s=r.transpose().mmul(r),this.xResidual=i,this.yResidual=o,this.betas=a}else this.w=l.transpose(),this.s=r.transpose().mmul(r).sqrt(),this.t=i?r.clone().div(this.s.get(0,0)):r,this.xResidual=e.sub(r.mmul(l.transpose()))}}zl.AbstractMatrix=lp,zl.CHO=Ep,zl.CholeskyDecomposition=Ep,zl.DistanceMatrix=mp,zl.EVD=Cp,zl.EigenvalueDecomposition=Cp,zl.LU=bp,zl.LuDecomposition=bp;var Mp=zl.Matrix=up;zl.MatrixColumnSelectionView=class extends hp{constructor(e,t){ap(e,t),super(e,e.rows,t.length),this.columnIndices=t}set(e,t,n){return this.matrix.set(e,this.columnIndices[t],n),this}get(e,t){return this.matrix.get(e,this.columnIndices[t])}},zl.MatrixColumnView=class extends hp{constructor(e,t){ep(e,t),super(e,e.rows,1),this.column=t}set(e,t,n){return this.matrix.set(e,this.column,n),this}get(e){return this.matrix.get(e,this.column)}},zl.MatrixFlipColumnView=class extends hp{constructor(e){super(e,e.rows,e.columns)}set(e,t,n){return this.matrix.set(e,this.columns-t-1,n),this}get(e,t){return this.matrix.get(e,this.columns-t-1)}},zl.MatrixFlipRowView=class extends hp{constructor(e){super(e,e.rows,e.columns)}set(e,t,n){return this.matrix.set(this.rows-e-1,t,n),this}get(e,t){return this.matrix.get(this.rows-e-1,t)}},zl.MatrixRowSelectionView=class extends hp{constructor(e,t){ip(e,t),super(e,t.length,e.columns),this.rowIndices=t}set(e,t,n){return this.matrix.set(this.rowIndices[e],t,n),this}get(e,t){return this.matrix.get(this.rowIndices[e],t)}},zl.MatrixRowView=class extends hp{constructor(e,t){Zl(e,t),super(e,1,e.columns),this.row=t}set(e,t,n){return this.matrix.set(this.row,t,n),this}get(e,t){return this.matrix.get(this.row,t)}},zl.MatrixSelectionView=fp,zl.MatrixSubView=class extends hp{constructor(e,t,n,i,a){op(e,t,n,i,a),super(e,n-t+1,a-i+1),this.startRow=t,this.startColumn=i}set(e,t,n){return this.matrix.set(this.startRow+e,this.startColumn+t,n),this}get(e,t){return this.matrix.get(this.startRow+e,this.startColumn+t)}};var Op=zl.MatrixTransposeView=class extends hp{constructor(e){super(e,e.columns,e.rows)}set(e,t,n){return this.matrix.set(t,e,n),this}get(e,t){return this.matrix.get(t,e)}};zl.NIPALS=Tp,zl.Nipals=Tp,zl.QR=yp,zl.QrDecomposition=yp,zl.SVD=wp,zl.SingularValueDecomposition=wp,zl.SymmetricMatrix=dp,zl.WrapperMatrix1D=gp,zl.WrapperMatrix2D=vp,zl.correlation=function(e,t=e,n={}){e=new up(e);let i=!1;if("object"!=typeof t||up.isMatrix(t)||$l.isAnyArray(t)?t=new up(t):(n=t,t=e,i=!0),e.rows!==t.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:a=!0,scale:o=!0}=n;a&&(e.center("column"),i||t.center("column")),o&&(e.scale("column"),i||t.scale("column"));const s=e.standardDeviation("column",{unbiased:!0}),r=i?s:t.standardDeviation("column",{unbiased:!0}),c=e.transpose().mmul(t);for(let t=0;t<c.rows;t++)for(let n=0;n<c.columns;n++)c.set(t,n,c.get(t,n)*(1/(s[t]*r[n]))*(1/(e.rows-1)));return c},zl.covariance=function(e,t=e,n={}){e=new up(e);let i=!1;if("object"!=typeof t||up.isMatrix(t)||$l.isAnyArray(t)?t=new up(t):(n=t,t=e,i=!0),e.rows!==t.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:a=!0}=n;a&&(e=e.center("column"),i||(t=t.center("column")));const o=e.transpose().mmul(t);for(let t=0;t<o.rows;t++)for(let n=0;n<o.columns;n++)o.set(t,n,o.get(t,n)*(1/(e.rows-1)));return o};var Ap=zl.default=up;zl.determinant=function e(t){if((t=up.checkMatrix(t)).isSquare()){if(0===t.columns)return 1;let n,i,a,o;if(2===t.columns)return n=t.get(0,0),i=t.get(0,1),a=t.get(1,0),o=t.get(1,1),n*o-i*a;if(3===t.columns){let o,s,r;return o=new fp(t,[1,2],[1,2]),s=new fp(t,[1,2],[0,2]),r=new fp(t,[1,2],[0,1]),n=t.get(0,0),i=t.get(0,1),a=t.get(0,2),n*e(o)-i*e(s)+a*e(r)}return new bp(t).determinant}throw Error("determinant can only be calculated for a square matrix")},zl.inverse=function(e,t=!1){return e=vp.checkMatrix(e),t?new wp(e).inverse():kp(e,up.eye(e.rows))},zl.linearDependencies=function(e,t={}){const{thresholdValue:n=1e-9,thresholdError:i=1e-9}=t;let a=(e=up.checkMatrix(e)).rows,o=new up(a,a);for(let t=0;t<a;t++){let s=up.columnVector(e.getRow(t)),r=e.subMatrixRow(_p(a,t)).transpose(),c=new wp(r).solve(s),l=up.sub(s,r.mmul(c)).abs().max();o.setRow(t,jp(l,c,t,n,i))}return o},zl.pseudoInverse=function(e,t=Number.EPSILON){if((e=up.checkMatrix(e)).isEmpty())return e.transpose();let n=new wp(e,{autoTranspose:!0}),i=n.leftSingularVectors,a=n.rightSingularVectors,o=n.diagonal;for(let e=0;e<o.length;e++)Math.abs(o[e])>t?o[e]=1/o[e]:o[e]=0;return a.mmul(up.diag(o).mmul(i.transpose()))};var Ip=zl.solve=kp;zl.wrap=function(e,t){if($l.isAnyArray(e))return e[0]&&$l.isAnyArray(e[0])?new vp(e):new gp(e,t);throw new Error("the argument is not an array")};const Pp=Mp,Rp=Op;Ap.Matrix&&Ap.Matrix;const Lp=Ip;function Np(e,t){if(!Bl(e)||!Bl(t))throw new TypeError("x and y must be arrays");if(e.length!==t.length)throw new RangeError("x and y arrays must have the same length")}class Dp{constructor(){if(new.target===Dp)throw new Error("BaseRegression must be subclassed")}predict(e){if("number"==typeof e)return this._predict(e);if(Bl(e)){const t=[];for(const n of e)t.push(this._predict(n));return t}throw new TypeError("x must be a number or array")}_predict(e){throw new Error("_predict must be implemented")}train(){}toString(e){return""}toLaTeX(e){return""}score(e,t){Np(e,t);const n=e.length,i=new Array(n);for(let t=0;t<n;t++)i[t]=this._predict(e[t]);let a=0,o=0,s=0,r=0,c=0,l=0,p=0;for(let e=0;e<n;e++)a+=i[e],o+=t[e],c+=i[e]*i[e],l+=t[e]*t[e],p+=i[e]*t[e],0!==t[e]&&(s+=(t[e]-i[e])*(t[e]-i[e])/t[e]),r+=(t[e]-i[e])*(t[e]-i[e]);const u=(n*p-a*o)/Math.sqrt((n*c-a*a)*(n*l-o*o));return{r:u,r2:u*u,chi2:s,rmsd:Math.sqrt(r/n)}}}function qp(e,t){return e<0?(e=0-e,"number"==typeof t?`- ${e.toPrecision(t)}`:`- ${e.toString()}`):"number"==typeof t?e.toPrecision(t):e.toString()}class Fp extends Dp{constructor(e,t,n,i={}){if(super(),!0===e)this.degree=t.degree,this.powers=t.powers,this.coefficients=t.coefficients;else{Np(e,t);const a=function(e,t,n,i={}){const a=e.length;let{interceptAtZero:o=!1}=i,s=[];if(Array.isArray(n))s=n,o=!1;else if("number"==typeof n)if(o){s=new Array(n);for(let e=0;e<n;e++)s[e]=e+1}else{s=new Array(n+1);for(let e=0;e<=n;e++)s[e]=e}const r=s.length,c=new Pp(a,r),l=new Pp([t]);for(let t=0;t<r;t++)for(let n=0;n<a;n++)0===s[t]?c.set(n,t,1):c.set(n,t,e[n]**s[t]);const p=new Rp(c),u=p.mmul(c),d=p.mmul(new Rp(l));return{coefficients:Lp(u,d).to1DArray(),degree:Math.max(...s),powers:s}}(e,t,n,i);this.degree=a.degree,this.powers=a.powers,this.coefficients=a.coefficients}}_predict(e){let t=0;for(let n=0;n<this.powers.length;n++)t+=this.coefficients[n]*e**this.powers[n];return t}toJSON(){return{name:"polynomialRegression",degree:this.degree,powers:this.powers,coefficients:this.coefficients}}toString(e){return this._toFormula(e,!1)}toLaTeX(e){return this._toFormula(e,!0)}_toFormula(e,t){let n="^",i="",a=" * ";t&&(n="^{",i="}",a="");let o="",s="";for(let t=0;t<this.coefficients.length;t++)s="",0!==this.coefficients[t]&&(s=0===this.powers[t]?qp(this.coefficients[t],e):1===this.powers[t]?`${qp(this.coefficients[t],e)+a}x`:`${qp(this.coefficients[t],e)+a}x${n}${this.powers[t]}${i}`,this.coefficients[t]>0&&t!==this.coefficients.length-1?s=` + ${s}`:t!==this.coefficients.length-1&&(s=` ${s}`)),o=s+o;return o.startsWith("+")&&(o=o.slice(1)),`f(x) = ${o}`}static load(e){if("polynomialRegression"!==e.name)throw new TypeError("not a polynomial regression model");return new Fp(!0,e)}}async function zp(e){var t=new Worker(new URL("worker.bbd9d6a2.js",import.meta.url),{type:"module"});window.myWorker=t;var n='<!doctype html>\n<html lang="en">\n <head>\n <link\n href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"\n rel="stylesheet"\n integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"\n crossorigin="anonymous"\n />\n <meta charset="UTF-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <script src="https://cdn.jsdelivr.net/npm/onnxjs/dist/onnx.min.js"><\/script>\n </head>\n\n <style>\n body {\n margin: 0;\n min-height: 100vh; /* Ensure body takes the full viewport height */\n display: flex; /* Enable Flexbox */\n justify-content: center; /* Center content horizontally */\n align-items: center; /* Center content vertically */\n font-family: sans-serif;\n }\n\n stim {\n position: absolute;\n height: auto;\n cursor: pointer;\n }\n\n #instruction {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n\n #confirmContainer {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n\n #stimulus {\n position: absolute;\n width: 25px;\n height: 25px;\n background-color: #1e90ff;\n border-radius: 50%;\n display: block; /* Initially hidden */\n transform: translate(-50%, -50%);\n }\n\n #headCanvas {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n #canvas-container {\n position: relative;\n width: 300px;\n height: 300px;\n top: 30px;\n margin: 0 auto;\n }\n </style>\n\n <body>\n \x3c!-- Center Instructions Panel --\x3e\n <div id="calibrationContentArea">\n <div class="row gap-2" id="instruction">\n <div class="col">\n <div class="card" style="width: 45rem; height: 39rem">\n <div class="card-body" style="text-align: center">\n <h3 class="card-title" id="calibrationTitle">\n <b> Calibration Phase </b>\n </h3>\n <h4 class="card-text">Now, we need to calibrate our systems.</h4>\n <h4 class="card-text" id="calibrationDescription"></h4>\n <div style="text-align: center; margin-bottom: 3vh">\n <img\n id="calibrationImage"\n src="https://eyetrackingdata.blob.core.windows.net/public/Images/squareAddition_white.png"\n width="350px"\n />\n </div>\n <div class="btn-group" role="group" aria-label="Basic example">\n <button\n type="button"\n class="btn btn-primary"\n id="startTestButton"\n onclick="startTest()"\n >\n Start\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div id="stimulus"></div>\n <div id="canvas-container" style="display: none">\n <canvas\n id="headCanvas"\n class="frame"\n style="position: relative; display: none"\n ></canvas>\n </div>\n\n \x3c!-- Confirm Button --\x3e\n <div class="row gap-2" id="confirmContainer" style="display: none">\n <div class="card-body" style="text-align: center">\n <h3>Calibration complete!</h3>\n <button type="button" class="btn btn-primary" id="confirmButton">\n Continue\n </button>\n </div>\n </div>\n\n <div class="panel-block" style="display: block" ;>\n <video class="inputVideo" style="display: none"></video>\n </div>\n\n <audio autoplay id="voiceover"></audio>\n\n <script data-dynamic>\n voiceover = document.getElementById("voiceover");\n document.body.addEventListener("click", function () {\n voiceover.pause();\n voiceover.currentTime = 0; // Stop the voiceover whenever a click is detected\n });\n\n // ----------- required -------------------\n function runAfterEveryFrame(output) {\n if (recordEyeMovements) {\n _gridCoordinates.push({\n x: parseFloat(stimulus.style.left),\n y: parseFloat(stimulus.style.top),\n });\n _eyeCoordinates.push({\n x: output.output.cpuData[0] * 100 - 50,\n y: output.output.cpuData[1] * 100,\n });\n _calibrationData.push(calibrationData);\n let time = new Date().getTime();\n _timeData.push(time);\n }\n }\n\n function pageCompleted() {\n continueProcessing = false;\n recordEyeMovements = false;\n const event = new Event("pageComplete");\n document.dispatchEvent(event);\n }\n\n var recordEyeMovements = false;\n var calibrationData = 1;\n var continueProcessing = true;\n\n var deviceConfig = store.session.get("deviceConfig");\n var _gridCoordinates = [];\n var _parentDir = store.session.get("id");\n var _videoURL = "";\n\n var IMAGE_SIZE = 640;\n var upperbound_x = 96;\n var lowerbound_x = 2;\n var upperbound_y = 96;\n var lowerbound_y = 2;\n var stimulus = document.getElementById("stimulus");\n var x = 0;\n var y = 0;\n var counter = 0;\n var incX = 0.15 * 2;\n var incY = 0.02 * 2;\n var timeArray = [];\n var xArray = [];\n var yArray = [];\n var _eyeCoordinates = [];\n var _calibrationData = [];\n var _timeData = [];\n var fixationStimulus_x = [30, 50, 70];\n var fixationStimulus_y = [20, 40, 60];\n\n async function startTest() {\n await runInference();\n openFullscreen();\n updateCountdown(initStimulus);\n }\n\n async function initStimulus() {\n document.getElementById("stimulus").style.display = "block";\n await startRecording();\n recordEyeMovements = true;\n moveStimulus();\n }\n\n async function moveStimulus() {\n counter = counter + 1;\n if (x > upperbound_x) {\n incX = -0.15 * 2;\n } else if (x < lowerbound_x) {\n incX = 0.15 * 2;\n }\n\n if (y > upperbound_y) {\n incY = -0.02 * 2;\n } else if (y < lowerbound_y) {\n incY = 0.02 * 2;\n }\n x = x + incX;\n y = y + incY;\n let time = new Date().getTime();\n\n timeArray.push(time);\n xArray.push(x);\n yArray.push(y);\n\n stimulus.style.left = `${x}%`; // Adjust for half of the cell width\n stimulus.style.top = `${y}%`; // Adjust for half of the cell height\n\n if (y < 75) {\n setTimeout(moveStimulus, 10);\n } else {\n calibrationData = 0;\n\n await stopRecording();\n pageCompleted();\n // setTimeout(fixationStimulus, 10);\n }\n }\n\n async function fixationStimulus() {\n for (let x of fixationStimulus_x) {\n for (let y of fixationStimulus_y) {\n let time = new Date().getTime();\n timeArray.push(time);\n xArray.push(x);\n yArray.push(y);\n\n stimulus.style.left = `${x}%`; // Adjust for half of the cell width\n stimulus.style.top = `${y}%`; // Adjust for half of the cell height\n\n // Wait for 4 seconds before moving to the next position\n await new Promise((resolve) => setTimeout(resolve, 4000));\n }\n }\n\n await stopRecording();\n pageCompleted();\n }\n <\/script>\n </body>\n</html>\n';"short"===e.firekit.task.variantParams.calibrationType&&(n='<!doctype html>\n<html lang="en">\n <head>\n <link\n href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"\n rel="stylesheet"\n integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"\n crossorigin="anonymous"\n />\n <meta charset="UTF-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <script src="https://cdn.jsdelivr.net/npm/onnxjs/dist/onnx.min.js"><\/script>\n </head>\n\n <style>\n body {\n margin: 0;\n min-height: 100vh; /* Ensure body takes the full viewport height */\n display: flex; /* Enable Flexbox */\n justify-content: center; /* Center content horizontally */\n align-items: center; /* Center content vertically */\n font-family: sans-serif;\n }\n\n\n\n stim {\n position: absolute;\n height: auto;\n cursor: pointer;\n }\n\n #instruction {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n\n #confirmContainer {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n\n #stimulus {\n position: absolute;\n animation: pulsate 1s infinite;\n width: 25px;\n height: 25px;\n background-color: #1e90ff;\n border-radius: 50%;\n display: block; /* Initially hidden */\n transform: translate(-50%, -50%);\n }\n\n #headCanvas {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n #canvas-container {\n position: relative;\n width: 300px;\n height: 300px;\n top: 30px;\n margin: 0 auto;\n }\n\n @keyframes pulsate {\n 0% {\n transform: scale(1) translate(-50%, -50%);\n }\n 50% {\n transform: scale(1.2) translate(-50%, -50%);\n }\n 100% {\n transform: scale(1) translate(-50%, -50%);\n }\n\n}\n\n </style>\n\n <body>\n \x3c!-- Center Instructions Panel --\x3e\n <div id="calibrationContentArea">\n <div class="row gap-2" id="instruction">\n <div class="col">\n <div class="card" style="width: 45rem; height: 39rem">\n <div class="card-body" style="text-align: center">\n <h3 class="card-title" id="calibrationTitle">\n <b> Calibration Phase </b>\n </h3>\n <h4 class="card-text">Now, we need to calibrate our systems.</h4>\n <h4 class="card-text" id="calibrationDescription"></h4>\n <div style="text-align: center; margin-bottom: 3vh">\n <img\n id="calibrationImage"\n src="https://eyetrackingdata.blob.core.windows.net/public/Images/squareAddition_white.png"\n width="350px"\n />\n </div>\n <div class="btn-group" role="group" aria-label="Basic example">\n <button\n type="button"\n class="btn btn-primary"\n id="startTestButton"\n onclick="startTest()"\n >\n Start\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div id="stimulus" class="pulsating-disc"></div>\n <div id="canvas-container" style="display: none">\n <canvas\n id="headCanvas"\n class="frame"\n style="position: relative; display: none"\n ></canvas>\n </div>\n\n \x3c!-- Confirm Button --\x3e\n <div class="row gap-2" id="confirmContainer" style="display: none">\n <div class="card-body" style="text-align: center">\n <h3>Calibration complete!</h3>\n <button type="button" class="btn btn-primary" id="confirmButton">\n Continue\n </button>\n </div>\n </div>\n\n <div class="panel-block" style="display: block" ;>\n <video class="inputVideo" style="display: none"></video>\n </div>\n\n <audio autoplay id="voiceover"></audio>\n\n <script data-dynamic>\n voiceover = document.getElementById("voiceover");\n document.body.addEventListener("click", function () {\n voiceover.pause();\n voiceover.currentTime = 0; // Stop the voiceover whenever a click is detected\n });\n\n // ----------- required -------------------\n function runAfterEveryFrame(output) {\n if (recordEyeMovements) {\n _gridCoordinates.push({\n x: parseFloat(stimulus.style.left),\n y: parseFloat(stimulus.style.top),\n });\n _eyeCoordinates.push({\n x: output.output.cpuData[0] * 100 - 50,\n y: output.output.cpuData[1] * 100,\n });\n _calibrationData.push(calibrationData);\n let time = new Date().getTime();\n _timeData.push(time);\n }\n }\n\n function pageCompleted() {\n continueProcessing = false;\n recordEyeMovements = false;\n const event = new Event("pageComplete");\n document.dispatchEvent(event);\n }\n\n var current_viewingDistance= 0\n var recordEyeMovements = false;\n var calibrationData = 1;\n var continueProcessing = true;\n\n var deviceConfig = store.session.get("deviceConfig");\n var _gridCoordinates = [];\n var _parentDir = store.session.get("id");\n var _videoURL = "";\n\n var IMAGE_SIZE = 640;\n var upperbound_x = 96;\n var lowerbound_x = 2;\n var upperbound_y = 96;\n var lowerbound_y = 2;\n var stimulus = document.getElementById("stimulus");\n var x = 0;\n var y = 0;\n var counter = 0;\n var incX = 0.15 * 2;\n var incY = 0.02 * 2;\n var timeArray = [];\n var xArray = [];\n var yArray = [];\n var _eyeCoordinates = [];\n var _calibrationData = [];\n var _timeData = [];\n var fixationStimulus_x = [30, 50, 70];\n var fixationStimulus_y = [20, 40, 60];\n\n async function startTest() {\n await runInference();\n openFullscreen();\n updateCountdown(initStimulus);\n }\n\n async function initStimulus() {\n document.getElementById("stimulus").style.display = "block";\n await startRecording();\n recordEyeMovements = true;\n moveStimulus();\n }\n\n\n // Define the locations with repetition to cover 3 seconds at 10ms intervals\n var locations = [\n { x: 25, y: 25 }, // Location 1 (25,25)\n { x: 75, y: 25 }, // Location 2 (25,25)\n { x: 25, y: 65 }, // Location 3 (25,25)\n { x: 75, y: 65 }, // Location 4 (25,25)\n { x: 50, y: 50 } // Location 5 (25,50)\n ];\n\n // Create an array that repeats each location enough times to cover 3 seconds at 10ms intervals\n var sequence = [];\n locations.forEach(loc => {\n for (let i = 0; i < 200; i++) { // 300 * 10ms = 3000ms = 3 seconds\n sequence.push(loc);\n }\n });\n\n\n async function moveStimulus() {\n if (counter < sequence.length) {\n let point = document.getElementById(\'point\');\n stimulus.style.left = `${sequence[counter].x}%`; // Adjust for half of the cell width\n stimulus.style.top = `${sequence[counter].y}%`; // Adjust for half of the cell height\n counter++;\n // Only append to arrays if more than 500ms has passed\n if (counter % 200 > 50) { \n let time = new Date().getTime();\n timeArray.push(time);\n xArray.push(sequence[counter].x); // Use the current x value from the sequence\n yArray.push(sequence[counter].y); // Use the current y value from the sequence\n }\n setTimeout(moveStimulus, 10); // Call this function every 10ms\n } else {\n calibrationData = 0;\n await stopRecording();\n pageCompleted();\n }\n }\n\n\n // async function moveStimulus() {\n // counter = counter + 1;\n // if (x > upperbound_x) {\n // incX = -0.15 * 2;\n // } else if (x < lowerbound_x) {\n // incX = 0.15 * 2;\n // }\n\n // if (y > upperbound_y) {\n // incY = -0.02 * 2;\n // } else if (y < lowerbound_y) {\n // incY = 0.02 * 2;\n // }\n // x = x + incX;\n // y = y + incY;\n // let time = new Date().getTime();\n\n // timeArray.push(time);\n // xArray.push(x);\n // yArray.push(y);\n\n // stimulus.style.left = `${x}%`; // Adjust for half of the cell width\n // stimulus.style.top = `${y}%`; // Adjust for half of the cell height\n\n // if (y < 75) {\n // setTimeout(moveStimulus, 10);\n // } else {\n // calibrationData = 0;\n\n // await stopRecording();\n // pageCompleted();\n // // setTimeout(fixationStimulus, 10);\n // }\n // }\n\n async function fixationStimulus() {\n for (let x of fixationStimulus_x) {\n for (let y of fixationStimulus_y) {\n let time = new Date().getTime();\n timeArray.push(time);\n xArray.push(x);\n yArray.push(y);\n\n stimulus.style.left = `${x}%`; // Adjust for half of the cell width\n stimulus.style.top = `${y}%`; // Adjust for half of the cell height\n\n // Wait for 4 seconds before moving to the next position\n await new Promise((resolve) => setTimeout(resolve, 4000));\n }\n }\n\n await stopRecording();\n pageCompleted();\n }\n <\/script>\n </body>\n</html>\n');const i=document.createElement("div");i.innerHTML='<script src="https://cdn.jsdelivr.net/npm/@mediapipe/face_mesh@0.4/face_mesh.min.js"><\/script>\n\n<script data-dynamic>\n var irisMetrics;\n var headMetrics;\n var headCoordinates;\n var leftEyeCoordinates;\n var rightEyeCoordinates;\n var movingContour;\n var fixedContour;\n var canvasContour;\n var focalLengthMultiple;\n var headMetrics_array = [];\n var irisMetrics_array = [];\n var videoRecorder;\n var videoChunks = [];\n var leftEyectx;\n var rightEyectx;\n var normalizedFocalLength;\n var blueCircle;\n\n var inputVideo = document.getElementsByClassName("inputVideo")[0];\n var headCanvas = document.getElementById("headCanvas");\n var headCtx = headCanvas.getContext("2d");\n\n var faceMesh = new FaceMesh({\n locateFile: (file) => {\n return `https://cdn.jsdelivr.net/npm/@mediapipe/face_mesh@0.4/${file}`;\n },\n });\n\n faceMesh.setOptions({\n selfieMode: true,\n enableFaceGeometry: false,\n maxNumFaces: 1,\n refineLandmarks: true,\n minDetectionConfidence: 0.5,\n minTrackingConfidence: 0.5,\n });\n\n faceMesh.onResults(onResultsFaceMesh);\n\n async function runInference() {\n await faceMesh.send({ image: inputVideo });\n try {\n if (!leftEyeCoordinates || !rightEyeCoordinates) {\n throw new Error("No face detected");\n }\n let input1, input2, kpsTensor;\n let [upper_left_x, upper_left_y, width, height] = convertToYolo(\n leftEyeCoordinates,\n inputVideo.videoWidth,\n inputVideo.videoHeight,\n );\n let kps = [\n upper_left_x / inputVideo.videoWidth,\n upper_left_y / inputVideo.videoHeight,\n width / inputVideo.videoWidth,\n height / inputVideo.videoHeight,\n ];\n\n leftEyectx.drawImage(\n inputVideo,\n Math.max(0, inputVideo.videoWidth - upper_left_x - width),\n Math.max(0, upper_left_y),\n Math.max(0, width),\n Math.max(0, height),\n 0,\n 0,\n 128,\n 128,\n );\n\n [upper_left_x, upper_left_y, width, height] = convertToYolo(\n rightEyeCoordinates,\n inputVideo.videoWidth,\n inputVideo.videoHeight,\n );\n kps.push(\n upper_left_x / inputVideo.videoWidth,\n upper_left_y / inputVideo.videoHeight,\n width / inputVideo.videoWidth,\n height / inputVideo.videoHeight,\n );\n rightEyectx.drawImage(\n inputVideo,\n Math.max(0, inputVideo.videoWidth - upper_left_x - width),\n Math.max(0, upper_left_y),\n Math.max(0, width),\n Math.max(0, height),\n 0,\n 0,\n 128,\n 128,\n );\n\n imageData = leftEyectx.getImageData(0, 0, 128, 128);\n let preprocessedData = preprocess(imageData.data, 128, 128);\n input1 = new Tensor(preprocessedData, "float32", [1, 3, 128, 128]);\n imageData = rightEyectx.getImageData(0, 0, 128, 128);\n preprocessedData = preprocess(imageData.data, 128, 128);\n input2 = new Tensor(preprocessedData, "float32", [1, 3, 128, 128]);\n preprocessedData = preprocess_kps(kps);\n kpsTensor = new Tensor(preprocessedData, "float32", [1, 8]);\n\n myWorker.postMessage({\n input1: input1,\n input2: input2,\n kpsTensor: kpsTensor,\n });\n } catch (error) {\n setTimeout(runInference, 50);\n }\n }\n\n myWorker.onmessage = async (e) => {\n if (e.data.error) {\n console.error("Error from worker:", e.data.error);\n } else {\n runAfterEveryFrame((output = e.data));\n }\n\n if (continueProcessing) {\n runInference();\n }\n };\n<\/script>\n';const a=document.createElement("div");a.style.position="fixed",a.style.top="0",a.style.left="0",a.style.width="100%",a.style.height="100%",await Vp(Fl),await Vp(Rl),a.innerHTML=n;const o=Vc;document.body.appendChild(a),await Up(a),await Up(i),Hp(i),Hp(a),async function(e){var t=document.getElementById("voiceover");t.src="https://eyetrackingdata.blob.core.windows.net/public/Audios/calibration.mp3",t.play(),document.getElementById("calibrationTitle").innerHTML="<b>Calibration Phase</b>",document.getElementById("calibrationDescription").innerHTML="You will see a blue disc pop up on the screen. Follow it with your eyes <b>without</b> moving your head.";var n=document.getElementById("calibrationImage");n.src="https://eyetrackingdata.blob.core.windows.net/public/Images/eyecalibration.gif","short"===e.firekit.task.variantParams.calibrationType&&(n.src="https://eyetrackingdata.blob.core.windows.net/public/Images/eyecalibration_short.gif");initEyeTracking(!1),await giveAccess()}(e),await new Promise((t=>{document.addEventListener("pageComplete",(async()=>{var n;a.innerHTML=o,(n=a).style.position="",n.style.top="",n.style.left="",n.style.width="",n.style.height="";const i=function(e,t){const n=new Fp(e.map((e=>e.x)),t.map((e=>e.x)),1),i=new Fp(e.map((e=>e.y)),t.map((e=>e.y)),1);return{x_regressor:n.coefficients,y_regressor:i.coefficients}}(_eyeCoordinates.filter(((e,t)=>1==_calibrationData[t])),_gridCoordinates.filter(((e,t)=>1==_calibrationData[t])));!function(e){s.session.set("x_coef",e.x_regressor[1]),s.session.set("x_intercept",e.x_regressor[0]),s.session.set("y_coef",e.y_regressor[1]),s.session.set("y_intercept",e.y_regressor[0])}(i),await async function(e){console.log("Test Finished");const t=(new Date).getTime();var n="RAN_eyeCalibration_"+e.toString()+"_"+t+".webm";_videoURL=n;try{await saveRecordings(n,s.session.get("id"))}catch(e){console.error("Error in saveRecordings:",e)}}(50);const r={assessment_type:"RAN",assessment_stage:"eyeCalibration",recordedVideo:_videoURL,distance:50,regressors:i,stimulusPosition:_gridCoordinates,eyeCoordinates:_eyeCoordinates,calibrationData:_calibrationData,_timeData:_timeData,parentDir:s.session.get("id"),deviceConfig:s.session.get("deviceConfig"),participantConfig:s.session.get("participantConfig"),correct:1};e.firekit.writeTrial(r),Bp(Fl),Bp(Rl),a.remove(),document.querySelectorAll("script[data-dynamic]").forEach((e=>e.parentNode.removeChild(e))),t()}),{once:!0})}))}async function Vp(e){Object.keys(e).forEach((t=>{window[t]=e[t]}))}function Bp(e){Object.keys(e).forEach((e=>{const t=Object.getOwnPropertyDescriptor(window,e);t&&t.configurable?delete window[e]:console.log(`Cannot remove ${e} from window; it may be non-configurable.`)}))}async function Up(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=t[e];n.src&&await Wp(n.src)}}function Hp(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=document.createElement("script");n.text=t[e].text,document.head.appendChild(n).parentNode.removeChild(n)}}function Wp(e){return new Promise(((t,n)=>{const i=document.createElement("script");i.src=e,i.onload=t,i.onerror=n,document.head.appendChild(i)}))}window.store=s;async function $p(e,t){const n=document.createElement("div");n.innerHTML='<!DOCTYPE html>\n<html lang="en">\n<head>\n <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n</head>\n\n<style>\n \n body {\n margin: 0;\n min-height: 100vh; /* Ensure body takes the full viewport height */\n display: flex; /* Enable Flexbox */\n justify-content: center; /* Center content horizontally */\n align-items: center; /* Center content vertically */\n font-family: sans-serif;\n overflow: hidden;\n }\n\n .character {\n position: absolute;\n top: 65%;\n left: 70%;\n margin-right: -50%;\n transform: translate(-50%, -50%);\n width: 45%;\n }\n\n .speechBubble {\n border-style: solid;\n border-width: 5px;\n border-color: rgb(255, 232, 128);\n border-radius: 10px;\n text-align: center;\n padding: 5vh;\n background-color: rgb(253 246 234);\n }\n\n stim {\n position: absolute;\n height: auto;\n cursor: pointer;\n }\n\n #instruction {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n \n #confirmContainer {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n \n </style>\n\n\n<body>\n\n \x3c!-- Center Instructions Panel --\x3e\n <div id="storyContentArea">\n <img id="bg" style="object-fit: contain; position: relative;">\n <img id="char" class="character">\n <div style="position: absolute; top: 40%; right: 50%;">\n <h4 class="speechBubble" id="text"> </h4>\n </div>\n </div>\n\n \x3c!-- Audio Playing --\x3e \n <audio id="voiceover"> </audio>\n \n </body>\n\n<script data-dynamic>\n\n var counter = 0;\n\n var testConfig = store.session.get(\'testConfig\');\n\n document.body.addEventListener(\'click\', function() {\n startNextView(); // Call startNextView function whenever a click is detected \n });\n\n document.getElementById(\'voiceover\').addEventListener(\'ended\', function() {\n voiceover.currentTime = 0; // Added this so the story will automatically progress once the audio ends, not only dependent on participant clicks\n startNextView();\n })\n\n if (testConfig[\'testname\'] === \'Letter\') {\n var calibrationText = "Ah! I think my navigation system broke <br> on the way here. Could you help me fix it? </br>"\n var practiceText = "Awesome! Thank you for calibrating my <br> navigation system. We can practice reading out the </br> letter directions to Rantopia now."\n var testText = "Perfect! Let\'s enter them for real. <br> Can you read me the letter directions </br> as fast as you can?"\n var testLower = "letter";\n } else {\n var calibrationText = "Darn, the radar is completely broken. <br> Let\'s fix it together! </br>"\n var practiceText = "You are an expert engineer! <br> We can practice reading out </br> the number coordinates to Rantopia now."\n var testText = "Amazing! Let\'s enter them for real. <br> Can you read me the number coordinates </br> as fast as you can?"\n var testLower = "number";\n }\n\n function startNextView() {\n counter++;\n var char = document.getElementById(\'char\');\n var bg = document.getElementById(\'bg\');\n var text = document.getElementById(\'text\');\n var voiceover = document.getElementById(\'voiceover\');\n\n if (stage === "Introduction"){\n console.log(stage, counter);\n switch (counter) {\n case 1:\n char.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/astronaut-girl-default.png`;\n bg.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/space-ship-control.png`;\n voiceover.src = `https://eyetrackingdata.blob.core.windows.net/public/Audios/intro.mp3`;\n text.innerHTML = `Hi! My name is Stella. <br> It\'s always great to meet a fellow astronaut. </br>`;\n break;\n case 2:\n char.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/astronaut-girl-panicked.png`;\n bg.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/space-ship-control.png`;\n voiceover.src = `https://eyetrackingdata.blob.core.windows.net/public/Audios/intro2.mp3`;\n text.innerHTML = `I was doing some errands for my mom, <br> but then I got lost. </br> She\'s probably so worried about me!`;\n break;\n case 3:\n char.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/astronaut-girl-unsure.png`;\n bg.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/space-ship-control.png`;\n voiceover.src = `https://eyetrackingdata.blob.core.windows.net/public/Audios/intro3.mp3`;\n text.innerHTML = `Could you help me calibrate my <br> navigation system so I can get to Rantopia? </br>`;\n break;\n default:\n // Reset or end\n counter = 0; \n pageCompleted()\n }\n } else if (stage === "Calibration") {\n console.log(stage, counter);\n switch (counter) {\n case 1:\n char.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/astronaut-girl-confused.png`;\n bg.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/space-ship-control.png`;\n voiceover.src = `https://eyetrackingdata.blob.core.windows.net/public/Audios/${testLower}StoryCalibration.mp3`;\n text.innerHTML = calibrationText;\n break;\n default:\n // Reset or end\n counter = 0; \n pageCompleted()\n }\n } else if (stage === "Practice"){\n console.log(stage, counter);\n switch (counter) {\n case 1:\n char.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/astronaut-girl-smile.png`;\n bg.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/space-ship-control.png`;\n voiceover.src = `https://eyetrackingdata.blob.core.windows.net/public/Audios/${testLower}StoryPractice.mp3`;\n text.innerHTML = practiceText;\n break;\n default:\n // Reset or end\n counter = 0; \n pageCompleted()\n }\n } else if (stage === "Test"){\n console.log(stage, counter);\n switch (counter) {\n case 1:\n char.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/astronaut-girl-smile.png`;\n bg.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/purple-planet.png`;\n voiceover.src = `https://eyetrackingdata.blob.core.windows.net/public/Audios/${testLower}StoryTest.mp3`;\n text.innerHTML = testText;\n break;\n default:\n // Reset or end\n counter = 0; \n pageCompleted()\n }\n } else if (stage === "Ending"){\n console.log(stage, counter);\n switch (counter) {\n case 1:\n char.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/astronaut-girl-happy.png`;\n bg.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/orange-planet.png`;\n voiceover.src = `https://eyetrackingdata.blob.core.windows.net/public/Audios/end.mp3`;\n text.innerHTML = `We made it to Rantopia! <br> I can finish grabbing all </br> the things I need for my mom.`;\n break;\n case 2:\n char.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/astronaut-girl-bye.png`;\n bg.src = `https://eyetrackingdata.blob.core.windows.net/public/Images/orange-planet.png`;\n voiceover.src = `https://eyetrackingdata.blob.core.windows.net/public/Audios/end2.mp3`;\n text.innerHTML = `I couldn’t have done this <br> without your help. </br> Come visit me again sometime!`;\n break;\n default:\n // Reset or end\n counter = 0; \n pageCompleted()\n }\n }\n\n // playing the voiceover \n if (voiceover.src !== ""){\n voiceover.play(); \n }\n\n }\n\n function pageCompleted(){\n const event = new Event(\'pageComplete\');\n document.dispatchEvent(event);\n }\n \n <\/script>',document.body.appendChild(n),window.stage=e,await async function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=t[e];n.src&&await Kp(n.src)}}(n),function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=document.createElement("script");n.text=t[e].text,document.head.appendChild(n).parentNode.removeChild(n)}}(n),startNextView(),await new Promise((e=>{document.addEventListener("pageComplete",(()=>{n.remove(),function(){e=document.body,t=e.cloneNode(!0),e.parentNode.replaceChild(t,e);var e,t;document.querySelectorAll("script[data-dynamic]").forEach((e=>{(e.textContent||e.innerText).includes("voiceover.addEventListener('ended'")||e.parentNode.removeChild(e)}))}(),e()}),{once:!0})}))}function Kp(e){return new Promise(((t,n)=>{const i=document.createElement("script");i.src=e,i.onload=t,i.onerror=n,document.head.appendChild(i)}))}window.store=s;async function Yp(e){window.tests_url=e;const t=document.createElement("div");t.innerHTML="\x3c!-- Scripts --\x3e\n<link href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css\" rel=\"stylesheet\" integrity=\"sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3\" crossorigin=\"anonymous\">\n\n\x3c!-- CSS --\x3e\n<style>\n\nbody {\n margin: 0;\n}\n\n .column {\n float: left;\n padding: 10px;\n}\n\n.left, .right {\n width: 33%;\n}\n\n.middle {\n width: 33%;\n}\n\n.row:after {\n content: \"\";\n display: table;\n clear: both;\n}\n\n</style>\n\n\x3c!-- HTML --\x3e\n<body id=\"body\">\n <div class=\"px-4 py-5 my-5 text-center\" style=\"display: block;\">\n <h1 class=\"display-5 fw-bold\" id=\"title\"> Activity Selection Menu </h1>\n <div class=\"col-lg-6 mx-auto\">\n <p class=\"lead mt-3 mb-5\"></p>\n <h4 class=\"card-text\"> Select an activity. Click on one of the options below to continue with the activity: </h4>\n <div class=\"row gap-2\" id=\"menuButtons\">\n </div>\n </div>\n </div>\n\n \x3c!-- Audio Playing --\x3e \n <audio autoplay src=\"https://eyetrackingdata.blob.core.windows.net/public/Audios/activityMenu.mp3\"> </audio>\n\n</body>\n\n<script data-dynamic>\n\ndocument.body.addEventListener('click', function() {\n voiceover.pause();\n voiceover.currentTime = 0;; // Stop the voiceover whenever a click is detected \n});\n\n // var jsonUrl = 'https://eyetrackingdata.blob.core.windows.net/public/config/tests.json';\n\n fetch(tests_url)\n .then(response => response.json())\n .then(data => {\n // Extract test names from the JSON data\n const testNames = Object.keys(data);\n // Create buttons dynamically based on test names\n const menuButtonsContainer = document.getElementById('menuButtons');\n const clickedTests = store.session.get('clickedTests') || [];\n testNames.forEach(testName => {\n console.log(testName)\n console.log(data[testName])\n\n const button = document.createElement('button');\n button.type = 'button';\n button.id = `button_${testName}`; \n button.className = 'btn btn-primary';\n button.textContent = testName;\n\n if (clickedTests.includes(testName)) {\n button.classList.add('btn-secondary'); // Grayish color\n button.disabled = true\n }\n\n button.addEventListener('click', () => {\n console.log(`CLICKED ${testName}`)\n // Set the selected testType\n store.session.set('testConfig', data[testName]);\n console.log(`Stored testType: ${testName}`);\n \n // Highlight the clicked button and remove highlighting from others\n const buttons = menuButtonsContainer.getElementsByTagName('button');\n for (const otherButton of buttons) {\n otherButton.classList.remove('btn-success');\n }\n\n button.classList.add('btn-success');\n // Store the clicked test name in the array\n store.session.set('clickedTests', clickedTests);\n\n });\n menuButtonsContainer.appendChild(button);\n });\n\n if ((clickedTests.length+1) >= document.querySelectorAll('button').length){\n console.log((clickedTests.length+1),document.querySelectorAll('button').length)\n store.session.set('testComplete',true)\n }\n })\n .catch(error => console.error('Error fetching JSON:', error));\n\n<\/script>\n ",document.body.appendChild(t),await async function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=t[e];n.src&&await Xp(n.src)}}(t),function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=document.createElement("script");n.text=t[e].text,document.head.appendChild(n).parentNode.removeChild(n)}}(t),await new Promise((e=>{document.body.addEventListener("click",(function(n){n.target.id.startsWith("button_")&&(console.log("Button clicked:",n.target.id),document.querySelectorAll("script[data-dynamic]").forEach((e=>e.parentNode.removeChild(e))),t.remove(),e())}))}))}function Xp(e){return new Promise(((t,n)=>{const i=document.createElement("script");i.src=e,i.onload=t,i.onerror=n,document.head.appendChild(i)}))}window.store=s;var Gp=4,Jp=9;function Qp(e,t,n){const i=document.getElementById("grid-container"),a=Gp*Jp;for(let o=0;o<a;o++){if("Practice"===type&&(o<Jp||o>=2*Jp))continue;const a=document.createElement("div"),{x:s,y:r,width:c,height:l}=e[o];a.style.width=`${c}px`,a.style.height=`${l}px`,a.style.left=`${s}px`,a.style.top=`${r}px`,a.style.position="absolute",a.style.transform="translate(-50%, -50%)",a.style.display="flex",a.style.justifyContent="center",a.style.alignItems="center";const p=t[o],u=document.createElement("img");u.src=`${n.dir}/${p}`,u.style.width="50%",u.style.height="auto",a.appendChild(u),i.appendChild(a);const d=u.getBoundingClientRect();d.x=d.x+d.width/2,d.y=d.y+d.height/2;const m={x:parseFloat(a.style.left),y:parseFloat(a.style.top),width:parseFloat(a.style.width),height:parseFloat(a.style.height),stim_x:d.x,stim_y:d.y,stim_width:d.width,stim_height:d.height};_gridCoordinates.push(m),_shuffledImages.push(p.slice(0,-4))}}async function Zp(e=!1){try{const t=e?{audio:!0}:{video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:60,max:60}},audio:!0},n=await navigator.mediaDevices.getUserMedia(t);if(camera_stream=n,camera_stream&&camera_stream.active)return videoChunks=[],videoRecorder=new MediaRecorder(camera_stream),videoRecorder.ondataavailable=e=>{e.data.size>0&&videoChunks.push(e.data)},Promise.resolve(camera_stream);throw new Error("Camera stream is not active")}catch(e){return console.error("Error accessing media devices:",e),Promise.reject(e)}}async function eu(){audioChunks=[],videoChunks=[],videoRecorder.start()}async function tu(e,t,n){try{const i=await fetch(`https://us-central1-webapp-af756.cloudfunctions.net/getUploadUrlFunction?fileName=${e}&mimeType=${t}&parentDir=${n}`);if(!i.ok)throw new Error("Failed to fetch upload URL");return(await i.json()).result}catch(e){throw console.error("Error fetching upload URL:",e),e}}async function nu(e,t){try{const n=await fetch(t,{method:"PUT",headers:{"Content-Type":e.type,"Content-Length":e.size},body:e});if(!n.ok)throw new Error("Upload failed: "+n.statusText);console.log("Upload complete:",await n.text())}catch(e){console.error("Error:",e)}}var iu=4;function au(e){0==--iu?(document.getElementById("instruction").style.display="none",document.getElementById("grid-container").style.visibility="visible",iu=4):(document.getElementById("instruction").innerHTML="<h1>"+iu+"</h1>",setTimeout((function(){au()}),1e3))}function ou(){desktop.requestFullscreen?desktop.requestFullscreen():desktop.webkitRequestFullscreen?desktop.webkitRequestFullscreen():desktop.msRequestFullscreen&&desktop.msRequestFullscreen()}var su=Object.freeze({__proto__:null,get countdown(){return iu},generateGridCoordinates:function(e){let t,n,i,a;if(console.log(e.screenWidth,e.screenHeight,e.screenWidthPX,e.screenHeightPX),e.screenWidth>0&&e.screenHeight>0){const i=13/Gp;t=24.75/Jp*(e.screenWidthPX/e.screenWidth),n=i*(e.screenHeightPX/e.screenHeight)}else{const i=.8*e.screenWidthPX,a=.8*e.screenHeightPX;t=i/Jp,n=a/Gp}i=t*Jp,a=n*Gp;const o=(e.screenWidthPX-i)/2,s=(e.screenHeightPX-a)/2,r=[];for(let e=0;e<Gp;e++)for(let i=0;i<Jp;i++){const a=o+i*t+t/2,c=s+e*n+n/2;r.push({x:a,y:c,width:t,height:n})}return r},generateStimulusOrder:function(e){const t=Gp*Jp,n=e.stimulus.slice(),i=Math.ceil(t/n.length),a=[];for(let e=0;e<i;e++){const e=n.sort((()=>Math.random()-.5));a.push(...e)}for(let e=1;e<a.length;e++)if(a[e]===a[e-1]){const t=a[e];a[e]=a[e+1],a[e+1]=t}return a.slice(0,t)},getUploadUrl:tu,giveAccess:Zp,gridHeightCM:13,gridWidthCM:24.75,numCols:Jp,numRows:Gp,openFullscreen:ou,populateGrid:Qp,saveRecordings:async function(e,t,n="video/webm"){await new Promise((e=>{videoRecorder.onstop=e,videoRecorder.stop()}));const i=new Blob(videoChunks,{type:"video/webm"});if(i.size>0){console.log("Video recorded successfully. Size:",i.size,"bytes");try{Bc.storeAudio&&Bc.storeVideo?n="video/webm":Bc.storeAudio&&(n="audio/webm"),console.log("mimie",n);const a=await tu(e,n,t);await nu(i,a)}catch(e){console.error("Error getting video upload URL:",e)}}else console.error("No video data recorded.")},startRecording:eu,startTest:async function(){await Zp(!Bc.bEyeTracking),document.getElementById("finishButton").disabled=!1,ou(),eu(),Qp(gridCoordinates,shuffledImages,testConfig),au()},stopRecording:async function(){videoRecorder.stop()},updateCountdown:au,uploadFile:nu});async function ru(e,t){const n=document.createElement("div");n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.height="100%",await async function(e){Object.keys(e).forEach((t=>{window[t]=e[t]}))}(su),console.log("countdown",countdown),n.innerHTML='<!DOCTYPE html>\n<html lang="en">\n<head>\n <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>Image and Audio Recording</title>\n\n \x3c!-- <script data-dynamic src="./RAN.js"><\/script> --\x3e\n</head>\n\n<style>\n \n body {\n margin: 0;\n min-height: 100vh; /* Ensure body takes the full viewport height */\n display: flex; /* Enable Flexbox */\n justify-content: center; /* Center content horizontally */\n align-items: center; /* Center content vertically */\n font-family: sans-serif;\n }\n\n stim {\n position: absolute;\n height: auto;\n cursor: pointer;\n }\n\n #instruction {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n \n #confirmContainer {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n</style>\n\n\n<body>\n\n <div id="grid-container" style="position: absolute; width: 100%; height: 100%; visibility: hidden;"></div>\n\n \x3c!-- Center Instructions Panel --\x3e\n <div id="instructionsContentArea">\n <div class="row gap-2" id="instruction">\n <div class="col">\n <div class="card" style="width:45rem; height:39rem">\n <div class="card-body" id="cardthing" style="text-align: center;">\n <h3 class="card-title" id="instructionTitle"></h3>\n <h4 class="card-text" id="instructionSubtitle"></h4>\n <h4 class="card-text" id="instructionDescription"></h4>\n <div style="text-align: center; margin-bottom: 3vh;">\n <img id="explanationGif" src="https://eyetrackingdata.blob.core.windows.net/public/Images/squareAddition_white.png" width="350px">\n </div>\n \x3c!-- <div class="btn-group" role="group" aria-label="Basic example" style="margin-bottom: 2vh;"> --\x3e\n \x3c!-- <button type="button" class="btn btn-primary" id="giveAccessButton" onclick="giveAccess()">Give Access to Mic/Camera</button> --\x3e\n \x3c!-- <br> --\x3e\n <button type="button" class="btn btn-primary" id="startTestButton" onclick="startTest()">Start</button>\n </div>\n </div>\n </div>\n </div>\n </div> \n \n </div>\n \n \x3c!-- Audio Playing --\x3e \n <audio autoplay id="voiceover"> </audio>\n \n \x3c!-- Confirm Button --\x3e\n <div class="row gap-2" id="confirmContainer" style="display: none;">\n <div class="card-body" style="text-align: center;">\n <h3> <span id="capName"></span> Test Complete </h3>\n <button type="button" class="btn btn-primary" id="confirmButton">Back to Menu</button>\n </div>\n </div>\n\n \x3c!-- Finish Button --\x3e\n <div id="finishButtonContainer" style="position: fixed; bottom: 10px; right: 10px; z-index: 1;">\n <button type="button" class="btn btn-primary" id="finishButton" disabled>Finish</button>\n </div>\n\n<script data-dynamic>\n\nvar deviceConfig = store.session.get(\'deviceConfig\')\n// var deviceConfig = {screenWidth: 29, screenHeight: 16.2, screenWidthPX: 960, screenHeightPX: 540, webcamHeight: 0.5}\nvar testConfig = store.session.get(\'testConfig\')\n// var testConfig = {dir: "https://eyetrackingdata.blob.core.windows.net/public/assets/Letter",\n// stimulus : ["C.svg", "D.svg", "H.svg", "K.svg", "N.svg", "O.svg", "R.svg", "S.svg", "V.svg", "Z.svg"],\n// sizecm: 2}\n\nif (testConfig[\'testname\'] === \'Letter\') {\n var subtestText = [\'Letter\', \'letter\']\n} else {\n var subtestText = [\'Number\', \'number\']\n}\n\nvar voiceover = document.getElementById(\'voiceover\');\nvoiceover.src = `https://eyetrackingdata.blob.core.windows.net/public/Audios/${subtestText[1]}Calibration.mp3`;\n\ndocument.body.addEventListener(\'click\', function() {\n voiceover.pause();\n voiceover.currentTime = 0;; // Stop the voiceover whenever a click is detected \n});\n\nvar desktop = document.documentElement;\nvar camera_stream;\nvar videoRecorder;\nvar audioChunks = [];\nvar videoChunks = [];\n\nvar clickedTests = store.session.get(\'clickedTests\') || [];\nif (type!==\'Practice\') {\nclickedTests.push(testConfig[\'testname\'])\n}\n\nstore.session.set(\'clickedTests\',clickedTests)\n\nvar gridCoordinates = generateGridCoordinates(deviceConfig)\nvar shuffledImages = generateStimulusOrder(testConfig)\n \nvar _gridCoordinates = []\n// gridCoordinates\nvar _shuffledImages = []\n// shuffledImages.map(filename => filename.split(\'.\')[0]);\nvar _parentDir = store.session.get("id")\nvar _videoURL = \'\'\nvar _deviceConfig = deviceConfig\nvar _testConfig = testConfig\n\n// async function finishTest() {\n// console.log(\'Test Finished\');\n// // Remove the clicked image\n// await stopRecording(); // Stop recording when stimulus is clicked\n// const timestamp = new Date().getTime();\n// document.getElementById("finishButton").disabled=true\n \n// var filename = \'RAN\' + \'_\' + testConfig[\'testname\'] + \'_\' + timestamp + \'.webm\'\n// _videoURL.push(filename)\n\n// document.getElementById("confirmContainer").style.display = "block"\n// document.getElementById("grid-container").style.display = "none"\n// document.getElementById("finishButtonContainer").style.display = "none"\n\n\n// if (type!==\'Practice\') {\n// try{\n// await saveRecordings(filename= filename ,parentDir=store.session.get("id")); // Save the recorded audio and video\n// } catch (error) {\n// console.error(\'Error in saveRecordings:\', error);\n// }\n// }\n\n// }\n\n\n<\/script>\n\n</body>\n</html>\n';const i=Vc;document.body.appendChild(n),window.type=e,await async function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=t[e];n.src&&await cu(n.src)}}(n),function(e){const t=e.getElementsByTagName("script");for(let e=0;e<t.length;e++){const n=document.createElement("script");n.text=t[e].text,document.head.appendChild(n).parentNode.removeChild(n)}}(n),function(e){document.getElementById("instructionTitle").innerHTML=`<b>${subtestText[0]} ${e} Phase</b>`,document.getElementById("explanationGif").src=`https://eyetrackingdata.blob.core.windows.net/public/Images/${subtestText[1]}-${e.toLowerCase()}-reading-order.gif`;var t=document.getElementById("voiceover");if("Practice"===e){document.getElementById("instructionSubtitle").innerHTML="Let's do some practice!",document.getElementById("instructionDescription").innerHTML=`You’re going to see a row of ${subtestText[1]}s. <span id="distance-span"> </span> </h4>\n Read them out loud as fast as you can without making mistakes. <span id="distance-span"> </span> </h4>\n Remember to read like you normally do by going from <b> left to right. </b> <span id="distance-span"> </span> </h4>\n Click the "Finish" button (bottom right) when you are done. <span id="distance-span"> </span> </h4>`,t.src=`https://eyetrackingdata.blob.core.windows.net/public/Audios/${subtestText[1]}${e}.mp3`}else{document.getElementById("instructionSubtitle").innerHTML="Let’s start for real now.",document.getElementById("instructionDescription").innerHTML=`Read the ${subtestText[1]}s as fast as you can without making mistakes. Remember to read in the right direction. <span id="distance-span"> </span> </h4>\n Click the "Finish" button (bottom right) when you are done.<span id="distance-span"> </span> </h4>`,t.src=`https://eyetrackingdata.blob.core.windows.net/public/Audios/${subtestText[1]}${e}.mp3`}}(e),await new Promise((e=>{document.body.addEventListener("click",(async function(a){if("finishButton"===a.target.id){console.log("Button clicked:",a.target.id),n.innerHTML=i,(o=n).style.position="",o.style.top="",o.style.left="",o.style.width="",o.style.height="",await async function(){console.log("Test Finished");const e=(new Date).getTime();await stopRecording();var t="RAN_"+testConfig.testname+"_"+e+".webm";_videoURL=t,console.log(s.session.get("id"));try{await saveRecordings(t,s.session.get("id"))}catch(e){console.error("Error in saveRecordings:",e)}}();const r={assessment_type:testConfig.testname,assessment_stage:"Test",stimulusPosition:_gridCoordinates,stimulus:_shuffledImages,recordedVideo:_videoURL,parentDir:_parentDir,correct:1,deviceConfig:_deviceConfig,testConfig:_testConfig};t.firekit.writeTrial(r),n.remove(),function(e){function t(e){const t=e,n=t.cloneNode(!0);t.parentNode.replaceChild(n,t)}!function(e){Object.keys(e).forEach((e=>{const t=Object.getOwnPropertyDescriptor(window,e);t&&t.configurable?delete window[e]:console.log(`Cannot remove ${e} from window; it may be non-configurable.`)}))}(e);document.querySelectorAll("button").forEach((e=>{t(e)}));for(;document.body.firstChild;)document.body.removeChild(document.body.firstChild);document.querySelectorAll("script[data-dynamic]").forEach((e=>e.parentNode.removeChild(e)))}(su),e()}var o}))}))}function cu(e){return new Promise(((t,n)=>{const i=document.createElement("script");i.src=e,i.onload=t,i.onerror=n,document.head.appendChild(i)}))}window.store=s;class lu{constructor(e,t,n,i){this.gameParams=t,this.userParams=n,this.firekit=e,this.displayElement=i,this.jsPsych=null}async init(){}async run(){this.gameParams.consent&&await Fc(),await this.firekit.startRun();const e=await(async(e,t,n,i)=>{const a=wo(wo({...t,...n},ko),_o),{userMetadata:o={},audioFeedback:s,grade:r,language:c=Ds.language,skipInstructions:l,practiceCorpus:p,stimulusCorpus:u,sequentialPractice:d,sequentialStimulus:m,buttonLayout:h,numberOfTrials:f,storyCorpus:g,taskName:v,stimulusBlocks:b,numOfPracticeTrials:x,storyOption:y,keyHelpers:w}=a;"en"!==c&&Ds.changeLanguage(c);const k={userMetadata:{...o,grade:r},audioFeedback:s||"neutral",skipInstructions:l??!0,startTime:new Date,firekit:e,displayElement:i||null,practiceCorpus:p??"math-item-bank-practice-pz",stimulusCorpus:u??"math-item-bank-pz",sequentialPractice:d??!0,sequentialStimulus:m??!0,buttonLayout:h||"default",numberOfTrials:f??10,task:v??"egma-math",stimulusBlocks:b??3,numOfPracticeTrials:x??2,storyOption:y,story:qc(y,r),keyHelpers:w??!0};console.log("this is grade:",r),console.log("this is storyOption:",y);const _=Object.fromEntries(Object.entries(t).map((([e,t])=>[e,"story"===e?t:k[e]??t])));return await k.firekit.updateTaskParams(_),null!==k.pid&&await k.firekit.updateUser({assessmentPid:k.pid,...o}),k})(this.firekit,this.gameParams,this.userParams,this.displayElement);e.story=!0,s.session.set("config",e),await Yc(e),e.story&&await $p("Introduction");let t=!1;do{await Yp(`https://eyetrackingdata.blob.core.windows.net/public/config/${this.gameParams.testConfigFile}.json`),e.story&&await $p("Calibration"),1==this.gameParams.bEyeTracking&&("short"===this.gameParams.calibrationType?await zp(e):await nl(e)),e.story&&await $p("Practice"),await ru("Practice",e),e.story&&await $p("Test"),await ru("Test",e),t="true"===sessionStorage.getItem("testComplete")}while(!t);e.story&&await $p("Ending")}}export{lu as default};
11
+ //# sourceMappingURL=index.f0b1685a.js.map