Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ssvep-stimuli

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssvep-stimuli - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

dist/README.md

2

dist/index.esm.js
function e(e,t,n,r,i,o,s){try{var u=e[o](s),a=u.value}catch(e){return void n(e)}u.done?t(a):Promise.resolve(a).then(r,i)}function t(t){return function(){var n=this,r=arguments;return new Promise((function(i,o){var s=t.apply(n,r);function u(t){e(s,i,o,u,a,"next",t)}function a(t){e(s,i,o,u,a,"throw",t)}u(void 0)}))}}var n={exports:{}},r={exports:{}};!function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(r),function(e){var t=r.exports.default;function n(){
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
e.exports=n=function(){return i},e.exports.__esModule=!0,e.exports.default=e.exports;var r,i={},o=Object.prototype,s=o.hasOwnProperty,u=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function h(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(r){h=function(e,t,n){return e[t]=n}}function d(e,t,n,r){var i=t&&t.prototype instanceof b?t:b,o=Object.create(i.prototype),s=new M(r||[]);return u(o,"_invoke",{value:S(e,n,s)}),o}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}i.wrap=d;var m="suspendedStart",g="suspendedYield",v="executing",w="completed",y={};function b(){}function x(){}function E(){}var N={};h(N,c,(function(){return this}));var _=Object.getPrototypeOf,T=_&&_(_(P([])));T&&T!==o&&s.call(T,c)&&(N=T);var A=E.prototype=b.prototype=Object.create(N);function O(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function R(e,n){function r(i,o,u,a){var c=p(e[i],e,o);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==t(f)&&s.call(f,"__await")?n.resolve(f.__await).then((function(e){r("next",e,u,a)}),(function(e){r("throw",e,u,a)})):n.resolve(f).then((function(e){l.value=e,u(l)}),(function(e){return r("throw",e,u,a)}))}a(c.arg)}var i;u(this,"_invoke",{value:function(e,t){function o(){return new n((function(n,i){r(e,t,n,i)}))}return i=i?i.then(o,o):o()}})}function S(e,t,n){var i=m;return function(o,s){if(i===v)throw Error("Generator is already running");if(i===w){if("throw"===o)throw s;return{value:r,done:!0}}for(n.method=o,n.arg=s;;){var u=n.delegate;if(u){var a=L(u,n);if(a){if(a===y)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===m)throw i=w,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=v;var c=p(e,t,n);if("normal"===c.type){if(i=n.done?w:g,c.arg===y)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=w,n.method="throw",n.arg=c.arg)}}}function L(e,t){var n=t.method,i=e.iterator[n];if(i===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=r,L(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var o=p(i,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,y;var s=o.arg;return s?s.done?(t[e.resultName]=s.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=r),t.delegate=null,y):s:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function F(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function P(e){if(e||""===e){var n=e[c];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function t(){for(;++i<e.length;)if(s.call(e,i))return t.value=e[i],t.done=!1,t;return t.value=r,t.done=!0,t};return o.next=o}}throw new TypeError(t(e)+" is not iterable")}return x.prototype=E,u(A,"constructor",{value:E,configurable:!0}),u(E,"constructor",{value:x,configurable:!0}),x.displayName=h(E,f,"GeneratorFunction"),i.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===x||"GeneratorFunction"===(t.displayName||t.name))},i.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,h(e,f,"GeneratorFunction")),e.prototype=Object.create(A),e},i.awrap=function(e){return{__await:e}},O(R.prototype),h(R.prototype,l,(function(){return this})),i.AsyncIterator=R,i.async=function(e,t,n,r,o){void 0===o&&(o=Promise);var s=new R(d(e,t,n,r),o);return i.isGeneratorFunction(t)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},O(A),h(A,f,"Generator"),h(A,c,(function(){return this})),h(A,"toString",(function(){return"[object Generator]"})),i.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},i.values=P,M.prototype={constructor:M,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(F),!e)for(var t in this)"t"===t.charAt(0)&&s.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=r)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return u.type="throw",u.arg=e,t.next=n,i&&(t.method="next",t.arg=r),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],u=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var a=s.call(o,"catchLoc"),c=s.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&s.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),F(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;F(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:P(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=r),y}},i}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(n);var i=n.exports(),o=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}function s(e){return s="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},s(e)}var u,a,c=9e15,l=1e9,f="0123456789abcdef",h="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",d="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",p={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-c,maxE:c,crypto:!1},m=!0,g="[DecimalError] ",v=g+"Invalid argument: ",w=g+"Precision limit exceeded",y=g+"crypto unavailable",b="[object Decimal]",x=Math.floor,E=Math.pow,N=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,_=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,T=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,A=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,O=1e7,R=h.length-1,S=d.length-1,L={toStringTag:b};function C(e){var t,n,r,i=e.length-1,o="",s=e[0];if(i>0){for(o+=s,t=1;t<i;t++)(n=7-(r=e[t]+"").length)&&(o+=H(n)),o+=r;(n=7-(r=(s=e[t])+"").length)&&(o+=H(n))}else if(0===s)return"0";for(;s%10==0;)s/=10;return o+s}function F(e,t,n){if(e!==~~e||e<t||e>n)throw Error(v+e)}function M(e,t,n,r){var i,o,s,u;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=7,i=0):(i=Math.ceil((t+1)/7),t%=7),o=E(10,7-t),u=e[i]%o|0,null==r?t<3?(0==t?u=u/100|0:1==t&&(u=u/10|0),s=n<4&&99999==u||n>3&&49999==u||5e4==u||0==u):s=(n<4&&u+1==o||n>3&&u+1==o/2)&&(e[i+1]/o/100|0)==E(10,t-2)-1||(u==o/2||0==u)&&!(e[i+1]/o/100|0):t<4?(0==t?u=u/1e3|0:1==t?u=u/100|0:2==t&&(u=u/10|0),s=(r||n<4)&&9999==u||!r&&n>3&&4999==u):s=((r||n<4)&&u+1==o||!r&&n>3&&u+1==o/2)&&(e[i+1]/o/1e3|0)==E(10,t-3)-1,s}function P(e,t,n){for(var r,i,o=[0],s=0,u=e.length;s<u;){for(i=o.length;i--;)o[i]*=t;for(o[0]+=f.indexOf(e.charAt(s++)),r=0;r<o.length;r++)o[r]>n-1&&(void 0===o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}L.absoluteValue=L.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),k(e)},L.ceil=function(){return k(new this.constructor(this),this.e+1,2)},L.clampedTo=L.clamp=function(e,t){var n=this,r=n.constructor;if(e=new r(e),t=new r(t),!e.s||!t.s)return new r(NaN);if(e.gt(t))throw Error(v+t);return n.cmp(e)<0?e:n.cmp(t)>0?t:new r(n)},L.comparedTo=L.cmp=function(e){var t,n,r,i,o=this,s=o.d,u=(e=new o.constructor(e)).d,a=o.s,c=e.s;if(!s||!u)return a&&c?a!==c?a:s===u?0:!s^a<0?1:-1:NaN;if(!s[0]||!u[0])return s[0]?a:u[0]?-c:0;if(a!==c)return a;if(o.e!==e.e)return o.e>e.e^a<0?1:-1;for(t=0,n=(r=s.length)<(i=u.length)?r:i;t<n;++t)if(s[t]!==u[t])return s[t]>u[t]^a<0?1:-1;return r===i?0:r>i^a<0?1:-1},L.cosine=L.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+7,r.rounding=1,n=function(e,t){var n,r,i;if(t.isZero())return t;r=t.d.length,r<32?i=(1/K(4,n=Math.ceil(r/3))).toString():(n=16,i="2.3283064365386962890625e-10");e.precision+=n,t=J(e,1,t.times(i),new e(1));for(var o=n;o--;){var s=t.times(t);t=s.times(s).minus(s).times(8).plus(1)}return e.precision-=n,t}(r,Q(r,n)),r.precision=e,r.rounding=t,k(2==a||3==a?n.neg():n,e,t,!0)):new r(1):new r(NaN)},L.cubeRoot=L.cbrt=function(){var e,t,n,r,i,o,s,u,a,c,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(m=!1,(o=l.s*E(l.s*l,1/3))&&Math.abs(o)!=1/0?r=new f(o.toString()):(n=C(l.d),(o=((e=l.e)-n.length+1)%3)&&(n+=1==o||-2==o?"0":"00"),o=E(n,1/3),e=x((e+1)/3)-(e%3==(e<0?-1:2)),(r=new f(n=o==1/0?"5e"+e:(n=o.toExponential()).slice(0,n.indexOf("e")+1)+e)).s=l.s),s=(e=f.precision)+3;;)if(c=(a=(u=r).times(u).times(u)).plus(l),r=B(c.plus(l).times(u),c.plus(a),s+2,1),C(u.d).slice(0,s)===(n=C(r.d)).slice(0,s)){if("9999"!=(n=n.slice(s-3,s+1))&&(i||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(k(r,e+1,1),t=!r.times(r).times(r).eq(l));break}if(!i&&(k(u,e+1,0),u.times(u).times(u).eq(l))){r=u;break}s+=4,i=1}return m=!0,k(r,e,f.rounding,t)},L.decimalPlaces=L.dp=function(){var e,t=this.d,n=NaN;if(t){if(n=7*((e=t.length-1)-x(this.e/7)),e=t[e])for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n},L.dividedBy=L.div=function(e){return B(this,new this.constructor(e))},L.dividedToIntegerBy=L.divToInt=function(e){var t=this.constructor;return k(B(this,new t(e),0,1,1),t.precision,t.rounding)},L.equals=L.eq=function(e){return 0===this.cmp(e)},L.floor=function(){return k(new this.constructor(this),this.e+1,3)},L.greaterThan=L.gt=function(e){return this.cmp(e)>0},L.greaterThanOrEqualTo=L.gte=function(e){var t=this.cmp(e);return 1==t||0===t},L.hyperbolicCosine=L.cosh=function(){var e,t,n,r,i,o=this,s=o.constructor,u=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return u;n=s.precision,r=s.rounding,s.precision=n+Math.max(o.e,o.sd())+4,s.rounding=1,(i=o.d.length)<32?t=(1/K(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),o=J(s,1,o.times(t),new s(1),!0);for(var a,c=e,l=new s(8);c--;)a=o.times(o),o=u.minus(a.times(l.minus(a.times(l))));return k(o,s.precision=n,s.rounding=r,!0)},L.hyperbolicSine=L.sinh=function(){var e,t,n,r,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,n=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,(r=i.d.length)<3)i=J(o,2,i,i,!0);else{e=(e=1.4*Math.sqrt(r))>16?16:0|e,i=J(o,2,i=i.times(1/K(5,e)),i,!0);for(var s,u=new o(5),a=new o(16),c=new o(20);e--;)s=i.times(i),i=i.times(u.plus(s.times(a.times(s).plus(c))))}return o.precision=t,o.rounding=n,k(i,t,n,!0)},L.hyperbolicTangent=L.tanh=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,B(n.sinh(),n.cosh(),r.precision=e,r.rounding=t)):new r(n.s)},L.inverseCosine=L.acos=function(){var e,t=this,n=t.constructor,r=t.abs().cmp(1),i=n.precision,o=n.rounding;return-1!==r?0===r?t.isNeg()?j(n,i,o):new n(0):new n(NaN):t.isZero()?j(n,i+4,o).times(.5):(n.precision=i+6,n.rounding=1,t=t.asin(),e=j(n,i+4,o).times(.5),n.precision=i,n.rounding=o,e.minus(t))},L.inverseHyperbolicCosine=L.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,m=!1,n=n.times(n).minus(1).sqrt().plus(n),m=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)},L.inverseHyperbolicSine=L.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,m=!1,n=n.times(n).plus(1).sqrt().plus(n),m=!0,r.precision=e,r.rounding=t,n.ln())},L.inverseHyperbolicTangent=L.atanh=function(){var e,t,n,r,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,r=i.sd(),Math.max(r,e)<2*-i.e-1?k(new o(i),e,t,!0):(o.precision=n=r-i.e,i=B(i.plus(1),new o(1).minus(i),n+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5))):new o(NaN)},L.inverseSine=L.asin=function(){var e,t,n,r,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),n=o.precision,r=o.rounding,-1!==t?0===t?((e=j(o,n+4,r).times(.5)).s=i.s,e):new o(NaN):(o.precision=n+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=r,i.times(2)))},L.inverseTangent=L.atan=function(){var e,t,n,r,i,o,s,u,a,c=this,l=c.constructor,f=l.precision,h=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&f+4<=S)return(s=j(l,f+4,h).times(.25)).s=c.s,s}else{if(!c.s)return new l(NaN);if(f+4<=S)return(s=j(l,f+4,h).times(.5)).s=c.s,s}for(l.precision=u=f+10,l.rounding=1,e=n=Math.min(28,u/7+2|0);e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(m=!1,t=Math.ceil(u/7),r=1,a=c.times(c),s=new l(c),i=c;-1!==e;)if(i=i.times(a),o=s.minus(i.div(r+=2)),i=i.times(a),void 0!==(s=o.plus(i.div(r+=2))).d[t])for(e=t;s.d[e]===o.d[e]&&e--;);return n&&(s=s.times(2<<n-1)),m=!0,k(s,l.precision=f,l.rounding=h,!0)},L.isFinite=function(){return!!this.d},L.isInteger=L.isInt=function(){return!!this.d&&x(this.e/7)>this.d.length-2},L.isNaN=function(){return!this.s},L.isNegative=L.isNeg=function(){return this.s<0},L.isPositive=L.isPos=function(){return this.s>0},L.isZero=function(){return!!this.d&&0===this.d[0]},L.lessThan=L.lt=function(e){return this.cmp(e)<0},L.lessThanOrEqualTo=L.lte=function(e){return this.cmp(e)<1},L.logarithm=L.log=function(e){var t,n,r,i,o,s,u,a,c=this,l=c.constructor,f=l.precision,h=l.rounding;if(null==e)e=new l(10),t=!0;else{if(n=(e=new l(e)).d,e.s<0||!n||!n[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(n=c.d,c.s<0||!n||!n[0]||c.eq(1))return new l(n&&!n[0]?-1/0:1!=c.s?NaN:n?0:1/0);if(t)if(n.length>1)o=!0;else{for(i=n[0];i%10==0;)i/=10;o=1!==i}if(m=!1,s=Y(c,u=f+5),r=t?U(l,u+10):Y(e,u),M((a=B(s,r,u,1)).d,i=f,h))do{if(s=Y(c,u+=10),r=t?U(l,u+10):Y(e,u),a=B(s,r,u,1),!o){+C(a.d).slice(i+1,i+15)+1==1e14&&(a=k(a,f+1,0));break}}while(M(a.d,i+=10,h));return m=!0,k(a,f,h)},L.minus=L.sub=function(e){var t,n,r,i,o,s,u,a,c,l,f,h,d=this,p=d.constructor;if(e=new p(e),!d.d||!e.d)return d.s&&e.s?d.d?e.s=-e.s:e=new p(e.d||d.s!==e.s?d:NaN):e=new p(NaN),e;if(d.s!=e.s)return e.s=-e.s,d.plus(e);if(c=d.d,h=e.d,u=p.precision,a=p.rounding,!c[0]||!h[0]){if(h[0])e.s=-e.s;else{if(!c[0])return new p(3===a?-0:0);e=new p(d)}return m?k(e,u,a):e}if(n=x(e.e/7),l=x(d.e/7),c=c.slice(),o=l-n){for((f=o<0)?(t=c,o=-o,s=h.length):(t=h,n=l,s=c.length),o>(r=Math.max(Math.ceil(u/7),s)+2)&&(o=r,t.length=1),t.reverse(),r=o;r--;)t.push(0);t.reverse()}else{for((f=(r=c.length)<(s=h.length))&&(s=r),r=0;r<s;r++)if(c[r]!=h[r]){f=c[r]<h[r];break}o=0}for(f&&(t=c,c=h,h=t,e.s=-e.s),s=c.length,r=h.length-s;r>0;--r)c[s++]=0;for(r=h.length;r>o;){if(c[--r]<h[r]){for(i=r;i&&0===c[--i];)c[i]=O-1;--c[i],c[r]+=O}c[r]-=h[r]}for(;0===c[--s];)c.pop();for(;0===c[0];c.shift())--n;return c[0]?(e.d=c,e.e=q(c,n),m?k(e,u,a):e):new p(3===a?-0:0)},L.modulo=L.mod=function(e){var t,n=this,r=n.constructor;return e=new r(e),!n.d||!e.s||e.d&&!e.d[0]?new r(NaN):!e.d||n.d&&!n.d[0]?k(new r(n),r.precision,r.rounding):(m=!1,9==r.modulo?(t=B(n,e.abs(),0,3,1)).s*=e.s:t=B(n,e,0,r.modulo,1),t=t.times(e),m=!0,n.minus(t))},L.naturalExponential=L.exp=function(){return V(this)},L.naturalLogarithm=L.ln=function(){return Y(this)},L.negated=L.neg=function(){var e=new this.constructor(this);return e.s=-e.s,k(e)},L.plus=L.add=function(e){var t,n,r,i,o,s,u,a,c,l,f=this,h=f.constructor;if(e=new h(e),!f.d||!e.d)return f.s&&e.s?f.d||(e=new h(e.d||f.s===e.s?f:NaN)):e=new h(NaN),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(c=f.d,l=e.d,u=h.precision,a=h.rounding,!c[0]||!l[0])return l[0]||(e=new h(f)),m?k(e,u,a):e;if(o=x(f.e/7),r=x(e.e/7),c=c.slice(),i=o-r){for(i<0?(n=c,i=-i,s=l.length):(n=l,r=o,s=c.length),i>(s=(o=Math.ceil(u/7))>s?o+1:s+1)&&(i=s,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for((s=c.length)-(i=l.length)<0&&(i=s,n=l,l=c,c=n),t=0;i;)t=(c[--i]=c[i]+l[i]+t)/O|0,c[i]%=O;for(t&&(c.unshift(t),++r),s=c.length;0==c[--s];)c.pop();return e.d=c,e.e=q(c,r),m?k(e,u,a):e},L.precision=L.sd=function(e){var t,n=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(v+e);return n.d?(t=D(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t},L.round=function(){var e=this,t=e.constructor;return k(new t(e),e.e+1,t.rounding)},L.sine=L.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+7,r.rounding=1,n=function(e,t){var n,r=t.d.length;if(r<3)return t.isZero()?t:J(e,2,t,t);n=(n=1.4*Math.sqrt(r))>16?16:0|n,t=t.times(1/K(5,n)),t=J(e,2,t,t);for(var i,o=new e(5),s=new e(16),u=new e(20);n--;)i=t.times(t),t=t.times(o.plus(i.times(s.times(i).minus(u))));return t}(r,Q(r,n)),r.precision=e,r.rounding=t,k(a>2?n.neg():n,e,t,!0)):new r(NaN)},L.squareRoot=L.sqrt=function(){var e,t,n,r,i,o,s=this,u=s.d,a=s.e,c=s.s,l=s.constructor;if(1!==c||!u||!u[0])return new l(!c||c<0&&(!u||u[0])?NaN:u?s:1/0);for(m=!1,0==(c=Math.sqrt(+s))||c==1/0?(((t=C(u)).length+a)%2==0&&(t+="0"),c=Math.sqrt(t),a=x((a+1)/2)-(a<0||a%2),r=new l(t=c==1/0?"5e"+a:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+a)):r=new l(c.toString()),n=(a=l.precision)+3;;)if(r=(o=r).plus(B(s,o,n+2,1)).times(.5),C(o.d).slice(0,n)===(t=C(r.d)).slice(0,n)){if("9999"!=(t=t.slice(n-3,n+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(k(r,a+1,1),e=!r.times(r).eq(s));break}if(!i&&(k(o,a+1,0),o.times(o).eq(s))){r=o;break}n+=4,i=1}return m=!0,k(r,a,l.rounding,e)},L.tangent=L.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,(n=n.sin()).s=1,n=B(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,k(2==a||4==a?n.neg():n,e,t,!0)):new r(NaN)},L.times=L.mul=function(e){var t,n,r,i,o,s,u,a,c,l=this,f=l.constructor,h=l.d,d=(e=new f(e)).d;if(e.s*=l.s,!(h&&h[0]&&d&&d[0]))return new f(!e.s||h&&!h[0]&&!d||d&&!d[0]&&!h?NaN:h&&d?0*e.s:e.s/0);for(n=x(l.e/7)+x(e.e/7),(a=h.length)<(c=d.length)&&(o=h,h=d,d=o,s=a,a=c,c=s),o=[],r=s=a+c;r--;)o.push(0);for(r=c;--r>=0;){for(t=0,i=a+r;i>r;)u=o[i]+d[r]*h[i-r-1]+t,o[i--]=u%O|0,t=u/O|0;o[i]=(o[i]+t)%O|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=q(o,n),m?k(e,f.precision,f.rounding):e},L.toBinary=function(e,t){return ee(this,2,e,t)},L.toDecimalPlaces=L.toDP=function(e,t){var n=this,r=n.constructor;return n=new r(n),void 0===e?n:(F(e,0,l),void 0===t?t=r.rounding:F(t,0,8),k(n,e+n.e+1,t))},L.toExponential=function(e,t){var n,r=this,i=r.constructor;return void 0===e?n=I(r,!0):(F(e,0,l),void 0===t?t=i.rounding:F(t,0,8),n=I(r=k(new i(r),e+1,t),!0,e+1)),r.isNeg()&&!r.isZero()?"-"+n:n},L.toFixed=function(e,t){var n,r,i=this,o=i.constructor;return void 0===e?n=I(i):(F(e,0,l),void 0===t?t=o.rounding:F(t,0,8),n=I(r=k(new o(i),e+i.e+1,t),!1,e+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n},L.toFraction=function(e){var t,n,r,i,o,s,u,a,c,l,f,h,d=this,p=d.d,g=d.constructor;if(!p)return new g(d);if(c=n=new g(1),r=a=new g(0),s=(o=(t=new g(r)).e=D(p)-d.e-1)%7,t.d[0]=E(10,s<0?7+s:s),null==e)e=o>0?t:c;else{if(!(u=new g(e)).isInt()||u.lt(c))throw Error(v+u);e=u.gt(t)?o>0?t:c:u}for(m=!1,u=new g(C(p)),l=g.precision,g.precision=o=7*p.length*2;f=B(u,t,0,1,1),1!=(i=n.plus(f.times(r))).cmp(e);)n=r,r=i,i=c,c=a.plus(f.times(i)),a=i,i=t,t=u.minus(f.times(i)),u=i;return i=B(e.minus(n),r,0,1,1),a=a.plus(i.times(c)),n=n.plus(i.times(r)),a.s=c.s=d.s,h=B(c,r,o,1).minus(d).abs().cmp(B(a,n,o,1).minus(d).abs())<1?[c,r]:[a,n],g.precision=l,m=!0,h},L.toHexadecimal=L.toHex=function(e,t){return ee(this,16,e,t)},L.toNearest=function(e,t){var n=this,r=n.constructor;if(n=new r(n),null==e){if(!n.d)return n;e=new r(1),t=r.rounding}else{if(e=new r(e),void 0===t?t=r.rounding:F(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&(e.s=n.s),e}return e.d[0]?(m=!1,n=B(n,e,0,t,1).times(e),m=!0,k(n)):(e.s=n.s,n=e),n},L.toNumber=function(){return+this},L.toOctal=function(e,t){return ee(this,8,e,t)},L.toPower=L.pow=function(e){var t,n,r,i,o,s,u=this,a=u.constructor,c=+(e=new a(e));if(!(u.d&&e.d&&u.d[0]&&e.d[0]))return new a(E(+u,c));if((u=new a(u)).eq(1))return u;if(r=a.precision,o=a.rounding,e.eq(1))return k(u,r,o);if((t=x(e.e/7))>=e.d.length-1&&(n=c<0?-c:c)<=9007199254740991)return i=Z(a,u,n,r),e.s<0?new a(1).div(i):k(i,r,o);if((s=u.s)<0){if(t<e.d.length-1)return new a(NaN);if(1&e.d[t]||(s=1),0==u.e&&1==u.d[0]&&1==u.d.length)return u.s=s,u}return(t=0!=(n=E(+u,c))&&isFinite(n)?new a(n+"").e:x(c*(Math.log("0."+C(u.d))/Math.LN10+u.e+1)))>a.maxE+1||t<a.minE-1?new a(t>0?s/0:0):(m=!1,a.rounding=u.s=1,n=Math.min(12,(t+"").length),(i=V(e.times(Y(u,r+n)),r)).d&&M((i=k(i,r+5,1)).d,r,o)&&(t=r+10,+C((i=k(V(e.times(Y(u,t+n)),t),t+5,1)).d).slice(r+1,r+15)+1==1e14&&(i=k(i,r+1,0))),i.s=s,m=!0,a.rounding=o,k(i,r,o))},L.toPrecision=function(e,t){var n,r=this,i=r.constructor;return void 0===e?n=I(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(F(e,1,l),void 0===t?t=i.rounding:F(t,0,8),n=I(r=k(new i(r),e,t),e<=r.e||r.e<=i.toExpNeg,e)),r.isNeg()&&!r.isZero()?"-"+n:n},L.toSignificantDigits=L.toSD=function(e,t){var n=this.constructor;return void 0===e?(e=n.precision,t=n.rounding):(F(e,1,l),void 0===t?t=n.rounding:F(t,0,8)),k(new n(this),e,t)},L.toString=function(){var e=this,t=e.constructor,n=I(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+n:n},L.truncated=L.trunc=function(){return k(new this.constructor(this),this.e+1,1)},L.valueOf=L.toJSON=function(){var e=this,t=e.constructor,n=I(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+n:n};var B=function(){function e(e,t,n){var r,i=0,o=e.length;for(e=e.slice();o--;)r=e[o]*t+i,e[o]=r%n|0,i=r/n|0;return i&&e.unshift(i),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;i<n;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]<t[n]?1:0,e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;)e.shift()}return function(r,i,o,s,a,c){var l,f,h,d,p,m,g,v,w,y,b,E,N,_,T,A,R,S,L,C,F=r.constructor,M=r.s==i.s?1:-1,P=r.d,B=i.d;if(!(P&&P[0]&&B&&B[0]))return new F(r.s&&i.s&&(P?!B||P[0]!=B[0]:B)?P&&0==P[0]||!B?0*M:M/0:NaN);for(c?(p=1,f=r.e-i.e):(c=O,p=7,f=x(r.e/p)-x(i.e/p)),L=B.length,R=P.length,y=(w=new F(M)).d=[],h=0;B[h]==(P[h]||0);h++);if(B[h]>(P[h]||0)&&f--,null==o?(_=o=F.precision,s=F.rounding):_=a?o+(r.e-i.e)+1:o,_<0)y.push(1),m=!0;else{if(_=_/p+2|0,h=0,1==L){for(d=0,B=B[0],_++;(h<R||d)&&_--;h++)T=d*c+(P[h]||0),y[h]=T/B|0,d=T%B|0;m=d||h<R}else{for((d=c/(B[0]+1)|0)>1&&(B=e(B,d,c),P=e(P,d,c),L=B.length,R=P.length),A=L,E=(b=P.slice(0,L)).length;E<L;)b[E++]=0;(C=B.slice()).unshift(0),S=B[0],B[1]>=c/2&&++S;do{d=0,(l=t(B,b,L,E))<0?(N=b[0],L!=E&&(N=N*c+(b[1]||0)),(d=N/S|0)>1?(d>=c&&(d=c-1),1==(l=t(g=e(B,d,c),b,v=g.length,E=b.length))&&(d--,n(g,L<v?C:B,v,c))):(0==d&&(l=d=1),g=B.slice()),(v=g.length)<E&&g.unshift(0),n(b,g,E,c),-1==l&&(l=t(B,b,L,E=b.length))<1&&(d++,n(b,L<E?C:B,E,c)),E=b.length):0===l&&(d++,b=[0]),y[h++]=d,l&&b[0]?b[E++]=P[A]||0:(b=[P[A]],E=1)}while((A++<R||void 0!==b[0])&&_--);m=void 0!==b[0]}y[0]||y.shift()}if(1==p)w.e=f,u=m;else{for(h=1,d=y[0];d>=10;d/=10)h++;w.e=h+f*p-1,k(w,a?o+w.e+1:o,s,m)}return w}}();function k(e,t,n,r){var i,o,s,u,a,c,l,f,h,d=e.constructor;e:if(null!=t){if(!(f=e.d))return e;for(i=1,u=f[0];u>=10;u/=10)i++;if((o=t-i)<0)o+=7,s=t,a=(l=f[h=0])/E(10,i-s-1)%10|0;else if((h=Math.ceil((o+1)/7))>=(u=f.length)){if(!r)break e;for(;u++<=h;)f.push(0);l=a=0,i=1,s=(o%=7)-7+1}else{for(l=u=f[h],i=1;u>=10;u/=10)i++;a=(s=(o%=7)-7+i)<0?0:l/E(10,i-s-1)%10|0}if(r=r||t<0||void 0!==f[h+1]||(s<0?l:l%E(10,i-s-1)),c=n<4?(a||r)&&(0==n||n==(e.s<0?3:2)):a>5||5==a&&(4==n||r||6==n&&(o>0?s>0?l/E(10,i-s):0:f[h-1])%10&1||n==(e.s<0?8:7)),t<1||!f[0])return f.length=0,c?(t-=e.e+1,f[0]=E(10,(7-t%7)%7),e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=h,u=1,h--):(f.length=h+1,u=E(10,7-o),f[h]=s>0?(l/E(10,i-s)%E(10,s)|0)*u:0),c)for(;;){if(0==h){for(o=1,s=f[0];s>=10;s/=10)o++;for(s=f[0]+=u,u=1;s>=10;s/=10)u++;o!=u&&(e.e++,f[0]==O&&(f[0]=1));break}if(f[h]+=u,f[h]!=O)break;f[h--]=0,u=1}for(o=f.length;0===f[--o];)f.pop()}return m&&(e.e>d.maxE?(e.d=null,e.e=NaN):e.e<d.minE&&(e.e=0,e.d=[0])),e}function I(e,t,n){if(!e.isFinite())return z(e);var r,i=e.e,o=C(e.d),s=o.length;return t?(n&&(r=n-s)>0?o=o.charAt(0)+"."+o.slice(1)+H(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+H(-i-1)+o,n&&(r=n-s)>0&&(o+=H(r))):i>=s?(o+=H(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+H(r))):((r=i+1)<s&&(o=o.slice(0,r)+"."+o.slice(r)),n&&(r=n-s)>0&&(i+1===s&&(o+="."),o+=H(r))),o}function q(e,t){var n=e[0];for(t*=7;n>=10;n/=10)t++;return t}function U(e,t,n){if(t>R)throw m=!0,n&&(e.precision=n),Error(w);return k(new e(h),t,1,!0)}function j(e,t,n){if(t>S)throw Error(w);return k(new e(d),t,n,!0)}function D(e){var t=e.length-1,n=7*t+1;if(t=e[t]){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function H(e){for(var t="";e--;)t+="0";return t}function Z(e,t,n,r){var i,o=new e(1),s=Math.ceil(r/7+4);for(m=!1;;){if(n%2&&te((o=o.times(t)).d,s)&&(i=!0),0===(n=x(n/2))){n=o.d.length-1,i&&0===o.d[n]&&++o.d[n];break}te((t=t.times(t)).d,s)}return m=!0,o}function G(e){return 1&e.d[e.d.length-1]}function X(e,t,n){for(var r,i=new e(t[0]),o=0;++o<t.length;){if(!(r=new e(t[o])).s){i=r;break}i[n](r)&&(i=r)}return i}function V(e,t){var n,r,i,o,s,u,a,c=0,l=0,f=0,h=e.constructor,d=h.rounding,p=h.precision;if(!e.d||!e.d[0]||e.e>17)return new h(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(null==t?(m=!1,a=p):a=t,u=new h(.03125);e.e>-2;)e=e.times(u),f+=5;for(a+=r=Math.log(E(2,f))/Math.LN10*2+5|0,n=o=s=new h(1),h.precision=a;;){if(o=k(o.times(e),a,1),n=n.times(++l),C((u=s.plus(B(o,n,a,1))).d).slice(0,a)===C(s.d).slice(0,a)){for(i=f;i--;)s=k(s.times(s),a,1);if(null!=t)return h.precision=p,s;if(!(c<3&&M(s.d,a-r,d,c)))return k(s,h.precision=p,d,m=!0);h.precision=a+=10,n=o=u=new h(1),l=0,c++}s=u}}function Y(e,t){var n,r,i,o,s,u,a,c,l,f,h,d=1,p=e,g=p.d,v=p.constructor,w=v.rounding,y=v.precision;if(p.s<0||!g||!g[0]||!p.e&&1==g[0]&&1==g.length)return new v(g&&!g[0]?-1/0:1!=p.s?NaN:g?0:p);if(null==t?(m=!1,l=y):l=t,v.precision=l+=10,r=(n=C(g)).charAt(0),!(Math.abs(o=p.e)<15e14))return c=U(v,l+2,y).times(o+""),p=Y(new v(r+"."+n.slice(1)),l-10).plus(c),v.precision=y,null==t?k(p,y,w,m=!0):p;for(;r<7&&1!=r||1==r&&n.charAt(1)>3;)r=(n=C((p=p.times(e)).d)).charAt(0),d++;for(o=p.e,r>1?(p=new v("0."+n),o++):p=new v(r+"."+n.slice(1)),f=p,a=s=p=B(p.minus(1),p.plus(1),l,1),h=k(p.times(p),l,1),i=3;;){if(s=k(s.times(h),l,1),C((c=a.plus(B(s,new v(i),l,1))).d).slice(0,l)===C(a.d).slice(0,l)){if(a=a.times(2),0!==o&&(a=a.plus(U(v,l+2,y).times(o+""))),a=B(a,new v(d),l,1),null!=t)return v.precision=y,a;if(!M(a.d,l-10,w,u))return k(a,v.precision=y,w,m=!0);v.precision=l+=10,c=s=p=B(f.minus(1),f.plus(1),l,1),h=k(p.times(p),l,1),i=u=1}a=c,i+=2}}function z(e){return String(e.s*e.s/0)}function W(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;48===t.charCodeAt(r);r++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(r,i)){if(i-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%7,n<0&&(r+=7),r<i){for(r&&e.d.push(+t.slice(0,r)),i-=7;r<i;)e.d.push(+t.slice(r,r+=7));r=7-(t=t.slice(r)).length}else r-=i;for(;r--;)t+="0";e.d.push(+t),m&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function $(e,t){var n,r,i,o,s,u,a,c,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),A.test(t))return W(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(_.test(t))n=16,t=t.toLowerCase();else if(N.test(t))n=2;else{if(!T.test(t))throw Error(v+t);n=8}for((o=t.search(/p/i))>0?(a=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),s=(o=t.indexOf("."))>=0,r=e.constructor,s&&(o=(u=(t=t.replace(".","")).length)-o,i=Z(r,new r(n),o,2*o)),o=l=(c=P(t,n,O)).length-1;0===c[o];--o)c.pop();return o<0?new r(0*e.s):(e.e=q(c,l),e.d=c,m=!1,s&&(e=B(e,i,4*u)),a&&(e=e.times(Math.abs(a)<54?E(2,a):He.pow(2,a))),m=!0,e)}function J(e,t,n,r,i){var o,s,u,a,c=e.precision,l=Math.ceil(c/7);for(m=!1,a=n.times(n),u=new e(r);;){if(s=B(u.times(a),new e(t++*t++),c,1),u=i?r.plus(s):r.minus(s),r=B(s.times(a),new e(t++*t++),c,1),void 0!==(s=u.plus(r)).d[l]){for(o=l;s.d[o]===u.d[o]&&o--;);if(-1==o)break}o=u,u=r,r=s,s=o}return m=!0,s.d.length=l+1,s}function K(e,t){for(var n=e;--t;)n*=e;return n}function Q(e,t){var n,r=t.s<0,i=j(e,e.precision,1),o=i.times(.5);if((t=t.abs()).lte(o))return a=r?4:1,t;if((n=t.divToInt(i)).isZero())a=r?3:2;else{if((t=t.minus(n.times(i))).lte(o))return a=G(n)?r?2:3:r?4:1,t;a=G(n)?r?1:4:r?3:2}return t.minus(i).abs()}function ee(e,t,n,r){var i,o,s,a,c,h,d,p,m,g=e.constructor,v=void 0!==n;if(v?(F(n,1,l),void 0===r?r=g.rounding:F(r,0,8)):(n=g.precision,r=g.rounding),e.isFinite()){for(v?(i=2,16==t?n=4*n-3:8==t&&(n=3*n-2)):i=t,(s=(d=I(e)).indexOf("."))>=0&&(d=d.replace(".",""),(m=new g(1)).e=d.length-s,m.d=P(I(m),10,i),m.e=m.d.length),o=c=(p=P(d,10,i)).length;0==p[--c];)p.pop();if(p[0]){if(s<0?o--:((e=new g(e)).d=p,e.e=o,p=(e=B(e,m,n,r,0,i)).d,o=e.e,h=u),s=p[n],a=i/2,h=h||void 0!==p[n+1],h=r<4?(void 0!==s||h)&&(0===r||r===(e.s<0?3:2)):s>a||s===a&&(4===r||h||6===r&&1&p[n-1]||r===(e.s<0?8:7)),p.length=n,h)for(;++p[--n]>i-1;)p[n]=0,n||(++o,p.unshift(1));for(c=p.length;!p[c-1];--c);for(s=0,d="";s<c;s++)d+=f.charAt(p[s]);if(v){if(c>1)if(16==t||8==t){for(s=16==t?4:3,--c;c%s;c++)d+="0";for(c=(p=P(d,i,t)).length;!p[c-1];--c);for(s=1,d="1.";s<c;s++)d+=f.charAt(p[s])}else d=d.charAt(0)+"."+d.slice(1);d=d+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)d="0"+d;d="0."+d}else if(++o>c)for(o-=c;o--;)d+="0";else o<c&&(d=d.slice(0,o)+"."+d.slice(o))}else d=v?"0p+0":"0";d=(16==t?"0x":2==t?"0b":8==t?"0o":"")+d}else d=z(e);return e.s<0?"-"+d:d}function te(e,t){if(e.length>t)return e.length=t,!0}function ne(e){return new this(e).abs()}function re(e){return new this(e).acos()}function ie(e){return new this(e).acosh()}function oe(e,t){return new this(e).plus(t)}function se(e){return new this(e).asin()}function ue(e){return new this(e).asinh()}function ae(e){return new this(e).atan()}function ce(e){return new this(e).atanh()}function le(e,t){e=new this(e),t=new this(t);var n,r=this.precision,i=this.rounding,o=r+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(n=t.s<0?j(this,r,i):new this(0)).s=e.s:!e.d||t.isZero()?(n=j(this,o,1).times(.5)).s=e.s:t.s<0?(this.precision=o,this.rounding=1,n=this.atan(B(e,t,o,1)),t=j(this,o,1),this.precision=r,this.rounding=i,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(B(e,t,o,1)):(n=j(this,o,1).times(t.s>0?.25:.75)).s=e.s:n=new this(NaN),n}function fe(e){return new this(e).cbrt()}function he(e){return k(e=new this(e),e.e+1,2)}function de(e,t,n){return new this(e).clamp(t,n)}function pe(e){if(!e||"object"!==s(e))throw Error(g+"Object expected");var t,n,r,i=!0===e.defaults,o=["precision",1,l,"rounding",0,8,"toExpNeg",-c,0,"toExpPos",0,c,"maxE",0,c,"minE",-c,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(n=o[t],i&&(this[n]=p[n]),void 0!==(r=e[n])){if(!(x(r)===r&&r>=o[t+1]&&r<=o[t+2]))throw Error(v+n+": "+r);this[n]=r}if(n="crypto",i&&(this[n]=p[n]),void 0!==(r=e[n])){if(!0!==r&&!1!==r&&0!==r&&1!==r)throw Error(v+n+": "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(y);this[n]=!0}else this[n]=!1}return this}function me(e){return new this(e).cos()}function ge(e){return new this(e).cosh()}function ve(e,t){return new this(e).div(t)}function we(e){return new this(e).exp()}function ye(e){return k(e=new this(e),e.e+1,3)}function be(){var e,t,n=new this(0);for(m=!1,e=0;e<arguments.length;)if((t=new this(arguments[e++])).d)n.d&&(n=n.plus(t.times(t)));else{if(t.s)return m=!0,new this(1/0);n=t}return m=!0,n.sqrt()}function xe(e){return e instanceof He||e&&e.toStringTag===b||!1}function Ee(e){return new this(e).ln()}function Ne(e,t){return new this(e).log(t)}function _e(e){return new this(e).log(2)}function Te(e){return new this(e).log(10)}function Ae(){return X(this,arguments,"lt")}function Oe(){return X(this,arguments,"gt")}function Re(e,t){return new this(e).mod(t)}function Se(e,t){return new this(e).mul(t)}function Le(e,t){return new this(e).pow(t)}function Ce(e){var t,n,r,i,o=0,s=new this(1),u=[];if(void 0===e?e=this.precision:F(e,1,l),r=Math.ceil(e/7),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(r));o<r;)(i=t[o])>=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:u[o++]=i%1e7;else{if(!crypto.randomBytes)throw Error(y);for(t=crypto.randomBytes(r*=4);o<r;)(i=t[o]+(t[o+1]<<8)+(t[o+2]<<16)+((127&t[o+3])<<24))>=214e7?crypto.randomBytes(4).copy(t,o):(u.push(i%1e7),o+=4);o=r/4}else for(;o<r;)u[o++]=1e7*Math.random()|0;for(e%=7,(r=u[--o])&&e&&(i=E(10,7-e),u[o]=(r/i|0)*i);0===u[o];o--)u.pop();if(o<0)n=0,u=[0];else{for(n=-1;0===u[0];n-=7)u.shift();for(r=1,i=u[0];i>=10;i/=10)r++;r<7&&(n-=7-r)}return s.e=n,s.d=u,s}function Fe(e){return k(e=new this(e),e.e+1,this.rounding)}function Me(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function Pe(e){return new this(e).sin()}function Be(e){return new this(e).sinh()}function ke(e){return new this(e).sqrt()}function Ie(e,t){return new this(e).sub(t)}function qe(){var e=0,t=arguments,n=new this(t[e]);for(m=!1;n.s&&++e<t.length;)n=n.plus(t[e]);return m=!0,k(n,this.precision,this.rounding)}function Ue(e){return new this(e).tan()}function je(e){return new this(e).tanh()}function De(e){return k(e=new this(e),e.e+1,1)}L[Symbol.for("nodejs.util.inspect.custom")]=L.toString,L[Symbol.toStringTag]="Decimal";var He=L.constructor=function e(t){var n,r,i;function o(e){var t,n,r,i=this;if(!(i instanceof o))return new o(e);if(i.constructor=o,xe(e))return i.s=e.s,void(m?!e.d||e.e>o.maxE?(i.e=NaN,i.d=null):e.e<o.minE?(i.e=0,i.d=[0]):(i.e=e.e,i.d=e.d.slice()):(i.e=e.e,i.d=e.d?e.d.slice():e.d));if("number"===(r=s(e))){if(0===e)return i.s=1/e<0?-1:1,i.e=0,void(i.d=[0]);if(e<0?(e=-e,i.s=-1):i.s=1,e===~~e&&e<1e7){for(t=0,n=e;n>=10;n/=10)t++;return void(m?t>o.maxE?(i.e=NaN,i.d=null):t<o.minE?(i.e=0,i.d=[0]):(i.e=t,i.d=[e]):(i.e=t,i.d=[e]))}return 0*e!=0?(e||(i.s=NaN),i.e=NaN,void(i.d=null)):W(i,e.toString())}if("string"!==r)throw Error(v+e);return 45===(n=e.charCodeAt(0))?(e=e.slice(1),i.s=-1):(43===n&&(e=e.slice(1)),i.s=1),A.test(e)?W(i,e):$(i,e)}if(o.prototype=L,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=pe,o.clone=e,o.isDecimal=xe,o.abs=ne,o.acos=re,o.acosh=ie,o.add=oe,o.asin=se,o.asinh=ue,o.atan=ae,o.atanh=ce,o.atan2=le,o.cbrt=fe,o.ceil=he,o.clamp=de,o.cos=me,o.cosh=ge,o.div=ve,o.exp=we,o.floor=ye,o.hypot=be,o.ln=Ee,o.log=Ne,o.log10=Te,o.log2=_e,o.max=Ae,o.min=Oe,o.mod=Re,o.mul=Se,o.pow=Le,o.random=Ce,o.round=Fe,o.sign=Me,o.sin=Pe,o.sinh=Be,o.sqrt=ke,o.sub=Ie,o.sum=qe,o.tan=Ue,o.tanh=je,o.trunc=De,void 0===t&&(t={}),t&&!0!==t.defaults)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],n=0;n<i.length;)t.hasOwnProperty(r=i[n++])||(t[r]=this[r]);return o.config(t),o}(p);h=new He(h),d=new He(d);var Ze=function(e){return 1/e},Ge=function(){var e=t(o.mark((function e(){var t,n,r,i,s=arguments;return o.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s.length>0&&void 0!==s[0]?s[0]:10,(n=s.length>1&&void 0!==s[1]?s[1]:10)<10&&(n=10),r=[],i=[],e.abrupt("return",new Promise((function(e){var o=function(s){if(r.unshift(s),r.length>t){var u=r.pop(),a=1e3*t/(s-u);if(i.unshift(a),i.length==n.length)return cancelAnimationFrame(c),void e(i)}var c=window.requestAnimationFrame(o)};window.requestAnimationFrame(o)})));case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Xe=function(){var e=t(o.mark((function e(){var t,n,r,i,s,u,a,c=arguments;return o.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=c.length>0&&void 0!==c[0]?c[0]:10,n=c.length>1&&void 0!==c[1]?c[1]:10,e.next=4,Ge(t,n);case 4:for(r=e.sent,i={},s=[],u=0;u<r.length;u++)i[r[u]]||(i[r[u]]=0),i[r[u]]+=1;return(s=Object.keys(i).map(Number).filter((function(e){return i[e]==Math.max.apply(null,Object.values(i))}))).length>1&&(s=[s.reduce((function(e,t){return e+t}))/s.length]),a=Number(s.shift().toFixed(7)),e.abrupt("return",a);case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ve=new He(2).times(He.acos(-1));function Ye(e){for(var t=Math.pow(10,function(e){if(Math.floor(e)===Number(e))return 0;var t=e.toString().split(".")[1].length;if(t<3)return t;throw"Stimuli frequencies must have less than 3 decimal places."}(e)),n=1;n<=t;n+=1){if(0===new He(n).times(e).mod(1).toNumber())return n}throw"Failed to calculate the required number of seconds."}function ze(e){var t=new He(50),n=Ve.times(t.div(100));return 2*(function(e,t){var n=e.div(t),r=new He(n.toFixed(0));if(n.minus(r).div(r).abs().toNumber()<Number.EPSILON)return new He(0);var i=n.floor(),o=t.times(i),s=Math.sign(t.toNumber()),u=e.minus(o);return e.equals(t)||u.equals(0)||Math.sign(u.toNumber())!=s&&(u=u.abs().times(s)),u}(e,Ve).toNumber()<n.toNumber()?1:0)-1}function We(e,t){return"@keyframes ".concat(t," { ").concat(e," }")}var $e=Object.freeze({__proto__:null,getAnimationInfo:function(e,t){for(var n="stimulus_"+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:Math.floor(1e6*Math.random())),r=Ye(e.frequency),i=new He(0),o="",s=0,u=new He(r).times(t).ceil().toNumber(),a=new He(100).div(new He(u)),c=0;c<u;c++){var l=ze(new He(Ve).times(e.frequency).times(new He(c).div(t)).add(e.phaseShift)),f=new He(.5).times(new He(1).add(l)).toNumber();""!==o&&s==f||(o+="".concat(i.toNumber(),"% { opacity: ").concat(f,"; } "),s=f),i=i.add(a)}var h=new He(1).div(t).times(u).toNumber();return{rule:We(o,n),duration:h,type:" step-end infinite",name:n}}});var Je=Object.freeze({__proto__:null,getAnimationInfo:function(e,t){return{duration:function(e,t){var n=Ze(e),r=Ze(t);return Math.ceil(r/n)*n}(t,e.frequency).toString(),name:"flicker",type:" step-end infinite",rule:"\n@keyframes flicker {\n 0% { opacity: 0; }\n 50% { opacity: 1; }\n}"}}}),Ke={approximation:$e,periodic:Je};function Qe(){return Qe=t(o.mark((function e(){var t,n,r,i,s,u,a,c,l,f,h,d,p,m,g,v=arguments;return o.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=v.length>0&&void 0!==v[0]?v[0]:"periodic",n=v.length>1?v[1]:void 0,r=v.length>2?v[2]:void 0,e.next=5,Xe(10,r);case 5:if(i=e.sent,t in Ke){e.next=10;break}throw"Method not available for CSS!";case 10:for((s=document.createElement("style")).type="text/css",document.head.appendChild(s),u=0;u<n.length;u++)(l=n[u].getAttribute("data-light-color"))&&(f=l.split(","),h=f.slice(0,3).map((function(e){return 255*(null!=e?e:1)})),n[u].style.backgroundColor="rgba(".concat(h,",").concat(f[3],")")),n[u].style.visibility="visible",d=Number(n[u].getAttribute("data-frequency")),p=Number(n[u].getAttribute("data-phase-shift")),m=Ke[t].getAnimationInfo({frequency:d,phaseShift:p},i),s.sheet.insertRule(m.rule,null!==(a=null===(c=s.cssRules)||void 0===c?void 0:c.length)&&void 0!==a?a:0),g=String(m.duration).concat("s ",m.name,m.type),n[u].style.animation=g;return e.abrupt("return",(function(){s.remove(),n.forEach((function(e){e.style.animation="",e.style.visibility="",e.style.backgroundColor=""}))}));case 15:case"end":return e.stop()}}),e)}))),Qe.apply(this,arguments)}var et=Object.freeze({__proto__:null,start:function(){return Qe.apply(this,arguments)}}),tt=document.createElement("canvas"),nt=tt.getContext("webgl",{alpha:!1});tt.width=10,tt.height=10;var rt=document.createElement("canvas"),it=rt.getContext("webgl",{alpha:!1});rt.width=10,rt.height=10;var ot="attribute vec2 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;void main() { gl_Position = vec4(a_position, 0, 1); v_texCoord = a_texCoord; }",st="precision mediump float;uniform sampler2D u_image;varying vec2 v_texCoord;void main() { gl_FragColor = texture2D(u_image, v_texCoord); }",ut=new Float32Array([-1,1,1,1,-1,-1,1,-1]),at=function(e){return Math.log(e)/Math.log(2)%1==0};function ct(e,t){return it.clearColor(e[0],e[1],e[2],e[3]),it.clear(it.COLOR_BUFFER_BIT),nt.clearColor(t[0],t[1],t[2],t[3]),nt.clear(nt.COLOR_BUFFER_BIT),{darkOffScreenCanvas:rt,lightOffScreenCanvas:tt}}function lt(e,t,n){var r=e.createProgram(),i=ft(e,t,e.VERTEX_SHADER),o=ft(e,n,e.FRAGMENT_SHADER);if(e.attachShader(r,i),e.attachShader(r,o),e.linkProgram(r),!e.getProgramParameter(r,e.LINK_STATUS))throw e.getProgramInfoLog(r);return r}function ft(e,t,n){var r=e.createShader(n);if(e.shaderSource(r,t),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw e.getShaderInfoLog(r);return r}function ht(e){var t=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,ut,e.STATIC_DRAW),t}function dt(e,t){var n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),at(t.width)&&at(t.height)||(e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST)),n}function pt(e,t){!function(e){var t=e.clientWidth,n=e.clientHeight;e.width===t&&e.height===n||(e.width=t,e.height=n)}(e.canvas),e.enable(e.SCISSOR_TEST),e.canvas.style.transform="translateY(".concat(window.scrollY,"px)");var n=t.element.getBoundingClientRect(),r=n.right-n.left,i=n.bottom-n.top,o=n.left,s=e.canvas.clientHeight-n.bottom-1;e.viewport(o,s,r,i),e.scissor(o,s,r,i),e.clear(e.COLOR_BUFFER_BIT),e.bindTexture(e.TEXTURE_2D,t.texture),e.enableVertexAttribArray(t.texCoordLoc),e.bindBuffer(e.ARRAY_BUFFER,t.coordBuffer),e.vertexAttribPointer(t.texCoordLoc,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_STRIP,0,4)}var mt=Object.freeze({__proto__:null,calculateStimuliIntensities:function(e,t){for(var n=Ye(e.frequency),r=[],i=new He(n).times(t).ceil().toNumber(),o=0;o<i;o++){var s=ze(new He(Ve).times(e.frequency).times(new He(o).div(t)).add(e.phaseShift)),u=new He(.5).times(new He(1).add(s));r.push(u.toNumber())}return r}});function gt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function vt(e){return function(e){if(Array.isArray(e))return gt(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 gt(e,t);var n={}.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)?gt(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var wt=Object.freeze({__proto__:null,calculateStimuliIntensities:function(e,t){var n=[],r=function(e,t){var n=Ze(t),r=Ze(e);return Math.round(r/n)}(e.frequency,t)/2;return n.push.apply(n,vt(Array(Math.ceil(r)).fill(1))),n.push.apply(n,vt(Array(Math.floor(r)).fill(0))),n}}),yt={approximation:mt,periodic:wt};function bt(){return bt=t(o.mark((function e(){var t,n,r,i,s,u,a,c,l,f,h,d,p,m,g,v,w,y,b,x,E,N,_,T,A,O,R=arguments;return o.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=R.length>0&&void 0!==R[0]?R[0]:"periodic",n=R.length>1?R[1]:void 0,r=R.length>2?R[2]:void 0,i=R.length>3&&void 0!==R[3]?R[3]:10,e.next=6,Xe(10,i);case 6:if(s=e.sent,u=[],t in yt){e.next=12;break}throw"Method not available for WebGL!";case 12:if(r instanceof HTMLCanvasElement){e.next=16;break}throw"canvas argument is not an HTMLCanvasElement!";case 16:for(a=r.getContext("webgl",{powerPreference:"high-performance",alpha:!1}),c=lt(a,ot,st),l=a.getAttribLocation(c,"a_position"),f=a.getAttribLocation(c,"a_texCoord"),h=ht(a),a.useProgram(c),a.enableVertexAttribArray(l),a.bindBuffer(a.ARRAY_BUFFER,h),a.vertexAttribPointer(l,2,a.FLOAT,!1,0,0),d=0;d<n.length;d++)g=(null!==(p=n[d].getAttribute("data-dark-color"))&&void 0!==p?p:"0,0,0,1").split(",").map(Number),v=(null!==(m=n[d].getAttribute("data-light-color"))&&void 0!==m?m:"1,1,1,1").split(",").map(Number),w=ct(g,v),y=Number(n[d].getAttribute("data-frequency")),b=Number(n[d].getAttribute("data-phase-shift")),x=yt[t].calculateStimuliIntensities({frequency:y,phaseShift:b},s),E=ht(a),N=dt(a,w.darkOffScreenCanvas),_=ht(a),T=dt(a,w.lightOffScreenCanvas),A={element:n[d],stimulusCycle:{intensities:x,maxFrames:x.length},textures:{darkTexture:N,lightTexture:T,texCoordLocation:f},coordBuffers:{darkTexCoordBuffer:E,lightTexCoordBuffer:_},counter:0},O={id:null},u.push(xt(performance.now(),A,a,O));case 26:return e.abrupt("return",(function(){u.forEach((function(e){return window.cancelAnimationFrame(e.id)})),a.clear(a.DEPTH_BUFFER_BIT|a.COLOR_BUFFER_BIT|a.STENCIL_BUFFER_BIT)}));case 27:case"end":return e.stop()}}),e)}))),bt.apply(this,arguments)}function xt(e,t,n,r){return 1===t.stimulusCycle.intensities[t.counter]?pt(n,{element:t.element,coordBuffer:t.coordBuffers.lightTexCoordBuffer,texCoordLoc:t.textures.texCoordLocation,texture:t.textures.lightTexture}):pt(n,{element:t.element,coordBuffer:t.coordBuffers.darkTexCoordBuffer,texCoordLoc:t.textures.texCoordLocation,texture:t.textures.darkTexture}),t.counter<t.stimulusCycle.maxFrames-1?t.counter++:t.counter=0,r.id=window.requestAnimationFrame((function(e){xt(e,t,n,r)})),r}var Et=Object.freeze({__proto__:null,start:function(){return bt.apply(this,arguments)},animate:xt});function Nt(e){var t=function(e,t){if("object"!=s(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==s(t)?t:t+""}function _t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Nt(r.key),r)}}function Tt(e,t,n){return t&&_t(e.prototype,t),n&&_t(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function At(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ot(e,t){if(t&&("object"==s(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Rt(e){return Rt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Rt(e)}function St(e,t){return St=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},St(e,t)}function Lt(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&&St(e,t)}function Ct(e,t,n){return(t=Nt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ft=Tt((function e(n){var r=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"periodic",s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;At(this,e),Ct(this,"refreshRate",null),Ct(this,"elements",new Map),Ct(this,"samples",10),Ct(this,"active",!1),Ct(this,"start",t(o.mark((function e(){var t,n=arguments;return o.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>0&&void 0!==n[0]?n[0]:Array.from(r.elements.values()),Array.isArray(t)||(t=t instanceof HTMLElement?[t]:Array.from(t)),r.active){e.next=7;break}return r.onstart(),e.next=6,Xe(10,r.samples);case 6:r.refreshRate=e.sent;case 7:t.forEach((function(e,t){var n=e instanceof HTMLElement?e:e.element;e=r.set(n),r.animate(e)})),r.active=!0;case 9:case"end":return e.stop()}}),e)})))),Ct(this,"set",(function(e){var t,n,i,o,s=null!==(t=Array.from(r.elements.values()).find((function(t){return t.element===e})))&&void 0!==t?t:{};return s.element=e,s.id=null!==(n=s.id)&&void 0!==n?n:Math.floor(1e6*Math.random()),s.frequency=Number(null!==(i=e.getAttribute("data-frequency"))&&void 0!==i?i:"0"),s.light=e.getAttribute("data-light-color"),s.dark=e.getAttribute("data-dark-color"),s.phaseShift=Number(null!==(o=e.getAttribute("data-phase-shift"))&&void 0!==o?o:"0"),r.elements.set(s.id,s),s})),Ct(this,"delete",(function(e){Array.from(r.elements).find((function(t,n){if(t[1].element===e)return r.ondelete(t[1]),r.elements.delete(t[0])}))||r.ondelete({element:e})})),Ct(this,"stop",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Array.from(r.elements.values()).map((function(e){return e.element}));Array.isArray(e)||(e=e instanceof HTMLElement?[e]:Array.from(e)),r.elements.forEach((function(t){e.includes(t.element)&&r.ondelete(t)})),e.length===r.elements.size&&(r.onstop(),r.active=!1)})),Ct(this,"reset",(function(){r.stop(),r.elements.forEach((function(e){return r.delete(e.element)}))})),Ct(this,"onstart",(function(){})),Ct(this,"ondelete",(function(){})),Ct(this,"onstop",(function(){})),Ct(this,"calculateRefreshRate",Xe),this.technique=n[i],this.samples=s}));function Mt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Mt=function(){return!!e})()}var Pt=function(){function e(){var t,n,r,i,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"periodic",s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return At(this,e),n=this,i=[{approximation:$e,periodic:Je},o,s],r=Rt(r=e),Ct(t=Ot(n,Mt()?Reflect.construct(r,i||[],Rt(n).constructor):r.apply(n,i)),"style",document.createElement("style")),Ct(t,"onstart",(function(){t.style.type="text/css",document.head.appendChild(t.style)})),Ct(t,"ondelete",(function(e){e.element.style.animation="",e.element.style.visibility="",e.element.style.backgroundColor=""})),Ct(t,"onstop",(function(){t.style.remove()})),Ct(t,"animate",(function(e){var n,r;if(e.light){var i,o=e.light.split(","),s=o.slice(0,3).map((function(e){return 255*(null!=e?e:1)}));e.element.style.backgroundColor="rgba(".concat(s,",").concat(null!==(i=null==o?void 0:o[3])&&void 0!==i?i:1,")")}e.element.style.visibility="visible";var u=t.technique.getAnimationInfo(e,t.refreshRate,e.id),a=String(u.duration).concat("s ",u.name,u.type);t.style.sheet.insertRule(u.rule,null!==(n=null===(r=t.style.cssRules)||void 0===r?void 0:r.length)&&void 0!==n?n:0),e.element.style.animation=a})),t}return Lt(e,Ft),Tt(e)}();function Bt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Bt=function(){return!!e})()}var kt=function(){function e(){var t,n,r,i,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"periodic",s=arguments.length>1?arguments[1]:void 0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return At(this,e),n=this,i=[{approximation:mt,periodic:wt},o,u],r=Rt(r=e),Ct(t=Ot(n,Bt()?Reflect.construct(r,i||[],Rt(n).constructor):r.apply(n,i)),"gl",null),Ct(t,"texCoordLocation",null),Ct(t,"canvas",null),Ct(t,"onstart",(function(){t.gl=t.canvas.getContext("webgl",{powerPreference:"high-performance",alpha:!1});var e=lt(t.gl,ot,st),n=t.gl.getAttribLocation(e,"a_position");t.texCoordLocation=t.gl.getAttribLocation(e,"a_texCoord");var r=ht(t.gl);t.gl.useProgram(e),t.gl.enableVertexAttribArray(n),t.gl.bindBuffer(t.gl.ARRAY_BUFFER,r),t.gl.vertexAttribPointer(n,2,t.gl.FLOAT,!1,0,0)})),Ct(t,"ondelete",(function(e){window.cancelAnimationFrame(e.animationId),e.animate=null})),Ct(t,"onstop",(function(){t.gl.clear(t.gl.DEPTH_BUFFER_BIT|t.gl.COLOR_BUFFER_BIT|t.gl.STENCIL_BUFFER_BIT)})),Ct(t,"getElementInfo",(function(e){var n,r;e.dark=null!==(n=e.element.getAttribute("data-dark-color"))&&void 0!==n?n:"0,0,0,1",e.light=null!==(r=e.element.getAttribute("data-light-color"))&&void 0!==r?r:"1,1,1,1";var i=ct(e.dark.split(",").map(Number),e.light.split(",").map(Number)),o=t.technique.calculateStimuliIntensities(e,t.refreshRate),s=ht(t.gl),u=dt(t.gl,i.darkOffScreenCanvas),a=ht(t.gl),c=dt(t.gl,i.lightOffScreenCanvas);return{element:e.element,stimulusCycle:{intensities:o,maxFrames:o.length},textures:{darkTexture:u,lightTexture:c,texCoordLocation:t.texCoordLocation},coordBuffers:{darkTexCoordBuffer:s,lightTexCoordBuffer:a},counter:0}})),Ct(t,"animate",(function(e){var n=t.getElementInfo(e);e.animate=function(){1===n.stimulusCycle.intensities[n.counter]?pt(t.gl,{element:n.element,coordBuffer:n.coordBuffers.lightTexCoordBuffer,texCoordLoc:n.textures.texCoordLocation,texture:n.textures.lightTexture}):pt(t.gl,{element:n.element,coordBuffer:n.coordBuffers.darkTexCoordBuffer,texCoordLoc:n.textures.texCoordLocation,texture:n.textures.darkTexture}),n.counter<n.stimulusCycle.maxFrames-1?n.counter++:n.counter=0,e.animationId=window.requestAnimationFrame((function(t){return e.animate()}))},e.animate()})),t.canvas=s,t}return Lt(e,Ft),Tt(e)}();export{Pt as CSS,kt as WebGL,Xe as calculateRefreshRate,et as css,Et as webgl};
e.exports=n=function(){return i},e.exports.__esModule=!0,e.exports.default=e.exports;var r,i={},o=Object.prototype,s=o.hasOwnProperty,u=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function h(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(r){h=function(e,t,n){return e[t]=n}}function d(e,t,n,r){var i=t&&t.prototype instanceof b?t:b,o=Object.create(i.prototype),s=new M(r||[]);return u(o,"_invoke",{value:S(e,n,s)}),o}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}i.wrap=d;var m="suspendedStart",g="suspendedYield",v="executing",w="completed",y={};function b(){}function x(){}function E(){}var N={};h(N,c,(function(){return this}));var _=Object.getPrototypeOf,T=_&&_(_(P([])));T&&T!==o&&s.call(T,c)&&(N=T);var A=E.prototype=b.prototype=Object.create(N);function O(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function R(e,n){function r(i,o,u,a){var c=p(e[i],e,o);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==t(f)&&s.call(f,"__await")?n.resolve(f.__await).then((function(e){r("next",e,u,a)}),(function(e){r("throw",e,u,a)})):n.resolve(f).then((function(e){l.value=e,u(l)}),(function(e){return r("throw",e,u,a)}))}a(c.arg)}var i;u(this,"_invoke",{value:function(e,t){function o(){return new n((function(n,i){r(e,t,n,i)}))}return i=i?i.then(o,o):o()}})}function S(e,t,n){var i=m;return function(o,s){if(i===v)throw Error("Generator is already running");if(i===w){if("throw"===o)throw s;return{value:r,done:!0}}for(n.method=o,n.arg=s;;){var u=n.delegate;if(u){var a=L(u,n);if(a){if(a===y)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===m)throw i=w,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=v;var c=p(e,t,n);if("normal"===c.type){if(i=n.done?w:g,c.arg===y)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=w,n.method="throw",n.arg=c.arg)}}}function L(e,t){var n=t.method,i=e.iterator[n];if(i===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=r,L(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var o=p(i,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,y;var s=o.arg;return s?s.done?(t[e.resultName]=s.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=r),t.delegate=null,y):s:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function F(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function P(e){if(e||""===e){var n=e[c];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function t(){for(;++i<e.length;)if(s.call(e,i))return t.value=e[i],t.done=!1,t;return t.value=r,t.done=!0,t};return o.next=o}}throw new TypeError(t(e)+" is not iterable")}return x.prototype=E,u(A,"constructor",{value:E,configurable:!0}),u(E,"constructor",{value:x,configurable:!0}),x.displayName=h(E,f,"GeneratorFunction"),i.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===x||"GeneratorFunction"===(t.displayName||t.name))},i.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,h(e,f,"GeneratorFunction")),e.prototype=Object.create(A),e},i.awrap=function(e){return{__await:e}},O(R.prototype),h(R.prototype,l,(function(){return this})),i.AsyncIterator=R,i.async=function(e,t,n,r,o){void 0===o&&(o=Promise);var s=new R(d(e,t,n,r),o);return i.isGeneratorFunction(t)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},O(A),h(A,f,"Generator"),h(A,c,(function(){return this})),h(A,"toString",(function(){return"[object Generator]"})),i.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},i.values=P,M.prototype={constructor:M,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(F),!e)for(var t in this)"t"===t.charAt(0)&&s.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=r)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return u.type="throw",u.arg=e,t.next=n,i&&(t.method="next",t.arg=r),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],u=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var a=s.call(o,"catchLoc"),c=s.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&s.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),F(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;F(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:P(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=r),y}},i}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(n);var i=n.exports(),o=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}function s(e){return s="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},s(e)}var u,a,c=9e15,l=1e9,f="0123456789abcdef",h="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",d="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",p={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-c,maxE:c,crypto:!1},m=!0,g="[DecimalError] ",v=g+"Invalid argument: ",w=g+"Precision limit exceeded",y=g+"crypto unavailable",b="[object Decimal]",x=Math.floor,E=Math.pow,N=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,_=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,T=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,A=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,O=1e7,R=h.length-1,S=d.length-1,L={toStringTag:b};function C(e){var t,n,r,i=e.length-1,o="",s=e[0];if(i>0){for(o+=s,t=1;t<i;t++)(n=7-(r=e[t]+"").length)&&(o+=H(n)),o+=r;(n=7-(r=(s=e[t])+"").length)&&(o+=H(n))}else if(0===s)return"0";for(;s%10==0;)s/=10;return o+s}function F(e,t,n){if(e!==~~e||e<t||e>n)throw Error(v+e)}function M(e,t,n,r){var i,o,s,u;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=7,i=0):(i=Math.ceil((t+1)/7),t%=7),o=E(10,7-t),u=e[i]%o|0,null==r?t<3?(0==t?u=u/100|0:1==t&&(u=u/10|0),s=n<4&&99999==u||n>3&&49999==u||5e4==u||0==u):s=(n<4&&u+1==o||n>3&&u+1==o/2)&&(e[i+1]/o/100|0)==E(10,t-2)-1||(u==o/2||0==u)&&!(e[i+1]/o/100|0):t<4?(0==t?u=u/1e3|0:1==t?u=u/100|0:2==t&&(u=u/10|0),s=(r||n<4)&&9999==u||!r&&n>3&&4999==u):s=((r||n<4)&&u+1==o||!r&&n>3&&u+1==o/2)&&(e[i+1]/o/1e3|0)==E(10,t-3)-1,s}function P(e,t,n){for(var r,i,o=[0],s=0,u=e.length;s<u;){for(i=o.length;i--;)o[i]*=t;for(o[0]+=f.indexOf(e.charAt(s++)),r=0;r<o.length;r++)o[r]>n-1&&(void 0===o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}L.absoluteValue=L.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),k(e)},L.ceil=function(){return k(new this.constructor(this),this.e+1,2)},L.clampedTo=L.clamp=function(e,t){var n=this,r=n.constructor;if(e=new r(e),t=new r(t),!e.s||!t.s)return new r(NaN);if(e.gt(t))throw Error(v+t);return n.cmp(e)<0?e:n.cmp(t)>0?t:new r(n)},L.comparedTo=L.cmp=function(e){var t,n,r,i,o=this,s=o.d,u=(e=new o.constructor(e)).d,a=o.s,c=e.s;if(!s||!u)return a&&c?a!==c?a:s===u?0:!s^a<0?1:-1:NaN;if(!s[0]||!u[0])return s[0]?a:u[0]?-c:0;if(a!==c)return a;if(o.e!==e.e)return o.e>e.e^a<0?1:-1;for(t=0,n=(r=s.length)<(i=u.length)?r:i;t<n;++t)if(s[t]!==u[t])return s[t]>u[t]^a<0?1:-1;return r===i?0:r>i^a<0?1:-1},L.cosine=L.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+7,r.rounding=1,n=function(e,t){var n,r,i;if(t.isZero())return t;r=t.d.length,r<32?i=(1/K(4,n=Math.ceil(r/3))).toString():(n=16,i="2.3283064365386962890625e-10");e.precision+=n,t=J(e,1,t.times(i),new e(1));for(var o=n;o--;){var s=t.times(t);t=s.times(s).minus(s).times(8).plus(1)}return e.precision-=n,t}(r,Q(r,n)),r.precision=e,r.rounding=t,k(2==a||3==a?n.neg():n,e,t,!0)):new r(1):new r(NaN)},L.cubeRoot=L.cbrt=function(){var e,t,n,r,i,o,s,u,a,c,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(m=!1,(o=l.s*E(l.s*l,1/3))&&Math.abs(o)!=1/0?r=new f(o.toString()):(n=C(l.d),(o=((e=l.e)-n.length+1)%3)&&(n+=1==o||-2==o?"0":"00"),o=E(n,1/3),e=x((e+1)/3)-(e%3==(e<0?-1:2)),(r=new f(n=o==1/0?"5e"+e:(n=o.toExponential()).slice(0,n.indexOf("e")+1)+e)).s=l.s),s=(e=f.precision)+3;;)if(c=(a=(u=r).times(u).times(u)).plus(l),r=B(c.plus(l).times(u),c.plus(a),s+2,1),C(u.d).slice(0,s)===(n=C(r.d)).slice(0,s)){if("9999"!=(n=n.slice(s-3,s+1))&&(i||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(k(r,e+1,1),t=!r.times(r).times(r).eq(l));break}if(!i&&(k(u,e+1,0),u.times(u).times(u).eq(l))){r=u;break}s+=4,i=1}return m=!0,k(r,e,f.rounding,t)},L.decimalPlaces=L.dp=function(){var e,t=this.d,n=NaN;if(t){if(n=7*((e=t.length-1)-x(this.e/7)),e=t[e])for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n},L.dividedBy=L.div=function(e){return B(this,new this.constructor(e))},L.dividedToIntegerBy=L.divToInt=function(e){var t=this.constructor;return k(B(this,new t(e),0,1,1),t.precision,t.rounding)},L.equals=L.eq=function(e){return 0===this.cmp(e)},L.floor=function(){return k(new this.constructor(this),this.e+1,3)},L.greaterThan=L.gt=function(e){return this.cmp(e)>0},L.greaterThanOrEqualTo=L.gte=function(e){var t=this.cmp(e);return 1==t||0===t},L.hyperbolicCosine=L.cosh=function(){var e,t,n,r,i,o=this,s=o.constructor,u=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return u;n=s.precision,r=s.rounding,s.precision=n+Math.max(o.e,o.sd())+4,s.rounding=1,(i=o.d.length)<32?t=(1/K(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),o=J(s,1,o.times(t),new s(1),!0);for(var a,c=e,l=new s(8);c--;)a=o.times(o),o=u.minus(a.times(l.minus(a.times(l))));return k(o,s.precision=n,s.rounding=r,!0)},L.hyperbolicSine=L.sinh=function(){var e,t,n,r,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,n=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,(r=i.d.length)<3)i=J(o,2,i,i,!0);else{e=(e=1.4*Math.sqrt(r))>16?16:0|e,i=J(o,2,i=i.times(1/K(5,e)),i,!0);for(var s,u=new o(5),a=new o(16),c=new o(20);e--;)s=i.times(i),i=i.times(u.plus(s.times(a.times(s).plus(c))))}return o.precision=t,o.rounding=n,k(i,t,n,!0)},L.hyperbolicTangent=L.tanh=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,B(n.sinh(),n.cosh(),r.precision=e,r.rounding=t)):new r(n.s)},L.inverseCosine=L.acos=function(){var e,t=this,n=t.constructor,r=t.abs().cmp(1),i=n.precision,o=n.rounding;return-1!==r?0===r?t.isNeg()?j(n,i,o):new n(0):new n(NaN):t.isZero()?j(n,i+4,o).times(.5):(n.precision=i+6,n.rounding=1,t=t.asin(),e=j(n,i+4,o).times(.5),n.precision=i,n.rounding=o,e.minus(t))},L.inverseHyperbolicCosine=L.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,m=!1,n=n.times(n).minus(1).sqrt().plus(n),m=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)},L.inverseHyperbolicSine=L.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,m=!1,n=n.times(n).plus(1).sqrt().plus(n),m=!0,r.precision=e,r.rounding=t,n.ln())},L.inverseHyperbolicTangent=L.atanh=function(){var e,t,n,r,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,r=i.sd(),Math.max(r,e)<2*-i.e-1?k(new o(i),e,t,!0):(o.precision=n=r-i.e,i=B(i.plus(1),new o(1).minus(i),n+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5))):new o(NaN)},L.inverseSine=L.asin=function(){var e,t,n,r,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),n=o.precision,r=o.rounding,-1!==t?0===t?((e=j(o,n+4,r).times(.5)).s=i.s,e):new o(NaN):(o.precision=n+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=r,i.times(2)))},L.inverseTangent=L.atan=function(){var e,t,n,r,i,o,s,u,a,c=this,l=c.constructor,f=l.precision,h=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&f+4<=S)return(s=j(l,f+4,h).times(.25)).s=c.s,s}else{if(!c.s)return new l(NaN);if(f+4<=S)return(s=j(l,f+4,h).times(.5)).s=c.s,s}for(l.precision=u=f+10,l.rounding=1,e=n=Math.min(28,u/7+2|0);e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(m=!1,t=Math.ceil(u/7),r=1,a=c.times(c),s=new l(c),i=c;-1!==e;)if(i=i.times(a),o=s.minus(i.div(r+=2)),i=i.times(a),void 0!==(s=o.plus(i.div(r+=2))).d[t])for(e=t;s.d[e]===o.d[e]&&e--;);return n&&(s=s.times(2<<n-1)),m=!0,k(s,l.precision=f,l.rounding=h,!0)},L.isFinite=function(){return!!this.d},L.isInteger=L.isInt=function(){return!!this.d&&x(this.e/7)>this.d.length-2},L.isNaN=function(){return!this.s},L.isNegative=L.isNeg=function(){return this.s<0},L.isPositive=L.isPos=function(){return this.s>0},L.isZero=function(){return!!this.d&&0===this.d[0]},L.lessThan=L.lt=function(e){return this.cmp(e)<0},L.lessThanOrEqualTo=L.lte=function(e){return this.cmp(e)<1},L.logarithm=L.log=function(e){var t,n,r,i,o,s,u,a,c=this,l=c.constructor,f=l.precision,h=l.rounding;if(null==e)e=new l(10),t=!0;else{if(n=(e=new l(e)).d,e.s<0||!n||!n[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(n=c.d,c.s<0||!n||!n[0]||c.eq(1))return new l(n&&!n[0]?-1/0:1!=c.s?NaN:n?0:1/0);if(t)if(n.length>1)o=!0;else{for(i=n[0];i%10==0;)i/=10;o=1!==i}if(m=!1,s=Y(c,u=f+5),r=t?U(l,u+10):Y(e,u),M((a=B(s,r,u,1)).d,i=f,h))do{if(s=Y(c,u+=10),r=t?U(l,u+10):Y(e,u),a=B(s,r,u,1),!o){+C(a.d).slice(i+1,i+15)+1==1e14&&(a=k(a,f+1,0));break}}while(M(a.d,i+=10,h));return m=!0,k(a,f,h)},L.minus=L.sub=function(e){var t,n,r,i,o,s,u,a,c,l,f,h,d=this,p=d.constructor;if(e=new p(e),!d.d||!e.d)return d.s&&e.s?d.d?e.s=-e.s:e=new p(e.d||d.s!==e.s?d:NaN):e=new p(NaN),e;if(d.s!=e.s)return e.s=-e.s,d.plus(e);if(c=d.d,h=e.d,u=p.precision,a=p.rounding,!c[0]||!h[0]){if(h[0])e.s=-e.s;else{if(!c[0])return new p(3===a?-0:0);e=new p(d)}return m?k(e,u,a):e}if(n=x(e.e/7),l=x(d.e/7),c=c.slice(),o=l-n){for((f=o<0)?(t=c,o=-o,s=h.length):(t=h,n=l,s=c.length),o>(r=Math.max(Math.ceil(u/7),s)+2)&&(o=r,t.length=1),t.reverse(),r=o;r--;)t.push(0);t.reverse()}else{for((f=(r=c.length)<(s=h.length))&&(s=r),r=0;r<s;r++)if(c[r]!=h[r]){f=c[r]<h[r];break}o=0}for(f&&(t=c,c=h,h=t,e.s=-e.s),s=c.length,r=h.length-s;r>0;--r)c[s++]=0;for(r=h.length;r>o;){if(c[--r]<h[r]){for(i=r;i&&0===c[--i];)c[i]=O-1;--c[i],c[r]+=O}c[r]-=h[r]}for(;0===c[--s];)c.pop();for(;0===c[0];c.shift())--n;return c[0]?(e.d=c,e.e=q(c,n),m?k(e,u,a):e):new p(3===a?-0:0)},L.modulo=L.mod=function(e){var t,n=this,r=n.constructor;return e=new r(e),!n.d||!e.s||e.d&&!e.d[0]?new r(NaN):!e.d||n.d&&!n.d[0]?k(new r(n),r.precision,r.rounding):(m=!1,9==r.modulo?(t=B(n,e.abs(),0,3,1)).s*=e.s:t=B(n,e,0,r.modulo,1),t=t.times(e),m=!0,n.minus(t))},L.naturalExponential=L.exp=function(){return V(this)},L.naturalLogarithm=L.ln=function(){return Y(this)},L.negated=L.neg=function(){var e=new this.constructor(this);return e.s=-e.s,k(e)},L.plus=L.add=function(e){var t,n,r,i,o,s,u,a,c,l,f=this,h=f.constructor;if(e=new h(e),!f.d||!e.d)return f.s&&e.s?f.d||(e=new h(e.d||f.s===e.s?f:NaN)):e=new h(NaN),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(c=f.d,l=e.d,u=h.precision,a=h.rounding,!c[0]||!l[0])return l[0]||(e=new h(f)),m?k(e,u,a):e;if(o=x(f.e/7),r=x(e.e/7),c=c.slice(),i=o-r){for(i<0?(n=c,i=-i,s=l.length):(n=l,r=o,s=c.length),i>(s=(o=Math.ceil(u/7))>s?o+1:s+1)&&(i=s,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for((s=c.length)-(i=l.length)<0&&(i=s,n=l,l=c,c=n),t=0;i;)t=(c[--i]=c[i]+l[i]+t)/O|0,c[i]%=O;for(t&&(c.unshift(t),++r),s=c.length;0==c[--s];)c.pop();return e.d=c,e.e=q(c,r),m?k(e,u,a):e},L.precision=L.sd=function(e){var t,n=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(v+e);return n.d?(t=D(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t},L.round=function(){var e=this,t=e.constructor;return k(new t(e),e.e+1,t.rounding)},L.sine=L.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+7,r.rounding=1,n=function(e,t){var n,r=t.d.length;if(r<3)return t.isZero()?t:J(e,2,t,t);n=(n=1.4*Math.sqrt(r))>16?16:0|n,t=t.times(1/K(5,n)),t=J(e,2,t,t);for(var i,o=new e(5),s=new e(16),u=new e(20);n--;)i=t.times(t),t=t.times(o.plus(i.times(s.times(i).minus(u))));return t}(r,Q(r,n)),r.precision=e,r.rounding=t,k(a>2?n.neg():n,e,t,!0)):new r(NaN)},L.squareRoot=L.sqrt=function(){var e,t,n,r,i,o,s=this,u=s.d,a=s.e,c=s.s,l=s.constructor;if(1!==c||!u||!u[0])return new l(!c||c<0&&(!u||u[0])?NaN:u?s:1/0);for(m=!1,0==(c=Math.sqrt(+s))||c==1/0?(((t=C(u)).length+a)%2==0&&(t+="0"),c=Math.sqrt(t),a=x((a+1)/2)-(a<0||a%2),r=new l(t=c==1/0?"5e"+a:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+a)):r=new l(c.toString()),n=(a=l.precision)+3;;)if(r=(o=r).plus(B(s,o,n+2,1)).times(.5),C(o.d).slice(0,n)===(t=C(r.d)).slice(0,n)){if("9999"!=(t=t.slice(n-3,n+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(k(r,a+1,1),e=!r.times(r).eq(s));break}if(!i&&(k(o,a+1,0),o.times(o).eq(s))){r=o;break}n+=4,i=1}return m=!0,k(r,a,l.rounding,e)},L.tangent=L.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,(n=n.sin()).s=1,n=B(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,k(2==a||4==a?n.neg():n,e,t,!0)):new r(NaN)},L.times=L.mul=function(e){var t,n,r,i,o,s,u,a,c,l=this,f=l.constructor,h=l.d,d=(e=new f(e)).d;if(e.s*=l.s,!(h&&h[0]&&d&&d[0]))return new f(!e.s||h&&!h[0]&&!d||d&&!d[0]&&!h?NaN:h&&d?0*e.s:e.s/0);for(n=x(l.e/7)+x(e.e/7),(a=h.length)<(c=d.length)&&(o=h,h=d,d=o,s=a,a=c,c=s),o=[],r=s=a+c;r--;)o.push(0);for(r=c;--r>=0;){for(t=0,i=a+r;i>r;)u=o[i]+d[r]*h[i-r-1]+t,o[i--]=u%O|0,t=u/O|0;o[i]=(o[i]+t)%O|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=q(o,n),m?k(e,f.precision,f.rounding):e},L.toBinary=function(e,t){return ee(this,2,e,t)},L.toDecimalPlaces=L.toDP=function(e,t){var n=this,r=n.constructor;return n=new r(n),void 0===e?n:(F(e,0,l),void 0===t?t=r.rounding:F(t,0,8),k(n,e+n.e+1,t))},L.toExponential=function(e,t){var n,r=this,i=r.constructor;return void 0===e?n=I(r,!0):(F(e,0,l),void 0===t?t=i.rounding:F(t,0,8),n=I(r=k(new i(r),e+1,t),!0,e+1)),r.isNeg()&&!r.isZero()?"-"+n:n},L.toFixed=function(e,t){var n,r,i=this,o=i.constructor;return void 0===e?n=I(i):(F(e,0,l),void 0===t?t=o.rounding:F(t,0,8),n=I(r=k(new o(i),e+i.e+1,t),!1,e+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n},L.toFraction=function(e){var t,n,r,i,o,s,u,a,c,l,f,h,d=this,p=d.d,g=d.constructor;if(!p)return new g(d);if(c=n=new g(1),r=a=new g(0),s=(o=(t=new g(r)).e=D(p)-d.e-1)%7,t.d[0]=E(10,s<0?7+s:s),null==e)e=o>0?t:c;else{if(!(u=new g(e)).isInt()||u.lt(c))throw Error(v+u);e=u.gt(t)?o>0?t:c:u}for(m=!1,u=new g(C(p)),l=g.precision,g.precision=o=7*p.length*2;f=B(u,t,0,1,1),1!=(i=n.plus(f.times(r))).cmp(e);)n=r,r=i,i=c,c=a.plus(f.times(i)),a=i,i=t,t=u.minus(f.times(i)),u=i;return i=B(e.minus(n),r,0,1,1),a=a.plus(i.times(c)),n=n.plus(i.times(r)),a.s=c.s=d.s,h=B(c,r,o,1).minus(d).abs().cmp(B(a,n,o,1).minus(d).abs())<1?[c,r]:[a,n],g.precision=l,m=!0,h},L.toHexadecimal=L.toHex=function(e,t){return ee(this,16,e,t)},L.toNearest=function(e,t){var n=this,r=n.constructor;if(n=new r(n),null==e){if(!n.d)return n;e=new r(1),t=r.rounding}else{if(e=new r(e),void 0===t?t=r.rounding:F(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&(e.s=n.s),e}return e.d[0]?(m=!1,n=B(n,e,0,t,1).times(e),m=!0,k(n)):(e.s=n.s,n=e),n},L.toNumber=function(){return+this},L.toOctal=function(e,t){return ee(this,8,e,t)},L.toPower=L.pow=function(e){var t,n,r,i,o,s,u=this,a=u.constructor,c=+(e=new a(e));if(!(u.d&&e.d&&u.d[0]&&e.d[0]))return new a(E(+u,c));if((u=new a(u)).eq(1))return u;if(r=a.precision,o=a.rounding,e.eq(1))return k(u,r,o);if((t=x(e.e/7))>=e.d.length-1&&(n=c<0?-c:c)<=9007199254740991)return i=Z(a,u,n,r),e.s<0?new a(1).div(i):k(i,r,o);if((s=u.s)<0){if(t<e.d.length-1)return new a(NaN);if(1&e.d[t]||(s=1),0==u.e&&1==u.d[0]&&1==u.d.length)return u.s=s,u}return(t=0!=(n=E(+u,c))&&isFinite(n)?new a(n+"").e:x(c*(Math.log("0."+C(u.d))/Math.LN10+u.e+1)))>a.maxE+1||t<a.minE-1?new a(t>0?s/0:0):(m=!1,a.rounding=u.s=1,n=Math.min(12,(t+"").length),(i=V(e.times(Y(u,r+n)),r)).d&&M((i=k(i,r+5,1)).d,r,o)&&(t=r+10,+C((i=k(V(e.times(Y(u,t+n)),t),t+5,1)).d).slice(r+1,r+15)+1==1e14&&(i=k(i,r+1,0))),i.s=s,m=!0,a.rounding=o,k(i,r,o))},L.toPrecision=function(e,t){var n,r=this,i=r.constructor;return void 0===e?n=I(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(F(e,1,l),void 0===t?t=i.rounding:F(t,0,8),n=I(r=k(new i(r),e,t),e<=r.e||r.e<=i.toExpNeg,e)),r.isNeg()&&!r.isZero()?"-"+n:n},L.toSignificantDigits=L.toSD=function(e,t){var n=this.constructor;return void 0===e?(e=n.precision,t=n.rounding):(F(e,1,l),void 0===t?t=n.rounding:F(t,0,8)),k(new n(this),e,t)},L.toString=function(){var e=this,t=e.constructor,n=I(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+n:n},L.truncated=L.trunc=function(){return k(new this.constructor(this),this.e+1,1)},L.valueOf=L.toJSON=function(){var e=this,t=e.constructor,n=I(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+n:n};var B=function(){function e(e,t,n){var r,i=0,o=e.length;for(e=e.slice();o--;)r=e[o]*t+i,e[o]=r%n|0,i=r/n|0;return i&&e.unshift(i),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;i<n;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]<t[n]?1:0,e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;)e.shift()}return function(r,i,o,s,a,c){var l,f,h,d,p,m,g,v,w,y,b,E,N,_,T,A,R,S,L,C,F=r.constructor,M=r.s==i.s?1:-1,P=r.d,B=i.d;if(!(P&&P[0]&&B&&B[0]))return new F(r.s&&i.s&&(P?!B||P[0]!=B[0]:B)?P&&0==P[0]||!B?0*M:M/0:NaN);for(c?(p=1,f=r.e-i.e):(c=O,p=7,f=x(r.e/p)-x(i.e/p)),L=B.length,R=P.length,y=(w=new F(M)).d=[],h=0;B[h]==(P[h]||0);h++);if(B[h]>(P[h]||0)&&f--,null==o?(_=o=F.precision,s=F.rounding):_=a?o+(r.e-i.e)+1:o,_<0)y.push(1),m=!0;else{if(_=_/p+2|0,h=0,1==L){for(d=0,B=B[0],_++;(h<R||d)&&_--;h++)T=d*c+(P[h]||0),y[h]=T/B|0,d=T%B|0;m=d||h<R}else{for((d=c/(B[0]+1)|0)>1&&(B=e(B,d,c),P=e(P,d,c),L=B.length,R=P.length),A=L,E=(b=P.slice(0,L)).length;E<L;)b[E++]=0;(C=B.slice()).unshift(0),S=B[0],B[1]>=c/2&&++S;do{d=0,(l=t(B,b,L,E))<0?(N=b[0],L!=E&&(N=N*c+(b[1]||0)),(d=N/S|0)>1?(d>=c&&(d=c-1),1==(l=t(g=e(B,d,c),b,v=g.length,E=b.length))&&(d--,n(g,L<v?C:B,v,c))):(0==d&&(l=d=1),g=B.slice()),(v=g.length)<E&&g.unshift(0),n(b,g,E,c),-1==l&&(l=t(B,b,L,E=b.length))<1&&(d++,n(b,L<E?C:B,E,c)),E=b.length):0===l&&(d++,b=[0]),y[h++]=d,l&&b[0]?b[E++]=P[A]||0:(b=[P[A]],E=1)}while((A++<R||void 0!==b[0])&&_--);m=void 0!==b[0]}y[0]||y.shift()}if(1==p)w.e=f,u=m;else{for(h=1,d=y[0];d>=10;d/=10)h++;w.e=h+f*p-1,k(w,a?o+w.e+1:o,s,m)}return w}}();function k(e,t,n,r){var i,o,s,u,a,c,l,f,h,d=e.constructor;e:if(null!=t){if(!(f=e.d))return e;for(i=1,u=f[0];u>=10;u/=10)i++;if((o=t-i)<0)o+=7,s=t,a=(l=f[h=0])/E(10,i-s-1)%10|0;else if((h=Math.ceil((o+1)/7))>=(u=f.length)){if(!r)break e;for(;u++<=h;)f.push(0);l=a=0,i=1,s=(o%=7)-7+1}else{for(l=u=f[h],i=1;u>=10;u/=10)i++;a=(s=(o%=7)-7+i)<0?0:l/E(10,i-s-1)%10|0}if(r=r||t<0||void 0!==f[h+1]||(s<0?l:l%E(10,i-s-1)),c=n<4?(a||r)&&(0==n||n==(e.s<0?3:2)):a>5||5==a&&(4==n||r||6==n&&(o>0?s>0?l/E(10,i-s):0:f[h-1])%10&1||n==(e.s<0?8:7)),t<1||!f[0])return f.length=0,c?(t-=e.e+1,f[0]=E(10,(7-t%7)%7),e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=h,u=1,h--):(f.length=h+1,u=E(10,7-o),f[h]=s>0?(l/E(10,i-s)%E(10,s)|0)*u:0),c)for(;;){if(0==h){for(o=1,s=f[0];s>=10;s/=10)o++;for(s=f[0]+=u,u=1;s>=10;s/=10)u++;o!=u&&(e.e++,f[0]==O&&(f[0]=1));break}if(f[h]+=u,f[h]!=O)break;f[h--]=0,u=1}for(o=f.length;0===f[--o];)f.pop()}return m&&(e.e>d.maxE?(e.d=null,e.e=NaN):e.e<d.minE&&(e.e=0,e.d=[0])),e}function I(e,t,n){if(!e.isFinite())return z(e);var r,i=e.e,o=C(e.d),s=o.length;return t?(n&&(r=n-s)>0?o=o.charAt(0)+"."+o.slice(1)+H(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+H(-i-1)+o,n&&(r=n-s)>0&&(o+=H(r))):i>=s?(o+=H(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+H(r))):((r=i+1)<s&&(o=o.slice(0,r)+"."+o.slice(r)),n&&(r=n-s)>0&&(i+1===s&&(o+="."),o+=H(r))),o}function q(e,t){var n=e[0];for(t*=7;n>=10;n/=10)t++;return t}function U(e,t,n){if(t>R)throw m=!0,n&&(e.precision=n),Error(w);return k(new e(h),t,1,!0)}function j(e,t,n){if(t>S)throw Error(w);return k(new e(d),t,n,!0)}function D(e){var t=e.length-1,n=7*t+1;if(t=e[t]){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function H(e){for(var t="";e--;)t+="0";return t}function Z(e,t,n,r){var i,o=new e(1),s=Math.ceil(r/7+4);for(m=!1;;){if(n%2&&te((o=o.times(t)).d,s)&&(i=!0),0===(n=x(n/2))){n=o.d.length-1,i&&0===o.d[n]&&++o.d[n];break}te((t=t.times(t)).d,s)}return m=!0,o}function G(e){return 1&e.d[e.d.length-1]}function X(e,t,n){for(var r,i=new e(t[0]),o=0;++o<t.length;){if(!(r=new e(t[o])).s){i=r;break}i[n](r)&&(i=r)}return i}function V(e,t){var n,r,i,o,s,u,a,c=0,l=0,f=0,h=e.constructor,d=h.rounding,p=h.precision;if(!e.d||!e.d[0]||e.e>17)return new h(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(null==t?(m=!1,a=p):a=t,u=new h(.03125);e.e>-2;)e=e.times(u),f+=5;for(a+=r=Math.log(E(2,f))/Math.LN10*2+5|0,n=o=s=new h(1),h.precision=a;;){if(o=k(o.times(e),a,1),n=n.times(++l),C((u=s.plus(B(o,n,a,1))).d).slice(0,a)===C(s.d).slice(0,a)){for(i=f;i--;)s=k(s.times(s),a,1);if(null!=t)return h.precision=p,s;if(!(c<3&&M(s.d,a-r,d,c)))return k(s,h.precision=p,d,m=!0);h.precision=a+=10,n=o=u=new h(1),l=0,c++}s=u}}function Y(e,t){var n,r,i,o,s,u,a,c,l,f,h,d=1,p=e,g=p.d,v=p.constructor,w=v.rounding,y=v.precision;if(p.s<0||!g||!g[0]||!p.e&&1==g[0]&&1==g.length)return new v(g&&!g[0]?-1/0:1!=p.s?NaN:g?0:p);if(null==t?(m=!1,l=y):l=t,v.precision=l+=10,r=(n=C(g)).charAt(0),!(Math.abs(o=p.e)<15e14))return c=U(v,l+2,y).times(o+""),p=Y(new v(r+"."+n.slice(1)),l-10).plus(c),v.precision=y,null==t?k(p,y,w,m=!0):p;for(;r<7&&1!=r||1==r&&n.charAt(1)>3;)r=(n=C((p=p.times(e)).d)).charAt(0),d++;for(o=p.e,r>1?(p=new v("0."+n),o++):p=new v(r+"."+n.slice(1)),f=p,a=s=p=B(p.minus(1),p.plus(1),l,1),h=k(p.times(p),l,1),i=3;;){if(s=k(s.times(h),l,1),C((c=a.plus(B(s,new v(i),l,1))).d).slice(0,l)===C(a.d).slice(0,l)){if(a=a.times(2),0!==o&&(a=a.plus(U(v,l+2,y).times(o+""))),a=B(a,new v(d),l,1),null!=t)return v.precision=y,a;if(!M(a.d,l-10,w,u))return k(a,v.precision=y,w,m=!0);v.precision=l+=10,c=s=p=B(f.minus(1),f.plus(1),l,1),h=k(p.times(p),l,1),i=u=1}a=c,i+=2}}function z(e){return String(e.s*e.s/0)}function W(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;48===t.charCodeAt(r);r++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(r,i)){if(i-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%7,n<0&&(r+=7),r<i){for(r&&e.d.push(+t.slice(0,r)),i-=7;r<i;)e.d.push(+t.slice(r,r+=7));r=7-(t=t.slice(r)).length}else r-=i;for(;r--;)t+="0";e.d.push(+t),m&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function $(e,t){var n,r,i,o,s,u,a,c,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),A.test(t))return W(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(_.test(t))n=16,t=t.toLowerCase();else if(N.test(t))n=2;else{if(!T.test(t))throw Error(v+t);n=8}for((o=t.search(/p/i))>0?(a=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),s=(o=t.indexOf("."))>=0,r=e.constructor,s&&(o=(u=(t=t.replace(".","")).length)-o,i=Z(r,new r(n),o,2*o)),o=l=(c=P(t,n,O)).length-1;0===c[o];--o)c.pop();return o<0?new r(0*e.s):(e.e=q(c,l),e.d=c,m=!1,s&&(e=B(e,i,4*u)),a&&(e=e.times(Math.abs(a)<54?E(2,a):He.pow(2,a))),m=!0,e)}function J(e,t,n,r,i){var o,s,u,a,c=e.precision,l=Math.ceil(c/7);for(m=!1,a=n.times(n),u=new e(r);;){if(s=B(u.times(a),new e(t++*t++),c,1),u=i?r.plus(s):r.minus(s),r=B(s.times(a),new e(t++*t++),c,1),void 0!==(s=u.plus(r)).d[l]){for(o=l;s.d[o]===u.d[o]&&o--;);if(-1==o)break}o=u,u=r,r=s,s=o}return m=!0,s.d.length=l+1,s}function K(e,t){for(var n=e;--t;)n*=e;return n}function Q(e,t){var n,r=t.s<0,i=j(e,e.precision,1),o=i.times(.5);if((t=t.abs()).lte(o))return a=r?4:1,t;if((n=t.divToInt(i)).isZero())a=r?3:2;else{if((t=t.minus(n.times(i))).lte(o))return a=G(n)?r?2:3:r?4:1,t;a=G(n)?r?1:4:r?3:2}return t.minus(i).abs()}function ee(e,t,n,r){var i,o,s,a,c,h,d,p,m,g=e.constructor,v=void 0!==n;if(v?(F(n,1,l),void 0===r?r=g.rounding:F(r,0,8)):(n=g.precision,r=g.rounding),e.isFinite()){for(v?(i=2,16==t?n=4*n-3:8==t&&(n=3*n-2)):i=t,(s=(d=I(e)).indexOf("."))>=0&&(d=d.replace(".",""),(m=new g(1)).e=d.length-s,m.d=P(I(m),10,i),m.e=m.d.length),o=c=(p=P(d,10,i)).length;0==p[--c];)p.pop();if(p[0]){if(s<0?o--:((e=new g(e)).d=p,e.e=o,p=(e=B(e,m,n,r,0,i)).d,o=e.e,h=u),s=p[n],a=i/2,h=h||void 0!==p[n+1],h=r<4?(void 0!==s||h)&&(0===r||r===(e.s<0?3:2)):s>a||s===a&&(4===r||h||6===r&&1&p[n-1]||r===(e.s<0?8:7)),p.length=n,h)for(;++p[--n]>i-1;)p[n]=0,n||(++o,p.unshift(1));for(c=p.length;!p[c-1];--c);for(s=0,d="";s<c;s++)d+=f.charAt(p[s]);if(v){if(c>1)if(16==t||8==t){for(s=16==t?4:3,--c;c%s;c++)d+="0";for(c=(p=P(d,i,t)).length;!p[c-1];--c);for(s=1,d="1.";s<c;s++)d+=f.charAt(p[s])}else d=d.charAt(0)+"."+d.slice(1);d=d+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)d="0"+d;d="0."+d}else if(++o>c)for(o-=c;o--;)d+="0";else o<c&&(d=d.slice(0,o)+"."+d.slice(o))}else d=v?"0p+0":"0";d=(16==t?"0x":2==t?"0b":8==t?"0o":"")+d}else d=z(e);return e.s<0?"-"+d:d}function te(e,t){if(e.length>t)return e.length=t,!0}function ne(e){return new this(e).abs()}function re(e){return new this(e).acos()}function ie(e){return new this(e).acosh()}function oe(e,t){return new this(e).plus(t)}function se(e){return new this(e).asin()}function ue(e){return new this(e).asinh()}function ae(e){return new this(e).atan()}function ce(e){return new this(e).atanh()}function le(e,t){e=new this(e),t=new this(t);var n,r=this.precision,i=this.rounding,o=r+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(n=t.s<0?j(this,r,i):new this(0)).s=e.s:!e.d||t.isZero()?(n=j(this,o,1).times(.5)).s=e.s:t.s<0?(this.precision=o,this.rounding=1,n=this.atan(B(e,t,o,1)),t=j(this,o,1),this.precision=r,this.rounding=i,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(B(e,t,o,1)):(n=j(this,o,1).times(t.s>0?.25:.75)).s=e.s:n=new this(NaN),n}function fe(e){return new this(e).cbrt()}function he(e){return k(e=new this(e),e.e+1,2)}function de(e,t,n){return new this(e).clamp(t,n)}function pe(e){if(!e||"object"!==s(e))throw Error(g+"Object expected");var t,n,r,i=!0===e.defaults,o=["precision",1,l,"rounding",0,8,"toExpNeg",-c,0,"toExpPos",0,c,"maxE",0,c,"minE",-c,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(n=o[t],i&&(this[n]=p[n]),void 0!==(r=e[n])){if(!(x(r)===r&&r>=o[t+1]&&r<=o[t+2]))throw Error(v+n+": "+r);this[n]=r}if(n="crypto",i&&(this[n]=p[n]),void 0!==(r=e[n])){if(!0!==r&&!1!==r&&0!==r&&1!==r)throw Error(v+n+": "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(y);this[n]=!0}else this[n]=!1}return this}function me(e){return new this(e).cos()}function ge(e){return new this(e).cosh()}function ve(e,t){return new this(e).div(t)}function we(e){return new this(e).exp()}function ye(e){return k(e=new this(e),e.e+1,3)}function be(){var e,t,n=new this(0);for(m=!1,e=0;e<arguments.length;)if((t=new this(arguments[e++])).d)n.d&&(n=n.plus(t.times(t)));else{if(t.s)return m=!0,new this(1/0);n=t}return m=!0,n.sqrt()}function xe(e){return e instanceof He||e&&e.toStringTag===b||!1}function Ee(e){return new this(e).ln()}function Ne(e,t){return new this(e).log(t)}function _e(e){return new this(e).log(2)}function Te(e){return new this(e).log(10)}function Ae(){return X(this,arguments,"lt")}function Oe(){return X(this,arguments,"gt")}function Re(e,t){return new this(e).mod(t)}function Se(e,t){return new this(e).mul(t)}function Le(e,t){return new this(e).pow(t)}function Ce(e){var t,n,r,i,o=0,s=new this(1),u=[];if(void 0===e?e=this.precision:F(e,1,l),r=Math.ceil(e/7),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(r));o<r;)(i=t[o])>=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:u[o++]=i%1e7;else{if(!crypto.randomBytes)throw Error(y);for(t=crypto.randomBytes(r*=4);o<r;)(i=t[o]+(t[o+1]<<8)+(t[o+2]<<16)+((127&t[o+3])<<24))>=214e7?crypto.randomBytes(4).copy(t,o):(u.push(i%1e7),o+=4);o=r/4}else for(;o<r;)u[o++]=1e7*Math.random()|0;for(e%=7,(r=u[--o])&&e&&(i=E(10,7-e),u[o]=(r/i|0)*i);0===u[o];o--)u.pop();if(o<0)n=0,u=[0];else{for(n=-1;0===u[0];n-=7)u.shift();for(r=1,i=u[0];i>=10;i/=10)r++;r<7&&(n-=7-r)}return s.e=n,s.d=u,s}function Fe(e){return k(e=new this(e),e.e+1,this.rounding)}function Me(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function Pe(e){return new this(e).sin()}function Be(e){return new this(e).sinh()}function ke(e){return new this(e).sqrt()}function Ie(e,t){return new this(e).sub(t)}function qe(){var e=0,t=arguments,n=new this(t[e]);for(m=!1;n.s&&++e<t.length;)n=n.plus(t[e]);return m=!0,k(n,this.precision,this.rounding)}function Ue(e){return new this(e).tan()}function je(e){return new this(e).tanh()}function De(e){return k(e=new this(e),e.e+1,1)}L[Symbol.for("nodejs.util.inspect.custom")]=L.toString,L[Symbol.toStringTag]="Decimal";var He=L.constructor=function e(t){var n,r,i;function o(e){var t,n,r,i=this;if(!(i instanceof o))return new o(e);if(i.constructor=o,xe(e))return i.s=e.s,void(m?!e.d||e.e>o.maxE?(i.e=NaN,i.d=null):e.e<o.minE?(i.e=0,i.d=[0]):(i.e=e.e,i.d=e.d.slice()):(i.e=e.e,i.d=e.d?e.d.slice():e.d));if("number"===(r=s(e))){if(0===e)return i.s=1/e<0?-1:1,i.e=0,void(i.d=[0]);if(e<0?(e=-e,i.s=-1):i.s=1,e===~~e&&e<1e7){for(t=0,n=e;n>=10;n/=10)t++;return void(m?t>o.maxE?(i.e=NaN,i.d=null):t<o.minE?(i.e=0,i.d=[0]):(i.e=t,i.d=[e]):(i.e=t,i.d=[e]))}return 0*e!=0?(e||(i.s=NaN),i.e=NaN,void(i.d=null)):W(i,e.toString())}if("string"!==r)throw Error(v+e);return 45===(n=e.charCodeAt(0))?(e=e.slice(1),i.s=-1):(43===n&&(e=e.slice(1)),i.s=1),A.test(e)?W(i,e):$(i,e)}if(o.prototype=L,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=pe,o.clone=e,o.isDecimal=xe,o.abs=ne,o.acos=re,o.acosh=ie,o.add=oe,o.asin=se,o.asinh=ue,o.atan=ae,o.atanh=ce,o.atan2=le,o.cbrt=fe,o.ceil=he,o.clamp=de,o.cos=me,o.cosh=ge,o.div=ve,o.exp=we,o.floor=ye,o.hypot=be,o.ln=Ee,o.log=Ne,o.log10=Te,o.log2=_e,o.max=Ae,o.min=Oe,o.mod=Re,o.mul=Se,o.pow=Le,o.random=Ce,o.round=Fe,o.sign=Me,o.sin=Pe,o.sinh=Be,o.sqrt=ke,o.sub=Ie,o.sum=qe,o.tan=Ue,o.tanh=je,o.trunc=De,void 0===t&&(t={}),t&&!0!==t.defaults)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],n=0;n<i.length;)t.hasOwnProperty(r=i[n++])||(t[r]=this[r]);return o.config(t),o}(p);h=new He(h),d=new He(d);var Ze=function(e){return 1/e},Ge=function(){var e=t(o.mark((function e(){var t,n,r,i,s=arguments;return o.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s.length>0&&void 0!==s[0]?s[0]:10,(n=s.length>1&&void 0!==s[1]?s[1]:10)<10&&(n=10),r=[],i=[],e.abrupt("return",new Promise((function(e){var o=function(s){if(r.unshift(s),r.length>t){var u=r.pop(),a=1e3*t/(s-u);if(i.unshift(a),i.length==n)return cancelAnimationFrame(c),void e(i)}var c=window.requestAnimationFrame(o)};window.requestAnimationFrame(o)})));case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Xe=function(){var e=t(o.mark((function e(){var t,n,r,i,s,u,a,c=arguments;return o.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=c.length>0&&void 0!==c[0]?c[0]:10,n=c.length>1&&void 0!==c[1]?c[1]:10,e.next=4,Ge(t,n);case 4:for(r=e.sent,i={},s=[],u=0;u<r.length;u++)i[r[u]]||(i[r[u]]=0),i[r[u]]+=1;return(s=Object.keys(i).map(Number).filter((function(e){return i[e]==Math.max.apply(null,Object.values(i))}))).length>1&&(s=[s.reduce((function(e,t){return e+t}))/s.length]),a=Number(s.shift().toFixed(7)),e.abrupt("return",a);case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ve=new He(2).times(He.acos(-1));function Ye(e){for(var t=Math.pow(10,function(e){if(Math.floor(e)===Number(e))return 0;var t=e.toString().split(".")[1].length;if(t<3)return t;throw"Stimuli frequencies must have less than 3 decimal places."}(e)),n=1;n<=t;n+=1){if(0===new He(n).times(e).mod(1).toNumber())return n}throw"Failed to calculate the required number of seconds."}function ze(e){var t=new He(50),n=Ve.times(t.div(100));return 2*(function(e,t){var n=e.div(t),r=new He(n.toFixed(0));if(n.minus(r).div(r).abs().toNumber()<Number.EPSILON)return new He(0);var i=n.floor(),o=t.times(i),s=Math.sign(t.toNumber()),u=e.minus(o);return e.equals(t)||u.equals(0)||Math.sign(u.toNumber())!=s&&(u=u.abs().times(s)),u}(e,Ve).toNumber()<n.toNumber()?1:0)-1}function We(e,t){return"@keyframes ".concat(t," { ").concat(e," }")}var $e=Object.freeze({__proto__:null,getAnimationInfo:function(e,t){for(var n="stimulus_"+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:Math.floor(1e6*Math.random())),r=Ye(e.frequency),i=new He(0),o="",s=0,u=new He(r).times(t).ceil().toNumber(),a=new He(100).div(new He(u)),c=0;c<u;c++){var l=ze(new He(Ve).times(e.frequency).times(new He(c).div(t)).add(e.phaseShift)),f=new He(.5).times(new He(1).add(l)).toNumber();""!==o&&s==f||(o+="".concat(i.toNumber(),"% { opacity: ").concat(f,"; } "),s=f),i=i.add(a)}var h=new He(1).div(t).times(u).toNumber();return{rule:We(o,n),duration:h,type:" step-end infinite",name:n}}});var Je=Object.freeze({__proto__:null,getAnimationInfo:function(e,t){return{duration:function(e,t){var n=Ze(e),r=Ze(t);return Math.ceil(r/n)*n}(t,e.frequency).toString(),name:"flicker",type:" step-end infinite",rule:"\n@keyframes flicker {\n 0% { opacity: 0; }\n 50% { opacity: 1; }\n}"}}}),Ke={approximation:$e,periodic:Je};function Qe(){return Qe=t(o.mark((function e(){var t,n,r,i,s,u,a,c,l,f,h,d,p,m,g,v=arguments;return o.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=v.length>0&&void 0!==v[0]?v[0]:"periodic",n=v.length>1?v[1]:void 0,r=v.length>2?v[2]:void 0,e.next=5,Xe(10,r);case 5:if(i=e.sent,t in Ke){e.next=10;break}throw"Method not available for CSS!";case 10:for((s=document.createElement("style")).type="text/css",document.head.appendChild(s),u=0;u<n.length;u++)(l=n[u].getAttribute("data-light-color"))&&(f=l.split(","),h=f.slice(0,3).map((function(e){return 255*(null!=e?e:1)})),n[u].style.backgroundColor="rgba(".concat(h,",").concat(f[3],")")),n[u].style.visibility="visible",d=Number(n[u].getAttribute("data-frequency")),p=Number(n[u].getAttribute("data-phase-shift")),m=Ke[t].getAnimationInfo({frequency:d,phaseShift:p},i),s.sheet.insertRule(m.rule,null!==(a=null===(c=s.cssRules)||void 0===c?void 0:c.length)&&void 0!==a?a:0),g=String(m.duration).concat("s ",m.name,m.type),n[u].style.animation=g;return e.abrupt("return",(function(){s.remove(),n.forEach((function(e){e.style.animation="",e.style.visibility="",e.style.backgroundColor=""}))}));case 15:case"end":return e.stop()}}),e)}))),Qe.apply(this,arguments)}var et=Object.freeze({__proto__:null,start:function(){return Qe.apply(this,arguments)}}),tt=document.createElement("canvas"),nt=tt.getContext("webgl",{alpha:!1});tt.width=10,tt.height=10;var rt=document.createElement("canvas"),it=rt.getContext("webgl",{alpha:!1});rt.width=10,rt.height=10;var ot="attribute vec2 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;void main() { gl_Position = vec4(a_position, 0, 1); v_texCoord = a_texCoord; }",st="precision mediump float;uniform sampler2D u_image;varying vec2 v_texCoord;void main() { gl_FragColor = texture2D(u_image, v_texCoord); }",ut=new Float32Array([-1,1,1,1,-1,-1,1,-1]),at=function(e){return Math.log(e)/Math.log(2)%1==0};function ct(e,t){return it.clearColor(e[0],e[1],e[2],e[3]),it.clear(it.COLOR_BUFFER_BIT),nt.clearColor(t[0],t[1],t[2],t[3]),nt.clear(nt.COLOR_BUFFER_BIT),{darkOffScreenCanvas:rt,lightOffScreenCanvas:tt}}function lt(e,t,n){var r=e.createProgram(),i=ft(e,t,e.VERTEX_SHADER),o=ft(e,n,e.FRAGMENT_SHADER);if(e.attachShader(r,i),e.attachShader(r,o),e.linkProgram(r),!e.getProgramParameter(r,e.LINK_STATUS))throw e.getProgramInfoLog(r);return r}function ft(e,t,n){var r=e.createShader(n);if(e.shaderSource(r,t),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw e.getShaderInfoLog(r);return r}function ht(e){var t=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,ut,e.STATIC_DRAW),t}function dt(e,t){var n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),at(t.width)&&at(t.height)||(e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST)),n}function pt(e,t){!function(e){var t=e.clientWidth,n=e.clientHeight;e.width===t&&e.height===n||(e.width=t,e.height=n)}(e.canvas),e.enable(e.SCISSOR_TEST),e.canvas.style.transform="translateY(".concat(window.scrollY,"px)");var n=t.element.getBoundingClientRect(),r=n.right-n.left,i=n.bottom-n.top,o=n.left,s=e.canvas.clientHeight-n.bottom-1;e.viewport(o,s,r,i),e.scissor(o,s,r,i),e.clear(e.COLOR_BUFFER_BIT),e.bindTexture(e.TEXTURE_2D,t.texture),e.enableVertexAttribArray(t.texCoordLoc),e.bindBuffer(e.ARRAY_BUFFER,t.coordBuffer),e.vertexAttribPointer(t.texCoordLoc,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_STRIP,0,4)}var mt=Object.freeze({__proto__:null,calculateStimuliIntensities:function(e,t){for(var n=Ye(e.frequency),r=[],i=new He(n).times(t).ceil().toNumber(),o=0;o<i;o++){var s=ze(new He(Ve).times(e.frequency).times(new He(o).div(t)).add(e.phaseShift)),u=new He(.5).times(new He(1).add(s));r.push(u.toNumber())}return r}});function gt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function vt(e){return function(e){if(Array.isArray(e))return gt(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 gt(e,t);var n={}.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)?gt(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var wt=Object.freeze({__proto__:null,calculateStimuliIntensities:function(e,t){var n=[],r=function(e,t){var n=Ze(t),r=Ze(e);return Math.round(r/n)}(e.frequency,t)/2;return n.push.apply(n,vt(Array(Math.ceil(r)).fill(1))),n.push.apply(n,vt(Array(Math.floor(r)).fill(0))),n}}),yt={approximation:mt,periodic:wt};function bt(){return bt=t(o.mark((function e(){var t,n,r,i,s,u,a,c,l,f,h,d,p,m,g,v,w,y,b,x,E,N,_,T,A,O,R=arguments;return o.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=R.length>0&&void 0!==R[0]?R[0]:"periodic",n=R.length>1?R[1]:void 0,r=R.length>2?R[2]:void 0,i=R.length>3&&void 0!==R[3]?R[3]:10,e.next=6,Xe(10,i);case 6:if(s=e.sent,u=[],t in yt){e.next=12;break}throw"Method not available for WebGL!";case 12:if(r instanceof HTMLCanvasElement){e.next=16;break}throw"canvas argument is not an HTMLCanvasElement!";case 16:for(a=r.getContext("webgl",{powerPreference:"high-performance",alpha:!1}),c=lt(a,ot,st),l=a.getAttribLocation(c,"a_position"),f=a.getAttribLocation(c,"a_texCoord"),h=ht(a),a.useProgram(c),a.enableVertexAttribArray(l),a.bindBuffer(a.ARRAY_BUFFER,h),a.vertexAttribPointer(l,2,a.FLOAT,!1,0,0),d=0;d<n.length;d++)g=(null!==(p=n[d].getAttribute("data-dark-color"))&&void 0!==p?p:"0,0,0,1").split(",").map(Number),v=(null!==(m=n[d].getAttribute("data-light-color"))&&void 0!==m?m:"1,1,1,1").split(",").map(Number),w=ct(g,v),y=Number(n[d].getAttribute("data-frequency")),b=Number(n[d].getAttribute("data-phase-shift")),x=yt[t].calculateStimuliIntensities({frequency:y,phaseShift:b},s),E=ht(a),N=dt(a,w.darkOffScreenCanvas),_=ht(a),T=dt(a,w.lightOffScreenCanvas),A={element:n[d],stimulusCycle:{intensities:x,maxFrames:x.length},textures:{darkTexture:N,lightTexture:T,texCoordLocation:f},coordBuffers:{darkTexCoordBuffer:E,lightTexCoordBuffer:_},counter:0},O={id:null},u.push(xt(performance.now(),A,a,O));case 26:return e.abrupt("return",(function(){u.forEach((function(e){return window.cancelAnimationFrame(e.id)})),a.clear(a.DEPTH_BUFFER_BIT|a.COLOR_BUFFER_BIT|a.STENCIL_BUFFER_BIT)}));case 27:case"end":return e.stop()}}),e)}))),bt.apply(this,arguments)}function xt(e,t,n,r){return 1===t.stimulusCycle.intensities[t.counter]?pt(n,{element:t.element,coordBuffer:t.coordBuffers.lightTexCoordBuffer,texCoordLoc:t.textures.texCoordLocation,texture:t.textures.lightTexture}):pt(n,{element:t.element,coordBuffer:t.coordBuffers.darkTexCoordBuffer,texCoordLoc:t.textures.texCoordLocation,texture:t.textures.darkTexture}),t.counter<t.stimulusCycle.maxFrames-1?t.counter++:t.counter=0,r.id=window.requestAnimationFrame((function(e){xt(e,t,n,r)})),r}var Et=Object.freeze({__proto__:null,start:function(){return bt.apply(this,arguments)},animate:xt});function Nt(e){var t=function(e,t){if("object"!=s(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==s(t)?t:t+""}function _t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Nt(r.key),r)}}function Tt(e,t,n){return t&&_t(e.prototype,t),n&&_t(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function At(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ot(e,t){if(t&&("object"==s(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Rt(e){return Rt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Rt(e)}function St(e,t){return St=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},St(e,t)}function Lt(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&&St(e,t)}function Ct(e,t,n){return(t=Nt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ft=Tt((function e(n){var r=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"periodic",s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;At(this,e),Ct(this,"refreshRate",null),Ct(this,"elements",new Map),Ct(this,"samples",10),Ct(this,"active",!1),Ct(this,"start",t(o.mark((function e(){var t,n=arguments;return o.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>0&&void 0!==n[0]?n[0]:Array.from(r.elements.values()),Array.isArray(t)||(t=t instanceof HTMLElement?[t]:Array.from(t)),r.active){e.next=7;break}return r.onstart(),e.next=6,Xe(10,r.samples);case 6:r.refreshRate=e.sent;case 7:t.forEach((function(e,t){var n=e instanceof HTMLElement?e:e.element;e=r.set(n),r.animate(e)})),r.active=!0;case 9:case"end":return e.stop()}}),e)})))),Ct(this,"set",(function(e){var t,n,i,o,s=null!==(t=Array.from(r.elements.values()).find((function(t){return t.element===e})))&&void 0!==t?t:{};return s.element=e,s.id=null!==(n=s.id)&&void 0!==n?n:Math.floor(1e6*Math.random()),s.frequency=Number(null!==(i=e.getAttribute("data-frequency"))&&void 0!==i?i:"0"),s.light=e.getAttribute("data-light-color"),s.dark=e.getAttribute("data-dark-color"),s.phaseShift=Number(null!==(o=e.getAttribute("data-phase-shift"))&&void 0!==o?o:"0"),r.elements.set(s.id,s),s})),Ct(this,"delete",(function(e){Array.from(r.elements).find((function(t,n){if(t[1].element===e)return r.ondelete(t[1]),r.elements.delete(t[0])}))||r.ondelete({element:e})})),Ct(this,"stop",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Array.from(r.elements.values()).map((function(e){return e.element}));Array.isArray(e)||(e=e instanceof HTMLElement?[e]:Array.from(e)),r.elements.forEach((function(t){e.includes(t.element)&&r.ondelete(t)})),e.length===r.elements.size&&(r.onstop(),r.active=!1)})),Ct(this,"reset",(function(){r.stop(),r.elements.forEach((function(e){return r.delete(e.element)}))})),Ct(this,"onstart",(function(){})),Ct(this,"ondelete",(function(){})),Ct(this,"onstop",(function(){})),Ct(this,"calculateRefreshRate",Xe),this.technique=n[i],this.samples=s}));function Mt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Mt=function(){return!!e})()}var Pt=function(){function e(){var t,n,r,i,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"periodic",s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return At(this,e),n=this,i=[{approximation:$e,periodic:Je},o,s],r=Rt(r=e),Ct(t=Ot(n,Mt()?Reflect.construct(r,i||[],Rt(n).constructor):r.apply(n,i)),"style",document.createElement("style")),Ct(t,"onstart",(function(){t.style.type="text/css",document.head.appendChild(t.style)})),Ct(t,"ondelete",(function(e){e.element.style.animation="",e.element.style.visibility="",e.element.style.backgroundColor=""})),Ct(t,"onstop",(function(){t.style.remove()})),Ct(t,"animate",(function(e){var n,r;if(e.light){var i,o=e.light.split(","),s=o.slice(0,3).map((function(e){return 255*(null!=e?e:1)}));e.element.style.backgroundColor="rgba(".concat(s,",").concat(null!==(i=null==o?void 0:o[3])&&void 0!==i?i:1,")")}e.element.style.visibility="visible";var u=t.technique.getAnimationInfo(e,t.refreshRate,e.id),a=String(u.duration).concat("s ",u.name,u.type);t.style.sheet.insertRule(u.rule,null!==(n=null===(r=t.style.cssRules)||void 0===r?void 0:r.length)&&void 0!==n?n:0),e.element.style.animation=a})),t}return Lt(e,Ft),Tt(e)}();function Bt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Bt=function(){return!!e})()}var kt=function(){function e(){var t,n,r,i,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"periodic",s=arguments.length>1?arguments[1]:void 0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return At(this,e),n=this,i=[{approximation:mt,periodic:wt},o,u],r=Rt(r=e),Ct(t=Ot(n,Bt()?Reflect.construct(r,i||[],Rt(n).constructor):r.apply(n,i)),"gl",null),Ct(t,"texCoordLocation",null),Ct(t,"canvas",null),Ct(t,"onstart",(function(){t.gl=t.canvas.getContext("webgl",{powerPreference:"high-performance",alpha:!1});var e=lt(t.gl,ot,st),n=t.gl.getAttribLocation(e,"a_position");t.texCoordLocation=t.gl.getAttribLocation(e,"a_texCoord");var r=ht(t.gl);t.gl.useProgram(e),t.gl.enableVertexAttribArray(n),t.gl.bindBuffer(t.gl.ARRAY_BUFFER,r),t.gl.vertexAttribPointer(n,2,t.gl.FLOAT,!1,0,0)})),Ct(t,"ondelete",(function(e){window.cancelAnimationFrame(e.animationId),e.animate=null})),Ct(t,"onstop",(function(){t.gl.clear(t.gl.DEPTH_BUFFER_BIT|t.gl.COLOR_BUFFER_BIT|t.gl.STENCIL_BUFFER_BIT)})),Ct(t,"getElementInfo",(function(e){var n,r;e.dark=null!==(n=e.element.getAttribute("data-dark-color"))&&void 0!==n?n:"0,0,0,1",e.light=null!==(r=e.element.getAttribute("data-light-color"))&&void 0!==r?r:"1,1,1,1";var i=ct(e.dark.split(",").map(Number),e.light.split(",").map(Number)),o=t.technique.calculateStimuliIntensities(e,t.refreshRate),s=ht(t.gl),u=dt(t.gl,i.darkOffScreenCanvas),a=ht(t.gl),c=dt(t.gl,i.lightOffScreenCanvas);return{element:e.element,stimulusCycle:{intensities:o,maxFrames:o.length},textures:{darkTexture:u,lightTexture:c,texCoordLocation:t.texCoordLocation},coordBuffers:{darkTexCoordBuffer:s,lightTexCoordBuffer:a},counter:0}})),Ct(t,"animate",(function(e){var n=t.getElementInfo(e);e.animate=function(){1===n.stimulusCycle.intensities[n.counter]?pt(t.gl,{element:n.element,coordBuffer:n.coordBuffers.lightTexCoordBuffer,texCoordLoc:n.textures.texCoordLocation,texture:n.textures.lightTexture}):pt(t.gl,{element:n.element,coordBuffer:n.coordBuffers.darkTexCoordBuffer,texCoordLoc:n.textures.texCoordLocation,texture:n.textures.darkTexture}),n.counter<n.stimulusCycle.maxFrames-1?n.counter++:n.counter=0,e.animationId=window.requestAnimationFrame((function(t){return e.animate()}))},e.animate()})),t.canvas=s,t}return Lt(e,Ft),Tt(e)}();export{Pt as CSS,kt as WebGL,Xe as calculateRefreshRate,et as css,Et as webgl};
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).stimuli={})}(this,(function(e){"use strict";function t(e,t,n,r,i,o,s){try{var u=e[o](s),a=u.value}catch(e){return void n(e)}u.done?t(a):Promise.resolve(a).then(r,i)}function n(e){return function(){var n=this,r=arguments;return new Promise((function(i,o){var s=e.apply(n,r);function u(e){t(s,i,o,u,a,"next",e)}function a(e){t(s,i,o,u,a,"throw",e)}u(void 0)}))}}var r={exports:{}},i={exports:{}};!function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(i),function(e){var t=i.exports.default;function n(){
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
e.exports=n=function(){return i},e.exports.__esModule=!0,e.exports.default=e.exports;var r,i={},o=Object.prototype,s=o.hasOwnProperty,u=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function h(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(r){h=function(e,t,n){return e[t]=n}}function d(e,t,n,r){var i=t&&t.prototype instanceof b?t:b,o=Object.create(i.prototype),s=new M(r||[]);return u(o,"_invoke",{value:S(e,n,s)}),o}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}i.wrap=d;var m="suspendedStart",g="suspendedYield",v="executing",w="completed",y={};function b(){}function x(){}function E(){}var N={};h(N,c,(function(){return this}));var _=Object.getPrototypeOf,T=_&&_(_(P([])));T&&T!==o&&s.call(T,c)&&(N=T);var A=E.prototype=b.prototype=Object.create(N);function O(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function R(e,n){function r(i,o,u,a){var c=p(e[i],e,o);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==t(f)&&s.call(f,"__await")?n.resolve(f.__await).then((function(e){r("next",e,u,a)}),(function(e){r("throw",e,u,a)})):n.resolve(f).then((function(e){l.value=e,u(l)}),(function(e){return r("throw",e,u,a)}))}a(c.arg)}var i;u(this,"_invoke",{value:function(e,t){function o(){return new n((function(n,i){r(e,t,n,i)}))}return i=i?i.then(o,o):o()}})}function S(e,t,n){var i=m;return function(o,s){if(i===v)throw Error("Generator is already running");if(i===w){if("throw"===o)throw s;return{value:r,done:!0}}for(n.method=o,n.arg=s;;){var u=n.delegate;if(u){var a=L(u,n);if(a){if(a===y)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===m)throw i=w,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=v;var c=p(e,t,n);if("normal"===c.type){if(i=n.done?w:g,c.arg===y)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=w,n.method="throw",n.arg=c.arg)}}}function L(e,t){var n=t.method,i=e.iterator[n];if(i===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=r,L(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var o=p(i,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,y;var s=o.arg;return s?s.done?(t[e.resultName]=s.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=r),t.delegate=null,y):s:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function F(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function P(e){if(e||""===e){var n=e[c];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function t(){for(;++i<e.length;)if(s.call(e,i))return t.value=e[i],t.done=!1,t;return t.value=r,t.done=!0,t};return o.next=o}}throw new TypeError(t(e)+" is not iterable")}return x.prototype=E,u(A,"constructor",{value:E,configurable:!0}),u(E,"constructor",{value:x,configurable:!0}),x.displayName=h(E,f,"GeneratorFunction"),i.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===x||"GeneratorFunction"===(t.displayName||t.name))},i.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,h(e,f,"GeneratorFunction")),e.prototype=Object.create(A),e},i.awrap=function(e){return{__await:e}},O(R.prototype),h(R.prototype,l,(function(){return this})),i.AsyncIterator=R,i.async=function(e,t,n,r,o){void 0===o&&(o=Promise);var s=new R(d(e,t,n,r),o);return i.isGeneratorFunction(t)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},O(A),h(A,f,"Generator"),h(A,c,(function(){return this})),h(A,"toString",(function(){return"[object Generator]"})),i.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},i.values=P,M.prototype={constructor:M,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(F),!e)for(var t in this)"t"===t.charAt(0)&&s.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=r)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return u.type="throw",u.arg=e,t.next=n,i&&(t.method="next",t.arg=r),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],u=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var a=s.call(o,"catchLoc"),c=s.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&s.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),F(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;F(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:P(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=r),y}},i}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(r);var o=r.exports(),s=o;try{regeneratorRuntime=o}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}var a,c,l=9e15,f=1e9,h="0123456789abcdef",d="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",p="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",m={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-l,maxE:l,crypto:!1},g=!0,v="[DecimalError] ",w=v+"Invalid argument: ",y=v+"Precision limit exceeded",b=v+"crypto unavailable",x="[object Decimal]",E=Math.floor,N=Math.pow,_=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,T=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,A=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,O=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,R=1e7,S=d.length-1,L=p.length-1,C={toStringTag:x};function F(e){var t,n,r,i=e.length-1,o="",s=e[0];if(i>0){for(o+=s,t=1;t<i;t++)(n=7-(r=e[t]+"").length)&&(o+=Z(n)),o+=r;(n=7-(r=(s=e[t])+"").length)&&(o+=Z(n))}else if(0===s)return"0";for(;s%10==0;)s/=10;return o+s}function M(e,t,n){if(e!==~~e||e<t||e>n)throw Error(w+e)}function P(e,t,n,r){var i,o,s,u;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=7,i=0):(i=Math.ceil((t+1)/7),t%=7),o=N(10,7-t),u=e[i]%o|0,null==r?t<3?(0==t?u=u/100|0:1==t&&(u=u/10|0),s=n<4&&99999==u||n>3&&49999==u||5e4==u||0==u):s=(n<4&&u+1==o||n>3&&u+1==o/2)&&(e[i+1]/o/100|0)==N(10,t-2)-1||(u==o/2||0==u)&&!(e[i+1]/o/100|0):t<4?(0==t?u=u/1e3|0:1==t?u=u/100|0:2==t&&(u=u/10|0),s=(r||n<4)&&9999==u||!r&&n>3&&4999==u):s=((r||n<4)&&u+1==o||!r&&n>3&&u+1==o/2)&&(e[i+1]/o/1e3|0)==N(10,t-3)-1,s}function B(e,t,n){for(var r,i,o=[0],s=0,u=e.length;s<u;){for(i=o.length;i--;)o[i]*=t;for(o[0]+=h.indexOf(e.charAt(s++)),r=0;r<o.length;r++)o[r]>n-1&&(void 0===o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}C.absoluteValue=C.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),I(e)},C.ceil=function(){return I(new this.constructor(this),this.e+1,2)},C.clampedTo=C.clamp=function(e,t){var n=this,r=n.constructor;if(e=new r(e),t=new r(t),!e.s||!t.s)return new r(NaN);if(e.gt(t))throw Error(w+t);return n.cmp(e)<0?e:n.cmp(t)>0?t:new r(n)},C.comparedTo=C.cmp=function(e){var t,n,r,i,o=this,s=o.d,u=(e=new o.constructor(e)).d,a=o.s,c=e.s;if(!s||!u)return a&&c?a!==c?a:s===u?0:!s^a<0?1:-1:NaN;if(!s[0]||!u[0])return s[0]?a:u[0]?-c:0;if(a!==c)return a;if(o.e!==e.e)return o.e>e.e^a<0?1:-1;for(t=0,n=(r=s.length)<(i=u.length)?r:i;t<n;++t)if(s[t]!==u[t])return s[t]>u[t]^a<0?1:-1;return r===i?0:r>i^a<0?1:-1},C.cosine=C.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+7,r.rounding=1,n=function(e,t){var n,r,i;if(t.isZero())return t;r=t.d.length,r<32?i=(1/Q(4,n=Math.ceil(r/3))).toString():(n=16,i="2.3283064365386962890625e-10");e.precision+=n,t=K(e,1,t.times(i),new e(1));for(var o=n;o--;){var s=t.times(t);t=s.times(s).minus(s).times(8).plus(1)}return e.precision-=n,t}(r,ee(r,n)),r.precision=e,r.rounding=t,I(2==c||3==c?n.neg():n,e,t,!0)):new r(1):new r(NaN)},C.cubeRoot=C.cbrt=function(){var e,t,n,r,i,o,s,u,a,c,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(g=!1,(o=l.s*N(l.s*l,1/3))&&Math.abs(o)!=1/0?r=new f(o.toString()):(n=F(l.d),(o=((e=l.e)-n.length+1)%3)&&(n+=1==o||-2==o?"0":"00"),o=N(n,1/3),e=E((e+1)/3)-(e%3==(e<0?-1:2)),(r=new f(n=o==1/0?"5e"+e:(n=o.toExponential()).slice(0,n.indexOf("e")+1)+e)).s=l.s),s=(e=f.precision)+3;;)if(c=(a=(u=r).times(u).times(u)).plus(l),r=k(c.plus(l).times(u),c.plus(a),s+2,1),F(u.d).slice(0,s)===(n=F(r.d)).slice(0,s)){if("9999"!=(n=n.slice(s-3,s+1))&&(i||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(I(r,e+1,1),t=!r.times(r).times(r).eq(l));break}if(!i&&(I(u,e+1,0),u.times(u).times(u).eq(l))){r=u;break}s+=4,i=1}return g=!0,I(r,e,f.rounding,t)},C.decimalPlaces=C.dp=function(){var e,t=this.d,n=NaN;if(t){if(n=7*((e=t.length-1)-E(this.e/7)),e=t[e])for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n},C.dividedBy=C.div=function(e){return k(this,new this.constructor(e))},C.dividedToIntegerBy=C.divToInt=function(e){var t=this.constructor;return I(k(this,new t(e),0,1,1),t.precision,t.rounding)},C.equals=C.eq=function(e){return 0===this.cmp(e)},C.floor=function(){return I(new this.constructor(this),this.e+1,3)},C.greaterThan=C.gt=function(e){return this.cmp(e)>0},C.greaterThanOrEqualTo=C.gte=function(e){var t=this.cmp(e);return 1==t||0===t},C.hyperbolicCosine=C.cosh=function(){var e,t,n,r,i,o=this,s=o.constructor,u=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return u;n=s.precision,r=s.rounding,s.precision=n+Math.max(o.e,o.sd())+4,s.rounding=1,(i=o.d.length)<32?t=(1/Q(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),o=K(s,1,o.times(t),new s(1),!0);for(var a,c=e,l=new s(8);c--;)a=o.times(o),o=u.minus(a.times(l.minus(a.times(l))));return I(o,s.precision=n,s.rounding=r,!0)},C.hyperbolicSine=C.sinh=function(){var e,t,n,r,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,n=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,(r=i.d.length)<3)i=K(o,2,i,i,!0);else{e=(e=1.4*Math.sqrt(r))>16?16:0|e,i=K(o,2,i=i.times(1/Q(5,e)),i,!0);for(var s,u=new o(5),a=new o(16),c=new o(20);e--;)s=i.times(i),i=i.times(u.plus(s.times(a.times(s).plus(c))))}return o.precision=t,o.rounding=n,I(i,t,n,!0)},C.hyperbolicTangent=C.tanh=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,k(n.sinh(),n.cosh(),r.precision=e,r.rounding=t)):new r(n.s)},C.inverseCosine=C.acos=function(){var e,t=this,n=t.constructor,r=t.abs().cmp(1),i=n.precision,o=n.rounding;return-1!==r?0===r?t.isNeg()?D(n,i,o):new n(0):new n(NaN):t.isZero()?D(n,i+4,o).times(.5):(n.precision=i+6,n.rounding=1,t=t.asin(),e=D(n,i+4,o).times(.5),n.precision=i,n.rounding=o,e.minus(t))},C.inverseHyperbolicCosine=C.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,g=!1,n=n.times(n).minus(1).sqrt().plus(n),g=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)},C.inverseHyperbolicSine=C.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,g=!1,n=n.times(n).plus(1).sqrt().plus(n),g=!0,r.precision=e,r.rounding=t,n.ln())},C.inverseHyperbolicTangent=C.atanh=function(){var e,t,n,r,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,r=i.sd(),Math.max(r,e)<2*-i.e-1?I(new o(i),e,t,!0):(o.precision=n=r-i.e,i=k(i.plus(1),new o(1).minus(i),n+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5))):new o(NaN)},C.inverseSine=C.asin=function(){var e,t,n,r,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),n=o.precision,r=o.rounding,-1!==t?0===t?((e=D(o,n+4,r).times(.5)).s=i.s,e):new o(NaN):(o.precision=n+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=r,i.times(2)))},C.inverseTangent=C.atan=function(){var e,t,n,r,i,o,s,u,a,c=this,l=c.constructor,f=l.precision,h=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&f+4<=L)return(s=D(l,f+4,h).times(.25)).s=c.s,s}else{if(!c.s)return new l(NaN);if(f+4<=L)return(s=D(l,f+4,h).times(.5)).s=c.s,s}for(l.precision=u=f+10,l.rounding=1,e=n=Math.min(28,u/7+2|0);e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(g=!1,t=Math.ceil(u/7),r=1,a=c.times(c),s=new l(c),i=c;-1!==e;)if(i=i.times(a),o=s.minus(i.div(r+=2)),i=i.times(a),void 0!==(s=o.plus(i.div(r+=2))).d[t])for(e=t;s.d[e]===o.d[e]&&e--;);return n&&(s=s.times(2<<n-1)),g=!0,I(s,l.precision=f,l.rounding=h,!0)},C.isFinite=function(){return!!this.d},C.isInteger=C.isInt=function(){return!!this.d&&E(this.e/7)>this.d.length-2},C.isNaN=function(){return!this.s},C.isNegative=C.isNeg=function(){return this.s<0},C.isPositive=C.isPos=function(){return this.s>0},C.isZero=function(){return!!this.d&&0===this.d[0]},C.lessThan=C.lt=function(e){return this.cmp(e)<0},C.lessThanOrEqualTo=C.lte=function(e){return this.cmp(e)<1},C.logarithm=C.log=function(e){var t,n,r,i,o,s,u,a,c=this,l=c.constructor,f=l.precision,h=l.rounding;if(null==e)e=new l(10),t=!0;else{if(n=(e=new l(e)).d,e.s<0||!n||!n[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(n=c.d,c.s<0||!n||!n[0]||c.eq(1))return new l(n&&!n[0]?-1/0:1!=c.s?NaN:n?0:1/0);if(t)if(n.length>1)o=!0;else{for(i=n[0];i%10==0;)i/=10;o=1!==i}if(g=!1,s=W(c,u=f+5),r=t?U(l,u+10):W(e,u),P((a=k(s,r,u,1)).d,i=f,h))do{if(s=W(c,u+=10),r=t?U(l,u+10):W(e,u),a=k(s,r,u,1),!o){+F(a.d).slice(i+1,i+15)+1==1e14&&(a=I(a,f+1,0));break}}while(P(a.d,i+=10,h));return g=!0,I(a,f,h)},C.minus=C.sub=function(e){var t,n,r,i,o,s,u,a,c,l,f,h,d=this,p=d.constructor;if(e=new p(e),!d.d||!e.d)return d.s&&e.s?d.d?e.s=-e.s:e=new p(e.d||d.s!==e.s?d:NaN):e=new p(NaN),e;if(d.s!=e.s)return e.s=-e.s,d.plus(e);if(c=d.d,h=e.d,u=p.precision,a=p.rounding,!c[0]||!h[0]){if(h[0])e.s=-e.s;else{if(!c[0])return new p(3===a?-0:0);e=new p(d)}return g?I(e,u,a):e}if(n=E(e.e/7),l=E(d.e/7),c=c.slice(),o=l-n){for((f=o<0)?(t=c,o=-o,s=h.length):(t=h,n=l,s=c.length),o>(r=Math.max(Math.ceil(u/7),s)+2)&&(o=r,t.length=1),t.reverse(),r=o;r--;)t.push(0);t.reverse()}else{for((f=(r=c.length)<(s=h.length))&&(s=r),r=0;r<s;r++)if(c[r]!=h[r]){f=c[r]<h[r];break}o=0}for(f&&(t=c,c=h,h=t,e.s=-e.s),s=c.length,r=h.length-s;r>0;--r)c[s++]=0;for(r=h.length;r>o;){if(c[--r]<h[r]){for(i=r;i&&0===c[--i];)c[i]=R-1;--c[i],c[r]+=R}c[r]-=h[r]}for(;0===c[--s];)c.pop();for(;0===c[0];c.shift())--n;return c[0]?(e.d=c,e.e=j(c,n),g?I(e,u,a):e):new p(3===a?-0:0)},C.modulo=C.mod=function(e){var t,n=this,r=n.constructor;return e=new r(e),!n.d||!e.s||e.d&&!e.d[0]?new r(NaN):!e.d||n.d&&!n.d[0]?I(new r(n),r.precision,r.rounding):(g=!1,9==r.modulo?(t=k(n,e.abs(),0,3,1)).s*=e.s:t=k(n,e,0,r.modulo,1),t=t.times(e),g=!0,n.minus(t))},C.naturalExponential=C.exp=function(){return Y(this)},C.naturalLogarithm=C.ln=function(){return W(this)},C.negated=C.neg=function(){var e=new this.constructor(this);return e.s=-e.s,I(e)},C.plus=C.add=function(e){var t,n,r,i,o,s,u,a,c,l,f=this,h=f.constructor;if(e=new h(e),!f.d||!e.d)return f.s&&e.s?f.d||(e=new h(e.d||f.s===e.s?f:NaN)):e=new h(NaN),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(c=f.d,l=e.d,u=h.precision,a=h.rounding,!c[0]||!l[0])return l[0]||(e=new h(f)),g?I(e,u,a):e;if(o=E(f.e/7),r=E(e.e/7),c=c.slice(),i=o-r){for(i<0?(n=c,i=-i,s=l.length):(n=l,r=o,s=c.length),i>(s=(o=Math.ceil(u/7))>s?o+1:s+1)&&(i=s,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for((s=c.length)-(i=l.length)<0&&(i=s,n=l,l=c,c=n),t=0;i;)t=(c[--i]=c[i]+l[i]+t)/R|0,c[i]%=R;for(t&&(c.unshift(t),++r),s=c.length;0==c[--s];)c.pop();return e.d=c,e.e=j(c,r),g?I(e,u,a):e},C.precision=C.sd=function(e){var t,n=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(w+e);return n.d?(t=H(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t},C.round=function(){var e=this,t=e.constructor;return I(new t(e),e.e+1,t.rounding)},C.sine=C.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+7,r.rounding=1,n=function(e,t){var n,r=t.d.length;if(r<3)return t.isZero()?t:K(e,2,t,t);n=(n=1.4*Math.sqrt(r))>16?16:0|n,t=t.times(1/Q(5,n)),t=K(e,2,t,t);for(var i,o=new e(5),s=new e(16),u=new e(20);n--;)i=t.times(t),t=t.times(o.plus(i.times(s.times(i).minus(u))));return t}(r,ee(r,n)),r.precision=e,r.rounding=t,I(c>2?n.neg():n,e,t,!0)):new r(NaN)},C.squareRoot=C.sqrt=function(){var e,t,n,r,i,o,s=this,u=s.d,a=s.e,c=s.s,l=s.constructor;if(1!==c||!u||!u[0])return new l(!c||c<0&&(!u||u[0])?NaN:u?s:1/0);for(g=!1,0==(c=Math.sqrt(+s))||c==1/0?(((t=F(u)).length+a)%2==0&&(t+="0"),c=Math.sqrt(t),a=E((a+1)/2)-(a<0||a%2),r=new l(t=c==1/0?"5e"+a:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+a)):r=new l(c.toString()),n=(a=l.precision)+3;;)if(r=(o=r).plus(k(s,o,n+2,1)).times(.5),F(o.d).slice(0,n)===(t=F(r.d)).slice(0,n)){if("9999"!=(t=t.slice(n-3,n+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(I(r,a+1,1),e=!r.times(r).eq(s));break}if(!i&&(I(o,a+1,0),o.times(o).eq(s))){r=o;break}n+=4,i=1}return g=!0,I(r,a,l.rounding,e)},C.tangent=C.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,(n=n.sin()).s=1,n=k(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,I(2==c||4==c?n.neg():n,e,t,!0)):new r(NaN)},C.times=C.mul=function(e){var t,n,r,i,o,s,u,a,c,l=this,f=l.constructor,h=l.d,d=(e=new f(e)).d;if(e.s*=l.s,!(h&&h[0]&&d&&d[0]))return new f(!e.s||h&&!h[0]&&!d||d&&!d[0]&&!h?NaN:h&&d?0*e.s:e.s/0);for(n=E(l.e/7)+E(e.e/7),(a=h.length)<(c=d.length)&&(o=h,h=d,d=o,s=a,a=c,c=s),o=[],r=s=a+c;r--;)o.push(0);for(r=c;--r>=0;){for(t=0,i=a+r;i>r;)u=o[i]+d[r]*h[i-r-1]+t,o[i--]=u%R|0,t=u/R|0;o[i]=(o[i]+t)%R|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=j(o,n),g?I(e,f.precision,f.rounding):e},C.toBinary=function(e,t){return te(this,2,e,t)},C.toDecimalPlaces=C.toDP=function(e,t){var n=this,r=n.constructor;return n=new r(n),void 0===e?n:(M(e,0,f),void 0===t?t=r.rounding:M(t,0,8),I(n,e+n.e+1,t))},C.toExponential=function(e,t){var n,r=this,i=r.constructor;return void 0===e?n=q(r,!0):(M(e,0,f),void 0===t?t=i.rounding:M(t,0,8),n=q(r=I(new i(r),e+1,t),!0,e+1)),r.isNeg()&&!r.isZero()?"-"+n:n},C.toFixed=function(e,t){var n,r,i=this,o=i.constructor;return void 0===e?n=q(i):(M(e,0,f),void 0===t?t=o.rounding:M(t,0,8),n=q(r=I(new o(i),e+i.e+1,t),!1,e+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n},C.toFraction=function(e){var t,n,r,i,o,s,u,a,c,l,f,h,d=this,p=d.d,m=d.constructor;if(!p)return new m(d);if(c=n=new m(1),r=a=new m(0),s=(o=(t=new m(r)).e=H(p)-d.e-1)%7,t.d[0]=N(10,s<0?7+s:s),null==e)e=o>0?t:c;else{if(!(u=new m(e)).isInt()||u.lt(c))throw Error(w+u);e=u.gt(t)?o>0?t:c:u}for(g=!1,u=new m(F(p)),l=m.precision,m.precision=o=7*p.length*2;f=k(u,t,0,1,1),1!=(i=n.plus(f.times(r))).cmp(e);)n=r,r=i,i=c,c=a.plus(f.times(i)),a=i,i=t,t=u.minus(f.times(i)),u=i;return i=k(e.minus(n),r,0,1,1),a=a.plus(i.times(c)),n=n.plus(i.times(r)),a.s=c.s=d.s,h=k(c,r,o,1).minus(d).abs().cmp(k(a,n,o,1).minus(d).abs())<1?[c,r]:[a,n],m.precision=l,g=!0,h},C.toHexadecimal=C.toHex=function(e,t){return te(this,16,e,t)},C.toNearest=function(e,t){var n=this,r=n.constructor;if(n=new r(n),null==e){if(!n.d)return n;e=new r(1),t=r.rounding}else{if(e=new r(e),void 0===t?t=r.rounding:M(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&(e.s=n.s),e}return e.d[0]?(g=!1,n=k(n,e,0,t,1).times(e),g=!0,I(n)):(e.s=n.s,n=e),n},C.toNumber=function(){return+this},C.toOctal=function(e,t){return te(this,8,e,t)},C.toPower=C.pow=function(e){var t,n,r,i,o,s,u=this,a=u.constructor,c=+(e=new a(e));if(!(u.d&&e.d&&u.d[0]&&e.d[0]))return new a(N(+u,c));if((u=new a(u)).eq(1))return u;if(r=a.precision,o=a.rounding,e.eq(1))return I(u,r,o);if((t=E(e.e/7))>=e.d.length-1&&(n=c<0?-c:c)<=9007199254740991)return i=G(a,u,n,r),e.s<0?new a(1).div(i):I(i,r,o);if((s=u.s)<0){if(t<e.d.length-1)return new a(NaN);if(1&e.d[t]||(s=1),0==u.e&&1==u.d[0]&&1==u.d.length)return u.s=s,u}return(t=0!=(n=N(+u,c))&&isFinite(n)?new a(n+"").e:E(c*(Math.log("0."+F(u.d))/Math.LN10+u.e+1)))>a.maxE+1||t<a.minE-1?new a(t>0?s/0:0):(g=!1,a.rounding=u.s=1,n=Math.min(12,(t+"").length),(i=Y(e.times(W(u,r+n)),r)).d&&P((i=I(i,r+5,1)).d,r,o)&&(t=r+10,+F((i=I(Y(e.times(W(u,t+n)),t),t+5,1)).d).slice(r+1,r+15)+1==1e14&&(i=I(i,r+1,0))),i.s=s,g=!0,a.rounding=o,I(i,r,o))},C.toPrecision=function(e,t){var n,r=this,i=r.constructor;return void 0===e?n=q(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(M(e,1,f),void 0===t?t=i.rounding:M(t,0,8),n=q(r=I(new i(r),e,t),e<=r.e||r.e<=i.toExpNeg,e)),r.isNeg()&&!r.isZero()?"-"+n:n},C.toSignificantDigits=C.toSD=function(e,t){var n=this.constructor;return void 0===e?(e=n.precision,t=n.rounding):(M(e,1,f),void 0===t?t=n.rounding:M(t,0,8)),I(new n(this),e,t)},C.toString=function(){var e=this,t=e.constructor,n=q(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+n:n},C.truncated=C.trunc=function(){return I(new this.constructor(this),this.e+1,1)},C.valueOf=C.toJSON=function(){var e=this,t=e.constructor,n=q(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+n:n};var k=function(){function e(e,t,n){var r,i=0,o=e.length;for(e=e.slice();o--;)r=e[o]*t+i,e[o]=r%n|0,i=r/n|0;return i&&e.unshift(i),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;i<n;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]<t[n]?1:0,e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;)e.shift()}return function(r,i,o,s,u,c){var l,f,h,d,p,m,g,v,w,y,b,x,N,_,T,A,O,S,L,C,F=r.constructor,M=r.s==i.s?1:-1,P=r.d,B=i.d;if(!(P&&P[0]&&B&&B[0]))return new F(r.s&&i.s&&(P?!B||P[0]!=B[0]:B)?P&&0==P[0]||!B?0*M:M/0:NaN);for(c?(p=1,f=r.e-i.e):(c=R,p=7,f=E(r.e/p)-E(i.e/p)),L=B.length,O=P.length,y=(w=new F(M)).d=[],h=0;B[h]==(P[h]||0);h++);if(B[h]>(P[h]||0)&&f--,null==o?(_=o=F.precision,s=F.rounding):_=u?o+(r.e-i.e)+1:o,_<0)y.push(1),m=!0;else{if(_=_/p+2|0,h=0,1==L){for(d=0,B=B[0],_++;(h<O||d)&&_--;h++)T=d*c+(P[h]||0),y[h]=T/B|0,d=T%B|0;m=d||h<O}else{for((d=c/(B[0]+1)|0)>1&&(B=e(B,d,c),P=e(P,d,c),L=B.length,O=P.length),A=L,x=(b=P.slice(0,L)).length;x<L;)b[x++]=0;(C=B.slice()).unshift(0),S=B[0],B[1]>=c/2&&++S;do{d=0,(l=t(B,b,L,x))<0?(N=b[0],L!=x&&(N=N*c+(b[1]||0)),(d=N/S|0)>1?(d>=c&&(d=c-1),1==(l=t(g=e(B,d,c),b,v=g.length,x=b.length))&&(d--,n(g,L<v?C:B,v,c))):(0==d&&(l=d=1),g=B.slice()),(v=g.length)<x&&g.unshift(0),n(b,g,x,c),-1==l&&(l=t(B,b,L,x=b.length))<1&&(d++,n(b,L<x?C:B,x,c)),x=b.length):0===l&&(d++,b=[0]),y[h++]=d,l&&b[0]?b[x++]=P[A]||0:(b=[P[A]],x=1)}while((A++<O||void 0!==b[0])&&_--);m=void 0!==b[0]}y[0]||y.shift()}if(1==p)w.e=f,a=m;else{for(h=1,d=y[0];d>=10;d/=10)h++;w.e=h+f*p-1,I(w,u?o+w.e+1:o,s,m)}return w}}();function I(e,t,n,r){var i,o,s,u,a,c,l,f,h,d=e.constructor;e:if(null!=t){if(!(f=e.d))return e;for(i=1,u=f[0];u>=10;u/=10)i++;if((o=t-i)<0)o+=7,s=t,a=(l=f[h=0])/N(10,i-s-1)%10|0;else if((h=Math.ceil((o+1)/7))>=(u=f.length)){if(!r)break e;for(;u++<=h;)f.push(0);l=a=0,i=1,s=(o%=7)-7+1}else{for(l=u=f[h],i=1;u>=10;u/=10)i++;a=(s=(o%=7)-7+i)<0?0:l/N(10,i-s-1)%10|0}if(r=r||t<0||void 0!==f[h+1]||(s<0?l:l%N(10,i-s-1)),c=n<4?(a||r)&&(0==n||n==(e.s<0?3:2)):a>5||5==a&&(4==n||r||6==n&&(o>0?s>0?l/N(10,i-s):0:f[h-1])%10&1||n==(e.s<0?8:7)),t<1||!f[0])return f.length=0,c?(t-=e.e+1,f[0]=N(10,(7-t%7)%7),e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=h,u=1,h--):(f.length=h+1,u=N(10,7-o),f[h]=s>0?(l/N(10,i-s)%N(10,s)|0)*u:0),c)for(;;){if(0==h){for(o=1,s=f[0];s>=10;s/=10)o++;for(s=f[0]+=u,u=1;s>=10;s/=10)u++;o!=u&&(e.e++,f[0]==R&&(f[0]=1));break}if(f[h]+=u,f[h]!=R)break;f[h--]=0,u=1}for(o=f.length;0===f[--o];)f.pop()}return g&&(e.e>d.maxE?(e.d=null,e.e=NaN):e.e<d.minE&&(e.e=0,e.d=[0])),e}function q(e,t,n){if(!e.isFinite())return z(e);var r,i=e.e,o=F(e.d),s=o.length;return t?(n&&(r=n-s)>0?o=o.charAt(0)+"."+o.slice(1)+Z(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+Z(-i-1)+o,n&&(r=n-s)>0&&(o+=Z(r))):i>=s?(o+=Z(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+Z(r))):((r=i+1)<s&&(o=o.slice(0,r)+"."+o.slice(r)),n&&(r=n-s)>0&&(i+1===s&&(o+="."),o+=Z(r))),o}function j(e,t){var n=e[0];for(t*=7;n>=10;n/=10)t++;return t}function U(e,t,n){if(t>S)throw g=!0,n&&(e.precision=n),Error(y);return I(new e(d),t,1,!0)}function D(e,t,n){if(t>L)throw Error(y);return I(new e(p),t,n,!0)}function H(e){var t=e.length-1,n=7*t+1;if(t=e[t]){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function Z(e){for(var t="";e--;)t+="0";return t}function G(e,t,n,r){var i,o=new e(1),s=Math.ceil(r/7+4);for(g=!1;;){if(n%2&&ne((o=o.times(t)).d,s)&&(i=!0),0===(n=E(n/2))){n=o.d.length-1,i&&0===o.d[n]&&++o.d[n];break}ne((t=t.times(t)).d,s)}return g=!0,o}function X(e){return 1&e.d[e.d.length-1]}function V(e,t,n){for(var r,i=new e(t[0]),o=0;++o<t.length;){if(!(r=new e(t[o])).s){i=r;break}i[n](r)&&(i=r)}return i}function Y(e,t){var n,r,i,o,s,u,a,c=0,l=0,f=0,h=e.constructor,d=h.rounding,p=h.precision;if(!e.d||!e.d[0]||e.e>17)return new h(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(null==t?(g=!1,a=p):a=t,u=new h(.03125);e.e>-2;)e=e.times(u),f+=5;for(a+=r=Math.log(N(2,f))/Math.LN10*2+5|0,n=o=s=new h(1),h.precision=a;;){if(o=I(o.times(e),a,1),n=n.times(++l),F((u=s.plus(k(o,n,a,1))).d).slice(0,a)===F(s.d).slice(0,a)){for(i=f;i--;)s=I(s.times(s),a,1);if(null!=t)return h.precision=p,s;if(!(c<3&&P(s.d,a-r,d,c)))return I(s,h.precision=p,d,g=!0);h.precision=a+=10,n=o=u=new h(1),l=0,c++}s=u}}function W(e,t){var n,r,i,o,s,u,a,c,l,f,h,d=1,p=e,m=p.d,v=p.constructor,w=v.rounding,y=v.precision;if(p.s<0||!m||!m[0]||!p.e&&1==m[0]&&1==m.length)return new v(m&&!m[0]?-1/0:1!=p.s?NaN:m?0:p);if(null==t?(g=!1,l=y):l=t,v.precision=l+=10,r=(n=F(m)).charAt(0),!(Math.abs(o=p.e)<15e14))return c=U(v,l+2,y).times(o+""),p=W(new v(r+"."+n.slice(1)),l-10).plus(c),v.precision=y,null==t?I(p,y,w,g=!0):p;for(;r<7&&1!=r||1==r&&n.charAt(1)>3;)r=(n=F((p=p.times(e)).d)).charAt(0),d++;for(o=p.e,r>1?(p=new v("0."+n),o++):p=new v(r+"."+n.slice(1)),f=p,a=s=p=k(p.minus(1),p.plus(1),l,1),h=I(p.times(p),l,1),i=3;;){if(s=I(s.times(h),l,1),F((c=a.plus(k(s,new v(i),l,1))).d).slice(0,l)===F(a.d).slice(0,l)){if(a=a.times(2),0!==o&&(a=a.plus(U(v,l+2,y).times(o+""))),a=k(a,new v(d),l,1),null!=t)return v.precision=y,a;if(!P(a.d,l-10,w,u))return I(a,v.precision=y,w,g=!0);v.precision=l+=10,c=s=p=k(f.minus(1),f.plus(1),l,1),h=I(p.times(p),l,1),i=u=1}a=c,i+=2}}function z(e){return String(e.s*e.s/0)}function $(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;48===t.charCodeAt(r);r++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(r,i)){if(i-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%7,n<0&&(r+=7),r<i){for(r&&e.d.push(+t.slice(0,r)),i-=7;r<i;)e.d.push(+t.slice(r,r+=7));r=7-(t=t.slice(r)).length}else r-=i;for(;r--;)t+="0";e.d.push(+t),g&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function J(e,t){var n,r,i,o,s,u,a,c,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),O.test(t))return $(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(T.test(t))n=16,t=t.toLowerCase();else if(_.test(t))n=2;else{if(!A.test(t))throw Error(w+t);n=8}for((o=t.search(/p/i))>0?(a=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),s=(o=t.indexOf("."))>=0,r=e.constructor,s&&(o=(u=(t=t.replace(".","")).length)-o,i=G(r,new r(n),o,2*o)),o=l=(c=B(t,n,R)).length-1;0===c[o];--o)c.pop();return o<0?new r(0*e.s):(e.e=j(c,l),e.d=c,g=!1,s&&(e=k(e,i,4*u)),a&&(e=e.times(Math.abs(a)<54?N(2,a):Ze.pow(2,a))),g=!0,e)}function K(e,t,n,r,i){var o,s,u,a,c=e.precision,l=Math.ceil(c/7);for(g=!1,a=n.times(n),u=new e(r);;){if(s=k(u.times(a),new e(t++*t++),c,1),u=i?r.plus(s):r.minus(s),r=k(s.times(a),new e(t++*t++),c,1),void 0!==(s=u.plus(r)).d[l]){for(o=l;s.d[o]===u.d[o]&&o--;);if(-1==o)break}o=u,u=r,r=s,s=o}return g=!0,s.d.length=l+1,s}function Q(e,t){for(var n=e;--t;)n*=e;return n}function ee(e,t){var n,r=t.s<0,i=D(e,e.precision,1),o=i.times(.5);if((t=t.abs()).lte(o))return c=r?4:1,t;if((n=t.divToInt(i)).isZero())c=r?3:2;else{if((t=t.minus(n.times(i))).lte(o))return c=X(n)?r?2:3:r?4:1,t;c=X(n)?r?1:4:r?3:2}return t.minus(i).abs()}function te(e,t,n,r){var i,o,s,u,c,l,d,p,m,g=e.constructor,v=void 0!==n;if(v?(M(n,1,f),void 0===r?r=g.rounding:M(r,0,8)):(n=g.precision,r=g.rounding),e.isFinite()){for(v?(i=2,16==t?n=4*n-3:8==t&&(n=3*n-2)):i=t,(s=(d=q(e)).indexOf("."))>=0&&(d=d.replace(".",""),(m=new g(1)).e=d.length-s,m.d=B(q(m),10,i),m.e=m.d.length),o=c=(p=B(d,10,i)).length;0==p[--c];)p.pop();if(p[0]){if(s<0?o--:((e=new g(e)).d=p,e.e=o,p=(e=k(e,m,n,r,0,i)).d,o=e.e,l=a),s=p[n],u=i/2,l=l||void 0!==p[n+1],l=r<4?(void 0!==s||l)&&(0===r||r===(e.s<0?3:2)):s>u||s===u&&(4===r||l||6===r&&1&p[n-1]||r===(e.s<0?8:7)),p.length=n,l)for(;++p[--n]>i-1;)p[n]=0,n||(++o,p.unshift(1));for(c=p.length;!p[c-1];--c);for(s=0,d="";s<c;s++)d+=h.charAt(p[s]);if(v){if(c>1)if(16==t||8==t){for(s=16==t?4:3,--c;c%s;c++)d+="0";for(c=(p=B(d,i,t)).length;!p[c-1];--c);for(s=1,d="1.";s<c;s++)d+=h.charAt(p[s])}else d=d.charAt(0)+"."+d.slice(1);d=d+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)d="0"+d;d="0."+d}else if(++o>c)for(o-=c;o--;)d+="0";else o<c&&(d=d.slice(0,o)+"."+d.slice(o))}else d=v?"0p+0":"0";d=(16==t?"0x":2==t?"0b":8==t?"0o":"")+d}else d=z(e);return e.s<0?"-"+d:d}function ne(e,t){if(e.length>t)return e.length=t,!0}function re(e){return new this(e).abs()}function ie(e){return new this(e).acos()}function oe(e){return new this(e).acosh()}function se(e,t){return new this(e).plus(t)}function ue(e){return new this(e).asin()}function ae(e){return new this(e).asinh()}function ce(e){return new this(e).atan()}function le(e){return new this(e).atanh()}function fe(e,t){e=new this(e),t=new this(t);var n,r=this.precision,i=this.rounding,o=r+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(n=t.s<0?D(this,r,i):new this(0)).s=e.s:!e.d||t.isZero()?(n=D(this,o,1).times(.5)).s=e.s:t.s<0?(this.precision=o,this.rounding=1,n=this.atan(k(e,t,o,1)),t=D(this,o,1),this.precision=r,this.rounding=i,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(k(e,t,o,1)):(n=D(this,o,1).times(t.s>0?.25:.75)).s=e.s:n=new this(NaN),n}function he(e){return new this(e).cbrt()}function de(e){return I(e=new this(e),e.e+1,2)}function pe(e,t,n){return new this(e).clamp(t,n)}function me(e){if(!e||"object"!==u(e))throw Error(v+"Object expected");var t,n,r,i=!0===e.defaults,o=["precision",1,f,"rounding",0,8,"toExpNeg",-l,0,"toExpPos",0,l,"maxE",0,l,"minE",-l,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(n=o[t],i&&(this[n]=m[n]),void 0!==(r=e[n])){if(!(E(r)===r&&r>=o[t+1]&&r<=o[t+2]))throw Error(w+n+": "+r);this[n]=r}if(n="crypto",i&&(this[n]=m[n]),void 0!==(r=e[n])){if(!0!==r&&!1!==r&&0!==r&&1!==r)throw Error(w+n+": "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(b);this[n]=!0}else this[n]=!1}return this}function ge(e){return new this(e).cos()}function ve(e){return new this(e).cosh()}function we(e,t){return new this(e).div(t)}function ye(e){return new this(e).exp()}function be(e){return I(e=new this(e),e.e+1,3)}function xe(){var e,t,n=new this(0);for(g=!1,e=0;e<arguments.length;)if((t=new this(arguments[e++])).d)n.d&&(n=n.plus(t.times(t)));else{if(t.s)return g=!0,new this(1/0);n=t}return g=!0,n.sqrt()}function Ee(e){return e instanceof Ze||e&&e.toStringTag===x||!1}function Ne(e){return new this(e).ln()}function _e(e,t){return new this(e).log(t)}function Te(e){return new this(e).log(2)}function Ae(e){return new this(e).log(10)}function Oe(){return V(this,arguments,"lt")}function Re(){return V(this,arguments,"gt")}function Se(e,t){return new this(e).mod(t)}function Le(e,t){return new this(e).mul(t)}function Ce(e,t){return new this(e).pow(t)}function Fe(e){var t,n,r,i,o=0,s=new this(1),u=[];if(void 0===e?e=this.precision:M(e,1,f),r=Math.ceil(e/7),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(r));o<r;)(i=t[o])>=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:u[o++]=i%1e7;else{if(!crypto.randomBytes)throw Error(b);for(t=crypto.randomBytes(r*=4);o<r;)(i=t[o]+(t[o+1]<<8)+(t[o+2]<<16)+((127&t[o+3])<<24))>=214e7?crypto.randomBytes(4).copy(t,o):(u.push(i%1e7),o+=4);o=r/4}else for(;o<r;)u[o++]=1e7*Math.random()|0;for(e%=7,(r=u[--o])&&e&&(i=N(10,7-e),u[o]=(r/i|0)*i);0===u[o];o--)u.pop();if(o<0)n=0,u=[0];else{for(n=-1;0===u[0];n-=7)u.shift();for(r=1,i=u[0];i>=10;i/=10)r++;r<7&&(n-=7-r)}return s.e=n,s.d=u,s}function Me(e){return I(e=new this(e),e.e+1,this.rounding)}function Pe(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function Be(e){return new this(e).sin()}function ke(e){return new this(e).sinh()}function Ie(e){return new this(e).sqrt()}function qe(e,t){return new this(e).sub(t)}function je(){var e=0,t=arguments,n=new this(t[e]);for(g=!1;n.s&&++e<t.length;)n=n.plus(t[e]);return g=!0,I(n,this.precision,this.rounding)}function Ue(e){return new this(e).tan()}function De(e){return new this(e).tanh()}function He(e){return I(e=new this(e),e.e+1,1)}C[Symbol.for("nodejs.util.inspect.custom")]=C.toString,C[Symbol.toStringTag]="Decimal";var Ze=C.constructor=function e(t){var n,r,i;function o(e){var t,n,r,i=this;if(!(i instanceof o))return new o(e);if(i.constructor=o,Ee(e))return i.s=e.s,void(g?!e.d||e.e>o.maxE?(i.e=NaN,i.d=null):e.e<o.minE?(i.e=0,i.d=[0]):(i.e=e.e,i.d=e.d.slice()):(i.e=e.e,i.d=e.d?e.d.slice():e.d));if("number"===(r=u(e))){if(0===e)return i.s=1/e<0?-1:1,i.e=0,void(i.d=[0]);if(e<0?(e=-e,i.s=-1):i.s=1,e===~~e&&e<1e7){for(t=0,n=e;n>=10;n/=10)t++;return void(g?t>o.maxE?(i.e=NaN,i.d=null):t<o.minE?(i.e=0,i.d=[0]):(i.e=t,i.d=[e]):(i.e=t,i.d=[e]))}return 0*e!=0?(e||(i.s=NaN),i.e=NaN,void(i.d=null)):$(i,e.toString())}if("string"!==r)throw Error(w+e);return 45===(n=e.charCodeAt(0))?(e=e.slice(1),i.s=-1):(43===n&&(e=e.slice(1)),i.s=1),O.test(e)?$(i,e):J(i,e)}if(o.prototype=C,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=me,o.clone=e,o.isDecimal=Ee,o.abs=re,o.acos=ie,o.acosh=oe,o.add=se,o.asin=ue,o.asinh=ae,o.atan=ce,o.atanh=le,o.atan2=fe,o.cbrt=he,o.ceil=de,o.clamp=pe,o.cos=ge,o.cosh=ve,o.div=we,o.exp=ye,o.floor=be,o.hypot=xe,o.ln=Ne,o.log=_e,o.log10=Ae,o.log2=Te,o.max=Oe,o.min=Re,o.mod=Se,o.mul=Le,o.pow=Ce,o.random=Fe,o.round=Me,o.sign=Pe,o.sin=Be,o.sinh=ke,o.sqrt=Ie,o.sub=qe,o.sum=je,o.tan=Ue,o.tanh=De,o.trunc=He,void 0===t&&(t={}),t&&!0!==t.defaults)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],n=0;n<i.length;)t.hasOwnProperty(r=i[n++])||(t[r]=this[r]);return o.config(t),o}(m);d=new Ze(d),p=new Ze(p);var Ge=function(e){return 1/e},Xe=function(){var e=n(s.mark((function e(){var t,n,r,i,o=arguments;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:10,(n=o.length>1&&void 0!==o[1]?o[1]:10)<10&&(n=10),r=[],i=[],e.abrupt("return",new Promise((function(e){var o=function(s){if(r.unshift(s),r.length>t){var u=r.pop(),a=1e3*t/(s-u);if(i.unshift(a),i.length==n.length)return cancelAnimationFrame(c),void e(i)}var c=window.requestAnimationFrame(o)};window.requestAnimationFrame(o)})));case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ve=function(){var e=n(s.mark((function e(){var t,n,r,i,o,u,a,c=arguments;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=c.length>0&&void 0!==c[0]?c[0]:10,n=c.length>1&&void 0!==c[1]?c[1]:10,e.next=4,Xe(t,n);case 4:for(r=e.sent,i={},o=[],u=0;u<r.length;u++)i[r[u]]||(i[r[u]]=0),i[r[u]]+=1;return(o=Object.keys(i).map(Number).filter((function(e){return i[e]==Math.max.apply(null,Object.values(i))}))).length>1&&(o=[o.reduce((function(e,t){return e+t}))/o.length]),a=Number(o.shift().toFixed(7)),e.abrupt("return",a);case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ye=new Ze(2).times(Ze.acos(-1));function We(e){for(var t=Math.pow(10,function(e){if(Math.floor(e)===Number(e))return 0;var t=e.toString().split(".")[1].length;if(t<3)return t;throw"Stimuli frequencies must have less than 3 decimal places."}(e)),n=1;n<=t;n+=1){if(0===new Ze(n).times(e).mod(1).toNumber())return n}throw"Failed to calculate the required number of seconds."}function ze(e){var t=new Ze(50),n=Ye.times(t.div(100));return 2*(function(e,t){var n=e.div(t),r=new Ze(n.toFixed(0));if(n.minus(r).div(r).abs().toNumber()<Number.EPSILON)return new Ze(0);var i=n.floor(),o=t.times(i),s=Math.sign(t.toNumber()),u=e.minus(o);return e.equals(t)||u.equals(0)||Math.sign(u.toNumber())!=s&&(u=u.abs().times(s)),u}(e,Ye).toNumber()<n.toNumber()?1:0)-1}function $e(e,t){return"@keyframes ".concat(t," { ").concat(e," }")}var Je=Object.freeze({__proto__:null,getAnimationInfo:function(e,t){for(var n="stimulus_"+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:Math.floor(1e6*Math.random())),r=We(e.frequency),i=new Ze(0),o="",s=0,u=new Ze(r).times(t).ceil().toNumber(),a=new Ze(100).div(new Ze(u)),c=0;c<u;c++){var l=ze(new Ze(Ye).times(e.frequency).times(new Ze(c).div(t)).add(e.phaseShift)),f=new Ze(.5).times(new Ze(1).add(l)).toNumber();""!==o&&s==f||(o+="".concat(i.toNumber(),"% { opacity: ").concat(f,"; } "),s=f),i=i.add(a)}var h=new Ze(1).div(t).times(u).toNumber();return{rule:$e(o,n),duration:h,type:" step-end infinite",name:n}}});var Ke=Object.freeze({__proto__:null,getAnimationInfo:function(e,t){return{duration:function(e,t){var n=Ge(e),r=Ge(t);return Math.ceil(r/n)*n}(t,e.frequency).toString(),name:"flicker",type:" step-end infinite",rule:"\n@keyframes flicker {\n 0% { opacity: 0; }\n 50% { opacity: 1; }\n}"}}}),Qe={approximation:Je,periodic:Ke};function et(){return et=n(s.mark((function e(){var t,n,r,i,o,u,a,c,l,f,h,d,p,m,g,v=arguments;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=v.length>0&&void 0!==v[0]?v[0]:"periodic",n=v.length>1?v[1]:void 0,r=v.length>2?v[2]:void 0,e.next=5,Ve(10,r);case 5:if(i=e.sent,t in Qe){e.next=10;break}throw"Method not available for CSS!";case 10:for((o=document.createElement("style")).type="text/css",document.head.appendChild(o),u=0;u<n.length;u++)(l=n[u].getAttribute("data-light-color"))&&(f=l.split(","),h=f.slice(0,3).map((function(e){return 255*(null!=e?e:1)})),n[u].style.backgroundColor="rgba(".concat(h,",").concat(f[3],")")),n[u].style.visibility="visible",d=Number(n[u].getAttribute("data-frequency")),p=Number(n[u].getAttribute("data-phase-shift")),m=Qe[t].getAnimationInfo({frequency:d,phaseShift:p},i),o.sheet.insertRule(m.rule,null!==(a=null===(c=o.cssRules)||void 0===c?void 0:c.length)&&void 0!==a?a:0),g=String(m.duration).concat("s ",m.name,m.type),n[u].style.animation=g;return e.abrupt("return",(function(){o.remove(),n.forEach((function(e){e.style.animation="",e.style.visibility="",e.style.backgroundColor=""}))}));case 15:case"end":return e.stop()}}),e)}))),et.apply(this,arguments)}var tt=Object.freeze({__proto__:null,start:function(){return et.apply(this,arguments)}}),nt=document.createElement("canvas"),rt=nt.getContext("webgl",{alpha:!1});nt.width=10,nt.height=10;var it=document.createElement("canvas"),ot=it.getContext("webgl",{alpha:!1});it.width=10,it.height=10;var st="attribute vec2 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;void main() { gl_Position = vec4(a_position, 0, 1); v_texCoord = a_texCoord; }",ut="precision mediump float;uniform sampler2D u_image;varying vec2 v_texCoord;void main() { gl_FragColor = texture2D(u_image, v_texCoord); }",at=new Float32Array([-1,1,1,1,-1,-1,1,-1]),ct=function(e){return Math.log(e)/Math.log(2)%1==0};function lt(e,t){return ot.clearColor(e[0],e[1],e[2],e[3]),ot.clear(ot.COLOR_BUFFER_BIT),rt.clearColor(t[0],t[1],t[2],t[3]),rt.clear(rt.COLOR_BUFFER_BIT),{darkOffScreenCanvas:it,lightOffScreenCanvas:nt}}function ft(e,t,n){var r=e.createProgram(),i=ht(e,t,e.VERTEX_SHADER),o=ht(e,n,e.FRAGMENT_SHADER);if(e.attachShader(r,i),e.attachShader(r,o),e.linkProgram(r),!e.getProgramParameter(r,e.LINK_STATUS))throw e.getProgramInfoLog(r);return r}function ht(e,t,n){var r=e.createShader(n);if(e.shaderSource(r,t),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw e.getShaderInfoLog(r);return r}function dt(e){var t=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,at,e.STATIC_DRAW),t}function pt(e,t){var n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),ct(t.width)&&ct(t.height)||(e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST)),n}function mt(e,t){!function(e){var t=e.clientWidth,n=e.clientHeight;e.width===t&&e.height===n||(e.width=t,e.height=n)}(e.canvas),e.enable(e.SCISSOR_TEST),e.canvas.style.transform="translateY(".concat(window.scrollY,"px)");var n=t.element.getBoundingClientRect(),r=n.right-n.left,i=n.bottom-n.top,o=n.left,s=e.canvas.clientHeight-n.bottom-1;e.viewport(o,s,r,i),e.scissor(o,s,r,i),e.clear(e.COLOR_BUFFER_BIT),e.bindTexture(e.TEXTURE_2D,t.texture),e.enableVertexAttribArray(t.texCoordLoc),e.bindBuffer(e.ARRAY_BUFFER,t.coordBuffer),e.vertexAttribPointer(t.texCoordLoc,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_STRIP,0,4)}var gt=Object.freeze({__proto__:null,calculateStimuliIntensities:function(e,t){for(var n=We(e.frequency),r=[],i=new Ze(n).times(t).ceil().toNumber(),o=0;o<i;o++){var s=ze(new Ze(Ye).times(e.frequency).times(new Ze(o).div(t)).add(e.phaseShift)),u=new Ze(.5).times(new Ze(1).add(s));r.push(u.toNumber())}return r}});function vt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function wt(e){return function(e){if(Array.isArray(e))return vt(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 vt(e,t);var n={}.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)?vt(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var yt=Object.freeze({__proto__:null,calculateStimuliIntensities:function(e,t){var n=[],r=function(e,t){var n=Ge(t),r=Ge(e);return Math.round(r/n)}(e.frequency,t)/2;return n.push.apply(n,wt(Array(Math.ceil(r)).fill(1))),n.push.apply(n,wt(Array(Math.floor(r)).fill(0))),n}}),bt={approximation:gt,periodic:yt};function xt(){return xt=n(s.mark((function e(){var t,n,r,i,o,u,a,c,l,f,h,d,p,m,g,v,w,y,b,x,E,N,_,T,A,O,R=arguments;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=R.length>0&&void 0!==R[0]?R[0]:"periodic",n=R.length>1?R[1]:void 0,r=R.length>2?R[2]:void 0,i=R.length>3&&void 0!==R[3]?R[3]:10,e.next=6,Ve(10,i);case 6:if(o=e.sent,u=[],t in bt){e.next=12;break}throw"Method not available for WebGL!";case 12:if(r instanceof HTMLCanvasElement){e.next=16;break}throw"canvas argument is not an HTMLCanvasElement!";case 16:for(a=r.getContext("webgl",{powerPreference:"high-performance",alpha:!1}),c=ft(a,st,ut),l=a.getAttribLocation(c,"a_position"),f=a.getAttribLocation(c,"a_texCoord"),h=dt(a),a.useProgram(c),a.enableVertexAttribArray(l),a.bindBuffer(a.ARRAY_BUFFER,h),a.vertexAttribPointer(l,2,a.FLOAT,!1,0,0),d=0;d<n.length;d++)g=(null!==(p=n[d].getAttribute("data-dark-color"))&&void 0!==p?p:"0,0,0,1").split(",").map(Number),v=(null!==(m=n[d].getAttribute("data-light-color"))&&void 0!==m?m:"1,1,1,1").split(",").map(Number),w=lt(g,v),y=Number(n[d].getAttribute("data-frequency")),b=Number(n[d].getAttribute("data-phase-shift")),x=bt[t].calculateStimuliIntensities({frequency:y,phaseShift:b},o),E=dt(a),N=pt(a,w.darkOffScreenCanvas),_=dt(a),T=pt(a,w.lightOffScreenCanvas),A={element:n[d],stimulusCycle:{intensities:x,maxFrames:x.length},textures:{darkTexture:N,lightTexture:T,texCoordLocation:f},coordBuffers:{darkTexCoordBuffer:E,lightTexCoordBuffer:_},counter:0},O={id:null},u.push(Et(performance.now(),A,a,O));case 26:return e.abrupt("return",(function(){u.forEach((function(e){return window.cancelAnimationFrame(e.id)})),a.clear(a.DEPTH_BUFFER_BIT|a.COLOR_BUFFER_BIT|a.STENCIL_BUFFER_BIT)}));case 27:case"end":return e.stop()}}),e)}))),xt.apply(this,arguments)}function Et(e,t,n,r){return 1===t.stimulusCycle.intensities[t.counter]?mt(n,{element:t.element,coordBuffer:t.coordBuffers.lightTexCoordBuffer,texCoordLoc:t.textures.texCoordLocation,texture:t.textures.lightTexture}):mt(n,{element:t.element,coordBuffer:t.coordBuffers.darkTexCoordBuffer,texCoordLoc:t.textures.texCoordLocation,texture:t.textures.darkTexture}),t.counter<t.stimulusCycle.maxFrames-1?t.counter++:t.counter=0,r.id=window.requestAnimationFrame((function(e){Et(e,t,n,r)})),r}var Nt=Object.freeze({__proto__:null,start:function(){return xt.apply(this,arguments)},animate:Et});function _t(e){var t=function(e,t){if("object"!=u(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==u(t)?t:t+""}function Tt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_t(r.key),r)}}function At(e,t,n){return t&&Tt(e.prototype,t),n&&Tt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ot(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rt(e,t){if(t&&("object"==u(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function St(e){return St=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},St(e)}function Lt(e,t){return Lt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Lt(e,t)}function Ct(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&&Lt(e,t)}function Ft(e,t,n){return(t=_t(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Mt=At((function e(t){var r=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"periodic",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;Ot(this,e),Ft(this,"refreshRate",null),Ft(this,"elements",new Map),Ft(this,"samples",10),Ft(this,"active",!1),Ft(this,"start",n(s.mark((function e(){var t,n=arguments;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>0&&void 0!==n[0]?n[0]:Array.from(r.elements.values()),Array.isArray(t)||(t=t instanceof HTMLElement?[t]:Array.from(t)),r.active){e.next=7;break}return r.onstart(),e.next=6,Ve(10,r.samples);case 6:r.refreshRate=e.sent;case 7:t.forEach((function(e,t){var n=e instanceof HTMLElement?e:e.element;e=r.set(n),r.animate(e)})),r.active=!0;case 9:case"end":return e.stop()}}),e)})))),Ft(this,"set",(function(e){var t,n,i,o,s=null!==(t=Array.from(r.elements.values()).find((function(t){return t.element===e})))&&void 0!==t?t:{};return s.element=e,s.id=null!==(n=s.id)&&void 0!==n?n:Math.floor(1e6*Math.random()),s.frequency=Number(null!==(i=e.getAttribute("data-frequency"))&&void 0!==i?i:"0"),s.light=e.getAttribute("data-light-color"),s.dark=e.getAttribute("data-dark-color"),s.phaseShift=Number(null!==(o=e.getAttribute("data-phase-shift"))&&void 0!==o?o:"0"),r.elements.set(s.id,s),s})),Ft(this,"delete",(function(e){Array.from(r.elements).find((function(t,n){if(t[1].element===e)return r.ondelete(t[1]),r.elements.delete(t[0])}))||r.ondelete({element:e})})),Ft(this,"stop",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Array.from(r.elements.values()).map((function(e){return e.element}));Array.isArray(e)||(e=e instanceof HTMLElement?[e]:Array.from(e)),r.elements.forEach((function(t){e.includes(t.element)&&r.ondelete(t)})),e.length===r.elements.size&&(r.onstop(),r.active=!1)})),Ft(this,"reset",(function(){r.stop(),r.elements.forEach((function(e){return r.delete(e.element)}))})),Ft(this,"onstart",(function(){})),Ft(this,"ondelete",(function(){})),Ft(this,"onstop",(function(){})),Ft(this,"calculateRefreshRate",Ve),this.technique=t[i],this.samples=o}));function Pt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Pt=function(){return!!e})()}var Bt=function(e){function t(){var e,n,r,i,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"periodic",s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return Ot(this,t),n=this,i=[{approximation:Je,periodic:Ke},o,s],r=St(r=t),Ft(e=Rt(n,Pt()?Reflect.construct(r,i||[],St(n).constructor):r.apply(n,i)),"style",document.createElement("style")),Ft(e,"onstart",(function(){e.style.type="text/css",document.head.appendChild(e.style)})),Ft(e,"ondelete",(function(e){e.element.style.animation="",e.element.style.visibility="",e.element.style.backgroundColor=""})),Ft(e,"onstop",(function(){e.style.remove()})),Ft(e,"animate",(function(t){var n,r;if(t.light){var i,o=t.light.split(","),s=o.slice(0,3).map((function(e){return 255*(null!=e?e:1)}));t.element.style.backgroundColor="rgba(".concat(s,",").concat(null!==(i=null==o?void 0:o[3])&&void 0!==i?i:1,")")}t.element.style.visibility="visible";var u=e.technique.getAnimationInfo(t,e.refreshRate,t.id),a=String(u.duration).concat("s ",u.name,u.type);e.style.sheet.insertRule(u.rule,null!==(n=null===(r=e.style.cssRules)||void 0===r?void 0:r.length)&&void 0!==n?n:0),t.element.style.animation=a})),e}return Ct(t,e),At(t)}(Mt);function kt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(kt=function(){return!!e})()}var It=function(e){function t(){var e,n,r,i,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"periodic",s=arguments.length>1?arguments[1]:void 0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return Ot(this,t),n=this,i=[{approximation:gt,periodic:yt},o,u],r=St(r=t),Ft(e=Rt(n,kt()?Reflect.construct(r,i||[],St(n).constructor):r.apply(n,i)),"gl",null),Ft(e,"texCoordLocation",null),Ft(e,"canvas",null),Ft(e,"onstart",(function(){e.gl=e.canvas.getContext("webgl",{powerPreference:"high-performance",alpha:!1});var t=ft(e.gl,st,ut),n=e.gl.getAttribLocation(t,"a_position");e.texCoordLocation=e.gl.getAttribLocation(t,"a_texCoord");var r=dt(e.gl);e.gl.useProgram(t),e.gl.enableVertexAttribArray(n),e.gl.bindBuffer(e.gl.ARRAY_BUFFER,r),e.gl.vertexAttribPointer(n,2,e.gl.FLOAT,!1,0,0)})),Ft(e,"ondelete",(function(e){window.cancelAnimationFrame(e.animationId),e.animate=null})),Ft(e,"onstop",(function(){e.gl.clear(e.gl.DEPTH_BUFFER_BIT|e.gl.COLOR_BUFFER_BIT|e.gl.STENCIL_BUFFER_BIT)})),Ft(e,"getElementInfo",(function(t){var n,r;t.dark=null!==(n=t.element.getAttribute("data-dark-color"))&&void 0!==n?n:"0,0,0,1",t.light=null!==(r=t.element.getAttribute("data-light-color"))&&void 0!==r?r:"1,1,1,1";var i=lt(t.dark.split(",").map(Number),t.light.split(",").map(Number)),o=e.technique.calculateStimuliIntensities(t,e.refreshRate),s=dt(e.gl),u=pt(e.gl,i.darkOffScreenCanvas),a=dt(e.gl),c=pt(e.gl,i.lightOffScreenCanvas);return{element:t.element,stimulusCycle:{intensities:o,maxFrames:o.length},textures:{darkTexture:u,lightTexture:c,texCoordLocation:e.texCoordLocation},coordBuffers:{darkTexCoordBuffer:s,lightTexCoordBuffer:a},counter:0}})),Ft(e,"animate",(function(t){var n=e.getElementInfo(t);t.animate=function(){1===n.stimulusCycle.intensities[n.counter]?mt(e.gl,{element:n.element,coordBuffer:n.coordBuffers.lightTexCoordBuffer,texCoordLoc:n.textures.texCoordLocation,texture:n.textures.lightTexture}):mt(e.gl,{element:n.element,coordBuffer:n.coordBuffers.darkTexCoordBuffer,texCoordLoc:n.textures.texCoordLocation,texture:n.textures.darkTexture}),n.counter<n.stimulusCycle.maxFrames-1?n.counter++:n.counter=0,t.animationId=window.requestAnimationFrame((function(e){return t.animate()}))},t.animate()})),e.canvas=s,e}return Ct(t,e),At(t)}(Mt);e.CSS=Bt,e.WebGL=It,e.calculateRefreshRate=Ve,e.css=tt,e.webgl=Nt,Object.defineProperty(e,"__esModule",{value:!0})}));
e.exports=n=function(){return i},e.exports.__esModule=!0,e.exports.default=e.exports;var r,i={},o=Object.prototype,s=o.hasOwnProperty,u=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function h(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(r){h=function(e,t,n){return e[t]=n}}function d(e,t,n,r){var i=t&&t.prototype instanceof b?t:b,o=Object.create(i.prototype),s=new M(r||[]);return u(o,"_invoke",{value:S(e,n,s)}),o}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}i.wrap=d;var m="suspendedStart",g="suspendedYield",v="executing",w="completed",y={};function b(){}function x(){}function E(){}var N={};h(N,c,(function(){return this}));var _=Object.getPrototypeOf,T=_&&_(_(P([])));T&&T!==o&&s.call(T,c)&&(N=T);var A=E.prototype=b.prototype=Object.create(N);function O(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function R(e,n){function r(i,o,u,a){var c=p(e[i],e,o);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==t(f)&&s.call(f,"__await")?n.resolve(f.__await).then((function(e){r("next",e,u,a)}),(function(e){r("throw",e,u,a)})):n.resolve(f).then((function(e){l.value=e,u(l)}),(function(e){return r("throw",e,u,a)}))}a(c.arg)}var i;u(this,"_invoke",{value:function(e,t){function o(){return new n((function(n,i){r(e,t,n,i)}))}return i=i?i.then(o,o):o()}})}function S(e,t,n){var i=m;return function(o,s){if(i===v)throw Error("Generator is already running");if(i===w){if("throw"===o)throw s;return{value:r,done:!0}}for(n.method=o,n.arg=s;;){var u=n.delegate;if(u){var a=L(u,n);if(a){if(a===y)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===m)throw i=w,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=v;var c=p(e,t,n);if("normal"===c.type){if(i=n.done?w:g,c.arg===y)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=w,n.method="throw",n.arg=c.arg)}}}function L(e,t){var n=t.method,i=e.iterator[n];if(i===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=r,L(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var o=p(i,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,y;var s=o.arg;return s?s.done?(t[e.resultName]=s.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=r),t.delegate=null,y):s:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function F(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function P(e){if(e||""===e){var n=e[c];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function t(){for(;++i<e.length;)if(s.call(e,i))return t.value=e[i],t.done=!1,t;return t.value=r,t.done=!0,t};return o.next=o}}throw new TypeError(t(e)+" is not iterable")}return x.prototype=E,u(A,"constructor",{value:E,configurable:!0}),u(E,"constructor",{value:x,configurable:!0}),x.displayName=h(E,f,"GeneratorFunction"),i.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===x||"GeneratorFunction"===(t.displayName||t.name))},i.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,h(e,f,"GeneratorFunction")),e.prototype=Object.create(A),e},i.awrap=function(e){return{__await:e}},O(R.prototype),h(R.prototype,l,(function(){return this})),i.AsyncIterator=R,i.async=function(e,t,n,r,o){void 0===o&&(o=Promise);var s=new R(d(e,t,n,r),o);return i.isGeneratorFunction(t)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},O(A),h(A,f,"Generator"),h(A,c,(function(){return this})),h(A,"toString",(function(){return"[object Generator]"})),i.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},i.values=P,M.prototype={constructor:M,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(F),!e)for(var t in this)"t"===t.charAt(0)&&s.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=r)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return u.type="throw",u.arg=e,t.next=n,i&&(t.method="next",t.arg=r),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],u=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var a=s.call(o,"catchLoc"),c=s.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&s.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),F(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;F(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:P(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=r),y}},i}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(r);var o=r.exports(),s=o;try{regeneratorRuntime=o}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}var a,c,l=9e15,f=1e9,h="0123456789abcdef",d="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",p="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",m={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-l,maxE:l,crypto:!1},g=!0,v="[DecimalError] ",w=v+"Invalid argument: ",y=v+"Precision limit exceeded",b=v+"crypto unavailable",x="[object Decimal]",E=Math.floor,N=Math.pow,_=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,T=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,A=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,O=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,R=1e7,S=d.length-1,L=p.length-1,C={toStringTag:x};function F(e){var t,n,r,i=e.length-1,o="",s=e[0];if(i>0){for(o+=s,t=1;t<i;t++)(n=7-(r=e[t]+"").length)&&(o+=Z(n)),o+=r;(n=7-(r=(s=e[t])+"").length)&&(o+=Z(n))}else if(0===s)return"0";for(;s%10==0;)s/=10;return o+s}function M(e,t,n){if(e!==~~e||e<t||e>n)throw Error(w+e)}function P(e,t,n,r){var i,o,s,u;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=7,i=0):(i=Math.ceil((t+1)/7),t%=7),o=N(10,7-t),u=e[i]%o|0,null==r?t<3?(0==t?u=u/100|0:1==t&&(u=u/10|0),s=n<4&&99999==u||n>3&&49999==u||5e4==u||0==u):s=(n<4&&u+1==o||n>3&&u+1==o/2)&&(e[i+1]/o/100|0)==N(10,t-2)-1||(u==o/2||0==u)&&!(e[i+1]/o/100|0):t<4?(0==t?u=u/1e3|0:1==t?u=u/100|0:2==t&&(u=u/10|0),s=(r||n<4)&&9999==u||!r&&n>3&&4999==u):s=((r||n<4)&&u+1==o||!r&&n>3&&u+1==o/2)&&(e[i+1]/o/1e3|0)==N(10,t-3)-1,s}function B(e,t,n){for(var r,i,o=[0],s=0,u=e.length;s<u;){for(i=o.length;i--;)o[i]*=t;for(o[0]+=h.indexOf(e.charAt(s++)),r=0;r<o.length;r++)o[r]>n-1&&(void 0===o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}C.absoluteValue=C.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),I(e)},C.ceil=function(){return I(new this.constructor(this),this.e+1,2)},C.clampedTo=C.clamp=function(e,t){var n=this,r=n.constructor;if(e=new r(e),t=new r(t),!e.s||!t.s)return new r(NaN);if(e.gt(t))throw Error(w+t);return n.cmp(e)<0?e:n.cmp(t)>0?t:new r(n)},C.comparedTo=C.cmp=function(e){var t,n,r,i,o=this,s=o.d,u=(e=new o.constructor(e)).d,a=o.s,c=e.s;if(!s||!u)return a&&c?a!==c?a:s===u?0:!s^a<0?1:-1:NaN;if(!s[0]||!u[0])return s[0]?a:u[0]?-c:0;if(a!==c)return a;if(o.e!==e.e)return o.e>e.e^a<0?1:-1;for(t=0,n=(r=s.length)<(i=u.length)?r:i;t<n;++t)if(s[t]!==u[t])return s[t]>u[t]^a<0?1:-1;return r===i?0:r>i^a<0?1:-1},C.cosine=C.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+7,r.rounding=1,n=function(e,t){var n,r,i;if(t.isZero())return t;r=t.d.length,r<32?i=(1/Q(4,n=Math.ceil(r/3))).toString():(n=16,i="2.3283064365386962890625e-10");e.precision+=n,t=K(e,1,t.times(i),new e(1));for(var o=n;o--;){var s=t.times(t);t=s.times(s).minus(s).times(8).plus(1)}return e.precision-=n,t}(r,ee(r,n)),r.precision=e,r.rounding=t,I(2==c||3==c?n.neg():n,e,t,!0)):new r(1):new r(NaN)},C.cubeRoot=C.cbrt=function(){var e,t,n,r,i,o,s,u,a,c,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(g=!1,(o=l.s*N(l.s*l,1/3))&&Math.abs(o)!=1/0?r=new f(o.toString()):(n=F(l.d),(o=((e=l.e)-n.length+1)%3)&&(n+=1==o||-2==o?"0":"00"),o=N(n,1/3),e=E((e+1)/3)-(e%3==(e<0?-1:2)),(r=new f(n=o==1/0?"5e"+e:(n=o.toExponential()).slice(0,n.indexOf("e")+1)+e)).s=l.s),s=(e=f.precision)+3;;)if(c=(a=(u=r).times(u).times(u)).plus(l),r=k(c.plus(l).times(u),c.plus(a),s+2,1),F(u.d).slice(0,s)===(n=F(r.d)).slice(0,s)){if("9999"!=(n=n.slice(s-3,s+1))&&(i||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(I(r,e+1,1),t=!r.times(r).times(r).eq(l));break}if(!i&&(I(u,e+1,0),u.times(u).times(u).eq(l))){r=u;break}s+=4,i=1}return g=!0,I(r,e,f.rounding,t)},C.decimalPlaces=C.dp=function(){var e,t=this.d,n=NaN;if(t){if(n=7*((e=t.length-1)-E(this.e/7)),e=t[e])for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n},C.dividedBy=C.div=function(e){return k(this,new this.constructor(e))},C.dividedToIntegerBy=C.divToInt=function(e){var t=this.constructor;return I(k(this,new t(e),0,1,1),t.precision,t.rounding)},C.equals=C.eq=function(e){return 0===this.cmp(e)},C.floor=function(){return I(new this.constructor(this),this.e+1,3)},C.greaterThan=C.gt=function(e){return this.cmp(e)>0},C.greaterThanOrEqualTo=C.gte=function(e){var t=this.cmp(e);return 1==t||0===t},C.hyperbolicCosine=C.cosh=function(){var e,t,n,r,i,o=this,s=o.constructor,u=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return u;n=s.precision,r=s.rounding,s.precision=n+Math.max(o.e,o.sd())+4,s.rounding=1,(i=o.d.length)<32?t=(1/Q(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),o=K(s,1,o.times(t),new s(1),!0);for(var a,c=e,l=new s(8);c--;)a=o.times(o),o=u.minus(a.times(l.minus(a.times(l))));return I(o,s.precision=n,s.rounding=r,!0)},C.hyperbolicSine=C.sinh=function(){var e,t,n,r,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,n=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,(r=i.d.length)<3)i=K(o,2,i,i,!0);else{e=(e=1.4*Math.sqrt(r))>16?16:0|e,i=K(o,2,i=i.times(1/Q(5,e)),i,!0);for(var s,u=new o(5),a=new o(16),c=new o(20);e--;)s=i.times(i),i=i.times(u.plus(s.times(a.times(s).plus(c))))}return o.precision=t,o.rounding=n,I(i,t,n,!0)},C.hyperbolicTangent=C.tanh=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,k(n.sinh(),n.cosh(),r.precision=e,r.rounding=t)):new r(n.s)},C.inverseCosine=C.acos=function(){var e,t=this,n=t.constructor,r=t.abs().cmp(1),i=n.precision,o=n.rounding;return-1!==r?0===r?t.isNeg()?D(n,i,o):new n(0):new n(NaN):t.isZero()?D(n,i+4,o).times(.5):(n.precision=i+6,n.rounding=1,t=t.asin(),e=D(n,i+4,o).times(.5),n.precision=i,n.rounding=o,e.minus(t))},C.inverseHyperbolicCosine=C.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,g=!1,n=n.times(n).minus(1).sqrt().plus(n),g=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)},C.inverseHyperbolicSine=C.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,g=!1,n=n.times(n).plus(1).sqrt().plus(n),g=!0,r.precision=e,r.rounding=t,n.ln())},C.inverseHyperbolicTangent=C.atanh=function(){var e,t,n,r,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,r=i.sd(),Math.max(r,e)<2*-i.e-1?I(new o(i),e,t,!0):(o.precision=n=r-i.e,i=k(i.plus(1),new o(1).minus(i),n+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5))):new o(NaN)},C.inverseSine=C.asin=function(){var e,t,n,r,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),n=o.precision,r=o.rounding,-1!==t?0===t?((e=D(o,n+4,r).times(.5)).s=i.s,e):new o(NaN):(o.precision=n+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=r,i.times(2)))},C.inverseTangent=C.atan=function(){var e,t,n,r,i,o,s,u,a,c=this,l=c.constructor,f=l.precision,h=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&f+4<=L)return(s=D(l,f+4,h).times(.25)).s=c.s,s}else{if(!c.s)return new l(NaN);if(f+4<=L)return(s=D(l,f+4,h).times(.5)).s=c.s,s}for(l.precision=u=f+10,l.rounding=1,e=n=Math.min(28,u/7+2|0);e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(g=!1,t=Math.ceil(u/7),r=1,a=c.times(c),s=new l(c),i=c;-1!==e;)if(i=i.times(a),o=s.minus(i.div(r+=2)),i=i.times(a),void 0!==(s=o.plus(i.div(r+=2))).d[t])for(e=t;s.d[e]===o.d[e]&&e--;);return n&&(s=s.times(2<<n-1)),g=!0,I(s,l.precision=f,l.rounding=h,!0)},C.isFinite=function(){return!!this.d},C.isInteger=C.isInt=function(){return!!this.d&&E(this.e/7)>this.d.length-2},C.isNaN=function(){return!this.s},C.isNegative=C.isNeg=function(){return this.s<0},C.isPositive=C.isPos=function(){return this.s>0},C.isZero=function(){return!!this.d&&0===this.d[0]},C.lessThan=C.lt=function(e){return this.cmp(e)<0},C.lessThanOrEqualTo=C.lte=function(e){return this.cmp(e)<1},C.logarithm=C.log=function(e){var t,n,r,i,o,s,u,a,c=this,l=c.constructor,f=l.precision,h=l.rounding;if(null==e)e=new l(10),t=!0;else{if(n=(e=new l(e)).d,e.s<0||!n||!n[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(n=c.d,c.s<0||!n||!n[0]||c.eq(1))return new l(n&&!n[0]?-1/0:1!=c.s?NaN:n?0:1/0);if(t)if(n.length>1)o=!0;else{for(i=n[0];i%10==0;)i/=10;o=1!==i}if(g=!1,s=W(c,u=f+5),r=t?U(l,u+10):W(e,u),P((a=k(s,r,u,1)).d,i=f,h))do{if(s=W(c,u+=10),r=t?U(l,u+10):W(e,u),a=k(s,r,u,1),!o){+F(a.d).slice(i+1,i+15)+1==1e14&&(a=I(a,f+1,0));break}}while(P(a.d,i+=10,h));return g=!0,I(a,f,h)},C.minus=C.sub=function(e){var t,n,r,i,o,s,u,a,c,l,f,h,d=this,p=d.constructor;if(e=new p(e),!d.d||!e.d)return d.s&&e.s?d.d?e.s=-e.s:e=new p(e.d||d.s!==e.s?d:NaN):e=new p(NaN),e;if(d.s!=e.s)return e.s=-e.s,d.plus(e);if(c=d.d,h=e.d,u=p.precision,a=p.rounding,!c[0]||!h[0]){if(h[0])e.s=-e.s;else{if(!c[0])return new p(3===a?-0:0);e=new p(d)}return g?I(e,u,a):e}if(n=E(e.e/7),l=E(d.e/7),c=c.slice(),o=l-n){for((f=o<0)?(t=c,o=-o,s=h.length):(t=h,n=l,s=c.length),o>(r=Math.max(Math.ceil(u/7),s)+2)&&(o=r,t.length=1),t.reverse(),r=o;r--;)t.push(0);t.reverse()}else{for((f=(r=c.length)<(s=h.length))&&(s=r),r=0;r<s;r++)if(c[r]!=h[r]){f=c[r]<h[r];break}o=0}for(f&&(t=c,c=h,h=t,e.s=-e.s),s=c.length,r=h.length-s;r>0;--r)c[s++]=0;for(r=h.length;r>o;){if(c[--r]<h[r]){for(i=r;i&&0===c[--i];)c[i]=R-1;--c[i],c[r]+=R}c[r]-=h[r]}for(;0===c[--s];)c.pop();for(;0===c[0];c.shift())--n;return c[0]?(e.d=c,e.e=j(c,n),g?I(e,u,a):e):new p(3===a?-0:0)},C.modulo=C.mod=function(e){var t,n=this,r=n.constructor;return e=new r(e),!n.d||!e.s||e.d&&!e.d[0]?new r(NaN):!e.d||n.d&&!n.d[0]?I(new r(n),r.precision,r.rounding):(g=!1,9==r.modulo?(t=k(n,e.abs(),0,3,1)).s*=e.s:t=k(n,e,0,r.modulo,1),t=t.times(e),g=!0,n.minus(t))},C.naturalExponential=C.exp=function(){return Y(this)},C.naturalLogarithm=C.ln=function(){return W(this)},C.negated=C.neg=function(){var e=new this.constructor(this);return e.s=-e.s,I(e)},C.plus=C.add=function(e){var t,n,r,i,o,s,u,a,c,l,f=this,h=f.constructor;if(e=new h(e),!f.d||!e.d)return f.s&&e.s?f.d||(e=new h(e.d||f.s===e.s?f:NaN)):e=new h(NaN),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(c=f.d,l=e.d,u=h.precision,a=h.rounding,!c[0]||!l[0])return l[0]||(e=new h(f)),g?I(e,u,a):e;if(o=E(f.e/7),r=E(e.e/7),c=c.slice(),i=o-r){for(i<0?(n=c,i=-i,s=l.length):(n=l,r=o,s=c.length),i>(s=(o=Math.ceil(u/7))>s?o+1:s+1)&&(i=s,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for((s=c.length)-(i=l.length)<0&&(i=s,n=l,l=c,c=n),t=0;i;)t=(c[--i]=c[i]+l[i]+t)/R|0,c[i]%=R;for(t&&(c.unshift(t),++r),s=c.length;0==c[--s];)c.pop();return e.d=c,e.e=j(c,r),g?I(e,u,a):e},C.precision=C.sd=function(e){var t,n=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(w+e);return n.d?(t=H(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t},C.round=function(){var e=this,t=e.constructor;return I(new t(e),e.e+1,t.rounding)},C.sine=C.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+7,r.rounding=1,n=function(e,t){var n,r=t.d.length;if(r<3)return t.isZero()?t:K(e,2,t,t);n=(n=1.4*Math.sqrt(r))>16?16:0|n,t=t.times(1/Q(5,n)),t=K(e,2,t,t);for(var i,o=new e(5),s=new e(16),u=new e(20);n--;)i=t.times(t),t=t.times(o.plus(i.times(s.times(i).minus(u))));return t}(r,ee(r,n)),r.precision=e,r.rounding=t,I(c>2?n.neg():n,e,t,!0)):new r(NaN)},C.squareRoot=C.sqrt=function(){var e,t,n,r,i,o,s=this,u=s.d,a=s.e,c=s.s,l=s.constructor;if(1!==c||!u||!u[0])return new l(!c||c<0&&(!u||u[0])?NaN:u?s:1/0);for(g=!1,0==(c=Math.sqrt(+s))||c==1/0?(((t=F(u)).length+a)%2==0&&(t+="0"),c=Math.sqrt(t),a=E((a+1)/2)-(a<0||a%2),r=new l(t=c==1/0?"5e"+a:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+a)):r=new l(c.toString()),n=(a=l.precision)+3;;)if(r=(o=r).plus(k(s,o,n+2,1)).times(.5),F(o.d).slice(0,n)===(t=F(r.d)).slice(0,n)){if("9999"!=(t=t.slice(n-3,n+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(I(r,a+1,1),e=!r.times(r).eq(s));break}if(!i&&(I(o,a+1,0),o.times(o).eq(s))){r=o;break}n+=4,i=1}return g=!0,I(r,a,l.rounding,e)},C.tangent=C.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,(n=n.sin()).s=1,n=k(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,I(2==c||4==c?n.neg():n,e,t,!0)):new r(NaN)},C.times=C.mul=function(e){var t,n,r,i,o,s,u,a,c,l=this,f=l.constructor,h=l.d,d=(e=new f(e)).d;if(e.s*=l.s,!(h&&h[0]&&d&&d[0]))return new f(!e.s||h&&!h[0]&&!d||d&&!d[0]&&!h?NaN:h&&d?0*e.s:e.s/0);for(n=E(l.e/7)+E(e.e/7),(a=h.length)<(c=d.length)&&(o=h,h=d,d=o,s=a,a=c,c=s),o=[],r=s=a+c;r--;)o.push(0);for(r=c;--r>=0;){for(t=0,i=a+r;i>r;)u=o[i]+d[r]*h[i-r-1]+t,o[i--]=u%R|0,t=u/R|0;o[i]=(o[i]+t)%R|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=j(o,n),g?I(e,f.precision,f.rounding):e},C.toBinary=function(e,t){return te(this,2,e,t)},C.toDecimalPlaces=C.toDP=function(e,t){var n=this,r=n.constructor;return n=new r(n),void 0===e?n:(M(e,0,f),void 0===t?t=r.rounding:M(t,0,8),I(n,e+n.e+1,t))},C.toExponential=function(e,t){var n,r=this,i=r.constructor;return void 0===e?n=q(r,!0):(M(e,0,f),void 0===t?t=i.rounding:M(t,0,8),n=q(r=I(new i(r),e+1,t),!0,e+1)),r.isNeg()&&!r.isZero()?"-"+n:n},C.toFixed=function(e,t){var n,r,i=this,o=i.constructor;return void 0===e?n=q(i):(M(e,0,f),void 0===t?t=o.rounding:M(t,0,8),n=q(r=I(new o(i),e+i.e+1,t),!1,e+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n},C.toFraction=function(e){var t,n,r,i,o,s,u,a,c,l,f,h,d=this,p=d.d,m=d.constructor;if(!p)return new m(d);if(c=n=new m(1),r=a=new m(0),s=(o=(t=new m(r)).e=H(p)-d.e-1)%7,t.d[0]=N(10,s<0?7+s:s),null==e)e=o>0?t:c;else{if(!(u=new m(e)).isInt()||u.lt(c))throw Error(w+u);e=u.gt(t)?o>0?t:c:u}for(g=!1,u=new m(F(p)),l=m.precision,m.precision=o=7*p.length*2;f=k(u,t,0,1,1),1!=(i=n.plus(f.times(r))).cmp(e);)n=r,r=i,i=c,c=a.plus(f.times(i)),a=i,i=t,t=u.minus(f.times(i)),u=i;return i=k(e.minus(n),r,0,1,1),a=a.plus(i.times(c)),n=n.plus(i.times(r)),a.s=c.s=d.s,h=k(c,r,o,1).minus(d).abs().cmp(k(a,n,o,1).minus(d).abs())<1?[c,r]:[a,n],m.precision=l,g=!0,h},C.toHexadecimal=C.toHex=function(e,t){return te(this,16,e,t)},C.toNearest=function(e,t){var n=this,r=n.constructor;if(n=new r(n),null==e){if(!n.d)return n;e=new r(1),t=r.rounding}else{if(e=new r(e),void 0===t?t=r.rounding:M(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&(e.s=n.s),e}return e.d[0]?(g=!1,n=k(n,e,0,t,1).times(e),g=!0,I(n)):(e.s=n.s,n=e),n},C.toNumber=function(){return+this},C.toOctal=function(e,t){return te(this,8,e,t)},C.toPower=C.pow=function(e){var t,n,r,i,o,s,u=this,a=u.constructor,c=+(e=new a(e));if(!(u.d&&e.d&&u.d[0]&&e.d[0]))return new a(N(+u,c));if((u=new a(u)).eq(1))return u;if(r=a.precision,o=a.rounding,e.eq(1))return I(u,r,o);if((t=E(e.e/7))>=e.d.length-1&&(n=c<0?-c:c)<=9007199254740991)return i=G(a,u,n,r),e.s<0?new a(1).div(i):I(i,r,o);if((s=u.s)<0){if(t<e.d.length-1)return new a(NaN);if(1&e.d[t]||(s=1),0==u.e&&1==u.d[0]&&1==u.d.length)return u.s=s,u}return(t=0!=(n=N(+u,c))&&isFinite(n)?new a(n+"").e:E(c*(Math.log("0."+F(u.d))/Math.LN10+u.e+1)))>a.maxE+1||t<a.minE-1?new a(t>0?s/0:0):(g=!1,a.rounding=u.s=1,n=Math.min(12,(t+"").length),(i=Y(e.times(W(u,r+n)),r)).d&&P((i=I(i,r+5,1)).d,r,o)&&(t=r+10,+F((i=I(Y(e.times(W(u,t+n)),t),t+5,1)).d).slice(r+1,r+15)+1==1e14&&(i=I(i,r+1,0))),i.s=s,g=!0,a.rounding=o,I(i,r,o))},C.toPrecision=function(e,t){var n,r=this,i=r.constructor;return void 0===e?n=q(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(M(e,1,f),void 0===t?t=i.rounding:M(t,0,8),n=q(r=I(new i(r),e,t),e<=r.e||r.e<=i.toExpNeg,e)),r.isNeg()&&!r.isZero()?"-"+n:n},C.toSignificantDigits=C.toSD=function(e,t){var n=this.constructor;return void 0===e?(e=n.precision,t=n.rounding):(M(e,1,f),void 0===t?t=n.rounding:M(t,0,8)),I(new n(this),e,t)},C.toString=function(){var e=this,t=e.constructor,n=q(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+n:n},C.truncated=C.trunc=function(){return I(new this.constructor(this),this.e+1,1)},C.valueOf=C.toJSON=function(){var e=this,t=e.constructor,n=q(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+n:n};var k=function(){function e(e,t,n){var r,i=0,o=e.length;for(e=e.slice();o--;)r=e[o]*t+i,e[o]=r%n|0,i=r/n|0;return i&&e.unshift(i),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;i<n;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]<t[n]?1:0,e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;)e.shift()}return function(r,i,o,s,u,c){var l,f,h,d,p,m,g,v,w,y,b,x,N,_,T,A,O,S,L,C,F=r.constructor,M=r.s==i.s?1:-1,P=r.d,B=i.d;if(!(P&&P[0]&&B&&B[0]))return new F(r.s&&i.s&&(P?!B||P[0]!=B[0]:B)?P&&0==P[0]||!B?0*M:M/0:NaN);for(c?(p=1,f=r.e-i.e):(c=R,p=7,f=E(r.e/p)-E(i.e/p)),L=B.length,O=P.length,y=(w=new F(M)).d=[],h=0;B[h]==(P[h]||0);h++);if(B[h]>(P[h]||0)&&f--,null==o?(_=o=F.precision,s=F.rounding):_=u?o+(r.e-i.e)+1:o,_<0)y.push(1),m=!0;else{if(_=_/p+2|0,h=0,1==L){for(d=0,B=B[0],_++;(h<O||d)&&_--;h++)T=d*c+(P[h]||0),y[h]=T/B|0,d=T%B|0;m=d||h<O}else{for((d=c/(B[0]+1)|0)>1&&(B=e(B,d,c),P=e(P,d,c),L=B.length,O=P.length),A=L,x=(b=P.slice(0,L)).length;x<L;)b[x++]=0;(C=B.slice()).unshift(0),S=B[0],B[1]>=c/2&&++S;do{d=0,(l=t(B,b,L,x))<0?(N=b[0],L!=x&&(N=N*c+(b[1]||0)),(d=N/S|0)>1?(d>=c&&(d=c-1),1==(l=t(g=e(B,d,c),b,v=g.length,x=b.length))&&(d--,n(g,L<v?C:B,v,c))):(0==d&&(l=d=1),g=B.slice()),(v=g.length)<x&&g.unshift(0),n(b,g,x,c),-1==l&&(l=t(B,b,L,x=b.length))<1&&(d++,n(b,L<x?C:B,x,c)),x=b.length):0===l&&(d++,b=[0]),y[h++]=d,l&&b[0]?b[x++]=P[A]||0:(b=[P[A]],x=1)}while((A++<O||void 0!==b[0])&&_--);m=void 0!==b[0]}y[0]||y.shift()}if(1==p)w.e=f,a=m;else{for(h=1,d=y[0];d>=10;d/=10)h++;w.e=h+f*p-1,I(w,u?o+w.e+1:o,s,m)}return w}}();function I(e,t,n,r){var i,o,s,u,a,c,l,f,h,d=e.constructor;e:if(null!=t){if(!(f=e.d))return e;for(i=1,u=f[0];u>=10;u/=10)i++;if((o=t-i)<0)o+=7,s=t,a=(l=f[h=0])/N(10,i-s-1)%10|0;else if((h=Math.ceil((o+1)/7))>=(u=f.length)){if(!r)break e;for(;u++<=h;)f.push(0);l=a=0,i=1,s=(o%=7)-7+1}else{for(l=u=f[h],i=1;u>=10;u/=10)i++;a=(s=(o%=7)-7+i)<0?0:l/N(10,i-s-1)%10|0}if(r=r||t<0||void 0!==f[h+1]||(s<0?l:l%N(10,i-s-1)),c=n<4?(a||r)&&(0==n||n==(e.s<0?3:2)):a>5||5==a&&(4==n||r||6==n&&(o>0?s>0?l/N(10,i-s):0:f[h-1])%10&1||n==(e.s<0?8:7)),t<1||!f[0])return f.length=0,c?(t-=e.e+1,f[0]=N(10,(7-t%7)%7),e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=h,u=1,h--):(f.length=h+1,u=N(10,7-o),f[h]=s>0?(l/N(10,i-s)%N(10,s)|0)*u:0),c)for(;;){if(0==h){for(o=1,s=f[0];s>=10;s/=10)o++;for(s=f[0]+=u,u=1;s>=10;s/=10)u++;o!=u&&(e.e++,f[0]==R&&(f[0]=1));break}if(f[h]+=u,f[h]!=R)break;f[h--]=0,u=1}for(o=f.length;0===f[--o];)f.pop()}return g&&(e.e>d.maxE?(e.d=null,e.e=NaN):e.e<d.minE&&(e.e=0,e.d=[0])),e}function q(e,t,n){if(!e.isFinite())return z(e);var r,i=e.e,o=F(e.d),s=o.length;return t?(n&&(r=n-s)>0?o=o.charAt(0)+"."+o.slice(1)+Z(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+Z(-i-1)+o,n&&(r=n-s)>0&&(o+=Z(r))):i>=s?(o+=Z(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+Z(r))):((r=i+1)<s&&(o=o.slice(0,r)+"."+o.slice(r)),n&&(r=n-s)>0&&(i+1===s&&(o+="."),o+=Z(r))),o}function j(e,t){var n=e[0];for(t*=7;n>=10;n/=10)t++;return t}function U(e,t,n){if(t>S)throw g=!0,n&&(e.precision=n),Error(y);return I(new e(d),t,1,!0)}function D(e,t,n){if(t>L)throw Error(y);return I(new e(p),t,n,!0)}function H(e){var t=e.length-1,n=7*t+1;if(t=e[t]){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function Z(e){for(var t="";e--;)t+="0";return t}function G(e,t,n,r){var i,o=new e(1),s=Math.ceil(r/7+4);for(g=!1;;){if(n%2&&ne((o=o.times(t)).d,s)&&(i=!0),0===(n=E(n/2))){n=o.d.length-1,i&&0===o.d[n]&&++o.d[n];break}ne((t=t.times(t)).d,s)}return g=!0,o}function X(e){return 1&e.d[e.d.length-1]}function V(e,t,n){for(var r,i=new e(t[0]),o=0;++o<t.length;){if(!(r=new e(t[o])).s){i=r;break}i[n](r)&&(i=r)}return i}function Y(e,t){var n,r,i,o,s,u,a,c=0,l=0,f=0,h=e.constructor,d=h.rounding,p=h.precision;if(!e.d||!e.d[0]||e.e>17)return new h(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(null==t?(g=!1,a=p):a=t,u=new h(.03125);e.e>-2;)e=e.times(u),f+=5;for(a+=r=Math.log(N(2,f))/Math.LN10*2+5|0,n=o=s=new h(1),h.precision=a;;){if(o=I(o.times(e),a,1),n=n.times(++l),F((u=s.plus(k(o,n,a,1))).d).slice(0,a)===F(s.d).slice(0,a)){for(i=f;i--;)s=I(s.times(s),a,1);if(null!=t)return h.precision=p,s;if(!(c<3&&P(s.d,a-r,d,c)))return I(s,h.precision=p,d,g=!0);h.precision=a+=10,n=o=u=new h(1),l=0,c++}s=u}}function W(e,t){var n,r,i,o,s,u,a,c,l,f,h,d=1,p=e,m=p.d,v=p.constructor,w=v.rounding,y=v.precision;if(p.s<0||!m||!m[0]||!p.e&&1==m[0]&&1==m.length)return new v(m&&!m[0]?-1/0:1!=p.s?NaN:m?0:p);if(null==t?(g=!1,l=y):l=t,v.precision=l+=10,r=(n=F(m)).charAt(0),!(Math.abs(o=p.e)<15e14))return c=U(v,l+2,y).times(o+""),p=W(new v(r+"."+n.slice(1)),l-10).plus(c),v.precision=y,null==t?I(p,y,w,g=!0):p;for(;r<7&&1!=r||1==r&&n.charAt(1)>3;)r=(n=F((p=p.times(e)).d)).charAt(0),d++;for(o=p.e,r>1?(p=new v("0."+n),o++):p=new v(r+"."+n.slice(1)),f=p,a=s=p=k(p.minus(1),p.plus(1),l,1),h=I(p.times(p),l,1),i=3;;){if(s=I(s.times(h),l,1),F((c=a.plus(k(s,new v(i),l,1))).d).slice(0,l)===F(a.d).slice(0,l)){if(a=a.times(2),0!==o&&(a=a.plus(U(v,l+2,y).times(o+""))),a=k(a,new v(d),l,1),null!=t)return v.precision=y,a;if(!P(a.d,l-10,w,u))return I(a,v.precision=y,w,g=!0);v.precision=l+=10,c=s=p=k(f.minus(1),f.plus(1),l,1),h=I(p.times(p),l,1),i=u=1}a=c,i+=2}}function z(e){return String(e.s*e.s/0)}function $(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;48===t.charCodeAt(r);r++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(r,i)){if(i-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%7,n<0&&(r+=7),r<i){for(r&&e.d.push(+t.slice(0,r)),i-=7;r<i;)e.d.push(+t.slice(r,r+=7));r=7-(t=t.slice(r)).length}else r-=i;for(;r--;)t+="0";e.d.push(+t),g&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function J(e,t){var n,r,i,o,s,u,a,c,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),O.test(t))return $(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(T.test(t))n=16,t=t.toLowerCase();else if(_.test(t))n=2;else{if(!A.test(t))throw Error(w+t);n=8}for((o=t.search(/p/i))>0?(a=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),s=(o=t.indexOf("."))>=0,r=e.constructor,s&&(o=(u=(t=t.replace(".","")).length)-o,i=G(r,new r(n),o,2*o)),o=l=(c=B(t,n,R)).length-1;0===c[o];--o)c.pop();return o<0?new r(0*e.s):(e.e=j(c,l),e.d=c,g=!1,s&&(e=k(e,i,4*u)),a&&(e=e.times(Math.abs(a)<54?N(2,a):Ze.pow(2,a))),g=!0,e)}function K(e,t,n,r,i){var o,s,u,a,c=e.precision,l=Math.ceil(c/7);for(g=!1,a=n.times(n),u=new e(r);;){if(s=k(u.times(a),new e(t++*t++),c,1),u=i?r.plus(s):r.minus(s),r=k(s.times(a),new e(t++*t++),c,1),void 0!==(s=u.plus(r)).d[l]){for(o=l;s.d[o]===u.d[o]&&o--;);if(-1==o)break}o=u,u=r,r=s,s=o}return g=!0,s.d.length=l+1,s}function Q(e,t){for(var n=e;--t;)n*=e;return n}function ee(e,t){var n,r=t.s<0,i=D(e,e.precision,1),o=i.times(.5);if((t=t.abs()).lte(o))return c=r?4:1,t;if((n=t.divToInt(i)).isZero())c=r?3:2;else{if((t=t.minus(n.times(i))).lte(o))return c=X(n)?r?2:3:r?4:1,t;c=X(n)?r?1:4:r?3:2}return t.minus(i).abs()}function te(e,t,n,r){var i,o,s,u,c,l,d,p,m,g=e.constructor,v=void 0!==n;if(v?(M(n,1,f),void 0===r?r=g.rounding:M(r,0,8)):(n=g.precision,r=g.rounding),e.isFinite()){for(v?(i=2,16==t?n=4*n-3:8==t&&(n=3*n-2)):i=t,(s=(d=q(e)).indexOf("."))>=0&&(d=d.replace(".",""),(m=new g(1)).e=d.length-s,m.d=B(q(m),10,i),m.e=m.d.length),o=c=(p=B(d,10,i)).length;0==p[--c];)p.pop();if(p[0]){if(s<0?o--:((e=new g(e)).d=p,e.e=o,p=(e=k(e,m,n,r,0,i)).d,o=e.e,l=a),s=p[n],u=i/2,l=l||void 0!==p[n+1],l=r<4?(void 0!==s||l)&&(0===r||r===(e.s<0?3:2)):s>u||s===u&&(4===r||l||6===r&&1&p[n-1]||r===(e.s<0?8:7)),p.length=n,l)for(;++p[--n]>i-1;)p[n]=0,n||(++o,p.unshift(1));for(c=p.length;!p[c-1];--c);for(s=0,d="";s<c;s++)d+=h.charAt(p[s]);if(v){if(c>1)if(16==t||8==t){for(s=16==t?4:3,--c;c%s;c++)d+="0";for(c=(p=B(d,i,t)).length;!p[c-1];--c);for(s=1,d="1.";s<c;s++)d+=h.charAt(p[s])}else d=d.charAt(0)+"."+d.slice(1);d=d+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)d="0"+d;d="0."+d}else if(++o>c)for(o-=c;o--;)d+="0";else o<c&&(d=d.slice(0,o)+"."+d.slice(o))}else d=v?"0p+0":"0";d=(16==t?"0x":2==t?"0b":8==t?"0o":"")+d}else d=z(e);return e.s<0?"-"+d:d}function ne(e,t){if(e.length>t)return e.length=t,!0}function re(e){return new this(e).abs()}function ie(e){return new this(e).acos()}function oe(e){return new this(e).acosh()}function se(e,t){return new this(e).plus(t)}function ue(e){return new this(e).asin()}function ae(e){return new this(e).asinh()}function ce(e){return new this(e).atan()}function le(e){return new this(e).atanh()}function fe(e,t){e=new this(e),t=new this(t);var n,r=this.precision,i=this.rounding,o=r+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(n=t.s<0?D(this,r,i):new this(0)).s=e.s:!e.d||t.isZero()?(n=D(this,o,1).times(.5)).s=e.s:t.s<0?(this.precision=o,this.rounding=1,n=this.atan(k(e,t,o,1)),t=D(this,o,1),this.precision=r,this.rounding=i,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(k(e,t,o,1)):(n=D(this,o,1).times(t.s>0?.25:.75)).s=e.s:n=new this(NaN),n}function he(e){return new this(e).cbrt()}function de(e){return I(e=new this(e),e.e+1,2)}function pe(e,t,n){return new this(e).clamp(t,n)}function me(e){if(!e||"object"!==u(e))throw Error(v+"Object expected");var t,n,r,i=!0===e.defaults,o=["precision",1,f,"rounding",0,8,"toExpNeg",-l,0,"toExpPos",0,l,"maxE",0,l,"minE",-l,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(n=o[t],i&&(this[n]=m[n]),void 0!==(r=e[n])){if(!(E(r)===r&&r>=o[t+1]&&r<=o[t+2]))throw Error(w+n+": "+r);this[n]=r}if(n="crypto",i&&(this[n]=m[n]),void 0!==(r=e[n])){if(!0!==r&&!1!==r&&0!==r&&1!==r)throw Error(w+n+": "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(b);this[n]=!0}else this[n]=!1}return this}function ge(e){return new this(e).cos()}function ve(e){return new this(e).cosh()}function we(e,t){return new this(e).div(t)}function ye(e){return new this(e).exp()}function be(e){return I(e=new this(e),e.e+1,3)}function xe(){var e,t,n=new this(0);for(g=!1,e=0;e<arguments.length;)if((t=new this(arguments[e++])).d)n.d&&(n=n.plus(t.times(t)));else{if(t.s)return g=!0,new this(1/0);n=t}return g=!0,n.sqrt()}function Ee(e){return e instanceof Ze||e&&e.toStringTag===x||!1}function Ne(e){return new this(e).ln()}function _e(e,t){return new this(e).log(t)}function Te(e){return new this(e).log(2)}function Ae(e){return new this(e).log(10)}function Oe(){return V(this,arguments,"lt")}function Re(){return V(this,arguments,"gt")}function Se(e,t){return new this(e).mod(t)}function Le(e,t){return new this(e).mul(t)}function Ce(e,t){return new this(e).pow(t)}function Fe(e){var t,n,r,i,o=0,s=new this(1),u=[];if(void 0===e?e=this.precision:M(e,1,f),r=Math.ceil(e/7),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(r));o<r;)(i=t[o])>=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:u[o++]=i%1e7;else{if(!crypto.randomBytes)throw Error(b);for(t=crypto.randomBytes(r*=4);o<r;)(i=t[o]+(t[o+1]<<8)+(t[o+2]<<16)+((127&t[o+3])<<24))>=214e7?crypto.randomBytes(4).copy(t,o):(u.push(i%1e7),o+=4);o=r/4}else for(;o<r;)u[o++]=1e7*Math.random()|0;for(e%=7,(r=u[--o])&&e&&(i=N(10,7-e),u[o]=(r/i|0)*i);0===u[o];o--)u.pop();if(o<0)n=0,u=[0];else{for(n=-1;0===u[0];n-=7)u.shift();for(r=1,i=u[0];i>=10;i/=10)r++;r<7&&(n-=7-r)}return s.e=n,s.d=u,s}function Me(e){return I(e=new this(e),e.e+1,this.rounding)}function Pe(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function Be(e){return new this(e).sin()}function ke(e){return new this(e).sinh()}function Ie(e){return new this(e).sqrt()}function qe(e,t){return new this(e).sub(t)}function je(){var e=0,t=arguments,n=new this(t[e]);for(g=!1;n.s&&++e<t.length;)n=n.plus(t[e]);return g=!0,I(n,this.precision,this.rounding)}function Ue(e){return new this(e).tan()}function De(e){return new this(e).tanh()}function He(e){return I(e=new this(e),e.e+1,1)}C[Symbol.for("nodejs.util.inspect.custom")]=C.toString,C[Symbol.toStringTag]="Decimal";var Ze=C.constructor=function e(t){var n,r,i;function o(e){var t,n,r,i=this;if(!(i instanceof o))return new o(e);if(i.constructor=o,Ee(e))return i.s=e.s,void(g?!e.d||e.e>o.maxE?(i.e=NaN,i.d=null):e.e<o.minE?(i.e=0,i.d=[0]):(i.e=e.e,i.d=e.d.slice()):(i.e=e.e,i.d=e.d?e.d.slice():e.d));if("number"===(r=u(e))){if(0===e)return i.s=1/e<0?-1:1,i.e=0,void(i.d=[0]);if(e<0?(e=-e,i.s=-1):i.s=1,e===~~e&&e<1e7){for(t=0,n=e;n>=10;n/=10)t++;return void(g?t>o.maxE?(i.e=NaN,i.d=null):t<o.minE?(i.e=0,i.d=[0]):(i.e=t,i.d=[e]):(i.e=t,i.d=[e]))}return 0*e!=0?(e||(i.s=NaN),i.e=NaN,void(i.d=null)):$(i,e.toString())}if("string"!==r)throw Error(w+e);return 45===(n=e.charCodeAt(0))?(e=e.slice(1),i.s=-1):(43===n&&(e=e.slice(1)),i.s=1),O.test(e)?$(i,e):J(i,e)}if(o.prototype=C,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=me,o.clone=e,o.isDecimal=Ee,o.abs=re,o.acos=ie,o.acosh=oe,o.add=se,o.asin=ue,o.asinh=ae,o.atan=ce,o.atanh=le,o.atan2=fe,o.cbrt=he,o.ceil=de,o.clamp=pe,o.cos=ge,o.cosh=ve,o.div=we,o.exp=ye,o.floor=be,o.hypot=xe,o.ln=Ne,o.log=_e,o.log10=Ae,o.log2=Te,o.max=Oe,o.min=Re,o.mod=Se,o.mul=Le,o.pow=Ce,o.random=Fe,o.round=Me,o.sign=Pe,o.sin=Be,o.sinh=ke,o.sqrt=Ie,o.sub=qe,o.sum=je,o.tan=Ue,o.tanh=De,o.trunc=He,void 0===t&&(t={}),t&&!0!==t.defaults)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],n=0;n<i.length;)t.hasOwnProperty(r=i[n++])||(t[r]=this[r]);return o.config(t),o}(m);d=new Ze(d),p=new Ze(p);var Ge=function(e){return 1/e},Xe=function(){var e=n(s.mark((function e(){var t,n,r,i,o=arguments;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:10,(n=o.length>1&&void 0!==o[1]?o[1]:10)<10&&(n=10),r=[],i=[],e.abrupt("return",new Promise((function(e){var o=function(s){if(r.unshift(s),r.length>t){var u=r.pop(),a=1e3*t/(s-u);if(i.unshift(a),i.length==n)return cancelAnimationFrame(c),void e(i)}var c=window.requestAnimationFrame(o)};window.requestAnimationFrame(o)})));case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ve=function(){var e=n(s.mark((function e(){var t,n,r,i,o,u,a,c=arguments;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=c.length>0&&void 0!==c[0]?c[0]:10,n=c.length>1&&void 0!==c[1]?c[1]:10,e.next=4,Xe(t,n);case 4:for(r=e.sent,i={},o=[],u=0;u<r.length;u++)i[r[u]]||(i[r[u]]=0),i[r[u]]+=1;return(o=Object.keys(i).map(Number).filter((function(e){return i[e]==Math.max.apply(null,Object.values(i))}))).length>1&&(o=[o.reduce((function(e,t){return e+t}))/o.length]),a=Number(o.shift().toFixed(7)),e.abrupt("return",a);case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ye=new Ze(2).times(Ze.acos(-1));function We(e){for(var t=Math.pow(10,function(e){if(Math.floor(e)===Number(e))return 0;var t=e.toString().split(".")[1].length;if(t<3)return t;throw"Stimuli frequencies must have less than 3 decimal places."}(e)),n=1;n<=t;n+=1){if(0===new Ze(n).times(e).mod(1).toNumber())return n}throw"Failed to calculate the required number of seconds."}function ze(e){var t=new Ze(50),n=Ye.times(t.div(100));return 2*(function(e,t){var n=e.div(t),r=new Ze(n.toFixed(0));if(n.minus(r).div(r).abs().toNumber()<Number.EPSILON)return new Ze(0);var i=n.floor(),o=t.times(i),s=Math.sign(t.toNumber()),u=e.minus(o);return e.equals(t)||u.equals(0)||Math.sign(u.toNumber())!=s&&(u=u.abs().times(s)),u}(e,Ye).toNumber()<n.toNumber()?1:0)-1}function $e(e,t){return"@keyframes ".concat(t," { ").concat(e," }")}var Je=Object.freeze({__proto__:null,getAnimationInfo:function(e,t){for(var n="stimulus_"+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:Math.floor(1e6*Math.random())),r=We(e.frequency),i=new Ze(0),o="",s=0,u=new Ze(r).times(t).ceil().toNumber(),a=new Ze(100).div(new Ze(u)),c=0;c<u;c++){var l=ze(new Ze(Ye).times(e.frequency).times(new Ze(c).div(t)).add(e.phaseShift)),f=new Ze(.5).times(new Ze(1).add(l)).toNumber();""!==o&&s==f||(o+="".concat(i.toNumber(),"% { opacity: ").concat(f,"; } "),s=f),i=i.add(a)}var h=new Ze(1).div(t).times(u).toNumber();return{rule:$e(o,n),duration:h,type:" step-end infinite",name:n}}});var Ke=Object.freeze({__proto__:null,getAnimationInfo:function(e,t){return{duration:function(e,t){var n=Ge(e),r=Ge(t);return Math.ceil(r/n)*n}(t,e.frequency).toString(),name:"flicker",type:" step-end infinite",rule:"\n@keyframes flicker {\n 0% { opacity: 0; }\n 50% { opacity: 1; }\n}"}}}),Qe={approximation:Je,periodic:Ke};function et(){return et=n(s.mark((function e(){var t,n,r,i,o,u,a,c,l,f,h,d,p,m,g,v=arguments;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=v.length>0&&void 0!==v[0]?v[0]:"periodic",n=v.length>1?v[1]:void 0,r=v.length>2?v[2]:void 0,e.next=5,Ve(10,r);case 5:if(i=e.sent,t in Qe){e.next=10;break}throw"Method not available for CSS!";case 10:for((o=document.createElement("style")).type="text/css",document.head.appendChild(o),u=0;u<n.length;u++)(l=n[u].getAttribute("data-light-color"))&&(f=l.split(","),h=f.slice(0,3).map((function(e){return 255*(null!=e?e:1)})),n[u].style.backgroundColor="rgba(".concat(h,",").concat(f[3],")")),n[u].style.visibility="visible",d=Number(n[u].getAttribute("data-frequency")),p=Number(n[u].getAttribute("data-phase-shift")),m=Qe[t].getAnimationInfo({frequency:d,phaseShift:p},i),o.sheet.insertRule(m.rule,null!==(a=null===(c=o.cssRules)||void 0===c?void 0:c.length)&&void 0!==a?a:0),g=String(m.duration).concat("s ",m.name,m.type),n[u].style.animation=g;return e.abrupt("return",(function(){o.remove(),n.forEach((function(e){e.style.animation="",e.style.visibility="",e.style.backgroundColor=""}))}));case 15:case"end":return e.stop()}}),e)}))),et.apply(this,arguments)}var tt=Object.freeze({__proto__:null,start:function(){return et.apply(this,arguments)}}),nt=document.createElement("canvas"),rt=nt.getContext("webgl",{alpha:!1});nt.width=10,nt.height=10;var it=document.createElement("canvas"),ot=it.getContext("webgl",{alpha:!1});it.width=10,it.height=10;var st="attribute vec2 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;void main() { gl_Position = vec4(a_position, 0, 1); v_texCoord = a_texCoord; }",ut="precision mediump float;uniform sampler2D u_image;varying vec2 v_texCoord;void main() { gl_FragColor = texture2D(u_image, v_texCoord); }",at=new Float32Array([-1,1,1,1,-1,-1,1,-1]),ct=function(e){return Math.log(e)/Math.log(2)%1==0};function lt(e,t){return ot.clearColor(e[0],e[1],e[2],e[3]),ot.clear(ot.COLOR_BUFFER_BIT),rt.clearColor(t[0],t[1],t[2],t[3]),rt.clear(rt.COLOR_BUFFER_BIT),{darkOffScreenCanvas:it,lightOffScreenCanvas:nt}}function ft(e,t,n){var r=e.createProgram(),i=ht(e,t,e.VERTEX_SHADER),o=ht(e,n,e.FRAGMENT_SHADER);if(e.attachShader(r,i),e.attachShader(r,o),e.linkProgram(r),!e.getProgramParameter(r,e.LINK_STATUS))throw e.getProgramInfoLog(r);return r}function ht(e,t,n){var r=e.createShader(n);if(e.shaderSource(r,t),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw e.getShaderInfoLog(r);return r}function dt(e){var t=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,at,e.STATIC_DRAW),t}function pt(e,t){var n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),ct(t.width)&&ct(t.height)||(e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST)),n}function mt(e,t){!function(e){var t=e.clientWidth,n=e.clientHeight;e.width===t&&e.height===n||(e.width=t,e.height=n)}(e.canvas),e.enable(e.SCISSOR_TEST),e.canvas.style.transform="translateY(".concat(window.scrollY,"px)");var n=t.element.getBoundingClientRect(),r=n.right-n.left,i=n.bottom-n.top,o=n.left,s=e.canvas.clientHeight-n.bottom-1;e.viewport(o,s,r,i),e.scissor(o,s,r,i),e.clear(e.COLOR_BUFFER_BIT),e.bindTexture(e.TEXTURE_2D,t.texture),e.enableVertexAttribArray(t.texCoordLoc),e.bindBuffer(e.ARRAY_BUFFER,t.coordBuffer),e.vertexAttribPointer(t.texCoordLoc,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_STRIP,0,4)}var gt=Object.freeze({__proto__:null,calculateStimuliIntensities:function(e,t){for(var n=We(e.frequency),r=[],i=new Ze(n).times(t).ceil().toNumber(),o=0;o<i;o++){var s=ze(new Ze(Ye).times(e.frequency).times(new Ze(o).div(t)).add(e.phaseShift)),u=new Ze(.5).times(new Ze(1).add(s));r.push(u.toNumber())}return r}});function vt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function wt(e){return function(e){if(Array.isArray(e))return vt(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 vt(e,t);var n={}.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)?vt(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var yt=Object.freeze({__proto__:null,calculateStimuliIntensities:function(e,t){var n=[],r=function(e,t){var n=Ge(t),r=Ge(e);return Math.round(r/n)}(e.frequency,t)/2;return n.push.apply(n,wt(Array(Math.ceil(r)).fill(1))),n.push.apply(n,wt(Array(Math.floor(r)).fill(0))),n}}),bt={approximation:gt,periodic:yt};function xt(){return xt=n(s.mark((function e(){var t,n,r,i,o,u,a,c,l,f,h,d,p,m,g,v,w,y,b,x,E,N,_,T,A,O,R=arguments;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=R.length>0&&void 0!==R[0]?R[0]:"periodic",n=R.length>1?R[1]:void 0,r=R.length>2?R[2]:void 0,i=R.length>3&&void 0!==R[3]?R[3]:10,e.next=6,Ve(10,i);case 6:if(o=e.sent,u=[],t in bt){e.next=12;break}throw"Method not available for WebGL!";case 12:if(r instanceof HTMLCanvasElement){e.next=16;break}throw"canvas argument is not an HTMLCanvasElement!";case 16:for(a=r.getContext("webgl",{powerPreference:"high-performance",alpha:!1}),c=ft(a,st,ut),l=a.getAttribLocation(c,"a_position"),f=a.getAttribLocation(c,"a_texCoord"),h=dt(a),a.useProgram(c),a.enableVertexAttribArray(l),a.bindBuffer(a.ARRAY_BUFFER,h),a.vertexAttribPointer(l,2,a.FLOAT,!1,0,0),d=0;d<n.length;d++)g=(null!==(p=n[d].getAttribute("data-dark-color"))&&void 0!==p?p:"0,0,0,1").split(",").map(Number),v=(null!==(m=n[d].getAttribute("data-light-color"))&&void 0!==m?m:"1,1,1,1").split(",").map(Number),w=lt(g,v),y=Number(n[d].getAttribute("data-frequency")),b=Number(n[d].getAttribute("data-phase-shift")),x=bt[t].calculateStimuliIntensities({frequency:y,phaseShift:b},o),E=dt(a),N=pt(a,w.darkOffScreenCanvas),_=dt(a),T=pt(a,w.lightOffScreenCanvas),A={element:n[d],stimulusCycle:{intensities:x,maxFrames:x.length},textures:{darkTexture:N,lightTexture:T,texCoordLocation:f},coordBuffers:{darkTexCoordBuffer:E,lightTexCoordBuffer:_},counter:0},O={id:null},u.push(Et(performance.now(),A,a,O));case 26:return e.abrupt("return",(function(){u.forEach((function(e){return window.cancelAnimationFrame(e.id)})),a.clear(a.DEPTH_BUFFER_BIT|a.COLOR_BUFFER_BIT|a.STENCIL_BUFFER_BIT)}));case 27:case"end":return e.stop()}}),e)}))),xt.apply(this,arguments)}function Et(e,t,n,r){return 1===t.stimulusCycle.intensities[t.counter]?mt(n,{element:t.element,coordBuffer:t.coordBuffers.lightTexCoordBuffer,texCoordLoc:t.textures.texCoordLocation,texture:t.textures.lightTexture}):mt(n,{element:t.element,coordBuffer:t.coordBuffers.darkTexCoordBuffer,texCoordLoc:t.textures.texCoordLocation,texture:t.textures.darkTexture}),t.counter<t.stimulusCycle.maxFrames-1?t.counter++:t.counter=0,r.id=window.requestAnimationFrame((function(e){Et(e,t,n,r)})),r}var Nt=Object.freeze({__proto__:null,start:function(){return xt.apply(this,arguments)},animate:Et});function _t(e){var t=function(e,t){if("object"!=u(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==u(t)?t:t+""}function Tt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_t(r.key),r)}}function At(e,t,n){return t&&Tt(e.prototype,t),n&&Tt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ot(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rt(e,t){if(t&&("object"==u(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function St(e){return St=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},St(e)}function Lt(e,t){return Lt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Lt(e,t)}function Ct(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&&Lt(e,t)}function Ft(e,t,n){return(t=_t(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Mt=At((function e(t){var r=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"periodic",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;Ot(this,e),Ft(this,"refreshRate",null),Ft(this,"elements",new Map),Ft(this,"samples",10),Ft(this,"active",!1),Ft(this,"start",n(s.mark((function e(){var t,n=arguments;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>0&&void 0!==n[0]?n[0]:Array.from(r.elements.values()),Array.isArray(t)||(t=t instanceof HTMLElement?[t]:Array.from(t)),r.active){e.next=7;break}return r.onstart(),e.next=6,Ve(10,r.samples);case 6:r.refreshRate=e.sent;case 7:t.forEach((function(e,t){var n=e instanceof HTMLElement?e:e.element;e=r.set(n),r.animate(e)})),r.active=!0;case 9:case"end":return e.stop()}}),e)})))),Ft(this,"set",(function(e){var t,n,i,o,s=null!==(t=Array.from(r.elements.values()).find((function(t){return t.element===e})))&&void 0!==t?t:{};return s.element=e,s.id=null!==(n=s.id)&&void 0!==n?n:Math.floor(1e6*Math.random()),s.frequency=Number(null!==(i=e.getAttribute("data-frequency"))&&void 0!==i?i:"0"),s.light=e.getAttribute("data-light-color"),s.dark=e.getAttribute("data-dark-color"),s.phaseShift=Number(null!==(o=e.getAttribute("data-phase-shift"))&&void 0!==o?o:"0"),r.elements.set(s.id,s),s})),Ft(this,"delete",(function(e){Array.from(r.elements).find((function(t,n){if(t[1].element===e)return r.ondelete(t[1]),r.elements.delete(t[0])}))||r.ondelete({element:e})})),Ft(this,"stop",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Array.from(r.elements.values()).map((function(e){return e.element}));Array.isArray(e)||(e=e instanceof HTMLElement?[e]:Array.from(e)),r.elements.forEach((function(t){e.includes(t.element)&&r.ondelete(t)})),e.length===r.elements.size&&(r.onstop(),r.active=!1)})),Ft(this,"reset",(function(){r.stop(),r.elements.forEach((function(e){return r.delete(e.element)}))})),Ft(this,"onstart",(function(){})),Ft(this,"ondelete",(function(){})),Ft(this,"onstop",(function(){})),Ft(this,"calculateRefreshRate",Ve),this.technique=t[i],this.samples=o}));function Pt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Pt=function(){return!!e})()}var Bt=function(e){function t(){var e,n,r,i,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"periodic",s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return Ot(this,t),n=this,i=[{approximation:Je,periodic:Ke},o,s],r=St(r=t),Ft(e=Rt(n,Pt()?Reflect.construct(r,i||[],St(n).constructor):r.apply(n,i)),"style",document.createElement("style")),Ft(e,"onstart",(function(){e.style.type="text/css",document.head.appendChild(e.style)})),Ft(e,"ondelete",(function(e){e.element.style.animation="",e.element.style.visibility="",e.element.style.backgroundColor=""})),Ft(e,"onstop",(function(){e.style.remove()})),Ft(e,"animate",(function(t){var n,r;if(t.light){var i,o=t.light.split(","),s=o.slice(0,3).map((function(e){return 255*(null!=e?e:1)}));t.element.style.backgroundColor="rgba(".concat(s,",").concat(null!==(i=null==o?void 0:o[3])&&void 0!==i?i:1,")")}t.element.style.visibility="visible";var u=e.technique.getAnimationInfo(t,e.refreshRate,t.id),a=String(u.duration).concat("s ",u.name,u.type);e.style.sheet.insertRule(u.rule,null!==(n=null===(r=e.style.cssRules)||void 0===r?void 0:r.length)&&void 0!==n?n:0),t.element.style.animation=a})),e}return Ct(t,e),At(t)}(Mt);function kt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(kt=function(){return!!e})()}var It=function(e){function t(){var e,n,r,i,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"periodic",s=arguments.length>1?arguments[1]:void 0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return Ot(this,t),n=this,i=[{approximation:gt,periodic:yt},o,u],r=St(r=t),Ft(e=Rt(n,kt()?Reflect.construct(r,i||[],St(n).constructor):r.apply(n,i)),"gl",null),Ft(e,"texCoordLocation",null),Ft(e,"canvas",null),Ft(e,"onstart",(function(){e.gl=e.canvas.getContext("webgl",{powerPreference:"high-performance",alpha:!1});var t=ft(e.gl,st,ut),n=e.gl.getAttribLocation(t,"a_position");e.texCoordLocation=e.gl.getAttribLocation(t,"a_texCoord");var r=dt(e.gl);e.gl.useProgram(t),e.gl.enableVertexAttribArray(n),e.gl.bindBuffer(e.gl.ARRAY_BUFFER,r),e.gl.vertexAttribPointer(n,2,e.gl.FLOAT,!1,0,0)})),Ft(e,"ondelete",(function(e){window.cancelAnimationFrame(e.animationId),e.animate=null})),Ft(e,"onstop",(function(){e.gl.clear(e.gl.DEPTH_BUFFER_BIT|e.gl.COLOR_BUFFER_BIT|e.gl.STENCIL_BUFFER_BIT)})),Ft(e,"getElementInfo",(function(t){var n,r;t.dark=null!==(n=t.element.getAttribute("data-dark-color"))&&void 0!==n?n:"0,0,0,1",t.light=null!==(r=t.element.getAttribute("data-light-color"))&&void 0!==r?r:"1,1,1,1";var i=lt(t.dark.split(",").map(Number),t.light.split(",").map(Number)),o=e.technique.calculateStimuliIntensities(t,e.refreshRate),s=dt(e.gl),u=pt(e.gl,i.darkOffScreenCanvas),a=dt(e.gl),c=pt(e.gl,i.lightOffScreenCanvas);return{element:t.element,stimulusCycle:{intensities:o,maxFrames:o.length},textures:{darkTexture:u,lightTexture:c,texCoordLocation:e.texCoordLocation},coordBuffers:{darkTexCoordBuffer:s,lightTexCoordBuffer:a},counter:0}})),Ft(e,"animate",(function(t){var n=e.getElementInfo(t);t.animate=function(){1===n.stimulusCycle.intensities[n.counter]?mt(e.gl,{element:n.element,coordBuffer:n.coordBuffers.lightTexCoordBuffer,texCoordLoc:n.textures.texCoordLocation,texture:n.textures.lightTexture}):mt(e.gl,{element:n.element,coordBuffer:n.coordBuffers.darkTexCoordBuffer,texCoordLoc:n.textures.texCoordLocation,texture:n.textures.darkTexture}),n.counter<n.stimulusCycle.maxFrames-1?n.counter++:n.counter=0,t.animationId=window.requestAnimationFrame((function(e){return t.animate()}))},t.animate()})),e.canvas=s,e}return Ct(t,e),At(t)}(Mt);e.CSS=Bt,e.WebGL=It,e.calculateRefreshRate=Ve,e.css=tt,e.webgl=Nt,Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -16,3 +16,3 @@ import { __awaiter } from "tslib";

refreshRates.unshift(refreshRate);
if (refreshRates.length == samples.length) {
if (refreshRates.length == samples) {
cancelAnimationFrame(id);

@@ -84,2 +84,2 @@ resolve(refreshRates);

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbW1vbi5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsT0FBTyxPQUFPLE1BQU0sd0JBQXdCLENBQUM7QUFFN0MsTUFBTSxDQUFDLE1BQU0sK0JBQStCLEdBQUcsU0FBUyxDQUFDLEVBQUUsQ0FBQyxDQUFDLEdBQUcsU0FBUyxDQUFDO0FBRzFFLG1FQUFtRTtBQUNuRSxNQUFNLENBQUMsTUFBTSxzQkFBc0IsR0FBRyxZQUFzQyxFQUFFLG1EQUFqQyxVQUFVLEdBQUcsRUFBRSxFQUFFLE9BQU8sR0FBRyxFQUFFO0lBRXhFLElBQUksT0FBTyxHQUFHLEVBQUU7UUFBRSxPQUFPLEdBQUcsRUFBRSxDQUFBLENBQUMsc0JBQXNCO0lBRXJELElBQUksYUFBYSxHQUFHLEVBQUUsRUFBRSxZQUFZLEdBQUcsRUFBRSxDQUFDO0lBRTFDLE9BQU8sSUFBSSxPQUFPLENBQUMsT0FBTyxDQUFDLEVBQUU7UUFFM0IsTUFBTSxHQUFHLEdBQUcsQ0FBQyxHQUFHLEVBQUUsRUFBRTtZQUNsQixhQUFhLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsd0dBQXdHO1lBRXBJLElBQUksYUFBYSxDQUFDLE1BQU0sR0FBRyxVQUFVLEVBQUUsQ0FBQyxDQUFDLCtDQUErQztnQkFFdEYsSUFBSSxTQUFTLEdBQUcsYUFBYSxDQUFDLEdBQUcsRUFBRSxDQUFDO2dCQUNwQyxJQUFJLFdBQVcsR0FBRyxJQUFJLEdBQUcsVUFBVSxHQUFHLENBQUMsR0FBRyxHQUFHLFNBQVMsQ0FBQyxDQUFDO2dCQUN4RCxZQUFZLENBQUMsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFDO2dCQUVsQyxJQUFJLFlBQVksQ0FBQyxNQUFNLElBQUksT0FBTyxDQUFDLE1BQU0sRUFBRSxDQUFDO29CQUMxQyxvQkFBb0IsQ0FBQyxFQUFFLENBQUMsQ0FBQztvQkFDekIsT0FBTyxDQUFDLFlBQVksQ0FBQyxDQUFBO29CQUNyQixPQUFPO2dCQUNULENBQUM7WUFDSCxDQUFDO1lBRUQsSUFBSSxFQUFFLEdBQUcsTUFBTSxDQUFDLHFCQUFxQixDQUFDLEdBQUcsQ0FBQyxDQUFDO1FBQzdDLENBQUMsQ0FBQTtRQUVELElBQUksRUFBRSxHQUFHLE1BQU0sQ0FBQyxxQkFBcUIsQ0FBQyxHQUFHLENBQUMsQ0FBQztJQUM3QyxDQUFDLENBQUMsQ0FBQTtBQUVKLENBQUMsQ0FBQSxDQUFDO0FBRUYsTUFBTSxDQUFDLE1BQU0sb0JBQW9CLEdBQUcsWUFBc0MsRUFBRSxtREFBakMsVUFBVSxHQUFHLEVBQUUsRUFBRSxPQUFPLEdBQUcsRUFBRTtJQUV0RSxNQUFNLFlBQVksR0FBRyxNQUFNLHNCQUFzQixDQUFDLFVBQVUsRUFBRSxPQUFPLENBQUMsQ0FBQTtJQUV0RSxJQUFJLGdCQUFnQixHQUFHLEVBQUUsRUFBRSxRQUFRLEdBQUcsRUFBRSxDQUFDO0lBRXpDLEtBQUssSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxZQUFZLENBQUMsTUFBTSxFQUFFLENBQUMsRUFBRSxFQUFFLENBQUM7UUFFN0MsSUFBSSxDQUFDLGdCQUFnQixDQUFDLFlBQVksQ0FBQyxDQUFDLENBQUMsQ0FBQztZQUNwQyxnQkFBZ0IsQ0FBQyxZQUFZLENBQUMsQ0FBQyxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUM7UUFFeEMsZ0JBQWdCLENBQUMsWUFBWSxDQUFDLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxDQUFDO0lBQ3pDLENBQUM7SUFFRCxRQUFRLEdBQUcsTUFBTSxDQUFDLElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxNQUFNLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFDLENBQUMsSUFBSSxJQUFJLENBQUMsR0FBRyxDQUFDLEtBQUssQ0FBQyxJQUFJLEVBQUUsTUFBTSxDQUFDLE1BQU0sQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLDZCQUE2QjtJQUU3SyxJQUFJLFFBQVEsQ0FBQyxNQUFNLEdBQUcsQ0FBQztRQUFFLFFBQVEsR0FBRyxDQUFDLFFBQVEsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLEdBQUcsUUFBUSxDQUFDLE1BQU0sQ0FBQyxDQUFDO0lBRXpGLE1BQU0sR0FBRyxHQUFHLE1BQU0sQ0FBQyxRQUFRLENBQUMsS0FBSyxFQUFFLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUE7SUFDL0MsT0FBTyxHQUFHLENBQUE7QUFDWixDQUFDLENBQUEsQ0FBQTtBQUdELGlFQUFpRTtBQUNqRSxNQUFNLENBQUMsTUFBTSxNQUFNLEdBQUcsSUFBSSxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsS0FBSyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO0FBRTdELE1BQU0sVUFBVSxhQUFhLENBQUMsaUJBQWlCO0lBQzdDLElBQUksSUFBSSxDQUFDLEtBQUssQ0FBQyxpQkFBaUIsQ0FBQyxLQUFLLE1BQU0sQ0FBQyxpQkFBaUIsQ0FBQztRQUM3RCxPQUFPLENBQUMsQ0FBQztJQUVYLElBQUksaUJBQWlCLEdBQUcsaUJBQWlCLENBQUMsUUFBUSxFQUFFLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLE1BQU0sQ0FBQztJQUUxRSxJQUFJLGlCQUFpQixHQUFHLENBQUM7UUFDdkIsT0FBTyxpQkFBaUIsQ0FBQztJQUUzQixNQUFNLDJEQUEyRCxDQUFBO0FBQ25FLENBQUM7QUFFRCxNQUFNLFVBQVUsd0JBQXdCLENBQUMsaUJBQWlCO0lBQ3hELElBQUksVUFBVSxHQUFHLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxFQUFFLGFBQWEsQ0FBQyxpQkFBaUIsQ0FBQyxDQUFDLENBQUM7SUFFaEUsS0FBSyxJQUFJLFFBQVEsR0FBRyxDQUFDLEVBQUUsUUFBUSxJQUFJLFVBQVUsRUFBRSxRQUFRLElBQUksQ0FBQyxFQUFFLENBQUM7UUFFN0QsSUFBSSxVQUFVLEdBQUcsSUFBSSxPQUFPLENBQUMsUUFBUSxDQUFDLENBQUMsS0FBSyxDQUFDLGlCQUFpQixDQUFDLENBQUM7UUFFaEUsSUFBSSxVQUFVLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLFFBQVEsRUFBRSxLQUFLLENBQUM7WUFDcEMsT0FBTyxRQUFRLENBQUM7SUFDcEIsQ0FBQztJQUVELE1BQU0scURBQXFELENBQUM7QUFDOUQsQ0FBQztBQUVELE1BQU0sVUFBVSxPQUFPLENBQUMsQ0FBQyxFQUFFLENBQUM7SUFDMUIsSUFBSSxRQUFRLEdBQUcsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUV4QixJQUFJLFdBQVcsR0FBRyxJQUFJLE9BQU8sQ0FBQyxRQUFRLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFFbkQsSUFBSSxDQUFDLFFBQVEsQ0FBQyxLQUFLLENBQUMsV0FBVyxDQUFDLENBQUMsQ0FBQyxHQUFHLENBQUMsV0FBVyxDQUFDLENBQUMsR0FBRyxFQUFFLENBQUMsUUFBUSxFQUFFLEdBQUcsTUFBTSxDQUFDLE9BQU8sRUFBRSxDQUFDO1FBQ3JGLE9BQU8sSUFBSSxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFDeEIsQ0FBQztTQUNJLENBQUM7UUFDSixJQUFJLENBQUMsR0FBRyxRQUFRLENBQUMsS0FBSyxFQUFFLENBQUM7UUFDekIsSUFBSSxJQUFJLEdBQUcsQ0FBQyxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUV0QixJQUFJLEtBQUssR0FBRyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxRQUFRLEVBQUUsQ0FBQyxDQUFDO1FBQ3BDLElBQUksTUFBTSxHQUFHLENBQUMsQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUM7UUFFM0IsSUFBSSxDQUFDLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUM7WUFDdEMsSUFBSSxJQUFJLENBQUMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxRQUFRLEVBQUUsQ0FBQyxJQUFJLEtBQUs7Z0JBQ3ZDLE1BQU0sR0FBRyxNQUFNLENBQUMsR0FBRyxFQUFFLENBQUMsS0FBSyxDQUFDLEtBQUssQ0FBQyxDQUFDO1FBQ3ZDLENBQUM7UUFFRCxPQUFPLE1BQU0sQ0FBQztJQUNoQixDQUFDO0FBQ0gsQ0FBQztBQUVELE1BQU0sVUFBVSxrQkFBa0IsQ0FBQyxXQUFXO0lBQzVDLE1BQU0sU0FBUyxHQUFHLElBQUksT0FBTyxDQUFDLEVBQUUsQ0FBQyxFQUMvQixVQUFVLEdBQUcsTUFBTSxDQUFDLEtBQUssQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUM7SUFFaEQsSUFBSSxZQUFZLEdBQUcsT0FBTyxDQUFDLFdBQVcsRUFBRSxNQUFNLENBQUMsQ0FBQztJQUVoRCxPQUFPLENBQUMsR0FBRyxDQUFDLFlBQVksQ0FBQyxRQUFRLEVBQUUsR0FBRyxVQUFVLENBQUMsUUFBUSxFQUFFLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDO0FBQzNFLENBQUMifQ==
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbW1vbi5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsT0FBTyxPQUFPLE1BQU0sd0JBQXdCLENBQUM7QUFFN0MsTUFBTSxDQUFDLE1BQU0sK0JBQStCLEdBQUcsU0FBUyxDQUFDLEVBQUUsQ0FBQyxDQUFDLEdBQUcsU0FBUyxDQUFDO0FBRzFFLG1FQUFtRTtBQUNuRSxNQUFNLENBQUMsTUFBTSxzQkFBc0IsR0FBRyxZQUFzQyxFQUFFLG1EQUFqQyxVQUFVLEdBQUcsRUFBRSxFQUFFLE9BQU8sR0FBRyxFQUFFO0lBRXhFLElBQUksT0FBTyxHQUFHLEVBQUU7UUFBRSxPQUFPLEdBQUcsRUFBRSxDQUFBLENBQUMsc0JBQXNCO0lBRXJELElBQUksYUFBYSxHQUFHLEVBQUUsRUFBRSxZQUFZLEdBQUcsRUFBRSxDQUFDO0lBRTFDLE9BQU8sSUFBSSxPQUFPLENBQUMsT0FBTyxDQUFDLEVBQUU7UUFFM0IsTUFBTSxHQUFHLEdBQUcsQ0FBQyxHQUFHLEVBQUUsRUFBRTtZQUNsQixhQUFhLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsd0dBQXdHO1lBRXBJLElBQUksYUFBYSxDQUFDLE1BQU0sR0FBRyxVQUFVLEVBQUUsQ0FBQyxDQUFDLCtDQUErQztnQkFFdEYsSUFBSSxTQUFTLEdBQUcsYUFBYSxDQUFDLEdBQUcsRUFBRSxDQUFDO2dCQUNwQyxJQUFJLFdBQVcsR0FBRyxJQUFJLEdBQUcsVUFBVSxHQUFHLENBQUMsR0FBRyxHQUFHLFNBQVMsQ0FBQyxDQUFDO2dCQUN4RCxZQUFZLENBQUMsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFDO2dCQUVsQyxJQUFJLFlBQVksQ0FBQyxNQUFNLElBQUksT0FBTyxFQUFFLENBQUM7b0JBQ25DLG9CQUFvQixDQUFDLEVBQUUsQ0FBQyxDQUFDO29CQUN6QixPQUFPLENBQUMsWUFBWSxDQUFDLENBQUE7b0JBQ3JCLE9BQU87Z0JBQ1QsQ0FBQztZQUNILENBQUM7WUFFRCxJQUFJLEVBQUUsR0FBRyxNQUFNLENBQUMscUJBQXFCLENBQUMsR0FBRyxDQUFDLENBQUM7UUFDN0MsQ0FBQyxDQUFBO1FBRUQsSUFBSSxFQUFFLEdBQUcsTUFBTSxDQUFDLHFCQUFxQixDQUFDLEdBQUcsQ0FBQyxDQUFDO0lBQzdDLENBQUMsQ0FBQyxDQUFBO0FBRUosQ0FBQyxDQUFBLENBQUM7QUFFRixNQUFNLENBQUMsTUFBTSxvQkFBb0IsR0FBRyxZQUFzQyxFQUFFLG1EQUFqQyxVQUFVLEdBQUcsRUFBRSxFQUFFLE9BQU8sR0FBRyxFQUFFO0lBRXRFLE1BQU0sWUFBWSxHQUFHLE1BQU0sc0JBQXNCLENBQUMsVUFBVSxFQUFFLE9BQU8sQ0FBQyxDQUFBO0lBRXRFLElBQUksZ0JBQWdCLEdBQUcsRUFBRSxFQUFFLFFBQVEsR0FBRyxFQUFFLENBQUM7SUFFekMsS0FBSyxJQUFJLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxHQUFHLFlBQVksQ0FBQyxNQUFNLEVBQUUsQ0FBQyxFQUFFLEVBQUUsQ0FBQztRQUU3QyxJQUFJLENBQUMsZ0JBQWdCLENBQUMsWUFBWSxDQUFDLENBQUMsQ0FBQyxDQUFDO1lBQ3BDLGdCQUFnQixDQUFDLFlBQVksQ0FBQyxDQUFDLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQztRQUV4QyxnQkFBZ0IsQ0FBQyxZQUFZLENBQUMsQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLENBQUM7SUFDekMsQ0FBQztJQUVELFFBQVEsR0FBRyxNQUFNLENBQUMsSUFBSSxDQUFDLGdCQUFnQixDQUFDLENBQUMsR0FBRyxDQUFDLE1BQU0sQ0FBQyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDLGdCQUFnQixDQUFDLENBQUMsQ0FBQyxJQUFJLElBQUksQ0FBQyxHQUFHLENBQUMsS0FBSyxDQUFDLElBQUksRUFBRSxNQUFNLENBQUMsTUFBTSxDQUFDLGdCQUFnQixDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsNkJBQTZCO0lBRTdLLElBQUksUUFBUSxDQUFDLE1BQU0sR0FBRyxDQUFDO1FBQUUsUUFBUSxHQUFHLENBQUMsUUFBUSxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDLEVBQUUsRUFBRSxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsR0FBRyxRQUFRLENBQUMsTUFBTSxDQUFDLENBQUM7SUFFekYsTUFBTSxHQUFHLEdBQUcsTUFBTSxDQUFDLFFBQVEsQ0FBQyxLQUFLLEVBQUUsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQTtJQUMvQyxPQUFPLEdBQUcsQ0FBQTtBQUNaLENBQUMsQ0FBQSxDQUFBO0FBR0QsaUVBQWlFO0FBQ2pFLE1BQU0sQ0FBQyxNQUFNLE1BQU0sR0FBRyxJQUFJLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7QUFFN0QsTUFBTSxVQUFVLGFBQWEsQ0FBQyxpQkFBaUI7SUFDN0MsSUFBSSxJQUFJLENBQUMsS0FBSyxDQUFDLGlCQUFpQixDQUFDLEtBQUssTUFBTSxDQUFDLGlCQUFpQixDQUFDO1FBQzdELE9BQU8sQ0FBQyxDQUFDO0lBRVgsSUFBSSxpQkFBaUIsR0FBRyxpQkFBaUIsQ0FBQyxRQUFRLEVBQUUsQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsTUFBTSxDQUFDO0lBRTFFLElBQUksaUJBQWlCLEdBQUcsQ0FBQztRQUN2QixPQUFPLGlCQUFpQixDQUFDO0lBRTNCLE1BQU0sMkRBQTJELENBQUE7QUFDbkUsQ0FBQztBQUVELE1BQU0sVUFBVSx3QkFBd0IsQ0FBQyxpQkFBaUI7SUFDeEQsSUFBSSxVQUFVLEdBQUcsSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLEVBQUUsYUFBYSxDQUFDLGlCQUFpQixDQUFDLENBQUMsQ0FBQztJQUVoRSxLQUFLLElBQUksUUFBUSxHQUFHLENBQUMsRUFBRSxRQUFRLElBQUksVUFBVSxFQUFFLFFBQVEsSUFBSSxDQUFDLEVBQUUsQ0FBQztRQUU3RCxJQUFJLFVBQVUsR0FBRyxJQUFJLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQyxLQUFLLENBQUMsaUJBQWlCLENBQUMsQ0FBQztRQUVoRSxJQUFJLFVBQVUsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMsUUFBUSxFQUFFLEtBQUssQ0FBQztZQUNwQyxPQUFPLFFBQVEsQ0FBQztJQUNwQixDQUFDO0lBRUQsTUFBTSxxREFBcUQsQ0FBQztBQUM5RCxDQUFDO0FBRUQsTUFBTSxVQUFVLE9BQU8sQ0FBQyxDQUFDLEVBQUUsQ0FBQztJQUMxQixJQUFJLFFBQVEsR0FBRyxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBRXhCLElBQUksV0FBVyxHQUFHLElBQUksT0FBTyxDQUFDLFFBQVEsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUVuRCxJQUFJLENBQUMsUUFBUSxDQUFDLEtBQUssQ0FBQyxXQUFXLENBQUMsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxXQUFXLENBQUMsQ0FBQyxHQUFHLEVBQUUsQ0FBQyxRQUFRLEVBQUUsR0FBRyxNQUFNLENBQUMsT0FBTyxFQUFFLENBQUM7UUFDckYsT0FBTyxJQUFJLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUN4QixDQUFDO1NBQ0ksQ0FBQztRQUNKLElBQUksQ0FBQyxHQUFHLFFBQVEsQ0FBQyxLQUFLLEVBQUUsQ0FBQztRQUN6QixJQUFJLElBQUksR0FBRyxDQUFDLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBRXRCLElBQUksS0FBSyxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLFFBQVEsRUFBRSxDQUFDLENBQUM7UUFDcEMsSUFBSSxNQUFNLEdBQUcsQ0FBQyxDQUFDLEtBQUssQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUUzQixJQUFJLENBQUMsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQztZQUN0QyxJQUFJLElBQUksQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLFFBQVEsRUFBRSxDQUFDLElBQUksS0FBSztnQkFDdkMsTUFBTSxHQUFHLE1BQU0sQ0FBQyxHQUFHLEVBQUUsQ0FBQyxLQUFLLENBQUMsS0FBSyxDQUFDLENBQUM7UUFDdkMsQ0FBQztRQUVELE9BQU8sTUFBTSxDQUFDO0lBQ2hCLENBQUM7QUFDSCxDQUFDO0FBRUQsTUFBTSxVQUFVLGtCQUFrQixDQUFDLFdBQVc7SUFDNUMsTUFBTSxTQUFTLEdBQUcsSUFBSSxPQUFPLENBQUMsRUFBRSxDQUFDLEVBQy9CLFVBQVUsR0FBRyxNQUFNLENBQUMsS0FBSyxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQztJQUVoRCxJQUFJLFlBQVksR0FBRyxPQUFPLENBQUMsV0FBVyxFQUFFLE1BQU0sQ0FBQyxDQUFDO0lBRWhELE9BQU8sQ0FBQyxHQUFHLENBQUMsWUFBWSxDQUFDLFFBQVEsRUFBRSxHQUFHLFVBQVUsQ0FBQyxRQUFRLEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUM7QUFDM0UsQ0FBQyJ9
{
"name": "ssvep-stimuli",
"version": "0.1.1",
"version": "0.1.2",
"description": "A library for generating SSVEP stimuli on the browser",

@@ -41,2 +41,2 @@ "main": "dist/index.js",

}
}
}

@@ -36,9 +36,9 @@ # SSVEP Stimuli-Generator Libraries

// ----------- CSS Methods -----------
const manager = new stimuli.CSS('periodic', elements)
// const manager = new stimuli.CSS('approximation', elements)
const manager = new stimuli.CSS('periodic', elements.length)
// const manager = new stimuli.CSS('approximation', elements.length)
// ----------- WebGL Methods -----------
// const canvas = document.body.querySelector('canvas')
// const manager = new stimuli.WebGL('periodic', elements, canvas)
// const manager = new stimuli.WebGL('approximation', elements, canvas)
// const manager = new stimuli.WebGL('periodic', elements.length, canvas)
// const manager = new stimuli.WebGL('approximation', elements.length, canvas)

@@ -45,0 +45,0 @@ elements.forEach(el => manager.set(el)) // Add Elements

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc