@guihz/trading-vue-editor-tes 0.0.141 → 0.0.143

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,14 +1,14 @@
1
- var UC=Object.defineProperty;var WC=(ye,tt,Nt)=>tt in ye?UC(ye,tt,{enumerable:!0,configurable:!0,writable:!0,value:Nt}):ye[tt]=Nt;var U=(ye,tt,Nt)=>(WC(ye,typeof tt!="symbol"?tt+"":tt,Nt),Nt),_l=(ye,tt,Nt)=>{if(!tt.has(ye))throw TypeError("Cannot "+Nt)};var on=(ye,tt,Nt)=>(_l(ye,tt,"read from private field"),Nt?Nt.call(ye):tt.get(ye)),vl=(ye,tt,Nt)=>{if(tt.has(ye))throw TypeError("Cannot add the same private member more than once");tt instanceof WeakSet?tt.add(ye):tt.set(ye,Nt)},Aa=(ye,tt,Nt,Qn)=>(_l(ye,tt,"write to private field"),Qn?Qn.call(ye,Nt):tt.set(ye,Nt),Nt);var gl=(ye,tt,Nt)=>(_l(ye,tt,"access private method"),Nt);(function(){"use strict";var gs,ml,Pi,rr;var ye=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function tt(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Nt(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var n=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return s[r]}})}),t}var Qn={exports:{}};/**
1
+ var UA=Object.defineProperty;var WA=(ye,tt,Nt)=>tt in ye?UA(ye,tt,{enumerable:!0,configurable:!0,writable:!0,value:Nt}):ye[tt]=Nt;var q=(ye,tt,Nt)=>(WA(ye,typeof tt!="symbol"?tt+"":tt,Nt),Nt),_l=(ye,tt,Nt)=>{if(!tt.has(ye))throw TypeError("Cannot "+Nt)};var on=(ye,tt,Nt)=>(_l(ye,tt,"read from private field"),Nt?Nt.call(ye):tt.get(ye)),vl=(ye,tt,Nt)=>{if(tt.has(ye))throw TypeError("Cannot add the same private member more than once");tt instanceof WeakSet?tt.add(ye):tt.set(ye,Nt)},Ca=(ye,tt,Nt,Qn)=>(_l(ye,tt,"write to private field"),Qn?Qn.call(ye,Nt):tt.set(ye,Nt),Nt);var gl=(ye,tt,Nt)=>(_l(ye,tt,"access private method"),Nt);(function(){"use strict";var gs,ml,Pi,rr;var ye=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function tt(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Nt(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var n=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return s[r]}})}),t}var Qn={exports:{}};/**
2
2
  * @license
3
3
  * Lodash <https://lodash.com/>
4
4
  * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
5
5
  * Released under MIT license <https://lodash.com/license>
6
6
  * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
7
7
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
8
- */Qn.exports,function(s,e){(function(){var t,r="4.17.21",n=200,i="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",u="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",c=500,h="__lodash_placeholder__",d=1,p=2,v=4,x=1,_=2,y=1,m=2,w=4,D=8,A=16,E=32,F=64,B=128,M=256,O=512,C=30,N="...",I=800,L=16,k=1,z=2,R=3,V=1/0,H=9007199254740991,ee=17976931348623157e292,te=NaN,j=4294967295,X=j-1,Y=j>>>1,Q=[["ary",B],["bind",y],["bindKey",m],["curry",D],["curryRight",A],["flip",O],["partial",E],["partialRight",F],["rearg",M]],pe="[object Arguments]",De="[object Array]",we="[object AsyncFunction]",Ee="[object Boolean]",Oe="[object Date]",Fe="[object DOMException]",nt="[object Error]",Ye="[object Function]",Ie="[object GeneratorFunction]",Le="[object Map]",yt="[object Number]",Wt="[object Null]",At="[object Object]",lr="[object Promise]",Rr="[object Proxy]",cr="[object RegExp]",Dt="[object Set]",It="[object String]",P="[object Symbol]",Z="[object Undefined]",J="[object WeakMap]",ie="[object WeakSet]",ue="[object ArrayBuffer]",se="[object DataView]",_e="[object Float32Array]",he="[object Float64Array]",de="[object Int8Array]",fe="[object Int16Array]",Xe="[object Int32Array]",et="[object Uint8Array]",dt="[object Uint8ClampedArray]",zt="[object Uint16Array]",Tt="[object Uint32Array]",nr=/\b__p \+= '';/g,fr=/\b(__p \+=) '' \+/g,en=/(__e\(.*?\)|\b__t\)) \+\n'';/g,wn=/&(?:amp|lt|gt|quot|#39);/g,li=/[&<>"']/g,ms=RegExp(wn.source),xs=RegExp(li.source),ys=/<%-([\s\S]+?)%>/g,ki=/<%([\s\S]+?)%>/g,zi=/<%=([\s\S]+?)%>/g,Ds=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,qi=/^\w*$/,ws=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,qn=/[\\^$.*+?()[\]{}|]/g,Qt=RegExp(qn.source),mr=/^\s+/,Ui=/\s/,Es=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Yu=/\{\n\/\* \[wrapped with (.+)\] \*/,Ku=/,? & /,Zu=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Vu=/[()=,{}\[\]\/\s]/,Gu=/\\(\\)?/g,Xu=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ro=/\w*$/,Qu=/^[-+]0x[0-9a-f]+$/i,Ju=/^0b[01]+$/i,e0=/^\[object .+?Constructor\]$/,t0=/^0o[0-7]+$/i,r0=/^(?:0|[1-9]\d*)$/,n0=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Wi=/($^)/,ci=/['\n\r\u2028\u2029\\]/g,Qe="\\ud800-\\udfff",ir="\\u0300-\\u036f",i0="\\ufe20-\\ufe2f",Hi="\\u20d0-\\u20ff",Un=ir+i0+Hi,Po="\\u2700-\\u27bf",qh="a-z\\xdf-\\xf6\\xf8-\\xff",Pw="\\xac\\xb1\\xd7\\xf7",kw="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",zw="\\u2000-\\u206f",qw=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Uh="A-Z\\xc0-\\xd6\\xd8-\\xde",Wh="\\ufe0e\\ufe0f",Hh=Pw+kw+zw+qw,s0="['’]",Uw="["+Qe+"]",jh="["+Hh+"]",ko="["+Un+"]",Yh="\\d+",Ww="["+Po+"]",Kh="["+qh+"]",Zh="[^"+Qe+Hh+Yh+Po+qh+Uh+"]",o0="\\ud83c[\\udffb-\\udfff]",Hw="(?:"+ko+"|"+o0+")",Vh="[^"+Qe+"]",a0="(?:\\ud83c[\\udde6-\\uddff]){2}",u0="[\\ud800-\\udbff][\\udc00-\\udfff]",ji="["+Uh+"]",Gh="\\u200d",Xh="(?:"+Kh+"|"+Zh+")",jw="(?:"+ji+"|"+Zh+")",Qh="(?:"+s0+"(?:d|ll|m|re|s|t|ve))?",Jh="(?:"+s0+"(?:D|LL|M|RE|S|T|VE))?",ed=Hw+"?",td="["+Wh+"]?",Yw="(?:"+Gh+"(?:"+[Vh,a0,u0].join("|")+")"+td+ed+")*",Kw="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Zw="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",rd=td+ed+Yw,Vw="(?:"+[Ww,a0,u0].join("|")+")"+rd,Gw="(?:"+[Vh+ko+"?",ko,a0,u0,Uw].join("|")+")",Xw=RegExp(s0,"g"),Qw=RegExp(ko,"g"),l0=RegExp(o0+"(?="+o0+")|"+Gw+rd,"g"),Jw=RegExp([ji+"?"+Kh+"+"+Qh+"(?="+[jh,ji,"$"].join("|")+")",jw+"+"+Jh+"(?="+[jh,ji+Xh,"$"].join("|")+")",ji+"?"+Xh+"+"+Qh,ji+"+"+Jh,Zw,Kw,Yh,Vw].join("|"),"g"),e2=RegExp("["+Gh+Qe+Un+Wh+"]"),t2=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,r2=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],n2=-1,wt={};wt[_e]=wt[he]=wt[de]=wt[fe]=wt[Xe]=wt[et]=wt[dt]=wt[zt]=wt[Tt]=!0,wt[pe]=wt[De]=wt[ue]=wt[Ee]=wt[se]=wt[Oe]=wt[nt]=wt[Ye]=wt[Le]=wt[yt]=wt[At]=wt[cr]=wt[Dt]=wt[It]=wt[J]=!1;var vt={};vt[pe]=vt[De]=vt[ue]=vt[se]=vt[Ee]=vt[Oe]=vt[_e]=vt[he]=vt[de]=vt[fe]=vt[Xe]=vt[Le]=vt[yt]=vt[At]=vt[cr]=vt[Dt]=vt[It]=vt[P]=vt[et]=vt[dt]=vt[zt]=vt[Tt]=!0,vt[nt]=vt[Ye]=vt[J]=!1;var i2={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},s2={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},o2={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},a2={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},u2=parseFloat,l2=parseInt,nd=typeof ye=="object"&&ye&&ye.Object===Object&&ye,c2=typeof self=="object"&&self&&self.Object===Object&&self,Jt=nd||c2||Function("return this")(),c0=e&&!e.nodeType&&e,fi=c0&&!0&&s&&!s.nodeType&&s,id=fi&&fi.exports===c0,f0=id&&nd.process,Pr=function(){try{var K=fi&&fi.require&&fi.require("util").types;return K||f0&&f0.binding&&f0.binding("util")}catch{}}(),sd=Pr&&Pr.isArrayBuffer,od=Pr&&Pr.isDate,ad=Pr&&Pr.isMap,ud=Pr&&Pr.isRegExp,ld=Pr&&Pr.isSet,cd=Pr&&Pr.isTypedArray;function Cr(K,ne,re){switch(re.length){case 0:return K.call(ne);case 1:return K.call(ne,re[0]);case 2:return K.call(ne,re[0],re[1]);case 3:return K.call(ne,re[0],re[1],re[2])}return K.apply(ne,re)}function f2(K,ne,re,be){for(var Re=-1,st=K==null?0:K.length;++Re<st;){var Ht=K[Re];ne(be,Ht,re(Ht),K)}return be}function kr(K,ne){for(var re=-1,be=K==null?0:K.length;++re<be&&ne(K[re],re,K)!==!1;);return K}function h2(K,ne){for(var re=K==null?0:K.length;re--&&ne(K[re],re,K)!==!1;);return K}function fd(K,ne){for(var re=-1,be=K==null?0:K.length;++re<be;)if(!ne(K[re],re,K))return!1;return!0}function Wn(K,ne){for(var re=-1,be=K==null?0:K.length,Re=0,st=[];++re<be;){var Ht=K[re];ne(Ht,re,K)&&(st[Re++]=Ht)}return st}function zo(K,ne){var re=K==null?0:K.length;return!!re&&Yi(K,ne,0)>-1}function h0(K,ne,re){for(var be=-1,Re=K==null?0:K.length;++be<Re;)if(re(ne,K[be]))return!0;return!1}function Ct(K,ne){for(var re=-1,be=K==null?0:K.length,Re=Array(be);++re<be;)Re[re]=ne(K[re],re,K);return Re}function Hn(K,ne){for(var re=-1,be=ne.length,Re=K.length;++re<be;)K[Re+re]=ne[re];return K}function d0(K,ne,re,be){var Re=-1,st=K==null?0:K.length;for(be&&st&&(re=K[++Re]);++Re<st;)re=ne(re,K[Re],Re,K);return re}function d2(K,ne,re,be){var Re=K==null?0:K.length;for(be&&Re&&(re=K[--Re]);Re--;)re=ne(re,K[Re],Re,K);return re}function p0(K,ne){for(var re=-1,be=K==null?0:K.length;++re<be;)if(ne(K[re],re,K))return!0;return!1}var p2=_0("length");function _2(K){return K.split("")}function v2(K){return K.match(Zu)||[]}function hd(K,ne,re){var be;return re(K,function(Re,st,Ht){if(ne(Re,st,Ht))return be=st,!1}),be}function qo(K,ne,re,be){for(var Re=K.length,st=re+(be?1:-1);be?st--:++st<Re;)if(ne(K[st],st,K))return st;return-1}function Yi(K,ne,re){return ne===ne?B2(K,ne,re):qo(K,dd,re)}function g2(K,ne,re,be){for(var Re=re-1,st=K.length;++Re<st;)if(be(K[Re],ne))return Re;return-1}function dd(K){return K!==K}function pd(K,ne){var re=K==null?0:K.length;return re?g0(K,ne)/re:te}function _0(K){return function(ne){return ne==null?t:ne[K]}}function v0(K){return function(ne){return K==null?t:K[ne]}}function _d(K,ne,re,be,Re){return Re(K,function(st,Ht,pt){re=be?(be=!1,st):ne(re,st,Ht,pt)}),re}function m2(K,ne){var re=K.length;for(K.sort(ne);re--;)K[re]=K[re].value;return K}function g0(K,ne){for(var re,be=-1,Re=K.length;++be<Re;){var st=ne(K[be]);st!==t&&(re=re===t?st:re+st)}return re}function m0(K,ne){for(var re=-1,be=Array(K);++re<K;)be[re]=ne(re);return be}function x2(K,ne){return Ct(ne,function(re){return[re,K[re]]})}function vd(K){return K&&K.slice(0,yd(K)+1).replace(mr,"")}function Fr(K){return function(ne){return K(ne)}}function x0(K,ne){return Ct(ne,function(re){return K[re]})}function bs(K,ne){return K.has(ne)}function gd(K,ne){for(var re=-1,be=K.length;++re<be&&Yi(ne,K[re],0)>-1;);return re}function md(K,ne){for(var re=K.length;re--&&Yi(ne,K[re],0)>-1;);return re}function y2(K,ne){for(var re=K.length,be=0;re--;)K[re]===ne&&++be;return be}var D2=v0(i2),w2=v0(s2);function E2(K){return"\\"+a2[K]}function b2(K,ne){return K==null?t:K[ne]}function Ki(K){return e2.test(K)}function A2(K){return t2.test(K)}function C2(K){for(var ne,re=[];!(ne=K.next()).done;)re.push(ne.value);return re}function y0(K){var ne=-1,re=Array(K.size);return K.forEach(function(be,Re){re[++ne]=[Re,be]}),re}function xd(K,ne){return function(re){return K(ne(re))}}function jn(K,ne){for(var re=-1,be=K.length,Re=0,st=[];++re<be;){var Ht=K[re];(Ht===ne||Ht===h)&&(K[re]=h,st[Re++]=re)}return st}function Uo(K){var ne=-1,re=Array(K.size);return K.forEach(function(be){re[++ne]=be}),re}function F2(K){var ne=-1,re=Array(K.size);return K.forEach(function(be){re[++ne]=[be,be]}),re}function B2(K,ne,re){for(var be=re-1,Re=K.length;++be<Re;)if(K[be]===ne)return be;return-1}function M2(K,ne,re){for(var be=re+1;be--;)if(K[be]===ne)return be;return be}function Zi(K){return Ki(K)?S2(K):p2(K)}function tn(K){return Ki(K)?O2(K):_2(K)}function yd(K){for(var ne=K.length;ne--&&Ui.test(K.charAt(ne)););return ne}var N2=v0(o2);function S2(K){for(var ne=l0.lastIndex=0;l0.test(K);)++ne;return ne}function O2(K){return K.match(l0)||[]}function I2(K){return K.match(Jw)||[]}var T2=function K(ne){ne=ne==null?Jt:Vi.defaults(Jt.Object(),ne,Vi.pick(Jt,r2));var re=ne.Array,be=ne.Date,Re=ne.Error,st=ne.Function,Ht=ne.Math,pt=ne.Object,D0=ne.RegExp,$2=ne.String,zr=ne.TypeError,Wo=re.prototype,L2=st.prototype,Gi=pt.prototype,Ho=ne["__core-js_shared__"],jo=L2.toString,lt=Gi.hasOwnProperty,R2=0,Dd=function(){var o=/[^.]+$/.exec(Ho&&Ho.keys&&Ho.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}(),Yo=Gi.toString,P2=jo.call(pt),k2=Jt._,z2=D0("^"+jo.call(lt).replace(qn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ko=id?ne.Buffer:t,Yn=ne.Symbol,Zo=ne.Uint8Array,wd=Ko?Ko.allocUnsafe:t,Vo=xd(pt.getPrototypeOf,pt),Ed=pt.create,bd=Gi.propertyIsEnumerable,Go=Wo.splice,Ad=Yn?Yn.isConcatSpreadable:t,As=Yn?Yn.iterator:t,hi=Yn?Yn.toStringTag:t,Xo=function(){try{var o=gi(pt,"defineProperty");return o({},"",{}),o}catch{}}(),q2=ne.clearTimeout!==Jt.clearTimeout&&ne.clearTimeout,U2=be&&be.now!==Jt.Date.now&&be.now,W2=ne.setTimeout!==Jt.setTimeout&&ne.setTimeout,Qo=Ht.ceil,Jo=Ht.floor,w0=pt.getOwnPropertySymbols,H2=Ko?Ko.isBuffer:t,Cd=ne.isFinite,j2=Wo.join,Y2=xd(pt.keys,pt),jt=Ht.max,sr=Ht.min,K2=be.now,Z2=ne.parseInt,Fd=Ht.random,V2=Wo.reverse,E0=gi(ne,"DataView"),Cs=gi(ne,"Map"),b0=gi(ne,"Promise"),Xi=gi(ne,"Set"),Fs=gi(ne,"WeakMap"),Bs=gi(pt,"create"),ea=Fs&&new Fs,Qi={},G2=mi(E0),X2=mi(Cs),Q2=mi(b0),J2=mi(Xi),eE=mi(Fs),ta=Yn?Yn.prototype:t,Ms=ta?ta.valueOf:t,Bd=ta?ta.toString:t;function T(o){if(St(o)&&!Pe(o)&&!(o instanceof Ke)){if(o instanceof qr)return o;if(lt.call(o,"__wrapped__"))return Mp(o)}return new qr(o)}var Ji=function(){function o(){}return function(l){if(!Mt(l))return{};if(Ed)return Ed(l);o.prototype=l;var g=new o;return o.prototype=t,g}}();function ra(){}function qr(o,l){this.__wrapped__=o,this.__actions__=[],this.__chain__=!!l,this.__index__=0,this.__values__=t}T.templateSettings={escape:ys,evaluate:ki,interpolate:zi,variable:"",imports:{_:T}},T.prototype=ra.prototype,T.prototype.constructor=T,qr.prototype=Ji(ra.prototype),qr.prototype.constructor=qr;function Ke(o){this.__wrapped__=o,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=j,this.__views__=[]}function tE(){var o=new Ke(this.__wrapped__);return o.__actions__=xr(this.__actions__),o.__dir__=this.__dir__,o.__filtered__=this.__filtered__,o.__iteratees__=xr(this.__iteratees__),o.__takeCount__=this.__takeCount__,o.__views__=xr(this.__views__),o}function rE(){if(this.__filtered__){var o=new Ke(this);o.__dir__=-1,o.__filtered__=!0}else o=this.clone(),o.__dir__*=-1;return o}function nE(){var o=this.__wrapped__.value(),l=this.__dir__,g=Pe(o),b=l<0,S=g?o.length:0,$=_b(0,S,this.__views__),q=$.start,W=$.end,G=W-q,oe=b?W:q-1,ae=this.__iteratees__,ce=ae.length,ge=0,Ae=sr(G,this.__takeCount__);if(!g||!b&&S==G&&Ae==G)return Qd(o,this.__actions__);var Ne=[];e:for(;G--&&ge<Ae;){oe+=l;for(var qe=-1,Se=o[oe];++qe<ce;){var He=ae[qe],Ge=He.iteratee,Nr=He.type,pr=Ge(Se);if(Nr==z)Se=pr;else if(!pr){if(Nr==k)continue e;break e}}Ne[ge++]=Se}return Ne}Ke.prototype=Ji(ra.prototype),Ke.prototype.constructor=Ke;function di(o){var l=-1,g=o==null?0:o.length;for(this.clear();++l<g;){var b=o[l];this.set(b[0],b[1])}}function iE(){this.__data__=Bs?Bs(null):{},this.size=0}function sE(o){var l=this.has(o)&&delete this.__data__[o];return this.size-=l?1:0,l}function oE(o){var l=this.__data__;if(Bs){var g=l[o];return g===f?t:g}return lt.call(l,o)?l[o]:t}function aE(o){var l=this.__data__;return Bs?l[o]!==t:lt.call(l,o)}function uE(o,l){var g=this.__data__;return this.size+=this.has(o)?0:1,g[o]=Bs&&l===t?f:l,this}di.prototype.clear=iE,di.prototype.delete=sE,di.prototype.get=oE,di.prototype.has=aE,di.prototype.set=uE;function En(o){var l=-1,g=o==null?0:o.length;for(this.clear();++l<g;){var b=o[l];this.set(b[0],b[1])}}function lE(){this.__data__=[],this.size=0}function cE(o){var l=this.__data__,g=na(l,o);if(g<0)return!1;var b=l.length-1;return g==b?l.pop():Go.call(l,g,1),--this.size,!0}function fE(o){var l=this.__data__,g=na(l,o);return g<0?t:l[g][1]}function hE(o){return na(this.__data__,o)>-1}function dE(o,l){var g=this.__data__,b=na(g,o);return b<0?(++this.size,g.push([o,l])):g[b][1]=l,this}En.prototype.clear=lE,En.prototype.delete=cE,En.prototype.get=fE,En.prototype.has=hE,En.prototype.set=dE;function bn(o){var l=-1,g=o==null?0:o.length;for(this.clear();++l<g;){var b=o[l];this.set(b[0],b[1])}}function pE(){this.size=0,this.__data__={hash:new di,map:new(Cs||En),string:new di}}function _E(o){var l=_a(this,o).delete(o);return this.size-=l?1:0,l}function vE(o){return _a(this,o).get(o)}function gE(o){return _a(this,o).has(o)}function mE(o,l){var g=_a(this,o),b=g.size;return g.set(o,l),this.size+=g.size==b?0:1,this}bn.prototype.clear=pE,bn.prototype.delete=_E,bn.prototype.get=vE,bn.prototype.has=gE,bn.prototype.set=mE;function pi(o){var l=-1,g=o==null?0:o.length;for(this.__data__=new bn;++l<g;)this.add(o[l])}function xE(o){return this.__data__.set(o,f),this}function yE(o){return this.__data__.has(o)}pi.prototype.add=pi.prototype.push=xE,pi.prototype.has=yE;function rn(o){var l=this.__data__=new En(o);this.size=l.size}function DE(){this.__data__=new En,this.size=0}function wE(o){var l=this.__data__,g=l.delete(o);return this.size=l.size,g}function EE(o){return this.__data__.get(o)}function bE(o){return this.__data__.has(o)}function AE(o,l){var g=this.__data__;if(g instanceof En){var b=g.__data__;if(!Cs||b.length<n-1)return b.push([o,l]),this.size=++g.size,this;g=this.__data__=new bn(b)}return g.set(o,l),this.size=g.size,this}rn.prototype.clear=DE,rn.prototype.delete=wE,rn.prototype.get=EE,rn.prototype.has=bE,rn.prototype.set=AE;function Md(o,l){var g=Pe(o),b=!g&&xi(o),S=!g&&!b&&Xn(o),$=!g&&!b&&!S&&ns(o),q=g||b||S||$,W=q?m0(o.length,$2):[],G=W.length;for(var oe in o)(l||lt.call(o,oe))&&!(q&&(oe=="length"||S&&(oe=="offset"||oe=="parent")||$&&(oe=="buffer"||oe=="byteLength"||oe=="byteOffset")||Bn(oe,G)))&&W.push(oe);return W}function Nd(o){var l=o.length;return l?o[$0(0,l-1)]:t}function CE(o,l){return va(xr(o),_i(l,0,o.length))}function FE(o){return va(xr(o))}function A0(o,l,g){(g!==t&&!nn(o[l],g)||g===t&&!(l in o))&&An(o,l,g)}function Ns(o,l,g){var b=o[l];(!(lt.call(o,l)&&nn(b,g))||g===t&&!(l in o))&&An(o,l,g)}function na(o,l){for(var g=o.length;g--;)if(nn(o[g][0],l))return g;return-1}function BE(o,l,g,b){return Kn(o,function(S,$,q){l(b,S,g(S),q)}),b}function Sd(o,l){return o&&hn(l,Kt(l),o)}function ME(o,l){return o&&hn(l,Dr(l),o)}function An(o,l,g){l=="__proto__"&&Xo?Xo(o,l,{configurable:!0,enumerable:!0,value:g,writable:!0}):o[l]=g}function C0(o,l){for(var g=-1,b=l.length,S=re(b),$=o==null;++g<b;)S[g]=$?t:ol(o,l[g]);return S}function _i(o,l,g){return o===o&&(g!==t&&(o=o<=g?o:g),l!==t&&(o=o>=l?o:l)),o}function Ur(o,l,g,b,S,$){var q,W=l&d,G=l&p,oe=l&v;if(g&&(q=S?g(o,b,S,$):g(o)),q!==t)return q;if(!Mt(o))return o;var ae=Pe(o);if(ae){if(q=gb(o),!W)return xr(o,q)}else{var ce=or(o),ge=ce==Ye||ce==Ie;if(Xn(o))return tp(o,W);if(ce==At||ce==pe||ge&&!S){if(q=G||ge?{}:yp(o),!W)return G?ob(o,ME(q,o)):sb(o,Sd(q,o))}else{if(!vt[ce])return S?o:{};q=mb(o,ce,W)}}$||($=new rn);var Ae=$.get(o);if(Ae)return Ae;$.set(o,q),Vp(o)?o.forEach(function(Se){q.add(Ur(Se,l,g,Se,o,$))}):Kp(o)&&o.forEach(function(Se,He){q.set(He,Ur(Se,l,g,He,o,$))});var Ne=oe?G?Y0:j0:G?Dr:Kt,qe=ae?t:Ne(o);return kr(qe||o,function(Se,He){qe&&(He=Se,Se=o[He]),Ns(q,He,Ur(Se,l,g,He,o,$))}),q}function NE(o){var l=Kt(o);return function(g){return Od(g,o,l)}}function Od(o,l,g){var b=g.length;if(o==null)return!b;for(o=pt(o);b--;){var S=g[b],$=l[S],q=o[S];if(q===t&&!(S in o)||!$(q))return!1}return!0}function Id(o,l,g){if(typeof o!="function")throw new zr(a);return Rs(function(){o.apply(t,g)},l)}function Ss(o,l,g,b){var S=-1,$=zo,q=!0,W=o.length,G=[],oe=l.length;if(!W)return G;g&&(l=Ct(l,Fr(g))),b?($=h0,q=!1):l.length>=n&&($=bs,q=!1,l=new pi(l));e:for(;++S<W;){var ae=o[S],ce=g==null?ae:g(ae);if(ae=b||ae!==0?ae:0,q&&ce===ce){for(var ge=oe;ge--;)if(l[ge]===ce)continue e;G.push(ae)}else $(l,ce,b)||G.push(ae)}return G}var Kn=op(fn),Td=op(B0,!0);function SE(o,l){var g=!0;return Kn(o,function(b,S,$){return g=!!l(b,S,$),g}),g}function ia(o,l,g){for(var b=-1,S=o.length;++b<S;){var $=o[b],q=l($);if(q!=null&&(W===t?q===q&&!Mr(q):g(q,W)))var W=q,G=$}return G}function OE(o,l,g,b){var S=o.length;for(g=ze(g),g<0&&(g=-g>S?0:S+g),b=b===t||b>S?S:ze(b),b<0&&(b+=S),b=g>b?0:Xp(b);g<b;)o[g++]=l;return o}function $d(o,l){var g=[];return Kn(o,function(b,S,$){l(b,S,$)&&g.push(b)}),g}function er(o,l,g,b,S){var $=-1,q=o.length;for(g||(g=yb),S||(S=[]);++$<q;){var W=o[$];l>0&&g(W)?l>1?er(W,l-1,g,b,S):Hn(S,W):b||(S[S.length]=W)}return S}var F0=ap(),Ld=ap(!0);function fn(o,l){return o&&F0(o,l,Kt)}function B0(o,l){return o&&Ld(o,l,Kt)}function sa(o,l){return Wn(l,function(g){return Mn(o[g])})}function vi(o,l){l=Vn(l,o);for(var g=0,b=l.length;o!=null&&g<b;)o=o[dn(l[g++])];return g&&g==b?o:t}function Rd(o,l,g){var b=l(o);return Pe(o)?b:Hn(b,g(o))}function hr(o){return o==null?o===t?Z:Wt:hi&&hi in pt(o)?pb(o):Fb(o)}function M0(o,l){return o>l}function IE(o,l){return o!=null&&lt.call(o,l)}function TE(o,l){return o!=null&&l in pt(o)}function $E(o,l,g){return o>=sr(l,g)&&o<jt(l,g)}function N0(o,l,g){for(var b=g?h0:zo,S=o[0].length,$=o.length,q=$,W=re($),G=1/0,oe=[];q--;){var ae=o[q];q&&l&&(ae=Ct(ae,Fr(l))),G=sr(ae.length,G),W[q]=!g&&(l||S>=120&&ae.length>=120)?new pi(q&&ae):t}ae=o[0];var ce=-1,ge=W[0];e:for(;++ce<S&&oe.length<G;){var Ae=ae[ce],Ne=l?l(Ae):Ae;if(Ae=g||Ae!==0?Ae:0,!(ge?bs(ge,Ne):b(oe,Ne,g))){for(q=$;--q;){var qe=W[q];if(!(qe?bs(qe,Ne):b(o[q],Ne,g)))continue e}ge&&ge.push(Ne),oe.push(Ae)}}return oe}function LE(o,l,g,b){return fn(o,function(S,$,q){l(b,g(S),$,q)}),b}function Os(o,l,g){l=Vn(l,o),o=bp(o,l);var b=o==null?o:o[dn(Hr(l))];return b==null?t:Cr(b,o,g)}function Pd(o){return St(o)&&hr(o)==pe}function RE(o){return St(o)&&hr(o)==ue}function PE(o){return St(o)&&hr(o)==Oe}function Is(o,l,g,b,S){return o===l?!0:o==null||l==null||!St(o)&&!St(l)?o!==o&&l!==l:kE(o,l,g,b,Is,S)}function kE(o,l,g,b,S,$){var q=Pe(o),W=Pe(l),G=q?De:or(o),oe=W?De:or(l);G=G==pe?At:G,oe=oe==pe?At:oe;var ae=G==At,ce=oe==At,ge=G==oe;if(ge&&Xn(o)){if(!Xn(l))return!1;q=!0,ae=!1}if(ge&&!ae)return $||($=new rn),q||ns(o)?gp(o,l,g,b,S,$):hb(o,l,G,g,b,S,$);if(!(g&x)){var Ae=ae&&lt.call(o,"__wrapped__"),Ne=ce&&lt.call(l,"__wrapped__");if(Ae||Ne){var qe=Ae?o.value():o,Se=Ne?l.value():l;return $||($=new rn),S(qe,Se,g,b,$)}}return ge?($||($=new rn),db(o,l,g,b,S,$)):!1}function zE(o){return St(o)&&or(o)==Le}function S0(o,l,g,b){var S=g.length,$=S,q=!b;if(o==null)return!$;for(o=pt(o);S--;){var W=g[S];if(q&&W[2]?W[1]!==o[W[0]]:!(W[0]in o))return!1}for(;++S<$;){W=g[S];var G=W[0],oe=o[G],ae=W[1];if(q&&W[2]){if(oe===t&&!(G in o))return!1}else{var ce=new rn;if(b)var ge=b(oe,ae,G,o,l,ce);if(!(ge===t?Is(ae,oe,x|_,b,ce):ge))return!1}}return!0}function kd(o){if(!Mt(o)||wb(o))return!1;var l=Mn(o)?z2:e0;return l.test(mi(o))}function qE(o){return St(o)&&hr(o)==cr}function UE(o){return St(o)&&or(o)==Dt}function WE(o){return St(o)&&wa(o.length)&&!!wt[hr(o)]}function zd(o){return typeof o=="function"?o:o==null?wr:typeof o=="object"?Pe(o)?Wd(o[0],o[1]):Ud(o):u1(o)}function O0(o){if(!Ls(o))return Y2(o);var l=[];for(var g in pt(o))lt.call(o,g)&&g!="constructor"&&l.push(g);return l}function HE(o){if(!Mt(o))return Cb(o);var l=Ls(o),g=[];for(var b in o)b=="constructor"&&(l||!lt.call(o,b))||g.push(b);return g}function I0(o,l){return o<l}function qd(o,l){var g=-1,b=yr(o)?re(o.length):[];return Kn(o,function(S,$,q){b[++g]=l(S,$,q)}),b}function Ud(o){var l=Z0(o);return l.length==1&&l[0][2]?wp(l[0][0],l[0][1]):function(g){return g===o||S0(g,o,l)}}function Wd(o,l){return G0(o)&&Dp(l)?wp(dn(o),l):function(g){var b=ol(g,o);return b===t&&b===l?al(g,o):Is(l,b,x|_)}}function oa(o,l,g,b,S){o!==l&&F0(l,function($,q){if(S||(S=new rn),Mt($))jE(o,l,q,g,oa,b,S);else{var W=b?b(Q0(o,q),$,q+"",o,l,S):t;W===t&&(W=$),A0(o,q,W)}},Dr)}function jE(o,l,g,b,S,$,q){var W=Q0(o,g),G=Q0(l,g),oe=q.get(G);if(oe){A0(o,g,oe);return}var ae=$?$(W,G,g+"",o,l,q):t,ce=ae===t;if(ce){var ge=Pe(G),Ae=!ge&&Xn(G),Ne=!ge&&!Ae&&ns(G);ae=G,ge||Ae||Ne?Pe(W)?ae=W:$t(W)?ae=xr(W):Ae?(ce=!1,ae=tp(G,!0)):Ne?(ce=!1,ae=rp(G,!0)):ae=[]:Ps(G)||xi(G)?(ae=W,xi(W)?ae=Qp(W):(!Mt(W)||Mn(W))&&(ae=yp(G))):ce=!1}ce&&(q.set(G,ae),S(ae,G,b,$,q),q.delete(G)),A0(o,g,ae)}function Hd(o,l){var g=o.length;if(g)return l+=l<0?g:0,Bn(l,g)?o[l]:t}function jd(o,l,g){l.length?l=Ct(l,function($){return Pe($)?function(q){return vi(q,$.length===1?$[0]:$)}:$}):l=[wr];var b=-1;l=Ct(l,Fr(Me()));var S=qd(o,function($,q,W){var G=Ct(l,function(oe){return oe($)});return{criteria:G,index:++b,value:$}});return m2(S,function($,q){return ib($,q,g)})}function YE(o,l){return Yd(o,l,function(g,b){return al(o,b)})}function Yd(o,l,g){for(var b=-1,S=l.length,$={};++b<S;){var q=l[b],W=vi(o,q);g(W,q)&&Ts($,Vn(q,o),W)}return $}function KE(o){return function(l){return vi(l,o)}}function T0(o,l,g,b){var S=b?g2:Yi,$=-1,q=l.length,W=o;for(o===l&&(l=xr(l)),g&&(W=Ct(o,Fr(g)));++$<q;)for(var G=0,oe=l[$],ae=g?g(oe):oe;(G=S(W,ae,G,b))>-1;)W!==o&&Go.call(W,G,1),Go.call(o,G,1);return o}function Kd(o,l){for(var g=o?l.length:0,b=g-1;g--;){var S=l[g];if(g==b||S!==$){var $=S;Bn(S)?Go.call(o,S,1):P0(o,S)}}return o}function $0(o,l){return o+Jo(Fd()*(l-o+1))}function ZE(o,l,g,b){for(var S=-1,$=jt(Qo((l-o)/(g||1)),0),q=re($);$--;)q[b?$:++S]=o,o+=g;return q}function L0(o,l){var g="";if(!o||l<1||l>H)return g;do l%2&&(g+=o),l=Jo(l/2),l&&(o+=o);while(l);return g}function Ue(o,l){return J0(Ep(o,l,wr),o+"")}function VE(o){return Nd(is(o))}function GE(o,l){var g=is(o);return va(g,_i(l,0,g.length))}function Ts(o,l,g,b){if(!Mt(o))return o;l=Vn(l,o);for(var S=-1,$=l.length,q=$-1,W=o;W!=null&&++S<$;){var G=dn(l[S]),oe=g;if(G==="__proto__"||G==="constructor"||G==="prototype")return o;if(S!=q){var ae=W[G];oe=b?b(ae,G,W):t,oe===t&&(oe=Mt(ae)?ae:Bn(l[S+1])?[]:{})}Ns(W,G,oe),W=W[G]}return o}var Zd=ea?function(o,l){return ea.set(o,l),o}:wr,XE=Xo?function(o,l){return Xo(o,"toString",{configurable:!0,enumerable:!1,value:ll(l),writable:!0})}:wr;function QE(o){return va(is(o))}function Wr(o,l,g){var b=-1,S=o.length;l<0&&(l=-l>S?0:S+l),g=g>S?S:g,g<0&&(g+=S),S=l>g?0:g-l>>>0,l>>>=0;for(var $=re(S);++b<S;)$[b]=o[b+l];return $}function JE(o,l){var g;return Kn(o,function(b,S,$){return g=l(b,S,$),!g}),!!g}function aa(o,l,g){var b=0,S=o==null?b:o.length;if(typeof l=="number"&&l===l&&S<=Y){for(;b<S;){var $=b+S>>>1,q=o[$];q!==null&&!Mr(q)&&(g?q<=l:q<l)?b=$+1:S=$}return S}return R0(o,l,wr,g)}function R0(o,l,g,b){var S=0,$=o==null?0:o.length;if($===0)return 0;l=g(l);for(var q=l!==l,W=l===null,G=Mr(l),oe=l===t;S<$;){var ae=Jo((S+$)/2),ce=g(o[ae]),ge=ce!==t,Ae=ce===null,Ne=ce===ce,qe=Mr(ce);if(q)var Se=b||Ne;else oe?Se=Ne&&(b||ge):W?Se=Ne&&ge&&(b||!Ae):G?Se=Ne&&ge&&!Ae&&(b||!qe):Ae||qe?Se=!1:Se=b?ce<=l:ce<l;Se?S=ae+1:$=ae}return sr($,X)}function Vd(o,l){for(var g=-1,b=o.length,S=0,$=[];++g<b;){var q=o[g],W=l?l(q):q;if(!g||!nn(W,G)){var G=W;$[S++]=q===0?0:q}}return $}function Gd(o){return typeof o=="number"?o:Mr(o)?te:+o}function Br(o){if(typeof o=="string")return o;if(Pe(o))return Ct(o,Br)+"";if(Mr(o))return Bd?Bd.call(o):"";var l=o+"";return l=="0"&&1/o==-V?"-0":l}function Zn(o,l,g){var b=-1,S=zo,$=o.length,q=!0,W=[],G=W;if(g)q=!1,S=h0;else if($>=n){var oe=l?null:cb(o);if(oe)return Uo(oe);q=!1,S=bs,G=new pi}else G=l?[]:W;e:for(;++b<$;){var ae=o[b],ce=l?l(ae):ae;if(ae=g||ae!==0?ae:0,q&&ce===ce){for(var ge=G.length;ge--;)if(G[ge]===ce)continue e;l&&G.push(ce),W.push(ae)}else S(G,ce,g)||(G!==W&&G.push(ce),W.push(ae))}return W}function P0(o,l){return l=Vn(l,o),o=bp(o,l),o==null||delete o[dn(Hr(l))]}function Xd(o,l,g,b){return Ts(o,l,g(vi(o,l)),b)}function ua(o,l,g,b){for(var S=o.length,$=b?S:-1;(b?$--:++$<S)&&l(o[$],$,o););return g?Wr(o,b?0:$,b?$+1:S):Wr(o,b?$+1:0,b?S:$)}function Qd(o,l){var g=o;return g instanceof Ke&&(g=g.value()),d0(l,function(b,S){return S.func.apply(S.thisArg,Hn([b],S.args))},g)}function k0(o,l,g){var b=o.length;if(b<2)return b?Zn(o[0]):[];for(var S=-1,$=re(b);++S<b;)for(var q=o[S],W=-1;++W<b;)W!=S&&($[S]=Ss($[S]||q,o[W],l,g));return Zn(er($,1),l,g)}function Jd(o,l,g){for(var b=-1,S=o.length,$=l.length,q={};++b<S;){var W=b<$?l[b]:t;g(q,o[b],W)}return q}function z0(o){return $t(o)?o:[]}function q0(o){return typeof o=="function"?o:wr}function Vn(o,l){return Pe(o)?o:G0(o,l)?[o]:Bp(at(o))}var eb=Ue;function Gn(o,l,g){var b=o.length;return g=g===t?b:g,!l&&g>=b?o:Wr(o,l,g)}var ep=q2||function(o){return Jt.clearTimeout(o)};function tp(o,l){if(l)return o.slice();var g=o.length,b=wd?wd(g):new o.constructor(g);return o.copy(b),b}function U0(o){var l=new o.constructor(o.byteLength);return new Zo(l).set(new Zo(o)),l}function tb(o,l){var g=l?U0(o.buffer):o.buffer;return new o.constructor(g,o.byteOffset,o.byteLength)}function rb(o){var l=new o.constructor(o.source,Ro.exec(o));return l.lastIndex=o.lastIndex,l}function nb(o){return Ms?pt(Ms.call(o)):{}}function rp(o,l){var g=l?U0(o.buffer):o.buffer;return new o.constructor(g,o.byteOffset,o.length)}function np(o,l){if(o!==l){var g=o!==t,b=o===null,S=o===o,$=Mr(o),q=l!==t,W=l===null,G=l===l,oe=Mr(l);if(!W&&!oe&&!$&&o>l||$&&q&&G&&!W&&!oe||b&&q&&G||!g&&G||!S)return 1;if(!b&&!$&&!oe&&o<l||oe&&g&&S&&!b&&!$||W&&g&&S||!q&&S||!G)return-1}return 0}function ib(o,l,g){for(var b=-1,S=o.criteria,$=l.criteria,q=S.length,W=g.length;++b<q;){var G=np(S[b],$[b]);if(G){if(b>=W)return G;var oe=g[b];return G*(oe=="desc"?-1:1)}}return o.index-l.index}function ip(o,l,g,b){for(var S=-1,$=o.length,q=g.length,W=-1,G=l.length,oe=jt($-q,0),ae=re(G+oe),ce=!b;++W<G;)ae[W]=l[W];for(;++S<q;)(ce||S<$)&&(ae[g[S]]=o[S]);for(;oe--;)ae[W++]=o[S++];return ae}function sp(o,l,g,b){for(var S=-1,$=o.length,q=-1,W=g.length,G=-1,oe=l.length,ae=jt($-W,0),ce=re(ae+oe),ge=!b;++S<ae;)ce[S]=o[S];for(var Ae=S;++G<oe;)ce[Ae+G]=l[G];for(;++q<W;)(ge||S<$)&&(ce[Ae+g[q]]=o[S++]);return ce}function xr(o,l){var g=-1,b=o.length;for(l||(l=re(b));++g<b;)l[g]=o[g];return l}function hn(o,l,g,b){var S=!g;g||(g={});for(var $=-1,q=l.length;++$<q;){var W=l[$],G=b?b(g[W],o[W],W,g,o):t;G===t&&(G=o[W]),S?An(g,W,G):Ns(g,W,G)}return g}function sb(o,l){return hn(o,V0(o),l)}function ob(o,l){return hn(o,mp(o),l)}function la(o,l){return function(g,b){var S=Pe(g)?f2:BE,$=l?l():{};return S(g,o,Me(b,2),$)}}function es(o){return Ue(function(l,g){var b=-1,S=g.length,$=S>1?g[S-1]:t,q=S>2?g[2]:t;for($=o.length>3&&typeof $=="function"?(S--,$):t,q&&dr(g[0],g[1],q)&&($=S<3?t:$,S=1),l=pt(l);++b<S;){var W=g[b];W&&o(l,W,b,$)}return l})}function op(o,l){return function(g,b){if(g==null)return g;if(!yr(g))return o(g,b);for(var S=g.length,$=l?S:-1,q=pt(g);(l?$--:++$<S)&&b(q[$],$,q)!==!1;);return g}}function ap(o){return function(l,g,b){for(var S=-1,$=pt(l),q=b(l),W=q.length;W--;){var G=q[o?W:++S];if(g($[G],G,$)===!1)break}return l}}function ab(o,l,g){var b=l&y,S=$s(o);function $(){var q=this&&this!==Jt&&this instanceof $?S:o;return q.apply(b?g:this,arguments)}return $}function up(o){return function(l){l=at(l);var g=Ki(l)?tn(l):t,b=g?g[0]:l.charAt(0),S=g?Gn(g,1).join(""):l.slice(1);return b[o]()+S}}function ts(o){return function(l){return d0(o1(s1(l).replace(Xw,"")),o,"")}}function $s(o){return function(){var l=arguments;switch(l.length){case 0:return new o;case 1:return new o(l[0]);case 2:return new o(l[0],l[1]);case 3:return new o(l[0],l[1],l[2]);case 4:return new o(l[0],l[1],l[2],l[3]);case 5:return new o(l[0],l[1],l[2],l[3],l[4]);case 6:return new o(l[0],l[1],l[2],l[3],l[4],l[5]);case 7:return new o(l[0],l[1],l[2],l[3],l[4],l[5],l[6])}var g=Ji(o.prototype),b=o.apply(g,l);return Mt(b)?b:g}}function ub(o,l,g){var b=$s(o);function S(){for(var $=arguments.length,q=re($),W=$,G=rs(S);W--;)q[W]=arguments[W];var oe=$<3&&q[0]!==G&&q[$-1]!==G?[]:jn(q,G);if($-=oe.length,$<g)return dp(o,l,ca,S.placeholder,t,q,oe,t,t,g-$);var ae=this&&this!==Jt&&this instanceof S?b:o;return Cr(ae,this,q)}return S}function lp(o){return function(l,g,b){var S=pt(l);if(!yr(l)){var $=Me(g,3);l=Kt(l),g=function(W){return $(S[W],W,S)}}var q=o(l,g,b);return q>-1?S[$?l[q]:q]:t}}function cp(o){return Fn(function(l){var g=l.length,b=g,S=qr.prototype.thru;for(o&&l.reverse();b--;){var $=l[b];if(typeof $!="function")throw new zr(a);if(S&&!q&&pa($)=="wrapper")var q=new qr([],!0)}for(b=q?b:g;++b<g;){$=l[b];var W=pa($),G=W=="wrapper"?K0($):t;G&&X0(G[0])&&G[1]==(B|D|E|M)&&!G[4].length&&G[9]==1?q=q[pa(G[0])].apply(q,G[3]):q=$.length==1&&X0($)?q[W]():q.thru($)}return function(){var oe=arguments,ae=oe[0];if(q&&oe.length==1&&Pe(ae))return q.plant(ae).value();for(var ce=0,ge=g?l[ce].apply(this,oe):ae;++ce<g;)ge=l[ce].call(this,ge);return ge}})}function ca(o,l,g,b,S,$,q,W,G,oe){var ae=l&B,ce=l&y,ge=l&m,Ae=l&(D|A),Ne=l&O,qe=ge?t:$s(o);function Se(){for(var He=arguments.length,Ge=re(He),Nr=He;Nr--;)Ge[Nr]=arguments[Nr];if(Ae)var pr=rs(Se),Sr=y2(Ge,pr);if(b&&(Ge=ip(Ge,b,S,Ae)),$&&(Ge=sp(Ge,$,q,Ae)),He-=Sr,Ae&&He<oe){var Lt=jn(Ge,pr);return dp(o,l,ca,Se.placeholder,g,Ge,Lt,W,G,oe-He)}var sn=ce?g:this,Sn=ge?sn[o]:o;return He=Ge.length,W?Ge=Bb(Ge,W):Ne&&He>1&&Ge.reverse(),ae&&G<He&&(Ge.length=G),this&&this!==Jt&&this instanceof Se&&(Sn=qe||$s(Sn)),Sn.apply(sn,Ge)}return Se}function fp(o,l){return function(g,b){return LE(g,o,l(b),{})}}function fa(o,l){return function(g,b){var S;if(g===t&&b===t)return l;if(g!==t&&(S=g),b!==t){if(S===t)return b;typeof g=="string"||typeof b=="string"?(g=Br(g),b=Br(b)):(g=Gd(g),b=Gd(b)),S=o(g,b)}return S}}function W0(o){return Fn(function(l){return l=Ct(l,Fr(Me())),Ue(function(g){var b=this;return o(l,function(S){return Cr(S,b,g)})})})}function ha(o,l){l=l===t?" ":Br(l);var g=l.length;if(g<2)return g?L0(l,o):l;var b=L0(l,Qo(o/Zi(l)));return Ki(l)?Gn(tn(b),0,o).join(""):b.slice(0,o)}function lb(o,l,g,b){var S=l&y,$=$s(o);function q(){for(var W=-1,G=arguments.length,oe=-1,ae=b.length,ce=re(ae+G),ge=this&&this!==Jt&&this instanceof q?$:o;++oe<ae;)ce[oe]=b[oe];for(;G--;)ce[oe++]=arguments[++W];return Cr(ge,S?g:this,ce)}return q}function hp(o){return function(l,g,b){return b&&typeof b!="number"&&dr(l,g,b)&&(g=b=t),l=Nn(l),g===t?(g=l,l=0):g=Nn(g),b=b===t?l<g?1:-1:Nn(b),ZE(l,g,b,o)}}function da(o){return function(l,g){return typeof l=="string"&&typeof g=="string"||(l=jr(l),g=jr(g)),o(l,g)}}function dp(o,l,g,b,S,$,q,W,G,oe){var ae=l&D,ce=ae?q:t,ge=ae?t:q,Ae=ae?$:t,Ne=ae?t:$;l|=ae?E:F,l&=~(ae?F:E),l&w||(l&=~(y|m));var qe=[o,l,S,Ae,ce,Ne,ge,W,G,oe],Se=g.apply(t,qe);return X0(o)&&Ap(Se,qe),Se.placeholder=b,Cp(Se,o,l)}function H0(o){var l=Ht[o];return function(g,b){if(g=jr(g),b=b==null?0:sr(ze(b),292),b&&Cd(g)){var S=(at(g)+"e").split("e"),$=l(S[0]+"e"+(+S[1]+b));return S=(at($)+"e").split("e"),+(S[0]+"e"+(+S[1]-b))}return l(g)}}var cb=Xi&&1/Uo(new Xi([,-0]))[1]==V?function(o){return new Xi(o)}:hl;function pp(o){return function(l){var g=or(l);return g==Le?y0(l):g==Dt?F2(l):x2(l,o(l))}}function Cn(o,l,g,b,S,$,q,W){var G=l&m;if(!G&&typeof o!="function")throw new zr(a);var oe=b?b.length:0;if(oe||(l&=~(E|F),b=S=t),q=q===t?q:jt(ze(q),0),W=W===t?W:ze(W),oe-=S?S.length:0,l&F){var ae=b,ce=S;b=S=t}var ge=G?t:K0(o),Ae=[o,l,g,b,S,ae,ce,$,q,W];if(ge&&Ab(Ae,ge),o=Ae[0],l=Ae[1],g=Ae[2],b=Ae[3],S=Ae[4],W=Ae[9]=Ae[9]===t?G?0:o.length:jt(Ae[9]-oe,0),!W&&l&(D|A)&&(l&=~(D|A)),!l||l==y)var Ne=ab(o,l,g);else l==D||l==A?Ne=ub(o,l,W):(l==E||l==(y|E))&&!S.length?Ne=lb(o,l,g,b):Ne=ca.apply(t,Ae);var qe=ge?Zd:Ap;return Cp(qe(Ne,Ae),o,l)}function _p(o,l,g,b){return o===t||nn(o,Gi[g])&&!lt.call(b,g)?l:o}function vp(o,l,g,b,S,$){return Mt(o)&&Mt(l)&&($.set(l,o),oa(o,l,t,vp,$),$.delete(l)),o}function fb(o){return Ps(o)?t:o}function gp(o,l,g,b,S,$){var q=g&x,W=o.length,G=l.length;if(W!=G&&!(q&&G>W))return!1;var oe=$.get(o),ae=$.get(l);if(oe&&ae)return oe==l&&ae==o;var ce=-1,ge=!0,Ae=g&_?new pi:t;for($.set(o,l),$.set(l,o);++ce<W;){var Ne=o[ce],qe=l[ce];if(b)var Se=q?b(qe,Ne,ce,l,o,$):b(Ne,qe,ce,o,l,$);if(Se!==t){if(Se)continue;ge=!1;break}if(Ae){if(!p0(l,function(He,Ge){if(!bs(Ae,Ge)&&(Ne===He||S(Ne,He,g,b,$)))return Ae.push(Ge)})){ge=!1;break}}else if(!(Ne===qe||S(Ne,qe,g,b,$))){ge=!1;break}}return $.delete(o),$.delete(l),ge}function hb(o,l,g,b,S,$,q){switch(g){case se:if(o.byteLength!=l.byteLength||o.byteOffset!=l.byteOffset)return!1;o=o.buffer,l=l.buffer;case ue:return!(o.byteLength!=l.byteLength||!$(new Zo(o),new Zo(l)));case Ee:case Oe:case yt:return nn(+o,+l);case nt:return o.name==l.name&&o.message==l.message;case cr:case It:return o==l+"";case Le:var W=y0;case Dt:var G=b&x;if(W||(W=Uo),o.size!=l.size&&!G)return!1;var oe=q.get(o);if(oe)return oe==l;b|=_,q.set(o,l);var ae=gp(W(o),W(l),b,S,$,q);return q.delete(o),ae;case P:if(Ms)return Ms.call(o)==Ms.call(l)}return!1}function db(o,l,g,b,S,$){var q=g&x,W=j0(o),G=W.length,oe=j0(l),ae=oe.length;if(G!=ae&&!q)return!1;for(var ce=G;ce--;){var ge=W[ce];if(!(q?ge in l:lt.call(l,ge)))return!1}var Ae=$.get(o),Ne=$.get(l);if(Ae&&Ne)return Ae==l&&Ne==o;var qe=!0;$.set(o,l),$.set(l,o);for(var Se=q;++ce<G;){ge=W[ce];var He=o[ge],Ge=l[ge];if(b)var Nr=q?b(Ge,He,ge,l,o,$):b(He,Ge,ge,o,l,$);if(!(Nr===t?He===Ge||S(He,Ge,g,b,$):Nr)){qe=!1;break}Se||(Se=ge=="constructor")}if(qe&&!Se){var pr=o.constructor,Sr=l.constructor;pr!=Sr&&"constructor"in o&&"constructor"in l&&!(typeof pr=="function"&&pr instanceof pr&&typeof Sr=="function"&&Sr instanceof Sr)&&(qe=!1)}return $.delete(o),$.delete(l),qe}function Fn(o){return J0(Ep(o,t,Op),o+"")}function j0(o){return Rd(o,Kt,V0)}function Y0(o){return Rd(o,Dr,mp)}var K0=ea?function(o){return ea.get(o)}:hl;function pa(o){for(var l=o.name+"",g=Qi[l],b=lt.call(Qi,l)?g.length:0;b--;){var S=g[b],$=S.func;if($==null||$==o)return S.name}return l}function rs(o){var l=lt.call(T,"placeholder")?T:o;return l.placeholder}function Me(){var o=T.iteratee||cl;return o=o===cl?zd:o,arguments.length?o(arguments[0],arguments[1]):o}function _a(o,l){var g=o.__data__;return Db(l)?g[typeof l=="string"?"string":"hash"]:g.map}function Z0(o){for(var l=Kt(o),g=l.length;g--;){var b=l[g],S=o[b];l[g]=[b,S,Dp(S)]}return l}function gi(o,l){var g=b2(o,l);return kd(g)?g:t}function pb(o){var l=lt.call(o,hi),g=o[hi];try{o[hi]=t;var b=!0}catch{}var S=Yo.call(o);return b&&(l?o[hi]=g:delete o[hi]),S}var V0=w0?function(o){return o==null?[]:(o=pt(o),Wn(w0(o),function(l){return bd.call(o,l)}))}:dl,mp=w0?function(o){for(var l=[];o;)Hn(l,V0(o)),o=Vo(o);return l}:dl,or=hr;(E0&&or(new E0(new ArrayBuffer(1)))!=se||Cs&&or(new Cs)!=Le||b0&&or(b0.resolve())!=lr||Xi&&or(new Xi)!=Dt||Fs&&or(new Fs)!=J)&&(or=function(o){var l=hr(o),g=l==At?o.constructor:t,b=g?mi(g):"";if(b)switch(b){case G2:return se;case X2:return Le;case Q2:return lr;case J2:return Dt;case eE:return J}return l});function _b(o,l,g){for(var b=-1,S=g.length;++b<S;){var $=g[b],q=$.size;switch($.type){case"drop":o+=q;break;case"dropRight":l-=q;break;case"take":l=sr(l,o+q);break;case"takeRight":o=jt(o,l-q);break}}return{start:o,end:l}}function vb(o){var l=o.match(Yu);return l?l[1].split(Ku):[]}function xp(o,l,g){l=Vn(l,o);for(var b=-1,S=l.length,$=!1;++b<S;){var q=dn(l[b]);if(!($=o!=null&&g(o,q)))break;o=o[q]}return $||++b!=S?$:(S=o==null?0:o.length,!!S&&wa(S)&&Bn(q,S)&&(Pe(o)||xi(o)))}function gb(o){var l=o.length,g=new o.constructor(l);return l&&typeof o[0]=="string"&&lt.call(o,"index")&&(g.index=o.index,g.input=o.input),g}function yp(o){return typeof o.constructor=="function"&&!Ls(o)?Ji(Vo(o)):{}}function mb(o,l,g){var b=o.constructor;switch(l){case ue:return U0(o);case Ee:case Oe:return new b(+o);case se:return tb(o,g);case _e:case he:case de:case fe:case Xe:case et:case dt:case zt:case Tt:return rp(o,g);case Le:return new b;case yt:case It:return new b(o);case cr:return rb(o);case Dt:return new b;case P:return nb(o)}}function xb(o,l){var g=l.length;if(!g)return o;var b=g-1;return l[b]=(g>1?"& ":"")+l[b],l=l.join(g>2?", ":" "),o.replace(Es,`{
8
+ */Qn.exports,function(s,e){(function(){var t,r="4.17.21",n=200,i="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",u="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",c=500,h="__lodash_placeholder__",d=1,p=2,v=4,x=1,_=2,y=1,m=2,w=4,D=8,C=16,b=32,F=64,B=128,M=256,O=512,A=30,N="...",I=800,L=16,k=1,z=2,R=3,V=1/0,H=9007199254740991,ee=17976931348623157e292,te=NaN,j=4294967295,X=j-1,Y=j>>>1,Q=[["ary",B],["bind",y],["bindKey",m],["curry",D],["curryRight",C],["flip",O],["partial",b],["partialRight",F],["rearg",M]],pe="[object Arguments]",De="[object Array]",we="[object AsyncFunction]",be="[object Boolean]",Oe="[object Date]",Fe="[object DOMException]",nt="[object Error]",Ye="[object Function]",Ie="[object GeneratorFunction]",Le="[object Map]",yt="[object Number]",Wt="[object Null]",Ct="[object Object]",lr="[object Promise]",Rr="[object Proxy]",cr="[object RegExp]",Dt="[object Set]",It="[object String]",P="[object Symbol]",Z="[object Undefined]",J="[object WeakMap]",ie="[object WeakSet]",ue="[object ArrayBuffer]",se="[object DataView]",_e="[object Float32Array]",he="[object Float64Array]",de="[object Int8Array]",fe="[object Int16Array]",Xe="[object Int32Array]",et="[object Uint8Array]",dt="[object Uint8ClampedArray]",zt="[object Uint16Array]",Tt="[object Uint32Array]",nr=/\b__p \+= '';/g,fr=/\b(__p \+=) '' \+/g,en=/(__e\(.*?\)|\b__t\)) \+\n'';/g,wn=/&(?:amp|lt|gt|quot|#39);/g,li=/[&<>"']/g,ms=RegExp(wn.source),xs=RegExp(li.source),ys=/<%-([\s\S]+?)%>/g,ki=/<%([\s\S]+?)%>/g,zi=/<%=([\s\S]+?)%>/g,Ds=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,qi=/^\w*$/,ws=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,qn=/[\\^$.*+?()[\]{}|]/g,Qt=RegExp(qn.source),mr=/^\s+/,Ui=/\s/,bs=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Yu=/\{\n\/\* \[wrapped with (.+)\] \*/,Ku=/,? & /,Zu=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Vu=/[()=,{}\[\]\/\s]/,Gu=/\\(\\)?/g,Xu=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ro=/\w*$/,Qu=/^[-+]0x[0-9a-f]+$/i,Ju=/^0b[01]+$/i,e0=/^\[object .+?Constructor\]$/,t0=/^0o[0-7]+$/i,r0=/^(?:0|[1-9]\d*)$/,n0=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Wi=/($^)/,ci=/['\n\r\u2028\u2029\\]/g,Qe="\\ud800-\\udfff",ir="\\u0300-\\u036f",i0="\\ufe20-\\ufe2f",Hi="\\u20d0-\\u20ff",Un=ir+i0+Hi,Po="\\u2700-\\u27bf",qh="a-z\\xdf-\\xf6\\xf8-\\xff",Pw="\\xac\\xb1\\xd7\\xf7",kw="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",zw="\\u2000-\\u206f",qw=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Uh="A-Z\\xc0-\\xd6\\xd8-\\xde",Wh="\\ufe0e\\ufe0f",Hh=Pw+kw+zw+qw,s0="['’]",Uw="["+Qe+"]",jh="["+Hh+"]",ko="["+Un+"]",Yh="\\d+",Ww="["+Po+"]",Kh="["+qh+"]",Zh="[^"+Qe+Hh+Yh+Po+qh+Uh+"]",o0="\\ud83c[\\udffb-\\udfff]",Hw="(?:"+ko+"|"+o0+")",Vh="[^"+Qe+"]",a0="(?:\\ud83c[\\udde6-\\uddff]){2}",u0="[\\ud800-\\udbff][\\udc00-\\udfff]",ji="["+Uh+"]",Gh="\\u200d",Xh="(?:"+Kh+"|"+Zh+")",jw="(?:"+ji+"|"+Zh+")",Qh="(?:"+s0+"(?:d|ll|m|re|s|t|ve))?",Jh="(?:"+s0+"(?:D|LL|M|RE|S|T|VE))?",ed=Hw+"?",td="["+Wh+"]?",Yw="(?:"+Gh+"(?:"+[Vh,a0,u0].join("|")+")"+td+ed+")*",Kw="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Zw="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",rd=td+ed+Yw,Vw="(?:"+[Ww,a0,u0].join("|")+")"+rd,Gw="(?:"+[Vh+ko+"?",ko,a0,u0,Uw].join("|")+")",Xw=RegExp(s0,"g"),Qw=RegExp(ko,"g"),l0=RegExp(o0+"(?="+o0+")|"+Gw+rd,"g"),Jw=RegExp([ji+"?"+Kh+"+"+Qh+"(?="+[jh,ji,"$"].join("|")+")",jw+"+"+Jh+"(?="+[jh,ji+Xh,"$"].join("|")+")",ji+"?"+Xh+"+"+Qh,ji+"+"+Jh,Zw,Kw,Yh,Vw].join("|"),"g"),e2=RegExp("["+Gh+Qe+Un+Wh+"]"),t2=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,r2=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],n2=-1,wt={};wt[_e]=wt[he]=wt[de]=wt[fe]=wt[Xe]=wt[et]=wt[dt]=wt[zt]=wt[Tt]=!0,wt[pe]=wt[De]=wt[ue]=wt[be]=wt[se]=wt[Oe]=wt[nt]=wt[Ye]=wt[Le]=wt[yt]=wt[Ct]=wt[cr]=wt[Dt]=wt[It]=wt[J]=!1;var vt={};vt[pe]=vt[De]=vt[ue]=vt[se]=vt[be]=vt[Oe]=vt[_e]=vt[he]=vt[de]=vt[fe]=vt[Xe]=vt[Le]=vt[yt]=vt[Ct]=vt[cr]=vt[Dt]=vt[It]=vt[P]=vt[et]=vt[dt]=vt[zt]=vt[Tt]=!0,vt[nt]=vt[Ye]=vt[J]=!1;var i2={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},s2={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},o2={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},a2={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},u2=parseFloat,l2=parseInt,nd=typeof ye=="object"&&ye&&ye.Object===Object&&ye,c2=typeof self=="object"&&self&&self.Object===Object&&self,Jt=nd||c2||Function("return this")(),c0=e&&!e.nodeType&&e,fi=c0&&!0&&s&&!s.nodeType&&s,id=fi&&fi.exports===c0,f0=id&&nd.process,Pr=function(){try{var K=fi&&fi.require&&fi.require("util").types;return K||f0&&f0.binding&&f0.binding("util")}catch{}}(),sd=Pr&&Pr.isArrayBuffer,od=Pr&&Pr.isDate,ad=Pr&&Pr.isMap,ud=Pr&&Pr.isRegExp,ld=Pr&&Pr.isSet,cd=Pr&&Pr.isTypedArray;function Ar(K,ne,re){switch(re.length){case 0:return K.call(ne);case 1:return K.call(ne,re[0]);case 2:return K.call(ne,re[0],re[1]);case 3:return K.call(ne,re[0],re[1],re[2])}return K.apply(ne,re)}function f2(K,ne,re,Ee){for(var Re=-1,st=K==null?0:K.length;++Re<st;){var Ht=K[Re];ne(Ee,Ht,re(Ht),K)}return Ee}function kr(K,ne){for(var re=-1,Ee=K==null?0:K.length;++re<Ee&&ne(K[re],re,K)!==!1;);return K}function h2(K,ne){for(var re=K==null?0:K.length;re--&&ne(K[re],re,K)!==!1;);return K}function fd(K,ne){for(var re=-1,Ee=K==null?0:K.length;++re<Ee;)if(!ne(K[re],re,K))return!1;return!0}function Wn(K,ne){for(var re=-1,Ee=K==null?0:K.length,Re=0,st=[];++re<Ee;){var Ht=K[re];ne(Ht,re,K)&&(st[Re++]=Ht)}return st}function zo(K,ne){var re=K==null?0:K.length;return!!re&&Yi(K,ne,0)>-1}function h0(K,ne,re){for(var Ee=-1,Re=K==null?0:K.length;++Ee<Re;)if(re(ne,K[Ee]))return!0;return!1}function At(K,ne){for(var re=-1,Ee=K==null?0:K.length,Re=Array(Ee);++re<Ee;)Re[re]=ne(K[re],re,K);return Re}function Hn(K,ne){for(var re=-1,Ee=ne.length,Re=K.length;++re<Ee;)K[Re+re]=ne[re];return K}function d0(K,ne,re,Ee){var Re=-1,st=K==null?0:K.length;for(Ee&&st&&(re=K[++Re]);++Re<st;)re=ne(re,K[Re],Re,K);return re}function d2(K,ne,re,Ee){var Re=K==null?0:K.length;for(Ee&&Re&&(re=K[--Re]);Re--;)re=ne(re,K[Re],Re,K);return re}function p0(K,ne){for(var re=-1,Ee=K==null?0:K.length;++re<Ee;)if(ne(K[re],re,K))return!0;return!1}var p2=_0("length");function _2(K){return K.split("")}function v2(K){return K.match(Zu)||[]}function hd(K,ne,re){var Ee;return re(K,function(Re,st,Ht){if(ne(Re,st,Ht))return Ee=st,!1}),Ee}function qo(K,ne,re,Ee){for(var Re=K.length,st=re+(Ee?1:-1);Ee?st--:++st<Re;)if(ne(K[st],st,K))return st;return-1}function Yi(K,ne,re){return ne===ne?B2(K,ne,re):qo(K,dd,re)}function g2(K,ne,re,Ee){for(var Re=re-1,st=K.length;++Re<st;)if(Ee(K[Re],ne))return Re;return-1}function dd(K){return K!==K}function pd(K,ne){var re=K==null?0:K.length;return re?g0(K,ne)/re:te}function _0(K){return function(ne){return ne==null?t:ne[K]}}function v0(K){return function(ne){return K==null?t:K[ne]}}function _d(K,ne,re,Ee,Re){return Re(K,function(st,Ht,pt){re=Ee?(Ee=!1,st):ne(re,st,Ht,pt)}),re}function m2(K,ne){var re=K.length;for(K.sort(ne);re--;)K[re]=K[re].value;return K}function g0(K,ne){for(var re,Ee=-1,Re=K.length;++Ee<Re;){var st=ne(K[Ee]);st!==t&&(re=re===t?st:re+st)}return re}function m0(K,ne){for(var re=-1,Ee=Array(K);++re<K;)Ee[re]=ne(re);return Ee}function x2(K,ne){return At(ne,function(re){return[re,K[re]]})}function vd(K){return K&&K.slice(0,yd(K)+1).replace(mr,"")}function Fr(K){return function(ne){return K(ne)}}function x0(K,ne){return At(ne,function(re){return K[re]})}function Es(K,ne){return K.has(ne)}function gd(K,ne){for(var re=-1,Ee=K.length;++re<Ee&&Yi(ne,K[re],0)>-1;);return re}function md(K,ne){for(var re=K.length;re--&&Yi(ne,K[re],0)>-1;);return re}function y2(K,ne){for(var re=K.length,Ee=0;re--;)K[re]===ne&&++Ee;return Ee}var D2=v0(i2),w2=v0(s2);function b2(K){return"\\"+a2[K]}function E2(K,ne){return K==null?t:K[ne]}function Ki(K){return e2.test(K)}function C2(K){return t2.test(K)}function A2(K){for(var ne,re=[];!(ne=K.next()).done;)re.push(ne.value);return re}function y0(K){var ne=-1,re=Array(K.size);return K.forEach(function(Ee,Re){re[++ne]=[Re,Ee]}),re}function xd(K,ne){return function(re){return K(ne(re))}}function jn(K,ne){for(var re=-1,Ee=K.length,Re=0,st=[];++re<Ee;){var Ht=K[re];(Ht===ne||Ht===h)&&(K[re]=h,st[Re++]=re)}return st}function Uo(K){var ne=-1,re=Array(K.size);return K.forEach(function(Ee){re[++ne]=Ee}),re}function F2(K){var ne=-1,re=Array(K.size);return K.forEach(function(Ee){re[++ne]=[Ee,Ee]}),re}function B2(K,ne,re){for(var Ee=re-1,Re=K.length;++Ee<Re;)if(K[Ee]===ne)return Ee;return-1}function M2(K,ne,re){for(var Ee=re+1;Ee--;)if(K[Ee]===ne)return Ee;return Ee}function Zi(K){return Ki(K)?S2(K):p2(K)}function tn(K){return Ki(K)?O2(K):_2(K)}function yd(K){for(var ne=K.length;ne--&&Ui.test(K.charAt(ne)););return ne}var N2=v0(o2);function S2(K){for(var ne=l0.lastIndex=0;l0.test(K);)++ne;return ne}function O2(K){return K.match(l0)||[]}function I2(K){return K.match(Jw)||[]}var T2=function K(ne){ne=ne==null?Jt:Vi.defaults(Jt.Object(),ne,Vi.pick(Jt,r2));var re=ne.Array,Ee=ne.Date,Re=ne.Error,st=ne.Function,Ht=ne.Math,pt=ne.Object,D0=ne.RegExp,$2=ne.String,zr=ne.TypeError,Wo=re.prototype,L2=st.prototype,Gi=pt.prototype,Ho=ne["__core-js_shared__"],jo=L2.toString,lt=Gi.hasOwnProperty,R2=0,Dd=function(){var o=/[^.]+$/.exec(Ho&&Ho.keys&&Ho.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}(),Yo=Gi.toString,P2=jo.call(pt),k2=Jt._,z2=D0("^"+jo.call(lt).replace(qn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ko=id?ne.Buffer:t,Yn=ne.Symbol,Zo=ne.Uint8Array,wd=Ko?Ko.allocUnsafe:t,Vo=xd(pt.getPrototypeOf,pt),bd=pt.create,Ed=Gi.propertyIsEnumerable,Go=Wo.splice,Cd=Yn?Yn.isConcatSpreadable:t,Cs=Yn?Yn.iterator:t,hi=Yn?Yn.toStringTag:t,Xo=function(){try{var o=gi(pt,"defineProperty");return o({},"",{}),o}catch{}}(),q2=ne.clearTimeout!==Jt.clearTimeout&&ne.clearTimeout,U2=Ee&&Ee.now!==Jt.Date.now&&Ee.now,W2=ne.setTimeout!==Jt.setTimeout&&ne.setTimeout,Qo=Ht.ceil,Jo=Ht.floor,w0=pt.getOwnPropertySymbols,H2=Ko?Ko.isBuffer:t,Ad=ne.isFinite,j2=Wo.join,Y2=xd(pt.keys,pt),jt=Ht.max,sr=Ht.min,K2=Ee.now,Z2=ne.parseInt,Fd=Ht.random,V2=Wo.reverse,b0=gi(ne,"DataView"),As=gi(ne,"Map"),E0=gi(ne,"Promise"),Xi=gi(ne,"Set"),Fs=gi(ne,"WeakMap"),Bs=gi(pt,"create"),ea=Fs&&new Fs,Qi={},G2=mi(b0),X2=mi(As),Q2=mi(E0),J2=mi(Xi),eb=mi(Fs),ta=Yn?Yn.prototype:t,Ms=ta?ta.valueOf:t,Bd=ta?ta.toString:t;function T(o){if(St(o)&&!Pe(o)&&!(o instanceof Ke)){if(o instanceof qr)return o;if(lt.call(o,"__wrapped__"))return Mp(o)}return new qr(o)}var Ji=function(){function o(){}return function(l){if(!Mt(l))return{};if(bd)return bd(l);o.prototype=l;var g=new o;return o.prototype=t,g}}();function ra(){}function qr(o,l){this.__wrapped__=o,this.__actions__=[],this.__chain__=!!l,this.__index__=0,this.__values__=t}T.templateSettings={escape:ys,evaluate:ki,interpolate:zi,variable:"",imports:{_:T}},T.prototype=ra.prototype,T.prototype.constructor=T,qr.prototype=Ji(ra.prototype),qr.prototype.constructor=qr;function Ke(o){this.__wrapped__=o,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=j,this.__views__=[]}function tb(){var o=new Ke(this.__wrapped__);return o.__actions__=xr(this.__actions__),o.__dir__=this.__dir__,o.__filtered__=this.__filtered__,o.__iteratees__=xr(this.__iteratees__),o.__takeCount__=this.__takeCount__,o.__views__=xr(this.__views__),o}function rb(){if(this.__filtered__){var o=new Ke(this);o.__dir__=-1,o.__filtered__=!0}else o=this.clone(),o.__dir__*=-1;return o}function nb(){var o=this.__wrapped__.value(),l=this.__dir__,g=Pe(o),E=l<0,S=g?o.length:0,$=_E(0,S,this.__views__),U=$.start,W=$.end,G=W-U,oe=E?W:U-1,ae=this.__iteratees__,ce=ae.length,ge=0,Ce=sr(G,this.__takeCount__);if(!g||!E&&S==G&&Ce==G)return Qd(o,this.__actions__);var Ne=[];e:for(;G--&&ge<Ce;){oe+=l;for(var qe=-1,Se=o[oe];++qe<ce;){var He=ae[qe],Ge=He.iteratee,Nr=He.type,pr=Ge(Se);if(Nr==z)Se=pr;else if(!pr){if(Nr==k)continue e;break e}}Ne[ge++]=Se}return Ne}Ke.prototype=Ji(ra.prototype),Ke.prototype.constructor=Ke;function di(o){var l=-1,g=o==null?0:o.length;for(this.clear();++l<g;){var E=o[l];this.set(E[0],E[1])}}function ib(){this.__data__=Bs?Bs(null):{},this.size=0}function sb(o){var l=this.has(o)&&delete this.__data__[o];return this.size-=l?1:0,l}function ob(o){var l=this.__data__;if(Bs){var g=l[o];return g===f?t:g}return lt.call(l,o)?l[o]:t}function ab(o){var l=this.__data__;return Bs?l[o]!==t:lt.call(l,o)}function ub(o,l){var g=this.__data__;return this.size+=this.has(o)?0:1,g[o]=Bs&&l===t?f:l,this}di.prototype.clear=ib,di.prototype.delete=sb,di.prototype.get=ob,di.prototype.has=ab,di.prototype.set=ub;function bn(o){var l=-1,g=o==null?0:o.length;for(this.clear();++l<g;){var E=o[l];this.set(E[0],E[1])}}function lb(){this.__data__=[],this.size=0}function cb(o){var l=this.__data__,g=na(l,o);if(g<0)return!1;var E=l.length-1;return g==E?l.pop():Go.call(l,g,1),--this.size,!0}function fb(o){var l=this.__data__,g=na(l,o);return g<0?t:l[g][1]}function hb(o){return na(this.__data__,o)>-1}function db(o,l){var g=this.__data__,E=na(g,o);return E<0?(++this.size,g.push([o,l])):g[E][1]=l,this}bn.prototype.clear=lb,bn.prototype.delete=cb,bn.prototype.get=fb,bn.prototype.has=hb,bn.prototype.set=db;function En(o){var l=-1,g=o==null?0:o.length;for(this.clear();++l<g;){var E=o[l];this.set(E[0],E[1])}}function pb(){this.size=0,this.__data__={hash:new di,map:new(As||bn),string:new di}}function _b(o){var l=_a(this,o).delete(o);return this.size-=l?1:0,l}function vb(o){return _a(this,o).get(o)}function gb(o){return _a(this,o).has(o)}function mb(o,l){var g=_a(this,o),E=g.size;return g.set(o,l),this.size+=g.size==E?0:1,this}En.prototype.clear=pb,En.prototype.delete=_b,En.prototype.get=vb,En.prototype.has=gb,En.prototype.set=mb;function pi(o){var l=-1,g=o==null?0:o.length;for(this.__data__=new En;++l<g;)this.add(o[l])}function xb(o){return this.__data__.set(o,f),this}function yb(o){return this.__data__.has(o)}pi.prototype.add=pi.prototype.push=xb,pi.prototype.has=yb;function rn(o){var l=this.__data__=new bn(o);this.size=l.size}function Db(){this.__data__=new bn,this.size=0}function wb(o){var l=this.__data__,g=l.delete(o);return this.size=l.size,g}function bb(o){return this.__data__.get(o)}function Eb(o){return this.__data__.has(o)}function Cb(o,l){var g=this.__data__;if(g instanceof bn){var E=g.__data__;if(!As||E.length<n-1)return E.push([o,l]),this.size=++g.size,this;g=this.__data__=new En(E)}return g.set(o,l),this.size=g.size,this}rn.prototype.clear=Db,rn.prototype.delete=wb,rn.prototype.get=bb,rn.prototype.has=Eb,rn.prototype.set=Cb;function Md(o,l){var g=Pe(o),E=!g&&xi(o),S=!g&&!E&&Xn(o),$=!g&&!E&&!S&&ns(o),U=g||E||S||$,W=U?m0(o.length,$2):[],G=W.length;for(var oe in o)(l||lt.call(o,oe))&&!(U&&(oe=="length"||S&&(oe=="offset"||oe=="parent")||$&&(oe=="buffer"||oe=="byteLength"||oe=="byteOffset")||Bn(oe,G)))&&W.push(oe);return W}function Nd(o){var l=o.length;return l?o[$0(0,l-1)]:t}function Ab(o,l){return va(xr(o),_i(l,0,o.length))}function Fb(o){return va(xr(o))}function C0(o,l,g){(g!==t&&!nn(o[l],g)||g===t&&!(l in o))&&Cn(o,l,g)}function Ns(o,l,g){var E=o[l];(!(lt.call(o,l)&&nn(E,g))||g===t&&!(l in o))&&Cn(o,l,g)}function na(o,l){for(var g=o.length;g--;)if(nn(o[g][0],l))return g;return-1}function Bb(o,l,g,E){return Kn(o,function(S,$,U){l(E,S,g(S),U)}),E}function Sd(o,l){return o&&hn(l,Kt(l),o)}function Mb(o,l){return o&&hn(l,Dr(l),o)}function Cn(o,l,g){l=="__proto__"&&Xo?Xo(o,l,{configurable:!0,enumerable:!0,value:g,writable:!0}):o[l]=g}function A0(o,l){for(var g=-1,E=l.length,S=re(E),$=o==null;++g<E;)S[g]=$?t:ol(o,l[g]);return S}function _i(o,l,g){return o===o&&(g!==t&&(o=o<=g?o:g),l!==t&&(o=o>=l?o:l)),o}function Ur(o,l,g,E,S,$){var U,W=l&d,G=l&p,oe=l&v;if(g&&(U=S?g(o,E,S,$):g(o)),U!==t)return U;if(!Mt(o))return o;var ae=Pe(o);if(ae){if(U=gE(o),!W)return xr(o,U)}else{var ce=or(o),ge=ce==Ye||ce==Ie;if(Xn(o))return tp(o,W);if(ce==Ct||ce==pe||ge&&!S){if(U=G||ge?{}:yp(o),!W)return G?oE(o,Mb(U,o)):sE(o,Sd(U,o))}else{if(!vt[ce])return S?o:{};U=mE(o,ce,W)}}$||($=new rn);var Ce=$.get(o);if(Ce)return Ce;$.set(o,U),Vp(o)?o.forEach(function(Se){U.add(Ur(Se,l,g,Se,o,$))}):Kp(o)&&o.forEach(function(Se,He){U.set(He,Ur(Se,l,g,He,o,$))});var Ne=oe?G?Y0:j0:G?Dr:Kt,qe=ae?t:Ne(o);return kr(qe||o,function(Se,He){qe&&(He=Se,Se=o[He]),Ns(U,He,Ur(Se,l,g,He,o,$))}),U}function Nb(o){var l=Kt(o);return function(g){return Od(g,o,l)}}function Od(o,l,g){var E=g.length;if(o==null)return!E;for(o=pt(o);E--;){var S=g[E],$=l[S],U=o[S];if(U===t&&!(S in o)||!$(U))return!1}return!0}function Id(o,l,g){if(typeof o!="function")throw new zr(a);return Rs(function(){o.apply(t,g)},l)}function Ss(o,l,g,E){var S=-1,$=zo,U=!0,W=o.length,G=[],oe=l.length;if(!W)return G;g&&(l=At(l,Fr(g))),E?($=h0,U=!1):l.length>=n&&($=Es,U=!1,l=new pi(l));e:for(;++S<W;){var ae=o[S],ce=g==null?ae:g(ae);if(ae=E||ae!==0?ae:0,U&&ce===ce){for(var ge=oe;ge--;)if(l[ge]===ce)continue e;G.push(ae)}else $(l,ce,E)||G.push(ae)}return G}var Kn=op(fn),Td=op(B0,!0);function Sb(o,l){var g=!0;return Kn(o,function(E,S,$){return g=!!l(E,S,$),g}),g}function ia(o,l,g){for(var E=-1,S=o.length;++E<S;){var $=o[E],U=l($);if(U!=null&&(W===t?U===U&&!Mr(U):g(U,W)))var W=U,G=$}return G}function Ob(o,l,g,E){var S=o.length;for(g=ze(g),g<0&&(g=-g>S?0:S+g),E=E===t||E>S?S:ze(E),E<0&&(E+=S),E=g>E?0:Xp(E);g<E;)o[g++]=l;return o}function $d(o,l){var g=[];return Kn(o,function(E,S,$){l(E,S,$)&&g.push(E)}),g}function er(o,l,g,E,S){var $=-1,U=o.length;for(g||(g=yE),S||(S=[]);++$<U;){var W=o[$];l>0&&g(W)?l>1?er(W,l-1,g,E,S):Hn(S,W):E||(S[S.length]=W)}return S}var F0=ap(),Ld=ap(!0);function fn(o,l){return o&&F0(o,l,Kt)}function B0(o,l){return o&&Ld(o,l,Kt)}function sa(o,l){return Wn(l,function(g){return Mn(o[g])})}function vi(o,l){l=Vn(l,o);for(var g=0,E=l.length;o!=null&&g<E;)o=o[dn(l[g++])];return g&&g==E?o:t}function Rd(o,l,g){var E=l(o);return Pe(o)?E:Hn(E,g(o))}function hr(o){return o==null?o===t?Z:Wt:hi&&hi in pt(o)?pE(o):FE(o)}function M0(o,l){return o>l}function Ib(o,l){return o!=null&&lt.call(o,l)}function Tb(o,l){return o!=null&&l in pt(o)}function $b(o,l,g){return o>=sr(l,g)&&o<jt(l,g)}function N0(o,l,g){for(var E=g?h0:zo,S=o[0].length,$=o.length,U=$,W=re($),G=1/0,oe=[];U--;){var ae=o[U];U&&l&&(ae=At(ae,Fr(l))),G=sr(ae.length,G),W[U]=!g&&(l||S>=120&&ae.length>=120)?new pi(U&&ae):t}ae=o[0];var ce=-1,ge=W[0];e:for(;++ce<S&&oe.length<G;){var Ce=ae[ce],Ne=l?l(Ce):Ce;if(Ce=g||Ce!==0?Ce:0,!(ge?Es(ge,Ne):E(oe,Ne,g))){for(U=$;--U;){var qe=W[U];if(!(qe?Es(qe,Ne):E(o[U],Ne,g)))continue e}ge&&ge.push(Ne),oe.push(Ce)}}return oe}function Lb(o,l,g,E){return fn(o,function(S,$,U){l(E,g(S),$,U)}),E}function Os(o,l,g){l=Vn(l,o),o=Ep(o,l);var E=o==null?o:o[dn(Hr(l))];return E==null?t:Ar(E,o,g)}function Pd(o){return St(o)&&hr(o)==pe}function Rb(o){return St(o)&&hr(o)==ue}function Pb(o){return St(o)&&hr(o)==Oe}function Is(o,l,g,E,S){return o===l?!0:o==null||l==null||!St(o)&&!St(l)?o!==o&&l!==l:kb(o,l,g,E,Is,S)}function kb(o,l,g,E,S,$){var U=Pe(o),W=Pe(l),G=U?De:or(o),oe=W?De:or(l);G=G==pe?Ct:G,oe=oe==pe?Ct:oe;var ae=G==Ct,ce=oe==Ct,ge=G==oe;if(ge&&Xn(o)){if(!Xn(l))return!1;U=!0,ae=!1}if(ge&&!ae)return $||($=new rn),U||ns(o)?gp(o,l,g,E,S,$):hE(o,l,G,g,E,S,$);if(!(g&x)){var Ce=ae&&lt.call(o,"__wrapped__"),Ne=ce&&lt.call(l,"__wrapped__");if(Ce||Ne){var qe=Ce?o.value():o,Se=Ne?l.value():l;return $||($=new rn),S(qe,Se,g,E,$)}}return ge?($||($=new rn),dE(o,l,g,E,S,$)):!1}function zb(o){return St(o)&&or(o)==Le}function S0(o,l,g,E){var S=g.length,$=S,U=!E;if(o==null)return!$;for(o=pt(o);S--;){var W=g[S];if(U&&W[2]?W[1]!==o[W[0]]:!(W[0]in o))return!1}for(;++S<$;){W=g[S];var G=W[0],oe=o[G],ae=W[1];if(U&&W[2]){if(oe===t&&!(G in o))return!1}else{var ce=new rn;if(E)var ge=E(oe,ae,G,o,l,ce);if(!(ge===t?Is(ae,oe,x|_,E,ce):ge))return!1}}return!0}function kd(o){if(!Mt(o)||wE(o))return!1;var l=Mn(o)?z2:e0;return l.test(mi(o))}function qb(o){return St(o)&&hr(o)==cr}function Ub(o){return St(o)&&or(o)==Dt}function Wb(o){return St(o)&&wa(o.length)&&!!wt[hr(o)]}function zd(o){return typeof o=="function"?o:o==null?wr:typeof o=="object"?Pe(o)?Wd(o[0],o[1]):Ud(o):u1(o)}function O0(o){if(!Ls(o))return Y2(o);var l=[];for(var g in pt(o))lt.call(o,g)&&g!="constructor"&&l.push(g);return l}function Hb(o){if(!Mt(o))return AE(o);var l=Ls(o),g=[];for(var E in o)E=="constructor"&&(l||!lt.call(o,E))||g.push(E);return g}function I0(o,l){return o<l}function qd(o,l){var g=-1,E=yr(o)?re(o.length):[];return Kn(o,function(S,$,U){E[++g]=l(S,$,U)}),E}function Ud(o){var l=Z0(o);return l.length==1&&l[0][2]?wp(l[0][0],l[0][1]):function(g){return g===o||S0(g,o,l)}}function Wd(o,l){return G0(o)&&Dp(l)?wp(dn(o),l):function(g){var E=ol(g,o);return E===t&&E===l?al(g,o):Is(l,E,x|_)}}function oa(o,l,g,E,S){o!==l&&F0(l,function($,U){if(S||(S=new rn),Mt($))jb(o,l,U,g,oa,E,S);else{var W=E?E(Q0(o,U),$,U+"",o,l,S):t;W===t&&(W=$),C0(o,U,W)}},Dr)}function jb(o,l,g,E,S,$,U){var W=Q0(o,g),G=Q0(l,g),oe=U.get(G);if(oe){C0(o,g,oe);return}var ae=$?$(W,G,g+"",o,l,U):t,ce=ae===t;if(ce){var ge=Pe(G),Ce=!ge&&Xn(G),Ne=!ge&&!Ce&&ns(G);ae=G,ge||Ce||Ne?Pe(W)?ae=W:$t(W)?ae=xr(W):Ce?(ce=!1,ae=tp(G,!0)):Ne?(ce=!1,ae=rp(G,!0)):ae=[]:Ps(G)||xi(G)?(ae=W,xi(W)?ae=Qp(W):(!Mt(W)||Mn(W))&&(ae=yp(G))):ce=!1}ce&&(U.set(G,ae),S(ae,G,E,$,U),U.delete(G)),C0(o,g,ae)}function Hd(o,l){var g=o.length;if(g)return l+=l<0?g:0,Bn(l,g)?o[l]:t}function jd(o,l,g){l.length?l=At(l,function($){return Pe($)?function(U){return vi(U,$.length===1?$[0]:$)}:$}):l=[wr];var E=-1;l=At(l,Fr(Me()));var S=qd(o,function($,U,W){var G=At(l,function(oe){return oe($)});return{criteria:G,index:++E,value:$}});return m2(S,function($,U){return iE($,U,g)})}function Yb(o,l){return Yd(o,l,function(g,E){return al(o,E)})}function Yd(o,l,g){for(var E=-1,S=l.length,$={};++E<S;){var U=l[E],W=vi(o,U);g(W,U)&&Ts($,Vn(U,o),W)}return $}function Kb(o){return function(l){return vi(l,o)}}function T0(o,l,g,E){var S=E?g2:Yi,$=-1,U=l.length,W=o;for(o===l&&(l=xr(l)),g&&(W=At(o,Fr(g)));++$<U;)for(var G=0,oe=l[$],ae=g?g(oe):oe;(G=S(W,ae,G,E))>-1;)W!==o&&Go.call(W,G,1),Go.call(o,G,1);return o}function Kd(o,l){for(var g=o?l.length:0,E=g-1;g--;){var S=l[g];if(g==E||S!==$){var $=S;Bn(S)?Go.call(o,S,1):P0(o,S)}}return o}function $0(o,l){return o+Jo(Fd()*(l-o+1))}function Zb(o,l,g,E){for(var S=-1,$=jt(Qo((l-o)/(g||1)),0),U=re($);$--;)U[E?$:++S]=o,o+=g;return U}function L0(o,l){var g="";if(!o||l<1||l>H)return g;do l%2&&(g+=o),l=Jo(l/2),l&&(o+=o);while(l);return g}function Ue(o,l){return J0(bp(o,l,wr),o+"")}function Vb(o){return Nd(is(o))}function Gb(o,l){var g=is(o);return va(g,_i(l,0,g.length))}function Ts(o,l,g,E){if(!Mt(o))return o;l=Vn(l,o);for(var S=-1,$=l.length,U=$-1,W=o;W!=null&&++S<$;){var G=dn(l[S]),oe=g;if(G==="__proto__"||G==="constructor"||G==="prototype")return o;if(S!=U){var ae=W[G];oe=E?E(ae,G,W):t,oe===t&&(oe=Mt(ae)?ae:Bn(l[S+1])?[]:{})}Ns(W,G,oe),W=W[G]}return o}var Zd=ea?function(o,l){return ea.set(o,l),o}:wr,Xb=Xo?function(o,l){return Xo(o,"toString",{configurable:!0,enumerable:!1,value:ll(l),writable:!0})}:wr;function Qb(o){return va(is(o))}function Wr(o,l,g){var E=-1,S=o.length;l<0&&(l=-l>S?0:S+l),g=g>S?S:g,g<0&&(g+=S),S=l>g?0:g-l>>>0,l>>>=0;for(var $=re(S);++E<S;)$[E]=o[E+l];return $}function Jb(o,l){var g;return Kn(o,function(E,S,$){return g=l(E,S,$),!g}),!!g}function aa(o,l,g){var E=0,S=o==null?E:o.length;if(typeof l=="number"&&l===l&&S<=Y){for(;E<S;){var $=E+S>>>1,U=o[$];U!==null&&!Mr(U)&&(g?U<=l:U<l)?E=$+1:S=$}return S}return R0(o,l,wr,g)}function R0(o,l,g,E){var S=0,$=o==null?0:o.length;if($===0)return 0;l=g(l);for(var U=l!==l,W=l===null,G=Mr(l),oe=l===t;S<$;){var ae=Jo((S+$)/2),ce=g(o[ae]),ge=ce!==t,Ce=ce===null,Ne=ce===ce,qe=Mr(ce);if(U)var Se=E||Ne;else oe?Se=Ne&&(E||ge):W?Se=Ne&&ge&&(E||!Ce):G?Se=Ne&&ge&&!Ce&&(E||!qe):Ce||qe?Se=!1:Se=E?ce<=l:ce<l;Se?S=ae+1:$=ae}return sr($,X)}function Vd(o,l){for(var g=-1,E=o.length,S=0,$=[];++g<E;){var U=o[g],W=l?l(U):U;if(!g||!nn(W,G)){var G=W;$[S++]=U===0?0:U}}return $}function Gd(o){return typeof o=="number"?o:Mr(o)?te:+o}function Br(o){if(typeof o=="string")return o;if(Pe(o))return At(o,Br)+"";if(Mr(o))return Bd?Bd.call(o):"";var l=o+"";return l=="0"&&1/o==-V?"-0":l}function Zn(o,l,g){var E=-1,S=zo,$=o.length,U=!0,W=[],G=W;if(g)U=!1,S=h0;else if($>=n){var oe=l?null:cE(o);if(oe)return Uo(oe);U=!1,S=Es,G=new pi}else G=l?[]:W;e:for(;++E<$;){var ae=o[E],ce=l?l(ae):ae;if(ae=g||ae!==0?ae:0,U&&ce===ce){for(var ge=G.length;ge--;)if(G[ge]===ce)continue e;l&&G.push(ce),W.push(ae)}else S(G,ce,g)||(G!==W&&G.push(ce),W.push(ae))}return W}function P0(o,l){return l=Vn(l,o),o=Ep(o,l),o==null||delete o[dn(Hr(l))]}function Xd(o,l,g,E){return Ts(o,l,g(vi(o,l)),E)}function ua(o,l,g,E){for(var S=o.length,$=E?S:-1;(E?$--:++$<S)&&l(o[$],$,o););return g?Wr(o,E?0:$,E?$+1:S):Wr(o,E?$+1:0,E?S:$)}function Qd(o,l){var g=o;return g instanceof Ke&&(g=g.value()),d0(l,function(E,S){return S.func.apply(S.thisArg,Hn([E],S.args))},g)}function k0(o,l,g){var E=o.length;if(E<2)return E?Zn(o[0]):[];for(var S=-1,$=re(E);++S<E;)for(var U=o[S],W=-1;++W<E;)W!=S&&($[S]=Ss($[S]||U,o[W],l,g));return Zn(er($,1),l,g)}function Jd(o,l,g){for(var E=-1,S=o.length,$=l.length,U={};++E<S;){var W=E<$?l[E]:t;g(U,o[E],W)}return U}function z0(o){return $t(o)?o:[]}function q0(o){return typeof o=="function"?o:wr}function Vn(o,l){return Pe(o)?o:G0(o,l)?[o]:Bp(at(o))}var eE=Ue;function Gn(o,l,g){var E=o.length;return g=g===t?E:g,!l&&g>=E?o:Wr(o,l,g)}var ep=q2||function(o){return Jt.clearTimeout(o)};function tp(o,l){if(l)return o.slice();var g=o.length,E=wd?wd(g):new o.constructor(g);return o.copy(E),E}function U0(o){var l=new o.constructor(o.byteLength);return new Zo(l).set(new Zo(o)),l}function tE(o,l){var g=l?U0(o.buffer):o.buffer;return new o.constructor(g,o.byteOffset,o.byteLength)}function rE(o){var l=new o.constructor(o.source,Ro.exec(o));return l.lastIndex=o.lastIndex,l}function nE(o){return Ms?pt(Ms.call(o)):{}}function rp(o,l){var g=l?U0(o.buffer):o.buffer;return new o.constructor(g,o.byteOffset,o.length)}function np(o,l){if(o!==l){var g=o!==t,E=o===null,S=o===o,$=Mr(o),U=l!==t,W=l===null,G=l===l,oe=Mr(l);if(!W&&!oe&&!$&&o>l||$&&U&&G&&!W&&!oe||E&&U&&G||!g&&G||!S)return 1;if(!E&&!$&&!oe&&o<l||oe&&g&&S&&!E&&!$||W&&g&&S||!U&&S||!G)return-1}return 0}function iE(o,l,g){for(var E=-1,S=o.criteria,$=l.criteria,U=S.length,W=g.length;++E<U;){var G=np(S[E],$[E]);if(G){if(E>=W)return G;var oe=g[E];return G*(oe=="desc"?-1:1)}}return o.index-l.index}function ip(o,l,g,E){for(var S=-1,$=o.length,U=g.length,W=-1,G=l.length,oe=jt($-U,0),ae=re(G+oe),ce=!E;++W<G;)ae[W]=l[W];for(;++S<U;)(ce||S<$)&&(ae[g[S]]=o[S]);for(;oe--;)ae[W++]=o[S++];return ae}function sp(o,l,g,E){for(var S=-1,$=o.length,U=-1,W=g.length,G=-1,oe=l.length,ae=jt($-W,0),ce=re(ae+oe),ge=!E;++S<ae;)ce[S]=o[S];for(var Ce=S;++G<oe;)ce[Ce+G]=l[G];for(;++U<W;)(ge||S<$)&&(ce[Ce+g[U]]=o[S++]);return ce}function xr(o,l){var g=-1,E=o.length;for(l||(l=re(E));++g<E;)l[g]=o[g];return l}function hn(o,l,g,E){var S=!g;g||(g={});for(var $=-1,U=l.length;++$<U;){var W=l[$],G=E?E(g[W],o[W],W,g,o):t;G===t&&(G=o[W]),S?Cn(g,W,G):Ns(g,W,G)}return g}function sE(o,l){return hn(o,V0(o),l)}function oE(o,l){return hn(o,mp(o),l)}function la(o,l){return function(g,E){var S=Pe(g)?f2:Bb,$=l?l():{};return S(g,o,Me(E,2),$)}}function es(o){return Ue(function(l,g){var E=-1,S=g.length,$=S>1?g[S-1]:t,U=S>2?g[2]:t;for($=o.length>3&&typeof $=="function"?(S--,$):t,U&&dr(g[0],g[1],U)&&($=S<3?t:$,S=1),l=pt(l);++E<S;){var W=g[E];W&&o(l,W,E,$)}return l})}function op(o,l){return function(g,E){if(g==null)return g;if(!yr(g))return o(g,E);for(var S=g.length,$=l?S:-1,U=pt(g);(l?$--:++$<S)&&E(U[$],$,U)!==!1;);return g}}function ap(o){return function(l,g,E){for(var S=-1,$=pt(l),U=E(l),W=U.length;W--;){var G=U[o?W:++S];if(g($[G],G,$)===!1)break}return l}}function aE(o,l,g){var E=l&y,S=$s(o);function $(){var U=this&&this!==Jt&&this instanceof $?S:o;return U.apply(E?g:this,arguments)}return $}function up(o){return function(l){l=at(l);var g=Ki(l)?tn(l):t,E=g?g[0]:l.charAt(0),S=g?Gn(g,1).join(""):l.slice(1);return E[o]()+S}}function ts(o){return function(l){return d0(o1(s1(l).replace(Xw,"")),o,"")}}function $s(o){return function(){var l=arguments;switch(l.length){case 0:return new o;case 1:return new o(l[0]);case 2:return new o(l[0],l[1]);case 3:return new o(l[0],l[1],l[2]);case 4:return new o(l[0],l[1],l[2],l[3]);case 5:return new o(l[0],l[1],l[2],l[3],l[4]);case 6:return new o(l[0],l[1],l[2],l[3],l[4],l[5]);case 7:return new o(l[0],l[1],l[2],l[3],l[4],l[5],l[6])}var g=Ji(o.prototype),E=o.apply(g,l);return Mt(E)?E:g}}function uE(o,l,g){var E=$s(o);function S(){for(var $=arguments.length,U=re($),W=$,G=rs(S);W--;)U[W]=arguments[W];var oe=$<3&&U[0]!==G&&U[$-1]!==G?[]:jn(U,G);if($-=oe.length,$<g)return dp(o,l,ca,S.placeholder,t,U,oe,t,t,g-$);var ae=this&&this!==Jt&&this instanceof S?E:o;return Ar(ae,this,U)}return S}function lp(o){return function(l,g,E){var S=pt(l);if(!yr(l)){var $=Me(g,3);l=Kt(l),g=function(W){return $(S[W],W,S)}}var U=o(l,g,E);return U>-1?S[$?l[U]:U]:t}}function cp(o){return Fn(function(l){var g=l.length,E=g,S=qr.prototype.thru;for(o&&l.reverse();E--;){var $=l[E];if(typeof $!="function")throw new zr(a);if(S&&!U&&pa($)=="wrapper")var U=new qr([],!0)}for(E=U?E:g;++E<g;){$=l[E];var W=pa($),G=W=="wrapper"?K0($):t;G&&X0(G[0])&&G[1]==(B|D|b|M)&&!G[4].length&&G[9]==1?U=U[pa(G[0])].apply(U,G[3]):U=$.length==1&&X0($)?U[W]():U.thru($)}return function(){var oe=arguments,ae=oe[0];if(U&&oe.length==1&&Pe(ae))return U.plant(ae).value();for(var ce=0,ge=g?l[ce].apply(this,oe):ae;++ce<g;)ge=l[ce].call(this,ge);return ge}})}function ca(o,l,g,E,S,$,U,W,G,oe){var ae=l&B,ce=l&y,ge=l&m,Ce=l&(D|C),Ne=l&O,qe=ge?t:$s(o);function Se(){for(var He=arguments.length,Ge=re(He),Nr=He;Nr--;)Ge[Nr]=arguments[Nr];if(Ce)var pr=rs(Se),Sr=y2(Ge,pr);if(E&&(Ge=ip(Ge,E,S,Ce)),$&&(Ge=sp(Ge,$,U,Ce)),He-=Sr,Ce&&He<oe){var Lt=jn(Ge,pr);return dp(o,l,ca,Se.placeholder,g,Ge,Lt,W,G,oe-He)}var sn=ce?g:this,Sn=ge?sn[o]:o;return He=Ge.length,W?Ge=BE(Ge,W):Ne&&He>1&&Ge.reverse(),ae&&G<He&&(Ge.length=G),this&&this!==Jt&&this instanceof Se&&(Sn=qe||$s(Sn)),Sn.apply(sn,Ge)}return Se}function fp(o,l){return function(g,E){return Lb(g,o,l(E),{})}}function fa(o,l){return function(g,E){var S;if(g===t&&E===t)return l;if(g!==t&&(S=g),E!==t){if(S===t)return E;typeof g=="string"||typeof E=="string"?(g=Br(g),E=Br(E)):(g=Gd(g),E=Gd(E)),S=o(g,E)}return S}}function W0(o){return Fn(function(l){return l=At(l,Fr(Me())),Ue(function(g){var E=this;return o(l,function(S){return Ar(S,E,g)})})})}function ha(o,l){l=l===t?" ":Br(l);var g=l.length;if(g<2)return g?L0(l,o):l;var E=L0(l,Qo(o/Zi(l)));return Ki(l)?Gn(tn(E),0,o).join(""):E.slice(0,o)}function lE(o,l,g,E){var S=l&y,$=$s(o);function U(){for(var W=-1,G=arguments.length,oe=-1,ae=E.length,ce=re(ae+G),ge=this&&this!==Jt&&this instanceof U?$:o;++oe<ae;)ce[oe]=E[oe];for(;G--;)ce[oe++]=arguments[++W];return Ar(ge,S?g:this,ce)}return U}function hp(o){return function(l,g,E){return E&&typeof E!="number"&&dr(l,g,E)&&(g=E=t),l=Nn(l),g===t?(g=l,l=0):g=Nn(g),E=E===t?l<g?1:-1:Nn(E),Zb(l,g,E,o)}}function da(o){return function(l,g){return typeof l=="string"&&typeof g=="string"||(l=jr(l),g=jr(g)),o(l,g)}}function dp(o,l,g,E,S,$,U,W,G,oe){var ae=l&D,ce=ae?U:t,ge=ae?t:U,Ce=ae?$:t,Ne=ae?t:$;l|=ae?b:F,l&=~(ae?F:b),l&w||(l&=~(y|m));var qe=[o,l,S,Ce,ce,Ne,ge,W,G,oe],Se=g.apply(t,qe);return X0(o)&&Cp(Se,qe),Se.placeholder=E,Ap(Se,o,l)}function H0(o){var l=Ht[o];return function(g,E){if(g=jr(g),E=E==null?0:sr(ze(E),292),E&&Ad(g)){var S=(at(g)+"e").split("e"),$=l(S[0]+"e"+(+S[1]+E));return S=(at($)+"e").split("e"),+(S[0]+"e"+(+S[1]-E))}return l(g)}}var cE=Xi&&1/Uo(new Xi([,-0]))[1]==V?function(o){return new Xi(o)}:hl;function pp(o){return function(l){var g=or(l);return g==Le?y0(l):g==Dt?F2(l):x2(l,o(l))}}function An(o,l,g,E,S,$,U,W){var G=l&m;if(!G&&typeof o!="function")throw new zr(a);var oe=E?E.length:0;if(oe||(l&=~(b|F),E=S=t),U=U===t?U:jt(ze(U),0),W=W===t?W:ze(W),oe-=S?S.length:0,l&F){var ae=E,ce=S;E=S=t}var ge=G?t:K0(o),Ce=[o,l,g,E,S,ae,ce,$,U,W];if(ge&&CE(Ce,ge),o=Ce[0],l=Ce[1],g=Ce[2],E=Ce[3],S=Ce[4],W=Ce[9]=Ce[9]===t?G?0:o.length:jt(Ce[9]-oe,0),!W&&l&(D|C)&&(l&=~(D|C)),!l||l==y)var Ne=aE(o,l,g);else l==D||l==C?Ne=uE(o,l,W):(l==b||l==(y|b))&&!S.length?Ne=lE(o,l,g,E):Ne=ca.apply(t,Ce);var qe=ge?Zd:Cp;return Ap(qe(Ne,Ce),o,l)}function _p(o,l,g,E){return o===t||nn(o,Gi[g])&&!lt.call(E,g)?l:o}function vp(o,l,g,E,S,$){return Mt(o)&&Mt(l)&&($.set(l,o),oa(o,l,t,vp,$),$.delete(l)),o}function fE(o){return Ps(o)?t:o}function gp(o,l,g,E,S,$){var U=g&x,W=o.length,G=l.length;if(W!=G&&!(U&&G>W))return!1;var oe=$.get(o),ae=$.get(l);if(oe&&ae)return oe==l&&ae==o;var ce=-1,ge=!0,Ce=g&_?new pi:t;for($.set(o,l),$.set(l,o);++ce<W;){var Ne=o[ce],qe=l[ce];if(E)var Se=U?E(qe,Ne,ce,l,o,$):E(Ne,qe,ce,o,l,$);if(Se!==t){if(Se)continue;ge=!1;break}if(Ce){if(!p0(l,function(He,Ge){if(!Es(Ce,Ge)&&(Ne===He||S(Ne,He,g,E,$)))return Ce.push(Ge)})){ge=!1;break}}else if(!(Ne===qe||S(Ne,qe,g,E,$))){ge=!1;break}}return $.delete(o),$.delete(l),ge}function hE(o,l,g,E,S,$,U){switch(g){case se:if(o.byteLength!=l.byteLength||o.byteOffset!=l.byteOffset)return!1;o=o.buffer,l=l.buffer;case ue:return!(o.byteLength!=l.byteLength||!$(new Zo(o),new Zo(l)));case be:case Oe:case yt:return nn(+o,+l);case nt:return o.name==l.name&&o.message==l.message;case cr:case It:return o==l+"";case Le:var W=y0;case Dt:var G=E&x;if(W||(W=Uo),o.size!=l.size&&!G)return!1;var oe=U.get(o);if(oe)return oe==l;E|=_,U.set(o,l);var ae=gp(W(o),W(l),E,S,$,U);return U.delete(o),ae;case P:if(Ms)return Ms.call(o)==Ms.call(l)}return!1}function dE(o,l,g,E,S,$){var U=g&x,W=j0(o),G=W.length,oe=j0(l),ae=oe.length;if(G!=ae&&!U)return!1;for(var ce=G;ce--;){var ge=W[ce];if(!(U?ge in l:lt.call(l,ge)))return!1}var Ce=$.get(o),Ne=$.get(l);if(Ce&&Ne)return Ce==l&&Ne==o;var qe=!0;$.set(o,l),$.set(l,o);for(var Se=U;++ce<G;){ge=W[ce];var He=o[ge],Ge=l[ge];if(E)var Nr=U?E(Ge,He,ge,l,o,$):E(He,Ge,ge,o,l,$);if(!(Nr===t?He===Ge||S(He,Ge,g,E,$):Nr)){qe=!1;break}Se||(Se=ge=="constructor")}if(qe&&!Se){var pr=o.constructor,Sr=l.constructor;pr!=Sr&&"constructor"in o&&"constructor"in l&&!(typeof pr=="function"&&pr instanceof pr&&typeof Sr=="function"&&Sr instanceof Sr)&&(qe=!1)}return $.delete(o),$.delete(l),qe}function Fn(o){return J0(bp(o,t,Op),o+"")}function j0(o){return Rd(o,Kt,V0)}function Y0(o){return Rd(o,Dr,mp)}var K0=ea?function(o){return ea.get(o)}:hl;function pa(o){for(var l=o.name+"",g=Qi[l],E=lt.call(Qi,l)?g.length:0;E--;){var S=g[E],$=S.func;if($==null||$==o)return S.name}return l}function rs(o){var l=lt.call(T,"placeholder")?T:o;return l.placeholder}function Me(){var o=T.iteratee||cl;return o=o===cl?zd:o,arguments.length?o(arguments[0],arguments[1]):o}function _a(o,l){var g=o.__data__;return DE(l)?g[typeof l=="string"?"string":"hash"]:g.map}function Z0(o){for(var l=Kt(o),g=l.length;g--;){var E=l[g],S=o[E];l[g]=[E,S,Dp(S)]}return l}function gi(o,l){var g=E2(o,l);return kd(g)?g:t}function pE(o){var l=lt.call(o,hi),g=o[hi];try{o[hi]=t;var E=!0}catch{}var S=Yo.call(o);return E&&(l?o[hi]=g:delete o[hi]),S}var V0=w0?function(o){return o==null?[]:(o=pt(o),Wn(w0(o),function(l){return Ed.call(o,l)}))}:dl,mp=w0?function(o){for(var l=[];o;)Hn(l,V0(o)),o=Vo(o);return l}:dl,or=hr;(b0&&or(new b0(new ArrayBuffer(1)))!=se||As&&or(new As)!=Le||E0&&or(E0.resolve())!=lr||Xi&&or(new Xi)!=Dt||Fs&&or(new Fs)!=J)&&(or=function(o){var l=hr(o),g=l==Ct?o.constructor:t,E=g?mi(g):"";if(E)switch(E){case G2:return se;case X2:return Le;case Q2:return lr;case J2:return Dt;case eb:return J}return l});function _E(o,l,g){for(var E=-1,S=g.length;++E<S;){var $=g[E],U=$.size;switch($.type){case"drop":o+=U;break;case"dropRight":l-=U;break;case"take":l=sr(l,o+U);break;case"takeRight":o=jt(o,l-U);break}}return{start:o,end:l}}function vE(o){var l=o.match(Yu);return l?l[1].split(Ku):[]}function xp(o,l,g){l=Vn(l,o);for(var E=-1,S=l.length,$=!1;++E<S;){var U=dn(l[E]);if(!($=o!=null&&g(o,U)))break;o=o[U]}return $||++E!=S?$:(S=o==null?0:o.length,!!S&&wa(S)&&Bn(U,S)&&(Pe(o)||xi(o)))}function gE(o){var l=o.length,g=new o.constructor(l);return l&&typeof o[0]=="string"&&lt.call(o,"index")&&(g.index=o.index,g.input=o.input),g}function yp(o){return typeof o.constructor=="function"&&!Ls(o)?Ji(Vo(o)):{}}function mE(o,l,g){var E=o.constructor;switch(l){case ue:return U0(o);case be:case Oe:return new E(+o);case se:return tE(o,g);case _e:case he:case de:case fe:case Xe:case et:case dt:case zt:case Tt:return rp(o,g);case Le:return new E;case yt:case It:return new E(o);case cr:return rE(o);case Dt:return new E;case P:return nE(o)}}function xE(o,l){var g=l.length;if(!g)return o;var E=g-1;return l[E]=(g>1?"& ":"")+l[E],l=l.join(g>2?", ":" "),o.replace(bs,`{
9
9
  /* [wrapped with `+l+`] */
10
- `)}function yb(o){return Pe(o)||xi(o)||!!(Ad&&o&&o[Ad])}function Bn(o,l){var g=typeof o;return l=l??H,!!l&&(g=="number"||g!="symbol"&&r0.test(o))&&o>-1&&o%1==0&&o<l}function dr(o,l,g){if(!Mt(g))return!1;var b=typeof l;return(b=="number"?yr(g)&&Bn(l,g.length):b=="string"&&l in g)?nn(g[l],o):!1}function G0(o,l){if(Pe(o))return!1;var g=typeof o;return g=="number"||g=="symbol"||g=="boolean"||o==null||Mr(o)?!0:qi.test(o)||!Ds.test(o)||l!=null&&o in pt(l)}function Db(o){var l=typeof o;return l=="string"||l=="number"||l=="symbol"||l=="boolean"?o!=="__proto__":o===null}function X0(o){var l=pa(o),g=T[l];if(typeof g!="function"||!(l in Ke.prototype))return!1;if(o===g)return!0;var b=K0(g);return!!b&&o===b[0]}function wb(o){return!!Dd&&Dd in o}var Eb=Ho?Mn:pl;function Ls(o){var l=o&&o.constructor,g=typeof l=="function"&&l.prototype||Gi;return o===g}function Dp(o){return o===o&&!Mt(o)}function wp(o,l){return function(g){return g==null?!1:g[o]===l&&(l!==t||o in pt(g))}}function bb(o){var l=ya(o,function(b){return g.size===c&&g.clear(),b}),g=l.cache;return l}function Ab(o,l){var g=o[1],b=l[1],S=g|b,$=S<(y|m|B),q=b==B&&g==D||b==B&&g==M&&o[7].length<=l[8]||b==(B|M)&&l[7].length<=l[8]&&g==D;if(!($||q))return o;b&y&&(o[2]=l[2],S|=g&y?0:w);var W=l[3];if(W){var G=o[3];o[3]=G?ip(G,W,l[4]):W,o[4]=G?jn(o[3],h):l[4]}return W=l[5],W&&(G=o[5],o[5]=G?sp(G,W,l[6]):W,o[6]=G?jn(o[5],h):l[6]),W=l[7],W&&(o[7]=W),b&B&&(o[8]=o[8]==null?l[8]:sr(o[8],l[8])),o[9]==null&&(o[9]=l[9]),o[0]=l[0],o[1]=S,o}function Cb(o){var l=[];if(o!=null)for(var g in pt(o))l.push(g);return l}function Fb(o){return Yo.call(o)}function Ep(o,l,g){return l=jt(l===t?o.length-1:l,0),function(){for(var b=arguments,S=-1,$=jt(b.length-l,0),q=re($);++S<$;)q[S]=b[l+S];S=-1;for(var W=re(l+1);++S<l;)W[S]=b[S];return W[l]=g(q),Cr(o,this,W)}}function bp(o,l){return l.length<2?o:vi(o,Wr(l,0,-1))}function Bb(o,l){for(var g=o.length,b=sr(l.length,g),S=xr(o);b--;){var $=l[b];o[b]=Bn($,g)?S[$]:t}return o}function Q0(o,l){if(!(l==="constructor"&&typeof o[l]=="function")&&l!="__proto__")return o[l]}var Ap=Fp(Zd),Rs=W2||function(o,l){return Jt.setTimeout(o,l)},J0=Fp(XE);function Cp(o,l,g){var b=l+"";return J0(o,xb(b,Mb(vb(b),g)))}function Fp(o){var l=0,g=0;return function(){var b=K2(),S=L-(b-g);if(g=b,S>0){if(++l>=I)return arguments[0]}else l=0;return o.apply(t,arguments)}}function va(o,l){var g=-1,b=o.length,S=b-1;for(l=l===t?b:l;++g<l;){var $=$0(g,S),q=o[$];o[$]=o[g],o[g]=q}return o.length=l,o}var Bp=bb(function(o){var l=[];return o.charCodeAt(0)===46&&l.push(""),o.replace(ws,function(g,b,S,$){l.push(S?$.replace(Gu,"$1"):b||g)}),l});function dn(o){if(typeof o=="string"||Mr(o))return o;var l=o+"";return l=="0"&&1/o==-V?"-0":l}function mi(o){if(o!=null){try{return jo.call(o)}catch{}try{return o+""}catch{}}return""}function Mb(o,l){return kr(Q,function(g){var b="_."+g[0];l&g[1]&&!zo(o,b)&&o.push(b)}),o.sort()}function Mp(o){if(o instanceof Ke)return o.clone();var l=new qr(o.__wrapped__,o.__chain__);return l.__actions__=xr(o.__actions__),l.__index__=o.__index__,l.__values__=o.__values__,l}function Nb(o,l,g){(g?dr(o,l,g):l===t)?l=1:l=jt(ze(l),0);var b=o==null?0:o.length;if(!b||l<1)return[];for(var S=0,$=0,q=re(Qo(b/l));S<b;)q[$++]=Wr(o,S,S+=l);return q}function Sb(o){for(var l=-1,g=o==null?0:o.length,b=0,S=[];++l<g;){var $=o[l];$&&(S[b++]=$)}return S}function Ob(){var o=arguments.length;if(!o)return[];for(var l=re(o-1),g=arguments[0],b=o;b--;)l[b-1]=arguments[b];return Hn(Pe(g)?xr(g):[g],er(l,1))}var Ib=Ue(function(o,l){return $t(o)?Ss(o,er(l,1,$t,!0)):[]}),Tb=Ue(function(o,l){var g=Hr(l);return $t(g)&&(g=t),$t(o)?Ss(o,er(l,1,$t,!0),Me(g,2)):[]}),$b=Ue(function(o,l){var g=Hr(l);return $t(g)&&(g=t),$t(o)?Ss(o,er(l,1,$t,!0),t,g):[]});function Lb(o,l,g){var b=o==null?0:o.length;return b?(l=g||l===t?1:ze(l),Wr(o,l<0?0:l,b)):[]}function Rb(o,l,g){var b=o==null?0:o.length;return b?(l=g||l===t?1:ze(l),l=b-l,Wr(o,0,l<0?0:l)):[]}function Pb(o,l){return o&&o.length?ua(o,Me(l,3),!0,!0):[]}function kb(o,l){return o&&o.length?ua(o,Me(l,3),!0):[]}function zb(o,l,g,b){var S=o==null?0:o.length;return S?(g&&typeof g!="number"&&dr(o,l,g)&&(g=0,b=S),OE(o,l,g,b)):[]}function Np(o,l,g){var b=o==null?0:o.length;if(!b)return-1;var S=g==null?0:ze(g);return S<0&&(S=jt(b+S,0)),qo(o,Me(l,3),S)}function Sp(o,l,g){var b=o==null?0:o.length;if(!b)return-1;var S=b-1;return g!==t&&(S=ze(g),S=g<0?jt(b+S,0):sr(S,b-1)),qo(o,Me(l,3),S,!0)}function Op(o){var l=o==null?0:o.length;return l?er(o,1):[]}function qb(o){var l=o==null?0:o.length;return l?er(o,V):[]}function Ub(o,l){var g=o==null?0:o.length;return g?(l=l===t?1:ze(l),er(o,l)):[]}function Wb(o){for(var l=-1,g=o==null?0:o.length,b={};++l<g;){var S=o[l];b[S[0]]=S[1]}return b}function Ip(o){return o&&o.length?o[0]:t}function Hb(o,l,g){var b=o==null?0:o.length;if(!b)return-1;var S=g==null?0:ze(g);return S<0&&(S=jt(b+S,0)),Yi(o,l,S)}function jb(o){var l=o==null?0:o.length;return l?Wr(o,0,-1):[]}var Yb=Ue(function(o){var l=Ct(o,z0);return l.length&&l[0]===o[0]?N0(l):[]}),Kb=Ue(function(o){var l=Hr(o),g=Ct(o,z0);return l===Hr(g)?l=t:g.pop(),g.length&&g[0]===o[0]?N0(g,Me(l,2)):[]}),Zb=Ue(function(o){var l=Hr(o),g=Ct(o,z0);return l=typeof l=="function"?l:t,l&&g.pop(),g.length&&g[0]===o[0]?N0(g,t,l):[]});function Vb(o,l){return o==null?"":j2.call(o,l)}function Hr(o){var l=o==null?0:o.length;return l?o[l-1]:t}function Gb(o,l,g){var b=o==null?0:o.length;if(!b)return-1;var S=b;return g!==t&&(S=ze(g),S=S<0?jt(b+S,0):sr(S,b-1)),l===l?M2(o,l,S):qo(o,dd,S,!0)}function Xb(o,l){return o&&o.length?Hd(o,ze(l)):t}var Qb=Ue(Tp);function Tp(o,l){return o&&o.length&&l&&l.length?T0(o,l):o}function Jb(o,l,g){return o&&o.length&&l&&l.length?T0(o,l,Me(g,2)):o}function e8(o,l,g){return o&&o.length&&l&&l.length?T0(o,l,t,g):o}var t8=Fn(function(o,l){var g=o==null?0:o.length,b=C0(o,l);return Kd(o,Ct(l,function(S){return Bn(S,g)?+S:S}).sort(np)),b});function r8(o,l){var g=[];if(!(o&&o.length))return g;var b=-1,S=[],$=o.length;for(l=Me(l,3);++b<$;){var q=o[b];l(q,b,o)&&(g.push(q),S.push(b))}return Kd(o,S),g}function el(o){return o==null?o:V2.call(o)}function n8(o,l,g){var b=o==null?0:o.length;return b?(g&&typeof g!="number"&&dr(o,l,g)?(l=0,g=b):(l=l==null?0:ze(l),g=g===t?b:ze(g)),Wr(o,l,g)):[]}function i8(o,l){return aa(o,l)}function s8(o,l,g){return R0(o,l,Me(g,2))}function o8(o,l){var g=o==null?0:o.length;if(g){var b=aa(o,l);if(b<g&&nn(o[b],l))return b}return-1}function a8(o,l){return aa(o,l,!0)}function u8(o,l,g){return R0(o,l,Me(g,2),!0)}function l8(o,l){var g=o==null?0:o.length;if(g){var b=aa(o,l,!0)-1;if(nn(o[b],l))return b}return-1}function c8(o){return o&&o.length?Vd(o):[]}function f8(o,l){return o&&o.length?Vd(o,Me(l,2)):[]}function h8(o){var l=o==null?0:o.length;return l?Wr(o,1,l):[]}function d8(o,l,g){return o&&o.length?(l=g||l===t?1:ze(l),Wr(o,0,l<0?0:l)):[]}function p8(o,l,g){var b=o==null?0:o.length;return b?(l=g||l===t?1:ze(l),l=b-l,Wr(o,l<0?0:l,b)):[]}function _8(o,l){return o&&o.length?ua(o,Me(l,3),!1,!0):[]}function v8(o,l){return o&&o.length?ua(o,Me(l,3)):[]}var g8=Ue(function(o){return Zn(er(o,1,$t,!0))}),m8=Ue(function(o){var l=Hr(o);return $t(l)&&(l=t),Zn(er(o,1,$t,!0),Me(l,2))}),x8=Ue(function(o){var l=Hr(o);return l=typeof l=="function"?l:t,Zn(er(o,1,$t,!0),t,l)});function y8(o){return o&&o.length?Zn(o):[]}function D8(o,l){return o&&o.length?Zn(o,Me(l,2)):[]}function w8(o,l){return l=typeof l=="function"?l:t,o&&o.length?Zn(o,t,l):[]}function tl(o){if(!(o&&o.length))return[];var l=0;return o=Wn(o,function(g){if($t(g))return l=jt(g.length,l),!0}),m0(l,function(g){return Ct(o,_0(g))})}function $p(o,l){if(!(o&&o.length))return[];var g=tl(o);return l==null?g:Ct(g,function(b){return Cr(l,t,b)})}var E8=Ue(function(o,l){return $t(o)?Ss(o,l):[]}),b8=Ue(function(o){return k0(Wn(o,$t))}),A8=Ue(function(o){var l=Hr(o);return $t(l)&&(l=t),k0(Wn(o,$t),Me(l,2))}),C8=Ue(function(o){var l=Hr(o);return l=typeof l=="function"?l:t,k0(Wn(o,$t),t,l)}),F8=Ue(tl);function B8(o,l){return Jd(o||[],l||[],Ns)}function M8(o,l){return Jd(o||[],l||[],Ts)}var N8=Ue(function(o){var l=o.length,g=l>1?o[l-1]:t;return g=typeof g=="function"?(o.pop(),g):t,$p(o,g)});function Lp(o){var l=T(o);return l.__chain__=!0,l}function S8(o,l){return l(o),o}function ga(o,l){return l(o)}var O8=Fn(function(o){var l=o.length,g=l?o[0]:0,b=this.__wrapped__,S=function($){return C0($,o)};return l>1||this.__actions__.length||!(b instanceof Ke)||!Bn(g)?this.thru(S):(b=b.slice(g,+g+(l?1:0)),b.__actions__.push({func:ga,args:[S],thisArg:t}),new qr(b,this.__chain__).thru(function($){return l&&!$.length&&$.push(t),$}))});function I8(){return Lp(this)}function T8(){return new qr(this.value(),this.__chain__)}function $8(){this.__values__===t&&(this.__values__=Gp(this.value()));var o=this.__index__>=this.__values__.length,l=o?t:this.__values__[this.__index__++];return{done:o,value:l}}function L8(){return this}function R8(o){for(var l,g=this;g instanceof ra;){var b=Mp(g);b.__index__=0,b.__values__=t,l?S.__wrapped__=b:l=b;var S=b;g=g.__wrapped__}return S.__wrapped__=o,l}function P8(){var o=this.__wrapped__;if(o instanceof Ke){var l=o;return this.__actions__.length&&(l=new Ke(this)),l=l.reverse(),l.__actions__.push({func:ga,args:[el],thisArg:t}),new qr(l,this.__chain__)}return this.thru(el)}function k8(){return Qd(this.__wrapped__,this.__actions__)}var z8=la(function(o,l,g){lt.call(o,g)?++o[g]:An(o,g,1)});function q8(o,l,g){var b=Pe(o)?fd:SE;return g&&dr(o,l,g)&&(l=t),b(o,Me(l,3))}function U8(o,l){var g=Pe(o)?Wn:$d;return g(o,Me(l,3))}var W8=lp(Np),H8=lp(Sp);function j8(o,l){return er(ma(o,l),1)}function Y8(o,l){return er(ma(o,l),V)}function K8(o,l,g){return g=g===t?1:ze(g),er(ma(o,l),g)}function Rp(o,l){var g=Pe(o)?kr:Kn;return g(o,Me(l,3))}function Pp(o,l){var g=Pe(o)?h2:Td;return g(o,Me(l,3))}var Z8=la(function(o,l,g){lt.call(o,g)?o[g].push(l):An(o,g,[l])});function V8(o,l,g,b){o=yr(o)?o:is(o),g=g&&!b?ze(g):0;var S=o.length;return g<0&&(g=jt(S+g,0)),Ea(o)?g<=S&&o.indexOf(l,g)>-1:!!S&&Yi(o,l,g)>-1}var G8=Ue(function(o,l,g){var b=-1,S=typeof l=="function",$=yr(o)?re(o.length):[];return Kn(o,function(q){$[++b]=S?Cr(l,q,g):Os(q,l,g)}),$}),X8=la(function(o,l,g){An(o,g,l)});function ma(o,l){var g=Pe(o)?Ct:qd;return g(o,Me(l,3))}function Q8(o,l,g,b){return o==null?[]:(Pe(l)||(l=l==null?[]:[l]),g=b?t:g,Pe(g)||(g=g==null?[]:[g]),jd(o,l,g))}var J8=la(function(o,l,g){o[g?0:1].push(l)},function(){return[[],[]]});function e4(o,l,g){var b=Pe(o)?d0:_d,S=arguments.length<3;return b(o,Me(l,4),g,S,Kn)}function t4(o,l,g){var b=Pe(o)?d2:_d,S=arguments.length<3;return b(o,Me(l,4),g,S,Td)}function r4(o,l){var g=Pe(o)?Wn:$d;return g(o,Da(Me(l,3)))}function n4(o){var l=Pe(o)?Nd:VE;return l(o)}function i4(o,l,g){(g?dr(o,l,g):l===t)?l=1:l=ze(l);var b=Pe(o)?CE:GE;return b(o,l)}function s4(o){var l=Pe(o)?FE:QE;return l(o)}function o4(o){if(o==null)return 0;if(yr(o))return Ea(o)?Zi(o):o.length;var l=or(o);return l==Le||l==Dt?o.size:O0(o).length}function a4(o,l,g){var b=Pe(o)?p0:JE;return g&&dr(o,l,g)&&(l=t),b(o,Me(l,3))}var u4=Ue(function(o,l){if(o==null)return[];var g=l.length;return g>1&&dr(o,l[0],l[1])?l=[]:g>2&&dr(l[0],l[1],l[2])&&(l=[l[0]]),jd(o,er(l,1),[])}),xa=U2||function(){return Jt.Date.now()};function l4(o,l){if(typeof l!="function")throw new zr(a);return o=ze(o),function(){if(--o<1)return l.apply(this,arguments)}}function kp(o,l,g){return l=g?t:l,l=o&&l==null?o.length:l,Cn(o,B,t,t,t,t,l)}function zp(o,l){var g;if(typeof l!="function")throw new zr(a);return o=ze(o),function(){return--o>0&&(g=l.apply(this,arguments)),o<=1&&(l=t),g}}var rl=Ue(function(o,l,g){var b=y;if(g.length){var S=jn(g,rs(rl));b|=E}return Cn(o,b,l,g,S)}),qp=Ue(function(o,l,g){var b=y|m;if(g.length){var S=jn(g,rs(qp));b|=E}return Cn(l,b,o,g,S)});function Up(o,l,g){l=g?t:l;var b=Cn(o,D,t,t,t,t,t,l);return b.placeholder=Up.placeholder,b}function Wp(o,l,g){l=g?t:l;var b=Cn(o,A,t,t,t,t,t,l);return b.placeholder=Wp.placeholder,b}function Hp(o,l,g){var b,S,$,q,W,G,oe=0,ae=!1,ce=!1,ge=!0;if(typeof o!="function")throw new zr(a);l=jr(l)||0,Mt(g)&&(ae=!!g.leading,ce="maxWait"in g,$=ce?jt(jr(g.maxWait)||0,l):$,ge="trailing"in g?!!g.trailing:ge);function Ae(Lt){var sn=b,Sn=S;return b=S=t,oe=Lt,q=o.apply(Sn,sn),q}function Ne(Lt){return oe=Lt,W=Rs(He,l),ae?Ae(Lt):q}function qe(Lt){var sn=Lt-G,Sn=Lt-oe,l1=l-sn;return ce?sr(l1,$-Sn):l1}function Se(Lt){var sn=Lt-G,Sn=Lt-oe;return G===t||sn>=l||sn<0||ce&&Sn>=$}function He(){var Lt=xa();if(Se(Lt))return Ge(Lt);W=Rs(He,qe(Lt))}function Ge(Lt){return W=t,ge&&b?Ae(Lt):(b=S=t,q)}function Nr(){W!==t&&ep(W),oe=0,b=G=S=W=t}function pr(){return W===t?q:Ge(xa())}function Sr(){var Lt=xa(),sn=Se(Lt);if(b=arguments,S=this,G=Lt,sn){if(W===t)return Ne(G);if(ce)return ep(W),W=Rs(He,l),Ae(G)}return W===t&&(W=Rs(He,l)),q}return Sr.cancel=Nr,Sr.flush=pr,Sr}var c4=Ue(function(o,l){return Id(o,1,l)}),f4=Ue(function(o,l,g){return Id(o,jr(l)||0,g)});function h4(o){return Cn(o,O)}function ya(o,l){if(typeof o!="function"||l!=null&&typeof l!="function")throw new zr(a);var g=function(){var b=arguments,S=l?l.apply(this,b):b[0],$=g.cache;if($.has(S))return $.get(S);var q=o.apply(this,b);return g.cache=$.set(S,q)||$,q};return g.cache=new(ya.Cache||bn),g}ya.Cache=bn;function Da(o){if(typeof o!="function")throw new zr(a);return function(){var l=arguments;switch(l.length){case 0:return!o.call(this);case 1:return!o.call(this,l[0]);case 2:return!o.call(this,l[0],l[1]);case 3:return!o.call(this,l[0],l[1],l[2])}return!o.apply(this,l)}}function d4(o){return zp(2,o)}var p4=eb(function(o,l){l=l.length==1&&Pe(l[0])?Ct(l[0],Fr(Me())):Ct(er(l,1),Fr(Me()));var g=l.length;return Ue(function(b){for(var S=-1,$=sr(b.length,g);++S<$;)b[S]=l[S].call(this,b[S]);return Cr(o,this,b)})}),nl=Ue(function(o,l){var g=jn(l,rs(nl));return Cn(o,E,t,l,g)}),jp=Ue(function(o,l){var g=jn(l,rs(jp));return Cn(o,F,t,l,g)}),_4=Fn(function(o,l){return Cn(o,M,t,t,t,l)});function v4(o,l){if(typeof o!="function")throw new zr(a);return l=l===t?l:ze(l),Ue(o,l)}function g4(o,l){if(typeof o!="function")throw new zr(a);return l=l==null?0:jt(ze(l),0),Ue(function(g){var b=g[l],S=Gn(g,0,l);return b&&Hn(S,b),Cr(o,this,S)})}function m4(o,l,g){var b=!0,S=!0;if(typeof o!="function")throw new zr(a);return Mt(g)&&(b="leading"in g?!!g.leading:b,S="trailing"in g?!!g.trailing:S),Hp(o,l,{leading:b,maxWait:l,trailing:S})}function x4(o){return kp(o,1)}function y4(o,l){return nl(q0(l),o)}function D4(){if(!arguments.length)return[];var o=arguments[0];return Pe(o)?o:[o]}function w4(o){return Ur(o,v)}function E4(o,l){return l=typeof l=="function"?l:t,Ur(o,v,l)}function b4(o){return Ur(o,d|v)}function A4(o,l){return l=typeof l=="function"?l:t,Ur(o,d|v,l)}function C4(o,l){return l==null||Od(o,l,Kt(l))}function nn(o,l){return o===l||o!==o&&l!==l}var F4=da(M0),B4=da(function(o,l){return o>=l}),xi=Pd(function(){return arguments}())?Pd:function(o){return St(o)&&lt.call(o,"callee")&&!bd.call(o,"callee")},Pe=re.isArray,M4=sd?Fr(sd):RE;function yr(o){return o!=null&&wa(o.length)&&!Mn(o)}function $t(o){return St(o)&&yr(o)}function N4(o){return o===!0||o===!1||St(o)&&hr(o)==Ee}var Xn=H2||pl,S4=od?Fr(od):PE;function O4(o){return St(o)&&o.nodeType===1&&!Ps(o)}function I4(o){if(o==null)return!0;if(yr(o)&&(Pe(o)||typeof o=="string"||typeof o.splice=="function"||Xn(o)||ns(o)||xi(o)))return!o.length;var l=or(o);if(l==Le||l==Dt)return!o.size;if(Ls(o))return!O0(o).length;for(var g in o)if(lt.call(o,g))return!1;return!0}function T4(o,l){return Is(o,l)}function $4(o,l,g){g=typeof g=="function"?g:t;var b=g?g(o,l):t;return b===t?Is(o,l,t,g):!!b}function il(o){if(!St(o))return!1;var l=hr(o);return l==nt||l==Fe||typeof o.message=="string"&&typeof o.name=="string"&&!Ps(o)}function L4(o){return typeof o=="number"&&Cd(o)}function Mn(o){if(!Mt(o))return!1;var l=hr(o);return l==Ye||l==Ie||l==we||l==Rr}function Yp(o){return typeof o=="number"&&o==ze(o)}function wa(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=H}function Mt(o){var l=typeof o;return o!=null&&(l=="object"||l=="function")}function St(o){return o!=null&&typeof o=="object"}var Kp=ad?Fr(ad):zE;function R4(o,l){return o===l||S0(o,l,Z0(l))}function P4(o,l,g){return g=typeof g=="function"?g:t,S0(o,l,Z0(l),g)}function k4(o){return Zp(o)&&o!=+o}function z4(o){if(Eb(o))throw new Re(i);return kd(o)}function q4(o){return o===null}function U4(o){return o==null}function Zp(o){return typeof o=="number"||St(o)&&hr(o)==yt}function Ps(o){if(!St(o)||hr(o)!=At)return!1;var l=Vo(o);if(l===null)return!0;var g=lt.call(l,"constructor")&&l.constructor;return typeof g=="function"&&g instanceof g&&jo.call(g)==P2}var sl=ud?Fr(ud):qE;function W4(o){return Yp(o)&&o>=-H&&o<=H}var Vp=ld?Fr(ld):UE;function Ea(o){return typeof o=="string"||!Pe(o)&&St(o)&&hr(o)==It}function Mr(o){return typeof o=="symbol"||St(o)&&hr(o)==P}var ns=cd?Fr(cd):WE;function H4(o){return o===t}function j4(o){return St(o)&&or(o)==J}function Y4(o){return St(o)&&hr(o)==ie}var K4=da(I0),Z4=da(function(o,l){return o<=l});function Gp(o){if(!o)return[];if(yr(o))return Ea(o)?tn(o):xr(o);if(As&&o[As])return C2(o[As]());var l=or(o),g=l==Le?y0:l==Dt?Uo:is;return g(o)}function Nn(o){if(!o)return o===0?o:0;if(o=jr(o),o===V||o===-V){var l=o<0?-1:1;return l*ee}return o===o?o:0}function ze(o){var l=Nn(o),g=l%1;return l===l?g?l-g:l:0}function Xp(o){return o?_i(ze(o),0,j):0}function jr(o){if(typeof o=="number")return o;if(Mr(o))return te;if(Mt(o)){var l=typeof o.valueOf=="function"?o.valueOf():o;o=Mt(l)?l+"":l}if(typeof o!="string")return o===0?o:+o;o=vd(o);var g=Ju.test(o);return g||t0.test(o)?l2(o.slice(2),g?2:8):Qu.test(o)?te:+o}function Qp(o){return hn(o,Dr(o))}function V4(o){return o?_i(ze(o),-H,H):o===0?o:0}function at(o){return o==null?"":Br(o)}var G4=es(function(o,l){if(Ls(l)||yr(l)){hn(l,Kt(l),o);return}for(var g in l)lt.call(l,g)&&Ns(o,g,l[g])}),Jp=es(function(o,l){hn(l,Dr(l),o)}),ba=es(function(o,l,g,b){hn(l,Dr(l),o,b)}),X4=es(function(o,l,g,b){hn(l,Kt(l),o,b)}),Q4=Fn(C0);function J4(o,l){var g=Ji(o);return l==null?g:Sd(g,l)}var eA=Ue(function(o,l){o=pt(o);var g=-1,b=l.length,S=b>2?l[2]:t;for(S&&dr(l[0],l[1],S)&&(b=1);++g<b;)for(var $=l[g],q=Dr($),W=-1,G=q.length;++W<G;){var oe=q[W],ae=o[oe];(ae===t||nn(ae,Gi[oe])&&!lt.call(o,oe))&&(o[oe]=$[oe])}return o}),tA=Ue(function(o){return o.push(t,vp),Cr(e1,t,o)});function rA(o,l){return hd(o,Me(l,3),fn)}function nA(o,l){return hd(o,Me(l,3),B0)}function iA(o,l){return o==null?o:F0(o,Me(l,3),Dr)}function sA(o,l){return o==null?o:Ld(o,Me(l,3),Dr)}function oA(o,l){return o&&fn(o,Me(l,3))}function aA(o,l){return o&&B0(o,Me(l,3))}function uA(o){return o==null?[]:sa(o,Kt(o))}function lA(o){return o==null?[]:sa(o,Dr(o))}function ol(o,l,g){var b=o==null?t:vi(o,l);return b===t?g:b}function cA(o,l){return o!=null&&xp(o,l,IE)}function al(o,l){return o!=null&&xp(o,l,TE)}var fA=fp(function(o,l,g){l!=null&&typeof l.toString!="function"&&(l=Yo.call(l)),o[l]=g},ll(wr)),hA=fp(function(o,l,g){l!=null&&typeof l.toString!="function"&&(l=Yo.call(l)),lt.call(o,l)?o[l].push(g):o[l]=[g]},Me),dA=Ue(Os);function Kt(o){return yr(o)?Md(o):O0(o)}function Dr(o){return yr(o)?Md(o,!0):HE(o)}function pA(o,l){var g={};return l=Me(l,3),fn(o,function(b,S,$){An(g,l(b,S,$),b)}),g}function _A(o,l){var g={};return l=Me(l,3),fn(o,function(b,S,$){An(g,S,l(b,S,$))}),g}var vA=es(function(o,l,g){oa(o,l,g)}),e1=es(function(o,l,g,b){oa(o,l,g,b)}),gA=Fn(function(o,l){var g={};if(o==null)return g;var b=!1;l=Ct(l,function($){return $=Vn($,o),b||(b=$.length>1),$}),hn(o,Y0(o),g),b&&(g=Ur(g,d|p|v,fb));for(var S=l.length;S--;)P0(g,l[S]);return g});function mA(o,l){return t1(o,Da(Me(l)))}var xA=Fn(function(o,l){return o==null?{}:YE(o,l)});function t1(o,l){if(o==null)return{};var g=Ct(Y0(o),function(b){return[b]});return l=Me(l),Yd(o,g,function(b,S){return l(b,S[0])})}function yA(o,l,g){l=Vn(l,o);var b=-1,S=l.length;for(S||(S=1,o=t);++b<S;){var $=o==null?t:o[dn(l[b])];$===t&&(b=S,$=g),o=Mn($)?$.call(o):$}return o}function DA(o,l,g){return o==null?o:Ts(o,l,g)}function wA(o,l,g,b){return b=typeof b=="function"?b:t,o==null?o:Ts(o,l,g,b)}var r1=pp(Kt),n1=pp(Dr);function EA(o,l,g){var b=Pe(o),S=b||Xn(o)||ns(o);if(l=Me(l,4),g==null){var $=o&&o.constructor;S?g=b?new $:[]:Mt(o)?g=Mn($)?Ji(Vo(o)):{}:g={}}return(S?kr:fn)(o,function(q,W,G){return l(g,q,W,G)}),g}function bA(o,l){return o==null?!0:P0(o,l)}function AA(o,l,g){return o==null?o:Xd(o,l,q0(g))}function CA(o,l,g,b){return b=typeof b=="function"?b:t,o==null?o:Xd(o,l,q0(g),b)}function is(o){return o==null?[]:x0(o,Kt(o))}function FA(o){return o==null?[]:x0(o,Dr(o))}function BA(o,l,g){return g===t&&(g=l,l=t),g!==t&&(g=jr(g),g=g===g?g:0),l!==t&&(l=jr(l),l=l===l?l:0),_i(jr(o),l,g)}function MA(o,l,g){return l=Nn(l),g===t?(g=l,l=0):g=Nn(g),o=jr(o),$E(o,l,g)}function NA(o,l,g){if(g&&typeof g!="boolean"&&dr(o,l,g)&&(l=g=t),g===t&&(typeof l=="boolean"?(g=l,l=t):typeof o=="boolean"&&(g=o,o=t)),o===t&&l===t?(o=0,l=1):(o=Nn(o),l===t?(l=o,o=0):l=Nn(l)),o>l){var b=o;o=l,l=b}if(g||o%1||l%1){var S=Fd();return sr(o+S*(l-o+u2("1e-"+((S+"").length-1))),l)}return $0(o,l)}var SA=ts(function(o,l,g){return l=l.toLowerCase(),o+(g?i1(l):l)});function i1(o){return ul(at(o).toLowerCase())}function s1(o){return o=at(o),o&&o.replace(n0,D2).replace(Qw,"")}function OA(o,l,g){o=at(o),l=Br(l);var b=o.length;g=g===t?b:_i(ze(g),0,b);var S=g;return g-=l.length,g>=0&&o.slice(g,S)==l}function IA(o){return o=at(o),o&&xs.test(o)?o.replace(li,w2):o}function TA(o){return o=at(o),o&&Qt.test(o)?o.replace(qn,"\\$&"):o}var $A=ts(function(o,l,g){return o+(g?"-":"")+l.toLowerCase()}),LA=ts(function(o,l,g){return o+(g?" ":"")+l.toLowerCase()}),RA=up("toLowerCase");function PA(o,l,g){o=at(o),l=ze(l);var b=l?Zi(o):0;if(!l||b>=l)return o;var S=(l-b)/2;return ha(Jo(S),g)+o+ha(Qo(S),g)}function kA(o,l,g){o=at(o),l=ze(l);var b=l?Zi(o):0;return l&&b<l?o+ha(l-b,g):o}function zA(o,l,g){o=at(o),l=ze(l);var b=l?Zi(o):0;return l&&b<l?ha(l-b,g)+o:o}function qA(o,l,g){return g||l==null?l=0:l&&(l=+l),Z2(at(o).replace(mr,""),l||0)}function UA(o,l,g){return(g?dr(o,l,g):l===t)?l=1:l=ze(l),L0(at(o),l)}function WA(){var o=arguments,l=at(o[0]);return o.length<3?l:l.replace(o[1],o[2])}var HA=ts(function(o,l,g){return o+(g?"_":"")+l.toLowerCase()});function jA(o,l,g){return g&&typeof g!="number"&&dr(o,l,g)&&(l=g=t),g=g===t?j:g>>>0,g?(o=at(o),o&&(typeof l=="string"||l!=null&&!sl(l))&&(l=Br(l),!l&&Ki(o))?Gn(tn(o),0,g):o.split(l,g)):[]}var YA=ts(function(o,l,g){return o+(g?" ":"")+ul(l)});function KA(o,l,g){return o=at(o),g=g==null?0:_i(ze(g),0,o.length),l=Br(l),o.slice(g,g+l.length)==l}function ZA(o,l,g){var b=T.templateSettings;g&&dr(o,l,g)&&(l=t),o=at(o),l=ba({},l,b,_p);var S=ba({},l.imports,b.imports,_p),$=Kt(S),q=x0(S,$),W,G,oe=0,ae=l.interpolate||Wi,ce="__p += '",ge=D0((l.escape||Wi).source+"|"+ae.source+"|"+(ae===zi?Xu:Wi).source+"|"+(l.evaluate||Wi).source+"|$","g"),Ae="//# sourceURL="+(lt.call(l,"sourceURL")?(l.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++n2+"]")+`
11
- `;o.replace(ge,function(Se,He,Ge,Nr,pr,Sr){return Ge||(Ge=Nr),ce+=o.slice(oe,Sr).replace(ci,E2),He&&(W=!0,ce+=`' +
10
+ `)}function yE(o){return Pe(o)||xi(o)||!!(Cd&&o&&o[Cd])}function Bn(o,l){var g=typeof o;return l=l??H,!!l&&(g=="number"||g!="symbol"&&r0.test(o))&&o>-1&&o%1==0&&o<l}function dr(o,l,g){if(!Mt(g))return!1;var E=typeof l;return(E=="number"?yr(g)&&Bn(l,g.length):E=="string"&&l in g)?nn(g[l],o):!1}function G0(o,l){if(Pe(o))return!1;var g=typeof o;return g=="number"||g=="symbol"||g=="boolean"||o==null||Mr(o)?!0:qi.test(o)||!Ds.test(o)||l!=null&&o in pt(l)}function DE(o){var l=typeof o;return l=="string"||l=="number"||l=="symbol"||l=="boolean"?o!=="__proto__":o===null}function X0(o){var l=pa(o),g=T[l];if(typeof g!="function"||!(l in Ke.prototype))return!1;if(o===g)return!0;var E=K0(g);return!!E&&o===E[0]}function wE(o){return!!Dd&&Dd in o}var bE=Ho?Mn:pl;function Ls(o){var l=o&&o.constructor,g=typeof l=="function"&&l.prototype||Gi;return o===g}function Dp(o){return o===o&&!Mt(o)}function wp(o,l){return function(g){return g==null?!1:g[o]===l&&(l!==t||o in pt(g))}}function EE(o){var l=ya(o,function(E){return g.size===c&&g.clear(),E}),g=l.cache;return l}function CE(o,l){var g=o[1],E=l[1],S=g|E,$=S<(y|m|B),U=E==B&&g==D||E==B&&g==M&&o[7].length<=l[8]||E==(B|M)&&l[7].length<=l[8]&&g==D;if(!($||U))return o;E&y&&(o[2]=l[2],S|=g&y?0:w);var W=l[3];if(W){var G=o[3];o[3]=G?ip(G,W,l[4]):W,o[4]=G?jn(o[3],h):l[4]}return W=l[5],W&&(G=o[5],o[5]=G?sp(G,W,l[6]):W,o[6]=G?jn(o[5],h):l[6]),W=l[7],W&&(o[7]=W),E&B&&(o[8]=o[8]==null?l[8]:sr(o[8],l[8])),o[9]==null&&(o[9]=l[9]),o[0]=l[0],o[1]=S,o}function AE(o){var l=[];if(o!=null)for(var g in pt(o))l.push(g);return l}function FE(o){return Yo.call(o)}function bp(o,l,g){return l=jt(l===t?o.length-1:l,0),function(){for(var E=arguments,S=-1,$=jt(E.length-l,0),U=re($);++S<$;)U[S]=E[l+S];S=-1;for(var W=re(l+1);++S<l;)W[S]=E[S];return W[l]=g(U),Ar(o,this,W)}}function Ep(o,l){return l.length<2?o:vi(o,Wr(l,0,-1))}function BE(o,l){for(var g=o.length,E=sr(l.length,g),S=xr(o);E--;){var $=l[E];o[E]=Bn($,g)?S[$]:t}return o}function Q0(o,l){if(!(l==="constructor"&&typeof o[l]=="function")&&l!="__proto__")return o[l]}var Cp=Fp(Zd),Rs=W2||function(o,l){return Jt.setTimeout(o,l)},J0=Fp(Xb);function Ap(o,l,g){var E=l+"";return J0(o,xE(E,ME(vE(E),g)))}function Fp(o){var l=0,g=0;return function(){var E=K2(),S=L-(E-g);if(g=E,S>0){if(++l>=I)return arguments[0]}else l=0;return o.apply(t,arguments)}}function va(o,l){var g=-1,E=o.length,S=E-1;for(l=l===t?E:l;++g<l;){var $=$0(g,S),U=o[$];o[$]=o[g],o[g]=U}return o.length=l,o}var Bp=EE(function(o){var l=[];return o.charCodeAt(0)===46&&l.push(""),o.replace(ws,function(g,E,S,$){l.push(S?$.replace(Gu,"$1"):E||g)}),l});function dn(o){if(typeof o=="string"||Mr(o))return o;var l=o+"";return l=="0"&&1/o==-V?"-0":l}function mi(o){if(o!=null){try{return jo.call(o)}catch{}try{return o+""}catch{}}return""}function ME(o,l){return kr(Q,function(g){var E="_."+g[0];l&g[1]&&!zo(o,E)&&o.push(E)}),o.sort()}function Mp(o){if(o instanceof Ke)return o.clone();var l=new qr(o.__wrapped__,o.__chain__);return l.__actions__=xr(o.__actions__),l.__index__=o.__index__,l.__values__=o.__values__,l}function NE(o,l,g){(g?dr(o,l,g):l===t)?l=1:l=jt(ze(l),0);var E=o==null?0:o.length;if(!E||l<1)return[];for(var S=0,$=0,U=re(Qo(E/l));S<E;)U[$++]=Wr(o,S,S+=l);return U}function SE(o){for(var l=-1,g=o==null?0:o.length,E=0,S=[];++l<g;){var $=o[l];$&&(S[E++]=$)}return S}function OE(){var o=arguments.length;if(!o)return[];for(var l=re(o-1),g=arguments[0],E=o;E--;)l[E-1]=arguments[E];return Hn(Pe(g)?xr(g):[g],er(l,1))}var IE=Ue(function(o,l){return $t(o)?Ss(o,er(l,1,$t,!0)):[]}),TE=Ue(function(o,l){var g=Hr(l);return $t(g)&&(g=t),$t(o)?Ss(o,er(l,1,$t,!0),Me(g,2)):[]}),$E=Ue(function(o,l){var g=Hr(l);return $t(g)&&(g=t),$t(o)?Ss(o,er(l,1,$t,!0),t,g):[]});function LE(o,l,g){var E=o==null?0:o.length;return E?(l=g||l===t?1:ze(l),Wr(o,l<0?0:l,E)):[]}function RE(o,l,g){var E=o==null?0:o.length;return E?(l=g||l===t?1:ze(l),l=E-l,Wr(o,0,l<0?0:l)):[]}function PE(o,l){return o&&o.length?ua(o,Me(l,3),!0,!0):[]}function kE(o,l){return o&&o.length?ua(o,Me(l,3),!0):[]}function zE(o,l,g,E){var S=o==null?0:o.length;return S?(g&&typeof g!="number"&&dr(o,l,g)&&(g=0,E=S),Ob(o,l,g,E)):[]}function Np(o,l,g){var E=o==null?0:o.length;if(!E)return-1;var S=g==null?0:ze(g);return S<0&&(S=jt(E+S,0)),qo(o,Me(l,3),S)}function Sp(o,l,g){var E=o==null?0:o.length;if(!E)return-1;var S=E-1;return g!==t&&(S=ze(g),S=g<0?jt(E+S,0):sr(S,E-1)),qo(o,Me(l,3),S,!0)}function Op(o){var l=o==null?0:o.length;return l?er(o,1):[]}function qE(o){var l=o==null?0:o.length;return l?er(o,V):[]}function UE(o,l){var g=o==null?0:o.length;return g?(l=l===t?1:ze(l),er(o,l)):[]}function WE(o){for(var l=-1,g=o==null?0:o.length,E={};++l<g;){var S=o[l];E[S[0]]=S[1]}return E}function Ip(o){return o&&o.length?o[0]:t}function HE(o,l,g){var E=o==null?0:o.length;if(!E)return-1;var S=g==null?0:ze(g);return S<0&&(S=jt(E+S,0)),Yi(o,l,S)}function jE(o){var l=o==null?0:o.length;return l?Wr(o,0,-1):[]}var YE=Ue(function(o){var l=At(o,z0);return l.length&&l[0]===o[0]?N0(l):[]}),KE=Ue(function(o){var l=Hr(o),g=At(o,z0);return l===Hr(g)?l=t:g.pop(),g.length&&g[0]===o[0]?N0(g,Me(l,2)):[]}),ZE=Ue(function(o){var l=Hr(o),g=At(o,z0);return l=typeof l=="function"?l:t,l&&g.pop(),g.length&&g[0]===o[0]?N0(g,t,l):[]});function VE(o,l){return o==null?"":j2.call(o,l)}function Hr(o){var l=o==null?0:o.length;return l?o[l-1]:t}function GE(o,l,g){var E=o==null?0:o.length;if(!E)return-1;var S=E;return g!==t&&(S=ze(g),S=S<0?jt(E+S,0):sr(S,E-1)),l===l?M2(o,l,S):qo(o,dd,S,!0)}function XE(o,l){return o&&o.length?Hd(o,ze(l)):t}var QE=Ue(Tp);function Tp(o,l){return o&&o.length&&l&&l.length?T0(o,l):o}function JE(o,l,g){return o&&o.length&&l&&l.length?T0(o,l,Me(g,2)):o}function e8(o,l,g){return o&&o.length&&l&&l.length?T0(o,l,t,g):o}var t8=Fn(function(o,l){var g=o==null?0:o.length,E=A0(o,l);return Kd(o,At(l,function(S){return Bn(S,g)?+S:S}).sort(np)),E});function r8(o,l){var g=[];if(!(o&&o.length))return g;var E=-1,S=[],$=o.length;for(l=Me(l,3);++E<$;){var U=o[E];l(U,E,o)&&(g.push(U),S.push(E))}return Kd(o,S),g}function el(o){return o==null?o:V2.call(o)}function n8(o,l,g){var E=o==null?0:o.length;return E?(g&&typeof g!="number"&&dr(o,l,g)?(l=0,g=E):(l=l==null?0:ze(l),g=g===t?E:ze(g)),Wr(o,l,g)):[]}function i8(o,l){return aa(o,l)}function s8(o,l,g){return R0(o,l,Me(g,2))}function o8(o,l){var g=o==null?0:o.length;if(g){var E=aa(o,l);if(E<g&&nn(o[E],l))return E}return-1}function a8(o,l){return aa(o,l,!0)}function u8(o,l,g){return R0(o,l,Me(g,2),!0)}function l8(o,l){var g=o==null?0:o.length;if(g){var E=aa(o,l,!0)-1;if(nn(o[E],l))return E}return-1}function c8(o){return o&&o.length?Vd(o):[]}function f8(o,l){return o&&o.length?Vd(o,Me(l,2)):[]}function h8(o){var l=o==null?0:o.length;return l?Wr(o,1,l):[]}function d8(o,l,g){return o&&o.length?(l=g||l===t?1:ze(l),Wr(o,0,l<0?0:l)):[]}function p8(o,l,g){var E=o==null?0:o.length;return E?(l=g||l===t?1:ze(l),l=E-l,Wr(o,l<0?0:l,E)):[]}function _8(o,l){return o&&o.length?ua(o,Me(l,3),!1,!0):[]}function v8(o,l){return o&&o.length?ua(o,Me(l,3)):[]}var g8=Ue(function(o){return Zn(er(o,1,$t,!0))}),m8=Ue(function(o){var l=Hr(o);return $t(l)&&(l=t),Zn(er(o,1,$t,!0),Me(l,2))}),x8=Ue(function(o){var l=Hr(o);return l=typeof l=="function"?l:t,Zn(er(o,1,$t,!0),t,l)});function y8(o){return o&&o.length?Zn(o):[]}function D8(o,l){return o&&o.length?Zn(o,Me(l,2)):[]}function w8(o,l){return l=typeof l=="function"?l:t,o&&o.length?Zn(o,t,l):[]}function tl(o){if(!(o&&o.length))return[];var l=0;return o=Wn(o,function(g){if($t(g))return l=jt(g.length,l),!0}),m0(l,function(g){return At(o,_0(g))})}function $p(o,l){if(!(o&&o.length))return[];var g=tl(o);return l==null?g:At(g,function(E){return Ar(l,t,E)})}var b8=Ue(function(o,l){return $t(o)?Ss(o,l):[]}),E8=Ue(function(o){return k0(Wn(o,$t))}),C8=Ue(function(o){var l=Hr(o);return $t(l)&&(l=t),k0(Wn(o,$t),Me(l,2))}),A8=Ue(function(o){var l=Hr(o);return l=typeof l=="function"?l:t,k0(Wn(o,$t),t,l)}),F8=Ue(tl);function B8(o,l){return Jd(o||[],l||[],Ns)}function M8(o,l){return Jd(o||[],l||[],Ts)}var N8=Ue(function(o){var l=o.length,g=l>1?o[l-1]:t;return g=typeof g=="function"?(o.pop(),g):t,$p(o,g)});function Lp(o){var l=T(o);return l.__chain__=!0,l}function S8(o,l){return l(o),o}function ga(o,l){return l(o)}var O8=Fn(function(o){var l=o.length,g=l?o[0]:0,E=this.__wrapped__,S=function($){return A0($,o)};return l>1||this.__actions__.length||!(E instanceof Ke)||!Bn(g)?this.thru(S):(E=E.slice(g,+g+(l?1:0)),E.__actions__.push({func:ga,args:[S],thisArg:t}),new qr(E,this.__chain__).thru(function($){return l&&!$.length&&$.push(t),$}))});function I8(){return Lp(this)}function T8(){return new qr(this.value(),this.__chain__)}function $8(){this.__values__===t&&(this.__values__=Gp(this.value()));var o=this.__index__>=this.__values__.length,l=o?t:this.__values__[this.__index__++];return{done:o,value:l}}function L8(){return this}function R8(o){for(var l,g=this;g instanceof ra;){var E=Mp(g);E.__index__=0,E.__values__=t,l?S.__wrapped__=E:l=E;var S=E;g=g.__wrapped__}return S.__wrapped__=o,l}function P8(){var o=this.__wrapped__;if(o instanceof Ke){var l=o;return this.__actions__.length&&(l=new Ke(this)),l=l.reverse(),l.__actions__.push({func:ga,args:[el],thisArg:t}),new qr(l,this.__chain__)}return this.thru(el)}function k8(){return Qd(this.__wrapped__,this.__actions__)}var z8=la(function(o,l,g){lt.call(o,g)?++o[g]:Cn(o,g,1)});function q8(o,l,g){var E=Pe(o)?fd:Sb;return g&&dr(o,l,g)&&(l=t),E(o,Me(l,3))}function U8(o,l){var g=Pe(o)?Wn:$d;return g(o,Me(l,3))}var W8=lp(Np),H8=lp(Sp);function j8(o,l){return er(ma(o,l),1)}function Y8(o,l){return er(ma(o,l),V)}function K8(o,l,g){return g=g===t?1:ze(g),er(ma(o,l),g)}function Rp(o,l){var g=Pe(o)?kr:Kn;return g(o,Me(l,3))}function Pp(o,l){var g=Pe(o)?h2:Td;return g(o,Me(l,3))}var Z8=la(function(o,l,g){lt.call(o,g)?o[g].push(l):Cn(o,g,[l])});function V8(o,l,g,E){o=yr(o)?o:is(o),g=g&&!E?ze(g):0;var S=o.length;return g<0&&(g=jt(S+g,0)),ba(o)?g<=S&&o.indexOf(l,g)>-1:!!S&&Yi(o,l,g)>-1}var G8=Ue(function(o,l,g){var E=-1,S=typeof l=="function",$=yr(o)?re(o.length):[];return Kn(o,function(U){$[++E]=S?Ar(l,U,g):Os(U,l,g)}),$}),X8=la(function(o,l,g){Cn(o,g,l)});function ma(o,l){var g=Pe(o)?At:qd;return g(o,Me(l,3))}function Q8(o,l,g,E){return o==null?[]:(Pe(l)||(l=l==null?[]:[l]),g=E?t:g,Pe(g)||(g=g==null?[]:[g]),jd(o,l,g))}var J8=la(function(o,l,g){o[g?0:1].push(l)},function(){return[[],[]]});function e4(o,l,g){var E=Pe(o)?d0:_d,S=arguments.length<3;return E(o,Me(l,4),g,S,Kn)}function t4(o,l,g){var E=Pe(o)?d2:_d,S=arguments.length<3;return E(o,Me(l,4),g,S,Td)}function r4(o,l){var g=Pe(o)?Wn:$d;return g(o,Da(Me(l,3)))}function n4(o){var l=Pe(o)?Nd:Vb;return l(o)}function i4(o,l,g){(g?dr(o,l,g):l===t)?l=1:l=ze(l);var E=Pe(o)?Ab:Gb;return E(o,l)}function s4(o){var l=Pe(o)?Fb:Qb;return l(o)}function o4(o){if(o==null)return 0;if(yr(o))return ba(o)?Zi(o):o.length;var l=or(o);return l==Le||l==Dt?o.size:O0(o).length}function a4(o,l,g){var E=Pe(o)?p0:Jb;return g&&dr(o,l,g)&&(l=t),E(o,Me(l,3))}var u4=Ue(function(o,l){if(o==null)return[];var g=l.length;return g>1&&dr(o,l[0],l[1])?l=[]:g>2&&dr(l[0],l[1],l[2])&&(l=[l[0]]),jd(o,er(l,1),[])}),xa=U2||function(){return Jt.Date.now()};function l4(o,l){if(typeof l!="function")throw new zr(a);return o=ze(o),function(){if(--o<1)return l.apply(this,arguments)}}function kp(o,l,g){return l=g?t:l,l=o&&l==null?o.length:l,An(o,B,t,t,t,t,l)}function zp(o,l){var g;if(typeof l!="function")throw new zr(a);return o=ze(o),function(){return--o>0&&(g=l.apply(this,arguments)),o<=1&&(l=t),g}}var rl=Ue(function(o,l,g){var E=y;if(g.length){var S=jn(g,rs(rl));E|=b}return An(o,E,l,g,S)}),qp=Ue(function(o,l,g){var E=y|m;if(g.length){var S=jn(g,rs(qp));E|=b}return An(l,E,o,g,S)});function Up(o,l,g){l=g?t:l;var E=An(o,D,t,t,t,t,t,l);return E.placeholder=Up.placeholder,E}function Wp(o,l,g){l=g?t:l;var E=An(o,C,t,t,t,t,t,l);return E.placeholder=Wp.placeholder,E}function Hp(o,l,g){var E,S,$,U,W,G,oe=0,ae=!1,ce=!1,ge=!0;if(typeof o!="function")throw new zr(a);l=jr(l)||0,Mt(g)&&(ae=!!g.leading,ce="maxWait"in g,$=ce?jt(jr(g.maxWait)||0,l):$,ge="trailing"in g?!!g.trailing:ge);function Ce(Lt){var sn=E,Sn=S;return E=S=t,oe=Lt,U=o.apply(Sn,sn),U}function Ne(Lt){return oe=Lt,W=Rs(He,l),ae?Ce(Lt):U}function qe(Lt){var sn=Lt-G,Sn=Lt-oe,l1=l-sn;return ce?sr(l1,$-Sn):l1}function Se(Lt){var sn=Lt-G,Sn=Lt-oe;return G===t||sn>=l||sn<0||ce&&Sn>=$}function He(){var Lt=xa();if(Se(Lt))return Ge(Lt);W=Rs(He,qe(Lt))}function Ge(Lt){return W=t,ge&&E?Ce(Lt):(E=S=t,U)}function Nr(){W!==t&&ep(W),oe=0,E=G=S=W=t}function pr(){return W===t?U:Ge(xa())}function Sr(){var Lt=xa(),sn=Se(Lt);if(E=arguments,S=this,G=Lt,sn){if(W===t)return Ne(G);if(ce)return ep(W),W=Rs(He,l),Ce(G)}return W===t&&(W=Rs(He,l)),U}return Sr.cancel=Nr,Sr.flush=pr,Sr}var c4=Ue(function(o,l){return Id(o,1,l)}),f4=Ue(function(o,l,g){return Id(o,jr(l)||0,g)});function h4(o){return An(o,O)}function ya(o,l){if(typeof o!="function"||l!=null&&typeof l!="function")throw new zr(a);var g=function(){var E=arguments,S=l?l.apply(this,E):E[0],$=g.cache;if($.has(S))return $.get(S);var U=o.apply(this,E);return g.cache=$.set(S,U)||$,U};return g.cache=new(ya.Cache||En),g}ya.Cache=En;function Da(o){if(typeof o!="function")throw new zr(a);return function(){var l=arguments;switch(l.length){case 0:return!o.call(this);case 1:return!o.call(this,l[0]);case 2:return!o.call(this,l[0],l[1]);case 3:return!o.call(this,l[0],l[1],l[2])}return!o.apply(this,l)}}function d4(o){return zp(2,o)}var p4=eE(function(o,l){l=l.length==1&&Pe(l[0])?At(l[0],Fr(Me())):At(er(l,1),Fr(Me()));var g=l.length;return Ue(function(E){for(var S=-1,$=sr(E.length,g);++S<$;)E[S]=l[S].call(this,E[S]);return Ar(o,this,E)})}),nl=Ue(function(o,l){var g=jn(l,rs(nl));return An(o,b,t,l,g)}),jp=Ue(function(o,l){var g=jn(l,rs(jp));return An(o,F,t,l,g)}),_4=Fn(function(o,l){return An(o,M,t,t,t,l)});function v4(o,l){if(typeof o!="function")throw new zr(a);return l=l===t?l:ze(l),Ue(o,l)}function g4(o,l){if(typeof o!="function")throw new zr(a);return l=l==null?0:jt(ze(l),0),Ue(function(g){var E=g[l],S=Gn(g,0,l);return E&&Hn(S,E),Ar(o,this,S)})}function m4(o,l,g){var E=!0,S=!0;if(typeof o!="function")throw new zr(a);return Mt(g)&&(E="leading"in g?!!g.leading:E,S="trailing"in g?!!g.trailing:S),Hp(o,l,{leading:E,maxWait:l,trailing:S})}function x4(o){return kp(o,1)}function y4(o,l){return nl(q0(l),o)}function D4(){if(!arguments.length)return[];var o=arguments[0];return Pe(o)?o:[o]}function w4(o){return Ur(o,v)}function b4(o,l){return l=typeof l=="function"?l:t,Ur(o,v,l)}function E4(o){return Ur(o,d|v)}function C4(o,l){return l=typeof l=="function"?l:t,Ur(o,d|v,l)}function A4(o,l){return l==null||Od(o,l,Kt(l))}function nn(o,l){return o===l||o!==o&&l!==l}var F4=da(M0),B4=da(function(o,l){return o>=l}),xi=Pd(function(){return arguments}())?Pd:function(o){return St(o)&&lt.call(o,"callee")&&!Ed.call(o,"callee")},Pe=re.isArray,M4=sd?Fr(sd):Rb;function yr(o){return o!=null&&wa(o.length)&&!Mn(o)}function $t(o){return St(o)&&yr(o)}function N4(o){return o===!0||o===!1||St(o)&&hr(o)==be}var Xn=H2||pl,S4=od?Fr(od):Pb;function O4(o){return St(o)&&o.nodeType===1&&!Ps(o)}function I4(o){if(o==null)return!0;if(yr(o)&&(Pe(o)||typeof o=="string"||typeof o.splice=="function"||Xn(o)||ns(o)||xi(o)))return!o.length;var l=or(o);if(l==Le||l==Dt)return!o.size;if(Ls(o))return!O0(o).length;for(var g in o)if(lt.call(o,g))return!1;return!0}function T4(o,l){return Is(o,l)}function $4(o,l,g){g=typeof g=="function"?g:t;var E=g?g(o,l):t;return E===t?Is(o,l,t,g):!!E}function il(o){if(!St(o))return!1;var l=hr(o);return l==nt||l==Fe||typeof o.message=="string"&&typeof o.name=="string"&&!Ps(o)}function L4(o){return typeof o=="number"&&Ad(o)}function Mn(o){if(!Mt(o))return!1;var l=hr(o);return l==Ye||l==Ie||l==we||l==Rr}function Yp(o){return typeof o=="number"&&o==ze(o)}function wa(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=H}function Mt(o){var l=typeof o;return o!=null&&(l=="object"||l=="function")}function St(o){return o!=null&&typeof o=="object"}var Kp=ad?Fr(ad):zb;function R4(o,l){return o===l||S0(o,l,Z0(l))}function P4(o,l,g){return g=typeof g=="function"?g:t,S0(o,l,Z0(l),g)}function k4(o){return Zp(o)&&o!=+o}function z4(o){if(bE(o))throw new Re(i);return kd(o)}function q4(o){return o===null}function U4(o){return o==null}function Zp(o){return typeof o=="number"||St(o)&&hr(o)==yt}function Ps(o){if(!St(o)||hr(o)!=Ct)return!1;var l=Vo(o);if(l===null)return!0;var g=lt.call(l,"constructor")&&l.constructor;return typeof g=="function"&&g instanceof g&&jo.call(g)==P2}var sl=ud?Fr(ud):qb;function W4(o){return Yp(o)&&o>=-H&&o<=H}var Vp=ld?Fr(ld):Ub;function ba(o){return typeof o=="string"||!Pe(o)&&St(o)&&hr(o)==It}function Mr(o){return typeof o=="symbol"||St(o)&&hr(o)==P}var ns=cd?Fr(cd):Wb;function H4(o){return o===t}function j4(o){return St(o)&&or(o)==J}function Y4(o){return St(o)&&hr(o)==ie}var K4=da(I0),Z4=da(function(o,l){return o<=l});function Gp(o){if(!o)return[];if(yr(o))return ba(o)?tn(o):xr(o);if(Cs&&o[Cs])return A2(o[Cs]());var l=or(o),g=l==Le?y0:l==Dt?Uo:is;return g(o)}function Nn(o){if(!o)return o===0?o:0;if(o=jr(o),o===V||o===-V){var l=o<0?-1:1;return l*ee}return o===o?o:0}function ze(o){var l=Nn(o),g=l%1;return l===l?g?l-g:l:0}function Xp(o){return o?_i(ze(o),0,j):0}function jr(o){if(typeof o=="number")return o;if(Mr(o))return te;if(Mt(o)){var l=typeof o.valueOf=="function"?o.valueOf():o;o=Mt(l)?l+"":l}if(typeof o!="string")return o===0?o:+o;o=vd(o);var g=Ju.test(o);return g||t0.test(o)?l2(o.slice(2),g?2:8):Qu.test(o)?te:+o}function Qp(o){return hn(o,Dr(o))}function V4(o){return o?_i(ze(o),-H,H):o===0?o:0}function at(o){return o==null?"":Br(o)}var G4=es(function(o,l){if(Ls(l)||yr(l)){hn(l,Kt(l),o);return}for(var g in l)lt.call(l,g)&&Ns(o,g,l[g])}),Jp=es(function(o,l){hn(l,Dr(l),o)}),Ea=es(function(o,l,g,E){hn(l,Dr(l),o,E)}),X4=es(function(o,l,g,E){hn(l,Kt(l),o,E)}),Q4=Fn(A0);function J4(o,l){var g=Ji(o);return l==null?g:Sd(g,l)}var eC=Ue(function(o,l){o=pt(o);var g=-1,E=l.length,S=E>2?l[2]:t;for(S&&dr(l[0],l[1],S)&&(E=1);++g<E;)for(var $=l[g],U=Dr($),W=-1,G=U.length;++W<G;){var oe=U[W],ae=o[oe];(ae===t||nn(ae,Gi[oe])&&!lt.call(o,oe))&&(o[oe]=$[oe])}return o}),tC=Ue(function(o){return o.push(t,vp),Ar(e1,t,o)});function rC(o,l){return hd(o,Me(l,3),fn)}function nC(o,l){return hd(o,Me(l,3),B0)}function iC(o,l){return o==null?o:F0(o,Me(l,3),Dr)}function sC(o,l){return o==null?o:Ld(o,Me(l,3),Dr)}function oC(o,l){return o&&fn(o,Me(l,3))}function aC(o,l){return o&&B0(o,Me(l,3))}function uC(o){return o==null?[]:sa(o,Kt(o))}function lC(o){return o==null?[]:sa(o,Dr(o))}function ol(o,l,g){var E=o==null?t:vi(o,l);return E===t?g:E}function cC(o,l){return o!=null&&xp(o,l,Ib)}function al(o,l){return o!=null&&xp(o,l,Tb)}var fC=fp(function(o,l,g){l!=null&&typeof l.toString!="function"&&(l=Yo.call(l)),o[l]=g},ll(wr)),hC=fp(function(o,l,g){l!=null&&typeof l.toString!="function"&&(l=Yo.call(l)),lt.call(o,l)?o[l].push(g):o[l]=[g]},Me),dC=Ue(Os);function Kt(o){return yr(o)?Md(o):O0(o)}function Dr(o){return yr(o)?Md(o,!0):Hb(o)}function pC(o,l){var g={};return l=Me(l,3),fn(o,function(E,S,$){Cn(g,l(E,S,$),E)}),g}function _C(o,l){var g={};return l=Me(l,3),fn(o,function(E,S,$){Cn(g,S,l(E,S,$))}),g}var vC=es(function(o,l,g){oa(o,l,g)}),e1=es(function(o,l,g,E){oa(o,l,g,E)}),gC=Fn(function(o,l){var g={};if(o==null)return g;var E=!1;l=At(l,function($){return $=Vn($,o),E||(E=$.length>1),$}),hn(o,Y0(o),g),E&&(g=Ur(g,d|p|v,fE));for(var S=l.length;S--;)P0(g,l[S]);return g});function mC(o,l){return t1(o,Da(Me(l)))}var xC=Fn(function(o,l){return o==null?{}:Yb(o,l)});function t1(o,l){if(o==null)return{};var g=At(Y0(o),function(E){return[E]});return l=Me(l),Yd(o,g,function(E,S){return l(E,S[0])})}function yC(o,l,g){l=Vn(l,o);var E=-1,S=l.length;for(S||(S=1,o=t);++E<S;){var $=o==null?t:o[dn(l[E])];$===t&&(E=S,$=g),o=Mn($)?$.call(o):$}return o}function DC(o,l,g){return o==null?o:Ts(o,l,g)}function wC(o,l,g,E){return E=typeof E=="function"?E:t,o==null?o:Ts(o,l,g,E)}var r1=pp(Kt),n1=pp(Dr);function bC(o,l,g){var E=Pe(o),S=E||Xn(o)||ns(o);if(l=Me(l,4),g==null){var $=o&&o.constructor;S?g=E?new $:[]:Mt(o)?g=Mn($)?Ji(Vo(o)):{}:g={}}return(S?kr:fn)(o,function(U,W,G){return l(g,U,W,G)}),g}function EC(o,l){return o==null?!0:P0(o,l)}function CC(o,l,g){return o==null?o:Xd(o,l,q0(g))}function AC(o,l,g,E){return E=typeof E=="function"?E:t,o==null?o:Xd(o,l,q0(g),E)}function is(o){return o==null?[]:x0(o,Kt(o))}function FC(o){return o==null?[]:x0(o,Dr(o))}function BC(o,l,g){return g===t&&(g=l,l=t),g!==t&&(g=jr(g),g=g===g?g:0),l!==t&&(l=jr(l),l=l===l?l:0),_i(jr(o),l,g)}function MC(o,l,g){return l=Nn(l),g===t?(g=l,l=0):g=Nn(g),o=jr(o),$b(o,l,g)}function NC(o,l,g){if(g&&typeof g!="boolean"&&dr(o,l,g)&&(l=g=t),g===t&&(typeof l=="boolean"?(g=l,l=t):typeof o=="boolean"&&(g=o,o=t)),o===t&&l===t?(o=0,l=1):(o=Nn(o),l===t?(l=o,o=0):l=Nn(l)),o>l){var E=o;o=l,l=E}if(g||o%1||l%1){var S=Fd();return sr(o+S*(l-o+u2("1e-"+((S+"").length-1))),l)}return $0(o,l)}var SC=ts(function(o,l,g){return l=l.toLowerCase(),o+(g?i1(l):l)});function i1(o){return ul(at(o).toLowerCase())}function s1(o){return o=at(o),o&&o.replace(n0,D2).replace(Qw,"")}function OC(o,l,g){o=at(o),l=Br(l);var E=o.length;g=g===t?E:_i(ze(g),0,E);var S=g;return g-=l.length,g>=0&&o.slice(g,S)==l}function IC(o){return o=at(o),o&&xs.test(o)?o.replace(li,w2):o}function TC(o){return o=at(o),o&&Qt.test(o)?o.replace(qn,"\\$&"):o}var $C=ts(function(o,l,g){return o+(g?"-":"")+l.toLowerCase()}),LC=ts(function(o,l,g){return o+(g?" ":"")+l.toLowerCase()}),RC=up("toLowerCase");function PC(o,l,g){o=at(o),l=ze(l);var E=l?Zi(o):0;if(!l||E>=l)return o;var S=(l-E)/2;return ha(Jo(S),g)+o+ha(Qo(S),g)}function kC(o,l,g){o=at(o),l=ze(l);var E=l?Zi(o):0;return l&&E<l?o+ha(l-E,g):o}function zC(o,l,g){o=at(o),l=ze(l);var E=l?Zi(o):0;return l&&E<l?ha(l-E,g)+o:o}function qC(o,l,g){return g||l==null?l=0:l&&(l=+l),Z2(at(o).replace(mr,""),l||0)}function UC(o,l,g){return(g?dr(o,l,g):l===t)?l=1:l=ze(l),L0(at(o),l)}function WC(){var o=arguments,l=at(o[0]);return o.length<3?l:l.replace(o[1],o[2])}var HC=ts(function(o,l,g){return o+(g?"_":"")+l.toLowerCase()});function jC(o,l,g){return g&&typeof g!="number"&&dr(o,l,g)&&(l=g=t),g=g===t?j:g>>>0,g?(o=at(o),o&&(typeof l=="string"||l!=null&&!sl(l))&&(l=Br(l),!l&&Ki(o))?Gn(tn(o),0,g):o.split(l,g)):[]}var YC=ts(function(o,l,g){return o+(g?" ":"")+ul(l)});function KC(o,l,g){return o=at(o),g=g==null?0:_i(ze(g),0,o.length),l=Br(l),o.slice(g,g+l.length)==l}function ZC(o,l,g){var E=T.templateSettings;g&&dr(o,l,g)&&(l=t),o=at(o),l=Ea({},l,E,_p);var S=Ea({},l.imports,E.imports,_p),$=Kt(S),U=x0(S,$),W,G,oe=0,ae=l.interpolate||Wi,ce="__p += '",ge=D0((l.escape||Wi).source+"|"+ae.source+"|"+(ae===zi?Xu:Wi).source+"|"+(l.evaluate||Wi).source+"|$","g"),Ce="//# sourceURL="+(lt.call(l,"sourceURL")?(l.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++n2+"]")+`
11
+ `;o.replace(ge,function(Se,He,Ge,Nr,pr,Sr){return Ge||(Ge=Nr),ce+=o.slice(oe,Sr).replace(ci,b2),He&&(W=!0,ce+=`' +
12
12
  __e(`+He+`) +
13
13
  '`),pr&&(G=!0,ce+=`';
14
14
  `+pr+`;
@@ -24,42 +24,42 @@ __p += '`),Ge&&(ce+=`' +
24
24
  function print() { __p += __j.call(arguments, '') }
25
25
  `:`;
26
26
  `)+ce+`return __p
27
- }`;var qe=a1(function(){return st($,Ae+"return "+ce).apply(t,q)});if(qe.source=ce,il(qe))throw qe;return qe}function VA(o){return at(o).toLowerCase()}function GA(o){return at(o).toUpperCase()}function XA(o,l,g){if(o=at(o),o&&(g||l===t))return vd(o);if(!o||!(l=Br(l)))return o;var b=tn(o),S=tn(l),$=gd(b,S),q=md(b,S)+1;return Gn(b,$,q).join("")}function QA(o,l,g){if(o=at(o),o&&(g||l===t))return o.slice(0,yd(o)+1);if(!o||!(l=Br(l)))return o;var b=tn(o),S=md(b,tn(l))+1;return Gn(b,0,S).join("")}function JA(o,l,g){if(o=at(o),o&&(g||l===t))return o.replace(mr,"");if(!o||!(l=Br(l)))return o;var b=tn(o),S=gd(b,tn(l));return Gn(b,S).join("")}function eC(o,l){var g=C,b=N;if(Mt(l)){var S="separator"in l?l.separator:S;g="length"in l?ze(l.length):g,b="omission"in l?Br(l.omission):b}o=at(o);var $=o.length;if(Ki(o)){var q=tn(o);$=q.length}if(g>=$)return o;var W=g-Zi(b);if(W<1)return b;var G=q?Gn(q,0,W).join(""):o.slice(0,W);if(S===t)return G+b;if(q&&(W+=G.length-W),sl(S)){if(o.slice(W).search(S)){var oe,ae=G;for(S.global||(S=D0(S.source,at(Ro.exec(S))+"g")),S.lastIndex=0;oe=S.exec(ae);)var ce=oe.index;G=G.slice(0,ce===t?W:ce)}}else if(o.indexOf(Br(S),W)!=W){var ge=G.lastIndexOf(S);ge>-1&&(G=G.slice(0,ge))}return G+b}function tC(o){return o=at(o),o&&ms.test(o)?o.replace(wn,N2):o}var rC=ts(function(o,l,g){return o+(g?" ":"")+l.toUpperCase()}),ul=up("toUpperCase");function o1(o,l,g){return o=at(o),l=g?t:l,l===t?A2(o)?I2(o):v2(o):o.match(l)||[]}var a1=Ue(function(o,l){try{return Cr(o,t,l)}catch(g){return il(g)?g:new Re(g)}}),nC=Fn(function(o,l){return kr(l,function(g){g=dn(g),An(o,g,rl(o[g],o))}),o});function iC(o){var l=o==null?0:o.length,g=Me();return o=l?Ct(o,function(b){if(typeof b[1]!="function")throw new zr(a);return[g(b[0]),b[1]]}):[],Ue(function(b){for(var S=-1;++S<l;){var $=o[S];if(Cr($[0],this,b))return Cr($[1],this,b)}})}function sC(o){return NE(Ur(o,d))}function ll(o){return function(){return o}}function oC(o,l){return o==null||o!==o?l:o}var aC=cp(),uC=cp(!0);function wr(o){return o}function cl(o){return zd(typeof o=="function"?o:Ur(o,d))}function lC(o){return Ud(Ur(o,d))}function cC(o,l){return Wd(o,Ur(l,d))}var fC=Ue(function(o,l){return function(g){return Os(g,o,l)}}),hC=Ue(function(o,l){return function(g){return Os(o,g,l)}});function fl(o,l,g){var b=Kt(l),S=sa(l,b);g==null&&!(Mt(l)&&(S.length||!b.length))&&(g=l,l=o,o=this,S=sa(l,Kt(l)));var $=!(Mt(g)&&"chain"in g)||!!g.chain,q=Mn(o);return kr(S,function(W){var G=l[W];o[W]=G,q&&(o.prototype[W]=function(){var oe=this.__chain__;if($||oe){var ae=o(this.__wrapped__),ce=ae.__actions__=xr(this.__actions__);return ce.push({func:G,args:arguments,thisArg:o}),ae.__chain__=oe,ae}return G.apply(o,Hn([this.value()],arguments))})}),o}function dC(){return Jt._===this&&(Jt._=k2),this}function hl(){}function pC(o){return o=ze(o),Ue(function(l){return Hd(l,o)})}var _C=W0(Ct),vC=W0(fd),gC=W0(p0);function u1(o){return G0(o)?_0(dn(o)):KE(o)}function mC(o){return function(l){return o==null?t:vi(o,l)}}var xC=hp(),yC=hp(!0);function dl(){return[]}function pl(){return!1}function DC(){return{}}function wC(){return""}function EC(){return!0}function bC(o,l){if(o=ze(o),o<1||o>H)return[];var g=j,b=sr(o,j);l=Me(l),o-=j;for(var S=m0(b,l);++g<o;)l(g);return S}function AC(o){return Pe(o)?Ct(o,dn):Mr(o)?[o]:xr(Bp(at(o)))}function CC(o){var l=++R2;return at(o)+l}var FC=fa(function(o,l){return o+l},0),BC=H0("ceil"),MC=fa(function(o,l){return o/l},1),NC=H0("floor");function SC(o){return o&&o.length?ia(o,wr,M0):t}function OC(o,l){return o&&o.length?ia(o,Me(l,2),M0):t}function IC(o){return pd(o,wr)}function TC(o,l){return pd(o,Me(l,2))}function $C(o){return o&&o.length?ia(o,wr,I0):t}function LC(o,l){return o&&o.length?ia(o,Me(l,2),I0):t}var RC=fa(function(o,l){return o*l},1),PC=H0("round"),kC=fa(function(o,l){return o-l},0);function zC(o){return o&&o.length?g0(o,wr):0}function qC(o,l){return o&&o.length?g0(o,Me(l,2)):0}return T.after=l4,T.ary=kp,T.assign=G4,T.assignIn=Jp,T.assignInWith=ba,T.assignWith=X4,T.at=Q4,T.before=zp,T.bind=rl,T.bindAll=nC,T.bindKey=qp,T.castArray=D4,T.chain=Lp,T.chunk=Nb,T.compact=Sb,T.concat=Ob,T.cond=iC,T.conforms=sC,T.constant=ll,T.countBy=z8,T.create=J4,T.curry=Up,T.curryRight=Wp,T.debounce=Hp,T.defaults=eA,T.defaultsDeep=tA,T.defer=c4,T.delay=f4,T.difference=Ib,T.differenceBy=Tb,T.differenceWith=$b,T.drop=Lb,T.dropRight=Rb,T.dropRightWhile=Pb,T.dropWhile=kb,T.fill=zb,T.filter=U8,T.flatMap=j8,T.flatMapDeep=Y8,T.flatMapDepth=K8,T.flatten=Op,T.flattenDeep=qb,T.flattenDepth=Ub,T.flip=h4,T.flow=aC,T.flowRight=uC,T.fromPairs=Wb,T.functions=uA,T.functionsIn=lA,T.groupBy=Z8,T.initial=jb,T.intersection=Yb,T.intersectionBy=Kb,T.intersectionWith=Zb,T.invert=fA,T.invertBy=hA,T.invokeMap=G8,T.iteratee=cl,T.keyBy=X8,T.keys=Kt,T.keysIn=Dr,T.map=ma,T.mapKeys=pA,T.mapValues=_A,T.matches=lC,T.matchesProperty=cC,T.memoize=ya,T.merge=vA,T.mergeWith=e1,T.method=fC,T.methodOf=hC,T.mixin=fl,T.negate=Da,T.nthArg=pC,T.omit=gA,T.omitBy=mA,T.once=d4,T.orderBy=Q8,T.over=_C,T.overArgs=p4,T.overEvery=vC,T.overSome=gC,T.partial=nl,T.partialRight=jp,T.partition=J8,T.pick=xA,T.pickBy=t1,T.property=u1,T.propertyOf=mC,T.pull=Qb,T.pullAll=Tp,T.pullAllBy=Jb,T.pullAllWith=e8,T.pullAt=t8,T.range=xC,T.rangeRight=yC,T.rearg=_4,T.reject=r4,T.remove=r8,T.rest=v4,T.reverse=el,T.sampleSize=i4,T.set=DA,T.setWith=wA,T.shuffle=s4,T.slice=n8,T.sortBy=u4,T.sortedUniq=c8,T.sortedUniqBy=f8,T.split=jA,T.spread=g4,T.tail=h8,T.take=d8,T.takeRight=p8,T.takeRightWhile=_8,T.takeWhile=v8,T.tap=S8,T.throttle=m4,T.thru=ga,T.toArray=Gp,T.toPairs=r1,T.toPairsIn=n1,T.toPath=AC,T.toPlainObject=Qp,T.transform=EA,T.unary=x4,T.union=g8,T.unionBy=m8,T.unionWith=x8,T.uniq=y8,T.uniqBy=D8,T.uniqWith=w8,T.unset=bA,T.unzip=tl,T.unzipWith=$p,T.update=AA,T.updateWith=CA,T.values=is,T.valuesIn=FA,T.without=E8,T.words=o1,T.wrap=y4,T.xor=b8,T.xorBy=A8,T.xorWith=C8,T.zip=F8,T.zipObject=B8,T.zipObjectDeep=M8,T.zipWith=N8,T.entries=r1,T.entriesIn=n1,T.extend=Jp,T.extendWith=ba,fl(T,T),T.add=FC,T.attempt=a1,T.camelCase=SA,T.capitalize=i1,T.ceil=BC,T.clamp=BA,T.clone=w4,T.cloneDeep=b4,T.cloneDeepWith=A4,T.cloneWith=E4,T.conformsTo=C4,T.deburr=s1,T.defaultTo=oC,T.divide=MC,T.endsWith=OA,T.eq=nn,T.escape=IA,T.escapeRegExp=TA,T.every=q8,T.find=W8,T.findIndex=Np,T.findKey=rA,T.findLast=H8,T.findLastIndex=Sp,T.findLastKey=nA,T.floor=NC,T.forEach=Rp,T.forEachRight=Pp,T.forIn=iA,T.forInRight=sA,T.forOwn=oA,T.forOwnRight=aA,T.get=ol,T.gt=F4,T.gte=B4,T.has=cA,T.hasIn=al,T.head=Ip,T.identity=wr,T.includes=V8,T.indexOf=Hb,T.inRange=MA,T.invoke=dA,T.isArguments=xi,T.isArray=Pe,T.isArrayBuffer=M4,T.isArrayLike=yr,T.isArrayLikeObject=$t,T.isBoolean=N4,T.isBuffer=Xn,T.isDate=S4,T.isElement=O4,T.isEmpty=I4,T.isEqual=T4,T.isEqualWith=$4,T.isError=il,T.isFinite=L4,T.isFunction=Mn,T.isInteger=Yp,T.isLength=wa,T.isMap=Kp,T.isMatch=R4,T.isMatchWith=P4,T.isNaN=k4,T.isNative=z4,T.isNil=U4,T.isNull=q4,T.isNumber=Zp,T.isObject=Mt,T.isObjectLike=St,T.isPlainObject=Ps,T.isRegExp=sl,T.isSafeInteger=W4,T.isSet=Vp,T.isString=Ea,T.isSymbol=Mr,T.isTypedArray=ns,T.isUndefined=H4,T.isWeakMap=j4,T.isWeakSet=Y4,T.join=Vb,T.kebabCase=$A,T.last=Hr,T.lastIndexOf=Gb,T.lowerCase=LA,T.lowerFirst=RA,T.lt=K4,T.lte=Z4,T.max=SC,T.maxBy=OC,T.mean=IC,T.meanBy=TC,T.min=$C,T.minBy=LC,T.stubArray=dl,T.stubFalse=pl,T.stubObject=DC,T.stubString=wC,T.stubTrue=EC,T.multiply=RC,T.nth=Xb,T.noConflict=dC,T.noop=hl,T.now=xa,T.pad=PA,T.padEnd=kA,T.padStart=zA,T.parseInt=qA,T.random=NA,T.reduce=e4,T.reduceRight=t4,T.repeat=UA,T.replace=WA,T.result=yA,T.round=PC,T.runInContext=K,T.sample=n4,T.size=o4,T.snakeCase=HA,T.some=a4,T.sortedIndex=i8,T.sortedIndexBy=s8,T.sortedIndexOf=o8,T.sortedLastIndex=a8,T.sortedLastIndexBy=u8,T.sortedLastIndexOf=l8,T.startCase=YA,T.startsWith=KA,T.subtract=kC,T.sum=zC,T.sumBy=qC,T.template=ZA,T.times=bC,T.toFinite=Nn,T.toInteger=ze,T.toLength=Xp,T.toLower=VA,T.toNumber=jr,T.toSafeInteger=V4,T.toString=at,T.toUpper=GA,T.trim=XA,T.trimEnd=QA,T.trimStart=JA,T.truncate=eC,T.unescape=tC,T.uniqueId=CC,T.upperCase=rC,T.upperFirst=ul,T.each=Rp,T.eachRight=Pp,T.first=Ip,fl(T,function(){var o={};return fn(T,function(l,g){lt.call(T.prototype,g)||(o[g]=l)}),o}(),{chain:!1}),T.VERSION=r,kr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){T[o].placeholder=T}),kr(["drop","take"],function(o,l){Ke.prototype[o]=function(g){g=g===t?1:jt(ze(g),0);var b=this.__filtered__&&!l?new Ke(this):this.clone();return b.__filtered__?b.__takeCount__=sr(g,b.__takeCount__):b.__views__.push({size:sr(g,j),type:o+(b.__dir__<0?"Right":"")}),b},Ke.prototype[o+"Right"]=function(g){return this.reverse()[o](g).reverse()}}),kr(["filter","map","takeWhile"],function(o,l){var g=l+1,b=g==k||g==R;Ke.prototype[o]=function(S){var $=this.clone();return $.__iteratees__.push({iteratee:Me(S,3),type:g}),$.__filtered__=$.__filtered__||b,$}}),kr(["head","last"],function(o,l){var g="take"+(l?"Right":"");Ke.prototype[o]=function(){return this[g](1).value()[0]}}),kr(["initial","tail"],function(o,l){var g="drop"+(l?"":"Right");Ke.prototype[o]=function(){return this.__filtered__?new Ke(this):this[g](1)}}),Ke.prototype.compact=function(){return this.filter(wr)},Ke.prototype.find=function(o){return this.filter(o).head()},Ke.prototype.findLast=function(o){return this.reverse().find(o)},Ke.prototype.invokeMap=Ue(function(o,l){return typeof o=="function"?new Ke(this):this.map(function(g){return Os(g,o,l)})}),Ke.prototype.reject=function(o){return this.filter(Da(Me(o)))},Ke.prototype.slice=function(o,l){o=ze(o);var g=this;return g.__filtered__&&(o>0||l<0)?new Ke(g):(o<0?g=g.takeRight(-o):o&&(g=g.drop(o)),l!==t&&(l=ze(l),g=l<0?g.dropRight(-l):g.take(l-o)),g)},Ke.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},Ke.prototype.toArray=function(){return this.take(j)},fn(Ke.prototype,function(o,l){var g=/^(?:filter|find|map|reject)|While$/.test(l),b=/^(?:head|last)$/.test(l),S=T[b?"take"+(l=="last"?"Right":""):l],$=b||/^find/.test(l);S&&(T.prototype[l]=function(){var q=this.__wrapped__,W=b?[1]:arguments,G=q instanceof Ke,oe=W[0],ae=G||Pe(q),ce=function(He){var Ge=S.apply(T,Hn([He],W));return b&&ge?Ge[0]:Ge};ae&&g&&typeof oe=="function"&&oe.length!=1&&(G=ae=!1);var ge=this.__chain__,Ae=!!this.__actions__.length,Ne=$&&!ge,qe=G&&!Ae;if(!$&&ae){q=qe?q:new Ke(this);var Se=o.apply(q,W);return Se.__actions__.push({func:ga,args:[ce],thisArg:t}),new qr(Se,ge)}return Ne&&qe?o.apply(this,W):(Se=this.thru(ce),Ne?b?Se.value()[0]:Se.value():Se)})}),kr(["pop","push","shift","sort","splice","unshift"],function(o){var l=Wo[o],g=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",b=/^(?:pop|shift)$/.test(o);T.prototype[o]=function(){var S=arguments;if(b&&!this.__chain__){var $=this.value();return l.apply(Pe($)?$:[],S)}return this[g](function(q){return l.apply(Pe(q)?q:[],S)})}}),fn(Ke.prototype,function(o,l){var g=T[l];if(g){var b=g.name+"";lt.call(Qi,b)||(Qi[b]=[]),Qi[b].push({name:l,func:g})}}),Qi[ca(t,m).name]=[{name:"wrapper",func:t}],Ke.prototype.clone=tE,Ke.prototype.reverse=rE,Ke.prototype.value=nE,T.prototype.at=O8,T.prototype.chain=I8,T.prototype.commit=T8,T.prototype.next=$8,T.prototype.plant=R8,T.prototype.reverse=P8,T.prototype.toJSON=T.prototype.valueOf=T.prototype.value=k8,T.prototype.first=T.prototype.head,As&&(T.prototype[As]=L8),T},Vi=T2();fi?((fi.exports=Vi)._=Vi,c0._=Vi):Jt._=Vi}).call(ye)}(Qn,Qn.exports);var Yr=Qn.exports;class c1{constructor(e,t){U(this,"_defaultParams");U(this,"_UserTypeFileds");U(this,"_varipKeys");this._defaultParams=e,this._UserTypeFileds=this._createDynamicClass(),this._varipKeys=t}copy(e){return Yr.cloneDeep(e)}new(e={}){return new this._UserTypeFileds(Object.assign(Yr.cloneDeep(this._defaultParams),e),this._varipKeys)}addNewMethod(e,t){this._UserTypeFileds.prototype[e]=t}_createDynamicClass(){return class{constructor(e,t){U(this,"_varipKeys");Object.assign(this,e),this._varipKeys=t}get varipKeys(){return[...this._varipKeys]}copy(){return Yr.cloneDeep(this)}}}}var xl={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(ye,function(){var t=1e3,r=6e4,n=36e5,i="millisecond",a="second",u="minute",f="hour",c="day",h="week",d="month",p="quarter",v="year",x="date",_="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,w={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(k){var z=["th","st","nd","rd"],R=k%100;return"["+k+(z[(R-20)%10]||z[R]||z[0])+"]"}},D=function(k,z,R){var V=String(k);return!V||V.length>=z?k:""+Array(z+1-V.length).join(R)+k},A={s:D,z:function(k){var z=-k.utcOffset(),R=Math.abs(z),V=Math.floor(R/60),H=R%60;return(z<=0?"+":"-")+D(V,2,"0")+":"+D(H,2,"0")},m:function k(z,R){if(z.date()<R.date())return-k(R,z);var V=12*(R.year()-z.year())+(R.month()-z.month()),H=z.clone().add(V,d),ee=R-H<0,te=z.clone().add(V+(ee?-1:1),d);return+(-(V+(R-H)/(ee?H-te:te-H))||0)},a:function(k){return k<0?Math.ceil(k)||0:Math.floor(k)},p:function(k){return{M:d,y:v,w:h,d:c,D:x,h:f,m:u,s:a,ms:i,Q:p}[k]||String(k||"").toLowerCase().replace(/s$/,"")},u:function(k){return k===void 0}},E="en",F={};F[E]=w;var B="$isDayjsObject",M=function(k){return k instanceof I||!(!k||!k[B])},O=function k(z,R,V){var H;if(!z)return E;if(typeof z=="string"){var ee=z.toLowerCase();F[ee]&&(H=ee),R&&(F[ee]=R,H=ee);var te=z.split("-");if(!H&&te.length>1)return k(te[0])}else{var j=z.name;F[j]=z,H=j}return!V&&H&&(E=H),H||!V&&E},C=function(k,z){if(M(k))return k.clone();var R=typeof z=="object"?z:{};return R.date=k,R.args=arguments,new I(R)},N=A;N.l=O,N.i=M,N.w=function(k,z){return C(k,{locale:z.$L,utc:z.$u,x:z.$x,$offset:z.$offset})};var I=function(){function k(R){this.$L=O(R.locale,null,!0),this.parse(R),this.$x=this.$x||R.x||{},this[B]=!0}var z=k.prototype;return z.parse=function(R){this.$d=function(V){var H=V.date,ee=V.utc;if(H===null)return new Date(NaN);if(N.u(H))return new Date;if(H instanceof Date)return new Date(H);if(typeof H=="string"&&!/Z$/i.test(H)){var te=H.match(y);if(te){var j=te[2]-1||0,X=(te[7]||"0").substring(0,3);return ee?new Date(Date.UTC(te[1],j,te[3]||1,te[4]||0,te[5]||0,te[6]||0,X)):new Date(te[1],j,te[3]||1,te[4]||0,te[5]||0,te[6]||0,X)}}return new Date(H)}(R),this.init()},z.init=function(){var R=this.$d;this.$y=R.getFullYear(),this.$M=R.getMonth(),this.$D=R.getDate(),this.$W=R.getDay(),this.$H=R.getHours(),this.$m=R.getMinutes(),this.$s=R.getSeconds(),this.$ms=R.getMilliseconds()},z.$utils=function(){return N},z.isValid=function(){return this.$d.toString()!==_},z.isSame=function(R,V){var H=C(R);return this.startOf(V)<=H&&H<=this.endOf(V)},z.isAfter=function(R,V){return C(R)<this.startOf(V)},z.isBefore=function(R,V){return this.endOf(V)<C(R)},z.$g=function(R,V,H){return N.u(R)?this[V]:this.set(H,R)},z.unix=function(){return Math.floor(this.valueOf()/1e3)},z.valueOf=function(){return this.$d.getTime()},z.startOf=function(R,V){var H=this,ee=!!N.u(V)||V,te=N.p(R),j=function(Oe,Fe){var nt=N.w(H.$u?Date.UTC(H.$y,Fe,Oe):new Date(H.$y,Fe,Oe),H);return ee?nt:nt.endOf(c)},X=function(Oe,Fe){return N.w(H.toDate()[Oe].apply(H.toDate("s"),(ee?[0,0,0,0]:[23,59,59,999]).slice(Fe)),H)},Y=this.$W,Q=this.$M,pe=this.$D,De="set"+(this.$u?"UTC":"");switch(te){case v:return ee?j(1,0):j(31,11);case d:return ee?j(1,Q):j(0,Q+1);case h:var we=this.$locale().weekStart||0,Ee=(Y<we?Y+7:Y)-we;return j(ee?pe-Ee:pe+(6-Ee),Q);case c:case x:return X(De+"Hours",0);case f:return X(De+"Minutes",1);case u:return X(De+"Seconds",2);case a:return X(De+"Milliseconds",3);default:return this.clone()}},z.endOf=function(R){return this.startOf(R,!1)},z.$set=function(R,V){var H,ee=N.p(R),te="set"+(this.$u?"UTC":""),j=(H={},H[c]=te+"Date",H[x]=te+"Date",H[d]=te+"Month",H[v]=te+"FullYear",H[f]=te+"Hours",H[u]=te+"Minutes",H[a]=te+"Seconds",H[i]=te+"Milliseconds",H)[ee],X=ee===c?this.$D+(V-this.$W):V;if(ee===d||ee===v){var Y=this.clone().set(x,1);Y.$d[j](X),Y.init(),this.$d=Y.set(x,Math.min(this.$D,Y.daysInMonth())).$d}else j&&this.$d[j](X);return this.init(),this},z.set=function(R,V){return this.clone().$set(R,V)},z.get=function(R){return this[N.p(R)]()},z.add=function(R,V){var H,ee=this;R=Number(R);var te=N.p(V),j=function(Q){var pe=C(ee);return N.w(pe.date(pe.date()+Math.round(Q*R)),ee)};if(te===d)return this.set(d,this.$M+R);if(te===v)return this.set(v,this.$y+R);if(te===c)return j(1);if(te===h)return j(7);var X=(H={},H[u]=r,H[f]=n,H[a]=t,H)[te]||1,Y=this.$d.getTime()+R*X;return N.w(Y,this)},z.subtract=function(R,V){return this.add(-1*R,V)},z.format=function(R){var V=this,H=this.$locale();if(!this.isValid())return H.invalidDate||_;var ee=R||"YYYY-MM-DDTHH:mm:ssZ",te=N.z(this),j=this.$H,X=this.$m,Y=this.$M,Q=H.weekdays,pe=H.months,De=H.meridiem,we=function(Fe,nt,Ye,Ie){return Fe&&(Fe[nt]||Fe(V,ee))||Ye[nt].slice(0,Ie)},Ee=function(Fe){return N.s(j%12||12,Fe,"0")},Oe=De||function(Fe,nt,Ye){var Ie=Fe<12?"AM":"PM";return Ye?Ie.toLowerCase():Ie};return ee.replace(m,function(Fe,nt){return nt||function(Ye){switch(Ye){case"YY":return String(V.$y).slice(-2);case"YYYY":return N.s(V.$y,4,"0");case"M":return Y+1;case"MM":return N.s(Y+1,2,"0");case"MMM":return we(H.monthsShort,Y,pe,3);case"MMMM":return we(pe,Y);case"D":return V.$D;case"DD":return N.s(V.$D,2,"0");case"d":return String(V.$W);case"dd":return we(H.weekdaysMin,V.$W,Q,2);case"ddd":return we(H.weekdaysShort,V.$W,Q,3);case"dddd":return Q[V.$W];case"H":return String(j);case"HH":return N.s(j,2,"0");case"h":return Ee(1);case"hh":return Ee(2);case"a":return Oe(j,X,!0);case"A":return Oe(j,X,!1);case"m":return String(X);case"mm":return N.s(X,2,"0");case"s":return String(V.$s);case"ss":return N.s(V.$s,2,"0");case"SSS":return N.s(V.$ms,3,"0");case"Z":return te}return null}(Fe)||te.replace(":","")})},z.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},z.diff=function(R,V,H){var ee,te=this,j=N.p(V),X=C(R),Y=(X.utcOffset()-this.utcOffset())*r,Q=this-X,pe=function(){return N.m(te,X)};switch(j){case v:ee=pe()/12;break;case d:ee=pe();break;case p:ee=pe()/3;break;case h:ee=(Q-Y)/6048e5;break;case c:ee=(Q-Y)/864e5;break;case f:ee=Q/n;break;case u:ee=Q/r;break;case a:ee=Q/t;break;default:ee=Q}return H?ee:N.a(ee)},z.daysInMonth=function(){return this.endOf(d).$D},z.$locale=function(){return F[this.$L]},z.locale=function(R,V){if(!R)return this.$L;var H=this.clone(),ee=O(R,V,!0);return ee&&(H.$L=ee),H},z.clone=function(){return N.w(this.$d,this)},z.toDate=function(){return new Date(this.valueOf())},z.toJSON=function(){return this.isValid()?this.toISOString():null},z.toISOString=function(){return this.$d.toISOString()},z.toString=function(){return this.$d.toUTCString()},k}(),L=I.prototype;return C.prototype=L,[["$ms",i],["$s",a],["$m",u],["$H",f],["$W",c],["$M",d],["$y",v],["$D",x]].forEach(function(k){L[k[1]]=function(z){return this.$g(z,k[0],k[1])}}),C.extend=function(k,z){return k.$i||(k(z,I,C),k.$i=!0),C},C.locale=O,C.isDayjs=M,C.unix=function(k){return C(1e3*k)},C.en=F[E],C.Ls=F,C.p={},C})})(xl);var f1=xl.exports,ot=tt(f1),yl={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(ye,function(){var t="minute",r=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(i,a,u){var f=a.prototype;u.utc=function(_){var y={date:_,utc:!0,args:arguments};return new a(y)},f.utc=function(_){var y=u(this.toDate(),{locale:this.$L,utc:!0});return _?y.add(this.utcOffset(),t):y},f.local=function(){return u(this.toDate(),{locale:this.$L,utc:!1})};var c=f.parse;f.parse=function(_){_.utc&&(this.$u=!0),this.$utils().u(_.$offset)||(this.$offset=_.$offset),c.call(this,_)};var h=f.init;f.init=function(){if(this.$u){var _=this.$d;this.$y=_.getUTCFullYear(),this.$M=_.getUTCMonth(),this.$D=_.getUTCDate(),this.$W=_.getUTCDay(),this.$H=_.getUTCHours(),this.$m=_.getUTCMinutes(),this.$s=_.getUTCSeconds(),this.$ms=_.getUTCMilliseconds()}else h.call(this)};var d=f.utcOffset;f.utcOffset=function(_,y){var m=this.$utils().u;if(m(_))return this.$u?0:m(this.$offset)?d.call(this):this.$offset;if(typeof _=="string"&&(_=function(E){E===void 0&&(E="");var F=E.match(r);if(!F)return null;var B=(""+F[0]).match(n)||["-",0,0],M=B[0],O=60*+B[1]+ +B[2];return O===0?0:M==="+"?O:-O}(_),_===null))return this;var w=Math.abs(_)<=16?60*_:_,D=this;if(y)return D.$offset=w,D.$u=_===0,D;if(_!==0){var A=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(D=this.local().add(w+A,t)).$offset=w,D.$x.$localOffset=A}else D=this.utc();return D};var p=f.format;f.format=function(_){var y=_||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return p.call(this,y)},f.valueOf=function(){var _=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*_},f.isUTC=function(){return!!this.$u},f.toISOString=function(){return this.toDate().toISOString()},f.toString=function(){return this.toDate().toUTCString()};var v=f.toDate;f.toDate=function(_){return _==="s"&&this.$offset?u(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():v.call(this)};var x=f.diff;f.diff=function(_,y,m){if(_&&this.$u===_.$u)return x.call(this,_,y,m);var w=this.local(),D=u(_).local();return x.call(w,D,y,m)}}})})(yl);var h1=yl.exports,Dl=tt(h1),wl={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(ye,function(){var t={year:0,month:1,day:2,hour:3,minute:4,second:5},r={};return function(n,i,a){var u,f=function(p,v,x){x===void 0&&(x={});var _=new Date(p),y=function(m,w){w===void 0&&(w={});var D=w.timeZoneName||"short",A=m+"|"+D,E=r[A];return E||(E=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:m,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:D}),r[A]=E),E}(v,x);return y.formatToParts(_)},c=function(p,v){for(var x=f(p,v),_=[],y=0;y<x.length;y+=1){var m=x[y],w=m.type,D=m.value,A=t[w];A>=0&&(_[A]=parseInt(D,10))}var E=_[3],F=E===24?0:E,B=_[0]+"-"+_[1]+"-"+_[2]+" "+F+":"+_[4]+":"+_[5]+":000",M=+p;return(a.utc(B).valueOf()-(M-=M%1e3))/6e4},h=i.prototype;h.tz=function(p,v){p===void 0&&(p=u);var x=this.utcOffset(),_=this.toDate(),y=_.toLocaleString("en-US",{timeZone:p}),m=Math.round((_-new Date(y))/1e3/60),w=a(y,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(15*-Math.round(_.getTimezoneOffset()/15)-m,!0);if(v){var D=w.utcOffset();w=w.add(x-D,"minute")}return w.$x.$timezone=p,w},h.offsetName=function(p){var v=this.$x.$timezone||a.tz.guess(),x=f(this.valueOf(),v,{timeZoneName:p}).find(function(_){return _.type.toLowerCase()==="timezonename"});return x&&x.value};var d=h.startOf;h.startOf=function(p,v){if(!this.$x||!this.$x.$timezone)return d.call(this,p,v);var x=a(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return d.call(x,p,v).tz(this.$x.$timezone,!0)},a.tz=function(p,v,x){var _=x&&v,y=x||v||u,m=c(+a(),y);if(typeof p!="string")return a(p).tz(y);var w=function(F,B,M){var O=F-60*B*1e3,C=c(O,M);if(B===C)return[O,B];var N=c(O-=60*(C-B)*1e3,M);return C===N?[O,C]:[F-60*Math.min(C,N)*1e3,Math.max(C,N)]}(a.utc(p,_).valueOf(),m,y),D=w[0],A=w[1],E=a(D).utcOffset(A);return E.$x.$timezone=y,E},a.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},a.tz.setDefault=function(p){u=p}}})})(wl);var d1=wl.exports,p1=tt(d1),El={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(ye,function(){var t="week",r="year";return function(n,i,a){var u=i.prototype;u.week=function(f){if(f===void 0&&(f=null),f!==null)return this.add(7*(f-this.week()),"day");var c=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var h=a(this).startOf(r).add(1,r).date(c),d=a(this).endOf(t);if(h.isBefore(d))return 1}var p=a(this).startOf(r).date(c).startOf(t).subtract(1,"millisecond"),v=this.diff(p,t,!0);return v<0?a(this).startOf("week").week():Math.ceil(v)},u.weeks=function(f){return f===void 0&&(f=null),this.week(f)}}})})(El);var _1=El.exports,v1=tt(_1);function Zt(s,e){return s.replace(/\$(\w+)/g,(t,r)=>String(e[r])||t)}function ks(s){const e=parseInt(s)||1;let t=s.replace(/\d+/,"");return t==="m"||t==="M"?t="M":t?t=t.toLocaleLowerCase():t="m",[e,t]}function g1(s){const e=/([+-])(\d{1,2})(\d{0,2})/,t=s.replace(/GMT|UTC/,"").match(e);if(!t)throw new Error("Invalid timezone string");const[,r,n,i]=t,a=parseInt(n,10)*60||0,u=parseInt(i,10)||0;return(r==="+"?-1:1)*(a+u)}function Kr(s,e){return e&&(e.startsWith("UTC")||e.startsWith("GMT"))?ot(s).utcOffset(g1(e)):ot(s).tz(e)}function pn(s){const[e,t]=ks(s);let r=0;switch(t){case"m":r=60;break;case"s":r=1;break;case"M":r=31*24*60*60;break;case"d":r=24*60*60;break;case"w":r=7*24*60*60;break;default:r=60*60;break}return Math.round(Number(e)*r)}function me(s){return typeof s!="number"||isNaN(s)}function _n(s,e){for(const t of e)s!=null&&s.hasOwnProperty(t)&&s[t]===void 0&&(s[t]=null)}var an=(s=>(s.BOOL="bool",s.INT="int",s.FLOAT="float",s.ARRAY="array",s.BOX="box",s.CHART_POINT="chart.point",s.COLOR="color",s.CONST="const",s.LABEL="label",s.LINE="line",s.LINEFILL="linefill",s.MAP="map",s.MATRIX="matrix",s.POLYLINE="polyline",s.SERIES="series",s.SIMPLE="simple",s.STRING="string",s.TABLE="table",s.UNDETERMINED="undetermined type",s.INPUT="input",s.NA="na",s.VOID="void",s.ENUM="enum",s))(an||{}),zs=(s=>(s.dividends="dividends",s.none="none",s.splits="splits",s))(zs||{}),Zr=(s=>(s.freqAll="freq_all",s.freqOncePerBar="freq_once_per_bar",s.freqOncePerBarClose="freq_once_per_bar_close",s))(Zr||{}),ss=(s=>(s.gapsOff="gaps_off",s.gapsOn="gaps_on",s.lookaheadOff="lookahead_off",s.lookaheadOn="lookahead_on",s))(ss||{}),Vt=(s=>(s.all="all",s.dataWindow="data_window",s.none="none",s.pane="pane",s.priceScale="price_scale",s.statusLine="status_line",s))(Vt||{}),Vr=(s=>(s.both="both",s.left="left",s.none="none",s.right="right",s))(Vr||{}),Je=(s=>(s.inherit="inherit",s.mintick="mintick",s.percent="percent",s.price="price",s.volume="volume",s))(Je||{}),qs=(s=>(s.styleDashed="style_dashed",s.styleDotted="style_dotted",s.styleSolid="style_solid",s))(qs||{}),gt=(s=>(s.styleArrowdown="style_arrowdown",s.styleArrowup="style_arrowup",s.styleCircle="style_circle",s.styleCross="style_cross",s.styleDiamond="style_diamond",s.styleFlag="style_flag",s.styleLabelCenter="style_label_center",s.styleLabelDown="style_label_down",s.styleLabelLeft="style_label_left",s.styleLabelLowerLeft="style_label_lower_left",s.styleLabelLowerRight="style_label_lower_right",s.styleLabelRight="style_label_right",s.styleLabelUp="style_label_up",s.styleLabelUpperLeft="style_label_upper_left",s.styleLabelUpperRight="style_label_upper_right",s.styleNone="style_none",s.styleSquare="style_square",s.styleTextOutline="style_text_outline",s.styleTriangledown="style_triangledown",s.styleTriangleup="style_triangleup",s.styleXcross="style_xcross",s))(gt||{}),qt=(s=>(s.styleArrowBoth="style_arrow_both",s.styleArrowLeft="style_arrow_left",s.styleArrowRight="style_arrow_right",s.styleDashed="style_dashed",s.styleDotted="style_dotted",s.styleSolid="style_solid",s))(qt||{}),vn=(s=>(s.abovebar="abovebar",s.absolute="absolute",s.belowbar="belowbar",s.bottom="bottom",s.top="top",s))(vn||{}),Jn=(s=>(s.ascending="ascending",s.descending="descending",s))(Jn||{}),Or=(s=>(s.styleArea="Area",s.styleAreabr="Area With Breaks",s.styleCircles="Circles",s.styleColumns="Columns",s.styleCross="Cross",s.styleHistogram="Histogram",s.styleLine="Line",s.styleLinebr="Line With Breaks",s.styleStepline="Step Line",s.styleSteplineDiamond="Step Line With Diamonds",s.styleSteplinebr="Step line with Breaks",s))(Or||{}),Er=(s=>(s.bottomCenter="bottom_center",s.bottomLeft="bottom_left",s.bottomRight="bottom_right",s.middleCenter="middle_center",s.middleLeft="middle_left",s.middleRight="middle_right",s.topCenter="top_center",s.topLeft="top_left",s.topRight="top_right",s))(Er||{}),Us=(s=>(s.left="left",s.none="none",s.right="right",s))(Us||{}),yi=(s=>(s.extended="extended",s.regular="regular",s))(yi||{}),_r=(s=>(s.arrowdown="arrowdown",s.arrowup="arrowup",s.circle="circle",s.cross="cross",s.diamond="diamond",s.flag="flag",s.labeldown="labeldown",s.labelup="labelup",s.square="square",s.triangledown="triangledown",s.triangleup="triangleup",s.xcross="xcross",s))(_r||{}),ar=(s=>(s.auto="auto",s.huge="huge",s.large="large",s.normal="normal",s.small="small",s.tiny="tiny",s))(ar||{}),ei=(s=>(s.familyDefault="default",s.familyMonospace="monospace",s))(ei||{}),Rt=(s=>(s.cash="cash",s.fixed="fixed",s.percentOfEquity="percent_of_equity",s))(Rt||{}),Ir=(s=>(s.cashPerContract="cash_per_contract",s.cashPerOrder="cash_per_order",s.percent="percent",s))(Ir||{}),mt=(s=>(s.all="all",s.long="long",s.short="short",s))(mt||{}),gn=(s=>(s.cancel="cancel",s.none="none",s.reduce="reduce",s))(gn||{}),je=(s=>(s.alignBottom="align_bottom",s.alignCenter="align_center",s.alignLeft="align_left",s.alignRight="align_right",s.alignTop="align_top",s.wrapAuto="wrap_auto",s.wrapNone="wrap_none",s))(je||{}),Et=(s=>(s.bar_index="bar_index",s.bar_time="bar_time",s))(Et||{}),Gr=(s=>(s.abovebar="abovebar",s.belowbar="belowbar",s.price="price",s))(Gr||{}),Ws=(s=>(s.actual="actual",s.estimate="estimate",s.standardized="standardized",s))(Ws||{}),ti=(s=>(s.traditional="Traditional",s.fibonacci="Fibonacci",s.woodie="Woodie",s.classic="Classic",s.dm="DM",s.camarilla="Camarilla",s))(ti||{}),ur=(s=>(s.INT="int",s.BOOL="bool",s.TIME="time",s.COLOR="color",s.FLOAT="float",s.PRICE="price",s.SOURCE="source",s.STRING="string",s.SYMBOL="symbol",s.SESSION="session",s.TEXT_AREA="text_area",s.TIMEFRAME="timeframe",s.ENUM="enum",s))(ur||{}),Ze=(s=>(s[s.Hint=1]="Hint",s[s.Info=2]="Info",s[s.Warning=4]="Warning",s[s.Error=8]="Error",s))(Ze||{});const ct={onlyInLoop:"'$text' is only allowed inside loops",invalidType:"Invalid argument 'expr$index' in 'operator SQBR' call",typeUseError:"Cannot specify a type form '$text' without also specifying the type.",notTypeKeyword:"'$text' is not a valid type keyword in variable declaration",undeclared:"Undeclared identifier '$name'",repeatVar:"'$name' is already defined",typeRepeatErr:"$keyword '$name' is already defined.",typeMismatch:"Cannot call '$operator' with argument '$index'. An argument of '$typeE' type was used but a '$typeR' is expected.",assignTypeMismatch:"Cannot assign a value of the `$typeE` type to the '$name' variable. The variable is declared with the `$typeR` type.",voidNotVar:"Void expression cannot be assigned to a variable",declareTypeErr:"Declared type '$type' is not compatible with assigned type '$valueType'",mapKeyValErr:"Cannot put <$typeA, $typeB> pairs into a map containing `$typeC` keys and `$typeD` values. The maps passed into the `$name()` function must have the same key types and value types.",inputSourceErr:"Invalid value for the '$name' parameter of the '$funcName' function. Possible values: [open, high, low, close, hl2, hlc3, ohlc4, hlcc4, volume].",buildInUseErr:"Cannot use '$name' as the default value of a type's field. The default value cannot be a function, variable or calculation.",argsLenErr:"Too many arguments passed into the `$name()` function call. Passed $lenA arguments but expected $lenB.",requiredParamErr:"No value assigned to the `$argName` parameter in $name()",argsSyntaxErr:"Syntax error after the argument for `$argName`. Arguments without their parameter name cannot be used after arguments with parameter names.",requestArgsErr:"Type $type cannot be used in $name '$argName' argument",mapKeyErr:"Incorrect `key` type `$type` in the variable. The `key` type must be one of the following: int, float, string, bool, color.",templateErr:"Incorrect number of arguments for the template: $countA expected, $countB passed.",templateNoSupportErr:"The '$name()' function does not support templates",ifOrSwitchTypeErr:"Return type of one of the '$keyword' blocks is not compatible with return type of other block(s) ($types)",argsNameErr:"The '$name' function does not have an argument with the name '$argName'",noFiledErr:"Object has no field $name",methodNotExistErr:"Could not find method or method reference '$methodName' for '$name'",tupleVarErr:"Syntax error: The quantities of tuple elements on each side of the assignment operator do not match. The right side has $indexA but the left side has $indexB.",tupleLeftVarErr:"Invalid assignment. Cannot assign a tuple to a variable '$name'.",tupleRightVarErr:"Cannot assign a variable to a tuple. The right side must be a function call or structure ('if', 'switch', 'for', 'while') returning a tuple with the same number of elements.",tempateTypeErr:"Syntax error: Only templates for arrays and matrices consist of a single type identifier enclosed in angle brackets.",qualifierErr:"'$name' is not a valid type qualifier. Possible values: 'const', 'simple', 'series'",notFindFuncErr:"Could not find function or function reference '$name'",naVarErr:"Value with NA type cannot be assigned to a variable that was defined without type keyword",notHistoryErr:"Variable '$name' doesn't have history values",defaultValueErr:"The default value cannot be a function, variable or calculation.",defaultValueTypeErr:"Default value of type $typeE can not be assigned to an argument of type $typeR",typeFieldErr:"In a type declaration, all fields without a default value must be explicitly typified.",unaryErr:"Syntax error at input '$sign'",funcArgAssignErr:"Function arguments cannot be mutable ('$name')",declaredErr:"A variable declared with the '$prefix' keyword cannot accept values of the '$type' form. Assign a '$prefix' value to this variable or remove the '$prefix' keyword from its declaration.",globalFuncErr:"Cannot use '$name' in local scope",onlyStatementErr:"Scripts must contain one declaration statement: `indicator()`, `strategy()` or `library()`, Your script has $count.",modifyGlobalVarErr:"Cannot modify global variable '$name' in function",inputDefvalErr:"Arguments of input function must be of constant type, or 'source' builtin variables.",objectIsNaErr:"Cannot access the '$name' $type of an na object. The object is 'na'.",buidinAssignErr:"Cannot assign a new value to the built-in variable '$name'.",buidinVarErr:"Cannot shadow the built-in variable `$name` because it has already been used as a built-in.",useNaErr:"Cannot use an `na` value of an unspecified type in the `$name` function.",libraryTitleErr:"Invalid argument 'title' in 'library' call. It cannot contain spaces, special characters or begin with a digit.",exportFuncArgErr:"All exported functions args should be typified",indiRunErr:"An indicator must contain at least one of the following: any `plot*()` function, `barcolor()`, `bgcolor()`, `hline()`, `alertcondition()`, or any drawing (line, label, box, table, polyline).",libraryExportErr:"A library must contain at least one exported function, method, or type.",strategyRunErr:"A strategy must contain at least one of the following: any `strategy.*()` function that creates orders, any `plot*()` function, `barcolor()`, `bgcolor()`, `hline()`, or any drawing (line, label, box, table, polyline).",exportUseErr:"Only libraries can contain exported $type.",funcRepeatErr:"The '$name' function has overloads with the same parameters. The type of parameters must be different in overloaded versions of functions.",importMultipleErr:"Cannot import a library more than once",importNotExitErr:"The user '$username' does not have a published library titled '$libraryName'",importNameRepeatErr:"More than one import uses the same alias: $name. Previous usage at line: $line",exportFuncHasInputErr:"The exported function '$func' depends on the '$name' input variable, which is not allowed.",libraryTitleIsKeywordErr:"Invalid argument 'title' in 'library' call. Token: '$name' can't be used as library title.",exportFuncUseGlobalVarErr:"Cannot use global variables in exported functions. Function: $func",loopRuntimeErr:"Loop takes too long to execute (> 500 ms)",paramsErr:"Invalid value '$value' for '$param' parameter of the '$func' function. Possible values: $targetVal",displayErr:"Invalid argument 'display' in '$func' call. Possible values: $values",exportFuncUseReqErr:"Cannot use `request.*()` call in exported function `$name()`",requestExprErr:"Type series $type cannot be used in $name 'expression' argument",argDefaultErr:"The default value assigned to a parameter must be either a literal value (e.g., `5`) or a built-in variable (e.g., `close`)",overloadFuncErr:"Cannot use global variables or any values qualified as 'input' in the local scopes of overloaded functions or methods. Remove any global variables or inputs from the scopes of all '$name()' overloads.",againAssignErr:"Unable to determine the object for the field assignment. Try putting the object into a separate variable before assigning values to its fields.",requestUserInLoopErr:"Cannot use `request.*()` call within loops or conditional structures.",enumVarNameErr:"Invalid enum name '$name': `bool`, `int`, `float`, `string`, and `color` are not allowed.",enumVarNameBuiltinErr:"Invalid object name: $name. Namespaces of built-ins cannot be used.",typeNameErr:"Invalid user-defined type name '$name': `bool`, `int`, `float`, `string`, and `color` are not allowed.",enumUseErr:"Cannot use the '$name' as a value. Use one of the enum's fields instead.",conditionalErr:"'$name' conditional expression must be of a bool type!",fortoErr:'The value of the "for" loop must be a number.',indicatorUseStrategyFuncErr:"You cannot use strategy $type ($name) in indicator script.",arrEmptyErr:"Array must not be empty",arrLengthDiffErr:"Arrays have different lengths",arrTypeErr:"数组类型错误,array.$name方法只能使用$type类型数组!",inputOptErr:"input's defval should be in options, but '$defval' is not in [$args]",mathRandomErr:"min must be less than max",matrixRehapeErr:"New matrix must be of same area as original matrix",strategyExitErr:"strategy.exit must have at least one of the following parameters: 'profit', 'limit', 'loss', 'stop' or one of the following pairs: 'trail_offset' and 'trail_price' / 'trail_points'. To close the position at market price, use 'strategy.close'",arrLenErr:"Invalid array length"};an.SERIES,an.SIMPLE,an.INPUT,an.CONST,an.INT,an.FLOAT,an.BOOL,an.COLOR,an.STRING;const m1=["close","open","high","low","hl2","hlc3","hlcc4","ohlc4","volume"],x1=["case","catch","default","delete","do","finally","function","instanceof","new","return","this","throw","try","typeof","void","with"],y1=["linefill","polyline","matrix","series","simple","string","array","color","const","float","label","table","bool","line","box","int","map","continue","for","varip","var","in","export","import","method","switch","break","while","else","type","and","for","not","as","by","if","in","or","to"];class D1{constructor(e){U(this,"_errorListener");this._errorListener=e}new({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_float({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_int({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_color({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_bool({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_string({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_line({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_box({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_table({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_linefill({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_label({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}copy({id:e}){return e==null?void 0:e.copy()}slice({id:e,index_from:t,index_to:r}){return e==null?void 0:e.slice({index_from:t,index_to:r})}size({id:e}){return e==null?void 0:e.size()}first({id:e}){return e==null?void 0:e.first()}abs({id:e},t){return e==null?void 0:e.abs(t)}avg({id:e},t){return e==null?void 0:e.avg(t)}binary_search({id:e,val:t},r){return e==null?void 0:e.binary_search({val:t},r)}binary_search_leftmost({id:e,val:t},r){return e==null?void 0:e.binary_search_leftmost({val:t},r)}binary_search_rightmost({id:e,val:t},r){return e==null?void 0:e.binary_search_rightmost({val:t},r)}clear({id:e}){e==null||e.clear()}concat({id1:e,id2:t}){return e==null?void 0:e.concat({id2:t})}covariance({id1:e,id2:t,biased:r},n){return e==null?void 0:e.covariance({id2:t,biased:r},n)}every({id:e},t){return e==null?void 0:e.every(t)}from(e,t){const r=new it(0,void 0,this._errorListener);return r._value=t,r}fill({id:e,value:t,index_from:r,index_to:n}){e==null||e.fill({value:t,index_from:r,index_to:n})}get({id:e,index:t}){return e==null?void 0:e.get({index:t})}includes({id:e,value:t}){return e==null?void 0:e.includes({value:t})}indexof({id:e,value:t}){return e==null?void 0:e.indexof({value:t})}insert({id:e,index:t,value:r}){e==null||e.insert({index:t,value:r})}join({id:e,separator:t},r){return e==null?void 0:e.join({separator:t},r)}last({id:e}){return e==null?void 0:e.last()}lastindexof({id:e,value:t}){return e==null?void 0:e.lastindexof({value:t})}max({id:e,nth:t},r){return e==null?void 0:e.max({nth:t},r)}median({id:e},t){return e==null?void 0:e.median(t)}min({id:e,nth:t},r){return e==null?void 0:e.min({nth:t},r)}mode({id:e},t){return e==null?void 0:e.mode(t)}percentile_linear_interpolation({id:e,percentage:t},r){return e==null?void 0:e.percentile_linear_interpolation({percentage:t},r)}percentile_nearest_rank({id:e,percentage:t},r){return e==null?void 0:e.percentile_nearest_rank({percentage:t},r)}percentrank({id:e,index:t},r){return e==null?void 0:e.percentrank({index:t},r)}pop({id:e}){return e==null?void 0:e.pop()}push({id:e,value:t}){e==null||e.push({value:t})}range({id:e},t){return e==null?void 0:e.range(t)}remove({id:e,index:t}){return e==null?void 0:e.remove({index:t})}reverse({id:e}){return e==null?void 0:e.reverse()}set({id:e,index:t,value:r}){e==null||e.set({index:t,value:r})}shift({id:e}){return e==null?void 0:e.shift()}some({id:e},t){return e==null?void 0:e.some(t)}sort({id:e,order:t},r){e==null||e.sort({order:t},r)}sort_indices({id:e,order:t},r){return e==null?void 0:e.sort_indices({order:t},r)}standardize({id:e},t){return e==null?void 0:e.standardize(t)}stdev({id:e,biased:t},r){return e==null?void 0:e.stdev({biased:t},r)}sum({id:e},t){return e==null?void 0:e.sum(t)}unshift({id:e,value:t}){e==null||e.unshift({value:t})}variance({id:e,biased:t},r){return e==null?void 0:e.variance({biased:t},r)}}class it{constructor(e=0,t,r){U(this,"_arrInstance");U(this,"_errorListener");this._errorListener=r,this._arrInstance=Array.from(new Array(e||0),()=>Yr.cloneDeep(t))}get isArray(){return!0}get _value(){return[...this._arrInstance]}set _value(e){this._arrInstance=[...e]}_deepCopyData(e){this._arrInstance=Yr.cloneDeep(e)}_copyData(e){this._arrInstance=e}copy(){const e=new it(0,void 0,this._errorListener);return e._deepCopyData(this._arrInstance),e}slice({index_from:e,index_to:t}){const r=new it(0,void 0,this._errorListener);return r._copyData(this._arrInstance.slice(e,t)),r}size(){return this._arrInstance.length}first(){return this._arrInstance[0]}abs(e){const t=new it(0,void 0,this._errorListener);this._verifySimpleType("number","abs","int/float",e);const r=this._arrInstance.map(n=>Math.abs(n));return t._copyData(r),t}avg(e){return this._verifySimpleType("number","avg","int/float",e),Yr.mean(this._arrInstance)}binary_search({val:e},t){return this._verifySimpleType("number","binary_search","int/float",t),me(e)?-1:this._binarySearch(this._arrInstance,e)}binary_search_leftmost({val:e},t){return this._verifySimpleType("number","binary_search_leftmost","int/float",t),me(e)?this._arrInstance.length-1:this._binarySearchLeftMost(this._arrInstance,e)}binary_search_rightmost({val:e},t){return this._verifySimpleType("number","binary_search_rightmost","int/float",t),me(e)?this._arrInstance.length:this._binarySearchRightMost(this._arrInstance,e)}clear(){this._arrInstance=[]}concat({id2:e}){return this._arrInstance=this._arrInstance.concat(e==null?void 0:e._value),this}covariance({id2:e,biased:t},r){return this._verifySimpleType("number","covariance","int/float",r),this._verifySimpleType("number","covariance","int/float",r,e==null?void 0:e._value),this._covariance(this._arrInstance,e._value,t,r)}every(e){return this._verifySimpleType("number|boolean","every","int/float/bool",e),this._arrInstance.every(t=>!!t)}fill({value:e,index_from:t=0,index_to:r}){this._arrInstance=this._setElements(this._arrInstance,e,t,r)}get({index:e}){if(!me(e))return this._arrInstance[e]}includes({value:e}){return this._arrInstance.includes(e)}indexof({value:e}){return this._arrInstance.indexOf(e)}insert({index:e,value:t}){me(e)||this._arrInstance.splice(e,0,t)}join({separator:e}={},t){return this._verifySimpleType("number|string","join","int/float/string",t),this._arrInstance.join(e)}last(){return this._arrInstance[this._arrInstance.length-1]}lastindexof({value:e}){return this._arrInstance.lastIndexOf(e)}max({nth:e}={},t){return this._verifySimpleType("number","max","int/float",t),this._maxNth([...this._arrInstance],e)}median(e){return this._verifySimpleType("number","median","int/float",e),this._median([...this._arrInstance])}min({nth:e}={},t){return this._verifySimpleType("number","min","int/float",t),this._minNth([...this._arrInstance],e)}mode(e){return this._verifySimpleType("number","mode","int/float",e),this._mode([...this._arrInstance])}percentile_linear_interpolation({percentage:e},t){return this._verifySimpleType("number","percentile_linear_interpolation","int/float",t),this._percentileLinearInterpolation([...this._arrInstance],e)}percentile_nearest_rank({percentage:e=0},t){var r;if(this._arrInstance.length===0||e<0||e>100||me(e)){(r=this._errorListener)==null||r.addError("Invalid percentile or empty array",t,Ze.Error);return}return this._verifySimpleType("number","percentile_nearest_rank","int/float",t),this._getNearestRankPercentile([...this._arrInstance],e)}percentrank({index:e},t){return this._verifySimpleType("number","percentrank","int/float",t),this._getPercentileRank([...this._arrInstance],e)}pop(){return this._arrInstance.pop()}push({value:e}){this._arrInstance.push(e)}range(e){var i;if(this._arrInstance.length===0){(i=this._errorListener)==null||i.addError(ct.arrEmptyErr,e,Ze.Error);return}this._verifySimpleType("number","range","int/float",e);const t=Math.min(...this._arrInstance);return Math.max(...this._arrInstance)-t}remove({index:e}){if(!me(e))return this._arrInstance.splice(e,1)[0]}reverse(){this._arrInstance.reverse()}set({index:e,value:t}){me(e)||(this._arrInstance[e]=t)}shift(){return this._arrInstance.shift()}some(e){return this._verifySimpleType("number|boolean","some","int/float/bool",e),this._arrInstance.some(t=>!!t)}sort({order:e}={},t){this._verifySimpleType("number","sort","int/float",t),this._arrInstance.sort((r,n)=>e!==Jn.descending?r-n:n-r)}sort_indices({order:e}={},t){this._verifySimpleType("number","sort_indices","int/float",t);const r=this._arrInstance.map((i,a)=>a);r.sort((i,a)=>e!==Jn.descending?this._arrInstance[i]-this._arrInstance[a]:this._arrInstance[a]-this._arrInstance[i]);const n=new it(0,void 0,this._errorListener);return n._copyData(r),n}standardize(e){this._verifySimpleType("number","standardize","int/float",e);const t=new it(0,void 0,this._errorListener);return t._copyData(this._standardizeArray([...this._arrInstance])),t}stdev({biased:e}={},t){var r;if(this._arrInstance.length===0){(r=this._errorListener)==null||r.addError(ct.arrEmptyErr,t,Ze.Error);return}return this._verifySimpleType("number","stdev","int/float",t),this._calculateStandardDeviations([...this._arrInstance],e)}sum(e){return this._verifySimpleType("number","sum","int/float",e),this._arrInstance.reduce((r,n)=>r+(n||0),0)}unshift({value:e}){this._arrInstance.unshift(e)}variance({biased:e}={},t){var r;if(this._arrInstance.length===0){(r=this._errorListener)==null||r.addError(ct.arrEmptyErr,t,Ze.Error);return}return this._verifySimpleType("number","variance","int/float",t),this._calculateVariances([...this._arrInstance],e)}_calculateVariances(e,t=!0){const r=e.reduce((a,u)=>a+(u||0),0)/e.length,n=e.reduce((a,u)=>a+((u||0)-r)**2,0),i=n/e.length;return t?i:e.length>1?n/(e.length-1):i}_calculateStandardDeviations(e,t=!0){const r=e.reduce((a,u)=>a+(u||0),0)/e.length,n=e.reduce((a,u)=>{const f=(u||0)-r;return a+f*f},0),i=Math.sqrt(n/e.length);return t?i:e.length>1?Math.sqrt(n/(e.length-1)):i}_standardizeArray(e){const t=e.reduce((i,a)=>i+(a||0),0)/e.length,r=Math.sqrt(e.reduce((i,a)=>i+Math.pow((a||0)-t,2),0)/e.length);return e.map(i=>((i||0)-t)/r)}_getPercentileRank(e,t=0){if(me(t))return;const r=e[t];let n=0;for(let a=0;a<e.length;a++)(e[a]<r||e[a]===r&&a!=t)&&n++;return n/(e.length-1)*100}_getNearestRankPercentile(e,t=0){const r=e.slice().sort((a,u)=>a-u),n=t/100*r.length,i=Math.ceil(n)-1;return r[i>=r.length?r.length-1:i]}_percentileLinearInterpolation(e,t=0){if(t<0||t>100||me(t))return;e.sort(function(i,a){return i-a});const r=e.length;t/=100;const n=1/(r*2);if(t<=n)return e[0];if(t>=1-1/(r*2))return e[r-1];for(const[i,a]of e.entries()){const u=e[i-1];if(t<(i+.5)/r)return u+(a-u)*(t-(i-.5)/r)/(1/r)}}_mode(e){const t={};let r=0;const n=[];for(const i of e)t[i]=(t[i]||0)+1,r=Math.max(r,t[i]);for(const i in t)t[i]===r&&n.push(Number(i));return Math.min(...r===1?e:n)}_median(e){e.sort(function(r,n){return r-n});const t=Math.floor(e.length/2);return e.length%2?e[t]:(e[t-1]+e[t])/2}_minNth(e,t=0){return e.sort(function(r,n){return r-n}),e[t]}_maxNth(e,t=0){return e.sort(function(r,n){return n-r}),e[t]}_setElements(e,t,r=0,n){n===void 0&&(n=e.length);for(let i=r;i<n;i++)e[i]=t;return e}_covariance(e,t,r=!0,n){var f;if(e.length!=t.length){(f=this._errorListener)==null||f.addError(ct.arrLengthDiffErr,n,Ze.Error);return}e=e.filter(c=>c!==void 0),t=t.filter(c=>c!==void 0);const i=e.reduce((c,h)=>c+h,0)/e.length,a=t.reduce((c,h)=>c+h,0)/t.length;let u=0;for(let c=0;c<e.length;c++)u+=(e[c]-i)*(t[c]-a);return r?u/e.length:u/(e.length-1)}_verifySimpleType(e,t,r,n,i=this._arrInstance){var u;i.filter(f=>f!==void 0).some(f=>!e.split("|").includes(typeof f))&&((u=this._errorListener)==null||u.addError(Zt(ct.arrTypeErr,{name:t,type:r}),n,Ze.Error))}_binarySearch(e,t){let r=0,n=e.length-1;for(;r<=n;){const i=Math.floor((r+n)/2);if(e[i]===t)return i;e[i]<t?r=i+1:n=i-1}return-1}_binarySearchLeftMost(e,t){let r=0,n=e.length-1;const i=[];for(;r<=n;){const a=Math.floor((r+n)/2);e[a]===t&&i.push(a),e[a]<t?r=a+1:n=a-1}return i.length?Math.min(...i):r-1}_binarySearchRightMost(e,t){let r=0,n=e.length-1;const i=[];for(;r<=n;){const a=Math.floor((r+n)/2);e[a]===t&&i.push(a),e[a]<=t?r=a+1:n=a-1}return i.length?Math.max(...i):r}}class w1{constructor(e,t){U(this,"_randomNums");U(this,"_mintick");U(this,"_cacheData");U(this,"_barIndex");U(this,"_errorListener");this._mintick=e,this._randomNums={},this._cacheData={},this._barIndex=0,this._errorListener=t}update(e){this._barIndex=e,this._randomNums={}}abs({number:e}){if(!me(e))return Math.abs(e)}acos({angle:e}){if(me(e))return;const t=Math.acos(e);return isNaN(t)?void 0:t}asin({angle:e}){if(me(e))return;const t=Math.asin(e);return isNaN(t)?void 0:t}atan({angle:e}){if(me(e))return;const t=Math.atan(e);return isNaN(t)?void 0:t}avg(e,t){return Yr.mean(t)}ceil({number:e}){if(!me(e))return Math.ceil(e)}floor({number:e}){if(!me(e))return Math.floor(e)}cos({angle:e}){if(me(e))return;const t=Math.cos(e);return isNaN(t)?void 0:t}sin({angle:e}){if(me(e))return;const t=Math.sin(e);return isNaN(t)?void 0:t}tan({angle:e}){if(me(e))return;const t=Math.tan(e);return isNaN(t)?void 0:t}exp({number:e}){if(!me(e))return Math.exp(e)}log({number:e}){if(!me(e))return Math.log(e)}log10({number:e}){if(!me(e))return Math.log10(e)}max(e,t){return t=t.filter(r=>!me(r)),Math.max(...t)}min(e,t){return t=t.filter(r=>!me(r)),Math.min(...t)}pow({base:e,exponent:t}){if(!(me(e)||me(t)))return Math.pow(e,t)}random({min:e=0,max:t=1,seed:r},n){if(me(e)&&(e=0),me(t)&&(t=1),r&&this._randomNums[r])return this._randomNums[r];if(e>=t){this._errorListener.addError(ct.mathRandomErr,n,Ze.Error);return}let i;do i=Math.random()*(t-e)+e;while(i===e||i===t);return r&&(this._randomNums[r]=i),i}round({number:e,precision:t}){if(!me(e))return me(t)?Math.round(e):Number(e==null?void 0:e.toFixed(t))}round_to_mintick({number:e}){if(!me(e))return Number(e==null?void 0:e.toFixed(this._mintick))}sign({number:e}){if(!me(e))return e&&Math.sign(e)}sqrt({number:e}){if(!me(e))return Math.sqrt(e)}sum({source:e,length:t=1},r){let n=this._cacheData[`sum_${r}`];n||(n=[]),n[this._barIndex]=e,this._cacheData[`sum_${r}`]=n;const i=n.filter(a=>!me(a));if(!(i.length<t))return Yr.sum(i.slice(-t))}todegrees({radians:e}){if(!me(e))return e*(180/Math.PI)}toradians({degrees:e}){if(!me(e))return e*(Math.PI/180)}}function Hs(){return Hs=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(s[r]=t[r])}return s},Hs.apply(this,arguments)}var bl={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function _t(s){return typeof s=="number"}function Ot(s){return!s||typeof s!="object"||typeof s.constructor!="function"?!1:s.isBigNumber===!0&&typeof s.constructor.prototype=="object"&&s.constructor.prototype.isBigNumber===!0||typeof s.constructor.isDecimal=="function"&&s.constructor.isDecimal(s)===!0}function Al(s){return s&&typeof s=="object"&&Object.getPrototypeOf(s).isComplex===!0||!1}function Cl(s){return s&&typeof s=="object"&&Object.getPrototypeOf(s).isFraction===!0||!1}function Fl(s){return s&&s.constructor.prototype.isUnit===!0||!1}function un(s){return typeof s=="string"}var Ft=Array.isArray;function xt(s){return s&&s.constructor.prototype.isMatrix===!0||!1}function os(s){return Array.isArray(s)||xt(s)}function E1(s){return s&&s.isDenseMatrix&&s.constructor.prototype.isMatrix===!0||!1}function b1(s){return s&&s.isSparseMatrix&&s.constructor.prototype.isMatrix===!0||!1}function A1(s){return s&&s.constructor.prototype.isRange===!0||!1}function Ca(s){return s&&s.constructor.prototype.isIndex===!0||!1}function C1(s){return typeof s=="boolean"}function F1(s){return s&&s.constructor.prototype.isResultSet===!0||!1}function B1(s){return s&&s.constructor.prototype.isHelp===!0||!1}function M1(s){return typeof s=="function"}function N1(s){return s instanceof Date}function S1(s){return s instanceof RegExp}function Fa(s){return!!(s&&typeof s=="object"&&s.constructor===Object&&!Al(s)&&!Cl(s))}function O1(s){return s===null}function I1(s){return s===void 0}function T1(s){return s&&s.isAccessorNode===!0&&s.constructor.prototype.isNode===!0||!1}function $1(s){return s&&s.isArrayNode===!0&&s.constructor.prototype.isNode===!0||!1}function L1(s){return s&&s.isAssignmentNode===!0&&s.constructor.prototype.isNode===!0||!1}function R1(s){return s&&s.isBlockNode===!0&&s.constructor.prototype.isNode===!0||!1}function P1(s){return s&&s.isConditionalNode===!0&&s.constructor.prototype.isNode===!0||!1}function k1(s){return s&&s.isConstantNode===!0&&s.constructor.prototype.isNode===!0||!1}function z1(s){return s&&s.isFunctionAssignmentNode===!0&&s.constructor.prototype.isNode===!0||!1}function q1(s){return s&&s.isFunctionNode===!0&&s.constructor.prototype.isNode===!0||!1}function U1(s){return s&&s.isIndexNode===!0&&s.constructor.prototype.isNode===!0||!1}function W1(s){return s&&s.isNode===!0&&s.constructor.prototype.isNode===!0||!1}function H1(s){return s&&s.isObjectNode===!0&&s.constructor.prototype.isNode===!0||!1}function j1(s){return s&&s.isOperatorNode===!0&&s.constructor.prototype.isNode===!0||!1}function Y1(s){return s&&s.isParenthesisNode===!0&&s.constructor.prototype.isNode===!0||!1}function K1(s){return s&&s.isRangeNode===!0&&s.constructor.prototype.isNode===!0||!1}function Z1(s){return s&&s.isRelationalNode===!0&&s.constructor.prototype.isNode===!0||!1}function V1(s){return s&&s.isSymbolNode===!0&&s.constructor.prototype.isNode===!0||!1}function G1(s){return s&&s.constructor.prototype.isChain===!0||!1}function On(s){var e=typeof s;return e==="object"?s===null?"null":Ot(s)?"BigNumber":s.constructor&&s.constructor.name?s.constructor.name:"Object":e}function ut(s){var e=typeof s;if(e==="number"||e==="string"||e==="boolean"||s===null||s===void 0)return s;if(typeof s.clone=="function")return s.clone();if(Array.isArray(s))return s.map(function(t){return ut(t)});if(s instanceof Date)return new Date(s.valueOf());if(Ot(s))return s;if(Fa(s))return X1(s,ut);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(s,")"))}function X1(s,e){var t={};for(var r in s)as(s,r)&&(t[r]=e(s[r]));return t}function Bl(s,e){for(var t in e)as(e,t)&&(s[t]=e[t]);return s}function Di(s,e){var t,r,n;if(Array.isArray(s)){if(!Array.isArray(e)||s.length!==e.length)return!1;for(r=0,n=s.length;r<n;r++)if(!Di(s[r],e[r]))return!1;return!0}else{if(typeof s=="function")return s===e;if(s instanceof Object){if(Array.isArray(e)||!(e instanceof Object))return!1;for(t in s)if(!(t in e)||!Di(s[t],e[t]))return!1;for(t in e)if(!(t in s))return!1;return!0}else return s===e}}function as(s,e){return s&&Object.hasOwnProperty.call(s,e)}function Q1(s,e){for(var t={},r=0;r<e.length;r++){var n=e[r],i=s[n];i!==void 0&&(t[n]=i)}return t}var J1=["Matrix","Array"],e_=["number","BigNumber","Fraction"],br=function(e){if(e)throw new Error(`The global config is readonly.
27
+ }`;var qe=a1(function(){return st($,Ce+"return "+ce).apply(t,U)});if(qe.source=ce,il(qe))throw qe;return qe}function VC(o){return at(o).toLowerCase()}function GC(o){return at(o).toUpperCase()}function XC(o,l,g){if(o=at(o),o&&(g||l===t))return vd(o);if(!o||!(l=Br(l)))return o;var E=tn(o),S=tn(l),$=gd(E,S),U=md(E,S)+1;return Gn(E,$,U).join("")}function QC(o,l,g){if(o=at(o),o&&(g||l===t))return o.slice(0,yd(o)+1);if(!o||!(l=Br(l)))return o;var E=tn(o),S=md(E,tn(l))+1;return Gn(E,0,S).join("")}function JC(o,l,g){if(o=at(o),o&&(g||l===t))return o.replace(mr,"");if(!o||!(l=Br(l)))return o;var E=tn(o),S=gd(E,tn(l));return Gn(E,S).join("")}function eA(o,l){var g=A,E=N;if(Mt(l)){var S="separator"in l?l.separator:S;g="length"in l?ze(l.length):g,E="omission"in l?Br(l.omission):E}o=at(o);var $=o.length;if(Ki(o)){var U=tn(o);$=U.length}if(g>=$)return o;var W=g-Zi(E);if(W<1)return E;var G=U?Gn(U,0,W).join(""):o.slice(0,W);if(S===t)return G+E;if(U&&(W+=G.length-W),sl(S)){if(o.slice(W).search(S)){var oe,ae=G;for(S.global||(S=D0(S.source,at(Ro.exec(S))+"g")),S.lastIndex=0;oe=S.exec(ae);)var ce=oe.index;G=G.slice(0,ce===t?W:ce)}}else if(o.indexOf(Br(S),W)!=W){var ge=G.lastIndexOf(S);ge>-1&&(G=G.slice(0,ge))}return G+E}function tA(o){return o=at(o),o&&ms.test(o)?o.replace(wn,N2):o}var rA=ts(function(o,l,g){return o+(g?" ":"")+l.toUpperCase()}),ul=up("toUpperCase");function o1(o,l,g){return o=at(o),l=g?t:l,l===t?C2(o)?I2(o):v2(o):o.match(l)||[]}var a1=Ue(function(o,l){try{return Ar(o,t,l)}catch(g){return il(g)?g:new Re(g)}}),nA=Fn(function(o,l){return kr(l,function(g){g=dn(g),Cn(o,g,rl(o[g],o))}),o});function iA(o){var l=o==null?0:o.length,g=Me();return o=l?At(o,function(E){if(typeof E[1]!="function")throw new zr(a);return[g(E[0]),E[1]]}):[],Ue(function(E){for(var S=-1;++S<l;){var $=o[S];if(Ar($[0],this,E))return Ar($[1],this,E)}})}function sA(o){return Nb(Ur(o,d))}function ll(o){return function(){return o}}function oA(o,l){return o==null||o!==o?l:o}var aA=cp(),uA=cp(!0);function wr(o){return o}function cl(o){return zd(typeof o=="function"?o:Ur(o,d))}function lA(o){return Ud(Ur(o,d))}function cA(o,l){return Wd(o,Ur(l,d))}var fA=Ue(function(o,l){return function(g){return Os(g,o,l)}}),hA=Ue(function(o,l){return function(g){return Os(o,g,l)}});function fl(o,l,g){var E=Kt(l),S=sa(l,E);g==null&&!(Mt(l)&&(S.length||!E.length))&&(g=l,l=o,o=this,S=sa(l,Kt(l)));var $=!(Mt(g)&&"chain"in g)||!!g.chain,U=Mn(o);return kr(S,function(W){var G=l[W];o[W]=G,U&&(o.prototype[W]=function(){var oe=this.__chain__;if($||oe){var ae=o(this.__wrapped__),ce=ae.__actions__=xr(this.__actions__);return ce.push({func:G,args:arguments,thisArg:o}),ae.__chain__=oe,ae}return G.apply(o,Hn([this.value()],arguments))})}),o}function dA(){return Jt._===this&&(Jt._=k2),this}function hl(){}function pA(o){return o=ze(o),Ue(function(l){return Hd(l,o)})}var _A=W0(At),vA=W0(fd),gA=W0(p0);function u1(o){return G0(o)?_0(dn(o)):Kb(o)}function mA(o){return function(l){return o==null?t:vi(o,l)}}var xA=hp(),yA=hp(!0);function dl(){return[]}function pl(){return!1}function DA(){return{}}function wA(){return""}function bA(){return!0}function EA(o,l){if(o=ze(o),o<1||o>H)return[];var g=j,E=sr(o,j);l=Me(l),o-=j;for(var S=m0(E,l);++g<o;)l(g);return S}function CA(o){return Pe(o)?At(o,dn):Mr(o)?[o]:xr(Bp(at(o)))}function AA(o){var l=++R2;return at(o)+l}var FA=fa(function(o,l){return o+l},0),BA=H0("ceil"),MA=fa(function(o,l){return o/l},1),NA=H0("floor");function SA(o){return o&&o.length?ia(o,wr,M0):t}function OA(o,l){return o&&o.length?ia(o,Me(l,2),M0):t}function IA(o){return pd(o,wr)}function TA(o,l){return pd(o,Me(l,2))}function $A(o){return o&&o.length?ia(o,wr,I0):t}function LA(o,l){return o&&o.length?ia(o,Me(l,2),I0):t}var RA=fa(function(o,l){return o*l},1),PA=H0("round"),kA=fa(function(o,l){return o-l},0);function zA(o){return o&&o.length?g0(o,wr):0}function qA(o,l){return o&&o.length?g0(o,Me(l,2)):0}return T.after=l4,T.ary=kp,T.assign=G4,T.assignIn=Jp,T.assignInWith=Ea,T.assignWith=X4,T.at=Q4,T.before=zp,T.bind=rl,T.bindAll=nA,T.bindKey=qp,T.castArray=D4,T.chain=Lp,T.chunk=NE,T.compact=SE,T.concat=OE,T.cond=iA,T.conforms=sA,T.constant=ll,T.countBy=z8,T.create=J4,T.curry=Up,T.curryRight=Wp,T.debounce=Hp,T.defaults=eC,T.defaultsDeep=tC,T.defer=c4,T.delay=f4,T.difference=IE,T.differenceBy=TE,T.differenceWith=$E,T.drop=LE,T.dropRight=RE,T.dropRightWhile=PE,T.dropWhile=kE,T.fill=zE,T.filter=U8,T.flatMap=j8,T.flatMapDeep=Y8,T.flatMapDepth=K8,T.flatten=Op,T.flattenDeep=qE,T.flattenDepth=UE,T.flip=h4,T.flow=aA,T.flowRight=uA,T.fromPairs=WE,T.functions=uC,T.functionsIn=lC,T.groupBy=Z8,T.initial=jE,T.intersection=YE,T.intersectionBy=KE,T.intersectionWith=ZE,T.invert=fC,T.invertBy=hC,T.invokeMap=G8,T.iteratee=cl,T.keyBy=X8,T.keys=Kt,T.keysIn=Dr,T.map=ma,T.mapKeys=pC,T.mapValues=_C,T.matches=lA,T.matchesProperty=cA,T.memoize=ya,T.merge=vC,T.mergeWith=e1,T.method=fA,T.methodOf=hA,T.mixin=fl,T.negate=Da,T.nthArg=pA,T.omit=gC,T.omitBy=mC,T.once=d4,T.orderBy=Q8,T.over=_A,T.overArgs=p4,T.overEvery=vA,T.overSome=gA,T.partial=nl,T.partialRight=jp,T.partition=J8,T.pick=xC,T.pickBy=t1,T.property=u1,T.propertyOf=mA,T.pull=QE,T.pullAll=Tp,T.pullAllBy=JE,T.pullAllWith=e8,T.pullAt=t8,T.range=xA,T.rangeRight=yA,T.rearg=_4,T.reject=r4,T.remove=r8,T.rest=v4,T.reverse=el,T.sampleSize=i4,T.set=DC,T.setWith=wC,T.shuffle=s4,T.slice=n8,T.sortBy=u4,T.sortedUniq=c8,T.sortedUniqBy=f8,T.split=jC,T.spread=g4,T.tail=h8,T.take=d8,T.takeRight=p8,T.takeRightWhile=_8,T.takeWhile=v8,T.tap=S8,T.throttle=m4,T.thru=ga,T.toArray=Gp,T.toPairs=r1,T.toPairsIn=n1,T.toPath=CA,T.toPlainObject=Qp,T.transform=bC,T.unary=x4,T.union=g8,T.unionBy=m8,T.unionWith=x8,T.uniq=y8,T.uniqBy=D8,T.uniqWith=w8,T.unset=EC,T.unzip=tl,T.unzipWith=$p,T.update=CC,T.updateWith=AC,T.values=is,T.valuesIn=FC,T.without=b8,T.words=o1,T.wrap=y4,T.xor=E8,T.xorBy=C8,T.xorWith=A8,T.zip=F8,T.zipObject=B8,T.zipObjectDeep=M8,T.zipWith=N8,T.entries=r1,T.entriesIn=n1,T.extend=Jp,T.extendWith=Ea,fl(T,T),T.add=FA,T.attempt=a1,T.camelCase=SC,T.capitalize=i1,T.ceil=BA,T.clamp=BC,T.clone=w4,T.cloneDeep=E4,T.cloneDeepWith=C4,T.cloneWith=b4,T.conformsTo=A4,T.deburr=s1,T.defaultTo=oA,T.divide=MA,T.endsWith=OC,T.eq=nn,T.escape=IC,T.escapeRegExp=TC,T.every=q8,T.find=W8,T.findIndex=Np,T.findKey=rC,T.findLast=H8,T.findLastIndex=Sp,T.findLastKey=nC,T.floor=NA,T.forEach=Rp,T.forEachRight=Pp,T.forIn=iC,T.forInRight=sC,T.forOwn=oC,T.forOwnRight=aC,T.get=ol,T.gt=F4,T.gte=B4,T.has=cC,T.hasIn=al,T.head=Ip,T.identity=wr,T.includes=V8,T.indexOf=HE,T.inRange=MC,T.invoke=dC,T.isArguments=xi,T.isArray=Pe,T.isArrayBuffer=M4,T.isArrayLike=yr,T.isArrayLikeObject=$t,T.isBoolean=N4,T.isBuffer=Xn,T.isDate=S4,T.isElement=O4,T.isEmpty=I4,T.isEqual=T4,T.isEqualWith=$4,T.isError=il,T.isFinite=L4,T.isFunction=Mn,T.isInteger=Yp,T.isLength=wa,T.isMap=Kp,T.isMatch=R4,T.isMatchWith=P4,T.isNaN=k4,T.isNative=z4,T.isNil=U4,T.isNull=q4,T.isNumber=Zp,T.isObject=Mt,T.isObjectLike=St,T.isPlainObject=Ps,T.isRegExp=sl,T.isSafeInteger=W4,T.isSet=Vp,T.isString=ba,T.isSymbol=Mr,T.isTypedArray=ns,T.isUndefined=H4,T.isWeakMap=j4,T.isWeakSet=Y4,T.join=VE,T.kebabCase=$C,T.last=Hr,T.lastIndexOf=GE,T.lowerCase=LC,T.lowerFirst=RC,T.lt=K4,T.lte=Z4,T.max=SA,T.maxBy=OA,T.mean=IA,T.meanBy=TA,T.min=$A,T.minBy=LA,T.stubArray=dl,T.stubFalse=pl,T.stubObject=DA,T.stubString=wA,T.stubTrue=bA,T.multiply=RA,T.nth=XE,T.noConflict=dA,T.noop=hl,T.now=xa,T.pad=PC,T.padEnd=kC,T.padStart=zC,T.parseInt=qC,T.random=NC,T.reduce=e4,T.reduceRight=t4,T.repeat=UC,T.replace=WC,T.result=yC,T.round=PA,T.runInContext=K,T.sample=n4,T.size=o4,T.snakeCase=HC,T.some=a4,T.sortedIndex=i8,T.sortedIndexBy=s8,T.sortedIndexOf=o8,T.sortedLastIndex=a8,T.sortedLastIndexBy=u8,T.sortedLastIndexOf=l8,T.startCase=YC,T.startsWith=KC,T.subtract=kA,T.sum=zA,T.sumBy=qA,T.template=ZC,T.times=EA,T.toFinite=Nn,T.toInteger=ze,T.toLength=Xp,T.toLower=VC,T.toNumber=jr,T.toSafeInteger=V4,T.toString=at,T.toUpper=GC,T.trim=XC,T.trimEnd=QC,T.trimStart=JC,T.truncate=eA,T.unescape=tA,T.uniqueId=AA,T.upperCase=rA,T.upperFirst=ul,T.each=Rp,T.eachRight=Pp,T.first=Ip,fl(T,function(){var o={};return fn(T,function(l,g){lt.call(T.prototype,g)||(o[g]=l)}),o}(),{chain:!1}),T.VERSION=r,kr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){T[o].placeholder=T}),kr(["drop","take"],function(o,l){Ke.prototype[o]=function(g){g=g===t?1:jt(ze(g),0);var E=this.__filtered__&&!l?new Ke(this):this.clone();return E.__filtered__?E.__takeCount__=sr(g,E.__takeCount__):E.__views__.push({size:sr(g,j),type:o+(E.__dir__<0?"Right":"")}),E},Ke.prototype[o+"Right"]=function(g){return this.reverse()[o](g).reverse()}}),kr(["filter","map","takeWhile"],function(o,l){var g=l+1,E=g==k||g==R;Ke.prototype[o]=function(S){var $=this.clone();return $.__iteratees__.push({iteratee:Me(S,3),type:g}),$.__filtered__=$.__filtered__||E,$}}),kr(["head","last"],function(o,l){var g="take"+(l?"Right":"");Ke.prototype[o]=function(){return this[g](1).value()[0]}}),kr(["initial","tail"],function(o,l){var g="drop"+(l?"":"Right");Ke.prototype[o]=function(){return this.__filtered__?new Ke(this):this[g](1)}}),Ke.prototype.compact=function(){return this.filter(wr)},Ke.prototype.find=function(o){return this.filter(o).head()},Ke.prototype.findLast=function(o){return this.reverse().find(o)},Ke.prototype.invokeMap=Ue(function(o,l){return typeof o=="function"?new Ke(this):this.map(function(g){return Os(g,o,l)})}),Ke.prototype.reject=function(o){return this.filter(Da(Me(o)))},Ke.prototype.slice=function(o,l){o=ze(o);var g=this;return g.__filtered__&&(o>0||l<0)?new Ke(g):(o<0?g=g.takeRight(-o):o&&(g=g.drop(o)),l!==t&&(l=ze(l),g=l<0?g.dropRight(-l):g.take(l-o)),g)},Ke.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},Ke.prototype.toArray=function(){return this.take(j)},fn(Ke.prototype,function(o,l){var g=/^(?:filter|find|map|reject)|While$/.test(l),E=/^(?:head|last)$/.test(l),S=T[E?"take"+(l=="last"?"Right":""):l],$=E||/^find/.test(l);S&&(T.prototype[l]=function(){var U=this.__wrapped__,W=E?[1]:arguments,G=U instanceof Ke,oe=W[0],ae=G||Pe(U),ce=function(He){var Ge=S.apply(T,Hn([He],W));return E&&ge?Ge[0]:Ge};ae&&g&&typeof oe=="function"&&oe.length!=1&&(G=ae=!1);var ge=this.__chain__,Ce=!!this.__actions__.length,Ne=$&&!ge,qe=G&&!Ce;if(!$&&ae){U=qe?U:new Ke(this);var Se=o.apply(U,W);return Se.__actions__.push({func:ga,args:[ce],thisArg:t}),new qr(Se,ge)}return Ne&&qe?o.apply(this,W):(Se=this.thru(ce),Ne?E?Se.value()[0]:Se.value():Se)})}),kr(["pop","push","shift","sort","splice","unshift"],function(o){var l=Wo[o],g=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",E=/^(?:pop|shift)$/.test(o);T.prototype[o]=function(){var S=arguments;if(E&&!this.__chain__){var $=this.value();return l.apply(Pe($)?$:[],S)}return this[g](function(U){return l.apply(Pe(U)?U:[],S)})}}),fn(Ke.prototype,function(o,l){var g=T[l];if(g){var E=g.name+"";lt.call(Qi,E)||(Qi[E]=[]),Qi[E].push({name:l,func:g})}}),Qi[ca(t,m).name]=[{name:"wrapper",func:t}],Ke.prototype.clone=tb,Ke.prototype.reverse=rb,Ke.prototype.value=nb,T.prototype.at=O8,T.prototype.chain=I8,T.prototype.commit=T8,T.prototype.next=$8,T.prototype.plant=R8,T.prototype.reverse=P8,T.prototype.toJSON=T.prototype.valueOf=T.prototype.value=k8,T.prototype.first=T.prototype.head,Cs&&(T.prototype[Cs]=L8),T},Vi=T2();fi?((fi.exports=Vi)._=Vi,c0._=Vi):Jt._=Vi}).call(ye)}(Qn,Qn.exports);var Yr=Qn.exports;class c1{constructor(e,t){q(this,"_defaultParams");q(this,"_UserTypeFileds");q(this,"_varipKeys");this._defaultParams=e,this._UserTypeFileds=this._createDynamicClass(),this._varipKeys=t}copy(e){return Yr.cloneDeep(e)}new(e={}){return new this._UserTypeFileds(Object.assign(Yr.cloneDeep(this._defaultParams),e),this._varipKeys)}addNewMethod(e,t){this._UserTypeFileds.prototype[e]=t}_createDynamicClass(){return class{constructor(e,t){q(this,"_varipKeys");Object.assign(this,e),this._varipKeys=t}get varipKeys(){return[...this._varipKeys]}copy(){return Yr.cloneDeep(this)}}}}var xl={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(ye,function(){var t=1e3,r=6e4,n=36e5,i="millisecond",a="second",u="minute",f="hour",c="day",h="week",d="month",p="quarter",v="year",x="date",_="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,w={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(k){var z=["th","st","nd","rd"],R=k%100;return"["+k+(z[(R-20)%10]||z[R]||z[0])+"]"}},D=function(k,z,R){var V=String(k);return!V||V.length>=z?k:""+Array(z+1-V.length).join(R)+k},C={s:D,z:function(k){var z=-k.utcOffset(),R=Math.abs(z),V=Math.floor(R/60),H=R%60;return(z<=0?"+":"-")+D(V,2,"0")+":"+D(H,2,"0")},m:function k(z,R){if(z.date()<R.date())return-k(R,z);var V=12*(R.year()-z.year())+(R.month()-z.month()),H=z.clone().add(V,d),ee=R-H<0,te=z.clone().add(V+(ee?-1:1),d);return+(-(V+(R-H)/(ee?H-te:te-H))||0)},a:function(k){return k<0?Math.ceil(k)||0:Math.floor(k)},p:function(k){return{M:d,y:v,w:h,d:c,D:x,h:f,m:u,s:a,ms:i,Q:p}[k]||String(k||"").toLowerCase().replace(/s$/,"")},u:function(k){return k===void 0}},b="en",F={};F[b]=w;var B="$isDayjsObject",M=function(k){return k instanceof I||!(!k||!k[B])},O=function k(z,R,V){var H;if(!z)return b;if(typeof z=="string"){var ee=z.toLowerCase();F[ee]&&(H=ee),R&&(F[ee]=R,H=ee);var te=z.split("-");if(!H&&te.length>1)return k(te[0])}else{var j=z.name;F[j]=z,H=j}return!V&&H&&(b=H),H||!V&&b},A=function(k,z){if(M(k))return k.clone();var R=typeof z=="object"?z:{};return R.date=k,R.args=arguments,new I(R)},N=C;N.l=O,N.i=M,N.w=function(k,z){return A(k,{locale:z.$L,utc:z.$u,x:z.$x,$offset:z.$offset})};var I=function(){function k(R){this.$L=O(R.locale,null,!0),this.parse(R),this.$x=this.$x||R.x||{},this[B]=!0}var z=k.prototype;return z.parse=function(R){this.$d=function(V){var H=V.date,ee=V.utc;if(H===null)return new Date(NaN);if(N.u(H))return new Date;if(H instanceof Date)return new Date(H);if(typeof H=="string"&&!/Z$/i.test(H)){var te=H.match(y);if(te){var j=te[2]-1||0,X=(te[7]||"0").substring(0,3);return ee?new Date(Date.UTC(te[1],j,te[3]||1,te[4]||0,te[5]||0,te[6]||0,X)):new Date(te[1],j,te[3]||1,te[4]||0,te[5]||0,te[6]||0,X)}}return new Date(H)}(R),this.init()},z.init=function(){var R=this.$d;this.$y=R.getFullYear(),this.$M=R.getMonth(),this.$D=R.getDate(),this.$W=R.getDay(),this.$H=R.getHours(),this.$m=R.getMinutes(),this.$s=R.getSeconds(),this.$ms=R.getMilliseconds()},z.$utils=function(){return N},z.isValid=function(){return this.$d.toString()!==_},z.isSame=function(R,V){var H=A(R);return this.startOf(V)<=H&&H<=this.endOf(V)},z.isAfter=function(R,V){return A(R)<this.startOf(V)},z.isBefore=function(R,V){return this.endOf(V)<A(R)},z.$g=function(R,V,H){return N.u(R)?this[V]:this.set(H,R)},z.unix=function(){return Math.floor(this.valueOf()/1e3)},z.valueOf=function(){return this.$d.getTime()},z.startOf=function(R,V){var H=this,ee=!!N.u(V)||V,te=N.p(R),j=function(Oe,Fe){var nt=N.w(H.$u?Date.UTC(H.$y,Fe,Oe):new Date(H.$y,Fe,Oe),H);return ee?nt:nt.endOf(c)},X=function(Oe,Fe){return N.w(H.toDate()[Oe].apply(H.toDate("s"),(ee?[0,0,0,0]:[23,59,59,999]).slice(Fe)),H)},Y=this.$W,Q=this.$M,pe=this.$D,De="set"+(this.$u?"UTC":"");switch(te){case v:return ee?j(1,0):j(31,11);case d:return ee?j(1,Q):j(0,Q+1);case h:var we=this.$locale().weekStart||0,be=(Y<we?Y+7:Y)-we;return j(ee?pe-be:pe+(6-be),Q);case c:case x:return X(De+"Hours",0);case f:return X(De+"Minutes",1);case u:return X(De+"Seconds",2);case a:return X(De+"Milliseconds",3);default:return this.clone()}},z.endOf=function(R){return this.startOf(R,!1)},z.$set=function(R,V){var H,ee=N.p(R),te="set"+(this.$u?"UTC":""),j=(H={},H[c]=te+"Date",H[x]=te+"Date",H[d]=te+"Month",H[v]=te+"FullYear",H[f]=te+"Hours",H[u]=te+"Minutes",H[a]=te+"Seconds",H[i]=te+"Milliseconds",H)[ee],X=ee===c?this.$D+(V-this.$W):V;if(ee===d||ee===v){var Y=this.clone().set(x,1);Y.$d[j](X),Y.init(),this.$d=Y.set(x,Math.min(this.$D,Y.daysInMonth())).$d}else j&&this.$d[j](X);return this.init(),this},z.set=function(R,V){return this.clone().$set(R,V)},z.get=function(R){return this[N.p(R)]()},z.add=function(R,V){var H,ee=this;R=Number(R);var te=N.p(V),j=function(Q){var pe=A(ee);return N.w(pe.date(pe.date()+Math.round(Q*R)),ee)};if(te===d)return this.set(d,this.$M+R);if(te===v)return this.set(v,this.$y+R);if(te===c)return j(1);if(te===h)return j(7);var X=(H={},H[u]=r,H[f]=n,H[a]=t,H)[te]||1,Y=this.$d.getTime()+R*X;return N.w(Y,this)},z.subtract=function(R,V){return this.add(-1*R,V)},z.format=function(R){var V=this,H=this.$locale();if(!this.isValid())return H.invalidDate||_;var ee=R||"YYYY-MM-DDTHH:mm:ssZ",te=N.z(this),j=this.$H,X=this.$m,Y=this.$M,Q=H.weekdays,pe=H.months,De=H.meridiem,we=function(Fe,nt,Ye,Ie){return Fe&&(Fe[nt]||Fe(V,ee))||Ye[nt].slice(0,Ie)},be=function(Fe){return N.s(j%12||12,Fe,"0")},Oe=De||function(Fe,nt,Ye){var Ie=Fe<12?"AM":"PM";return Ye?Ie.toLowerCase():Ie};return ee.replace(m,function(Fe,nt){return nt||function(Ye){switch(Ye){case"YY":return String(V.$y).slice(-2);case"YYYY":return N.s(V.$y,4,"0");case"M":return Y+1;case"MM":return N.s(Y+1,2,"0");case"MMM":return we(H.monthsShort,Y,pe,3);case"MMMM":return we(pe,Y);case"D":return V.$D;case"DD":return N.s(V.$D,2,"0");case"d":return String(V.$W);case"dd":return we(H.weekdaysMin,V.$W,Q,2);case"ddd":return we(H.weekdaysShort,V.$W,Q,3);case"dddd":return Q[V.$W];case"H":return String(j);case"HH":return N.s(j,2,"0");case"h":return be(1);case"hh":return be(2);case"a":return Oe(j,X,!0);case"A":return Oe(j,X,!1);case"m":return String(X);case"mm":return N.s(X,2,"0");case"s":return String(V.$s);case"ss":return N.s(V.$s,2,"0");case"SSS":return N.s(V.$ms,3,"0");case"Z":return te}return null}(Fe)||te.replace(":","")})},z.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},z.diff=function(R,V,H){var ee,te=this,j=N.p(V),X=A(R),Y=(X.utcOffset()-this.utcOffset())*r,Q=this-X,pe=function(){return N.m(te,X)};switch(j){case v:ee=pe()/12;break;case d:ee=pe();break;case p:ee=pe()/3;break;case h:ee=(Q-Y)/6048e5;break;case c:ee=(Q-Y)/864e5;break;case f:ee=Q/n;break;case u:ee=Q/r;break;case a:ee=Q/t;break;default:ee=Q}return H?ee:N.a(ee)},z.daysInMonth=function(){return this.endOf(d).$D},z.$locale=function(){return F[this.$L]},z.locale=function(R,V){if(!R)return this.$L;var H=this.clone(),ee=O(R,V,!0);return ee&&(H.$L=ee),H},z.clone=function(){return N.w(this.$d,this)},z.toDate=function(){return new Date(this.valueOf())},z.toJSON=function(){return this.isValid()?this.toISOString():null},z.toISOString=function(){return this.$d.toISOString()},z.toString=function(){return this.$d.toUTCString()},k}(),L=I.prototype;return A.prototype=L,[["$ms",i],["$s",a],["$m",u],["$H",f],["$W",c],["$M",d],["$y",v],["$D",x]].forEach(function(k){L[k[1]]=function(z){return this.$g(z,k[0],k[1])}}),A.extend=function(k,z){return k.$i||(k(z,I,A),k.$i=!0),A},A.locale=O,A.isDayjs=M,A.unix=function(k){return A(1e3*k)},A.en=F[b],A.Ls=F,A.p={},A})})(xl);var f1=xl.exports,ot=tt(f1),yl={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(ye,function(){var t="minute",r=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(i,a,u){var f=a.prototype;u.utc=function(_){var y={date:_,utc:!0,args:arguments};return new a(y)},f.utc=function(_){var y=u(this.toDate(),{locale:this.$L,utc:!0});return _?y.add(this.utcOffset(),t):y},f.local=function(){return u(this.toDate(),{locale:this.$L,utc:!1})};var c=f.parse;f.parse=function(_){_.utc&&(this.$u=!0),this.$utils().u(_.$offset)||(this.$offset=_.$offset),c.call(this,_)};var h=f.init;f.init=function(){if(this.$u){var _=this.$d;this.$y=_.getUTCFullYear(),this.$M=_.getUTCMonth(),this.$D=_.getUTCDate(),this.$W=_.getUTCDay(),this.$H=_.getUTCHours(),this.$m=_.getUTCMinutes(),this.$s=_.getUTCSeconds(),this.$ms=_.getUTCMilliseconds()}else h.call(this)};var d=f.utcOffset;f.utcOffset=function(_,y){var m=this.$utils().u;if(m(_))return this.$u?0:m(this.$offset)?d.call(this):this.$offset;if(typeof _=="string"&&(_=function(b){b===void 0&&(b="");var F=b.match(r);if(!F)return null;var B=(""+F[0]).match(n)||["-",0,0],M=B[0],O=60*+B[1]+ +B[2];return O===0?0:M==="+"?O:-O}(_),_===null))return this;var w=Math.abs(_)<=16?60*_:_,D=this;if(y)return D.$offset=w,D.$u=_===0,D;if(_!==0){var C=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(D=this.local().add(w+C,t)).$offset=w,D.$x.$localOffset=C}else D=this.utc();return D};var p=f.format;f.format=function(_){var y=_||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return p.call(this,y)},f.valueOf=function(){var _=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*_},f.isUTC=function(){return!!this.$u},f.toISOString=function(){return this.toDate().toISOString()},f.toString=function(){return this.toDate().toUTCString()};var v=f.toDate;f.toDate=function(_){return _==="s"&&this.$offset?u(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():v.call(this)};var x=f.diff;f.diff=function(_,y,m){if(_&&this.$u===_.$u)return x.call(this,_,y,m);var w=this.local(),D=u(_).local();return x.call(w,D,y,m)}}})})(yl);var h1=yl.exports,Dl=tt(h1),wl={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(ye,function(){var t={year:0,month:1,day:2,hour:3,minute:4,second:5},r={};return function(n,i,a){var u,f=function(p,v,x){x===void 0&&(x={});var _=new Date(p),y=function(m,w){w===void 0&&(w={});var D=w.timeZoneName||"short",C=m+"|"+D,b=r[C];return b||(b=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:m,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:D}),r[C]=b),b}(v,x);return y.formatToParts(_)},c=function(p,v){for(var x=f(p,v),_=[],y=0;y<x.length;y+=1){var m=x[y],w=m.type,D=m.value,C=t[w];C>=0&&(_[C]=parseInt(D,10))}var b=_[3],F=b===24?0:b,B=_[0]+"-"+_[1]+"-"+_[2]+" "+F+":"+_[4]+":"+_[5]+":000",M=+p;return(a.utc(B).valueOf()-(M-=M%1e3))/6e4},h=i.prototype;h.tz=function(p,v){p===void 0&&(p=u);var x=this.utcOffset(),_=this.toDate(),y=_.toLocaleString("en-US",{timeZone:p}),m=Math.round((_-new Date(y))/1e3/60),w=a(y,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(15*-Math.round(_.getTimezoneOffset()/15)-m,!0);if(v){var D=w.utcOffset();w=w.add(x-D,"minute")}return w.$x.$timezone=p,w},h.offsetName=function(p){var v=this.$x.$timezone||a.tz.guess(),x=f(this.valueOf(),v,{timeZoneName:p}).find(function(_){return _.type.toLowerCase()==="timezonename"});return x&&x.value};var d=h.startOf;h.startOf=function(p,v){if(!this.$x||!this.$x.$timezone)return d.call(this,p,v);var x=a(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return d.call(x,p,v).tz(this.$x.$timezone,!0)},a.tz=function(p,v,x){var _=x&&v,y=x||v||u,m=c(+a(),y);if(typeof p!="string")return a(p).tz(y);var w=function(F,B,M){var O=F-60*B*1e3,A=c(O,M);if(B===A)return[O,B];var N=c(O-=60*(A-B)*1e3,M);return A===N?[O,A]:[F-60*Math.min(A,N)*1e3,Math.max(A,N)]}(a.utc(p,_).valueOf(),m,y),D=w[0],C=w[1],b=a(D).utcOffset(C);return b.$x.$timezone=y,b},a.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},a.tz.setDefault=function(p){u=p}}})})(wl);var d1=wl.exports,p1=tt(d1),bl={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(ye,function(){var t="week",r="year";return function(n,i,a){var u=i.prototype;u.week=function(f){if(f===void 0&&(f=null),f!==null)return this.add(7*(f-this.week()),"day");var c=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var h=a(this).startOf(r).add(1,r).date(c),d=a(this).endOf(t);if(h.isBefore(d))return 1}var p=a(this).startOf(r).date(c).startOf(t).subtract(1,"millisecond"),v=this.diff(p,t,!0);return v<0?a(this).startOf("week").week():Math.ceil(v)},u.weeks=function(f){return f===void 0&&(f=null),this.week(f)}}})})(bl);var _1=bl.exports,v1=tt(_1);function Zt(s,e){return s.replace(/\$(\w+)/g,(t,r)=>String(e[r])||t)}function ks(s){const e=parseInt(s)||1;let t=s.replace(/\d+/,"");return t==="m"||t==="M"?t="M":t?t=t.toLocaleLowerCase():t="m",[e,t]}function g1(s){const e=/([+-])(\d{1,2})(\d{0,2})/,t=s.replace(/GMT|UTC/,"").match(e);if(!t)throw new Error("Invalid timezone string");const[,r,n,i]=t,a=parseInt(n,10)*60||0,u=parseInt(i,10)||0;return(r==="+"?-1:1)*(a+u)}function Kr(s,e){return e&&(e.startsWith("UTC")||e.startsWith("GMT"))?ot(s).utcOffset(g1(e)):ot(s).tz(e)}function pn(s){const[e,t]=ks(s);let r=0;switch(t){case"m":r=60;break;case"s":r=1;break;case"M":r=31*24*60*60;break;case"d":r=24*60*60;break;case"w":r=7*24*60*60;break;default:r=60*60;break}return Math.round(Number(e)*r)}function me(s){return typeof s!="number"||isNaN(s)}function _n(s,e){for(const t of e)s!=null&&s.hasOwnProperty(t)&&s[t]===void 0&&(s[t]=null)}var an=(s=>(s.BOOL="bool",s.INT="int",s.FLOAT="float",s.ARRAY="array",s.BOX="box",s.CHART_POINT="chart.point",s.COLOR="color",s.CONST="const",s.LABEL="label",s.LINE="line",s.LINEFILL="linefill",s.MAP="map",s.MATRIX="matrix",s.POLYLINE="polyline",s.SERIES="series",s.SIMPLE="simple",s.STRING="string",s.TABLE="table",s.UNDETERMINED="undetermined type",s.INPUT="input",s.NA="na",s.VOID="void",s.ENUM="enum",s))(an||{}),zs=(s=>(s.dividends="dividends",s.none="none",s.splits="splits",s))(zs||{}),Zr=(s=>(s.freqAll="freq_all",s.freqOncePerBar="freq_once_per_bar",s.freqOncePerBarClose="freq_once_per_bar_close",s))(Zr||{}),ss=(s=>(s.gapsOff="gaps_off",s.gapsOn="gaps_on",s.lookaheadOff="lookahead_off",s.lookaheadOn="lookahead_on",s))(ss||{}),Vt=(s=>(s.all="all",s.dataWindow="data_window",s.none="none",s.pane="pane",s.priceScale="price_scale",s.statusLine="status_line",s))(Vt||{}),Vr=(s=>(s.both="both",s.left="left",s.none="none",s.right="right",s))(Vr||{}),Je=(s=>(s.inherit="inherit",s.mintick="mintick",s.percent="percent",s.price="price",s.volume="volume",s))(Je||{}),qs=(s=>(s.styleDashed="style_dashed",s.styleDotted="style_dotted",s.styleSolid="style_solid",s))(qs||{}),gt=(s=>(s.styleArrowdown="style_arrowdown",s.styleArrowup="style_arrowup",s.styleCircle="style_circle",s.styleCross="style_cross",s.styleDiamond="style_diamond",s.styleFlag="style_flag",s.styleLabelCenter="style_label_center",s.styleLabelDown="style_label_down",s.styleLabelLeft="style_label_left",s.styleLabelLowerLeft="style_label_lower_left",s.styleLabelLowerRight="style_label_lower_right",s.styleLabelRight="style_label_right",s.styleLabelUp="style_label_up",s.styleLabelUpperLeft="style_label_upper_left",s.styleLabelUpperRight="style_label_upper_right",s.styleNone="style_none",s.styleSquare="style_square",s.styleTextOutline="style_text_outline",s.styleTriangledown="style_triangledown",s.styleTriangleup="style_triangleup",s.styleXcross="style_xcross",s))(gt||{}),qt=(s=>(s.styleArrowBoth="style_arrow_both",s.styleArrowLeft="style_arrow_left",s.styleArrowRight="style_arrow_right",s.styleDashed="style_dashed",s.styleDotted="style_dotted",s.styleSolid="style_solid",s))(qt||{}),vn=(s=>(s.abovebar="abovebar",s.absolute="absolute",s.belowbar="belowbar",s.bottom="bottom",s.top="top",s))(vn||{}),Jn=(s=>(s.ascending="ascending",s.descending="descending",s))(Jn||{}),Or=(s=>(s.styleArea="Area",s.styleAreabr="Area With Breaks",s.styleCircles="Circles",s.styleColumns="Columns",s.styleCross="Cross",s.styleHistogram="Histogram",s.styleLine="Line",s.styleLinebr="Line With Breaks",s.styleStepline="Step Line",s.styleSteplineDiamond="Step Line With Diamonds",s.styleSteplinebr="Step line with Breaks",s))(Or||{}),br=(s=>(s.bottomCenter="bottom_center",s.bottomLeft="bottom_left",s.bottomRight="bottom_right",s.middleCenter="middle_center",s.middleLeft="middle_left",s.middleRight="middle_right",s.topCenter="top_center",s.topLeft="top_left",s.topRight="top_right",s))(br||{}),Us=(s=>(s.left="left",s.none="none",s.right="right",s))(Us||{}),yi=(s=>(s.extended="extended",s.regular="regular",s))(yi||{}),_r=(s=>(s.arrowdown="arrowdown",s.arrowup="arrowup",s.circle="circle",s.cross="cross",s.diamond="diamond",s.flag="flag",s.labeldown="labeldown",s.labelup="labelup",s.square="square",s.triangledown="triangledown",s.triangleup="triangleup",s.xcross="xcross",s))(_r||{}),ar=(s=>(s.auto="auto",s.huge="huge",s.large="large",s.normal="normal",s.small="small",s.tiny="tiny",s))(ar||{}),ei=(s=>(s.familyDefault="default",s.familyMonospace="monospace",s))(ei||{}),Rt=(s=>(s.cash="cash",s.fixed="fixed",s.percentOfEquity="percent_of_equity",s))(Rt||{}),Ir=(s=>(s.cashPerContract="cash_per_contract",s.cashPerOrder="cash_per_order",s.percent="percent",s))(Ir||{}),mt=(s=>(s.all="all",s.long="long",s.short="short",s))(mt||{}),gn=(s=>(s.cancel="cancel",s.none="none",s.reduce="reduce",s))(gn||{}),je=(s=>(s.alignBottom="align_bottom",s.alignCenter="align_center",s.alignLeft="align_left",s.alignRight="align_right",s.alignTop="align_top",s.wrapAuto="wrap_auto",s.wrapNone="wrap_none",s))(je||{}),bt=(s=>(s.bar_index="bar_index",s.bar_time="bar_time",s))(bt||{}),Gr=(s=>(s.abovebar="abovebar",s.belowbar="belowbar",s.price="price",s))(Gr||{}),Ws=(s=>(s.actual="actual",s.estimate="estimate",s.standardized="standardized",s))(Ws||{}),ti=(s=>(s.traditional="Traditional",s.fibonacci="Fibonacci",s.woodie="Woodie",s.classic="Classic",s.dm="DM",s.camarilla="Camarilla",s))(ti||{}),ur=(s=>(s.INT="int",s.BOOL="bool",s.TIME="time",s.COLOR="color",s.FLOAT="float",s.PRICE="price",s.SOURCE="source",s.STRING="string",s.SYMBOL="symbol",s.SESSION="session",s.TEXT_AREA="text_area",s.TIMEFRAME="timeframe",s.ENUM="enum",s))(ur||{}),Ze=(s=>(s[s.Hint=1]="Hint",s[s.Info=2]="Info",s[s.Warning=4]="Warning",s[s.Error=8]="Error",s))(Ze||{});const ct={onlyInLoop:"'$text' is only allowed inside loops",invalidType:"Invalid argument 'expr$index' in 'operator SQBR' call",typeUseError:"Cannot specify a type form '$text' without also specifying the type.",notTypeKeyword:"'$text' is not a valid type keyword in variable declaration",undeclared:"Undeclared identifier '$name'",repeatVar:"'$name' is already defined",typeRepeatErr:"$keyword '$name' is already defined.",typeMismatch:"Cannot call '$operator' with argument '$index'. An argument of '$typeE' type was used but a '$typeR' is expected.",assignTypeMismatch:"Cannot assign a value of the `$typeE` type to the '$name' variable. The variable is declared with the `$typeR` type.",voidNotVar:"Void expression cannot be assigned to a variable",declareTypeErr:"Declared type '$type' is not compatible with assigned type '$valueType'",mapKeyValErr:"Cannot put <$typeA, $typeB> pairs into a map containing `$typeC` keys and `$typeD` values. The maps passed into the `$name()` function must have the same key types and value types.",inputSourceErr:"Invalid value for the '$name' parameter of the '$funcName' function. Possible values: [open, high, low, close, hl2, hlc3, ohlc4, hlcc4, volume].",buildInUseErr:"Cannot use '$name' as the default value of a type's field. The default value cannot be a function, variable or calculation.",argsLenErr:"Too many arguments passed into the `$name()` function call. Passed $lenA arguments but expected $lenB.",requiredParamErr:"No value assigned to the `$argName` parameter in $name()",argsSyntaxErr:"Syntax error after the argument for `$argName`. Arguments without their parameter name cannot be used after arguments with parameter names.",requestArgsErr:"Type $type cannot be used in $name '$argName' argument",mapKeyErr:"Incorrect `key` type `$type` in the variable. The `key` type must be one of the following: int, float, string, bool, color.",templateErr:"Incorrect number of arguments for the template: $countA expected, $countB passed.",templateNoSupportErr:"The '$name()' function does not support templates",ifOrSwitchTypeErr:"Return type of one of the '$keyword' blocks is not compatible with return type of other block(s) ($types)",argsNameErr:"The '$name' function does not have an argument with the name '$argName'",noFiledErr:"Object has no field $name",methodNotExistErr:"Could not find method or method reference '$methodName' for '$name'",tupleVarErr:"Syntax error: The quantities of tuple elements on each side of the assignment operator do not match. The right side has $indexA but the left side has $indexB.",tupleLeftVarErr:"Invalid assignment. Cannot assign a tuple to a variable '$name'.",tupleRightVarErr:"Cannot assign a variable to a tuple. The right side must be a function call or structure ('if', 'switch', 'for', 'while') returning a tuple with the same number of elements.",tempateTypeErr:"Syntax error: Only templates for arrays and matrices consist of a single type identifier enclosed in angle brackets.",qualifierErr:"'$name' is not a valid type qualifier. Possible values: 'const', 'simple', 'series'",notFindFuncErr:"Could not find function or function reference '$name'",naVarErr:"Value with NA type cannot be assigned to a variable that was defined without type keyword",notHistoryErr:"Variable '$name' doesn't have history values",defaultValueErr:"The default value cannot be a function, variable or calculation.",defaultValueTypeErr:"Default value of type $typeE can not be assigned to an argument of type $typeR",typeFieldErr:"In a type declaration, all fields without a default value must be explicitly typified.",unaryErr:"Syntax error at input '$sign'",funcArgAssignErr:"Function arguments cannot be mutable ('$name')",declaredErr:"A variable declared with the '$prefix' keyword cannot accept values of the '$type' form. Assign a '$prefix' value to this variable or remove the '$prefix' keyword from its declaration.",globalFuncErr:"Cannot use '$name' in local scope",onlyStatementErr:"Scripts must contain one declaration statement: `indicator()`, `strategy()` or `library()`, Your script has $count.",modifyGlobalVarErr:"Cannot modify global variable '$name' in function",inputDefvalErr:"Arguments of input function must be of constant type, or 'source' builtin variables.",objectIsNaErr:"Cannot access the '$name' $type of an na object. The object is 'na'.",buidinAssignErr:"Cannot assign a new value to the built-in variable '$name'.",buidinVarErr:"Cannot shadow the built-in variable `$name` because it has already been used as a built-in.",useNaErr:"Cannot use an `na` value of an unspecified type in the `$name` function.",libraryTitleErr:"Invalid argument 'title' in 'library' call. It cannot contain spaces, special characters or begin with a digit.",exportFuncArgErr:"All exported functions args should be typified",indiRunErr:"An indicator must contain at least one of the following: any `plot*()` function, `barcolor()`, `bgcolor()`, `hline()`, `alertcondition()`, or any drawing (line, label, box, table, polyline).",libraryExportErr:"A library must contain at least one exported function, method, or type.",strategyRunErr:"A strategy must contain at least one of the following: any `strategy.*()` function that creates orders, any `plot*()` function, `barcolor()`, `bgcolor()`, `hline()`, or any drawing (line, label, box, table, polyline).",exportUseErr:"Only libraries can contain exported $type.",funcRepeatErr:"The '$name' function has overloads with the same parameters. The type of parameters must be different in overloaded versions of functions.",importMultipleErr:"Cannot import a library more than once",importNotExitErr:"The user '$username' does not have a published library titled '$libraryName'",importNameRepeatErr:"More than one import uses the same alias: $name. Previous usage at line: $line",exportFuncHasInputErr:"The exported function '$func' depends on the '$name' input variable, which is not allowed.",libraryTitleIsKeywordErr:"Invalid argument 'title' in 'library' call. Token: '$name' can't be used as library title.",exportFuncUseGlobalVarErr:"Cannot use global variables in exported functions. Function: $func",loopRuntimeErr:"Loop takes too long to execute (> 500 ms)",paramsErr:"Invalid value '$value' for '$param' parameter of the '$func' function. Possible values: $targetVal",displayErr:"Invalid argument 'display' in '$func' call. Possible values: $values",exportFuncUseReqErr:"Cannot use `request.*()` call in exported function `$name()`",requestExprErr:"Type series $type cannot be used in $name 'expression' argument",argDefaultErr:"The default value assigned to a parameter must be either a literal value (e.g., `5`) or a built-in variable (e.g., `close`)",overloadFuncErr:"Cannot use global variables or any values qualified as 'input' in the local scopes of overloaded functions or methods. Remove any global variables or inputs from the scopes of all '$name()' overloads.",againAssignErr:"Unable to determine the object for the field assignment. Try putting the object into a separate variable before assigning values to its fields.",requestUserInLoopErr:"Cannot use `request.*()` call within loops or conditional structures.",enumVarNameErr:"Invalid enum name '$name': `bool`, `int`, `float`, `string`, and `color` are not allowed.",enumVarNameBuiltinErr:"Invalid object name: $name. Namespaces of built-ins cannot be used.",typeNameErr:"Invalid user-defined type name '$name': `bool`, `int`, `float`, `string`, and `color` are not allowed.",enumUseErr:"Cannot use the '$name' as a value. Use one of the enum's fields instead.",conditionalErr:"'$name' conditional expression must be of a bool type!",fortoErr:'The value of the "for" loop must be a number.',indicatorUseStrategyFuncErr:"You cannot use strategy $type ($name) in indicator script.",arrEmptyErr:"Array must not be empty",arrLengthDiffErr:"Arrays have different lengths",arrTypeErr:"数组类型错误,array.$name方法只能使用$type类型数组!",inputOptErr:"input's defval should be in options, but '$defval' is not in [$args]",mathRandomErr:"min must be less than max",matrixRehapeErr:"New matrix must be of same area as original matrix",strategyExitErr:"strategy.exit must have at least one of the following parameters: 'profit', 'limit', 'loss', 'stop' or one of the following pairs: 'trail_offset' and 'trail_price' / 'trail_points'. To close the position at market price, use 'strategy.close'",arrLenErr:"Invalid array length"};an.SERIES,an.SIMPLE,an.INPUT,an.CONST,an.INT,an.FLOAT,an.BOOL,an.COLOR,an.STRING;const m1=["close","open","high","low","hl2","hlc3","hlcc4","ohlc4","volume"],x1=["case","catch","default","delete","do","finally","function","instanceof","new","return","this","throw","try","typeof","void","with"],y1=["linefill","polyline","matrix","series","simple","string","array","color","const","float","label","table","bool","line","box","int","map","continue","for","varip","var","in","export","import","method","switch","break","while","else","type","and","for","not","as","by","if","in","or","to"];class D1{constructor(e){q(this,"_errorListener");this._errorListener=e}new({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_float({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_int({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_color({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_bool({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_string({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_line({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_box({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_table({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_linefill({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_label({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}copy({id:e}){return e==null?void 0:e.copy()}slice({id:e,index_from:t,index_to:r}){return e==null?void 0:e.slice({index_from:t,index_to:r})}size({id:e}){return e==null?void 0:e.size()}first({id:e}){return e==null?void 0:e.first()}abs({id:e},t){return e==null?void 0:e.abs(t)}avg({id:e},t){return e==null?void 0:e.avg(t)}binary_search({id:e,val:t},r){return e==null?void 0:e.binary_search({val:t},r)}binary_search_leftmost({id:e,val:t},r){return e==null?void 0:e.binary_search_leftmost({val:t},r)}binary_search_rightmost({id:e,val:t},r){return e==null?void 0:e.binary_search_rightmost({val:t},r)}clear({id:e}){e==null||e.clear()}concat({id1:e,id2:t}){return e==null?void 0:e.concat({id2:t})}covariance({id1:e,id2:t,biased:r},n){return e==null?void 0:e.covariance({id2:t,biased:r},n)}every({id:e},t){return e==null?void 0:e.every(t)}from(e,t){const r=new it(0,void 0,this._errorListener);return r._value=t,r}fill({id:e,value:t,index_from:r,index_to:n}){e==null||e.fill({value:t,index_from:r,index_to:n})}get({id:e,index:t}){return e==null?void 0:e.get({index:t})}includes({id:e,value:t}){return e==null?void 0:e.includes({value:t})}indexof({id:e,value:t}){return e==null?void 0:e.indexof({value:t})}insert({id:e,index:t,value:r}){e==null||e.insert({index:t,value:r})}join({id:e,separator:t},r){return e==null?void 0:e.join({separator:t},r)}last({id:e}){return e==null?void 0:e.last()}lastindexof({id:e,value:t}){return e==null?void 0:e.lastindexof({value:t})}max({id:e,nth:t},r){return e==null?void 0:e.max({nth:t},r)}median({id:e},t){return e==null?void 0:e.median(t)}min({id:e,nth:t},r){return e==null?void 0:e.min({nth:t},r)}mode({id:e},t){return e==null?void 0:e.mode(t)}percentile_linear_interpolation({id:e,percentage:t},r){return e==null?void 0:e.percentile_linear_interpolation({percentage:t},r)}percentile_nearest_rank({id:e,percentage:t},r){return e==null?void 0:e.percentile_nearest_rank({percentage:t},r)}percentrank({id:e,index:t},r){return e==null?void 0:e.percentrank({index:t},r)}pop({id:e}){return e==null?void 0:e.pop()}push({id:e,value:t}){e==null||e.push({value:t})}range({id:e},t){return e==null?void 0:e.range(t)}remove({id:e,index:t}){return e==null?void 0:e.remove({index:t})}reverse({id:e}){return e==null?void 0:e.reverse()}set({id:e,index:t,value:r}){e==null||e.set({index:t,value:r})}shift({id:e}){return e==null?void 0:e.shift()}some({id:e},t){return e==null?void 0:e.some(t)}sort({id:e,order:t},r){e==null||e.sort({order:t},r)}sort_indices({id:e,order:t},r){return e==null?void 0:e.sort_indices({order:t},r)}standardize({id:e},t){return e==null?void 0:e.standardize(t)}stdev({id:e,biased:t},r){return e==null?void 0:e.stdev({biased:t},r)}sum({id:e},t){return e==null?void 0:e.sum(t)}unshift({id:e,value:t}){e==null||e.unshift({value:t})}variance({id:e,biased:t},r){return e==null?void 0:e.variance({biased:t},r)}}class it{constructor(e=0,t,r){q(this,"_arrInstance");q(this,"_errorListener");this._errorListener=r,this._arrInstance=Array.from(new Array(e||0),()=>Yr.cloneDeep(t))}get isArray(){return!0}get _value(){return[...this._arrInstance]}set _value(e){this._arrInstance=[...e]}_deepCopyData(e){this._arrInstance=Yr.cloneDeep(e)}_copyData(e){this._arrInstance=e}copy(){const e=new it(0,void 0,this._errorListener);return e._deepCopyData(this._arrInstance),e}slice({index_from:e,index_to:t}){const r=new it(0,void 0,this._errorListener);return r._copyData(this._arrInstance.slice(e,t)),r}size(){return this._arrInstance.length}first(){return this._arrInstance[0]}abs(e){const t=new it(0,void 0,this._errorListener);this._verifySimpleType("number","abs","int/float",e);const r=this._arrInstance.map(n=>Math.abs(n));return t._copyData(r),t}avg(e){return this._verifySimpleType("number","avg","int/float",e),Yr.mean(this._arrInstance)}binary_search({val:e},t){return this._verifySimpleType("number","binary_search","int/float",t),me(e)?-1:this._binarySearch(this._arrInstance,e)}binary_search_leftmost({val:e},t){return this._verifySimpleType("number","binary_search_leftmost","int/float",t),me(e)?this._arrInstance.length-1:this._binarySearchLeftMost(this._arrInstance,e)}binary_search_rightmost({val:e},t){return this._verifySimpleType("number","binary_search_rightmost","int/float",t),me(e)?this._arrInstance.length:this._binarySearchRightMost(this._arrInstance,e)}clear(){this._arrInstance=[]}concat({id2:e}){return this._arrInstance=this._arrInstance.concat(e==null?void 0:e._value),this}covariance({id2:e,biased:t},r){return this._verifySimpleType("number","covariance","int/float",r),this._verifySimpleType("number","covariance","int/float",r,e==null?void 0:e._value),this._covariance(this._arrInstance,e._value,t,r)}every(e){return this._verifySimpleType("number|boolean","every","int/float/bool",e),this._arrInstance.every(t=>!!t)}fill({value:e,index_from:t=0,index_to:r}){this._arrInstance=this._setElements(this._arrInstance,e,t,r)}get({index:e}){if(!me(e))return this._arrInstance[e]}includes({value:e}){return this._arrInstance.includes(e)}indexof({value:e}){return this._arrInstance.indexOf(e)}insert({index:e,value:t}){me(e)||this._arrInstance.splice(e,0,t)}join({separator:e}={},t){return this._verifySimpleType("number|string","join","int/float/string",t),this._arrInstance.join(e)}last(){return this._arrInstance[this._arrInstance.length-1]}lastindexof({value:e}){return this._arrInstance.lastIndexOf(e)}max({nth:e}={},t){return this._verifySimpleType("number","max","int/float",t),this._maxNth([...this._arrInstance],e)}median(e){return this._verifySimpleType("number","median","int/float",e),this._median([...this._arrInstance])}min({nth:e}={},t){return this._verifySimpleType("number","min","int/float",t),this._minNth([...this._arrInstance],e)}mode(e){return this._verifySimpleType("number","mode","int/float",e),this._mode([...this._arrInstance])}percentile_linear_interpolation({percentage:e},t){return this._verifySimpleType("number","percentile_linear_interpolation","int/float",t),this._percentileLinearInterpolation([...this._arrInstance],e)}percentile_nearest_rank({percentage:e=0},t){var r;if(this._arrInstance.length===0||e<0||e>100||me(e)){(r=this._errorListener)==null||r.addError("Invalid percentile or empty array",t,Ze.Error);return}return this._verifySimpleType("number","percentile_nearest_rank","int/float",t),this._getNearestRankPercentile([...this._arrInstance],e)}percentrank({index:e},t){return this._verifySimpleType("number","percentrank","int/float",t),this._getPercentileRank([...this._arrInstance],e)}pop(){return this._arrInstance.pop()}push({value:e}){this._arrInstance.push(e)}range(e){var i;if(this._arrInstance.length===0){(i=this._errorListener)==null||i.addError(ct.arrEmptyErr,e,Ze.Error);return}this._verifySimpleType("number","range","int/float",e);const t=Math.min(...this._arrInstance);return Math.max(...this._arrInstance)-t}remove({index:e}){if(!me(e))return this._arrInstance.splice(e,1)[0]}reverse(){this._arrInstance.reverse()}set({index:e,value:t}){me(e)||(this._arrInstance[e]=t)}shift(){return this._arrInstance.shift()}some(e){return this._verifySimpleType("number|boolean","some","int/float/bool",e),this._arrInstance.some(t=>!!t)}sort({order:e}={},t){this._verifySimpleType("number","sort","int/float",t),this._arrInstance.sort((r,n)=>e!==Jn.descending?r-n:n-r)}sort_indices({order:e}={},t){this._verifySimpleType("number","sort_indices","int/float",t);const r=this._arrInstance.map((i,a)=>a);r.sort((i,a)=>e!==Jn.descending?this._arrInstance[i]-this._arrInstance[a]:this._arrInstance[a]-this._arrInstance[i]);const n=new it(0,void 0,this._errorListener);return n._copyData(r),n}standardize(e){this._verifySimpleType("number","standardize","int/float",e);const t=new it(0,void 0,this._errorListener);return t._copyData(this._standardizeArray([...this._arrInstance])),t}stdev({biased:e}={},t){var r;if(this._arrInstance.length===0){(r=this._errorListener)==null||r.addError(ct.arrEmptyErr,t,Ze.Error);return}return this._verifySimpleType("number","stdev","int/float",t),this._calculateStandardDeviations([...this._arrInstance],e)}sum(e){return this._verifySimpleType("number","sum","int/float",e),this._arrInstance.reduce((r,n)=>r+(n||0),0)}unshift({value:e}){this._arrInstance.unshift(e)}variance({biased:e}={},t){var r;if(this._arrInstance.length===0){(r=this._errorListener)==null||r.addError(ct.arrEmptyErr,t,Ze.Error);return}return this._verifySimpleType("number","variance","int/float",t),this._calculateVariances([...this._arrInstance],e)}_calculateVariances(e,t=!0){const r=e.reduce((a,u)=>a+(u||0),0)/e.length,n=e.reduce((a,u)=>a+((u||0)-r)**2,0),i=n/e.length;return t?i:e.length>1?n/(e.length-1):i}_calculateStandardDeviations(e,t=!0){const r=e.reduce((a,u)=>a+(u||0),0)/e.length,n=e.reduce((a,u)=>{const f=(u||0)-r;return a+f*f},0),i=Math.sqrt(n/e.length);return t?i:e.length>1?Math.sqrt(n/(e.length-1)):i}_standardizeArray(e){const t=e.reduce((i,a)=>i+(a||0),0)/e.length,r=Math.sqrt(e.reduce((i,a)=>i+Math.pow((a||0)-t,2),0)/e.length);return e.map(i=>((i||0)-t)/r)}_getPercentileRank(e,t=0){if(me(t))return;const r=e[t];let n=0;for(let a=0;a<e.length;a++)(e[a]<r||e[a]===r&&a!=t)&&n++;return n/(e.length-1)*100}_getNearestRankPercentile(e,t=0){const r=e.slice().sort((a,u)=>a-u),n=t/100*r.length,i=Math.ceil(n)-1;return r[i>=r.length?r.length-1:i]}_percentileLinearInterpolation(e,t=0){if(t<0||t>100||me(t))return;e.sort(function(i,a){return i-a});const r=e.length;t/=100;const n=1/(r*2);if(t<=n)return e[0];if(t>=1-1/(r*2))return e[r-1];for(const[i,a]of e.entries()){const u=e[i-1];if(t<(i+.5)/r)return u+(a-u)*(t-(i-.5)/r)/(1/r)}}_mode(e){const t={};let r=0;const n=[];for(const i of e)t[i]=(t[i]||0)+1,r=Math.max(r,t[i]);for(const i in t)t[i]===r&&n.push(Number(i));return Math.min(...r===1?e:n)}_median(e){e.sort(function(r,n){return r-n});const t=Math.floor(e.length/2);return e.length%2?e[t]:(e[t-1]+e[t])/2}_minNth(e,t=0){return e.sort(function(r,n){return r-n}),e[t]}_maxNth(e,t=0){return e.sort(function(r,n){return n-r}),e[t]}_setElements(e,t,r=0,n){n===void 0&&(n=e.length);for(let i=r;i<n;i++)e[i]=t;return e}_covariance(e,t,r=!0,n){var f;if(e.length!=t.length){(f=this._errorListener)==null||f.addError(ct.arrLengthDiffErr,n,Ze.Error);return}e=e.filter(c=>c!==void 0),t=t.filter(c=>c!==void 0);const i=e.reduce((c,h)=>c+h,0)/e.length,a=t.reduce((c,h)=>c+h,0)/t.length;let u=0;for(let c=0;c<e.length;c++)u+=(e[c]-i)*(t[c]-a);return r?u/e.length:u/(e.length-1)}_verifySimpleType(e,t,r,n,i=this._arrInstance){var u;i.filter(f=>f!==void 0).some(f=>!e.split("|").includes(typeof f))&&((u=this._errorListener)==null||u.addError(Zt(ct.arrTypeErr,{name:t,type:r}),n,Ze.Error))}_binarySearch(e,t){let r=0,n=e.length-1;for(;r<=n;){const i=Math.floor((r+n)/2);if(e[i]===t)return i;e[i]<t?r=i+1:n=i-1}return-1}_binarySearchLeftMost(e,t){let r=0,n=e.length-1;const i=[];for(;r<=n;){const a=Math.floor((r+n)/2);e[a]===t&&i.push(a),e[a]<t?r=a+1:n=a-1}return i.length?Math.min(...i):r-1}_binarySearchRightMost(e,t){let r=0,n=e.length-1;const i=[];for(;r<=n;){const a=Math.floor((r+n)/2);e[a]===t&&i.push(a),e[a]<=t?r=a+1:n=a-1}return i.length?Math.max(...i):r}}class w1{constructor(e,t){q(this,"_randomNums");q(this,"_mintick");q(this,"_cacheData");q(this,"_barIndex");q(this,"_errorListener");this._mintick=e,this._randomNums={},this._cacheData={},this._barIndex=0,this._errorListener=t}update(e){this._barIndex=e,this._randomNums={}}abs({number:e}){if(!me(e))return Math.abs(e)}acos({angle:e}){if(me(e))return;const t=Math.acos(e);return isNaN(t)?void 0:t}asin({angle:e}){if(me(e))return;const t=Math.asin(e);return isNaN(t)?void 0:t}atan({angle:e}){if(me(e))return;const t=Math.atan(e);return isNaN(t)?void 0:t}avg(e,t){return Yr.mean(t)}ceil({number:e}){if(!me(e))return Math.ceil(e)}floor({number:e}){if(!me(e))return Math.floor(e)}cos({angle:e}){if(me(e))return;const t=Math.cos(e);return isNaN(t)?void 0:t}sin({angle:e}){if(me(e))return;const t=Math.sin(e);return isNaN(t)?void 0:t}tan({angle:e}){if(me(e))return;const t=Math.tan(e);return isNaN(t)?void 0:t}exp({number:e}){if(!me(e))return Math.exp(e)}log({number:e}){if(!me(e))return Math.log(e)}log10({number:e}){if(!me(e))return Math.log10(e)}max(e,t){return t=t.filter(r=>!me(r)),Math.max(...t)}min(e,t){return t=t.filter(r=>!me(r)),Math.min(...t)}pow({base:e,exponent:t}){if(!(me(e)||me(t)))return Math.pow(e,t)}random({min:e=0,max:t=1,seed:r},n){if(me(e)&&(e=0),me(t)&&(t=1),r&&this._randomNums[r])return this._randomNums[r];if(e>=t){this._errorListener.addError(ct.mathRandomErr,n,Ze.Error);return}let i;do i=Math.random()*(t-e)+e;while(i===e||i===t);return r&&(this._randomNums[r]=i),i}round({number:e,precision:t}){if(!me(e))return me(t)?Math.round(e):Number(e==null?void 0:e.toFixed(t))}round_to_mintick({number:e}){if(!me(e))return Number(e==null?void 0:e.toFixed(this._mintick))}sign({number:e}){if(!me(e))return e&&Math.sign(e)}sqrt({number:e}){if(!me(e))return Math.sqrt(e)}sum({source:e,length:t=1},r){let n=this._cacheData[`sum_${r}`];n||(n=[]),n[this._barIndex]=e,this._cacheData[`sum_${r}`]=n;const i=n.filter(a=>!me(a));if(!(i.length<t))return Yr.sum(i.slice(-t))}todegrees({radians:e}){if(!me(e))return e*(180/Math.PI)}toradians({degrees:e}){if(!me(e))return e*(Math.PI/180)}}function Hs(){return Hs=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(s[r]=t[r])}return s},Hs.apply(this,arguments)}var El={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function _t(s){return typeof s=="number"}function Ot(s){return!s||typeof s!="object"||typeof s.constructor!="function"?!1:s.isBigNumber===!0&&typeof s.constructor.prototype=="object"&&s.constructor.prototype.isBigNumber===!0||typeof s.constructor.isDecimal=="function"&&s.constructor.isDecimal(s)===!0}function Cl(s){return s&&typeof s=="object"&&Object.getPrototypeOf(s).isComplex===!0||!1}function Al(s){return s&&typeof s=="object"&&Object.getPrototypeOf(s).isFraction===!0||!1}function Fl(s){return s&&s.constructor.prototype.isUnit===!0||!1}function un(s){return typeof s=="string"}var Ft=Array.isArray;function xt(s){return s&&s.constructor.prototype.isMatrix===!0||!1}function os(s){return Array.isArray(s)||xt(s)}function b1(s){return s&&s.isDenseMatrix&&s.constructor.prototype.isMatrix===!0||!1}function E1(s){return s&&s.isSparseMatrix&&s.constructor.prototype.isMatrix===!0||!1}function C1(s){return s&&s.constructor.prototype.isRange===!0||!1}function Aa(s){return s&&s.constructor.prototype.isIndex===!0||!1}function A1(s){return typeof s=="boolean"}function F1(s){return s&&s.constructor.prototype.isResultSet===!0||!1}function B1(s){return s&&s.constructor.prototype.isHelp===!0||!1}function M1(s){return typeof s=="function"}function N1(s){return s instanceof Date}function S1(s){return s instanceof RegExp}function Fa(s){return!!(s&&typeof s=="object"&&s.constructor===Object&&!Cl(s)&&!Al(s))}function O1(s){return s===null}function I1(s){return s===void 0}function T1(s){return s&&s.isAccessorNode===!0&&s.constructor.prototype.isNode===!0||!1}function $1(s){return s&&s.isArrayNode===!0&&s.constructor.prototype.isNode===!0||!1}function L1(s){return s&&s.isAssignmentNode===!0&&s.constructor.prototype.isNode===!0||!1}function R1(s){return s&&s.isBlockNode===!0&&s.constructor.prototype.isNode===!0||!1}function P1(s){return s&&s.isConditionalNode===!0&&s.constructor.prototype.isNode===!0||!1}function k1(s){return s&&s.isConstantNode===!0&&s.constructor.prototype.isNode===!0||!1}function z1(s){return s&&s.isFunctionAssignmentNode===!0&&s.constructor.prototype.isNode===!0||!1}function q1(s){return s&&s.isFunctionNode===!0&&s.constructor.prototype.isNode===!0||!1}function U1(s){return s&&s.isIndexNode===!0&&s.constructor.prototype.isNode===!0||!1}function W1(s){return s&&s.isNode===!0&&s.constructor.prototype.isNode===!0||!1}function H1(s){return s&&s.isObjectNode===!0&&s.constructor.prototype.isNode===!0||!1}function j1(s){return s&&s.isOperatorNode===!0&&s.constructor.prototype.isNode===!0||!1}function Y1(s){return s&&s.isParenthesisNode===!0&&s.constructor.prototype.isNode===!0||!1}function K1(s){return s&&s.isRangeNode===!0&&s.constructor.prototype.isNode===!0||!1}function Z1(s){return s&&s.isRelationalNode===!0&&s.constructor.prototype.isNode===!0||!1}function V1(s){return s&&s.isSymbolNode===!0&&s.constructor.prototype.isNode===!0||!1}function G1(s){return s&&s.constructor.prototype.isChain===!0||!1}function On(s){var e=typeof s;return e==="object"?s===null?"null":Ot(s)?"BigNumber":s.constructor&&s.constructor.name?s.constructor.name:"Object":e}function ut(s){var e=typeof s;if(e==="number"||e==="string"||e==="boolean"||s===null||s===void 0)return s;if(typeof s.clone=="function")return s.clone();if(Array.isArray(s))return s.map(function(t){return ut(t)});if(s instanceof Date)return new Date(s.valueOf());if(Ot(s))return s;if(Fa(s))return X1(s,ut);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(s,")"))}function X1(s,e){var t={};for(var r in s)as(s,r)&&(t[r]=e(s[r]));return t}function Bl(s,e){for(var t in e)as(e,t)&&(s[t]=e[t]);return s}function Di(s,e){var t,r,n;if(Array.isArray(s)){if(!Array.isArray(e)||s.length!==e.length)return!1;for(r=0,n=s.length;r<n;r++)if(!Di(s[r],e[r]))return!1;return!0}else{if(typeof s=="function")return s===e;if(s instanceof Object){if(Array.isArray(e)||!(e instanceof Object))return!1;for(t in s)if(!(t in e)||!Di(s[t],e[t]))return!1;for(t in e)if(!(t in s))return!1;return!0}else return s===e}}function as(s,e){return s&&Object.hasOwnProperty.call(s,e)}function Q1(s,e){for(var t={},r=0;r<e.length;r++){var n=e[r],i=s[n];i!==void 0&&(t[n]=i)}return t}var J1=["Matrix","Array"],e_=["number","BigNumber","Fraction"],Er=function(e){if(e)throw new Error(`The global config is readonly.
28
28
  Please create a mathjs instance if you want to change the default configuration.
29
29
  Example:
30
30
 
31
31
  import { create, all } from 'mathjs';
32
32
  const mathjs = create(all);
33
33
  mathjs.config({ number: 'BigNumber' });
34
- `);return Object.freeze(bl)};Hs(br,bl,{MATRIX_OPTIONS:J1,NUMBER_OPTIONS:e_});function Ml(){return!0}function Tr(){return!1}function wi(){}const Nl="Argument is not a typed-function.";function Sl(){function s(P){return typeof P=="object"&&P!==null&&P.constructor===Object}const e=[{name:"number",test:function(P){return typeof P=="number"}},{name:"string",test:function(P){return typeof P=="string"}},{name:"boolean",test:function(P){return typeof P=="boolean"}},{name:"Function",test:function(P){return typeof P=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(P){return P instanceof Date}},{name:"RegExp",test:function(P){return P instanceof RegExp}},{name:"Object",test:s},{name:"null",test:function(P){return P===null}},{name:"undefined",test:function(P){return P===void 0}}],t={name:"any",test:Ml,isAny:!0};let r,n,i=0,a={createCount:0};function u(P){const Z=r.get(P);if(Z)return Z;let J='Unknown type "'+P+'"';const ie=P.toLowerCase();let ue;for(ue of n)if(ue.toLowerCase()===ie){J+='. Did you mean "'+ue+'" ?';break}throw new TypeError(J)}function f(P){let Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any";const J=Z?u(Z).index:n.length,ie=[];for(let se=0;se<P.length;++se){if(!P[se]||typeof P[se].name!="string"||typeof P[se].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");const _e=P[se].name;if(r.has(_e))throw new TypeError('Duplicate type name "'+_e+'"');ie.push(_e),r.set(_e,{name:_e,test:P[se].test,isAny:P[se].isAny,index:J+se,conversionsTo:[]})}const ue=n.slice(J);n=n.slice(0,J).concat(ie).concat(ue);for(let se=J+ie.length;se<n.length;++se)r.get(n[se]).index=se}function c(){r=new Map,n=[],i=0,f([t],!1)}c(),f(e);function h(){let P;for(P of n)r.get(P).conversionsTo=[];i=0}function d(P){const Z=n.filter(J=>{const ie=r.get(J);return!ie.isAny&&ie.test(P)});return Z.length?Z:["any"]}function p(P){return P&&typeof P=="function"&&"_typedFunctionData"in P}function v(P,Z,J){if(!p(P))throw new TypeError(Nl);const ie=J&&J.exact,ue=Array.isArray(Z)?Z.join(","):Z,se=A(ue),_e=y(se);if(!ie||_e in P.signatures){const Xe=P._typedFunctionData.signatureMap.get(_e);if(Xe)return Xe}const he=se.length;let de;if(ie){de=[];let Xe;for(Xe in P.signatures)de.push(P._typedFunctionData.signatureMap.get(Xe))}else de=P._typedFunctionData.signatures;for(let Xe=0;Xe<he;++Xe){const et=se[Xe],dt=[];let zt;for(zt of de){const Tt=M(zt.params,Xe);if(!(!Tt||et.restParam&&!Tt.restParam)){if(!Tt.hasAny){const nr=D(Tt);if(et.types.some(fr=>!nr.has(fr.name)))continue}dt.push(zt)}}if(de=dt,de.length===0)break}let fe;for(fe of de)if(fe.params.length<=he)return fe;throw new TypeError("Signature not found (signature: "+(P.name||"unnamed")+"("+y(se,", ")+"))")}function x(P,Z,J){return v(P,Z,J).implementation}function _(P,Z){const J=u(Z);if(J.test(P))return P;const ie=J.conversionsTo;if(ie.length===0)throw new Error("There are no conversions to "+Z+" defined.");for(let ue=0;ue<ie.length;ue++)if(u(ie[ue].from).test(P))return ie[ue].convert(P);throw new Error("Cannot convert "+P+" to "+Z)}function y(P){let Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return P.map(J=>J.name).join(Z)}function m(P){const Z=P.indexOf("...")===0,ie=(Z?P.length>3?P.slice(3):"any":P).split("|").map(he=>u(he.trim()));let ue=!1,se=Z?"...":"";return{types:ie.map(function(he){return ue=he.isAny||ue,se+=he.name+"|",{name:he.name,typeIndex:he.index,test:he.test,isAny:he.isAny,conversion:null,conversionIndex:-1}}),name:se.slice(0,-1),hasAny:ue,hasConversion:!1,restParam:Z}}function w(P){const Z=P.types.map(_e=>_e.name),J=V(Z);let ie=P.hasAny,ue=P.name;const se=J.map(function(_e){const he=u(_e.from);return ie=he.isAny||ie,ue+="|"+_e.from,{name:_e.from,typeIndex:he.index,test:he.test,isAny:he.isAny,conversion:_e,conversionIndex:_e.index}});return{types:P.types.concat(se),name:ue,hasAny:ie,hasConversion:se.length>0,restParam:P.restParam}}function D(P){return P.typeSet||(P.typeSet=new Set,P.types.forEach(Z=>P.typeSet.add(Z.name))),P.typeSet}function A(P){const Z=[];if(typeof P!="string")throw new TypeError("Signatures must be strings");const J=P.trim();if(J==="")return Z;const ie=J.split(",");for(let ue=0;ue<ie.length;++ue){const se=m(ie[ue].trim());if(se.restParam&&ue!==ie.length-1)throw new SyntaxError('Unexpected rest parameter "'+ie[ue]+'": only allowed for the last parameter');if(se.types.length===0)return null;Z.push(se)}return Z}function E(P){const Z=Oe(P);return Z?Z.restParam:!1}function F(P){if(!P||P.types.length===0)return Ml;if(P.types.length===1)return u(P.types[0].name).test;if(P.types.length===2){const Z=u(P.types[0].name).test,J=u(P.types[1].name).test;return function(ue){return Z(ue)||J(ue)}}else{const Z=P.types.map(function(J){return u(J.name).test});return function(ie){for(let ue=0;ue<Z.length;ue++)if(Z[ue](ie))return!0;return!1}}}function B(P){let Z,J,ie;if(E(P)){Z=Ee(P).map(F);const ue=Z.length,se=F(Oe(P)),_e=function(he){for(let de=ue;de<he.length;de++)if(!se(he[de]))return!1;return!0};return function(de){for(let fe=0;fe<Z.length;fe++)if(!Z[fe](de[fe]))return!1;return _e(de)&&de.length>=ue+1}}else return P.length===0?function(se){return se.length===0}:P.length===1?(J=F(P[0]),function(se){return J(se[0])&&se.length===1}):P.length===2?(J=F(P[0]),ie=F(P[1]),function(se){return J(se[0])&&ie(se[1])&&se.length===2}):(Z=P.map(F),function(se){for(let _e=0;_e<Z.length;_e++)if(!Z[_e](se[_e]))return!1;return se.length===Z.length})}function M(P,Z){return Z<P.length?P[Z]:E(P)?Oe(P):null}function O(P,Z){const J=M(P,Z);return J?D(J):new Set}function C(P){return P.conversion===null||P.conversion===void 0}function N(P,Z){const J=new Set;return P.forEach(ie=>{const ue=O(ie.params,Z);let se;for(se of ue)J.add(se)}),J.has("any")?["any"]:Array.from(J)}function I(P,Z,J){let ie,ue;const se=P||"unnamed";let _e=J,he;for(he=0;he<Z.length;he++){const et=[];if(_e.forEach(dt=>{const zt=M(dt.params,he),Tt=F(zt);(he<dt.params.length||E(dt.params))&&Tt(Z[he])&&et.push(dt)}),et.length===0){if(ue=N(_e,he),ue.length>0){const dt=d(Z[he]);return ie=new TypeError("Unexpected type of argument in function "+se+" (expected: "+ue.join(" or ")+", actual: "+dt.join(" | ")+", index: "+he+")"),ie.data={category:"wrongType",fn:se,index:he,actual:dt,expected:ue},ie}}else _e=et}const de=_e.map(function(et){return E(et.params)?1/0:et.params.length});if(Z.length<Math.min.apply(null,de))return ue=N(_e,he),ie=new TypeError("Too few arguments in function "+se+" (expected: "+ue.join(" or ")+", index: "+Z.length+")"),ie.data={category:"tooFewArgs",fn:se,index:Z.length,expected:ue},ie;const fe=Math.max.apply(null,de);if(Z.length>fe)return ie=new TypeError("Too many arguments in function "+se+" (expected: "+fe+", actual: "+Z.length+")"),ie.data={category:"tooManyArgs",fn:se,index:Z.length,expectedLength:fe},ie;const Xe=[];for(let et=0;et<Z.length;++et)Xe.push(d(Z[et]).join("|"));return ie=new TypeError('Arguments of type "'+Xe.join(", ")+'" do not match any of the defined signatures of function '+se+"."),ie.data={category:"mismatch",actual:Xe},ie}function L(P){let Z=n.length+1;for(let J=0;J<P.types.length;J++)C(P.types[J])&&(Z=Math.min(Z,P.types[J].typeIndex));return Z}function k(P){let Z=i+1;for(let J=0;J<P.types.length;J++)C(P.types[J])||(Z=Math.min(Z,P.types[J].conversionIndex));return Z}function z(P,Z){if(P.hasAny){if(!Z.hasAny)return 1}else if(Z.hasAny)return-1;if(P.restParam){if(!Z.restParam)return 1}else if(Z.restParam)return-1;if(P.hasConversion){if(!Z.hasConversion)return 1}else if(Z.hasConversion)return-1;const J=L(P)-L(Z);if(J<0)return-1;if(J>0)return 1;const ie=k(P)-k(Z);return ie<0?-1:ie>0?1:0}function R(P,Z){const J=P.params,ie=Z.params,ue=Oe(J),se=Oe(ie),_e=E(J),he=E(ie);if(_e&&ue.hasAny){if(!he||!se.hasAny)return 1}else if(he&&se.hasAny)return-1;let de=0,fe=0,Xe;for(Xe of J)Xe.hasAny&&++de,Xe.hasConversion&&++fe;let et=0,dt=0;for(Xe of ie)Xe.hasAny&&++et,Xe.hasConversion&&++dt;if(de!==et)return de-et;if(_e&&ue.hasConversion){if(!he||!se.hasConversion)return 1}else if(he&&se.hasConversion)return-1;if(fe!==dt)return fe-dt;if(_e){if(!he)return 1}else if(he)return-1;const zt=(J.length-ie.length)*(_e?-1:1);if(zt!==0)return zt;const Tt=[];let nr=0;for(let en=0;en<J.length;++en){const wn=z(J[en],ie[en]);Tt.push(wn),nr+=wn}if(nr!==0)return nr;let fr;for(fr of Tt)if(fr!==0)return fr;return 0}function V(P){if(P.length===0)return[];const Z=P.map(u);P.length>1&&Z.sort((ue,se)=>ue.index-se.index);let J=Z[0].conversionsTo;if(P.length===1)return J;J=J.concat([]);const ie=new Set(P);for(let ue=1;ue<Z.length;++ue){let se;for(se of Z[ue].conversionsTo)ie.has(se.from)||(J.push(se),ie.add(se.from))}return J}function H(P,Z){let J=Z;if(P.some(ue=>ue.hasConversion)){const ue=E(P),se=P.map(ee);J=function(){const he=[],de=ue?arguments.length-1:arguments.length;for(let fe=0;fe<de;fe++)he[fe]=se[fe](arguments[fe]);return ue&&(he[de]=arguments[de].map(se[de])),Z.apply(this,he)}}let ie=J;if(E(P)){const ue=P.length-1;ie=function(){return J.apply(this,Fe(arguments,0,ue).concat([Fe(arguments,ue)]))}}return ie}function ee(P){let Z,J,ie,ue;const se=[],_e=[];switch(P.types.forEach(function(he){he.conversion&&(se.push(u(he.conversion.from).test),_e.push(he.conversion.convert))}),_e.length){case 0:return function(de){return de};case 1:return Z=se[0],ie=_e[0],function(de){return Z(de)?ie(de):de};case 2:return Z=se[0],J=se[1],ie=_e[0],ue=_e[1],function(de){return Z(de)?ie(de):J(de)?ue(de):de};default:return function(de){for(let fe=0;fe<_e.length;fe++)if(se[fe](de))return _e[fe](de);return de}}}function te(P){function Z(J,ie,ue){if(ie<J.length){const se=J[ie];let _e=[];if(se.restParam){const he=se.types.filter(C);he.length<se.types.length&&_e.push({types:he,name:"..."+he.map(de=>de.name).join("|"),hasAny:he.some(de=>de.isAny),hasConversion:!1,restParam:!0}),_e.push(se)}else _e=se.types.map(function(he){return{types:[he],name:he.name,hasAny:he.isAny,hasConversion:he.conversion,restParam:!1}});return Ye(_e,function(he){return Z(J,ie+1,ue.concat([he]))})}else return[ue]}return Z(P,0,[])}function j(P,Z){const J=Math.max(P.length,Z.length);for(let he=0;he<J;he++){const de=O(P,he),fe=O(Z,he);let Xe=!1,et;for(et of fe)if(de.has(et)){Xe=!0;break}if(!Xe)return!1}const ie=P.length,ue=Z.length,se=E(P),_e=E(Z);return se?_e?ie===ue:ue>=ie:_e?ie>=ue:ie===ue}function X(P){return P.map(Z=>At(Z)?yt(Z.referToSelf.callback):Wt(Z)?Le(Z.referTo.references,Z.referTo.callback):Z)}function Y(P,Z,J){const ie=[];let ue;for(ue of P){let se=J[ue];if(typeof se!="number")throw new TypeError('No definition for referenced signature "'+ue+'"');if(se=Z[se],typeof se!="function")return!1;ie.push(se)}return ie}function Q(P,Z,J){const ie=X(P),ue=new Array(ie.length).fill(!1);let se=!0;for(;se;){se=!1;let _e=!0;for(let he=0;he<ie.length;++he){if(ue[he])continue;const de=ie[he];if(At(de))ie[he]=de.referToSelf.callback(J),ie[he].referToSelf=de.referToSelf,ue[he]=!0,_e=!1;else if(Wt(de)){const fe=Y(de.referTo.references,ie,Z);fe?(ie[he]=de.referTo.callback.apply(this,fe),ie[he].referTo=de.referTo,ue[he]=!0,_e=!1):se=!0}}if(_e&&se)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return ie}function pe(P){const Z=/\bthis(\(|\.signatures\b)/;Object.keys(P).forEach(J=>{const ie=P[J];if(Z.test(ie.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function De(P,Z){if(a.createCount++,Object.keys(Z).length===0)throw new SyntaxError("No signatures provided");a.warnAgainstDeprecatedThis&&pe(Z);const J=[],ie=[],ue={},se=[];let _e;for(_e in Z){if(!Object.prototype.hasOwnProperty.call(Z,_e))continue;const Qe=A(_e);if(!Qe)continue;J.forEach(function(Un){if(j(Un,Qe))throw new TypeError('Conflicting signatures "'+y(Un)+'" and "'+y(Qe)+'".')}),J.push(Qe);const ir=ie.length;ie.push(Z[_e]);const i0=Qe.map(w);let Hi;for(Hi of te(i0)){const Un=y(Hi);se.push({params:Hi,name:Un,fn:ir}),Hi.every(Po=>!Po.hasConversion)&&(ue[Un]=ir)}}se.sort(R);const he=Q(ie,ue,ci);let de;for(de in ue)Object.prototype.hasOwnProperty.call(ue,de)&&(ue[de]=he[ue[de]]);const fe=[],Xe=new Map;for(de of se)Xe.has(de.name)||(de.fn=he[de.fn],fe.push(de),Xe.set(de.name,de));const et=fe[0]&&fe[0].params.length<=2&&!E(fe[0].params),dt=fe[1]&&fe[1].params.length<=2&&!E(fe[1].params),zt=fe[2]&&fe[2].params.length<=2&&!E(fe[2].params),Tt=fe[3]&&fe[3].params.length<=2&&!E(fe[3].params),nr=fe[4]&&fe[4].params.length<=2&&!E(fe[4].params),fr=fe[5]&&fe[5].params.length<=2&&!E(fe[5].params),en=et&&dt&&zt&&Tt&&nr&&fr;for(let Qe=0;Qe<fe.length;++Qe)fe[Qe].test=B(fe[Qe].params);const wn=et?F(fe[0].params[0]):Tr,li=dt?F(fe[1].params[0]):Tr,ms=zt?F(fe[2].params[0]):Tr,xs=Tt?F(fe[3].params[0]):Tr,ys=nr?F(fe[4].params[0]):Tr,ki=fr?F(fe[5].params[0]):Tr,zi=et?F(fe[0].params[1]):Tr,Ds=dt?F(fe[1].params[1]):Tr,qi=zt?F(fe[2].params[1]):Tr,ws=Tt?F(fe[3].params[1]):Tr,qn=nr?F(fe[4].params[1]):Tr,Qt=fr?F(fe[5].params[1]):Tr;for(let Qe=0;Qe<fe.length;++Qe)fe[Qe].implementation=H(fe[Qe].params,fe[Qe].fn);const mr=et?fe[0].implementation:wi,Ui=dt?fe[1].implementation:wi,Es=zt?fe[2].implementation:wi,Yu=Tt?fe[3].implementation:wi,Ku=nr?fe[4].implementation:wi,Zu=fr?fe[5].implementation:wi,Vu=et?fe[0].params.length:-1,Gu=dt?fe[1].params.length:-1,Xu=zt?fe[2].params.length:-1,Ro=Tt?fe[3].params.length:-1,Qu=nr?fe[4].params.length:-1,Ju=fr?fe[5].params.length:-1,e0=en?6:0,t0=fe.length,r0=fe.map(Qe=>Qe.test),n0=fe.map(Qe=>Qe.implementation),Wi=function(){for(let ir=e0;ir<t0;ir++)if(r0[ir](arguments))return n0[ir].apply(this,arguments);return a.onMismatch(P,arguments,fe)};function ci(Qe,ir){return arguments.length===Vu&&wn(Qe)&&zi(ir)?mr.apply(this,arguments):arguments.length===Gu&&li(Qe)&&Ds(ir)?Ui.apply(this,arguments):arguments.length===Xu&&ms(Qe)&&qi(ir)?Es.apply(this,arguments):arguments.length===Ro&&xs(Qe)&&ws(ir)?Yu.apply(this,arguments):arguments.length===Qu&&ys(Qe)&&qn(ir)?Ku.apply(this,arguments):arguments.length===Ju&&ki(Qe)&&Qt(ir)?Zu.apply(this,arguments):Wi.apply(this,arguments)}try{Object.defineProperty(ci,"name",{value:P})}catch{}return ci.signatures=ue,ci._typedFunctionData={signatures:fe,signatureMap:Xe},ci}function we(P,Z,J){throw I(P,Z,J)}function Ee(P){return Fe(P,0,P.length-1)}function Oe(P){return P[P.length-1]}function Fe(P,Z,J){return Array.prototype.slice.call(P,Z,J)}function nt(P,Z){for(let J=0;J<P.length;J++)if(Z(P[J]))return P[J]}function Ye(P,Z){return Array.prototype.concat.apply([],P.map(Z))}function Ie(){const P=Ee(arguments).map(J=>y(A(J))),Z=Oe(arguments);if(typeof Z!="function")throw new TypeError("Callback function expected as last argument");return Le(P,Z)}function Le(P,Z){return{referTo:{references:P,callback:Z}}}function yt(P){if(typeof P!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:P}}}function Wt(P){return P&&typeof P.referTo=="object"&&Array.isArray(P.referTo.references)&&typeof P.referTo.callback=="function"}function At(P){return P&&typeof P.referToSelf=="object"&&typeof P.referToSelf.callback=="function"}function lr(P,Z){if(!P)return Z;if(Z&&Z!==P){const J=new Error("Function names do not match (expected: "+P+", actual: "+Z+")");throw J.data={actual:Z,expected:P},J}return P}function Rr(P){let Z;for(const J in P)Object.prototype.hasOwnProperty.call(P,J)&&(p(P[J])||typeof P[J].signature=="string")&&(Z=lr(Z,P[J].name));return Z}function cr(P,Z){let J;for(J in Z)if(Object.prototype.hasOwnProperty.call(Z,J)){if(J in P&&Z[J]!==P[J]){const ie=new Error('Signature "'+J+'" is defined twice');throw ie.data={signature:J,sourceFunction:Z[J],destFunction:P[J]},ie}P[J]=Z[J]}}const Dt=a;a=function(P){const Z=typeof P=="string",J=Z?1:0;let ie=Z?P:"";const ue={};for(let se=J;se<arguments.length;++se){const _e=arguments[se];let he={},de;if(typeof _e=="function"?(de=_e.name,typeof _e.signature=="string"?he[_e.signature]=_e:p(_e)&&(he=_e.signatures)):s(_e)&&(he=_e,Z||(de=Rr(_e))),Object.keys(he).length===0){const fe=new TypeError("Argument to 'typed' at index "+se+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw fe.data={index:se,argument:_e},fe}Z||(ie=lr(ie,de)),cr(ue,he)}return De(ie||"",ue)},a.create=Sl,a.createCount=Dt.createCount,a.onMismatch=we,a.throwMismatchError=we,a.createError=I,a.clear=c,a.clearConversions=h,a.addTypes=f,a._findType=u,a.referTo=Ie,a.referToSelf=yt,a.convert=_,a.findSignature=v,a.find=x,a.isTypedFunction=p,a.warnAgainstDeprecatedThis=!0,a.addType=function(P,Z){let J="any";Z!==!1&&r.has("Object")&&(J="Object"),a.addTypes([P],J)};function It(P){if(!P||typeof P.from!="string"||typeof P.to!="string"||typeof P.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(P.to===P.from)throw new SyntaxError('Illegal to define conversion from "'+P.from+'" to itself.')}return a.addConversion=function(P){It(P);const Z=u(P.to);if(Z.conversionsTo.every(function(J){return J.from!==P.from}))Z.conversionsTo.push({from:P.from,convert:P.convert,index:i++});else throw new Error('There is already a conversion from "'+P.from+'" to "'+Z.name+'"')},a.addConversions=function(P){P.forEach(a.addConversion)},a.removeConversion=function(P){It(P);const Z=u(P.to),J=nt(Z.conversionsTo,ue=>ue.from===P.from);if(!J)throw new Error("Attempt to remove nonexistent conversion from "+P.from+" to "+P.to);if(J.convert!==P.convert)throw new Error("Conversion to remove does not match existing conversion");const ie=Z.conversionsTo.indexOf(J);Z.conversionsTo.splice(ie,1)},a.resolve=function(P,Z){if(!p(P))throw new TypeError(Nl);const J=P._typedFunctionData.signatures;for(let ie=0;ie<J.length;++ie)if(J[ie].test(Z))return J[ie];return null},a}var Ol=Sl();function bt(s){return typeof s=="boolean"?!0:isFinite(s)?s===Math.round(s):!1}function Ba(s,e,t){var r={2:"0b",8:"0o",16:"0x"},n=r[e],i="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!bt(t))throw new Error("size must be an integer");if(s>2**(t-1)-1||s<-(2**(t-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!bt(s))throw new Error("Value must be an integer");s<0&&(s=s+2**t),i="i".concat(t)}var a="";return s<0&&(s=-s,a="-"),"".concat(a).concat(n).concat(s.toString(e)).concat(i)}function Ma(s,e){if(typeof e=="function")return e(s);if(s===1/0)return"Infinity";if(s===-1/0)return"-Infinity";if(isNaN(s))return"NaN";var{notation:t,precision:r,wordSize:n}=Il(e);switch(t){case"fixed":return r_(s,r);case"exponential":return Tl(s,r);case"engineering":return t_(s,r);case"bin":return Ba(s,2,n);case"oct":return Ba(s,8,n);case"hex":return Ba(s,16,n);case"auto":return n_(s,r,e).replace(/((\.\d*?)(0+))($|e)/,function(){var i=arguments[2],a=arguments[4];return i!=="."?i+a:a});default:throw new Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Il(s){var e="auto",t,r;if(s!==void 0)if(_t(s))t=s;else if(Ot(s))t=s.toNumber();else if(Fa(s))s.precision!==void 0&&(t=$l(s.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),s.wordSize!==void 0&&(r=$l(s.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),s.notation&&(e=s.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:e,precision:t,wordSize:r}}function js(s){var e=String(s).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!e)throw new SyntaxError("Invalid number "+s);var t=e[1],r=e[2],n=parseFloat(e[4]||"0"),i=r.indexOf(".");n+=i!==-1?i-1:r.length-1;var a=r.replace(".","").replace(/^0*/,function(u){return n-=u.length,""}).replace(/0*$/,"").split("").map(function(u){return parseInt(u)});return a.length===0&&(a.push(0),n++),{sign:t,coefficients:a,exponent:n}}function t_(s,e){if(isNaN(s)||!isFinite(s))return String(s);var t=js(s),r=Ys(t,e),n=r.exponent,i=r.coefficients,a=n%3===0?n:n<0?n-3-n%3:n-n%3;if(_t(e))for(;e>i.length||n-a+1>i.length;)i.push(0);else for(var u=Math.abs(n-a)-(i.length-1),f=0;f<u;f++)i.push(0);for(var c=Math.abs(n-a),h=1;c>0;)h++,c--;var d=i.slice(h).join(""),p=_t(e)&&d.length||d.match(/[1-9]/)?"."+d:"",v=i.slice(0,h).join("")+p+"e"+(n>=0?"+":"")+a.toString();return r.sign+v}function r_(s,e){if(isNaN(s)||!isFinite(s))return String(s);var t=js(s),r=typeof e=="number"?Ys(t,t.exponent+1+e):t,n=r.coefficients,i=r.exponent+1,a=i+(e||0);return n.length<a&&(n=n.concat(Ei(a-n.length))),i<0&&(n=Ei(-i+1).concat(n),i=1),i<n.length&&n.splice(i,0,i===0?"0.":"."),r.sign+n.join("")}function Tl(s,e){if(isNaN(s)||!isFinite(s))return String(s);var t=js(s),r=e?Ys(t,e):t,n=r.coefficients,i=r.exponent;n.length<e&&(n=n.concat(Ei(e-n.length)));var a=n.shift();return r.sign+a+(n.length>0?"."+n.join(""):"")+"e"+(i>=0?"+":"")+i}function n_(s,e,t){if(isNaN(s)||!isFinite(s))return String(s);var r=Ll(t==null?void 0:t.lowerExp,-3),n=Ll(t==null?void 0:t.upperExp,5),i=js(s),a=e?Ys(i,e):i;if(a.exponent<r||a.exponent>=n)return Tl(s,e);var u=a.coefficients,f=a.exponent;u.length<e&&(u=u.concat(Ei(e-u.length))),u=u.concat(Ei(f-u.length+1+(u.length<e?e-u.length:0))),u=Ei(-f).concat(u);var c=f>0?f:0;return c<u.length-1&&u.splice(c+1,0,"."),a.sign+u.join("")}function Ys(s,e){for(var t={sign:s.sign,coefficients:s.coefficients,exponent:s.exponent},r=t.coefficients;e<=0;)r.unshift(0),t.exponent++,e++;if(r.length>e){var n=r.splice(e,r.length-e);if(n[0]>=5){var i=e-1;for(r[i]++;r[i]===10;)r.pop(),i===0&&(r.unshift(0),t.exponent++,i++),i--,r[i]++}}return t}function Ei(s){for(var e=[],t=0;t<s;t++)e.push(0);return e}function i_(s){return s.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}var s_=Number.EPSILON||2220446049250313e-31;function ri(s,e,t){if(t==null)return s===e;if(s===e)return!0;if(isNaN(s)||isNaN(e))return!1;if(isFinite(s)&&isFinite(e)){var r=Math.abs(s-e);return r<=s_?!0:r<=Math.max(Math.abs(s),Math.abs(e))*t}return!1}function $l(s,e){if(_t(s))return s;if(Ot(s))return s.toNumber();e()}function Ll(s,e){return _t(s)?s:Ot(s)?s.toNumber():e}function Na(s,e,t){var r=s.constructor,n=new r(2),i="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!bt(t))throw new Error("size must be an integer");if(s.greaterThan(n.pow(t-1).sub(1))||s.lessThan(n.pow(t-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!s.isInteger())throw new Error("Value must be an integer");s.lessThan(0)&&(s=s.add(n.pow(t))),i="i".concat(t)}switch(e){case 2:return"".concat(s.toBinary()).concat(i);case 8:return"".concat(s.toOctal()).concat(i);case 16:return"".concat(s.toHexadecimal()).concat(i);default:throw new Error("Base ".concat(e," not supported "))}}function o_(s,e){if(typeof e=="function")return e(s);if(!s.isFinite())return s.isNaN()?"NaN":s.gt(0)?"Infinity":"-Infinity";var{notation:t,precision:r,wordSize:n}=Il(e);switch(t){case"fixed":return u_(s,r);case"exponential":return Rl(s,r);case"engineering":return a_(s,r);case"bin":return Na(s,2,n);case"oct":return Na(s,8,n);case"hex":return Na(s,16,n);case"auto":{var i=Pl(e==null?void 0:e.lowerExp,-3),a=Pl(e==null?void 0:e.upperExp,5);if(s.isZero())return"0";var u,f=s.toSignificantDigits(r),c=f.e;return c>=i&&c<a?u=f.toFixed():u=Rl(s,r),u.replace(/((\.\d*?)(0+))($|e)/,function(){var h=arguments[2],d=arguments[4];return h!=="."?h+d:d})}default:throw new Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function a_(s,e){var t=s.e,r=t%3===0?t:t<0?t-3-t%3:t-t%3,n=s.mul(Math.pow(10,-r)),i=n.toPrecision(e);if(i.indexOf("e")!==-1){var a=s.constructor;i=new a(i).toFixed()}return i+"e"+(t>=0?"+":"")+r.toString()}function Rl(s,e){return e!==void 0?s.toExponential(e-1):s.toExponential()}function u_(s,e){return s.toFixed(e)}function Pl(s,e){return _t(s)?s:Ot(s)?s.toNumber():e}function ft(s,e){var t=l_(s,e);return e&&typeof e=="object"&&"truncate"in e&&t.length>e.truncate?t.substring(0,e.truncate-3)+"...":t}function l_(s,e){if(typeof s=="number")return Ma(s,e);if(Ot(s))return o_(s,e);if(c_(s))return!e||e.fraction!=="decimal"?s.s*s.n+"/"+s.d:s.toString();if(Array.isArray(s))return ql(s,e);if(un(s))return kl(s);if(typeof s=="function")return s.syntax?String(s.syntax):"function";if(s&&typeof s=="object"){if(typeof s.format=="function")return s.format(e);if(s&&s.toString(e)!=={}.toString())return s.toString(e);var t=Object.keys(s).map(r=>kl(r)+": "+ft(s[r],e));return"{"+t.join(", ")+"}"}return String(s)}function kl(s){for(var e=String(s),t="",r=0;r<e.length;){var n=e.charAt(r);t+=n in zl?zl[n]:n,r++}return'"'+t+'"'}var zl={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"};function ql(s,e){if(Array.isArray(s)){for(var t="[",r=s.length,n=0;n<r;n++)n!==0&&(t+=", "),t+=ql(s[n],e);return t+="]",t}else return ft(s,e)}function c_(s){return s&&typeof s=="object"&&typeof s.s=="number"&&typeof s.n=="number"&&typeof s.d=="number"||!1}function rt(s,e,t){if(!(this instanceof rt))throw new SyntaxError("Constructor must be called with the new operator");this.actual=s,this.expected=e,this.relation=t,this.message="Dimension mismatch ("+(Array.isArray(s)?"["+s.join(", ")+"]":s)+" "+(this.relation||"!=")+" "+(Array.isArray(e)?"["+e.join(", ")+"]":e)+")",this.stack=new Error().stack}rt.prototype=new RangeError,rt.prototype.constructor=RangeError,rt.prototype.name="DimensionError",rt.prototype.isDimensionError=!0;function In(s,e,t){if(!(this instanceof In))throw new SyntaxError("Constructor must be called with the new operator");this.index=s,arguments.length<3?(this.min=0,this.max=e):(this.min=e,this.max=t),this.min!==void 0&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":this.max!==void 0&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=new Error().stack}In.prototype=new RangeError,In.prototype.constructor=RangeError,In.prototype.name="IndexError",In.prototype.isIndexError=!0;function Pt(s){for(var e=[];Array.isArray(s);)e.push(s.length),s=s[0];return e}function Ul(s,e,t){var r,n=s.length;if(n!==e[t])throw new rt(n,e[t]);if(t<e.length-1){var i=t+1;for(r=0;r<n;r++){var a=s[r];if(!Array.isArray(a))throw new rt(e.length-1,e.length,"<");Ul(s[r],e,i)}}else for(r=0;r<n;r++)if(Array.isArray(s[r]))throw new rt(e.length+1,e.length,">")}function Wl(s,e){var t=e.length===0;if(t){if(Array.isArray(s))throw new rt(s.length,0)}else Ul(s,e,0)}function Bt(s,e){if(s!==void 0){if(!_t(s)||!bt(s))throw new TypeError("Index must be an integer (value: "+s+")");if(s<0||typeof e=="number"&&s>=e)throw new In(s,e)}}function Sa(s,e,t){if(!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new Error("Resizing to scalar is not supported");e.forEach(function(n){if(!_t(n)||!bt(n)||n<0)throw new TypeError("Invalid size, must contain positive integers (size: "+ft(e)+")")}),(_t(s)||Ot(s))&&(s=[s]);var r=t!==void 0?t:0;return Oa(s,e,0,r),s}function Oa(s,e,t,r){var n,i,a=s.length,u=e[t],f=Math.min(a,u);if(s.length=u,t<e.length-1){var c=t+1;for(n=0;n<f;n++)i=s[n],Array.isArray(i)||(i=[i],s[n]=i),Oa(i,e,c,r);for(n=f;n<u;n++)i=[],s[n]=i,Oa(i,e,c,r)}else{for(n=0;n<f;n++)for(;Array.isArray(s[n]);)s[n]=s[n][0];for(n=f;n<u;n++)s[n]=r}}function Ia(s,e){var t=$a(s),r=t.length;if(!Array.isArray(s)||!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new rt(0,r,"!=");e=Ta(e,r);var n=Hl(e);if(r!==n)throw new rt(n,r,"!=");try{return f_(t,e)}catch(i){throw i instanceof rt?new rt(n,r,"!="):i}}function Ta(s,e){var t=Hl(s),r=s.slice(),n=-1,i=s.indexOf(n),a=s.indexOf(n,i+1)>=0;if(a)throw new Error("More than one wildcard in sizes");var u=i>=0,f=e%t===0;if(u)if(f)r[i]=-e/t;else throw new Error("Could not replace wildcard, since "+e+" is no multiple of "+-t);return r}function Hl(s){return s.reduce((e,t)=>e*t,1)}function f_(s,e){for(var t=s,r,n=e.length-1;n>0;n--){var i=e[n];r=[];for(var a=t.length/i,u=0;u<a;u++)r.push(t.slice(u*i,(u+1)*i));t=r}return t}function jl(s,e,t,r){var n=r||Pt(s);if(t)for(var i=0;i<t;i++)s=[s],n.unshift(1);for(s=Yl(s,e,0);n.length<e;)n.push(1);return s}function Yl(s,e,t){var r,n;if(Array.isArray(s)){var i=t+1;for(r=0,n=s.length;r<n;r++)s[r]=Yl(s[r],e,i)}else for(var a=t;a<e;a++)s=[s];return s}function $a(s){if(!Array.isArray(s))return s;var e=[];return s.forEach(function t(r){Array.isArray(r)?r.forEach(t):e.push(r)}),e}function Ks(s,e){for(var t,r=0,n=0;n<s.length;n++){var i=s[n],a=Array.isArray(i);if(n===0&&a&&(r=i.length),a&&i.length!==r)return;var u=a?Ks(i,e):e(i);if(t===void 0)t=u;else if(t!==u)return"mixed"}return t}function Kl(s,e,t,r){if(r<t){if(s.length!==e.length)throw new rt(s.length,e.length);for(var n=[],i=0;i<s.length;i++)n[i]=Kl(s[i],e[i],t,r+1);return n}else return s.concat(e)}function Zl(){var s=Array.prototype.slice.call(arguments,0,-1),e=Array.prototype.slice.call(arguments,-1);if(s.length===1)return s[0];if(s.length>1)return s.slice(1).reduce(function(t,r){return Kl(t,r,e,0)},s[0]);throw new Error("Wrong number of arguments in function concat")}function h_(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];for(var r=e.map(p=>p.length),n=Math.max(...r),i=new Array(n).fill(null),a=0;a<e.length;a++)for(var u=e[a],f=r[a],c=0;c<f;c++){var h=n-f+c;u[c]>i[h]&&(i[h]=u[c])}for(var d=0;d<e.length;d++)Zs(e[d],i);return i}function Zs(s,e){for(var t=e.length,r=s.length,n=0;n<r;n++){var i=t-r+n;if(s[n]<e[i]&&s[n]>1||s[n]>e[i])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(s,") not possible to broadcast dimension ").concat(r," with size ").concat(s[n]," to size ").concat(e[i]))}}function Vl(s,e){var t=Pt(s);if(Di(t,e))return s;Zs(t,e);var r=h_(t,e),n=r.length,i=[...Array(n-t.length).fill(1),...t],a=p_(s);t.length<n&&(a=Ia(a,i),t=Pt(a));for(var u=0;u<n;u++)t[u]<r[u]&&(a=d_(a,r[u],u),t=Pt(a));return a}function d_(s,e,t){return Zl(...Array(e).fill(s),t)}function p_(s){return Hs([],s)}function xe(s,e,t,r){function n(i){var a=Q1(i,e.map(g_));return __(s,e,i),t(a)}return n.isFactory=!0,n.fn=s,n.dependencies=e.slice().sort(),r&&(n.meta=r),n}function __(s,e,t){var r=e.filter(i=>!v_(i)).every(i=>t[i]!==void 0);if(!r){var n=e.filter(i=>t[i]===void 0);throw new Error('Cannot create function "'.concat(s,'", ')+"some dependencies are missing: ".concat(n.map(i=>'"'.concat(i,'"')).join(", "),"."))}}function v_(s){return s&&s[0]==="?"}function g_(s){return s&&s[0]==="?"?s.slice(1):s}function m_(s,e){if(Xl(s)&&Gl(s,e))return s[e];throw typeof s[e]=="function"&&D_(s,e)?new Error('Cannot access method "'+e+'" as a property'):new Error('No access to property "'+e+'"')}function x_(s,e,t){if(Xl(s)&&Gl(s,e))return s[e]=t,t;throw new Error('No access to property "'+e+'"')}function y_(s,e){return e in s}function Gl(s,e){return!s||typeof s!="object"?!1:as(w_,e)?!0:!(e in Object.prototype||e in Function.prototype)}function D_(s,e){return s==null||typeof s[e]!="function"||as(s,e)&&Object.getPrototypeOf&&e in Object.getPrototypeOf(s)?!1:as(E_,e)?!0:!(e in Object.prototype||e in Function.prototype)}function Xl(s){return typeof s=="object"&&s&&s.constructor===Object}var w_={length:!0,name:!0},E_={toString:!0,valueOf:!0,toLocaleString:!0};class b_{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).values()}get(e){return m_(this.wrappedObject,e)}set(e,t){return x_(this.wrappedObject,e,t),this}has(e){return y_(this.wrappedObject,e)}entries(){return A_(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var t of this.keys())e(this.get(t),t,this)}delete(e){delete this.wrappedObject[e]}clear(){for(var e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}}function A_(s,e){return{next:()=>{var t=s.next();return t.done?t:{value:e(t.value),done:!1}}}}function C_(s){return s?s instanceof Map||s instanceof b_||typeof s.set=="function"&&typeof s.get=="function"&&typeof s.keys=="function"&&typeof s.has=="function":!1}var Ql=function(){return Ql=Ol.create,Ol},F_=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],B_=xe("typed",F_,function(e){var{BigNumber:t,Complex:r,DenseMatrix:n,Fraction:i}=e,a=Ql();return a.clear(),a.addTypes([{name:"number",test:_t},{name:"Complex",test:Al},{name:"BigNumber",test:Ot},{name:"Fraction",test:Cl},{name:"Unit",test:Fl},{name:"identifier",test:u=>un&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(u)},{name:"string",test:un},{name:"Chain",test:G1},{name:"Array",test:Ft},{name:"Matrix",test:xt},{name:"DenseMatrix",test:E1},{name:"SparseMatrix",test:b1},{name:"Range",test:A1},{name:"Index",test:Ca},{name:"boolean",test:C1},{name:"ResultSet",test:F1},{name:"Help",test:B1},{name:"function",test:M1},{name:"Date",test:N1},{name:"RegExp",test:S1},{name:"null",test:O1},{name:"undefined",test:I1},{name:"AccessorNode",test:T1},{name:"ArrayNode",test:$1},{name:"AssignmentNode",test:L1},{name:"BlockNode",test:R1},{name:"ConditionalNode",test:P1},{name:"ConstantNode",test:k1},{name:"FunctionNode",test:q1},{name:"FunctionAssignmentNode",test:z1},{name:"IndexNode",test:U1},{name:"Node",test:W1},{name:"ObjectNode",test:H1},{name:"OperatorNode",test:j1},{name:"ParenthesisNode",test:Y1},{name:"RangeNode",test:K1},{name:"RelationalNode",test:Z1},{name:"SymbolNode",test:V1},{name:"Map",test:C_},{name:"Object",test:Fa}]),a.addConversions([{from:"number",to:"BigNumber",convert:function(f){if(t||La(f),i_(f)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+f+"). Use function bignumber(x) to convert to BigNumber.");return new t(f)}},{from:"number",to:"Complex",convert:function(f){return r||Vs(f),new r(f,0)}},{from:"BigNumber",to:"Complex",convert:function(f){return r||Vs(f),new r(f.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(f){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(f){return r||Vs(f),new r(f.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(f){i||Ra(f);var c=new i(f);if(c.valueOf()!==f)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+f+"). Use function fraction(x) to convert to Fraction.");return c}},{from:"string",to:"number",convert:function(f){var c=Number(f);if(isNaN(c))throw new Error('Cannot convert "'+f+'" to a number');return c}},{from:"string",to:"BigNumber",convert:function(f){t||La(f);try{return new t(f)}catch{throw new Error('Cannot convert "'+f+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(f){i||Ra(f);try{return new i(f)}catch{throw new Error('Cannot convert "'+f+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(f){r||Vs(f);try{return new r(f)}catch{throw new Error('Cannot convert "'+f+'" to Complex')}}},{from:"boolean",to:"number",convert:function(f){return+f}},{from:"boolean",to:"BigNumber",convert:function(f){return t||La(f),new t(+f)}},{from:"boolean",to:"Fraction",convert:function(f){return i||Ra(f),new i(+f)}},{from:"boolean",to:"string",convert:function(f){return String(f)}},{from:"Array",to:"Matrix",convert:function(f){return n||M_(),new n(f)}},{from:"Matrix",to:"Array",convert:function(f){return f.valueOf()}}]),a.onMismatch=(u,f,c)=>{var h=a.createError(u,f,c);if(["wrongType","mismatch"].includes(h.data.category)&&f.length===1&&os(f[0])&&c.some(p=>!p.params.includes(","))){var d=new TypeError("Function '".concat(u,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(u,")'."));throw d.data=h.data,d}throw h},a.onMismatch=(u,f,c)=>{var h=a.createError(u,f,c);if(["wrongType","mismatch"].includes(h.data.category)&&f.length===1&&os(f[0])&&c.some(p=>!p.params.includes(","))){var d=new TypeError("Function '".concat(u,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(u,")'."));throw d.data=h.data,d}throw h},a});function La(s){throw new Error("Cannot convert value ".concat(s," into a BigNumber: no class 'BigNumber' provided"))}function Vs(s){throw new Error("Cannot convert value ".concat(s," into a Complex number: no class 'Complex' provided"))}function M_(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function Ra(s){throw new Error("Cannot convert value ".concat(s," into a Fraction, no class 'Fraction' provided."))}/*!
34
+ `);return Object.freeze(El)};Hs(Er,El,{MATRIX_OPTIONS:J1,NUMBER_OPTIONS:e_});function Ml(){return!0}function Tr(){return!1}function wi(){}const Nl="Argument is not a typed-function.";function Sl(){function s(P){return typeof P=="object"&&P!==null&&P.constructor===Object}const e=[{name:"number",test:function(P){return typeof P=="number"}},{name:"string",test:function(P){return typeof P=="string"}},{name:"boolean",test:function(P){return typeof P=="boolean"}},{name:"Function",test:function(P){return typeof P=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(P){return P instanceof Date}},{name:"RegExp",test:function(P){return P instanceof RegExp}},{name:"Object",test:s},{name:"null",test:function(P){return P===null}},{name:"undefined",test:function(P){return P===void 0}}],t={name:"any",test:Ml,isAny:!0};let r,n,i=0,a={createCount:0};function u(P){const Z=r.get(P);if(Z)return Z;let J='Unknown type "'+P+'"';const ie=P.toLowerCase();let ue;for(ue of n)if(ue.toLowerCase()===ie){J+='. Did you mean "'+ue+'" ?';break}throw new TypeError(J)}function f(P){let Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any";const J=Z?u(Z).index:n.length,ie=[];for(let se=0;se<P.length;++se){if(!P[se]||typeof P[se].name!="string"||typeof P[se].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");const _e=P[se].name;if(r.has(_e))throw new TypeError('Duplicate type name "'+_e+'"');ie.push(_e),r.set(_e,{name:_e,test:P[se].test,isAny:P[se].isAny,index:J+se,conversionsTo:[]})}const ue=n.slice(J);n=n.slice(0,J).concat(ie).concat(ue);for(let se=J+ie.length;se<n.length;++se)r.get(n[se]).index=se}function c(){r=new Map,n=[],i=0,f([t],!1)}c(),f(e);function h(){let P;for(P of n)r.get(P).conversionsTo=[];i=0}function d(P){const Z=n.filter(J=>{const ie=r.get(J);return!ie.isAny&&ie.test(P)});return Z.length?Z:["any"]}function p(P){return P&&typeof P=="function"&&"_typedFunctionData"in P}function v(P,Z,J){if(!p(P))throw new TypeError(Nl);const ie=J&&J.exact,ue=Array.isArray(Z)?Z.join(","):Z,se=C(ue),_e=y(se);if(!ie||_e in P.signatures){const Xe=P._typedFunctionData.signatureMap.get(_e);if(Xe)return Xe}const he=se.length;let de;if(ie){de=[];let Xe;for(Xe in P.signatures)de.push(P._typedFunctionData.signatureMap.get(Xe))}else de=P._typedFunctionData.signatures;for(let Xe=0;Xe<he;++Xe){const et=se[Xe],dt=[];let zt;for(zt of de){const Tt=M(zt.params,Xe);if(!(!Tt||et.restParam&&!Tt.restParam)){if(!Tt.hasAny){const nr=D(Tt);if(et.types.some(fr=>!nr.has(fr.name)))continue}dt.push(zt)}}if(de=dt,de.length===0)break}let fe;for(fe of de)if(fe.params.length<=he)return fe;throw new TypeError("Signature not found (signature: "+(P.name||"unnamed")+"("+y(se,", ")+"))")}function x(P,Z,J){return v(P,Z,J).implementation}function _(P,Z){const J=u(Z);if(J.test(P))return P;const ie=J.conversionsTo;if(ie.length===0)throw new Error("There are no conversions to "+Z+" defined.");for(let ue=0;ue<ie.length;ue++)if(u(ie[ue].from).test(P))return ie[ue].convert(P);throw new Error("Cannot convert "+P+" to "+Z)}function y(P){let Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return P.map(J=>J.name).join(Z)}function m(P){const Z=P.indexOf("...")===0,ie=(Z?P.length>3?P.slice(3):"any":P).split("|").map(he=>u(he.trim()));let ue=!1,se=Z?"...":"";return{types:ie.map(function(he){return ue=he.isAny||ue,se+=he.name+"|",{name:he.name,typeIndex:he.index,test:he.test,isAny:he.isAny,conversion:null,conversionIndex:-1}}),name:se.slice(0,-1),hasAny:ue,hasConversion:!1,restParam:Z}}function w(P){const Z=P.types.map(_e=>_e.name),J=V(Z);let ie=P.hasAny,ue=P.name;const se=J.map(function(_e){const he=u(_e.from);return ie=he.isAny||ie,ue+="|"+_e.from,{name:_e.from,typeIndex:he.index,test:he.test,isAny:he.isAny,conversion:_e,conversionIndex:_e.index}});return{types:P.types.concat(se),name:ue,hasAny:ie,hasConversion:se.length>0,restParam:P.restParam}}function D(P){return P.typeSet||(P.typeSet=new Set,P.types.forEach(Z=>P.typeSet.add(Z.name))),P.typeSet}function C(P){const Z=[];if(typeof P!="string")throw new TypeError("Signatures must be strings");const J=P.trim();if(J==="")return Z;const ie=J.split(",");for(let ue=0;ue<ie.length;++ue){const se=m(ie[ue].trim());if(se.restParam&&ue!==ie.length-1)throw new SyntaxError('Unexpected rest parameter "'+ie[ue]+'": only allowed for the last parameter');if(se.types.length===0)return null;Z.push(se)}return Z}function b(P){const Z=Oe(P);return Z?Z.restParam:!1}function F(P){if(!P||P.types.length===0)return Ml;if(P.types.length===1)return u(P.types[0].name).test;if(P.types.length===2){const Z=u(P.types[0].name).test,J=u(P.types[1].name).test;return function(ue){return Z(ue)||J(ue)}}else{const Z=P.types.map(function(J){return u(J.name).test});return function(ie){for(let ue=0;ue<Z.length;ue++)if(Z[ue](ie))return!0;return!1}}}function B(P){let Z,J,ie;if(b(P)){Z=be(P).map(F);const ue=Z.length,se=F(Oe(P)),_e=function(he){for(let de=ue;de<he.length;de++)if(!se(he[de]))return!1;return!0};return function(de){for(let fe=0;fe<Z.length;fe++)if(!Z[fe](de[fe]))return!1;return _e(de)&&de.length>=ue+1}}else return P.length===0?function(se){return se.length===0}:P.length===1?(J=F(P[0]),function(se){return J(se[0])&&se.length===1}):P.length===2?(J=F(P[0]),ie=F(P[1]),function(se){return J(se[0])&&ie(se[1])&&se.length===2}):(Z=P.map(F),function(se){for(let _e=0;_e<Z.length;_e++)if(!Z[_e](se[_e]))return!1;return se.length===Z.length})}function M(P,Z){return Z<P.length?P[Z]:b(P)?Oe(P):null}function O(P,Z){const J=M(P,Z);return J?D(J):new Set}function A(P){return P.conversion===null||P.conversion===void 0}function N(P,Z){const J=new Set;return P.forEach(ie=>{const ue=O(ie.params,Z);let se;for(se of ue)J.add(se)}),J.has("any")?["any"]:Array.from(J)}function I(P,Z,J){let ie,ue;const se=P||"unnamed";let _e=J,he;for(he=0;he<Z.length;he++){const et=[];if(_e.forEach(dt=>{const zt=M(dt.params,he),Tt=F(zt);(he<dt.params.length||b(dt.params))&&Tt(Z[he])&&et.push(dt)}),et.length===0){if(ue=N(_e,he),ue.length>0){const dt=d(Z[he]);return ie=new TypeError("Unexpected type of argument in function "+se+" (expected: "+ue.join(" or ")+", actual: "+dt.join(" | ")+", index: "+he+")"),ie.data={category:"wrongType",fn:se,index:he,actual:dt,expected:ue},ie}}else _e=et}const de=_e.map(function(et){return b(et.params)?1/0:et.params.length});if(Z.length<Math.min.apply(null,de))return ue=N(_e,he),ie=new TypeError("Too few arguments in function "+se+" (expected: "+ue.join(" or ")+", index: "+Z.length+")"),ie.data={category:"tooFewArgs",fn:se,index:Z.length,expected:ue},ie;const fe=Math.max.apply(null,de);if(Z.length>fe)return ie=new TypeError("Too many arguments in function "+se+" (expected: "+fe+", actual: "+Z.length+")"),ie.data={category:"tooManyArgs",fn:se,index:Z.length,expectedLength:fe},ie;const Xe=[];for(let et=0;et<Z.length;++et)Xe.push(d(Z[et]).join("|"));return ie=new TypeError('Arguments of type "'+Xe.join(", ")+'" do not match any of the defined signatures of function '+se+"."),ie.data={category:"mismatch",actual:Xe},ie}function L(P){let Z=n.length+1;for(let J=0;J<P.types.length;J++)A(P.types[J])&&(Z=Math.min(Z,P.types[J].typeIndex));return Z}function k(P){let Z=i+1;for(let J=0;J<P.types.length;J++)A(P.types[J])||(Z=Math.min(Z,P.types[J].conversionIndex));return Z}function z(P,Z){if(P.hasAny){if(!Z.hasAny)return 1}else if(Z.hasAny)return-1;if(P.restParam){if(!Z.restParam)return 1}else if(Z.restParam)return-1;if(P.hasConversion){if(!Z.hasConversion)return 1}else if(Z.hasConversion)return-1;const J=L(P)-L(Z);if(J<0)return-1;if(J>0)return 1;const ie=k(P)-k(Z);return ie<0?-1:ie>0?1:0}function R(P,Z){const J=P.params,ie=Z.params,ue=Oe(J),se=Oe(ie),_e=b(J),he=b(ie);if(_e&&ue.hasAny){if(!he||!se.hasAny)return 1}else if(he&&se.hasAny)return-1;let de=0,fe=0,Xe;for(Xe of J)Xe.hasAny&&++de,Xe.hasConversion&&++fe;let et=0,dt=0;for(Xe of ie)Xe.hasAny&&++et,Xe.hasConversion&&++dt;if(de!==et)return de-et;if(_e&&ue.hasConversion){if(!he||!se.hasConversion)return 1}else if(he&&se.hasConversion)return-1;if(fe!==dt)return fe-dt;if(_e){if(!he)return 1}else if(he)return-1;const zt=(J.length-ie.length)*(_e?-1:1);if(zt!==0)return zt;const Tt=[];let nr=0;for(let en=0;en<J.length;++en){const wn=z(J[en],ie[en]);Tt.push(wn),nr+=wn}if(nr!==0)return nr;let fr;for(fr of Tt)if(fr!==0)return fr;return 0}function V(P){if(P.length===0)return[];const Z=P.map(u);P.length>1&&Z.sort((ue,se)=>ue.index-se.index);let J=Z[0].conversionsTo;if(P.length===1)return J;J=J.concat([]);const ie=new Set(P);for(let ue=1;ue<Z.length;++ue){let se;for(se of Z[ue].conversionsTo)ie.has(se.from)||(J.push(se),ie.add(se.from))}return J}function H(P,Z){let J=Z;if(P.some(ue=>ue.hasConversion)){const ue=b(P),se=P.map(ee);J=function(){const he=[],de=ue?arguments.length-1:arguments.length;for(let fe=0;fe<de;fe++)he[fe]=se[fe](arguments[fe]);return ue&&(he[de]=arguments[de].map(se[de])),Z.apply(this,he)}}let ie=J;if(b(P)){const ue=P.length-1;ie=function(){return J.apply(this,Fe(arguments,0,ue).concat([Fe(arguments,ue)]))}}return ie}function ee(P){let Z,J,ie,ue;const se=[],_e=[];switch(P.types.forEach(function(he){he.conversion&&(se.push(u(he.conversion.from).test),_e.push(he.conversion.convert))}),_e.length){case 0:return function(de){return de};case 1:return Z=se[0],ie=_e[0],function(de){return Z(de)?ie(de):de};case 2:return Z=se[0],J=se[1],ie=_e[0],ue=_e[1],function(de){return Z(de)?ie(de):J(de)?ue(de):de};default:return function(de){for(let fe=0;fe<_e.length;fe++)if(se[fe](de))return _e[fe](de);return de}}}function te(P){function Z(J,ie,ue){if(ie<J.length){const se=J[ie];let _e=[];if(se.restParam){const he=se.types.filter(A);he.length<se.types.length&&_e.push({types:he,name:"..."+he.map(de=>de.name).join("|"),hasAny:he.some(de=>de.isAny),hasConversion:!1,restParam:!0}),_e.push(se)}else _e=se.types.map(function(he){return{types:[he],name:he.name,hasAny:he.isAny,hasConversion:he.conversion,restParam:!1}});return Ye(_e,function(he){return Z(J,ie+1,ue.concat([he]))})}else return[ue]}return Z(P,0,[])}function j(P,Z){const J=Math.max(P.length,Z.length);for(let he=0;he<J;he++){const de=O(P,he),fe=O(Z,he);let Xe=!1,et;for(et of fe)if(de.has(et)){Xe=!0;break}if(!Xe)return!1}const ie=P.length,ue=Z.length,se=b(P),_e=b(Z);return se?_e?ie===ue:ue>=ie:_e?ie>=ue:ie===ue}function X(P){return P.map(Z=>Ct(Z)?yt(Z.referToSelf.callback):Wt(Z)?Le(Z.referTo.references,Z.referTo.callback):Z)}function Y(P,Z,J){const ie=[];let ue;for(ue of P){let se=J[ue];if(typeof se!="number")throw new TypeError('No definition for referenced signature "'+ue+'"');if(se=Z[se],typeof se!="function")return!1;ie.push(se)}return ie}function Q(P,Z,J){const ie=X(P),ue=new Array(ie.length).fill(!1);let se=!0;for(;se;){se=!1;let _e=!0;for(let he=0;he<ie.length;++he){if(ue[he])continue;const de=ie[he];if(Ct(de))ie[he]=de.referToSelf.callback(J),ie[he].referToSelf=de.referToSelf,ue[he]=!0,_e=!1;else if(Wt(de)){const fe=Y(de.referTo.references,ie,Z);fe?(ie[he]=de.referTo.callback.apply(this,fe),ie[he].referTo=de.referTo,ue[he]=!0,_e=!1):se=!0}}if(_e&&se)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return ie}function pe(P){const Z=/\bthis(\(|\.signatures\b)/;Object.keys(P).forEach(J=>{const ie=P[J];if(Z.test(ie.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function De(P,Z){if(a.createCount++,Object.keys(Z).length===0)throw new SyntaxError("No signatures provided");a.warnAgainstDeprecatedThis&&pe(Z);const J=[],ie=[],ue={},se=[];let _e;for(_e in Z){if(!Object.prototype.hasOwnProperty.call(Z,_e))continue;const Qe=C(_e);if(!Qe)continue;J.forEach(function(Un){if(j(Un,Qe))throw new TypeError('Conflicting signatures "'+y(Un)+'" and "'+y(Qe)+'".')}),J.push(Qe);const ir=ie.length;ie.push(Z[_e]);const i0=Qe.map(w);let Hi;for(Hi of te(i0)){const Un=y(Hi);se.push({params:Hi,name:Un,fn:ir}),Hi.every(Po=>!Po.hasConversion)&&(ue[Un]=ir)}}se.sort(R);const he=Q(ie,ue,ci);let de;for(de in ue)Object.prototype.hasOwnProperty.call(ue,de)&&(ue[de]=he[ue[de]]);const fe=[],Xe=new Map;for(de of se)Xe.has(de.name)||(de.fn=he[de.fn],fe.push(de),Xe.set(de.name,de));const et=fe[0]&&fe[0].params.length<=2&&!b(fe[0].params),dt=fe[1]&&fe[1].params.length<=2&&!b(fe[1].params),zt=fe[2]&&fe[2].params.length<=2&&!b(fe[2].params),Tt=fe[3]&&fe[3].params.length<=2&&!b(fe[3].params),nr=fe[4]&&fe[4].params.length<=2&&!b(fe[4].params),fr=fe[5]&&fe[5].params.length<=2&&!b(fe[5].params),en=et&&dt&&zt&&Tt&&nr&&fr;for(let Qe=0;Qe<fe.length;++Qe)fe[Qe].test=B(fe[Qe].params);const wn=et?F(fe[0].params[0]):Tr,li=dt?F(fe[1].params[0]):Tr,ms=zt?F(fe[2].params[0]):Tr,xs=Tt?F(fe[3].params[0]):Tr,ys=nr?F(fe[4].params[0]):Tr,ki=fr?F(fe[5].params[0]):Tr,zi=et?F(fe[0].params[1]):Tr,Ds=dt?F(fe[1].params[1]):Tr,qi=zt?F(fe[2].params[1]):Tr,ws=Tt?F(fe[3].params[1]):Tr,qn=nr?F(fe[4].params[1]):Tr,Qt=fr?F(fe[5].params[1]):Tr;for(let Qe=0;Qe<fe.length;++Qe)fe[Qe].implementation=H(fe[Qe].params,fe[Qe].fn);const mr=et?fe[0].implementation:wi,Ui=dt?fe[1].implementation:wi,bs=zt?fe[2].implementation:wi,Yu=Tt?fe[3].implementation:wi,Ku=nr?fe[4].implementation:wi,Zu=fr?fe[5].implementation:wi,Vu=et?fe[0].params.length:-1,Gu=dt?fe[1].params.length:-1,Xu=zt?fe[2].params.length:-1,Ro=Tt?fe[3].params.length:-1,Qu=nr?fe[4].params.length:-1,Ju=fr?fe[5].params.length:-1,e0=en?6:0,t0=fe.length,r0=fe.map(Qe=>Qe.test),n0=fe.map(Qe=>Qe.implementation),Wi=function(){for(let ir=e0;ir<t0;ir++)if(r0[ir](arguments))return n0[ir].apply(this,arguments);return a.onMismatch(P,arguments,fe)};function ci(Qe,ir){return arguments.length===Vu&&wn(Qe)&&zi(ir)?mr.apply(this,arguments):arguments.length===Gu&&li(Qe)&&Ds(ir)?Ui.apply(this,arguments):arguments.length===Xu&&ms(Qe)&&qi(ir)?bs.apply(this,arguments):arguments.length===Ro&&xs(Qe)&&ws(ir)?Yu.apply(this,arguments):arguments.length===Qu&&ys(Qe)&&qn(ir)?Ku.apply(this,arguments):arguments.length===Ju&&ki(Qe)&&Qt(ir)?Zu.apply(this,arguments):Wi.apply(this,arguments)}try{Object.defineProperty(ci,"name",{value:P})}catch{}return ci.signatures=ue,ci._typedFunctionData={signatures:fe,signatureMap:Xe},ci}function we(P,Z,J){throw I(P,Z,J)}function be(P){return Fe(P,0,P.length-1)}function Oe(P){return P[P.length-1]}function Fe(P,Z,J){return Array.prototype.slice.call(P,Z,J)}function nt(P,Z){for(let J=0;J<P.length;J++)if(Z(P[J]))return P[J]}function Ye(P,Z){return Array.prototype.concat.apply([],P.map(Z))}function Ie(){const P=be(arguments).map(J=>y(C(J))),Z=Oe(arguments);if(typeof Z!="function")throw new TypeError("Callback function expected as last argument");return Le(P,Z)}function Le(P,Z){return{referTo:{references:P,callback:Z}}}function yt(P){if(typeof P!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:P}}}function Wt(P){return P&&typeof P.referTo=="object"&&Array.isArray(P.referTo.references)&&typeof P.referTo.callback=="function"}function Ct(P){return P&&typeof P.referToSelf=="object"&&typeof P.referToSelf.callback=="function"}function lr(P,Z){if(!P)return Z;if(Z&&Z!==P){const J=new Error("Function names do not match (expected: "+P+", actual: "+Z+")");throw J.data={actual:Z,expected:P},J}return P}function Rr(P){let Z;for(const J in P)Object.prototype.hasOwnProperty.call(P,J)&&(p(P[J])||typeof P[J].signature=="string")&&(Z=lr(Z,P[J].name));return Z}function cr(P,Z){let J;for(J in Z)if(Object.prototype.hasOwnProperty.call(Z,J)){if(J in P&&Z[J]!==P[J]){const ie=new Error('Signature "'+J+'" is defined twice');throw ie.data={signature:J,sourceFunction:Z[J],destFunction:P[J]},ie}P[J]=Z[J]}}const Dt=a;a=function(P){const Z=typeof P=="string",J=Z?1:0;let ie=Z?P:"";const ue={};for(let se=J;se<arguments.length;++se){const _e=arguments[se];let he={},de;if(typeof _e=="function"?(de=_e.name,typeof _e.signature=="string"?he[_e.signature]=_e:p(_e)&&(he=_e.signatures)):s(_e)&&(he=_e,Z||(de=Rr(_e))),Object.keys(he).length===0){const fe=new TypeError("Argument to 'typed' at index "+se+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw fe.data={index:se,argument:_e},fe}Z||(ie=lr(ie,de)),cr(ue,he)}return De(ie||"",ue)},a.create=Sl,a.createCount=Dt.createCount,a.onMismatch=we,a.throwMismatchError=we,a.createError=I,a.clear=c,a.clearConversions=h,a.addTypes=f,a._findType=u,a.referTo=Ie,a.referToSelf=yt,a.convert=_,a.findSignature=v,a.find=x,a.isTypedFunction=p,a.warnAgainstDeprecatedThis=!0,a.addType=function(P,Z){let J="any";Z!==!1&&r.has("Object")&&(J="Object"),a.addTypes([P],J)};function It(P){if(!P||typeof P.from!="string"||typeof P.to!="string"||typeof P.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(P.to===P.from)throw new SyntaxError('Illegal to define conversion from "'+P.from+'" to itself.')}return a.addConversion=function(P){It(P);const Z=u(P.to);if(Z.conversionsTo.every(function(J){return J.from!==P.from}))Z.conversionsTo.push({from:P.from,convert:P.convert,index:i++});else throw new Error('There is already a conversion from "'+P.from+'" to "'+Z.name+'"')},a.addConversions=function(P){P.forEach(a.addConversion)},a.removeConversion=function(P){It(P);const Z=u(P.to),J=nt(Z.conversionsTo,ue=>ue.from===P.from);if(!J)throw new Error("Attempt to remove nonexistent conversion from "+P.from+" to "+P.to);if(J.convert!==P.convert)throw new Error("Conversion to remove does not match existing conversion");const ie=Z.conversionsTo.indexOf(J);Z.conversionsTo.splice(ie,1)},a.resolve=function(P,Z){if(!p(P))throw new TypeError(Nl);const J=P._typedFunctionData.signatures;for(let ie=0;ie<J.length;++ie)if(J[ie].test(Z))return J[ie];return null},a}var Ol=Sl();function Et(s){return typeof s=="boolean"?!0:isFinite(s)?s===Math.round(s):!1}function Ba(s,e,t){var r={2:"0b",8:"0o",16:"0x"},n=r[e],i="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!Et(t))throw new Error("size must be an integer");if(s>2**(t-1)-1||s<-(2**(t-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!Et(s))throw new Error("Value must be an integer");s<0&&(s=s+2**t),i="i".concat(t)}var a="";return s<0&&(s=-s,a="-"),"".concat(a).concat(n).concat(s.toString(e)).concat(i)}function Ma(s,e){if(typeof e=="function")return e(s);if(s===1/0)return"Infinity";if(s===-1/0)return"-Infinity";if(isNaN(s))return"NaN";var{notation:t,precision:r,wordSize:n}=Il(e);switch(t){case"fixed":return r_(s,r);case"exponential":return Tl(s,r);case"engineering":return t_(s,r);case"bin":return Ba(s,2,n);case"oct":return Ba(s,8,n);case"hex":return Ba(s,16,n);case"auto":return n_(s,r,e).replace(/((\.\d*?)(0+))($|e)/,function(){var i=arguments[2],a=arguments[4];return i!=="."?i+a:a});default:throw new Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Il(s){var e="auto",t,r;if(s!==void 0)if(_t(s))t=s;else if(Ot(s))t=s.toNumber();else if(Fa(s))s.precision!==void 0&&(t=$l(s.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),s.wordSize!==void 0&&(r=$l(s.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),s.notation&&(e=s.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:e,precision:t,wordSize:r}}function js(s){var e=String(s).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!e)throw new SyntaxError("Invalid number "+s);var t=e[1],r=e[2],n=parseFloat(e[4]||"0"),i=r.indexOf(".");n+=i!==-1?i-1:r.length-1;var a=r.replace(".","").replace(/^0*/,function(u){return n-=u.length,""}).replace(/0*$/,"").split("").map(function(u){return parseInt(u)});return a.length===0&&(a.push(0),n++),{sign:t,coefficients:a,exponent:n}}function t_(s,e){if(isNaN(s)||!isFinite(s))return String(s);var t=js(s),r=Ys(t,e),n=r.exponent,i=r.coefficients,a=n%3===0?n:n<0?n-3-n%3:n-n%3;if(_t(e))for(;e>i.length||n-a+1>i.length;)i.push(0);else for(var u=Math.abs(n-a)-(i.length-1),f=0;f<u;f++)i.push(0);for(var c=Math.abs(n-a),h=1;c>0;)h++,c--;var d=i.slice(h).join(""),p=_t(e)&&d.length||d.match(/[1-9]/)?"."+d:"",v=i.slice(0,h).join("")+p+"e"+(n>=0?"+":"")+a.toString();return r.sign+v}function r_(s,e){if(isNaN(s)||!isFinite(s))return String(s);var t=js(s),r=typeof e=="number"?Ys(t,t.exponent+1+e):t,n=r.coefficients,i=r.exponent+1,a=i+(e||0);return n.length<a&&(n=n.concat(bi(a-n.length))),i<0&&(n=bi(-i+1).concat(n),i=1),i<n.length&&n.splice(i,0,i===0?"0.":"."),r.sign+n.join("")}function Tl(s,e){if(isNaN(s)||!isFinite(s))return String(s);var t=js(s),r=e?Ys(t,e):t,n=r.coefficients,i=r.exponent;n.length<e&&(n=n.concat(bi(e-n.length)));var a=n.shift();return r.sign+a+(n.length>0?"."+n.join(""):"")+"e"+(i>=0?"+":"")+i}function n_(s,e,t){if(isNaN(s)||!isFinite(s))return String(s);var r=Ll(t==null?void 0:t.lowerExp,-3),n=Ll(t==null?void 0:t.upperExp,5),i=js(s),a=e?Ys(i,e):i;if(a.exponent<r||a.exponent>=n)return Tl(s,e);var u=a.coefficients,f=a.exponent;u.length<e&&(u=u.concat(bi(e-u.length))),u=u.concat(bi(f-u.length+1+(u.length<e?e-u.length:0))),u=bi(-f).concat(u);var c=f>0?f:0;return c<u.length-1&&u.splice(c+1,0,"."),a.sign+u.join("")}function Ys(s,e){for(var t={sign:s.sign,coefficients:s.coefficients,exponent:s.exponent},r=t.coefficients;e<=0;)r.unshift(0),t.exponent++,e++;if(r.length>e){var n=r.splice(e,r.length-e);if(n[0]>=5){var i=e-1;for(r[i]++;r[i]===10;)r.pop(),i===0&&(r.unshift(0),t.exponent++,i++),i--,r[i]++}}return t}function bi(s){for(var e=[],t=0;t<s;t++)e.push(0);return e}function i_(s){return s.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}var s_=Number.EPSILON||2220446049250313e-31;function ri(s,e,t){if(t==null)return s===e;if(s===e)return!0;if(isNaN(s)||isNaN(e))return!1;if(isFinite(s)&&isFinite(e)){var r=Math.abs(s-e);return r<=s_?!0:r<=Math.max(Math.abs(s),Math.abs(e))*t}return!1}function $l(s,e){if(_t(s))return s;if(Ot(s))return s.toNumber();e()}function Ll(s,e){return _t(s)?s:Ot(s)?s.toNumber():e}function Na(s,e,t){var r=s.constructor,n=new r(2),i="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!Et(t))throw new Error("size must be an integer");if(s.greaterThan(n.pow(t-1).sub(1))||s.lessThan(n.pow(t-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!s.isInteger())throw new Error("Value must be an integer");s.lessThan(0)&&(s=s.add(n.pow(t))),i="i".concat(t)}switch(e){case 2:return"".concat(s.toBinary()).concat(i);case 8:return"".concat(s.toOctal()).concat(i);case 16:return"".concat(s.toHexadecimal()).concat(i);default:throw new Error("Base ".concat(e," not supported "))}}function o_(s,e){if(typeof e=="function")return e(s);if(!s.isFinite())return s.isNaN()?"NaN":s.gt(0)?"Infinity":"-Infinity";var{notation:t,precision:r,wordSize:n}=Il(e);switch(t){case"fixed":return u_(s,r);case"exponential":return Rl(s,r);case"engineering":return a_(s,r);case"bin":return Na(s,2,n);case"oct":return Na(s,8,n);case"hex":return Na(s,16,n);case"auto":{var i=Pl(e==null?void 0:e.lowerExp,-3),a=Pl(e==null?void 0:e.upperExp,5);if(s.isZero())return"0";var u,f=s.toSignificantDigits(r),c=f.e;return c>=i&&c<a?u=f.toFixed():u=Rl(s,r),u.replace(/((\.\d*?)(0+))($|e)/,function(){var h=arguments[2],d=arguments[4];return h!=="."?h+d:d})}default:throw new Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function a_(s,e){var t=s.e,r=t%3===0?t:t<0?t-3-t%3:t-t%3,n=s.mul(Math.pow(10,-r)),i=n.toPrecision(e);if(i.indexOf("e")!==-1){var a=s.constructor;i=new a(i).toFixed()}return i+"e"+(t>=0?"+":"")+r.toString()}function Rl(s,e){return e!==void 0?s.toExponential(e-1):s.toExponential()}function u_(s,e){return s.toFixed(e)}function Pl(s,e){return _t(s)?s:Ot(s)?s.toNumber():e}function ft(s,e){var t=l_(s,e);return e&&typeof e=="object"&&"truncate"in e&&t.length>e.truncate?t.substring(0,e.truncate-3)+"...":t}function l_(s,e){if(typeof s=="number")return Ma(s,e);if(Ot(s))return o_(s,e);if(c_(s))return!e||e.fraction!=="decimal"?s.s*s.n+"/"+s.d:s.toString();if(Array.isArray(s))return ql(s,e);if(un(s))return kl(s);if(typeof s=="function")return s.syntax?String(s.syntax):"function";if(s&&typeof s=="object"){if(typeof s.format=="function")return s.format(e);if(s&&s.toString(e)!=={}.toString())return s.toString(e);var t=Object.keys(s).map(r=>kl(r)+": "+ft(s[r],e));return"{"+t.join(", ")+"}"}return String(s)}function kl(s){for(var e=String(s),t="",r=0;r<e.length;){var n=e.charAt(r);t+=n in zl?zl[n]:n,r++}return'"'+t+'"'}var zl={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"};function ql(s,e){if(Array.isArray(s)){for(var t="[",r=s.length,n=0;n<r;n++)n!==0&&(t+=", "),t+=ql(s[n],e);return t+="]",t}else return ft(s,e)}function c_(s){return s&&typeof s=="object"&&typeof s.s=="number"&&typeof s.n=="number"&&typeof s.d=="number"||!1}function rt(s,e,t){if(!(this instanceof rt))throw new SyntaxError("Constructor must be called with the new operator");this.actual=s,this.expected=e,this.relation=t,this.message="Dimension mismatch ("+(Array.isArray(s)?"["+s.join(", ")+"]":s)+" "+(this.relation||"!=")+" "+(Array.isArray(e)?"["+e.join(", ")+"]":e)+")",this.stack=new Error().stack}rt.prototype=new RangeError,rt.prototype.constructor=RangeError,rt.prototype.name="DimensionError",rt.prototype.isDimensionError=!0;function In(s,e,t){if(!(this instanceof In))throw new SyntaxError("Constructor must be called with the new operator");this.index=s,arguments.length<3?(this.min=0,this.max=e):(this.min=e,this.max=t),this.min!==void 0&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":this.max!==void 0&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=new Error().stack}In.prototype=new RangeError,In.prototype.constructor=RangeError,In.prototype.name="IndexError",In.prototype.isIndexError=!0;function Pt(s){for(var e=[];Array.isArray(s);)e.push(s.length),s=s[0];return e}function Ul(s,e,t){var r,n=s.length;if(n!==e[t])throw new rt(n,e[t]);if(t<e.length-1){var i=t+1;for(r=0;r<n;r++){var a=s[r];if(!Array.isArray(a))throw new rt(e.length-1,e.length,"<");Ul(s[r],e,i)}}else for(r=0;r<n;r++)if(Array.isArray(s[r]))throw new rt(e.length+1,e.length,">")}function Wl(s,e){var t=e.length===0;if(t){if(Array.isArray(s))throw new rt(s.length,0)}else Ul(s,e,0)}function Bt(s,e){if(s!==void 0){if(!_t(s)||!Et(s))throw new TypeError("Index must be an integer (value: "+s+")");if(s<0||typeof e=="number"&&s>=e)throw new In(s,e)}}function Sa(s,e,t){if(!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new Error("Resizing to scalar is not supported");e.forEach(function(n){if(!_t(n)||!Et(n)||n<0)throw new TypeError("Invalid size, must contain positive integers (size: "+ft(e)+")")}),(_t(s)||Ot(s))&&(s=[s]);var r=t!==void 0?t:0;return Oa(s,e,0,r),s}function Oa(s,e,t,r){var n,i,a=s.length,u=e[t],f=Math.min(a,u);if(s.length=u,t<e.length-1){var c=t+1;for(n=0;n<f;n++)i=s[n],Array.isArray(i)||(i=[i],s[n]=i),Oa(i,e,c,r);for(n=f;n<u;n++)i=[],s[n]=i,Oa(i,e,c,r)}else{for(n=0;n<f;n++)for(;Array.isArray(s[n]);)s[n]=s[n][0];for(n=f;n<u;n++)s[n]=r}}function Ia(s,e){var t=$a(s),r=t.length;if(!Array.isArray(s)||!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new rt(0,r,"!=");e=Ta(e,r);var n=Hl(e);if(r!==n)throw new rt(n,r,"!=");try{return f_(t,e)}catch(i){throw i instanceof rt?new rt(n,r,"!="):i}}function Ta(s,e){var t=Hl(s),r=s.slice(),n=-1,i=s.indexOf(n),a=s.indexOf(n,i+1)>=0;if(a)throw new Error("More than one wildcard in sizes");var u=i>=0,f=e%t===0;if(u)if(f)r[i]=-e/t;else throw new Error("Could not replace wildcard, since "+e+" is no multiple of "+-t);return r}function Hl(s){return s.reduce((e,t)=>e*t,1)}function f_(s,e){for(var t=s,r,n=e.length-1;n>0;n--){var i=e[n];r=[];for(var a=t.length/i,u=0;u<a;u++)r.push(t.slice(u*i,(u+1)*i));t=r}return t}function jl(s,e,t,r){var n=r||Pt(s);if(t)for(var i=0;i<t;i++)s=[s],n.unshift(1);for(s=Yl(s,e,0);n.length<e;)n.push(1);return s}function Yl(s,e,t){var r,n;if(Array.isArray(s)){var i=t+1;for(r=0,n=s.length;r<n;r++)s[r]=Yl(s[r],e,i)}else for(var a=t;a<e;a++)s=[s];return s}function $a(s){if(!Array.isArray(s))return s;var e=[];return s.forEach(function t(r){Array.isArray(r)?r.forEach(t):e.push(r)}),e}function Ks(s,e){for(var t,r=0,n=0;n<s.length;n++){var i=s[n],a=Array.isArray(i);if(n===0&&a&&(r=i.length),a&&i.length!==r)return;var u=a?Ks(i,e):e(i);if(t===void 0)t=u;else if(t!==u)return"mixed"}return t}function Kl(s,e,t,r){if(r<t){if(s.length!==e.length)throw new rt(s.length,e.length);for(var n=[],i=0;i<s.length;i++)n[i]=Kl(s[i],e[i],t,r+1);return n}else return s.concat(e)}function Zl(){var s=Array.prototype.slice.call(arguments,0,-1),e=Array.prototype.slice.call(arguments,-1);if(s.length===1)return s[0];if(s.length>1)return s.slice(1).reduce(function(t,r){return Kl(t,r,e,0)},s[0]);throw new Error("Wrong number of arguments in function concat")}function h_(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];for(var r=e.map(p=>p.length),n=Math.max(...r),i=new Array(n).fill(null),a=0;a<e.length;a++)for(var u=e[a],f=r[a],c=0;c<f;c++){var h=n-f+c;u[c]>i[h]&&(i[h]=u[c])}for(var d=0;d<e.length;d++)Zs(e[d],i);return i}function Zs(s,e){for(var t=e.length,r=s.length,n=0;n<r;n++){var i=t-r+n;if(s[n]<e[i]&&s[n]>1||s[n]>e[i])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(s,") not possible to broadcast dimension ").concat(r," with size ").concat(s[n]," to size ").concat(e[i]))}}function Vl(s,e){var t=Pt(s);if(Di(t,e))return s;Zs(t,e);var r=h_(t,e),n=r.length,i=[...Array(n-t.length).fill(1),...t],a=p_(s);t.length<n&&(a=Ia(a,i),t=Pt(a));for(var u=0;u<n;u++)t[u]<r[u]&&(a=d_(a,r[u],u),t=Pt(a));return a}function d_(s,e,t){return Zl(...Array(e).fill(s),t)}function p_(s){return Hs([],s)}function xe(s,e,t,r){function n(i){var a=Q1(i,e.map(g_));return __(s,e,i),t(a)}return n.isFactory=!0,n.fn=s,n.dependencies=e.slice().sort(),r&&(n.meta=r),n}function __(s,e,t){var r=e.filter(i=>!v_(i)).every(i=>t[i]!==void 0);if(!r){var n=e.filter(i=>t[i]===void 0);throw new Error('Cannot create function "'.concat(s,'", ')+"some dependencies are missing: ".concat(n.map(i=>'"'.concat(i,'"')).join(", "),"."))}}function v_(s){return s&&s[0]==="?"}function g_(s){return s&&s[0]==="?"?s.slice(1):s}function m_(s,e){if(Xl(s)&&Gl(s,e))return s[e];throw typeof s[e]=="function"&&D_(s,e)?new Error('Cannot access method "'+e+'" as a property'):new Error('No access to property "'+e+'"')}function x_(s,e,t){if(Xl(s)&&Gl(s,e))return s[e]=t,t;throw new Error('No access to property "'+e+'"')}function y_(s,e){return e in s}function Gl(s,e){return!s||typeof s!="object"?!1:as(w_,e)?!0:!(e in Object.prototype||e in Function.prototype)}function D_(s,e){return s==null||typeof s[e]!="function"||as(s,e)&&Object.getPrototypeOf&&e in Object.getPrototypeOf(s)?!1:as(b_,e)?!0:!(e in Object.prototype||e in Function.prototype)}function Xl(s){return typeof s=="object"&&s&&s.constructor===Object}var w_={length:!0,name:!0},b_={toString:!0,valueOf:!0,toLocaleString:!0};class E_{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).values()}get(e){return m_(this.wrappedObject,e)}set(e,t){return x_(this.wrappedObject,e,t),this}has(e){return y_(this.wrappedObject,e)}entries(){return C_(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var t of this.keys())e(this.get(t),t,this)}delete(e){delete this.wrappedObject[e]}clear(){for(var e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}}function C_(s,e){return{next:()=>{var t=s.next();return t.done?t:{value:e(t.value),done:!1}}}}function A_(s){return s?s instanceof Map||s instanceof E_||typeof s.set=="function"&&typeof s.get=="function"&&typeof s.keys=="function"&&typeof s.has=="function":!1}var Ql=function(){return Ql=Ol.create,Ol},F_=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],B_=xe("typed",F_,function(e){var{BigNumber:t,Complex:r,DenseMatrix:n,Fraction:i}=e,a=Ql();return a.clear(),a.addTypes([{name:"number",test:_t},{name:"Complex",test:Cl},{name:"BigNumber",test:Ot},{name:"Fraction",test:Al},{name:"Unit",test:Fl},{name:"identifier",test:u=>un&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(u)},{name:"string",test:un},{name:"Chain",test:G1},{name:"Array",test:Ft},{name:"Matrix",test:xt},{name:"DenseMatrix",test:b1},{name:"SparseMatrix",test:E1},{name:"Range",test:C1},{name:"Index",test:Aa},{name:"boolean",test:A1},{name:"ResultSet",test:F1},{name:"Help",test:B1},{name:"function",test:M1},{name:"Date",test:N1},{name:"RegExp",test:S1},{name:"null",test:O1},{name:"undefined",test:I1},{name:"AccessorNode",test:T1},{name:"ArrayNode",test:$1},{name:"AssignmentNode",test:L1},{name:"BlockNode",test:R1},{name:"ConditionalNode",test:P1},{name:"ConstantNode",test:k1},{name:"FunctionNode",test:q1},{name:"FunctionAssignmentNode",test:z1},{name:"IndexNode",test:U1},{name:"Node",test:W1},{name:"ObjectNode",test:H1},{name:"OperatorNode",test:j1},{name:"ParenthesisNode",test:Y1},{name:"RangeNode",test:K1},{name:"RelationalNode",test:Z1},{name:"SymbolNode",test:V1},{name:"Map",test:A_},{name:"Object",test:Fa}]),a.addConversions([{from:"number",to:"BigNumber",convert:function(f){if(t||La(f),i_(f)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+f+"). Use function bignumber(x) to convert to BigNumber.");return new t(f)}},{from:"number",to:"Complex",convert:function(f){return r||Vs(f),new r(f,0)}},{from:"BigNumber",to:"Complex",convert:function(f){return r||Vs(f),new r(f.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(f){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(f){return r||Vs(f),new r(f.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(f){i||Ra(f);var c=new i(f);if(c.valueOf()!==f)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+f+"). Use function fraction(x) to convert to Fraction.");return c}},{from:"string",to:"number",convert:function(f){var c=Number(f);if(isNaN(c))throw new Error('Cannot convert "'+f+'" to a number');return c}},{from:"string",to:"BigNumber",convert:function(f){t||La(f);try{return new t(f)}catch{throw new Error('Cannot convert "'+f+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(f){i||Ra(f);try{return new i(f)}catch{throw new Error('Cannot convert "'+f+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(f){r||Vs(f);try{return new r(f)}catch{throw new Error('Cannot convert "'+f+'" to Complex')}}},{from:"boolean",to:"number",convert:function(f){return+f}},{from:"boolean",to:"BigNumber",convert:function(f){return t||La(f),new t(+f)}},{from:"boolean",to:"Fraction",convert:function(f){return i||Ra(f),new i(+f)}},{from:"boolean",to:"string",convert:function(f){return String(f)}},{from:"Array",to:"Matrix",convert:function(f){return n||M_(),new n(f)}},{from:"Matrix",to:"Array",convert:function(f){return f.valueOf()}}]),a.onMismatch=(u,f,c)=>{var h=a.createError(u,f,c);if(["wrongType","mismatch"].includes(h.data.category)&&f.length===1&&os(f[0])&&c.some(p=>!p.params.includes(","))){var d=new TypeError("Function '".concat(u,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(u,")'."));throw d.data=h.data,d}throw h},a.onMismatch=(u,f,c)=>{var h=a.createError(u,f,c);if(["wrongType","mismatch"].includes(h.data.category)&&f.length===1&&os(f[0])&&c.some(p=>!p.params.includes(","))){var d=new TypeError("Function '".concat(u,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(u,")'."));throw d.data=h.data,d}throw h},a});function La(s){throw new Error("Cannot convert value ".concat(s," into a BigNumber: no class 'BigNumber' provided"))}function Vs(s){throw new Error("Cannot convert value ".concat(s," into a Complex number: no class 'Complex' provided"))}function M_(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function Ra(s){throw new Error("Cannot convert value ".concat(s," into a Fraction, no class 'Fraction' provided."))}/*!
35
35
  * decimal.js v10.4.3
36
36
  * An arbitrary-precision Decimal type for JavaScript.
37
37
  * https://github.com/MikeMcl/decimal.js
38
38
  * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
39
39
  * MIT Licence
40
- */var bi=9e15,Tn=1e9,Pa="0123456789abcdef",Gs="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Xs="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ka={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-bi,maxE:bi,crypto:!1},Jl,mn,$e=!0,Qs="[DecimalError] ",$n=Qs+"Invalid argument: ",ec=Qs+"Precision limit exceeded",tc=Qs+"crypto unavailable",rc="[object Decimal]",tr=Math.floor,Ut=Math.pow,N_=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,S_=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,O_=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,nc=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Xr=1e7,Be=7,I_=9007199254740991,T_=Gs.length-1,za=Xs.length-1,le={toStringTag:rc};le.absoluteValue=le.abs=function(){var s=new this.constructor(this);return s.s<0&&(s.s=1),Ce(s)},le.ceil=function(){return Ce(new this.constructor(this),this.e+1,2)},le.clampedTo=le.clamp=function(s,e){var t,r=this,n=r.constructor;if(s=new n(s),e=new n(e),!s.s||!e.s)return new n(NaN);if(s.gt(e))throw Error($n+e);return t=r.cmp(s),t<0?s:r.cmp(e)>0?e:new n(r)},le.comparedTo=le.cmp=function(s){var e,t,r,n,i=this,a=i.d,u=(s=new i.constructor(s)).d,f=i.s,c=s.s;if(!a||!u)return!f||!c?NaN:f!==c?f:a===u?0:!a^f<0?1:-1;if(!a[0]||!u[0])return a[0]?f:u[0]?-c:0;if(f!==c)return f;if(i.e!==s.e)return i.e>s.e^f<0?1:-1;for(r=a.length,n=u.length,e=0,t=r<n?r:n;e<t;++e)if(a[e]!==u[e])return a[e]>u[e]^f<0?1:-1;return r===n?0:r>n^f<0?1:-1},le.cosine=le.cos=function(){var s,e,t=this,r=t.constructor;return t.d?t.d[0]?(s=r.precision,e=r.rounding,r.precision=s+Math.max(t.e,t.sd())+Be,r.rounding=1,t=$_(r,lc(r,t)),r.precision=s,r.rounding=e,Ce(mn==2||mn==3?t.neg():t,s,e,!0)):new r(1):new r(NaN)},le.cubeRoot=le.cbrt=function(){var s,e,t,r,n,i,a,u,f,c,h=this,d=h.constructor;if(!h.isFinite()||h.isZero())return new d(h);for($e=!1,i=h.s*Ut(h.s*h,1/3),!i||Math.abs(i)==1/0?(t=Gt(h.d),s=h.e,(i=(s-t.length+1)%3)&&(t+=i==1||i==-2?"0":"00"),i=Ut(t,1/3),s=tr((s+1)/3)-(s%3==(s<0?-1:2)),i==1/0?t="5e"+s:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+s),r=new d(t),r.s=h.s):r=new d(i.toString()),a=(s=d.precision)+3;;)if(u=r,f=u.times(u).times(u),c=f.plus(h),r=ht(c.plus(h).times(u),c.plus(f),a+2,1),Gt(u.d).slice(0,a)===(t=Gt(r.d)).slice(0,a))if(t=t.slice(a-3,a+1),t=="9999"||!n&&t=="4999"){if(!n&&(Ce(u,s+1,0),u.times(u).times(u).eq(h))){r=u;break}a+=4,n=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(Ce(r,s+1,1),e=!r.times(r).times(r).eq(h));break}return $e=!0,Ce(r,s,d.rounding,e)},le.decimalPlaces=le.dp=function(){var s,e=this.d,t=NaN;if(e){if(s=e.length-1,t=(s-tr(this.e/Be))*Be,s=e[s],s)for(;s%10==0;s/=10)t--;t<0&&(t=0)}return t},le.dividedBy=le.div=function(s){return ht(this,new this.constructor(s))},le.dividedToIntegerBy=le.divToInt=function(s){var e=this,t=e.constructor;return Ce(ht(e,new t(s),0,1,1),t.precision,t.rounding)},le.equals=le.eq=function(s){return this.cmp(s)===0},le.floor=function(){return Ce(new this.constructor(this),this.e+1,3)},le.greaterThan=le.gt=function(s){return this.cmp(s)>0},le.greaterThanOrEqualTo=le.gte=function(s){var e=this.cmp(s);return e==1||e===0},le.hyperbolicCosine=le.cosh=function(){var s,e,t,r,n,i=this,a=i.constructor,u=new a(1);if(!i.isFinite())return new a(i.s?1/0:NaN);if(i.isZero())return u;t=a.precision,r=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,n=i.d.length,n<32?(s=Math.ceil(n/3),e=(1/ro(4,s)).toString()):(s=16,e="2.3283064365386962890625e-10"),i=Ai(a,1,i.times(e),new a(1),!0);for(var f,c=s,h=new a(8);c--;)f=i.times(i),i=u.minus(f.times(h.minus(f.times(h))));return Ce(i,a.precision=t,a.rounding=r,!0)},le.hyperbolicSine=le.sinh=function(){var s,e,t,r,n=this,i=n.constructor;if(!n.isFinite()||n.isZero())return new i(n);if(e=i.precision,t=i.rounding,i.precision=e+Math.max(n.e,n.sd())+4,i.rounding=1,r=n.d.length,r<3)n=Ai(i,2,n,n,!0);else{s=1.4*Math.sqrt(r),s=s>16?16:s|0,n=n.times(1/ro(5,s)),n=Ai(i,2,n,n,!0);for(var a,u=new i(5),f=new i(16),c=new i(20);s--;)a=n.times(n),n=n.times(u.plus(a.times(f.times(a).plus(c))))}return i.precision=e,i.rounding=t,Ce(n,e,t,!0)},le.hyperbolicTangent=le.tanh=function(){var s,e,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(s=r.precision,e=r.rounding,r.precision=s+7,r.rounding=1,ht(t.sinh(),t.cosh(),r.precision=s,r.rounding=e)):new r(t.s)},le.inverseCosine=le.acos=function(){var s,e=this,t=e.constructor,r=e.abs().cmp(1),n=t.precision,i=t.rounding;return r!==-1?r===0?e.isNeg()?Qr(t,n,i):new t(0):new t(NaN):e.isZero()?Qr(t,n+4,i).times(.5):(t.precision=n+6,t.rounding=1,e=e.asin(),s=Qr(t,n+4,i).times(.5),t.precision=n,t.rounding=i,s.minus(e))},le.inverseHyperbolicCosine=le.acosh=function(){var s,e,t=this,r=t.constructor;return t.lte(1)?new r(t.eq(1)?0:NaN):t.isFinite()?(s=r.precision,e=r.rounding,r.precision=s+Math.max(Math.abs(t.e),t.sd())+4,r.rounding=1,$e=!1,t=t.times(t).minus(1).sqrt().plus(t),$e=!0,r.precision=s,r.rounding=e,t.ln()):new r(t)},le.inverseHyperbolicSine=le.asinh=function(){var s,e,t=this,r=t.constructor;return!t.isFinite()||t.isZero()?new r(t):(s=r.precision,e=r.rounding,r.precision=s+2*Math.max(Math.abs(t.e),t.sd())+6,r.rounding=1,$e=!1,t=t.times(t).plus(1).sqrt().plus(t),$e=!0,r.precision=s,r.rounding=e,t.ln())},le.inverseHyperbolicTangent=le.atanh=function(){var s,e,t,r,n=this,i=n.constructor;return n.isFinite()?n.e>=0?new i(n.abs().eq(1)?n.s/0:n.isZero()?n:NaN):(s=i.precision,e=i.rounding,r=n.sd(),Math.max(r,s)<2*-n.e-1?Ce(new i(n),s,e,!0):(i.precision=t=r-n.e,n=ht(n.plus(1),new i(1).minus(n),t+s,1),i.precision=s+4,i.rounding=1,n=n.ln(),i.precision=s,i.rounding=e,n.times(.5))):new i(NaN)},le.inverseSine=le.asin=function(){var s,e,t,r,n=this,i=n.constructor;return n.isZero()?new i(n):(e=n.abs().cmp(1),t=i.precision,r=i.rounding,e!==-1?e===0?(s=Qr(i,t+4,r).times(.5),s.s=n.s,s):new i(NaN):(i.precision=t+6,i.rounding=1,n=n.div(new i(1).minus(n.times(n)).sqrt().plus(1)).atan(),i.precision=t,i.rounding=r,n.times(2)))},le.inverseTangent=le.atan=function(){var s,e,t,r,n,i,a,u,f,c=this,h=c.constructor,d=h.precision,p=h.rounding;if(c.isFinite()){if(c.isZero())return new h(c);if(c.abs().eq(1)&&d+4<=za)return a=Qr(h,d+4,p).times(.25),a.s=c.s,a}else{if(!c.s)return new h(NaN);if(d+4<=za)return a=Qr(h,d+4,p).times(.5),a.s=c.s,a}for(h.precision=u=d+10,h.rounding=1,t=Math.min(28,u/Be+2|0),s=t;s;--s)c=c.div(c.times(c).plus(1).sqrt().plus(1));for($e=!1,e=Math.ceil(u/Be),r=1,f=c.times(c),a=new h(c),n=c;s!==-1;)if(n=n.times(f),i=a.minus(n.div(r+=2)),n=n.times(f),a=i.plus(n.div(r+=2)),a.d[e]!==void 0)for(s=e;a.d[s]===i.d[s]&&s--;);return t&&(a=a.times(2<<t-1)),$e=!0,Ce(a,h.precision=d,h.rounding=p,!0)},le.isFinite=function(){return!!this.d},le.isInteger=le.isInt=function(){return!!this.d&&tr(this.e/Be)>this.d.length-2},le.isNaN=function(){return!this.s},le.isNegative=le.isNeg=function(){return this.s<0},le.isPositive=le.isPos=function(){return this.s>0},le.isZero=function(){return!!this.d&&this.d[0]===0},le.lessThan=le.lt=function(s){return this.cmp(s)<0},le.lessThanOrEqualTo=le.lte=function(s){return this.cmp(s)<1},le.logarithm=le.log=function(s){var e,t,r,n,i,a,u,f,c=this,h=c.constructor,d=h.precision,p=h.rounding,v=5;if(s==null)s=new h(10),e=!0;else{if(s=new h(s),t=s.d,s.s<0||!t||!t[0]||s.eq(1))return new h(NaN);e=s.eq(10)}if(t=c.d,c.s<0||!t||!t[0]||c.eq(1))return new h(t&&!t[0]?-1/0:c.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)i=!0;else{for(n=t[0];n%10===0;)n/=10;i=n!==1}if($e=!1,u=d+v,a=Rn(c,u),r=e?to(h,u+10):Rn(s,u),f=ht(a,r,u,1),us(f.d,n=d,p))do if(u+=10,a=Rn(c,u),r=e?to(h,u+10):Rn(s,u),f=ht(a,r,u,1),!i){+Gt(f.d).slice(n+1,n+15)+1==1e14&&(f=Ce(f,d+1,0));break}while(us(f.d,n+=10,p));return $e=!0,Ce(f,d,p)},le.minus=le.sub=function(s){var e,t,r,n,i,a,u,f,c,h,d,p,v=this,x=v.constructor;if(s=new x(s),!v.d||!s.d)return!v.s||!s.s?s=new x(NaN):v.d?s.s=-s.s:s=new x(s.d||v.s!==s.s?v:NaN),s;if(v.s!=s.s)return s.s=-s.s,v.plus(s);if(c=v.d,p=s.d,u=x.precision,f=x.rounding,!c[0]||!p[0]){if(p[0])s.s=-s.s;else if(c[0])s=new x(v);else return new x(f===3?-0:0);return $e?Ce(s,u,f):s}if(t=tr(s.e/Be),h=tr(v.e/Be),c=c.slice(),i=h-t,i){for(d=i<0,d?(e=c,i=-i,a=p.length):(e=p,t=h,a=c.length),r=Math.max(Math.ceil(u/Be),a)+2,i>r&&(i=r,e.length=1),e.reverse(),r=i;r--;)e.push(0);e.reverse()}else{for(r=c.length,a=p.length,d=r<a,d&&(a=r),r=0;r<a;r++)if(c[r]!=p[r]){d=c[r]<p[r];break}i=0}for(d&&(e=c,c=p,p=e,s.s=-s.s),a=c.length,r=p.length-a;r>0;--r)c[a++]=0;for(r=p.length;r>i;){if(c[--r]<p[r]){for(n=r;n&&c[--n]===0;)c[n]=Xr-1;--c[n],c[r]+=Xr}c[r]-=p[r]}for(;c[--a]===0;)c.pop();for(;c[0]===0;c.shift())--t;return c[0]?(s.d=c,s.e=eo(c,t),$e?Ce(s,u,f):s):new x(f===3?-0:0)},le.modulo=le.mod=function(s){var e,t=this,r=t.constructor;return s=new r(s),!t.d||!s.s||s.d&&!s.d[0]?new r(NaN):!s.d||t.d&&!t.d[0]?Ce(new r(t),r.precision,r.rounding):($e=!1,r.modulo==9?(e=ht(t,s.abs(),0,3,1),e.s*=s.s):e=ht(t,s,0,r.modulo,1),e=e.times(s),$e=!0,t.minus(e))},le.naturalExponential=le.exp=function(){return qa(this)},le.naturalLogarithm=le.ln=function(){return Rn(this)},le.negated=le.neg=function(){var s=new this.constructor(this);return s.s=-s.s,Ce(s)},le.plus=le.add=function(s){var e,t,r,n,i,a,u,f,c,h,d=this,p=d.constructor;if(s=new p(s),!d.d||!s.d)return!d.s||!s.s?s=new p(NaN):d.d||(s=new p(s.d||d.s===s.s?d:NaN)),s;if(d.s!=s.s)return s.s=-s.s,d.minus(s);if(c=d.d,h=s.d,u=p.precision,f=p.rounding,!c[0]||!h[0])return h[0]||(s=new p(d)),$e?Ce(s,u,f):s;if(i=tr(d.e/Be),r=tr(s.e/Be),c=c.slice(),n=i-r,n){for(n<0?(t=c,n=-n,a=h.length):(t=h,r=i,a=c.length),i=Math.ceil(u/Be),a=i>a?i+1:a+1,n>a&&(n=a,t.length=1),t.reverse();n--;)t.push(0);t.reverse()}for(a=c.length,n=h.length,a-n<0&&(n=a,t=h,h=c,c=t),e=0;n;)e=(c[--n]=c[n]+h[n]+e)/Xr|0,c[n]%=Xr;for(e&&(c.unshift(e),++r),a=c.length;c[--a]==0;)c.pop();return s.d=c,s.e=eo(c,r),$e?Ce(s,u,f):s},le.precision=le.sd=function(s){var e,t=this;if(s!==void 0&&s!==!!s&&s!==1&&s!==0)throw Error($n+s);return t.d?(e=ic(t.d),s&&t.e+1>e&&(e=t.e+1)):e=NaN,e},le.round=function(){var s=this,e=s.constructor;return Ce(new e(s),s.e+1,e.rounding)},le.sine=le.sin=function(){var s,e,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(s=r.precision,e=r.rounding,r.precision=s+Math.max(t.e,t.sd())+Be,r.rounding=1,t=R_(r,lc(r,t)),r.precision=s,r.rounding=e,Ce(mn>2?t.neg():t,s,e,!0)):new r(NaN)},le.squareRoot=le.sqrt=function(){var s,e,t,r,n,i,a=this,u=a.d,f=a.e,c=a.s,h=a.constructor;if(c!==1||!u||!u[0])return new h(!c||c<0&&(!u||u[0])?NaN:u?a:1/0);for($e=!1,c=Math.sqrt(+a),c==0||c==1/0?(e=Gt(u),(e.length+f)%2==0&&(e+="0"),c=Math.sqrt(e),f=tr((f+1)/2)-(f<0||f%2),c==1/0?e="5e"+f:(e=c.toExponential(),e=e.slice(0,e.indexOf("e")+1)+f),r=new h(e)):r=new h(c.toString()),t=(f=h.precision)+3;;)if(i=r,r=i.plus(ht(a,i,t+2,1)).times(.5),Gt(i.d).slice(0,t)===(e=Gt(r.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!n&&e=="4999"){if(!n&&(Ce(i,f+1,0),i.times(i).eq(a))){r=i;break}t+=4,n=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(Ce(r,f+1,1),s=!r.times(r).eq(a));break}return $e=!0,Ce(r,f,h.rounding,s)},le.tangent=le.tan=function(){var s,e,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(s=r.precision,e=r.rounding,r.precision=s+10,r.rounding=1,t=t.sin(),t.s=1,t=ht(t,new r(1).minus(t.times(t)).sqrt(),s+10,0),r.precision=s,r.rounding=e,Ce(mn==2||mn==4?t.neg():t,s,e,!0)):new r(NaN)},le.times=le.mul=function(s){var e,t,r,n,i,a,u,f,c,h=this,d=h.constructor,p=h.d,v=(s=new d(s)).d;if(s.s*=h.s,!p||!p[0]||!v||!v[0])return new d(!s.s||p&&!p[0]&&!v||v&&!v[0]&&!p?NaN:!p||!v?s.s/0:s.s*0);for(t=tr(h.e/Be)+tr(s.e/Be),f=p.length,c=v.length,f<c&&(i=p,p=v,v=i,a=f,f=c,c=a),i=[],a=f+c,r=a;r--;)i.push(0);for(r=c;--r>=0;){for(e=0,n=f+r;n>r;)u=i[n]+v[r]*p[n-r-1]+e,i[n--]=u%Xr|0,e=u/Xr|0;i[n]=(i[n]+e)%Xr|0}for(;!i[--a];)i.pop();return e?++t:i.shift(),s.d=i,s.e=eo(i,t),$e?Ce(s,d.precision,d.rounding):s},le.toBinary=function(s,e){return Wa(this,2,s,e)},le.toDecimalPlaces=le.toDP=function(s,e){var t=this,r=t.constructor;return t=new r(t),s===void 0?t:(vr(s,0,Tn),e===void 0?e=r.rounding:vr(e,0,8),Ce(t,s+t.e+1,e))},le.toExponential=function(s,e){var t,r=this,n=r.constructor;return s===void 0?t=ln(r,!0):(vr(s,0,Tn),e===void 0?e=n.rounding:vr(e,0,8),r=Ce(new n(r),s+1,e),t=ln(r,!0,s+1)),r.isNeg()&&!r.isZero()?"-"+t:t},le.toFixed=function(s,e){var t,r,n=this,i=n.constructor;return s===void 0?t=ln(n):(vr(s,0,Tn),e===void 0?e=i.rounding:vr(e,0,8),r=Ce(new i(n),s+n.e+1,e),t=ln(r,!1,s+r.e+1)),n.isNeg()&&!n.isZero()?"-"+t:t},le.toFraction=function(s){var e,t,r,n,i,a,u,f,c,h,d,p,v=this,x=v.d,_=v.constructor;if(!x)return new _(v);if(c=t=new _(1),r=f=new _(0),e=new _(r),i=e.e=ic(x)-v.e-1,a=i%Be,e.d[0]=Ut(10,a<0?Be+a:a),s==null)s=i>0?e:c;else{if(u=new _(s),!u.isInt()||u.lt(c))throw Error($n+u);s=u.gt(e)?i>0?e:c:u}for($e=!1,u=new _(Gt(x)),h=_.precision,_.precision=i=x.length*Be*2;d=ht(u,e,0,1,1),n=t.plus(d.times(r)),n.cmp(s)!=1;)t=r,r=n,n=c,c=f.plus(d.times(n)),f=n,n=e,e=u.minus(d.times(n)),u=n;return n=ht(s.minus(t),r,0,1,1),f=f.plus(n.times(c)),t=t.plus(n.times(r)),f.s=c.s=v.s,p=ht(c,r,i,1).minus(v).abs().cmp(ht(f,t,i,1).minus(v).abs())<1?[c,r]:[f,t],_.precision=h,$e=!0,p},le.toHexadecimal=le.toHex=function(s,e){return Wa(this,16,s,e)},le.toNearest=function(s,e){var t=this,r=t.constructor;if(t=new r(t),s==null){if(!t.d)return t;s=new r(1),e=r.rounding}else{if(s=new r(s),e===void 0?e=r.rounding:vr(e,0,8),!t.d)return s.s?t:s;if(!s.d)return s.s&&(s.s=t.s),s}return s.d[0]?($e=!1,t=ht(t,s,0,e,1).times(s),$e=!0,Ce(t)):(s.s=t.s,t=s),t},le.toNumber=function(){return+this},le.toOctal=function(s,e){return Wa(this,8,s,e)},le.toPower=le.pow=function(s){var e,t,r,n,i,a,u=this,f=u.constructor,c=+(s=new f(s));if(!u.d||!s.d||!u.d[0]||!s.d[0])return new f(Ut(+u,c));if(u=new f(u),u.eq(1))return u;if(r=f.precision,i=f.rounding,s.eq(1))return Ce(u,r,i);if(e=tr(s.e/Be),e>=s.d.length-1&&(t=c<0?-c:c)<=I_)return n=sc(f,u,t,r),s.s<0?new f(1).div(n):Ce(n,r,i);if(a=u.s,a<0){if(e<s.d.length-1)return new f(NaN);if(s.d[e]&1||(a=1),u.e==0&&u.d[0]==1&&u.d.length==1)return u.s=a,u}return t=Ut(+u,c),e=t==0||!isFinite(t)?tr(c*(Math.log("0."+Gt(u.d))/Math.LN10+u.e+1)):new f(t+"").e,e>f.maxE+1||e<f.minE-1?new f(e>0?a/0:0):($e=!1,f.rounding=u.s=1,t=Math.min(12,(e+"").length),n=qa(s.times(Rn(u,r+t)),r),n.d&&(n=Ce(n,r+5,1),us(n.d,r,i)&&(e=r+10,n=Ce(qa(s.times(Rn(u,e+t)),e),e+5,1),+Gt(n.d).slice(r+1,r+15)+1==1e14&&(n=Ce(n,r+1,0)))),n.s=a,$e=!0,f.rounding=i,Ce(n,r,i))},le.toPrecision=function(s,e){var t,r=this,n=r.constructor;return s===void 0?t=ln(r,r.e<=n.toExpNeg||r.e>=n.toExpPos):(vr(s,1,Tn),e===void 0?e=n.rounding:vr(e,0,8),r=Ce(new n(r),s,e),t=ln(r,s<=r.e||r.e<=n.toExpNeg,s)),r.isNeg()&&!r.isZero()?"-"+t:t},le.toSignificantDigits=le.toSD=function(s,e){var t=this,r=t.constructor;return s===void 0?(s=r.precision,e=r.rounding):(vr(s,1,Tn),e===void 0?e=r.rounding:vr(e,0,8)),Ce(new r(t),s,e)},le.toString=function(){var s=this,e=s.constructor,t=ln(s,s.e<=e.toExpNeg||s.e>=e.toExpPos);return s.isNeg()&&!s.isZero()?"-"+t:t},le.truncated=le.trunc=function(){return Ce(new this.constructor(this),this.e+1,1)},le.valueOf=le.toJSON=function(){var s=this,e=s.constructor,t=ln(s,s.e<=e.toExpNeg||s.e>=e.toExpPos);return s.isNeg()?"-"+t:t};function Gt(s){var e,t,r,n=s.length-1,i="",a=s[0];if(n>0){for(i+=a,e=1;e<n;e++)r=s[e]+"",t=Be-r.length,t&&(i+=Ln(t)),i+=r;a=s[e],r=a+"",t=Be-r.length,t&&(i+=Ln(t))}else if(a===0)return"0";for(;a%10===0;)a/=10;return i+a}function vr(s,e,t){if(s!==~~s||s<e||s>t)throw Error($n+s)}function us(s,e,t,r){var n,i,a,u;for(i=s[0];i>=10;i/=10)--e;return--e<0?(e+=Be,n=0):(n=Math.ceil((e+1)/Be),e%=Be),i=Ut(10,Be-e),u=s[n]%i|0,r==null?e<3?(e==0?u=u/100|0:e==1&&(u=u/10|0),a=t<4&&u==99999||t>3&&u==49999||u==5e4||u==0):a=(t<4&&u+1==i||t>3&&u+1==i/2)&&(s[n+1]/i/100|0)==Ut(10,e-2)-1||(u==i/2||u==0)&&(s[n+1]/i/100|0)==0:e<4?(e==0?u=u/1e3|0:e==1?u=u/100|0:e==2&&(u=u/10|0),a=(r||t<4)&&u==9999||!r&&t>3&&u==4999):a=((r||t<4)&&u+1==i||!r&&t>3&&u+1==i/2)&&(s[n+1]/i/1e3|0)==Ut(10,e-3)-1,a}function Js(s,e,t){for(var r,n=[0],i,a=0,u=s.length;a<u;){for(i=n.length;i--;)n[i]*=e;for(n[0]+=Pa.indexOf(s.charAt(a++)),r=0;r<n.length;r++)n[r]>t-1&&(n[r+1]===void 0&&(n[r+1]=0),n[r+1]+=n[r]/t|0,n[r]%=t)}return n.reverse()}function $_(s,e){var t,r,n;if(e.isZero())return e;r=e.d.length,r<32?(t=Math.ceil(r/3),n=(1/ro(4,t)).toString()):(t=16,n="2.3283064365386962890625e-10"),s.precision+=t,e=Ai(s,1,e.times(n),new s(1));for(var i=t;i--;){var a=e.times(e);e=a.times(a).minus(a).times(8).plus(1)}return s.precision-=t,e}var ht=function(){function s(r,n,i){var a,u=0,f=r.length;for(r=r.slice();f--;)a=r[f]*n+u,r[f]=a%i|0,u=a/i|0;return u&&r.unshift(u),r}function e(r,n,i,a){var u,f;if(i!=a)f=i>a?1:-1;else for(u=f=0;u<i;u++)if(r[u]!=n[u]){f=r[u]>n[u]?1:-1;break}return f}function t(r,n,i,a){for(var u=0;i--;)r[i]-=u,u=r[i]<n[i]?1:0,r[i]=u*a+r[i]-n[i];for(;!r[0]&&r.length>1;)r.shift()}return function(r,n,i,a,u,f){var c,h,d,p,v,x,_,y,m,w,D,A,E,F,B,M,O,C,N,I,L=r.constructor,k=r.s==n.s?1:-1,z=r.d,R=n.d;if(!z||!z[0]||!R||!R[0])return new L(!r.s||!n.s||(z?R&&z[0]==R[0]:!R)?NaN:z&&z[0]==0||!R?k*0:k/0);for(f?(v=1,h=r.e-n.e):(f=Xr,v=Be,h=tr(r.e/v)-tr(n.e/v)),N=R.length,O=z.length,m=new L(k),w=m.d=[],d=0;R[d]==(z[d]||0);d++);if(R[d]>(z[d]||0)&&h--,i==null?(F=i=L.precision,a=L.rounding):u?F=i+(r.e-n.e)+1:F=i,F<0)w.push(1),x=!0;else{if(F=F/v+2|0,d=0,N==1){for(p=0,R=R[0],F++;(d<O||p)&&F--;d++)B=p*f+(z[d]||0),w[d]=B/R|0,p=B%R|0;x=p||d<O}else{for(p=f/(R[0]+1)|0,p>1&&(R=s(R,p,f),z=s(z,p,f),N=R.length,O=z.length),M=N,D=z.slice(0,N),A=D.length;A<N;)D[A++]=0;I=R.slice(),I.unshift(0),C=R[0],R[1]>=f/2&&++C;do p=0,c=e(R,D,N,A),c<0?(E=D[0],N!=A&&(E=E*f+(D[1]||0)),p=E/C|0,p>1?(p>=f&&(p=f-1),_=s(R,p,f),y=_.length,A=D.length,c=e(_,D,y,A),c==1&&(p--,t(_,N<y?I:R,y,f))):(p==0&&(c=p=1),_=R.slice()),y=_.length,y<A&&_.unshift(0),t(D,_,A,f),c==-1&&(A=D.length,c=e(R,D,N,A),c<1&&(p++,t(D,N<A?I:R,A,f))),A=D.length):c===0&&(p++,D=[0]),w[d++]=p,c&&D[0]?D[A++]=z[M]||0:(D=[z[M]],A=1);while((M++<O||D[0]!==void 0)&&F--);x=D[0]!==void 0}w[0]||w.shift()}if(v==1)m.e=h,Jl=x;else{for(d=1,p=w[0];p>=10;p/=10)d++;m.e=d+h*v-1,Ce(m,u?i+m.e+1:i,a,x)}return m}}();function Ce(s,e,t,r){var n,i,a,u,f,c,h,d,p,v=s.constructor;e:if(e!=null){if(d=s.d,!d)return s;for(n=1,u=d[0];u>=10;u/=10)n++;if(i=e-n,i<0)i+=Be,a=e,h=d[p=0],f=h/Ut(10,n-a-1)%10|0;else if(p=Math.ceil((i+1)/Be),u=d.length,p>=u)if(r){for(;u++<=p;)d.push(0);h=f=0,n=1,i%=Be,a=i-Be+1}else break e;else{for(h=u=d[p],n=1;u>=10;u/=10)n++;i%=Be,a=i-Be+n,f=a<0?0:h/Ut(10,n-a-1)%10|0}if(r=r||e<0||d[p+1]!==void 0||(a<0?h:h%Ut(10,n-a-1)),c=t<4?(f||r)&&(t==0||t==(s.s<0?3:2)):f>5||f==5&&(t==4||r||t==6&&(i>0?a>0?h/Ut(10,n-a):0:d[p-1])%10&1||t==(s.s<0?8:7)),e<1||!d[0])return d.length=0,c?(e-=s.e+1,d[0]=Ut(10,(Be-e%Be)%Be),s.e=-e||0):d[0]=s.e=0,s;if(i==0?(d.length=p,u=1,p--):(d.length=p+1,u=Ut(10,Be-i),d[p]=a>0?(h/Ut(10,n-a)%Ut(10,a)|0)*u:0),c)for(;;)if(p==0){for(i=1,a=d[0];a>=10;a/=10)i++;for(a=d[0]+=u,u=1;a>=10;a/=10)u++;i!=u&&(s.e++,d[0]==Xr&&(d[0]=1));break}else{if(d[p]+=u,d[p]!=Xr)break;d[p--]=0,u=1}for(i=d.length;d[--i]===0;)d.pop()}return $e&&(s.e>v.maxE?(s.d=null,s.e=NaN):s.e<v.minE&&(s.e=0,s.d=[0])),s}function ln(s,e,t){if(!s.isFinite())return uc(s);var r,n=s.e,i=Gt(s.d),a=i.length;return e?(t&&(r=t-a)>0?i=i.charAt(0)+"."+i.slice(1)+Ln(r):a>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(s.e<0?"e":"e+")+s.e):n<0?(i="0."+Ln(-n-1)+i,t&&(r=t-a)>0&&(i+=Ln(r))):n>=a?(i+=Ln(n+1-a),t&&(r=t-n-1)>0&&(i=i+"."+Ln(r))):((r=n+1)<a&&(i=i.slice(0,r)+"."+i.slice(r)),t&&(r=t-a)>0&&(n+1===a&&(i+="."),i+=Ln(r))),i}function eo(s,e){var t=s[0];for(e*=Be;t>=10;t/=10)e++;return e}function to(s,e,t){if(e>T_)throw $e=!0,t&&(s.precision=t),Error(ec);return Ce(new s(Gs),e,1,!0)}function Qr(s,e,t){if(e>za)throw Error(ec);return Ce(new s(Xs),e,t,!0)}function ic(s){var e=s.length-1,t=e*Be+1;if(e=s[e],e){for(;e%10==0;e/=10)t--;for(e=s[0];e>=10;e/=10)t++}return t}function Ln(s){for(var e="";s--;)e+="0";return e}function sc(s,e,t,r){var n,i=new s(1),a=Math.ceil(r/Be+4);for($e=!1;;){if(t%2&&(i=i.times(e),cc(i.d,a)&&(n=!0)),t=tr(t/2),t===0){t=i.d.length-1,n&&i.d[t]===0&&++i.d[t];break}e=e.times(e),cc(e.d,a)}return $e=!0,i}function oc(s){return s.d[s.d.length-1]&1}function ac(s,e,t){for(var r,n=new s(e[0]),i=0;++i<e.length;)if(r=new s(e[i]),r.s)n[t](r)&&(n=r);else{n=r;break}return n}function qa(s,e){var t,r,n,i,a,u,f,c=0,h=0,d=0,p=s.constructor,v=p.rounding,x=p.precision;if(!s.d||!s.d[0]||s.e>17)return new p(s.d?s.d[0]?s.s<0?0:1/0:1:s.s?s.s<0?0:s:NaN);for(e==null?($e=!1,f=x):f=e,u=new p(.03125);s.e>-2;)s=s.times(u),d+=5;for(r=Math.log(Ut(2,d))/Math.LN10*2+5|0,f+=r,t=i=a=new p(1),p.precision=f;;){if(i=Ce(i.times(s),f,1),t=t.times(++h),u=a.plus(ht(i,t,f,1)),Gt(u.d).slice(0,f)===Gt(a.d).slice(0,f)){for(n=d;n--;)a=Ce(a.times(a),f,1);if(e==null)if(c<3&&us(a.d,f-r,v,c))p.precision=f+=10,t=i=u=new p(1),h=0,c++;else return Ce(a,p.precision=x,v,$e=!0);else return p.precision=x,a}a=u}}function Rn(s,e){var t,r,n,i,a,u,f,c,h,d,p,v=1,x=10,_=s,y=_.d,m=_.constructor,w=m.rounding,D=m.precision;if(_.s<0||!y||!y[0]||!_.e&&y[0]==1&&y.length==1)return new m(y&&!y[0]?-1/0:_.s!=1?NaN:y?0:_);if(e==null?($e=!1,h=D):h=e,m.precision=h+=x,t=Gt(y),r=t.charAt(0),Math.abs(i=_.e)<15e14){for(;r<7&&r!=1||r==1&&t.charAt(1)>3;)_=_.times(s),t=Gt(_.d),r=t.charAt(0),v++;i=_.e,r>1?(_=new m("0."+t),i++):_=new m(r+"."+t.slice(1))}else return c=to(m,h+2,D).times(i+""),_=Rn(new m(r+"."+t.slice(1)),h-x).plus(c),m.precision=D,e==null?Ce(_,D,w,$e=!0):_;for(d=_,f=a=_=ht(_.minus(1),_.plus(1),h,1),p=Ce(_.times(_),h,1),n=3;;){if(a=Ce(a.times(p),h,1),c=f.plus(ht(a,new m(n),h,1)),Gt(c.d).slice(0,h)===Gt(f.d).slice(0,h))if(f=f.times(2),i!==0&&(f=f.plus(to(m,h+2,D).times(i+""))),f=ht(f,new m(v),h,1),e==null)if(us(f.d,h-x,w,u))m.precision=h+=x,c=a=_=ht(d.minus(1),d.plus(1),h,1),p=Ce(_.times(_),h,1),n=u=1;else return Ce(f,m.precision=D,w,$e=!0);else return m.precision=D,f;f=c,n+=2}}function uc(s){return String(s.s*s.s/0)}function Ua(s,e){var t,r,n;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(t<0&&(t=r),t+=+e.slice(r+1),e=e.substring(0,r)):t<0&&(t=e.length),r=0;e.charCodeAt(r)===48;r++);for(n=e.length;e.charCodeAt(n-1)===48;--n);if(e=e.slice(r,n),e){if(n-=r,s.e=t=t-r-1,s.d=[],r=(t+1)%Be,t<0&&(r+=Be),r<n){for(r&&s.d.push(+e.slice(0,r)),n-=Be;r<n;)s.d.push(+e.slice(r,r+=Be));e=e.slice(r),r=Be-e.length}else r-=n;for(;r--;)e+="0";s.d.push(+e),$e&&(s.e>s.constructor.maxE?(s.d=null,s.e=NaN):s.e<s.constructor.minE&&(s.e=0,s.d=[0]))}else s.e=0,s.d=[0];return s}function L_(s,e){var t,r,n,i,a,u,f,c,h;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),nc.test(e))return Ua(s,e)}else if(e==="Infinity"||e==="NaN")return+e||(s.s=NaN),s.e=NaN,s.d=null,s;if(S_.test(e))t=16,e=e.toLowerCase();else if(N_.test(e))t=2;else if(O_.test(e))t=8;else throw Error($n+e);for(i=e.search(/p/i),i>0?(f=+e.slice(i+1),e=e.substring(2,i)):e=e.slice(2),i=e.indexOf("."),a=i>=0,r=s.constructor,a&&(e=e.replace(".",""),u=e.length,i=u-i,n=sc(r,new r(t),i,i*2)),c=Js(e,t,Xr),h=c.length-1,i=h;c[i]===0;--i)c.pop();return i<0?new r(s.s*0):(s.e=eo(c,h),s.d=c,$e=!1,a&&(s=ht(s,n,u*4)),f&&(s=s.times(Math.abs(f)<54?Ut(2,f):Ci.pow(2,f))),$e=!0,s)}function R_(s,e){var t,r=e.d.length;if(r<3)return e.isZero()?e:Ai(s,2,e,e);t=1.4*Math.sqrt(r),t=t>16?16:t|0,e=e.times(1/ro(5,t)),e=Ai(s,2,e,e);for(var n,i=new s(5),a=new s(16),u=new s(20);t--;)n=e.times(e),e=e.times(i.plus(n.times(a.times(n).minus(u))));return e}function Ai(s,e,t,r,n){var i,a,u,f,c=s.precision,h=Math.ceil(c/Be);for($e=!1,f=t.times(t),u=new s(r);;){if(a=ht(u.times(f),new s(e++*e++),c,1),u=n?r.plus(a):r.minus(a),r=ht(a.times(f),new s(e++*e++),c,1),a=u.plus(r),a.d[h]!==void 0){for(i=h;a.d[i]===u.d[i]&&i--;);if(i==-1)break}i=u,u=r,r=a,a=i}return $e=!0,a.d.length=h+1,a}function ro(s,e){for(var t=s;--e;)t*=s;return t}function lc(s,e){var t,r=e.s<0,n=Qr(s,s.precision,1),i=n.times(.5);if(e=e.abs(),e.lte(i))return mn=r?4:1,e;if(t=e.divToInt(n),t.isZero())mn=r?3:2;else{if(e=e.minus(t.times(n)),e.lte(i))return mn=oc(t)?r?2:3:r?4:1,e;mn=oc(t)?r?1:4:r?3:2}return e.minus(n).abs()}function Wa(s,e,t,r){var n,i,a,u,f,c,h,d,p,v=s.constructor,x=t!==void 0;if(x?(vr(t,1,Tn),r===void 0?r=v.rounding:vr(r,0,8)):(t=v.precision,r=v.rounding),!s.isFinite())h=uc(s);else{for(h=ln(s),a=h.indexOf("."),x?(n=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):n=e,a>=0&&(h=h.replace(".",""),p=new v(1),p.e=h.length-a,p.d=Js(ln(p),10,n),p.e=p.d.length),d=Js(h,10,n),i=f=d.length;d[--f]==0;)d.pop();if(!d[0])h=x?"0p+0":"0";else{if(a<0?i--:(s=new v(s),s.d=d,s.e=i,s=ht(s,p,t,r,0,n),d=s.d,i=s.e,c=Jl),a=d[t],u=n/2,c=c||d[t+1]!==void 0,c=r<4?(a!==void 0||c)&&(r===0||r===(s.s<0?3:2)):a>u||a===u&&(r===4||c||r===6&&d[t-1]&1||r===(s.s<0?8:7)),d.length=t,c)for(;++d[--t]>n-1;)d[t]=0,t||(++i,d.unshift(1));for(f=d.length;!d[f-1];--f);for(a=0,h="";a<f;a++)h+=Pa.charAt(d[a]);if(x){if(f>1)if(e==16||e==8){for(a=e==16?4:3,--f;f%a;f++)h+="0";for(d=Js(h,n,e),f=d.length;!d[f-1];--f);for(a=1,h="1.";a<f;a++)h+=Pa.charAt(d[a])}else h=h.charAt(0)+"."+h.slice(1);h=h+(i<0?"p":"p+")+i}else if(i<0){for(;++i;)h="0"+h;h="0."+h}else if(++i>f)for(i-=f;i--;)h+="0";else i<f&&(h=h.slice(0,i)+"."+h.slice(i))}h=(e==16?"0x":e==2?"0b":e==8?"0o":"")+h}return s.s<0?"-"+h:h}function cc(s,e){if(s.length>e)return s.length=e,!0}function P_(s){return new this(s).abs()}function k_(s){return new this(s).acos()}function z_(s){return new this(s).acosh()}function q_(s,e){return new this(s).plus(e)}function U_(s){return new this(s).asin()}function W_(s){return new this(s).asinh()}function H_(s){return new this(s).atan()}function j_(s){return new this(s).atanh()}function Y_(s,e){s=new this(s),e=new this(e);var t,r=this.precision,n=this.rounding,i=r+4;return!s.s||!e.s?t=new this(NaN):!s.d&&!e.d?(t=Qr(this,i,1).times(e.s>0?.25:.75),t.s=s.s):!e.d||s.isZero()?(t=e.s<0?Qr(this,r,n):new this(0),t.s=s.s):!s.d||e.isZero()?(t=Qr(this,i,1).times(.5),t.s=s.s):e.s<0?(this.precision=i,this.rounding=1,t=this.atan(ht(s,e,i,1)),e=Qr(this,i,1),this.precision=r,this.rounding=n,t=s.s<0?t.minus(e):t.plus(e)):t=this.atan(ht(s,e,i,1)),t}function K_(s){return new this(s).cbrt()}function Z_(s){return Ce(s=new this(s),s.e+1,2)}function V_(s,e,t){return new this(s).clamp(e,t)}function G_(s){if(!s||typeof s!="object")throw Error(Qs+"Object expected");var e,t,r,n=s.defaults===!0,i=["precision",1,Tn,"rounding",0,8,"toExpNeg",-bi,0,"toExpPos",0,bi,"maxE",0,bi,"minE",-bi,0,"modulo",0,9];for(e=0;e<i.length;e+=3)if(t=i[e],n&&(this[t]=ka[t]),(r=s[t])!==void 0)if(tr(r)===r&&r>=i[e+1]&&r<=i[e+2])this[t]=r;else throw Error($n+t+": "+r);if(t="crypto",n&&(this[t]=ka[t]),(r=s[t])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(tc);else this[t]=!1;else throw Error($n+t+": "+r);return this}function X_(s){return new this(s).cos()}function Q_(s){return new this(s).cosh()}function fc(s){var e,t,r;function n(i){var a,u,f,c=this;if(!(c instanceof n))return new n(i);if(c.constructor=n,hc(i)){c.s=i.s,$e?!i.d||i.e>n.maxE?(c.e=NaN,c.d=null):i.e<n.minE?(c.e=0,c.d=[0]):(c.e=i.e,c.d=i.d.slice()):(c.e=i.e,c.d=i.d?i.d.slice():i.d);return}if(f=typeof i,f==="number"){if(i===0){c.s=1/i<0?-1:1,c.e=0,c.d=[0];return}if(i<0?(i=-i,c.s=-1):c.s=1,i===~~i&&i<1e7){for(a=0,u=i;u>=10;u/=10)a++;$e?a>n.maxE?(c.e=NaN,c.d=null):a<n.minE?(c.e=0,c.d=[0]):(c.e=a,c.d=[i]):(c.e=a,c.d=[i]);return}else if(i*0!==0){i||(c.s=NaN),c.e=NaN,c.d=null;return}return Ua(c,i.toString())}else if(f!=="string")throw Error($n+i);return(u=i.charCodeAt(0))===45?(i=i.slice(1),c.s=-1):(u===43&&(i=i.slice(1)),c.s=1),nc.test(i)?Ua(c,i):L_(c,i)}if(n.prototype=le,n.ROUND_UP=0,n.ROUND_DOWN=1,n.ROUND_CEIL=2,n.ROUND_FLOOR=3,n.ROUND_HALF_UP=4,n.ROUND_HALF_DOWN=5,n.ROUND_HALF_EVEN=6,n.ROUND_HALF_CEIL=7,n.ROUND_HALF_FLOOR=8,n.EUCLID=9,n.config=n.set=G_,n.clone=fc,n.isDecimal=hc,n.abs=P_,n.acos=k_,n.acosh=z_,n.add=q_,n.asin=U_,n.asinh=W_,n.atan=H_,n.atanh=j_,n.atan2=Y_,n.cbrt=K_,n.ceil=Z_,n.clamp=V_,n.cos=X_,n.cosh=Q_,n.div=J_,n.exp=ev,n.floor=tv,n.hypot=rv,n.ln=nv,n.log=iv,n.log10=ov,n.log2=sv,n.max=av,n.min=uv,n.mod=lv,n.mul=cv,n.pow=fv,n.random=hv,n.round=dv,n.sign=pv,n.sin=_v,n.sinh=vv,n.sqrt=gv,n.sub=mv,n.sum=xv,n.tan=yv,n.tanh=Dv,n.trunc=wv,s===void 0&&(s={}),s&&s.defaults!==!0)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<r.length;)s.hasOwnProperty(t=r[e++])||(s[t]=this[t]);return n.config(s),n}function J_(s,e){return new this(s).div(e)}function ev(s){return new this(s).exp()}function tv(s){return Ce(s=new this(s),s.e+1,3)}function rv(){var s,e,t=new this(0);for($e=!1,s=0;s<arguments.length;)if(e=new this(arguments[s++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return $e=!0,new this(1/0);t=e}return $e=!0,t.sqrt()}function hc(s){return s instanceof Ci||s&&s.toStringTag===rc||!1}function nv(s){return new this(s).ln()}function iv(s,e){return new this(s).log(e)}function sv(s){return new this(s).log(2)}function ov(s){return new this(s).log(10)}function av(){return ac(this,arguments,"lt")}function uv(){return ac(this,arguments,"gt")}function lv(s,e){return new this(s).mod(e)}function cv(s,e){return new this(s).mul(e)}function fv(s,e){return new this(s).pow(e)}function hv(s){var e,t,r,n,i=0,a=new this(1),u=[];if(s===void 0?s=this.precision:vr(s,1,Tn),r=Math.ceil(s/Be),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(r));i<r;)n=e[i],n>=429e7?e[i]=crypto.getRandomValues(new Uint32Array(1))[0]:u[i++]=n%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(r*=4);i<r;)n=e[i]+(e[i+1]<<8)+(e[i+2]<<16)+((e[i+3]&127)<<24),n>=214e7?crypto.randomBytes(4).copy(e,i):(u.push(n%1e7),i+=4);i=r/4}else throw Error(tc);else for(;i<r;)u[i++]=Math.random()*1e7|0;for(r=u[--i],s%=Be,r&&s&&(n=Ut(10,Be-s),u[i]=(r/n|0)*n);u[i]===0;i--)u.pop();if(i<0)t=0,u=[0];else{for(t=-1;u[0]===0;t-=Be)u.shift();for(r=1,n=u[0];n>=10;n/=10)r++;r<Be&&(t-=Be-r)}return a.e=t,a.d=u,a}function dv(s){return Ce(s=new this(s),s.e+1,this.rounding)}function pv(s){return s=new this(s),s.d?s.d[0]?s.s:0*s.s:s.s||NaN}function _v(s){return new this(s).sin()}function vv(s){return new this(s).sinh()}function gv(s){return new this(s).sqrt()}function mv(s,e){return new this(s).sub(e)}function xv(){var s=0,e=arguments,t=new this(e[s]);for($e=!1;t.s&&++s<e.length;)t=t.plus(e[s]);return $e=!0,Ce(t,this.precision,this.rounding)}function yv(s){return new this(s).tan()}function Dv(s){return new this(s).tanh()}function wv(s){return Ce(s=new this(s),s.e+1,1)}le[Symbol.for("nodejs.util.inspect.custom")]=le.toString,le[Symbol.toStringTag]="Decimal";var Ci=le.constructor=fc(ka);Gs=new Ci(Gs),Xs=new Ci(Xs);var Ev="BigNumber",bv=["?on","config"],Av=xe(Ev,bv,s=>{var{on:e,config:t}=s,r=Ci.clone({precision:t.precision,modulo:Ci.EUCLID});return r.prototype=Object.create(r.prototype),r.prototype.type="BigNumber",r.prototype.isBigNumber=!0,r.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},r.fromJSON=function(n){return new r(n.value)},e&&e("config",function(n,i){n.precision!==i.precision&&r.config({precision:n.precision})}),r},{isClass:!0}),dc={exports:{}};/**
40
+ */var Ei=9e15,Tn=1e9,Pa="0123456789abcdef",Gs="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Xs="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ka={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Ei,maxE:Ei,crypto:!1},Jl,mn,$e=!0,Qs="[DecimalError] ",$n=Qs+"Invalid argument: ",ec=Qs+"Precision limit exceeded",tc=Qs+"crypto unavailable",rc="[object Decimal]",tr=Math.floor,Ut=Math.pow,N_=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,S_=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,O_=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,nc=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Xr=1e7,Be=7,I_=9007199254740991,T_=Gs.length-1,za=Xs.length-1,le={toStringTag:rc};le.absoluteValue=le.abs=function(){var s=new this.constructor(this);return s.s<0&&(s.s=1),Ae(s)},le.ceil=function(){return Ae(new this.constructor(this),this.e+1,2)},le.clampedTo=le.clamp=function(s,e){var t,r=this,n=r.constructor;if(s=new n(s),e=new n(e),!s.s||!e.s)return new n(NaN);if(s.gt(e))throw Error($n+e);return t=r.cmp(s),t<0?s:r.cmp(e)>0?e:new n(r)},le.comparedTo=le.cmp=function(s){var e,t,r,n,i=this,a=i.d,u=(s=new i.constructor(s)).d,f=i.s,c=s.s;if(!a||!u)return!f||!c?NaN:f!==c?f:a===u?0:!a^f<0?1:-1;if(!a[0]||!u[0])return a[0]?f:u[0]?-c:0;if(f!==c)return f;if(i.e!==s.e)return i.e>s.e^f<0?1:-1;for(r=a.length,n=u.length,e=0,t=r<n?r:n;e<t;++e)if(a[e]!==u[e])return a[e]>u[e]^f<0?1:-1;return r===n?0:r>n^f<0?1:-1},le.cosine=le.cos=function(){var s,e,t=this,r=t.constructor;return t.d?t.d[0]?(s=r.precision,e=r.rounding,r.precision=s+Math.max(t.e,t.sd())+Be,r.rounding=1,t=$_(r,lc(r,t)),r.precision=s,r.rounding=e,Ae(mn==2||mn==3?t.neg():t,s,e,!0)):new r(1):new r(NaN)},le.cubeRoot=le.cbrt=function(){var s,e,t,r,n,i,a,u,f,c,h=this,d=h.constructor;if(!h.isFinite()||h.isZero())return new d(h);for($e=!1,i=h.s*Ut(h.s*h,1/3),!i||Math.abs(i)==1/0?(t=Gt(h.d),s=h.e,(i=(s-t.length+1)%3)&&(t+=i==1||i==-2?"0":"00"),i=Ut(t,1/3),s=tr((s+1)/3)-(s%3==(s<0?-1:2)),i==1/0?t="5e"+s:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+s),r=new d(t),r.s=h.s):r=new d(i.toString()),a=(s=d.precision)+3;;)if(u=r,f=u.times(u).times(u),c=f.plus(h),r=ht(c.plus(h).times(u),c.plus(f),a+2,1),Gt(u.d).slice(0,a)===(t=Gt(r.d)).slice(0,a))if(t=t.slice(a-3,a+1),t=="9999"||!n&&t=="4999"){if(!n&&(Ae(u,s+1,0),u.times(u).times(u).eq(h))){r=u;break}a+=4,n=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(Ae(r,s+1,1),e=!r.times(r).times(r).eq(h));break}return $e=!0,Ae(r,s,d.rounding,e)},le.decimalPlaces=le.dp=function(){var s,e=this.d,t=NaN;if(e){if(s=e.length-1,t=(s-tr(this.e/Be))*Be,s=e[s],s)for(;s%10==0;s/=10)t--;t<0&&(t=0)}return t},le.dividedBy=le.div=function(s){return ht(this,new this.constructor(s))},le.dividedToIntegerBy=le.divToInt=function(s){var e=this,t=e.constructor;return Ae(ht(e,new t(s),0,1,1),t.precision,t.rounding)},le.equals=le.eq=function(s){return this.cmp(s)===0},le.floor=function(){return Ae(new this.constructor(this),this.e+1,3)},le.greaterThan=le.gt=function(s){return this.cmp(s)>0},le.greaterThanOrEqualTo=le.gte=function(s){var e=this.cmp(s);return e==1||e===0},le.hyperbolicCosine=le.cosh=function(){var s,e,t,r,n,i=this,a=i.constructor,u=new a(1);if(!i.isFinite())return new a(i.s?1/0:NaN);if(i.isZero())return u;t=a.precision,r=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,n=i.d.length,n<32?(s=Math.ceil(n/3),e=(1/ro(4,s)).toString()):(s=16,e="2.3283064365386962890625e-10"),i=Ci(a,1,i.times(e),new a(1),!0);for(var f,c=s,h=new a(8);c--;)f=i.times(i),i=u.minus(f.times(h.minus(f.times(h))));return Ae(i,a.precision=t,a.rounding=r,!0)},le.hyperbolicSine=le.sinh=function(){var s,e,t,r,n=this,i=n.constructor;if(!n.isFinite()||n.isZero())return new i(n);if(e=i.precision,t=i.rounding,i.precision=e+Math.max(n.e,n.sd())+4,i.rounding=1,r=n.d.length,r<3)n=Ci(i,2,n,n,!0);else{s=1.4*Math.sqrt(r),s=s>16?16:s|0,n=n.times(1/ro(5,s)),n=Ci(i,2,n,n,!0);for(var a,u=new i(5),f=new i(16),c=new i(20);s--;)a=n.times(n),n=n.times(u.plus(a.times(f.times(a).plus(c))))}return i.precision=e,i.rounding=t,Ae(n,e,t,!0)},le.hyperbolicTangent=le.tanh=function(){var s,e,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(s=r.precision,e=r.rounding,r.precision=s+7,r.rounding=1,ht(t.sinh(),t.cosh(),r.precision=s,r.rounding=e)):new r(t.s)},le.inverseCosine=le.acos=function(){var s,e=this,t=e.constructor,r=e.abs().cmp(1),n=t.precision,i=t.rounding;return r!==-1?r===0?e.isNeg()?Qr(t,n,i):new t(0):new t(NaN):e.isZero()?Qr(t,n+4,i).times(.5):(t.precision=n+6,t.rounding=1,e=e.asin(),s=Qr(t,n+4,i).times(.5),t.precision=n,t.rounding=i,s.minus(e))},le.inverseHyperbolicCosine=le.acosh=function(){var s,e,t=this,r=t.constructor;return t.lte(1)?new r(t.eq(1)?0:NaN):t.isFinite()?(s=r.precision,e=r.rounding,r.precision=s+Math.max(Math.abs(t.e),t.sd())+4,r.rounding=1,$e=!1,t=t.times(t).minus(1).sqrt().plus(t),$e=!0,r.precision=s,r.rounding=e,t.ln()):new r(t)},le.inverseHyperbolicSine=le.asinh=function(){var s,e,t=this,r=t.constructor;return!t.isFinite()||t.isZero()?new r(t):(s=r.precision,e=r.rounding,r.precision=s+2*Math.max(Math.abs(t.e),t.sd())+6,r.rounding=1,$e=!1,t=t.times(t).plus(1).sqrt().plus(t),$e=!0,r.precision=s,r.rounding=e,t.ln())},le.inverseHyperbolicTangent=le.atanh=function(){var s,e,t,r,n=this,i=n.constructor;return n.isFinite()?n.e>=0?new i(n.abs().eq(1)?n.s/0:n.isZero()?n:NaN):(s=i.precision,e=i.rounding,r=n.sd(),Math.max(r,s)<2*-n.e-1?Ae(new i(n),s,e,!0):(i.precision=t=r-n.e,n=ht(n.plus(1),new i(1).minus(n),t+s,1),i.precision=s+4,i.rounding=1,n=n.ln(),i.precision=s,i.rounding=e,n.times(.5))):new i(NaN)},le.inverseSine=le.asin=function(){var s,e,t,r,n=this,i=n.constructor;return n.isZero()?new i(n):(e=n.abs().cmp(1),t=i.precision,r=i.rounding,e!==-1?e===0?(s=Qr(i,t+4,r).times(.5),s.s=n.s,s):new i(NaN):(i.precision=t+6,i.rounding=1,n=n.div(new i(1).minus(n.times(n)).sqrt().plus(1)).atan(),i.precision=t,i.rounding=r,n.times(2)))},le.inverseTangent=le.atan=function(){var s,e,t,r,n,i,a,u,f,c=this,h=c.constructor,d=h.precision,p=h.rounding;if(c.isFinite()){if(c.isZero())return new h(c);if(c.abs().eq(1)&&d+4<=za)return a=Qr(h,d+4,p).times(.25),a.s=c.s,a}else{if(!c.s)return new h(NaN);if(d+4<=za)return a=Qr(h,d+4,p).times(.5),a.s=c.s,a}for(h.precision=u=d+10,h.rounding=1,t=Math.min(28,u/Be+2|0),s=t;s;--s)c=c.div(c.times(c).plus(1).sqrt().plus(1));for($e=!1,e=Math.ceil(u/Be),r=1,f=c.times(c),a=new h(c),n=c;s!==-1;)if(n=n.times(f),i=a.minus(n.div(r+=2)),n=n.times(f),a=i.plus(n.div(r+=2)),a.d[e]!==void 0)for(s=e;a.d[s]===i.d[s]&&s--;);return t&&(a=a.times(2<<t-1)),$e=!0,Ae(a,h.precision=d,h.rounding=p,!0)},le.isFinite=function(){return!!this.d},le.isInteger=le.isInt=function(){return!!this.d&&tr(this.e/Be)>this.d.length-2},le.isNaN=function(){return!this.s},le.isNegative=le.isNeg=function(){return this.s<0},le.isPositive=le.isPos=function(){return this.s>0},le.isZero=function(){return!!this.d&&this.d[0]===0},le.lessThan=le.lt=function(s){return this.cmp(s)<0},le.lessThanOrEqualTo=le.lte=function(s){return this.cmp(s)<1},le.logarithm=le.log=function(s){var e,t,r,n,i,a,u,f,c=this,h=c.constructor,d=h.precision,p=h.rounding,v=5;if(s==null)s=new h(10),e=!0;else{if(s=new h(s),t=s.d,s.s<0||!t||!t[0]||s.eq(1))return new h(NaN);e=s.eq(10)}if(t=c.d,c.s<0||!t||!t[0]||c.eq(1))return new h(t&&!t[0]?-1/0:c.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)i=!0;else{for(n=t[0];n%10===0;)n/=10;i=n!==1}if($e=!1,u=d+v,a=Rn(c,u),r=e?to(h,u+10):Rn(s,u),f=ht(a,r,u,1),us(f.d,n=d,p))do if(u+=10,a=Rn(c,u),r=e?to(h,u+10):Rn(s,u),f=ht(a,r,u,1),!i){+Gt(f.d).slice(n+1,n+15)+1==1e14&&(f=Ae(f,d+1,0));break}while(us(f.d,n+=10,p));return $e=!0,Ae(f,d,p)},le.minus=le.sub=function(s){var e,t,r,n,i,a,u,f,c,h,d,p,v=this,x=v.constructor;if(s=new x(s),!v.d||!s.d)return!v.s||!s.s?s=new x(NaN):v.d?s.s=-s.s:s=new x(s.d||v.s!==s.s?v:NaN),s;if(v.s!=s.s)return s.s=-s.s,v.plus(s);if(c=v.d,p=s.d,u=x.precision,f=x.rounding,!c[0]||!p[0]){if(p[0])s.s=-s.s;else if(c[0])s=new x(v);else return new x(f===3?-0:0);return $e?Ae(s,u,f):s}if(t=tr(s.e/Be),h=tr(v.e/Be),c=c.slice(),i=h-t,i){for(d=i<0,d?(e=c,i=-i,a=p.length):(e=p,t=h,a=c.length),r=Math.max(Math.ceil(u/Be),a)+2,i>r&&(i=r,e.length=1),e.reverse(),r=i;r--;)e.push(0);e.reverse()}else{for(r=c.length,a=p.length,d=r<a,d&&(a=r),r=0;r<a;r++)if(c[r]!=p[r]){d=c[r]<p[r];break}i=0}for(d&&(e=c,c=p,p=e,s.s=-s.s),a=c.length,r=p.length-a;r>0;--r)c[a++]=0;for(r=p.length;r>i;){if(c[--r]<p[r]){for(n=r;n&&c[--n]===0;)c[n]=Xr-1;--c[n],c[r]+=Xr}c[r]-=p[r]}for(;c[--a]===0;)c.pop();for(;c[0]===0;c.shift())--t;return c[0]?(s.d=c,s.e=eo(c,t),$e?Ae(s,u,f):s):new x(f===3?-0:0)},le.modulo=le.mod=function(s){var e,t=this,r=t.constructor;return s=new r(s),!t.d||!s.s||s.d&&!s.d[0]?new r(NaN):!s.d||t.d&&!t.d[0]?Ae(new r(t),r.precision,r.rounding):($e=!1,r.modulo==9?(e=ht(t,s.abs(),0,3,1),e.s*=s.s):e=ht(t,s,0,r.modulo,1),e=e.times(s),$e=!0,t.minus(e))},le.naturalExponential=le.exp=function(){return qa(this)},le.naturalLogarithm=le.ln=function(){return Rn(this)},le.negated=le.neg=function(){var s=new this.constructor(this);return s.s=-s.s,Ae(s)},le.plus=le.add=function(s){var e,t,r,n,i,a,u,f,c,h,d=this,p=d.constructor;if(s=new p(s),!d.d||!s.d)return!d.s||!s.s?s=new p(NaN):d.d||(s=new p(s.d||d.s===s.s?d:NaN)),s;if(d.s!=s.s)return s.s=-s.s,d.minus(s);if(c=d.d,h=s.d,u=p.precision,f=p.rounding,!c[0]||!h[0])return h[0]||(s=new p(d)),$e?Ae(s,u,f):s;if(i=tr(d.e/Be),r=tr(s.e/Be),c=c.slice(),n=i-r,n){for(n<0?(t=c,n=-n,a=h.length):(t=h,r=i,a=c.length),i=Math.ceil(u/Be),a=i>a?i+1:a+1,n>a&&(n=a,t.length=1),t.reverse();n--;)t.push(0);t.reverse()}for(a=c.length,n=h.length,a-n<0&&(n=a,t=h,h=c,c=t),e=0;n;)e=(c[--n]=c[n]+h[n]+e)/Xr|0,c[n]%=Xr;for(e&&(c.unshift(e),++r),a=c.length;c[--a]==0;)c.pop();return s.d=c,s.e=eo(c,r),$e?Ae(s,u,f):s},le.precision=le.sd=function(s){var e,t=this;if(s!==void 0&&s!==!!s&&s!==1&&s!==0)throw Error($n+s);return t.d?(e=ic(t.d),s&&t.e+1>e&&(e=t.e+1)):e=NaN,e},le.round=function(){var s=this,e=s.constructor;return Ae(new e(s),s.e+1,e.rounding)},le.sine=le.sin=function(){var s,e,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(s=r.precision,e=r.rounding,r.precision=s+Math.max(t.e,t.sd())+Be,r.rounding=1,t=R_(r,lc(r,t)),r.precision=s,r.rounding=e,Ae(mn>2?t.neg():t,s,e,!0)):new r(NaN)},le.squareRoot=le.sqrt=function(){var s,e,t,r,n,i,a=this,u=a.d,f=a.e,c=a.s,h=a.constructor;if(c!==1||!u||!u[0])return new h(!c||c<0&&(!u||u[0])?NaN:u?a:1/0);for($e=!1,c=Math.sqrt(+a),c==0||c==1/0?(e=Gt(u),(e.length+f)%2==0&&(e+="0"),c=Math.sqrt(e),f=tr((f+1)/2)-(f<0||f%2),c==1/0?e="5e"+f:(e=c.toExponential(),e=e.slice(0,e.indexOf("e")+1)+f),r=new h(e)):r=new h(c.toString()),t=(f=h.precision)+3;;)if(i=r,r=i.plus(ht(a,i,t+2,1)).times(.5),Gt(i.d).slice(0,t)===(e=Gt(r.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!n&&e=="4999"){if(!n&&(Ae(i,f+1,0),i.times(i).eq(a))){r=i;break}t+=4,n=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(Ae(r,f+1,1),s=!r.times(r).eq(a));break}return $e=!0,Ae(r,f,h.rounding,s)},le.tangent=le.tan=function(){var s,e,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(s=r.precision,e=r.rounding,r.precision=s+10,r.rounding=1,t=t.sin(),t.s=1,t=ht(t,new r(1).minus(t.times(t)).sqrt(),s+10,0),r.precision=s,r.rounding=e,Ae(mn==2||mn==4?t.neg():t,s,e,!0)):new r(NaN)},le.times=le.mul=function(s){var e,t,r,n,i,a,u,f,c,h=this,d=h.constructor,p=h.d,v=(s=new d(s)).d;if(s.s*=h.s,!p||!p[0]||!v||!v[0])return new d(!s.s||p&&!p[0]&&!v||v&&!v[0]&&!p?NaN:!p||!v?s.s/0:s.s*0);for(t=tr(h.e/Be)+tr(s.e/Be),f=p.length,c=v.length,f<c&&(i=p,p=v,v=i,a=f,f=c,c=a),i=[],a=f+c,r=a;r--;)i.push(0);for(r=c;--r>=0;){for(e=0,n=f+r;n>r;)u=i[n]+v[r]*p[n-r-1]+e,i[n--]=u%Xr|0,e=u/Xr|0;i[n]=(i[n]+e)%Xr|0}for(;!i[--a];)i.pop();return e?++t:i.shift(),s.d=i,s.e=eo(i,t),$e?Ae(s,d.precision,d.rounding):s},le.toBinary=function(s,e){return Wa(this,2,s,e)},le.toDecimalPlaces=le.toDP=function(s,e){var t=this,r=t.constructor;return t=new r(t),s===void 0?t:(vr(s,0,Tn),e===void 0?e=r.rounding:vr(e,0,8),Ae(t,s+t.e+1,e))},le.toExponential=function(s,e){var t,r=this,n=r.constructor;return s===void 0?t=ln(r,!0):(vr(s,0,Tn),e===void 0?e=n.rounding:vr(e,0,8),r=Ae(new n(r),s+1,e),t=ln(r,!0,s+1)),r.isNeg()&&!r.isZero()?"-"+t:t},le.toFixed=function(s,e){var t,r,n=this,i=n.constructor;return s===void 0?t=ln(n):(vr(s,0,Tn),e===void 0?e=i.rounding:vr(e,0,8),r=Ae(new i(n),s+n.e+1,e),t=ln(r,!1,s+r.e+1)),n.isNeg()&&!n.isZero()?"-"+t:t},le.toFraction=function(s){var e,t,r,n,i,a,u,f,c,h,d,p,v=this,x=v.d,_=v.constructor;if(!x)return new _(v);if(c=t=new _(1),r=f=new _(0),e=new _(r),i=e.e=ic(x)-v.e-1,a=i%Be,e.d[0]=Ut(10,a<0?Be+a:a),s==null)s=i>0?e:c;else{if(u=new _(s),!u.isInt()||u.lt(c))throw Error($n+u);s=u.gt(e)?i>0?e:c:u}for($e=!1,u=new _(Gt(x)),h=_.precision,_.precision=i=x.length*Be*2;d=ht(u,e,0,1,1),n=t.plus(d.times(r)),n.cmp(s)!=1;)t=r,r=n,n=c,c=f.plus(d.times(n)),f=n,n=e,e=u.minus(d.times(n)),u=n;return n=ht(s.minus(t),r,0,1,1),f=f.plus(n.times(c)),t=t.plus(n.times(r)),f.s=c.s=v.s,p=ht(c,r,i,1).minus(v).abs().cmp(ht(f,t,i,1).minus(v).abs())<1?[c,r]:[f,t],_.precision=h,$e=!0,p},le.toHexadecimal=le.toHex=function(s,e){return Wa(this,16,s,e)},le.toNearest=function(s,e){var t=this,r=t.constructor;if(t=new r(t),s==null){if(!t.d)return t;s=new r(1),e=r.rounding}else{if(s=new r(s),e===void 0?e=r.rounding:vr(e,0,8),!t.d)return s.s?t:s;if(!s.d)return s.s&&(s.s=t.s),s}return s.d[0]?($e=!1,t=ht(t,s,0,e,1).times(s),$e=!0,Ae(t)):(s.s=t.s,t=s),t},le.toNumber=function(){return+this},le.toOctal=function(s,e){return Wa(this,8,s,e)},le.toPower=le.pow=function(s){var e,t,r,n,i,a,u=this,f=u.constructor,c=+(s=new f(s));if(!u.d||!s.d||!u.d[0]||!s.d[0])return new f(Ut(+u,c));if(u=new f(u),u.eq(1))return u;if(r=f.precision,i=f.rounding,s.eq(1))return Ae(u,r,i);if(e=tr(s.e/Be),e>=s.d.length-1&&(t=c<0?-c:c)<=I_)return n=sc(f,u,t,r),s.s<0?new f(1).div(n):Ae(n,r,i);if(a=u.s,a<0){if(e<s.d.length-1)return new f(NaN);if(s.d[e]&1||(a=1),u.e==0&&u.d[0]==1&&u.d.length==1)return u.s=a,u}return t=Ut(+u,c),e=t==0||!isFinite(t)?tr(c*(Math.log("0."+Gt(u.d))/Math.LN10+u.e+1)):new f(t+"").e,e>f.maxE+1||e<f.minE-1?new f(e>0?a/0:0):($e=!1,f.rounding=u.s=1,t=Math.min(12,(e+"").length),n=qa(s.times(Rn(u,r+t)),r),n.d&&(n=Ae(n,r+5,1),us(n.d,r,i)&&(e=r+10,n=Ae(qa(s.times(Rn(u,e+t)),e),e+5,1),+Gt(n.d).slice(r+1,r+15)+1==1e14&&(n=Ae(n,r+1,0)))),n.s=a,$e=!0,f.rounding=i,Ae(n,r,i))},le.toPrecision=function(s,e){var t,r=this,n=r.constructor;return s===void 0?t=ln(r,r.e<=n.toExpNeg||r.e>=n.toExpPos):(vr(s,1,Tn),e===void 0?e=n.rounding:vr(e,0,8),r=Ae(new n(r),s,e),t=ln(r,s<=r.e||r.e<=n.toExpNeg,s)),r.isNeg()&&!r.isZero()?"-"+t:t},le.toSignificantDigits=le.toSD=function(s,e){var t=this,r=t.constructor;return s===void 0?(s=r.precision,e=r.rounding):(vr(s,1,Tn),e===void 0?e=r.rounding:vr(e,0,8)),Ae(new r(t),s,e)},le.toString=function(){var s=this,e=s.constructor,t=ln(s,s.e<=e.toExpNeg||s.e>=e.toExpPos);return s.isNeg()&&!s.isZero()?"-"+t:t},le.truncated=le.trunc=function(){return Ae(new this.constructor(this),this.e+1,1)},le.valueOf=le.toJSON=function(){var s=this,e=s.constructor,t=ln(s,s.e<=e.toExpNeg||s.e>=e.toExpPos);return s.isNeg()?"-"+t:t};function Gt(s){var e,t,r,n=s.length-1,i="",a=s[0];if(n>0){for(i+=a,e=1;e<n;e++)r=s[e]+"",t=Be-r.length,t&&(i+=Ln(t)),i+=r;a=s[e],r=a+"",t=Be-r.length,t&&(i+=Ln(t))}else if(a===0)return"0";for(;a%10===0;)a/=10;return i+a}function vr(s,e,t){if(s!==~~s||s<e||s>t)throw Error($n+s)}function us(s,e,t,r){var n,i,a,u;for(i=s[0];i>=10;i/=10)--e;return--e<0?(e+=Be,n=0):(n=Math.ceil((e+1)/Be),e%=Be),i=Ut(10,Be-e),u=s[n]%i|0,r==null?e<3?(e==0?u=u/100|0:e==1&&(u=u/10|0),a=t<4&&u==99999||t>3&&u==49999||u==5e4||u==0):a=(t<4&&u+1==i||t>3&&u+1==i/2)&&(s[n+1]/i/100|0)==Ut(10,e-2)-1||(u==i/2||u==0)&&(s[n+1]/i/100|0)==0:e<4?(e==0?u=u/1e3|0:e==1?u=u/100|0:e==2&&(u=u/10|0),a=(r||t<4)&&u==9999||!r&&t>3&&u==4999):a=((r||t<4)&&u+1==i||!r&&t>3&&u+1==i/2)&&(s[n+1]/i/1e3|0)==Ut(10,e-3)-1,a}function Js(s,e,t){for(var r,n=[0],i,a=0,u=s.length;a<u;){for(i=n.length;i--;)n[i]*=e;for(n[0]+=Pa.indexOf(s.charAt(a++)),r=0;r<n.length;r++)n[r]>t-1&&(n[r+1]===void 0&&(n[r+1]=0),n[r+1]+=n[r]/t|0,n[r]%=t)}return n.reverse()}function $_(s,e){var t,r,n;if(e.isZero())return e;r=e.d.length,r<32?(t=Math.ceil(r/3),n=(1/ro(4,t)).toString()):(t=16,n="2.3283064365386962890625e-10"),s.precision+=t,e=Ci(s,1,e.times(n),new s(1));for(var i=t;i--;){var a=e.times(e);e=a.times(a).minus(a).times(8).plus(1)}return s.precision-=t,e}var ht=function(){function s(r,n,i){var a,u=0,f=r.length;for(r=r.slice();f--;)a=r[f]*n+u,r[f]=a%i|0,u=a/i|0;return u&&r.unshift(u),r}function e(r,n,i,a){var u,f;if(i!=a)f=i>a?1:-1;else for(u=f=0;u<i;u++)if(r[u]!=n[u]){f=r[u]>n[u]?1:-1;break}return f}function t(r,n,i,a){for(var u=0;i--;)r[i]-=u,u=r[i]<n[i]?1:0,r[i]=u*a+r[i]-n[i];for(;!r[0]&&r.length>1;)r.shift()}return function(r,n,i,a,u,f){var c,h,d,p,v,x,_,y,m,w,D,C,b,F,B,M,O,A,N,I,L=r.constructor,k=r.s==n.s?1:-1,z=r.d,R=n.d;if(!z||!z[0]||!R||!R[0])return new L(!r.s||!n.s||(z?R&&z[0]==R[0]:!R)?NaN:z&&z[0]==0||!R?k*0:k/0);for(f?(v=1,h=r.e-n.e):(f=Xr,v=Be,h=tr(r.e/v)-tr(n.e/v)),N=R.length,O=z.length,m=new L(k),w=m.d=[],d=0;R[d]==(z[d]||0);d++);if(R[d]>(z[d]||0)&&h--,i==null?(F=i=L.precision,a=L.rounding):u?F=i+(r.e-n.e)+1:F=i,F<0)w.push(1),x=!0;else{if(F=F/v+2|0,d=0,N==1){for(p=0,R=R[0],F++;(d<O||p)&&F--;d++)B=p*f+(z[d]||0),w[d]=B/R|0,p=B%R|0;x=p||d<O}else{for(p=f/(R[0]+1)|0,p>1&&(R=s(R,p,f),z=s(z,p,f),N=R.length,O=z.length),M=N,D=z.slice(0,N),C=D.length;C<N;)D[C++]=0;I=R.slice(),I.unshift(0),A=R[0],R[1]>=f/2&&++A;do p=0,c=e(R,D,N,C),c<0?(b=D[0],N!=C&&(b=b*f+(D[1]||0)),p=b/A|0,p>1?(p>=f&&(p=f-1),_=s(R,p,f),y=_.length,C=D.length,c=e(_,D,y,C),c==1&&(p--,t(_,N<y?I:R,y,f))):(p==0&&(c=p=1),_=R.slice()),y=_.length,y<C&&_.unshift(0),t(D,_,C,f),c==-1&&(C=D.length,c=e(R,D,N,C),c<1&&(p++,t(D,N<C?I:R,C,f))),C=D.length):c===0&&(p++,D=[0]),w[d++]=p,c&&D[0]?D[C++]=z[M]||0:(D=[z[M]],C=1);while((M++<O||D[0]!==void 0)&&F--);x=D[0]!==void 0}w[0]||w.shift()}if(v==1)m.e=h,Jl=x;else{for(d=1,p=w[0];p>=10;p/=10)d++;m.e=d+h*v-1,Ae(m,u?i+m.e+1:i,a,x)}return m}}();function Ae(s,e,t,r){var n,i,a,u,f,c,h,d,p,v=s.constructor;e:if(e!=null){if(d=s.d,!d)return s;for(n=1,u=d[0];u>=10;u/=10)n++;if(i=e-n,i<0)i+=Be,a=e,h=d[p=0],f=h/Ut(10,n-a-1)%10|0;else if(p=Math.ceil((i+1)/Be),u=d.length,p>=u)if(r){for(;u++<=p;)d.push(0);h=f=0,n=1,i%=Be,a=i-Be+1}else break e;else{for(h=u=d[p],n=1;u>=10;u/=10)n++;i%=Be,a=i-Be+n,f=a<0?0:h/Ut(10,n-a-1)%10|0}if(r=r||e<0||d[p+1]!==void 0||(a<0?h:h%Ut(10,n-a-1)),c=t<4?(f||r)&&(t==0||t==(s.s<0?3:2)):f>5||f==5&&(t==4||r||t==6&&(i>0?a>0?h/Ut(10,n-a):0:d[p-1])%10&1||t==(s.s<0?8:7)),e<1||!d[0])return d.length=0,c?(e-=s.e+1,d[0]=Ut(10,(Be-e%Be)%Be),s.e=-e||0):d[0]=s.e=0,s;if(i==0?(d.length=p,u=1,p--):(d.length=p+1,u=Ut(10,Be-i),d[p]=a>0?(h/Ut(10,n-a)%Ut(10,a)|0)*u:0),c)for(;;)if(p==0){for(i=1,a=d[0];a>=10;a/=10)i++;for(a=d[0]+=u,u=1;a>=10;a/=10)u++;i!=u&&(s.e++,d[0]==Xr&&(d[0]=1));break}else{if(d[p]+=u,d[p]!=Xr)break;d[p--]=0,u=1}for(i=d.length;d[--i]===0;)d.pop()}return $e&&(s.e>v.maxE?(s.d=null,s.e=NaN):s.e<v.minE&&(s.e=0,s.d=[0])),s}function ln(s,e,t){if(!s.isFinite())return uc(s);var r,n=s.e,i=Gt(s.d),a=i.length;return e?(t&&(r=t-a)>0?i=i.charAt(0)+"."+i.slice(1)+Ln(r):a>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(s.e<0?"e":"e+")+s.e):n<0?(i="0."+Ln(-n-1)+i,t&&(r=t-a)>0&&(i+=Ln(r))):n>=a?(i+=Ln(n+1-a),t&&(r=t-n-1)>0&&(i=i+"."+Ln(r))):((r=n+1)<a&&(i=i.slice(0,r)+"."+i.slice(r)),t&&(r=t-a)>0&&(n+1===a&&(i+="."),i+=Ln(r))),i}function eo(s,e){var t=s[0];for(e*=Be;t>=10;t/=10)e++;return e}function to(s,e,t){if(e>T_)throw $e=!0,t&&(s.precision=t),Error(ec);return Ae(new s(Gs),e,1,!0)}function Qr(s,e,t){if(e>za)throw Error(ec);return Ae(new s(Xs),e,t,!0)}function ic(s){var e=s.length-1,t=e*Be+1;if(e=s[e],e){for(;e%10==0;e/=10)t--;for(e=s[0];e>=10;e/=10)t++}return t}function Ln(s){for(var e="";s--;)e+="0";return e}function sc(s,e,t,r){var n,i=new s(1),a=Math.ceil(r/Be+4);for($e=!1;;){if(t%2&&(i=i.times(e),cc(i.d,a)&&(n=!0)),t=tr(t/2),t===0){t=i.d.length-1,n&&i.d[t]===0&&++i.d[t];break}e=e.times(e),cc(e.d,a)}return $e=!0,i}function oc(s){return s.d[s.d.length-1]&1}function ac(s,e,t){for(var r,n=new s(e[0]),i=0;++i<e.length;)if(r=new s(e[i]),r.s)n[t](r)&&(n=r);else{n=r;break}return n}function qa(s,e){var t,r,n,i,a,u,f,c=0,h=0,d=0,p=s.constructor,v=p.rounding,x=p.precision;if(!s.d||!s.d[0]||s.e>17)return new p(s.d?s.d[0]?s.s<0?0:1/0:1:s.s?s.s<0?0:s:NaN);for(e==null?($e=!1,f=x):f=e,u=new p(.03125);s.e>-2;)s=s.times(u),d+=5;for(r=Math.log(Ut(2,d))/Math.LN10*2+5|0,f+=r,t=i=a=new p(1),p.precision=f;;){if(i=Ae(i.times(s),f,1),t=t.times(++h),u=a.plus(ht(i,t,f,1)),Gt(u.d).slice(0,f)===Gt(a.d).slice(0,f)){for(n=d;n--;)a=Ae(a.times(a),f,1);if(e==null)if(c<3&&us(a.d,f-r,v,c))p.precision=f+=10,t=i=u=new p(1),h=0,c++;else return Ae(a,p.precision=x,v,$e=!0);else return p.precision=x,a}a=u}}function Rn(s,e){var t,r,n,i,a,u,f,c,h,d,p,v=1,x=10,_=s,y=_.d,m=_.constructor,w=m.rounding,D=m.precision;if(_.s<0||!y||!y[0]||!_.e&&y[0]==1&&y.length==1)return new m(y&&!y[0]?-1/0:_.s!=1?NaN:y?0:_);if(e==null?($e=!1,h=D):h=e,m.precision=h+=x,t=Gt(y),r=t.charAt(0),Math.abs(i=_.e)<15e14){for(;r<7&&r!=1||r==1&&t.charAt(1)>3;)_=_.times(s),t=Gt(_.d),r=t.charAt(0),v++;i=_.e,r>1?(_=new m("0."+t),i++):_=new m(r+"."+t.slice(1))}else return c=to(m,h+2,D).times(i+""),_=Rn(new m(r+"."+t.slice(1)),h-x).plus(c),m.precision=D,e==null?Ae(_,D,w,$e=!0):_;for(d=_,f=a=_=ht(_.minus(1),_.plus(1),h,1),p=Ae(_.times(_),h,1),n=3;;){if(a=Ae(a.times(p),h,1),c=f.plus(ht(a,new m(n),h,1)),Gt(c.d).slice(0,h)===Gt(f.d).slice(0,h))if(f=f.times(2),i!==0&&(f=f.plus(to(m,h+2,D).times(i+""))),f=ht(f,new m(v),h,1),e==null)if(us(f.d,h-x,w,u))m.precision=h+=x,c=a=_=ht(d.minus(1),d.plus(1),h,1),p=Ae(_.times(_),h,1),n=u=1;else return Ae(f,m.precision=D,w,$e=!0);else return m.precision=D,f;f=c,n+=2}}function uc(s){return String(s.s*s.s/0)}function Ua(s,e){var t,r,n;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(t<0&&(t=r),t+=+e.slice(r+1),e=e.substring(0,r)):t<0&&(t=e.length),r=0;e.charCodeAt(r)===48;r++);for(n=e.length;e.charCodeAt(n-1)===48;--n);if(e=e.slice(r,n),e){if(n-=r,s.e=t=t-r-1,s.d=[],r=(t+1)%Be,t<0&&(r+=Be),r<n){for(r&&s.d.push(+e.slice(0,r)),n-=Be;r<n;)s.d.push(+e.slice(r,r+=Be));e=e.slice(r),r=Be-e.length}else r-=n;for(;r--;)e+="0";s.d.push(+e),$e&&(s.e>s.constructor.maxE?(s.d=null,s.e=NaN):s.e<s.constructor.minE&&(s.e=0,s.d=[0]))}else s.e=0,s.d=[0];return s}function L_(s,e){var t,r,n,i,a,u,f,c,h;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),nc.test(e))return Ua(s,e)}else if(e==="Infinity"||e==="NaN")return+e||(s.s=NaN),s.e=NaN,s.d=null,s;if(S_.test(e))t=16,e=e.toLowerCase();else if(N_.test(e))t=2;else if(O_.test(e))t=8;else throw Error($n+e);for(i=e.search(/p/i),i>0?(f=+e.slice(i+1),e=e.substring(2,i)):e=e.slice(2),i=e.indexOf("."),a=i>=0,r=s.constructor,a&&(e=e.replace(".",""),u=e.length,i=u-i,n=sc(r,new r(t),i,i*2)),c=Js(e,t,Xr),h=c.length-1,i=h;c[i]===0;--i)c.pop();return i<0?new r(s.s*0):(s.e=eo(c,h),s.d=c,$e=!1,a&&(s=ht(s,n,u*4)),f&&(s=s.times(Math.abs(f)<54?Ut(2,f):Ai.pow(2,f))),$e=!0,s)}function R_(s,e){var t,r=e.d.length;if(r<3)return e.isZero()?e:Ci(s,2,e,e);t=1.4*Math.sqrt(r),t=t>16?16:t|0,e=e.times(1/ro(5,t)),e=Ci(s,2,e,e);for(var n,i=new s(5),a=new s(16),u=new s(20);t--;)n=e.times(e),e=e.times(i.plus(n.times(a.times(n).minus(u))));return e}function Ci(s,e,t,r,n){var i,a,u,f,c=s.precision,h=Math.ceil(c/Be);for($e=!1,f=t.times(t),u=new s(r);;){if(a=ht(u.times(f),new s(e++*e++),c,1),u=n?r.plus(a):r.minus(a),r=ht(a.times(f),new s(e++*e++),c,1),a=u.plus(r),a.d[h]!==void 0){for(i=h;a.d[i]===u.d[i]&&i--;);if(i==-1)break}i=u,u=r,r=a,a=i}return $e=!0,a.d.length=h+1,a}function ro(s,e){for(var t=s;--e;)t*=s;return t}function lc(s,e){var t,r=e.s<0,n=Qr(s,s.precision,1),i=n.times(.5);if(e=e.abs(),e.lte(i))return mn=r?4:1,e;if(t=e.divToInt(n),t.isZero())mn=r?3:2;else{if(e=e.minus(t.times(n)),e.lte(i))return mn=oc(t)?r?2:3:r?4:1,e;mn=oc(t)?r?1:4:r?3:2}return e.minus(n).abs()}function Wa(s,e,t,r){var n,i,a,u,f,c,h,d,p,v=s.constructor,x=t!==void 0;if(x?(vr(t,1,Tn),r===void 0?r=v.rounding:vr(r,0,8)):(t=v.precision,r=v.rounding),!s.isFinite())h=uc(s);else{for(h=ln(s),a=h.indexOf("."),x?(n=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):n=e,a>=0&&(h=h.replace(".",""),p=new v(1),p.e=h.length-a,p.d=Js(ln(p),10,n),p.e=p.d.length),d=Js(h,10,n),i=f=d.length;d[--f]==0;)d.pop();if(!d[0])h=x?"0p+0":"0";else{if(a<0?i--:(s=new v(s),s.d=d,s.e=i,s=ht(s,p,t,r,0,n),d=s.d,i=s.e,c=Jl),a=d[t],u=n/2,c=c||d[t+1]!==void 0,c=r<4?(a!==void 0||c)&&(r===0||r===(s.s<0?3:2)):a>u||a===u&&(r===4||c||r===6&&d[t-1]&1||r===(s.s<0?8:7)),d.length=t,c)for(;++d[--t]>n-1;)d[t]=0,t||(++i,d.unshift(1));for(f=d.length;!d[f-1];--f);for(a=0,h="";a<f;a++)h+=Pa.charAt(d[a]);if(x){if(f>1)if(e==16||e==8){for(a=e==16?4:3,--f;f%a;f++)h+="0";for(d=Js(h,n,e),f=d.length;!d[f-1];--f);for(a=1,h="1.";a<f;a++)h+=Pa.charAt(d[a])}else h=h.charAt(0)+"."+h.slice(1);h=h+(i<0?"p":"p+")+i}else if(i<0){for(;++i;)h="0"+h;h="0."+h}else if(++i>f)for(i-=f;i--;)h+="0";else i<f&&(h=h.slice(0,i)+"."+h.slice(i))}h=(e==16?"0x":e==2?"0b":e==8?"0o":"")+h}return s.s<0?"-"+h:h}function cc(s,e){if(s.length>e)return s.length=e,!0}function P_(s){return new this(s).abs()}function k_(s){return new this(s).acos()}function z_(s){return new this(s).acosh()}function q_(s,e){return new this(s).plus(e)}function U_(s){return new this(s).asin()}function W_(s){return new this(s).asinh()}function H_(s){return new this(s).atan()}function j_(s){return new this(s).atanh()}function Y_(s,e){s=new this(s),e=new this(e);var t,r=this.precision,n=this.rounding,i=r+4;return!s.s||!e.s?t=new this(NaN):!s.d&&!e.d?(t=Qr(this,i,1).times(e.s>0?.25:.75),t.s=s.s):!e.d||s.isZero()?(t=e.s<0?Qr(this,r,n):new this(0),t.s=s.s):!s.d||e.isZero()?(t=Qr(this,i,1).times(.5),t.s=s.s):e.s<0?(this.precision=i,this.rounding=1,t=this.atan(ht(s,e,i,1)),e=Qr(this,i,1),this.precision=r,this.rounding=n,t=s.s<0?t.minus(e):t.plus(e)):t=this.atan(ht(s,e,i,1)),t}function K_(s){return new this(s).cbrt()}function Z_(s){return Ae(s=new this(s),s.e+1,2)}function V_(s,e,t){return new this(s).clamp(e,t)}function G_(s){if(!s||typeof s!="object")throw Error(Qs+"Object expected");var e,t,r,n=s.defaults===!0,i=["precision",1,Tn,"rounding",0,8,"toExpNeg",-Ei,0,"toExpPos",0,Ei,"maxE",0,Ei,"minE",-Ei,0,"modulo",0,9];for(e=0;e<i.length;e+=3)if(t=i[e],n&&(this[t]=ka[t]),(r=s[t])!==void 0)if(tr(r)===r&&r>=i[e+1]&&r<=i[e+2])this[t]=r;else throw Error($n+t+": "+r);if(t="crypto",n&&(this[t]=ka[t]),(r=s[t])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(tc);else this[t]=!1;else throw Error($n+t+": "+r);return this}function X_(s){return new this(s).cos()}function Q_(s){return new this(s).cosh()}function fc(s){var e,t,r;function n(i){var a,u,f,c=this;if(!(c instanceof n))return new n(i);if(c.constructor=n,hc(i)){c.s=i.s,$e?!i.d||i.e>n.maxE?(c.e=NaN,c.d=null):i.e<n.minE?(c.e=0,c.d=[0]):(c.e=i.e,c.d=i.d.slice()):(c.e=i.e,c.d=i.d?i.d.slice():i.d);return}if(f=typeof i,f==="number"){if(i===0){c.s=1/i<0?-1:1,c.e=0,c.d=[0];return}if(i<0?(i=-i,c.s=-1):c.s=1,i===~~i&&i<1e7){for(a=0,u=i;u>=10;u/=10)a++;$e?a>n.maxE?(c.e=NaN,c.d=null):a<n.minE?(c.e=0,c.d=[0]):(c.e=a,c.d=[i]):(c.e=a,c.d=[i]);return}else if(i*0!==0){i||(c.s=NaN),c.e=NaN,c.d=null;return}return Ua(c,i.toString())}else if(f!=="string")throw Error($n+i);return(u=i.charCodeAt(0))===45?(i=i.slice(1),c.s=-1):(u===43&&(i=i.slice(1)),c.s=1),nc.test(i)?Ua(c,i):L_(c,i)}if(n.prototype=le,n.ROUND_UP=0,n.ROUND_DOWN=1,n.ROUND_CEIL=2,n.ROUND_FLOOR=3,n.ROUND_HALF_UP=4,n.ROUND_HALF_DOWN=5,n.ROUND_HALF_EVEN=6,n.ROUND_HALF_CEIL=7,n.ROUND_HALF_FLOOR=8,n.EUCLID=9,n.config=n.set=G_,n.clone=fc,n.isDecimal=hc,n.abs=P_,n.acos=k_,n.acosh=z_,n.add=q_,n.asin=U_,n.asinh=W_,n.atan=H_,n.atanh=j_,n.atan2=Y_,n.cbrt=K_,n.ceil=Z_,n.clamp=V_,n.cos=X_,n.cosh=Q_,n.div=J_,n.exp=ev,n.floor=tv,n.hypot=rv,n.ln=nv,n.log=iv,n.log10=ov,n.log2=sv,n.max=av,n.min=uv,n.mod=lv,n.mul=cv,n.pow=fv,n.random=hv,n.round=dv,n.sign=pv,n.sin=_v,n.sinh=vv,n.sqrt=gv,n.sub=mv,n.sum=xv,n.tan=yv,n.tanh=Dv,n.trunc=wv,s===void 0&&(s={}),s&&s.defaults!==!0)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<r.length;)s.hasOwnProperty(t=r[e++])||(s[t]=this[t]);return n.config(s),n}function J_(s,e){return new this(s).div(e)}function ev(s){return new this(s).exp()}function tv(s){return Ae(s=new this(s),s.e+1,3)}function rv(){var s,e,t=new this(0);for($e=!1,s=0;s<arguments.length;)if(e=new this(arguments[s++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return $e=!0,new this(1/0);t=e}return $e=!0,t.sqrt()}function hc(s){return s instanceof Ai||s&&s.toStringTag===rc||!1}function nv(s){return new this(s).ln()}function iv(s,e){return new this(s).log(e)}function sv(s){return new this(s).log(2)}function ov(s){return new this(s).log(10)}function av(){return ac(this,arguments,"lt")}function uv(){return ac(this,arguments,"gt")}function lv(s,e){return new this(s).mod(e)}function cv(s,e){return new this(s).mul(e)}function fv(s,e){return new this(s).pow(e)}function hv(s){var e,t,r,n,i=0,a=new this(1),u=[];if(s===void 0?s=this.precision:vr(s,1,Tn),r=Math.ceil(s/Be),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(r));i<r;)n=e[i],n>=429e7?e[i]=crypto.getRandomValues(new Uint32Array(1))[0]:u[i++]=n%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(r*=4);i<r;)n=e[i]+(e[i+1]<<8)+(e[i+2]<<16)+((e[i+3]&127)<<24),n>=214e7?crypto.randomBytes(4).copy(e,i):(u.push(n%1e7),i+=4);i=r/4}else throw Error(tc);else for(;i<r;)u[i++]=Math.random()*1e7|0;for(r=u[--i],s%=Be,r&&s&&(n=Ut(10,Be-s),u[i]=(r/n|0)*n);u[i]===0;i--)u.pop();if(i<0)t=0,u=[0];else{for(t=-1;u[0]===0;t-=Be)u.shift();for(r=1,n=u[0];n>=10;n/=10)r++;r<Be&&(t-=Be-r)}return a.e=t,a.d=u,a}function dv(s){return Ae(s=new this(s),s.e+1,this.rounding)}function pv(s){return s=new this(s),s.d?s.d[0]?s.s:0*s.s:s.s||NaN}function _v(s){return new this(s).sin()}function vv(s){return new this(s).sinh()}function gv(s){return new this(s).sqrt()}function mv(s,e){return new this(s).sub(e)}function xv(){var s=0,e=arguments,t=new this(e[s]);for($e=!1;t.s&&++s<e.length;)t=t.plus(e[s]);return $e=!0,Ae(t,this.precision,this.rounding)}function yv(s){return new this(s).tan()}function Dv(s){return new this(s).tanh()}function wv(s){return Ae(s=new this(s),s.e+1,1)}le[Symbol.for("nodejs.util.inspect.custom")]=le.toString,le[Symbol.toStringTag]="Decimal";var Ai=le.constructor=fc(ka);Gs=new Ai(Gs),Xs=new Ai(Xs);var bv="BigNumber",Ev=["?on","config"],Cv=xe(bv,Ev,s=>{var{on:e,config:t}=s,r=Ai.clone({precision:t.precision,modulo:Ai.EUCLID});return r.prototype=Object.create(r.prototype),r.prototype.type="BigNumber",r.prototype.isBigNumber=!0,r.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},r.fromJSON=function(n){return new r(n.value)},e&&e("config",function(n,i){n.precision!==i.precision&&r.config({precision:n.precision})}),r},{isClass:!0}),dc={exports:{}};/**
41
41
  * @license Complex.js v2.1.1 12/05/2020
42
42
  *
43
43
  * Copyright (c) 2020, Robert Eisele (robert@xarg.org)
44
44
  * Dual licensed under the MIT or GPL Version 2 licenses.
45
45
  **/(function(s,e){(function(t){var r=Math.cosh||function(d){return Math.abs(d)<1e-9?1-d:(Math.exp(d)+Math.exp(-d))*.5},n=Math.sinh||function(d){return Math.abs(d)<1e-9?d:(Math.exp(d)-Math.exp(-d))*.5},i=function(d){var p=Math.PI/4;if(-p>d||d>p)return Math.cos(d)-1;var v=d*d;return v*(v*(v*(v*(v*(v*(v*(v/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},a=function(d,p){var v=Math.abs(d),x=Math.abs(p);return v<3e3&&x<3e3?Math.sqrt(v*v+x*x):(v<x?(v=x,x=d/p):x=p/d,v*Math.sqrt(1+x*x))},u=function(){throw SyntaxError("Invalid Param")};function f(d,p){var v=Math.abs(d),x=Math.abs(p);return d===0?Math.log(x):p===0?Math.log(v):v<3e3&&x<3e3?Math.log(d*d+p*p)*.5:(d=d/2,p=p/2,.5*Math.log(d*d+p*p)+Math.LN2)}var c=function(d,p){var v={re:0,im:0};if(d==null)v.re=v.im=0;else if(p!==void 0)v.re=d,v.im=p;else switch(typeof d){case"object":if("im"in d&&"re"in d)v.re=d.re,v.im=d.im;else if("abs"in d&&"arg"in d){if(!Number.isFinite(d.abs)&&Number.isFinite(d.arg))return h.INFINITY;v.re=d.abs*Math.cos(d.arg),v.im=d.abs*Math.sin(d.arg)}else if("r"in d&&"phi"in d){if(!Number.isFinite(d.r)&&Number.isFinite(d.phi))return h.INFINITY;v.re=d.r*Math.cos(d.phi),v.im=d.r*Math.sin(d.phi)}else d.length===2?(v.re=d[0],v.im=d[1]):u();break;case"string":v.im=v.re=0;var x=d.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),_=1,y=0;x===null&&u();for(var m=0;m<x.length;m++){var w=x[m];w===" "||w===" "||w===`
46
- `||(w==="+"?_++:w==="-"?y++:w==="i"||w==="I"?(_+y===0&&u(),x[m+1]!==" "&&!isNaN(x[m+1])?(v.im+=parseFloat((y%2?"-":"")+x[m+1]),m++):v.im+=parseFloat((y%2?"-":"")+"1"),_=y=0):((_+y===0||isNaN(w))&&u(),x[m+1]==="i"||x[m+1]==="I"?(v.im+=parseFloat((y%2?"-":"")+w),m++):v.re+=parseFloat((y%2?"-":"")+w),_=y=0))}_+y>0&&u();break;case"number":v.im=0,v.re=d;break;default:u()}return isNaN(v.re)||isNaN(v.im),v};function h(d,p){if(!(this instanceof h))return new h(d,p);var v=c(d,p);this.re=v.re,this.im=v.im}h.prototype={re:0,im:0,sign:function(){var d=this.abs();return new h(this.re/d,this.im/d)},add:function(d,p){var v=new h(d,p);return this.isInfinite()&&v.isInfinite()?h.NAN:this.isInfinite()||v.isInfinite()?h.INFINITY:new h(this.re+v.re,this.im+v.im)},sub:function(d,p){var v=new h(d,p);return this.isInfinite()&&v.isInfinite()?h.NAN:this.isInfinite()||v.isInfinite()?h.INFINITY:new h(this.re-v.re,this.im-v.im)},mul:function(d,p){var v=new h(d,p);return this.isInfinite()&&v.isZero()||this.isZero()&&v.isInfinite()?h.NAN:this.isInfinite()||v.isInfinite()?h.INFINITY:v.im===0&&this.im===0?new h(this.re*v.re,0):new h(this.re*v.re-this.im*v.im,this.re*v.im+this.im*v.re)},div:function(d,p){var v=new h(d,p);if(this.isZero()&&v.isZero()||this.isInfinite()&&v.isInfinite())return h.NAN;if(this.isInfinite()||v.isZero())return h.INFINITY;if(this.isZero()||v.isInfinite())return h.ZERO;d=this.re,p=this.im;var x=v.re,_=v.im,y,m;return _===0?new h(d/x,p/x):Math.abs(x)<Math.abs(_)?(m=x/_,y=x*m+_,new h((d*m+p)/y,(p*m-d)/y)):(m=_/x,y=_*m+x,new h((d+p*m)/y,(p-d*m)/y))},pow:function(d,p){var v=new h(d,p);if(d=this.re,p=this.im,v.isZero())return h.ONE;if(v.im===0){if(p===0&&d>0)return new h(Math.pow(d,v.re),0);if(d===0)switch((v.re%4+4)%4){case 0:return new h(Math.pow(p,v.re),0);case 1:return new h(0,Math.pow(p,v.re));case 2:return new h(-Math.pow(p,v.re),0);case 3:return new h(0,-Math.pow(p,v.re))}}if(d===0&&p===0&&v.re>0&&v.im>=0)return h.ZERO;var x=Math.atan2(p,d),_=f(d,p);return d=Math.exp(v.re*_-v.im*x),p=v.im*_+v.re*x,new h(d*Math.cos(p),d*Math.sin(p))},sqrt:function(){var d=this.re,p=this.im,v=this.abs(),x,_;if(d>=0){if(p===0)return new h(Math.sqrt(d),0);x=.5*Math.sqrt(2*(v+d))}else x=Math.abs(p)/Math.sqrt(2*(v-d));return d<=0?_=.5*Math.sqrt(2*(v-d)):_=Math.abs(p)/Math.sqrt(2*(v+d)),new h(x,p<0?-_:_)},exp:function(){var d=Math.exp(this.re);return this.im,new h(d*Math.cos(this.im),d*Math.sin(this.im))},expm1:function(){var d=this.re,p=this.im;return new h(Math.expm1(d)*Math.cos(p)+i(p),Math.exp(d)*Math.sin(p))},log:function(){var d=this.re,p=this.im;return new h(f(d,p),Math.atan2(p,d))},abs:function(){return a(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var d=this.re,p=this.im;return new h(Math.sin(d)*r(p),Math.cos(d)*n(p))},cos:function(){var d=this.re,p=this.im;return new h(Math.cos(d)*r(p),-Math.sin(d)*n(p))},tan:function(){var d=2*this.re,p=2*this.im,v=Math.cos(d)+r(p);return new h(Math.sin(d)/v,n(p)/v)},cot:function(){var d=2*this.re,p=2*this.im,v=Math.cos(d)-r(p);return new h(-Math.sin(d)/v,n(p)/v)},sec:function(){var d=this.re,p=this.im,v=.5*r(2*p)+.5*Math.cos(2*d);return new h(Math.cos(d)*r(p)/v,Math.sin(d)*n(p)/v)},csc:function(){var d=this.re,p=this.im,v=.5*r(2*p)-.5*Math.cos(2*d);return new h(Math.sin(d)*r(p)/v,-Math.cos(d)*n(p)/v)},asin:function(){var d=this.re,p=this.im,v=new h(p*p-d*d+1,-2*d*p).sqrt(),x=new h(v.re-p,v.im+d).log();return new h(x.im,-x.re)},acos:function(){var d=this.re,p=this.im,v=new h(p*p-d*d+1,-2*d*p).sqrt(),x=new h(v.re-p,v.im+d).log();return new h(Math.PI/2-x.im,x.re)},atan:function(){var d=this.re,p=this.im;if(d===0){if(p===1)return new h(0,1/0);if(p===-1)return new h(0,-1/0)}var v=d*d+(1-p)*(1-p),x=new h((1-p*p-d*d)/v,-2*d/v).log();return new h(-.5*x.im,.5*x.re)},acot:function(){var d=this.re,p=this.im;if(p===0)return new h(Math.atan2(1,d),0);var v=d*d+p*p;return v!==0?new h(d/v,-p/v).atan():new h(d!==0?d/0:0,p!==0?-p/0:0).atan()},asec:function(){var d=this.re,p=this.im;if(d===0&&p===0)return new h(0,1/0);var v=d*d+p*p;return v!==0?new h(d/v,-p/v).acos():new h(d!==0?d/0:0,p!==0?-p/0:0).acos()},acsc:function(){var d=this.re,p=this.im;if(d===0&&p===0)return new h(Math.PI/2,1/0);var v=d*d+p*p;return v!==0?new h(d/v,-p/v).asin():new h(d!==0?d/0:0,p!==0?-p/0:0).asin()},sinh:function(){var d=this.re,p=this.im;return new h(n(d)*Math.cos(p),r(d)*Math.sin(p))},cosh:function(){var d=this.re,p=this.im;return new h(r(d)*Math.cos(p),n(d)*Math.sin(p))},tanh:function(){var d=2*this.re,p=2*this.im,v=r(d)+Math.cos(p);return new h(n(d)/v,Math.sin(p)/v)},coth:function(){var d=2*this.re,p=2*this.im,v=r(d)-Math.cos(p);return new h(n(d)/v,-Math.sin(p)/v)},csch:function(){var d=this.re,p=this.im,v=Math.cos(2*p)-r(2*d);return new h(-2*n(d)*Math.cos(p)/v,2*r(d)*Math.sin(p)/v)},sech:function(){var d=this.re,p=this.im,v=Math.cos(2*p)+r(2*d);return new h(2*r(d)*Math.cos(p)/v,-2*n(d)*Math.sin(p)/v)},asinh:function(){var d=this.im;this.im=-this.re,this.re=d;var p=this.asin();return this.re=-this.im,this.im=d,d=p.re,p.re=-p.im,p.im=d,p},acosh:function(){var d=this.acos();if(d.im<=0){var p=d.re;d.re=-d.im,d.im=p}else{var p=d.im;d.im=-d.re,d.re=p}return d},atanh:function(){var d=this.re,p=this.im,v=d>1&&p===0,x=1-d,_=1+d,y=x*x+p*p,m=y!==0?new h((_*x-p*p)/y,(p*x+_*p)/y):new h(d!==-1?d/0:0,p!==0?p/0:0),w=m.re;return m.re=f(m.re,m.im)/2,m.im=Math.atan2(m.im,w)/2,v&&(m.im=-m.im),m},acoth:function(){var d=this.re,p=this.im;if(d===0&&p===0)return new h(0,Math.PI/2);var v=d*d+p*p;return v!==0?new h(d/v,-p/v).atanh():new h(d!==0?d/0:0,p!==0?-p/0:0).atanh()},acsch:function(){var d=this.re,p=this.im;if(p===0)return new h(d!==0?Math.log(d+Math.sqrt(d*d+1)):1/0,0);var v=d*d+p*p;return v!==0?new h(d/v,-p/v).asinh():new h(d!==0?d/0:0,p!==0?-p/0:0).asinh()},asech:function(){var d=this.re,p=this.im;if(this.isZero())return h.INFINITY;var v=d*d+p*p;return v!==0?new h(d/v,-p/v).acosh():new h(d!==0?d/0:0,p!==0?-p/0:0).acosh()},inverse:function(){if(this.isZero())return h.INFINITY;if(this.isInfinite())return h.ZERO;var d=this.re,p=this.im,v=d*d+p*p;return new h(d/v,-p/v)},conjugate:function(){return new h(this.re,-this.im)},neg:function(){return new h(-this.re,-this.im)},ceil:function(d){return d=Math.pow(10,d||0),new h(Math.ceil(this.re*d)/d,Math.ceil(this.im*d)/d)},floor:function(d){return d=Math.pow(10,d||0),new h(Math.floor(this.re*d)/d,Math.floor(this.im*d)/d)},round:function(d){return d=Math.pow(10,d||0),new h(Math.round(this.re*d)/d,Math.round(this.im*d)/d)},equals:function(d,p){var v=new h(d,p);return Math.abs(v.re-this.re)<=h.EPSILON&&Math.abs(v.im-this.im)<=h.EPSILON},clone:function(){return new h(this.re,this.im)},toString:function(){var d=this.re,p=this.im,v="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(d)<h.EPSILON&&(d=0),Math.abs(p)<h.EPSILON&&(p=0),p===0?v+d:(d!==0?(v+=d,v+=" ",p<0?(p=-p,v+="-"):v+="+",v+=" "):p<0&&(p=-p,v+="-"),p!==1&&(v+=p),v+"i"))},toVector:function(){return[this.re,this.im]},valueOf:function(){return this.im===0?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return this.im===0&&this.re===0},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!(this.isNaN()||this.isFinite())}},h.ZERO=new h(0,0),h.ONE=new h(1,0),h.I=new h(0,1),h.PI=new h(Math.PI,0),h.E=new h(Math.E,0),h.INFINITY=new h(1/0,1/0),h.NAN=new h(NaN,NaN),h.EPSILON=1e-15,Object.defineProperty(h,"__esModule",{value:!0}),h.default=h,h.Complex=h,s.exports=h})()})(dc);var Cv=dc.exports,Xt=tt(Cv),Fv="Complex",Bv=[],Mv=xe(Fv,Bv,()=>(Object.defineProperty(Xt,"name",{value:"Complex"}),Xt.prototype.constructor=Xt,Xt.prototype.type="Complex",Xt.prototype.isComplex=!0,Xt.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Xt.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Xt.prototype.format=function(s){var e="",t=this.im,r=this.re,n=Ma(this.re,s),i=Ma(this.im,s),a=_t(s)?s:s?s.precision:null;if(a!==null){var u=Math.pow(10,-a);Math.abs(r/t)<u&&(r=0),Math.abs(t/r)<u&&(t=0)}return t===0?e=n:r===0?t===1?e="i":t===-1?e="-i":e=i+"i":t<0?t===-1?e=n+" - i":e=n+" - "+i.substring(1)+"i":t===1?e=n+" + i":e=n+" + "+i+"i",e},Xt.fromPolar=function(s){switch(arguments.length){case 1:{var e=arguments[0];if(typeof e=="object")return Xt(e);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{var t=arguments[0],r=arguments[1];if(_t(t)){if(Fl(r)&&r.hasBase("ANGLE")&&(r=r.toNumber("rad")),_t(r))return new Xt({r:t,phi:r});throw new TypeError("Phi is not a number nor an angle unit.")}else throw new TypeError("Radius r is not a number.")}default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},Xt.prototype.valueOf=Xt.prototype.toString,Xt.fromJSON=function(s){return new Xt(s)},Xt.compare=function(s,e){return s.re>e.re?1:s.re<e.re?-1:s.im>e.im?1:s.im<e.im?-1:0},Xt),{isClass:!0}),pc={exports:{}};/**
46
+ `||(w==="+"?_++:w==="-"?y++:w==="i"||w==="I"?(_+y===0&&u(),x[m+1]!==" "&&!isNaN(x[m+1])?(v.im+=parseFloat((y%2?"-":"")+x[m+1]),m++):v.im+=parseFloat((y%2?"-":"")+"1"),_=y=0):((_+y===0||isNaN(w))&&u(),x[m+1]==="i"||x[m+1]==="I"?(v.im+=parseFloat((y%2?"-":"")+w),m++):v.re+=parseFloat((y%2?"-":"")+w),_=y=0))}_+y>0&&u();break;case"number":v.im=0,v.re=d;break;default:u()}return isNaN(v.re)||isNaN(v.im),v};function h(d,p){if(!(this instanceof h))return new h(d,p);var v=c(d,p);this.re=v.re,this.im=v.im}h.prototype={re:0,im:0,sign:function(){var d=this.abs();return new h(this.re/d,this.im/d)},add:function(d,p){var v=new h(d,p);return this.isInfinite()&&v.isInfinite()?h.NAN:this.isInfinite()||v.isInfinite()?h.INFINITY:new h(this.re+v.re,this.im+v.im)},sub:function(d,p){var v=new h(d,p);return this.isInfinite()&&v.isInfinite()?h.NAN:this.isInfinite()||v.isInfinite()?h.INFINITY:new h(this.re-v.re,this.im-v.im)},mul:function(d,p){var v=new h(d,p);return this.isInfinite()&&v.isZero()||this.isZero()&&v.isInfinite()?h.NAN:this.isInfinite()||v.isInfinite()?h.INFINITY:v.im===0&&this.im===0?new h(this.re*v.re,0):new h(this.re*v.re-this.im*v.im,this.re*v.im+this.im*v.re)},div:function(d,p){var v=new h(d,p);if(this.isZero()&&v.isZero()||this.isInfinite()&&v.isInfinite())return h.NAN;if(this.isInfinite()||v.isZero())return h.INFINITY;if(this.isZero()||v.isInfinite())return h.ZERO;d=this.re,p=this.im;var x=v.re,_=v.im,y,m;return _===0?new h(d/x,p/x):Math.abs(x)<Math.abs(_)?(m=x/_,y=x*m+_,new h((d*m+p)/y,(p*m-d)/y)):(m=_/x,y=_*m+x,new h((d+p*m)/y,(p-d*m)/y))},pow:function(d,p){var v=new h(d,p);if(d=this.re,p=this.im,v.isZero())return h.ONE;if(v.im===0){if(p===0&&d>0)return new h(Math.pow(d,v.re),0);if(d===0)switch((v.re%4+4)%4){case 0:return new h(Math.pow(p,v.re),0);case 1:return new h(0,Math.pow(p,v.re));case 2:return new h(-Math.pow(p,v.re),0);case 3:return new h(0,-Math.pow(p,v.re))}}if(d===0&&p===0&&v.re>0&&v.im>=0)return h.ZERO;var x=Math.atan2(p,d),_=f(d,p);return d=Math.exp(v.re*_-v.im*x),p=v.im*_+v.re*x,new h(d*Math.cos(p),d*Math.sin(p))},sqrt:function(){var d=this.re,p=this.im,v=this.abs(),x,_;if(d>=0){if(p===0)return new h(Math.sqrt(d),0);x=.5*Math.sqrt(2*(v+d))}else x=Math.abs(p)/Math.sqrt(2*(v-d));return d<=0?_=.5*Math.sqrt(2*(v-d)):_=Math.abs(p)/Math.sqrt(2*(v+d)),new h(x,p<0?-_:_)},exp:function(){var d=Math.exp(this.re);return this.im,new h(d*Math.cos(this.im),d*Math.sin(this.im))},expm1:function(){var d=this.re,p=this.im;return new h(Math.expm1(d)*Math.cos(p)+i(p),Math.exp(d)*Math.sin(p))},log:function(){var d=this.re,p=this.im;return new h(f(d,p),Math.atan2(p,d))},abs:function(){return a(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var d=this.re,p=this.im;return new h(Math.sin(d)*r(p),Math.cos(d)*n(p))},cos:function(){var d=this.re,p=this.im;return new h(Math.cos(d)*r(p),-Math.sin(d)*n(p))},tan:function(){var d=2*this.re,p=2*this.im,v=Math.cos(d)+r(p);return new h(Math.sin(d)/v,n(p)/v)},cot:function(){var d=2*this.re,p=2*this.im,v=Math.cos(d)-r(p);return new h(-Math.sin(d)/v,n(p)/v)},sec:function(){var d=this.re,p=this.im,v=.5*r(2*p)+.5*Math.cos(2*d);return new h(Math.cos(d)*r(p)/v,Math.sin(d)*n(p)/v)},csc:function(){var d=this.re,p=this.im,v=.5*r(2*p)-.5*Math.cos(2*d);return new h(Math.sin(d)*r(p)/v,-Math.cos(d)*n(p)/v)},asin:function(){var d=this.re,p=this.im,v=new h(p*p-d*d+1,-2*d*p).sqrt(),x=new h(v.re-p,v.im+d).log();return new h(x.im,-x.re)},acos:function(){var d=this.re,p=this.im,v=new h(p*p-d*d+1,-2*d*p).sqrt(),x=new h(v.re-p,v.im+d).log();return new h(Math.PI/2-x.im,x.re)},atan:function(){var d=this.re,p=this.im;if(d===0){if(p===1)return new h(0,1/0);if(p===-1)return new h(0,-1/0)}var v=d*d+(1-p)*(1-p),x=new h((1-p*p-d*d)/v,-2*d/v).log();return new h(-.5*x.im,.5*x.re)},acot:function(){var d=this.re,p=this.im;if(p===0)return new h(Math.atan2(1,d),0);var v=d*d+p*p;return v!==0?new h(d/v,-p/v).atan():new h(d!==0?d/0:0,p!==0?-p/0:0).atan()},asec:function(){var d=this.re,p=this.im;if(d===0&&p===0)return new h(0,1/0);var v=d*d+p*p;return v!==0?new h(d/v,-p/v).acos():new h(d!==0?d/0:0,p!==0?-p/0:0).acos()},acsc:function(){var d=this.re,p=this.im;if(d===0&&p===0)return new h(Math.PI/2,1/0);var v=d*d+p*p;return v!==0?new h(d/v,-p/v).asin():new h(d!==0?d/0:0,p!==0?-p/0:0).asin()},sinh:function(){var d=this.re,p=this.im;return new h(n(d)*Math.cos(p),r(d)*Math.sin(p))},cosh:function(){var d=this.re,p=this.im;return new h(r(d)*Math.cos(p),n(d)*Math.sin(p))},tanh:function(){var d=2*this.re,p=2*this.im,v=r(d)+Math.cos(p);return new h(n(d)/v,Math.sin(p)/v)},coth:function(){var d=2*this.re,p=2*this.im,v=r(d)-Math.cos(p);return new h(n(d)/v,-Math.sin(p)/v)},csch:function(){var d=this.re,p=this.im,v=Math.cos(2*p)-r(2*d);return new h(-2*n(d)*Math.cos(p)/v,2*r(d)*Math.sin(p)/v)},sech:function(){var d=this.re,p=this.im,v=Math.cos(2*p)+r(2*d);return new h(2*r(d)*Math.cos(p)/v,-2*n(d)*Math.sin(p)/v)},asinh:function(){var d=this.im;this.im=-this.re,this.re=d;var p=this.asin();return this.re=-this.im,this.im=d,d=p.re,p.re=-p.im,p.im=d,p},acosh:function(){var d=this.acos();if(d.im<=0){var p=d.re;d.re=-d.im,d.im=p}else{var p=d.im;d.im=-d.re,d.re=p}return d},atanh:function(){var d=this.re,p=this.im,v=d>1&&p===0,x=1-d,_=1+d,y=x*x+p*p,m=y!==0?new h((_*x-p*p)/y,(p*x+_*p)/y):new h(d!==-1?d/0:0,p!==0?p/0:0),w=m.re;return m.re=f(m.re,m.im)/2,m.im=Math.atan2(m.im,w)/2,v&&(m.im=-m.im),m},acoth:function(){var d=this.re,p=this.im;if(d===0&&p===0)return new h(0,Math.PI/2);var v=d*d+p*p;return v!==0?new h(d/v,-p/v).atanh():new h(d!==0?d/0:0,p!==0?-p/0:0).atanh()},acsch:function(){var d=this.re,p=this.im;if(p===0)return new h(d!==0?Math.log(d+Math.sqrt(d*d+1)):1/0,0);var v=d*d+p*p;return v!==0?new h(d/v,-p/v).asinh():new h(d!==0?d/0:0,p!==0?-p/0:0).asinh()},asech:function(){var d=this.re,p=this.im;if(this.isZero())return h.INFINITY;var v=d*d+p*p;return v!==0?new h(d/v,-p/v).acosh():new h(d!==0?d/0:0,p!==0?-p/0:0).acosh()},inverse:function(){if(this.isZero())return h.INFINITY;if(this.isInfinite())return h.ZERO;var d=this.re,p=this.im,v=d*d+p*p;return new h(d/v,-p/v)},conjugate:function(){return new h(this.re,-this.im)},neg:function(){return new h(-this.re,-this.im)},ceil:function(d){return d=Math.pow(10,d||0),new h(Math.ceil(this.re*d)/d,Math.ceil(this.im*d)/d)},floor:function(d){return d=Math.pow(10,d||0),new h(Math.floor(this.re*d)/d,Math.floor(this.im*d)/d)},round:function(d){return d=Math.pow(10,d||0),new h(Math.round(this.re*d)/d,Math.round(this.im*d)/d)},equals:function(d,p){var v=new h(d,p);return Math.abs(v.re-this.re)<=h.EPSILON&&Math.abs(v.im-this.im)<=h.EPSILON},clone:function(){return new h(this.re,this.im)},toString:function(){var d=this.re,p=this.im,v="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(d)<h.EPSILON&&(d=0),Math.abs(p)<h.EPSILON&&(p=0),p===0?v+d:(d!==0?(v+=d,v+=" ",p<0?(p=-p,v+="-"):v+="+",v+=" "):p<0&&(p=-p,v+="-"),p!==1&&(v+=p),v+"i"))},toVector:function(){return[this.re,this.im]},valueOf:function(){return this.im===0?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return this.im===0&&this.re===0},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!(this.isNaN()||this.isFinite())}},h.ZERO=new h(0,0),h.ONE=new h(1,0),h.I=new h(0,1),h.PI=new h(Math.PI,0),h.E=new h(Math.E,0),h.INFINITY=new h(1/0,1/0),h.NAN=new h(NaN,NaN),h.EPSILON=1e-15,Object.defineProperty(h,"__esModule",{value:!0}),h.default=h,h.Complex=h,s.exports=h})()})(dc);var Av=dc.exports,Xt=tt(Av),Fv="Complex",Bv=[],Mv=xe(Fv,Bv,()=>(Object.defineProperty(Xt,"name",{value:"Complex"}),Xt.prototype.constructor=Xt,Xt.prototype.type="Complex",Xt.prototype.isComplex=!0,Xt.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Xt.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Xt.prototype.format=function(s){var e="",t=this.im,r=this.re,n=Ma(this.re,s),i=Ma(this.im,s),a=_t(s)?s:s?s.precision:null;if(a!==null){var u=Math.pow(10,-a);Math.abs(r/t)<u&&(r=0),Math.abs(t/r)<u&&(t=0)}return t===0?e=n:r===0?t===1?e="i":t===-1?e="-i":e=i+"i":t<0?t===-1?e=n+" - i":e=n+" - "+i.substring(1)+"i":t===1?e=n+" + i":e=n+" + "+i+"i",e},Xt.fromPolar=function(s){switch(arguments.length){case 1:{var e=arguments[0];if(typeof e=="object")return Xt(e);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{var t=arguments[0],r=arguments[1];if(_t(t)){if(Fl(r)&&r.hasBase("ANGLE")&&(r=r.toNumber("rad")),_t(r))return new Xt({r:t,phi:r});throw new TypeError("Phi is not a number nor an angle unit.")}else throw new TypeError("Radius r is not a number.")}default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},Xt.prototype.valueOf=Xt.prototype.toString,Xt.fromJSON=function(s){return new Xt(s)},Xt.compare=function(s,e){return s.re>e.re?1:s.re<e.re?-1:s.im>e.im?1:s.im<e.im?-1:0},Xt),{isClass:!0}),pc={exports:{}};/**
47
47
  * @license Fraction.js v4.3.0 20/08/2023
48
48
  * https://www.xarg.org/2014/03/rational-numbers-in-javascript/
49
49
  *
50
50
  * Copyright (c) 2023, Robert Eisele (robert@raw.org)
51
51
  * Dual licensed under the MIT or GPL Version 2 licenses.
52
- **/(function(s,e){(function(t){var r=2e3,n={s:1,n:0,d:1};function i(m,w){if(isNaN(m=parseInt(m,10)))throw _();return m*w}function a(m,w){if(w===0)throw x();var D=Object.create(v.prototype);D.s=m<0?-1:1,m=m<0?-m:m;var A=p(m,w);return D.n=m/A,D.d=w/A,D}function u(m){for(var w={},D=m,A=2,E=4;E<=D;){for(;D%A===0;)D/=A,w[A]=(w[A]||0)+1;E+=1+2*A++}return D!==m?D>1&&(w[D]=(w[D]||0)+1):w[m]=(w[m]||0)+1,w}var f=function(m,w){var D=0,A=1,E=1,F=0,B=0,M=0,O=1,C=1,N=0,I=1,L=1,k=1,z=1e7,R;if(m!=null)if(w!==void 0){if(D=m,A=w,E=D*A,D%1!==0||A%1!==0)throw y()}else switch(typeof m){case"object":{if("d"in m&&"n"in m)D=m.n,A=m.d,"s"in m&&(D*=m.s);else if(0 in m)D=m[0],1 in m&&(A=m[1]);else throw _();E=D*A;break}case"number":{if(m<0&&(E=m,m=-m),m%1===0)D=m;else if(m>0){for(m>=1&&(C=Math.pow(10,Math.floor(1+Math.log(m)/Math.LN10)),m/=C);I<=z&&k<=z;)if(R=(N+L)/(I+k),m===R){I+k<=z?(D=N+L,A=I+k):k>I?(D=L,A=k):(D=N,A=I);break}else m>R?(N+=L,I+=k):(L+=N,k+=I),I>z?(D=L,A=k):(D=N,A=I);D*=C}else(isNaN(m)||isNaN(w))&&(A=D=NaN);break}case"string":{if(I=m.match(/\d+|./g),I===null)throw _();if(I[N]==="-"?(E=-1,N++):I[N]==="+"&&N++,I.length===N+1?B=i(I[N++],E):I[N+1]==="."||I[N]==="."?(I[N]!=="."&&(F=i(I[N++],E)),N++,(N+1===I.length||I[N+1]==="("&&I[N+3]===")"||I[N+1]==="'"&&I[N+3]==="'")&&(B=i(I[N],E),O=Math.pow(10,I[N].length),N++),(I[N]==="("&&I[N+2]===")"||I[N]==="'"&&I[N+2]==="'")&&(M=i(I[N+1],E),C=Math.pow(10,I[N+1].length)-1,N+=3)):I[N+1]==="/"||I[N+1]===":"?(B=i(I[N],E),O=i(I[N+2],1),N+=3):I[N+3]==="/"&&I[N+1]===" "&&(F=i(I[N],E),B=i(I[N+2],E),O=i(I[N+4],1),N+=5),I.length<=N){A=O*C,E=D=M+A*F+C*B;break}}default:throw _()}if(A===0)throw x();n.s=E<0?-1:1,n.n=Math.abs(D),n.d=Math.abs(A)};function c(m,w,D){for(var A=1;w>0;m=m*m%D,w>>=1)w&1&&(A=A*m%D);return A}function h(m,w){for(;w%2===0;w/=2);for(;w%5===0;w/=5);if(w===1)return 0;for(var D=10%w,A=1;D!==1;A++)if(D=D*10%w,A>r)return 0;return A}function d(m,w,D){for(var A=1,E=c(10,D,w),F=0;F<300;F++){if(A===E)return F;A=A*10%w,E=E*10%w}return 0}function p(m,w){if(!m)return w;if(!w)return m;for(;;){if(m%=w,!m)return w;if(w%=m,!w)return m}}function v(m,w){if(f(m,w),this instanceof v)m=p(n.d,n.n),this.s=n.s,this.n=n.n/m,this.d=n.d/m;else return a(n.s*n.n,n.d)}var x=function(){return new Error("Division by Zero")},_=function(){return new Error("Invalid argument")},y=function(){return new Error("Parameters must be integer")};v.prototype={s:1,n:0,d:1,abs:function(){return a(this.n,this.d)},neg:function(){return a(-this.s*this.n,this.d)},add:function(m,w){return f(m,w),a(this.s*this.n*n.d+n.s*this.d*n.n,this.d*n.d)},sub:function(m,w){return f(m,w),a(this.s*this.n*n.d-n.s*this.d*n.n,this.d*n.d)},mul:function(m,w){return f(m,w),a(this.s*n.s*this.n*n.n,this.d*n.d)},div:function(m,w){return f(m,w),a(this.s*n.s*this.n*n.d,this.d*n.n)},clone:function(){return a(this.s*this.n,this.d)},mod:function(m,w){if(isNaN(this.n)||isNaN(this.d))return new v(NaN);if(m===void 0)return a(this.s*this.n%this.d,1);if(f(m,w),n.n===0&&this.d===0)throw x();return a(this.s*(n.d*this.n)%(n.n*this.d),n.d*this.d)},gcd:function(m,w){return f(m,w),a(p(n.n,this.n)*p(n.d,this.d),n.d*this.d)},lcm:function(m,w){return f(m,w),n.n===0&&this.n===0?a(0,1):a(n.n*this.n,p(n.n,this.n)*p(n.d,this.d))},ceil:function(m){return m=Math.pow(10,m||0),isNaN(this.n)||isNaN(this.d)?new v(NaN):a(Math.ceil(m*this.s*this.n/this.d),m)},floor:function(m){return m=Math.pow(10,m||0),isNaN(this.n)||isNaN(this.d)?new v(NaN):a(Math.floor(m*this.s*this.n/this.d),m)},round:function(m){return m=Math.pow(10,m||0),isNaN(this.n)||isNaN(this.d)?new v(NaN):a(Math.round(m*this.s*this.n/this.d),m)},inverse:function(){return a(this.s*this.d,this.n)},pow:function(m,w){if(f(m,w),n.d===1)return n.s<0?a(Math.pow(this.s*this.d,n.n),Math.pow(this.n,n.n)):a(Math.pow(this.s*this.n,n.n),Math.pow(this.d,n.n));if(this.s<0)return null;var D=u(this.n),A=u(this.d),E=1,F=1;for(var B in D)if(B!=="1"){if(B==="0"){E=0;break}if(D[B]*=n.n,D[B]%n.d===0)D[B]/=n.d;else return null;E*=Math.pow(B,D[B])}for(var B in A)if(B!=="1"){if(A[B]*=n.n,A[B]%n.d===0)A[B]/=n.d;else return null;F*=Math.pow(B,A[B])}return n.s<0?a(F,E):a(E,F)},equals:function(m,w){return f(m,w),this.s*this.n*n.d===n.s*n.n*this.d},compare:function(m,w){f(m,w);var D=this.s*this.n*n.d-n.s*n.n*this.d;return(0<D)-(D<0)},simplify:function(m){if(isNaN(this.n)||isNaN(this.d))return this;m=m||.001;for(var w=this.abs(),D=w.toContinued(),A=1;A<D.length;A++){for(var E=a(D[A-1],1),F=A-2;F>=0;F--)E=E.inverse().add(D[F]);if(Math.abs(E.sub(w).valueOf())<m)return E.mul(this.s)}return this},divisible:function(m,w){return f(m,w),!(!(n.n*this.d)||this.n*n.d%(n.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(m){var w,D="",A=this.n,E=this.d;return this.s<0&&(D+="-"),E===1?D+=A:(m&&(w=Math.floor(A/E))>0&&(D+=w,D+=" ",A%=E),D+=A,D+="/",D+=E),D},toLatex:function(m){var w,D="",A=this.n,E=this.d;return this.s<0&&(D+="-"),E===1?D+=A:(m&&(w=Math.floor(A/E))>0&&(D+=w,A%=E),D+="\\frac{",D+=A,D+="}{",D+=E,D+="}"),D},toContinued:function(){var m,w=this.n,D=this.d,A=[];if(isNaN(w)||isNaN(D))return A;do A.push(Math.floor(w/D)),m=w%D,w=D,D=m;while(w!==1);return A},toString:function(m){var w=this.n,D=this.d;if(isNaN(w)||isNaN(D))return"NaN";m=m||15;var A=h(w,D),E=d(w,D,A),F=this.s<0?"-":"";if(F+=w/D|0,w%=D,w*=10,w&&(F+="."),A){for(var B=E;B--;)F+=w/D|0,w%=D,w*=10;F+="(";for(var B=A;B--;)F+=w/D|0,w%=D,w*=10;F+=")"}else for(var B=m;w&&B--;)F+=w/D|0,w%=D,w*=10;return F}},Object.defineProperty(v,"__esModule",{value:!0}),v.default=v,v.Fraction=v,s.exports=v})()})(pc);var Nv=pc.exports,xn=tt(Nv),Sv="Fraction",Ov=[],Iv=xe(Sv,Ov,()=>(Object.defineProperty(xn,"name",{value:"Fraction"}),xn.prototype.constructor=xn,xn.prototype.type="Fraction",xn.prototype.isFraction=!0,xn.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},xn.fromJSON=function(s){return new xn(s)},xn),{isClass:!0}),Tv="Matrix",$v=[],Lv=xe(Tv,$v,()=>{function s(){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator")}return s.prototype.type="Matrix",s.prototype.isMatrix=!0,s.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},s.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},s.prototype.create=function(e,t){throw new Error("Cannot invoke create on a Matrix interface")},s.prototype.subset=function(e,t,r){throw new Error("Cannot invoke subset on a Matrix interface")},s.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},s.prototype.set=function(e,t,r){throw new Error("Cannot invoke set on a Matrix interface")},s.prototype.resize=function(e,t){throw new Error("Cannot invoke resize on a Matrix interface")},s.prototype.reshape=function(e,t){throw new Error("Cannot invoke reshape on a Matrix interface")},s.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},s.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},s.prototype.map=function(e,t){throw new Error("Cannot invoke map on a Matrix interface")},s.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},s.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},s.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},s.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},s.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},s.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},s},{isClass:!0});function _c(s){return Object.keys(s.signatures||{}).reduce(function(e,t){var r=(t.match(/,/g)||[]).length+1;return Math.max(e,r)},-1)}var Rv="DenseMatrix",Pv=["Matrix"],kv=xe(Rv,Pv,s=>{var{Matrix:e}=s;function t(h,d){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(d&&!un(d))throw new Error("Invalid datatype: "+d);if(xt(h))h.type==="DenseMatrix"?(this._data=ut(h._data),this._size=ut(h._size),this._datatype=d||h._datatype):(this._data=h.toArray(),this._size=h.size(),this._datatype=d||h._datatype);else if(h&&Ft(h.data)&&Ft(h.size))this._data=h.data,this._size=h.size,Wl(this._data,this._size),this._datatype=d||h.datatype;else if(Ft(h))this._data=c(h),this._size=Pt(this._data),Wl(this._data,this._size),this._datatype=d;else{if(h)throw new TypeError("Unsupported type of data ("+On(h)+")");this._data=[],this._size=[0],this._datatype=d}}t.prototype=new e,t.prototype.createDenseMatrix=function(h,d){return new t(h,d)},Object.defineProperty(t,"name",{value:"DenseMatrix"}),t.prototype.constructor=t,t.prototype.type="DenseMatrix",t.prototype.isDenseMatrix=!0,t.prototype.getDataType=function(){return Ks(this._data,On)},t.prototype.storage=function(){return"dense"},t.prototype.datatype=function(){return this._datatype},t.prototype.create=function(h,d){return new t(h,d)},t.prototype.subset=function(h,d,p){switch(arguments.length){case 1:return r(this,h);case 2:case 3:return i(this,h,d,p);default:throw new SyntaxError("Wrong number of arguments")}},t.prototype.get=function(h){if(!Ft(h))throw new TypeError("Array expected");if(h.length!==this._size.length)throw new rt(h.length,this._size.length);for(var d=0;d<h.length;d++)Bt(h[d],this._size[d]);for(var p=this._data,v=0,x=h.length;v<x;v++){var _=h[v];Bt(_,p.length),p=p[_]}return p},t.prototype.set=function(h,d,p){if(!Ft(h))throw new TypeError("Array expected");if(h.length<this._size.length)throw new rt(h.length,this._size.length,"<");var v,x,_,y=h.map(function(w){return w+1});f(this,y,p);var m=this._data;for(v=0,x=h.length-1;v<x;v++)_=h[v],Bt(_,m.length),m=m[_];return _=h[h.length-1],Bt(_,m.length),m[_]=d,this};function r(h,d){if(!Ca(d))throw new TypeError("Invalid index");var p=d.isScalar();if(p)return h.get(d.min());var v=d.size();if(v.length!==h._size.length)throw new rt(v.length,h._size.length);for(var x=d.min(),_=d.max(),y=0,m=h._size.length;y<m;y++)Bt(x[y],h._size[y]),Bt(_[y],h._size[y]);return new t(n(h._data,d,v.length,0),h._datatype)}function n(h,d,p,v){var x=v===p-1,_=d.dimension(v);return x?_.map(function(y){return Bt(y,h.length),h[y]}).valueOf():_.map(function(y){Bt(y,h.length);var m=h[y];return n(m,d,p,v+1)}).valueOf()}function i(h,d,p,v){if(!d||d.isIndex!==!0)throw new TypeError("Invalid index");var x=d.size(),_=d.isScalar(),y;if(xt(p)?(y=p.size(),p=p.valueOf()):y=Pt(p),_){if(y.length!==0)throw new TypeError("Scalar expected");h.set(d.min(),p,v)}else{if(!Di(y,x))try{y.length===0?p=Vl([p],x):p=Vl(p,x),y=Pt(p)}catch{}if(x.length<h._size.length)throw new rt(x.length,h._size.length,"<");if(y.length<x.length){for(var m=0,w=0;x[m]===1&&y[m]===1;)m++;for(;x[m]===1;)w++,m++;p=jl(p,x.length,w,y)}if(!Di(x,y))throw new rt(x,y,">");var D=d.max().map(function(F){return F+1});f(h,D,v);var A=x.length,E=0;a(h._data,d,p,A,E)}return h}function a(h,d,p,v,x){var _=x===v-1,y=d.dimension(x);_?y.forEach(function(m,w){Bt(m),h[m]=p[w[0]]}):y.forEach(function(m,w){Bt(m),a(h[m],d,p[w[0]],v,x+1)})}t.prototype.resize=function(h,d,p){if(!os(h))throw new TypeError("Array or Matrix expected");var v=h.valueOf().map(_=>Array.isArray(_)&&_.length===1?_[0]:_),x=p?this.clone():this;return u(x,v,d)};function u(h,d,p){if(d.length===0){for(var v=h._data;Ft(v);)v=v[0];return v}return h._size=d.slice(0),h._data=Sa(h._data,h._size,p),h}t.prototype.reshape=function(h,d){var p=d?this.clone():this;p._data=Ia(p._data,h);var v=p._size.reduce((x,_)=>x*_);return p._size=Ta(h,v),p};function f(h,d,p){for(var v=h._size.slice(0),x=!1;v.length<d.length;)v.push(0),x=!0;for(var _=0,y=d.length;_<y;_++)d[_]>v[_]&&(v[_]=d[_],x=!0);x&&u(h,v,p)}t.prototype.clone=function(){var h=new t({data:ut(this._data),size:ut(this._size),datatype:this._datatype});return h},t.prototype.size=function(){return this._size.slice(0)},t.prototype.map=function(h){var d=this,p=_c(h),v=function y(m,w){return Ft(m)?m.map(function(D,A){return y(D,w.concat(A))}):p===1?h(m):p===2?h(m,w):h(m,w,d)},x=v(this._data,[]),_=this._datatype!==void 0?Ks(x,On):void 0;return new t(x,_)},t.prototype.forEach=function(h){var d=this,p=function v(x,_){Ft(x)?x.forEach(function(y,m){v(y,_.concat(m))}):h(x,_,d)};p(this._data,[])},t.prototype[Symbol.iterator]=function*(){var h=function*d(p,v){if(Ft(p))for(var x=0;x<p.length;x++)yield*d(p[x],v.concat(x));else yield{value:p,index:v}};yield*h(this._data,[])},t.prototype.rows=function(){var h=[],d=this.size();if(d.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");var p=this._data;for(var v of p)h.push(new t([v],this._datatype));return h},t.prototype.columns=function(){var h=this,d=[],p=this.size();if(p.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var v=this._data,x=function(m){var w=v.map(D=>[D[m]]);d.push(new t(w,h._datatype))},_=0;_<p[1];_++)x(_);return d},t.prototype.toArray=function(){return ut(this._data)},t.prototype.valueOf=function(){return this._data},t.prototype.format=function(h){return ft(this._data,h)},t.prototype.toString=function(){return ft(this._data)},t.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},t.prototype.diagonal=function(h){if(h){if(Ot(h)&&(h=h.toNumber()),!_t(h)||!bt(h))throw new TypeError("The parameter k must be an integer number")}else h=0;for(var d=h>0?h:0,p=h<0?-h:0,v=this._size[0],x=this._size[1],_=Math.min(v-p,x-d),y=[],m=0;m<_;m++)y[m]=this._data[m+p][m+d];return new t({data:y,size:[_],datatype:this._datatype})},t.diagonal=function(h,d,p,v){if(!Ft(h))throw new TypeError("Array expected, size parameter");if(h.length!==2)throw new Error("Only two dimensions matrix are supported");if(h=h.map(function(B){if(Ot(B)&&(B=B.toNumber()),!_t(B)||!bt(B)||B<1)throw new Error("Size values must be positive integers");return B}),p){if(Ot(p)&&(p=p.toNumber()),!_t(p)||!bt(p))throw new TypeError("The parameter k must be an integer number")}else p=0;var x=p>0?p:0,_=p<0?-p:0,y=h[0],m=h[1],w=Math.min(y-_,m-x),D;if(Ft(d)){if(d.length!==w)throw new Error("Invalid value array length");D=function(M){return d[M]}}else if(xt(d)){var A=d.size();if(A.length!==1||A[0]!==w)throw new Error("Invalid matrix length");D=function(M){return d.get([M])}}else D=function(){return d};v||(v=Ot(D(0))?D(0).mul(0):0);var E=[];if(h.length>0){E=Sa(E,h,v);for(var F=0;F<w;F++)E[F+_][F+x]=D(F)}return new t({data:E,size:[y,m]})},t.fromJSON=function(h){return new t(h)},t.prototype.swapRows=function(h,d){if(!_t(h)||!bt(h)||!_t(d)||!bt(d))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return Bt(h,this._size[0]),Bt(d,this._size[0]),t._swapRows(h,d,this._data),this},t._swapRows=function(h,d,p){var v=p[h];p[h]=p[d],p[d]=v};function c(h){return xt(h)?c(h.valueOf()):Ft(h)?h.map(c):h}return t},{isClass:!0});function zv(s){var e=s.length,t=s[0].length,r,n,i=[];for(n=0;n<t;n++){var a=[];for(r=0;r<e;r++)a.push(s[r][n]);i.push(a)}return i}function no(s){for(var e=0;e<s.length;e++)if(os(s[e]))return!0;return!1}function ls(s,e){xt(s)&&(s=s.valueOf());for(var t=0,r=s.length;t<r;t++){var n=s[t];Array.isArray(n)?ls(n,e):e(n)}}function Jr(s,e,t){return s&&typeof s.map=="function"?s.map(function(r){return Jr(r,e)}):e(s)}function Ha(s,e,t){var r=Array.isArray(s)?Pt(s):s.size();if(e<0||e>=r.length)throw new In(e,r.length);return xt(s)?s.create(io(s.valueOf(),e,t)):io(s,e,t)}function io(s,e,t){var r,n,i,a;if(e<=0)if(Array.isArray(s[0])){for(a=zv(s),n=[],r=0;r<a.length;r++)n[r]=io(a[r],e-1,t);return n}else{for(i=s[0],r=1;r<s.length;r++)i=t(i,s[r]);return i}else{for(n=[],r=0;r<s.length;r++)n[r]=io(s[r],e-1,t);return n}}var vc="isInteger",qv=["typed"],Uv=xe(vc,qv,s=>{var{typed:e}=s;return e(vc,{number:bt,BigNumber:function(r){return r.isInt()},Fraction:function(r){return r.d===1&&isFinite(r.n)},"Array | Matrix":e.referToSelf(t=>r=>Jr(r,t))})}),gc="number",so="number, number";function mc(s){return Math.abs(s)}mc.signature=gc;function xc(s,e){return s+e}xc.signature=so;function yc(s,e){return s-e}yc.signature=so;function Dc(s,e){return s*e}Dc.signature=so;function wc(s){return-s}wc.signature=gc;function Ec(s,e){return s*s<1&&e===1/0||s*s>1&&e===-1/0?0:Math.pow(s,e)}Ec.signature=so;var bc="number";function Ac(s){return s===0}Ac.signature=bc;function Cc(s){return Number.isNaN(s)}Cc.signature=bc;var Fc="isNumeric",Wv=["typed"],Hv=xe(Fc,Wv,s=>{var{typed:e}=s;return e(Fc,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":e.referToSelf(t=>r=>Jr(r,t))})}),Bc="isZero",jv=["typed"],Yv=xe(Bc,jv,s=>{var{typed:e}=s;return e(Bc,{number:Ac,BigNumber:function(r){return r.isZero()},Complex:function(r){return r.re===0&&r.im===0},Fraction:function(r){return r.d===1&&r.n===0},Unit:e.referToSelf(t=>r=>e.find(t,r.valueType())(r.value)),"Array | Matrix":e.referToSelf(t=>r=>Jr(r,t))})}),Mc="isNaN",Kv=["typed"],Zv=xe(Mc,Kv,s=>{var{typed:e}=s;return e(Mc,{number:Cc,BigNumber:function(r){return r.isNaN()},Fraction:function(r){return!1},Complex:function(r){return r.isNaN()},Unit:function(r){return Number.isNaN(r.value)},"Array | Matrix":function(r){return Jr(r,Number.isNaN)}})});function oo(s,e,t){if(t==null)return s.eq(e);if(s.eq(e))return!0;if(s.isNaN()||e.isNaN())return!1;if(s.isFinite()&&e.isFinite()){var r=s.minus(e).abs();if(r.isZero())return!0;var n=s.constructor.max(s.abs(),e.abs());return r.lte(n.times(t))}return!1}function Vv(s,e,t){return ri(s.re,e.re,t)&&ri(s.im,e.im,t)}var ao=xe("compareUnits",["typed"],s=>{var{typed:e}=s;return{"Unit, Unit":e.referToSelf(t=>(r,n)=>{if(!r.equalBase(n))throw new Error("Cannot compare units with different base");return e.find(t,[r.valueType(),n.valueType()])(r.value,n.value)})}}),uo="equalScalar",Gv=["typed","config"],Xv=xe(uo,Gv,s=>{var{typed:e,config:t}=s,r=ao({typed:e});return e(uo,{"boolean, boolean":function(i,a){return i===a},"number, number":function(i,a){return ri(i,a,t.epsilon)},"BigNumber, BigNumber":function(i,a){return i.eq(a)||oo(i,a,t.epsilon)},"Fraction, Fraction":function(i,a){return i.equals(a)},"Complex, Complex":function(i,a){return Vv(i,a,t.epsilon)}},r)});xe(uo,["typed","config"],s=>{var{typed:e,config:t}=s;return e(uo,{"number, number":function(n,i){return ri(n,i,t.epsilon)}})});var Qv="SparseMatrix",Jv=["typed","equalScalar","Matrix"],eg=xe(Qv,Jv,s=>{var{typed:e,equalScalar:t,Matrix:r}=s;function n(_,y){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(y&&!un(y))throw new Error("Invalid datatype: "+y);if(xt(_))i(this,_,y);else if(_&&Ft(_.index)&&Ft(_.ptr)&&Ft(_.size))this._values=_.values,this._index=_.index,this._ptr=_.ptr,this._size=_.size,this._datatype=y||_.datatype;else if(Ft(_))a(this,_,y);else{if(_)throw new TypeError("Unsupported type of data ("+On(_)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=y}}function i(_,y,m){y.type==="SparseMatrix"?(_._values=y._values?ut(y._values):void 0,_._index=ut(y._index),_._ptr=ut(y._ptr),_._size=ut(y._size),_._datatype=m||y._datatype):a(_,y.valueOf(),m||y._datatype)}function a(_,y,m){_._values=[],_._index=[],_._ptr=[],_._datatype=m;var w=y.length,D=0,A=t,E=0;if(un(m)&&(A=e.find(t,[m,m])||t,E=e.convert(0,m)),w>0){var F=0;do{_._ptr.push(_._index.length);for(var B=0;B<w;B++){var M=y[B];if(Ft(M)){if(F===0&&D<M.length&&(D=M.length),F<M.length){var O=M[F];A(O,E)||(_._values.push(O),_._index.push(B))}}else F===0&&D<1&&(D=1),A(M,E)||(_._values.push(M),_._index.push(B))}F++}while(F<D)}_._ptr.push(_._index.length),_._size=[w,D]}n.prototype=new r,n.prototype.createSparseMatrix=function(_,y){return new n(_,y)},Object.defineProperty(n,"name",{value:"SparseMatrix"}),n.prototype.constructor=n,n.prototype.type="SparseMatrix",n.prototype.isSparseMatrix=!0,n.prototype.getDataType=function(){return Ks(this._values,On)},n.prototype.storage=function(){return"sparse"},n.prototype.datatype=function(){return this._datatype},n.prototype.create=function(_,y){return new n(_,y)},n.prototype.density=function(){var _=this._size[0],y=this._size[1];return _!==0&&y!==0?this._index.length/(_*y):0},n.prototype.subset=function(_,y,m){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return u(this,_);case 2:case 3:return f(this,_,y,m);default:throw new SyntaxError("Wrong number of arguments")}};function u(_,y){if(!Ca(y))throw new TypeError("Invalid index");var m=y.isScalar();if(m)return _.get(y.min());var w=y.size();if(w.length!==_._size.length)throw new rt(w.length,_._size.length);var D,A,E,F,B=y.min(),M=y.max();for(D=0,A=_._size.length;D<A;D++)Bt(B[D],_._size[D]),Bt(M[D],_._size[D]);var O=_._values,C=_._index,N=_._ptr,I=y.dimension(0),L=y.dimension(1),k=[],z=[];I.forEach(function(ee,te){z[ee]=te[0],k[ee]=!0});var R=O?[]:void 0,V=[],H=[];return L.forEach(function(ee){for(H.push(V.length),E=N[ee],F=N[ee+1];E<F;E++)D=C[E],k[D]===!0&&(V.push(z[D]),R&&R.push(O[E]))}),H.push(V.length),new n({values:R,index:V,ptr:H,size:w,datatype:_._datatype})}function f(_,y,m,w){if(!y||y.isIndex!==!0)throw new TypeError("Invalid index");var D=y.size(),A=y.isScalar(),E;if(xt(m)?(E=m.size(),m=m.toArray()):E=Pt(m),A){if(E.length!==0)throw new TypeError("Scalar expected");_.set(y.min(),m,w)}else{if(D.length!==1&&D.length!==2)throw new rt(D.length,_._size.length,"<");if(E.length<D.length){for(var F=0,B=0;D[F]===1&&E[F]===1;)F++;for(;D[F]===1;)B++,F++;m=jl(m,D.length,B,E)}if(!Di(D,E))throw new rt(D,E,">");if(D.length===1){var M=y.dimension(0);M.forEach(function(N,I){Bt(N),_.set([N,0],m[I[0]],w)})}else{var O=y.dimension(0),C=y.dimension(1);O.forEach(function(N,I){Bt(N),C.forEach(function(L,k){Bt(L),_.set([N,L],m[I[0]][k[0]],w)})})}}return _}n.prototype.get=function(_){if(!Ft(_))throw new TypeError("Array expected");if(_.length!==this._size.length)throw new rt(_.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var y=_[0],m=_[1];Bt(y,this._size[0]),Bt(m,this._size[1]);var w=c(y,this._ptr[m],this._ptr[m+1],this._index);return w<this._ptr[m+1]&&this._index[w]===y?this._values[w]:0},n.prototype.set=function(_,y,m){if(!Ft(_))throw new TypeError("Array expected");if(_.length!==this._size.length)throw new rt(_.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var w=_[0],D=_[1],A=this._size[0],E=this._size[1],F=t,B=0;un(this._datatype)&&(F=e.find(t,[this._datatype,this._datatype])||t,B=e.convert(0,this._datatype)),(w>A-1||D>E-1)&&(p(this,Math.max(w+1,A),Math.max(D+1,E),m),A=this._size[0],E=this._size[1]),Bt(w,A),Bt(D,E);var M=c(w,this._ptr[D],this._ptr[D+1],this._index);return M<this._ptr[D+1]&&this._index[M]===w?F(y,B)?h(M,D,this._values,this._index,this._ptr):this._values[M]=y:F(y,B)||d(M,w,D,y,this._values,this._index,this._ptr),this};function c(_,y,m,w){if(m-y===0)return m;for(var D=y;D<m;D++)if(w[D]===_)return D;return y}function h(_,y,m,w,D){m.splice(_,1),w.splice(_,1);for(var A=y+1;A<D.length;A++)D[A]--}function d(_,y,m,w,D,A,E){D.splice(_,0,w),A.splice(_,0,y);for(var F=m+1;F<E.length;F++)E[F]++}n.prototype.resize=function(_,y,m){if(!os(_))throw new TypeError("Array or Matrix expected");var w=_.valueOf().map(A=>Array.isArray(A)&&A.length===1?A[0]:A);if(w.length!==2)throw new Error("Only two dimensions matrix are supported");w.forEach(function(A){if(!_t(A)||!bt(A)||A<0)throw new TypeError("Invalid size, must contain positive integers (size: "+ft(w)+")")});var D=m?this.clone():this;return p(D,w[0],w[1],y)};function p(_,y,m,w){var D=w||0,A=t,E=0;un(_._datatype)&&(A=e.find(t,[_._datatype,_._datatype])||t,E=e.convert(0,_._datatype),D=e.convert(D,_._datatype));var F=!A(D,E),B=_._size[0],M=_._size[1],O,C,N;if(m>M){for(C=M;C<m;C++)if(_._ptr[C]=_._values.length,F)for(O=0;O<B;O++)_._values.push(D),_._index.push(O);_._ptr[m]=_._values.length}else m<M&&(_._ptr.splice(m+1,M-m),_._values.splice(_._ptr[m],_._values.length),_._index.splice(_._ptr[m],_._index.length));if(M=m,y>B){if(F){var I=0;for(C=0;C<M;C++){_._ptr[C]=_._ptr[C]+I,N=_._ptr[C+1]+I;var L=0;for(O=B;O<y;O++,L++)_._values.splice(N+L,0,D),_._index.splice(N+L,0,O),I++}_._ptr[M]=_._values.length}}else if(y<B){var k=0;for(C=0;C<M;C++){_._ptr[C]=_._ptr[C]-k;var z=_._ptr[C],R=_._ptr[C+1]-k;for(N=z;N<R;N++)O=_._index[N],O>y-1&&(_._values.splice(N,1),_._index.splice(N,1),k++)}_._ptr[C]=_._values.length}return _._size[0]=y,_._size[1]=m,_}n.prototype.reshape=function(_,y){if(!Ft(_))throw new TypeError("Array expected");if(_.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");_.forEach(function(ee){if(!_t(ee)||!bt(ee)||ee<=-2||ee===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+ft(_)+")")});var m=this._size[0]*this._size[1];_=Ta(_,m);var w=_[0]*_[1];if(m!==w)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var D=y?this.clone():this;if(this._size[0]===_[0]&&this._size[1]===_[1])return D;for(var A=[],E=0;E<D._ptr.length;E++)for(var F=0;F<D._ptr[E+1]-D._ptr[E];F++)A.push(E);for(var B=D._values.slice(),M=D._index.slice(),O=0;O<D._index.length;O++){var C=M[O],N=A[O],I=C*D._size[1]+N;A[O]=I%_[1],M[O]=Math.floor(I/_[1])}D._values.length=0,D._index.length=0,D._ptr.length=_[1]+1,D._size=_.slice();for(var L=0;L<D._ptr.length;L++)D._ptr[L]=0;for(var k=0;k<B.length;k++){var z=M[k],R=A[k],V=B[k],H=c(z,D._ptr[R],D._ptr[R+1],D._index);d(H,z,R,V,D._values,D._index,D._ptr)}return D},n.prototype.clone=function(){var _=new n({values:this._values?ut(this._values):void 0,index:ut(this._index),ptr:ut(this._ptr),size:ut(this._size),datatype:this._datatype});return _},n.prototype.size=function(){return this._size.slice(0)},n.prototype.map=function(_,y){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var m=this,w=this._size[0],D=this._size[1],A=_c(_),E=function(B,M,O){return A===1?_(B):A===2?_(B,[M,O]):_(B,[M,O],m)};return v(this,0,w-1,0,D-1,E,y)};function v(_,y,m,w,D,A,E){var F=[],B=[],M=[],O=t,C=0;un(_._datatype)&&(O=e.find(t,[_._datatype,_._datatype])||t,C=e.convert(0,_._datatype));for(var N=function(Y,Q,pe){Y=A(Y,Q,pe),O(Y,C)||(F.push(Y),B.push(Q))},I=w;I<=D;I++){M.push(F.length);var L=_._ptr[I],k=_._ptr[I+1];if(E)for(var z=L;z<k;z++){var R=_._index[z];R>=y&&R<=m&&N(_._values[z],R-y,I-w)}else{for(var V={},H=L;H<k;H++){var ee=_._index[H];V[ee]=_._values[H]}for(var te=y;te<=m;te++){var j=te in V?V[te]:0;N(j,te-y,I-w)}}}return M.push(F.length),new n({values:F,index:B,ptr:M,size:[m-y+1,D-w+1]})}n.prototype.forEach=function(_,y){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var m=this,w=this._size[0],D=this._size[1],A=0;A<D;A++){var E=this._ptr[A],F=this._ptr[A+1];if(y)for(var B=E;B<F;B++){var M=this._index[B];_(this._values[B],[M,A],m)}else{for(var O={},C=E;C<F;C++){var N=this._index[C];O[N]=this._values[C]}for(var I=0;I<w;I++){var L=I in O?O[I]:0;_(L,[I,A],m)}}}},n.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var _=this._size[1],y=0;y<_;y++)for(var m=this._ptr[y],w=this._ptr[y+1],D=m;D<w;D++){var A=this._index[D];yield{value:this._values[D],index:[A,y]}}},n.prototype.toArray=function(){return x(this._values,this._index,this._ptr,this._size,!0)},n.prototype.valueOf=function(){return x(this._values,this._index,this._ptr,this._size,!1)};function x(_,y,m,w,D){var A=w[0],E=w[1],F=[],B,M;for(B=0;B<A;B++)for(F[B]=[],M=0;M<E;M++)F[B][M]=0;for(M=0;M<E;M++)for(var O=m[M],C=m[M+1],N=O;N<C;N++)B=y[N],F[B][M]=_?D?ut(_[N]):_[N]:1;return F}return n.prototype.format=function(_){for(var y=this._size[0],m=this._size[1],w=this.density(),D="Sparse Matrix ["+ft(y,_)+" x "+ft(m,_)+"] density: "+ft(w,_)+`
53
- `,A=0;A<m;A++)for(var E=this._ptr[A],F=this._ptr[A+1],B=E;B<F;B++){var M=this._index[B];D+=`
54
- (`+ft(M,_)+", "+ft(A,_)+") ==> "+(this._values?ft(this._values[B],_):"X")}return D},n.prototype.toString=function(){return ft(this.toArray())},n.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},n.prototype.diagonal=function(_){if(_){if(Ot(_)&&(_=_.toNumber()),!_t(_)||!bt(_))throw new TypeError("The parameter k must be an integer number")}else _=0;var y=_>0?_:0,m=_<0?-_:0,w=this._size[0],D=this._size[1],A=Math.min(w-m,D-y),E=[],F=[],B=[];B[0]=0;for(var M=y;M<D&&E.length<A;M++)for(var O=this._ptr[M],C=this._ptr[M+1],N=O;N<C;N++){var I=this._index[N];if(I===M-y+m){E.push(this._values[N]),F[E.length-1]=I-m;break}}return B.push(E.length),new n({values:E,index:F,ptr:B,size:[A,1]})},n.fromJSON=function(_){return new n(_)},n.diagonal=function(_,y,m,w,D){if(!Ft(_))throw new TypeError("Array expected, size parameter");if(_.length!==2)throw new Error("Only two dimensions matrix are supported");if(_=_.map(function(ee){if(Ot(ee)&&(ee=ee.toNumber()),!_t(ee)||!bt(ee)||ee<1)throw new Error("Size values must be positive integers");return ee}),m){if(Ot(m)&&(m=m.toNumber()),!_t(m)||!bt(m))throw new TypeError("The parameter k must be an integer number")}else m=0;var A=t,E=0;un(D)&&(A=e.find(t,[D,D])||t,E=e.convert(0,D));var F=m>0?m:0,B=m<0?-m:0,M=_[0],O=_[1],C=Math.min(M-B,O-F),N;if(Ft(y)){if(y.length!==C)throw new Error("Invalid value array length");N=function(te){return y[te]}}else if(xt(y)){var I=y.size();if(I.length!==1||I[0]!==C)throw new Error("Invalid matrix length");N=function(te){return y.get([te])}}else N=function(){return y};for(var L=[],k=[],z=[],R=0;R<O;R++){z.push(L.length);var V=R-F;if(V>=0&&V<C){var H=N(V);A(H,E)||(k.push(V+B),L.push(H))}}return z.push(L.length),new n({values:L,index:k,ptr:z,size:[M,O]})},n.prototype.swapRows=function(_,y){if(!_t(_)||!bt(_)||!_t(y)||!bt(y))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return Bt(_,this._size[0]),Bt(y,this._size[0]),n._swapRows(_,y,this._size[1],this._values,this._index,this._ptr),this},n._forEachRow=function(_,y,m,w,D){for(var A=w[_],E=w[_+1],F=A;F<E;F++)D(m[F],y[F])},n._swapRows=function(_,y,m,w,D,A){for(var E=0;E<m;E++){var F=A[E],B=A[E+1],M=c(_,F,B,D),O=c(y,F,B,D);if(M<B&&O<B&&D[M]===_&&D[O]===y){if(w){var C=w[M];w[M]=w[O],w[O]=C}continue}if(M<B&&D[M]===_&&(O>=B||D[O]!==y)){var N=w?w[M]:void 0;D.splice(O,0,y),w&&w.splice(O,0,N),D.splice(O<=M?M+1:M,1),w&&w.splice(O<=M?M+1:M,1);continue}if(O<B&&D[O]===y&&(M>=B||D[M]!==_)){var I=w?w[O]:void 0;D.splice(M,0,_),w&&w.splice(M,0,I),D.splice(M<=O?O+1:O,1),w&&w.splice(M<=O?O+1:O,1)}}},n},{isClass:!0}),tg="number",rg=["typed"];function ng(s){var e=s.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(e){var t={"0b":2,"0o":8,"0x":16}[e[1]],r=e[2],n=e[3];return{input:s,radix:t,integerPart:r,fractionalPart:n}}else return null}function ig(s){for(var e=parseInt(s.integerPart,s.radix),t=0,r=0;r<s.fractionalPart.length;r++){var n=parseInt(s.fractionalPart[r],s.radix);t+=n/Math.pow(s.radix,r+1)}var i=e+t;if(isNaN(i))throw new SyntaxError('String "'+s.input+'" is not a valid number');return i}var sg=xe(tg,rg,s=>{var{typed:e}=s,t=e("number",{"":function(){return 0},number:function(n){return n},string:function(n){if(n==="NaN")return NaN;var i=ng(n);if(i)return ig(i);var a=0,u=n.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);u&&(a=Number(u[2]),n=u[1]);var f=Number(n);if(isNaN(f))throw new SyntaxError('String "'+n+'" is not a valid number');if(u){if(f>2**a-1)throw new SyntaxError('String "'.concat(n,'" is out of range'));f>=2**(a-1)&&(f=f-2**a)}return f},BigNumber:function(n){return n.toNumber()},Fraction:function(n){return n.valueOf()},Unit:e.referToSelf(r=>n=>{var i=n.clone();return i.value=r(n.value),i}),null:function(n){return 0},"Unit, string | Unit":function(n,i){return n.toNumber(i)},"Array | Matrix":e.referToSelf(r=>n=>Jr(n,r))});return t.fromJSON=function(r){return parseFloat(r.value)},t}),og="bignumber",ag=["typed","BigNumber"],ug=xe(og,ag,s=>{var{typed:e,BigNumber:t}=s;return e("bignumber",{"":function(){return new t(0)},number:function(n){return new t(n+"")},string:function(n){var i=n.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(i){var a=i[2],u=t(i[1]),f=new t(2).pow(Number(a));if(u.gt(f.sub(1)))throw new SyntaxError('String "'.concat(n,'" is out of range'));var c=new t(2).pow(Number(a)-1);return u.gte(c)?u.sub(f):u}return new t(n)},BigNumber:function(n){return n},Unit:e.referToSelf(r=>n=>{var i=n.clone();return i.value=r(n.value),i}),Fraction:function(n){return new t(n.n).div(n.d).times(n.s)},null:function(n){return new t(0)},"Array | Matrix":e.referToSelf(r=>n=>Jr(n,r))})}),lg="fraction",cg=["typed","Fraction"],fg=xe(lg,cg,s=>{var{typed:e,Fraction:t}=s;return e("fraction",{number:function(n){if(!isFinite(n)||isNaN(n))throw new Error(n+" cannot be represented as a fraction");return new t(n)},string:function(n){return new t(n)},"number, number":function(n,i){return new t(n,i)},null:function(n){return new t(0)},BigNumber:function(n){return new t(n.toString())},Fraction:function(n){return n},Unit:e.referToSelf(r=>n=>{var i=n.clone();return i.value=r(n.value),i}),Object:function(n){return new t(n)},"Array | Matrix":e.referToSelf(r=>n=>Jr(n,r))})}),Nc="matrix",hg=["typed","Matrix","DenseMatrix","SparseMatrix"],dg=xe(Nc,hg,s=>{var{typed:e,Matrix:t,DenseMatrix:r,SparseMatrix:n}=s;return e(Nc,{"":function(){return i([])},string:function(u){return i([],u)},"string, string":function(u,f){return i([],u,f)},Array:function(u){return i(u)},Matrix:function(u){return i(u,u.storage())},"Array | Matrix, string":i,"Array | Matrix, string, string":i});function i(a,u,f){if(u==="dense"||u==="default"||u===void 0)return new r(a,f);if(u==="sparse")return new n(a,f);throw new TypeError("Unknown matrix type "+JSON.stringify(u)+".")}}),Sc="unaryMinus",pg=["typed"],_g=xe(Sc,pg,s=>{var{typed:e}=s;return e(Sc,{number:wc,"Complex | BigNumber | Fraction":t=>t.neg(),Unit:e.referToSelf(t=>r=>{var n=r.clone();return n.value=e.find(t,n.valueType())(r.value),n}),"Array | Matrix":e.referToSelf(t=>r=>Jr(r,t))})}),Oc="abs",vg=["typed"],gg=xe(Oc,vg,s=>{var{typed:e}=s;return e(Oc,{number:mc,"Complex | BigNumber | Fraction | Unit":t=>t.abs(),"Array | Matrix":e.referToSelf(t=>r=>Jr(r,t))})}),Ic="addScalar",mg=["typed"],xg=xe(Ic,mg,s=>{var{typed:e}=s;return e(Ic,{"number, number":xc,"Complex, Complex":function(r,n){return r.add(n)},"BigNumber, BigNumber":function(r,n){return r.plus(n)},"Fraction, Fraction":function(r,n){return r.add(n)},"Unit, Unit":e.referToSelf(t=>(r,n)=>{if(r.value===null||r.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(n.value===null||n.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!r.equalBase(n))throw new Error("Units do not match");var i=r.clone();return i.value=e.find(t,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i})})}),Tc="subtractScalar",yg=["typed"],Dg=xe(Tc,yg,s=>{var{typed:e}=s;return e(Tc,{"number, number":yc,"Complex, Complex":function(r,n){return r.sub(n)},"BigNumber, BigNumber":function(r,n){return r.minus(n)},"Fraction, Fraction":function(r,n){return r.sub(n)},"Unit, Unit":e.referToSelf(t=>(r,n)=>{if(r.value===null||r.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(n.value===null||n.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!r.equalBase(n))throw new Error("Units do not match");var i=r.clone();return i.value=e.find(t,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i})})}),wg="matAlgo11xS0s",Eg=["typed","equalScalar"],ja=xe(wg,Eg,s=>{var{typed:e,equalScalar:t}=s;return function(n,i,a,u){var f=n._values,c=n._index,h=n._ptr,d=n._size,p=n._datatype;if(!f)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var v=d[0],x=d[1],_,y=t,m=0,w=a;typeof p=="string"&&(_=p,y=e.find(t,[_,_]),m=e.convert(0,_),i=e.convert(i,_),w=e.find(a,[_,_]));for(var D=[],A=[],E=[],F=0;F<x;F++){E[F]=A.length;for(var B=h[F],M=h[F+1],O=B;O<M;O++){var C=c[O],N=u?w(i,f[O]):w(f[O],i);y(N,m)||(A.push(C),D.push(N))}}return E[x]=A.length,n.createSparseMatrix({values:D,index:A,ptr:E,size:[v,x],datatype:_})}}),bg="matAlgo12xSfs",Ag=["typed","DenseMatrix"],Fi=xe(bg,Ag,s=>{var{typed:e,DenseMatrix:t}=s;return function(n,i,a,u){var f=n._values,c=n._index,h=n._ptr,d=n._size,p=n._datatype;if(!f)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var v=d[0],x=d[1],_,y=a;typeof p=="string"&&(_=p,i=e.convert(i,_),y=e.find(a,[_,_]));for(var m=[],w=[],D=[],A=0;A<x;A++){for(var E=A+1,F=h[A],B=h[A+1],M=F;M<B;M++){var O=c[M];w[O]=f[M],D[O]=E}for(var C=0;C<v;C++)A===0&&(m[C]=[]),D[C]===E?m[C][A]=u?y(i,w[C]):y(w[C],i):m[C][A]=u?y(i,0):y(0,i)}return new t({data:m,size:[v,x],datatype:_})}}),Cg="matAlgo14xDs",Fg=["typed"],Ya=xe(Cg,Fg,s=>{var{typed:e}=s;return function(n,i,a,u){var f=n._data,c=n._size,h=n._datatype,d,p=a;typeof h=="string"&&(d=h,i=e.convert(i,d),p=e.find(a,[d,d]));var v=c.length>0?t(p,0,c,c[0],f,i,u):[];return n.createDenseMatrix({data:v,size:ut(c),datatype:d})};function t(r,n,i,a,u,f,c){var h=[];if(n===i.length-1)for(var d=0;d<a;d++)h[d]=c?r(f,u[d]):r(u[d],f);else for(var p=0;p<a;p++)h[p]=t(r,n+1,i,i[n+1],u[p],f,c);return h}}),Bg="matAlgo02xDS0",Mg=["typed","equalScalar"],Ng=xe(Bg,Mg,s=>{var{typed:e,equalScalar:t}=s;return function(n,i,a,u){var f=n._data,c=n._size,h=n._datatype||n.getDataType(),d=i._values,p=i._index,v=i._ptr,x=i._size,_=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(c.length!==x.length)throw new rt(c.length,x.length);if(c[0]!==x[0]||c[1]!==x[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+x+")");if(!d)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var y=c[0],m=c[1],w,D=t,A=0,E=a;typeof h=="string"&&h===_&&h!=="mixed"&&(w=h,D=e.find(t,[w,w]),A=e.convert(0,w),E=e.find(a,[w,w]));for(var F=[],B=[],M=[],O=0;O<m;O++){M[O]=B.length;for(var C=v[O],N=v[O+1],I=C;I<N;I++){var L=p[I],k=u?E(d[I],f[L][O]):E(f[L][O],d[I]);D(k,A)||(B.push(L),F.push(k))}}return M[m]=B.length,i.createSparseMatrix({values:F,index:B,ptr:M,size:[y,m],datatype:h===n._datatype&&_===i._datatype?w:void 0})}}),Sg="matAlgo03xDSf",Og=["typed"],Bi=xe(Sg,Og,s=>{var{typed:e}=s;return function(r,n,i,a){var u=r._data,f=r._size,c=r._datatype||r.getDataType(),h=n._values,d=n._index,p=n._ptr,v=n._size,x=n._datatype||n._data===void 0?n._datatype:n.getDataType();if(f.length!==v.length)throw new rt(f.length,v.length);if(f[0]!==v[0]||f[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+v+")");if(!h)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var _=f[0],y=f[1],m,w=0,D=i;typeof c=="string"&&c===x&&c!=="mixed"&&(m=c,w=e.convert(0,m),D=e.find(i,[m,m]));for(var A=[],E=0;E<_;E++)A[E]=[];for(var F=[],B=[],M=0;M<y;M++){for(var O=M+1,C=p[M],N=p[M+1],I=C;I<N;I++){var L=d[I];F[L]=a?D(h[I],u[L][M]):D(u[L][M],h[I]),B[L]=O}for(var k=0;k<_;k++)B[k]===O?A[k][M]=F[k]:A[k][M]=a?D(w,u[k][M]):D(u[k][M],w)}return r.createDenseMatrix({data:A,size:[_,y],datatype:c===r._datatype&&x===n._datatype?m:void 0})}}),Ig="matAlgo05xSfSf",Tg=["typed","equalScalar"],$c=xe(Ig,Tg,s=>{var{typed:e,equalScalar:t}=s;return function(n,i,a){var u=n._values,f=n._index,c=n._ptr,h=n._size,d=n._datatype||n._data===void 0?n._datatype:n.getDataType(),p=i._values,v=i._index,x=i._ptr,_=i._size,y=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(h.length!==_.length)throw new rt(h.length,_.length);if(h[0]!==_[0]||h[1]!==_[1])throw new RangeError("Dimension mismatch. Matrix A ("+h+") must match Matrix B ("+_+")");var m=h[0],w=h[1],D,A=t,E=0,F=a;typeof d=="string"&&d===y&&d!=="mixed"&&(D=d,A=e.find(t,[D,D]),E=e.convert(0,D),F=e.find(a,[D,D]));var B=u&&p?[]:void 0,M=[],O=[],C=B?[]:void 0,N=B?[]:void 0,I=[],L=[],k,z,R,V;for(z=0;z<w;z++){O[z]=M.length;var H=z+1;for(R=c[z],V=c[z+1];R<V;R++)k=f[R],M.push(k),I[k]=H,C&&(C[k]=u[R]);for(R=x[z],V=x[z+1];R<V;R++)k=v[R],I[k]!==H&&M.push(k),L[k]=H,N&&(N[k]=p[R]);if(B)for(R=O[z];R<M.length;){k=M[R];var ee=I[k],te=L[k];if(ee===H||te===H){var j=ee===H?C[k]:E,X=te===H?N[k]:E,Y=F(j,X);A(Y,E)?M.splice(R,1):(B.push(Y),R++)}}}return O[w]=M.length,n.createSparseMatrix({values:B,index:M,ptr:O,size:[m,w],datatype:d===n._datatype&&y===i._datatype?D:void 0})}}),$g="matAlgo13xDD",Lg=["typed"],Rg=xe($g,Lg,s=>{var{typed:e}=s;return function(n,i,a){var u=n._data,f=n._size,c=n._datatype,h=i._data,d=i._size,p=i._datatype,v=[];if(f.length!==d.length)throw new rt(f.length,d.length);for(var x=0;x<f.length;x++){if(f[x]!==d[x])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+d+")");v[x]=f[x]}var _,y=a;typeof c=="string"&&c===p&&(_=c,y=e.find(a,[_,_]));var m=v.length>0?t(y,0,v,v[0],u,h):[];return n.createDenseMatrix({data:m,size:v,datatype:_})};function t(r,n,i,a,u,f){var c=[];if(n===i.length-1)for(var h=0;h<a;h++)c[h]=r(u[h],f[h]);else for(var d=0;d<a;d++)c[d]=t(r,n+1,i,i[n+1],u[d],f[d]);return c}}),Pg="broadcast",kg=["concat"],zg=xe(Pg,kg,s=>{var{concat:e}=s;return function(n,i){var a=Math.max(n._size.length,i._size.length);if(n._size.length===i._size.length&&n._size.every((x,_)=>x===i._size[_]))return[n,i];for(var u=t(n._size,a,0),f=t(i._size,a,0),c=[],h=0;h<a;h++)c[h]=Math.max(u[h],f[h]);Zs(u,c),Zs(f,c);var d=n.clone(),p=i.clone();d._size.length<a?d.reshape(t(d._size,a,1)):p._size.length<a&&p.reshape(t(p._size,a,1));for(var v=0;v<a;v++)d._size[v]<c[v]&&(d=r(d,c[v],v)),p._size[v]<c[v]&&(p=r(p,c[v],v));return[d,p]};function t(n,i,a){return[...Array(i-n.length).fill(a),...n]}function r(n,i,a){return e(...Array(i).fill(n),a)}}),qg="matrixAlgorithmSuite",Ug=["typed","matrix","concat"],ni=xe(qg,Ug,s=>{var{typed:e,matrix:t,concat:r}=s,n=Rg({typed:e}),i=Ya({typed:e}),a=zg({concat:r});return function(f){var c=f.elop,h=f.SD||f.DS,d;c?(d={"DenseMatrix, DenseMatrix":(_,y)=>n(...a(_,y),c),"Array, Array":(_,y)=>n(...a(t(_),t(y)),c).valueOf(),"Array, DenseMatrix":(_,y)=>n(...a(t(_),y),c),"DenseMatrix, Array":(_,y)=>n(...a(_,t(y)),c)},f.SS&&(d["SparseMatrix, SparseMatrix"]=(_,y)=>f.SS(...a(_,y),c,!1)),f.DS&&(d["DenseMatrix, SparseMatrix"]=(_,y)=>f.DS(...a(_,y),c,!1),d["Array, SparseMatrix"]=(_,y)=>f.DS(...a(t(_),y),c,!1)),h&&(d["SparseMatrix, DenseMatrix"]=(_,y)=>h(...a(y,_),c,!0),d["SparseMatrix, Array"]=(_,y)=>h(...a(t(y),_),c,!0))):(d={"DenseMatrix, DenseMatrix":e.referToSelf(_=>(y,m)=>n(...a(y,m),_)),"Array, Array":e.referToSelf(_=>(y,m)=>n(...a(t(y),t(m)),_).valueOf()),"Array, DenseMatrix":e.referToSelf(_=>(y,m)=>n(...a(t(y),m),_)),"DenseMatrix, Array":e.referToSelf(_=>(y,m)=>n(...a(y,t(m)),_))},f.SS&&(d["SparseMatrix, SparseMatrix"]=e.referToSelf(_=>(y,m)=>f.SS(...a(y,m),_,!1))),f.DS&&(d["DenseMatrix, SparseMatrix"]=e.referToSelf(_=>(y,m)=>f.DS(...a(y,m),_,!1)),d["Array, SparseMatrix"]=e.referToSelf(_=>(y,m)=>f.DS(...a(t(y),m),_,!1))),h&&(d["SparseMatrix, DenseMatrix"]=e.referToSelf(_=>(y,m)=>h(...a(m,y),_,!0)),d["SparseMatrix, Array"]=e.referToSelf(_=>(y,m)=>h(...a(t(m),y),_,!0))));var p=f.scalar||"any",v=f.Ds||f.Ss;v&&(c?(d["DenseMatrix,"+p]=(_,y)=>i(_,y,c,!1),d[p+", DenseMatrix"]=(_,y)=>i(y,_,c,!0),d["Array,"+p]=(_,y)=>i(t(_),y,c,!1).valueOf(),d[p+", Array"]=(_,y)=>i(t(y),_,c,!0).valueOf()):(d["DenseMatrix,"+p]=e.referToSelf(_=>(y,m)=>i(y,m,_,!1)),d[p+", DenseMatrix"]=e.referToSelf(_=>(y,m)=>i(m,y,_,!0)),d["Array,"+p]=e.referToSelf(_=>(y,m)=>i(t(y),m,_,!1).valueOf()),d[p+", Array"]=e.referToSelf(_=>(y,m)=>i(t(m),y,_,!0).valueOf())));var x=f.sS!==void 0?f.sS:f.Ss;return c?(f.Ss&&(d["SparseMatrix,"+p]=(_,y)=>f.Ss(_,y,c,!1)),x&&(d[p+", SparseMatrix"]=(_,y)=>x(y,_,c,!0))):(f.Ss&&(d["SparseMatrix,"+p]=e.referToSelf(_=>(y,m)=>f.Ss(y,m,_,!1))),x&&(d[p+", SparseMatrix"]=e.referToSelf(_=>(y,m)=>x(m,y,_,!0)))),c&&c.signatures&&Bl(d,c.signatures),d}}),Wg="matAlgo01xDSid",Hg=["typed"],Lc=xe(Wg,Hg,s=>{var{typed:e}=s;return function(r,n,i,a){var u=r._data,f=r._size,c=r._datatype||r.getDataType(),h=n._values,d=n._index,p=n._ptr,v=n._size,x=n._datatype||n._data===void 0?n._datatype:n.getDataType();if(f.length!==v.length)throw new rt(f.length,v.length);if(f[0]!==v[0]||f[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+v+")");if(!h)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var _=f[0],y=f[1],m=typeof c=="string"&&c!=="mixed"&&c===x?c:void 0,w=m?e.find(i,[m,m]):i,D,A,E=[];for(D=0;D<_;D++)E[D]=[];var F=[],B=[];for(A=0;A<y;A++){for(var M=A+1,O=p[A],C=p[A+1],N=O;N<C;N++)D=d[N],F[D]=a?w(h[N],u[D][A]):w(u[D][A],h[N]),B[D]=M;for(D=0;D<_;D++)B[D]===M?E[D][A]=F[D]:E[D][A]=u[D][A]}return r.createDenseMatrix({data:E,size:[_,y],datatype:c===r._datatype&&x===n._datatype?m:void 0})}}),jg="matAlgo04xSidSid",Yg=["typed","equalScalar"],Kg=xe(jg,Yg,s=>{var{typed:e,equalScalar:t}=s;return function(n,i,a){var u=n._values,f=n._index,c=n._ptr,h=n._size,d=n._datatype||n._data===void 0?n._datatype:n.getDataType(),p=i._values,v=i._index,x=i._ptr,_=i._size,y=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(h.length!==_.length)throw new rt(h.length,_.length);if(h[0]!==_[0]||h[1]!==_[1])throw new RangeError("Dimension mismatch. Matrix A ("+h+") must match Matrix B ("+_+")");var m=h[0],w=h[1],D,A=t,E=0,F=a;typeof d=="string"&&d===y&&d!=="mixed"&&(D=d,A=e.find(t,[D,D]),E=e.convert(0,D),F=e.find(a,[D,D]));var B=u&&p?[]:void 0,M=[],O=[],C=u&&p?[]:void 0,N=u&&p?[]:void 0,I=[],L=[],k,z,R,V,H;for(z=0;z<w;z++){O[z]=M.length;var ee=z+1;for(V=c[z],H=c[z+1],R=V;R<H;R++)k=f[R],M.push(k),I[k]=ee,C&&(C[k]=u[R]);for(V=x[z],H=x[z+1],R=V;R<H;R++)if(k=v[R],I[k]===ee){if(C){var te=F(C[k],p[R]);A(te,E)?I[k]=null:C[k]=te}}else M.push(k),L[k]=ee,N&&(N[k]=p[R]);if(C&&N)for(R=O[z];R<M.length;)k=M[R],I[k]===ee?(B[R]=C[k],R++):L[k]===ee?(B[R]=N[k],R++):M.splice(R,1)}return O[w]=M.length,n.createSparseMatrix({values:B,index:M,ptr:O,size:[m,w],datatype:d===n._datatype&&y===i._datatype?D:void 0})}}),Zg="matAlgo10xSids",Vg=["typed","DenseMatrix"],Rc=xe(Zg,Vg,s=>{var{typed:e,DenseMatrix:t}=s;return function(n,i,a,u){var f=n._values,c=n._index,h=n._ptr,d=n._size,p=n._datatype;if(!f)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var v=d[0],x=d[1],_,y=a;typeof p=="string"&&(_=p,i=e.convert(i,_),y=e.find(a,[_,_]));for(var m=[],w=[],D=[],A=0;A<x;A++){for(var E=A+1,F=h[A],B=h[A+1],M=F;M<B;M++){var O=c[M];w[O]=f[M],D[O]=E}for(var C=0;C<v;C++)A===0&&(m[C]=[]),D[C]===E?m[C][A]=u?y(i,w[C]):y(w[C],i):m[C][A]=i}return new t({data:m,size:[v,x],datatype:_})}}),Gg="multiplyScalar",Xg=["typed"],Qg=xe(Gg,Xg,s=>{var{typed:e}=s;return e("multiplyScalar",{"number, number":Dc,"Complex, Complex":function(r,n){return r.mul(n)},"BigNumber, BigNumber":function(r,n){return r.times(n)},"Fraction, Fraction":function(r,n){return r.mul(n)},"number | Fraction | BigNumber | Complex, Unit":(t,r)=>r.multiply(t),"Unit, number | Fraction | BigNumber | Complex | Unit":(t,r)=>t.multiply(r)})}),Pc="multiply",Jg=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],em=xe(Pc,Jg,s=>{var{typed:e,matrix:t,addScalar:r,multiplyScalar:n,equalScalar:i,dot:a}=s,u=ja({typed:e,equalScalar:i}),f=Ya({typed:e});function c(E,F){switch(E.length){case 1:switch(F.length){case 1:if(E[0]!==F[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(E[0]!==F[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+E[0]+") must match Matrix rows ("+F[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+F.length+" dimensions)")}break;case 2:switch(F.length){case 1:if(E[1]!==F[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+E[1]+") must match Vector length ("+F[0]+")");break;case 2:if(E[1]!==F[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+E[1]+") must match Matrix B rows ("+F[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+F.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+E.length+" dimensions)")}}function h(E,F,B){if(B===0)throw new Error("Cannot multiply two empty vectors");return a(E,F)}function d(E,F){if(F.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return p(E,F)}function p(E,F){var B=E._data,M=E._size,O=E._datatype||E.getDataType(),C=F._data,N=F._size,I=F._datatype||F.getDataType(),L=M[0],k=N[1],z,R=r,V=n;O&&I&&O===I&&typeof O=="string"&&O!=="mixed"&&(z=O,R=e.find(r,[z,z]),V=e.find(n,[z,z]));for(var H=[],ee=0;ee<k;ee++){for(var te=V(B[0],C[0][ee]),j=1;j<L;j++)te=R(te,V(B[j],C[j][ee]));H[ee]=te}return E.createDenseMatrix({data:H,size:[k],datatype:O===E._datatype&&I===F._datatype?z:void 0})}var v=e("_multiplyMatrixVector",{"DenseMatrix, any":_,"SparseMatrix, any":w}),x=e("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":y,"DenseMatrix, SparseMatrix":m,"SparseMatrix, DenseMatrix":D,"SparseMatrix, SparseMatrix":A});function _(E,F){var B=E._data,M=E._size,O=E._datatype||E.getDataType(),C=F._data,N=F._datatype||F.getDataType(),I=M[0],L=M[1],k,z=r,R=n;O&&N&&O===N&&typeof O=="string"&&O!=="mixed"&&(k=O,z=e.find(r,[k,k]),R=e.find(n,[k,k]));for(var V=[],H=0;H<I;H++){for(var ee=B[H],te=R(ee[0],C[0]),j=1;j<L;j++)te=z(te,R(ee[j],C[j]));V[H]=te}return E.createDenseMatrix({data:V,size:[I],datatype:O===E._datatype&&N===F._datatype?k:void 0})}function y(E,F){var B=E._data,M=E._size,O=E._datatype||E.getDataType(),C=F._data,N=F._size,I=F._datatype||F.getDataType(),L=M[0],k=M[1],z=N[1],R,V=r,H=n;O&&I&&O===I&&typeof O=="string"&&O!=="mixed"&&O!=="mixed"&&(R=O,V=e.find(r,[R,R]),H=e.find(n,[R,R]));for(var ee=[],te=0;te<L;te++){var j=B[te];ee[te]=[];for(var X=0;X<z;X++){for(var Y=H(j[0],C[0][X]),Q=1;Q<k;Q++)Y=V(Y,H(j[Q],C[Q][X]));ee[te][X]=Y}}return E.createDenseMatrix({data:ee,size:[L,z],datatype:O===E._datatype&&I===F._datatype?R:void 0})}function m(E,F){var B=E._data,M=E._size,O=E._datatype||E.getDataType(),C=F._values,N=F._index,I=F._ptr,L=F._size,k=F._datatype||F._data===void 0?F._datatype:F.getDataType();if(!C)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var z=M[0],R=L[1],V,H=r,ee=n,te=i,j=0;O&&k&&O===k&&typeof O=="string"&&O!=="mixed"&&(V=O,H=e.find(r,[V,V]),ee=e.find(n,[V,V]),te=e.find(i,[V,V]),j=e.convert(0,V));for(var X=[],Y=[],Q=[],pe=F.createSparseMatrix({values:X,index:Y,ptr:Q,size:[z,R],datatype:O===E._datatype&&k===F._datatype?V:void 0}),De=0;De<R;De++){Q[De]=Y.length;var we=I[De],Ee=I[De+1];if(Ee>we)for(var Oe=0,Fe=0;Fe<z;Fe++){for(var nt=Fe+1,Ye=void 0,Ie=we;Ie<Ee;Ie++){var Le=N[Ie];Oe!==nt?(Ye=ee(B[Fe][Le],C[Ie]),Oe=nt):Ye=H(Ye,ee(B[Fe][Le],C[Ie]))}Oe===nt&&!te(Ye,j)&&(Y.push(Fe),X.push(Ye))}}return Q[R]=Y.length,pe}function w(E,F){var B=E._values,M=E._index,O=E._ptr,C=E._datatype||E._data===void 0?E._datatype:E.getDataType();if(!B)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var N=F._data,I=F._datatype||F.getDataType(),L=E._size[0],k=F._size[0],z=[],R=[],V=[],H,ee=r,te=n,j=i,X=0;C&&I&&C===I&&typeof C=="string"&&C!=="mixed"&&(H=C,ee=e.find(r,[H,H]),te=e.find(n,[H,H]),j=e.find(i,[H,H]),X=e.convert(0,H));var Y=[],Q=[];V[0]=0;for(var pe=0;pe<k;pe++){var De=N[pe];if(!j(De,X))for(var we=O[pe],Ee=O[pe+1],Oe=we;Oe<Ee;Oe++){var Fe=M[Oe];Q[Fe]?Y[Fe]=ee(Y[Fe],te(De,B[Oe])):(Q[Fe]=!0,R.push(Fe),Y[Fe]=te(De,B[Oe]))}}for(var nt=R.length,Ye=0;Ye<nt;Ye++){var Ie=R[Ye];z[Ye]=Y[Ie]}return V[1]=R.length,E.createSparseMatrix({values:z,index:R,ptr:V,size:[L,1],datatype:C===E._datatype&&I===F._datatype?H:void 0})}function D(E,F){var B=E._values,M=E._index,O=E._ptr,C=E._datatype||E._data===void 0?E._datatype:E.getDataType();if(!B)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var N=F._data,I=F._datatype||F.getDataType(),L=E._size[0],k=F._size[0],z=F._size[1],R,V=r,H=n,ee=i,te=0;C&&I&&C===I&&typeof C=="string"&&C!=="mixed"&&(R=C,V=e.find(r,[R,R]),H=e.find(n,[R,R]),ee=e.find(i,[R,R]),te=e.convert(0,R));for(var j=[],X=[],Y=[],Q=E.createSparseMatrix({values:j,index:X,ptr:Y,size:[L,z],datatype:C===E._datatype&&I===F._datatype?R:void 0}),pe=[],De=[],we=0;we<z;we++){Y[we]=X.length;for(var Ee=we+1,Oe=0;Oe<k;Oe++){var Fe=N[Oe][we];if(!ee(Fe,te))for(var nt=O[Oe],Ye=O[Oe+1],Ie=nt;Ie<Ye;Ie++){var Le=M[Ie];De[Le]!==Ee?(De[Le]=Ee,X.push(Le),pe[Le]=H(Fe,B[Ie])):pe[Le]=V(pe[Le],H(Fe,B[Ie]))}}for(var yt=Y[we],Wt=X.length,At=yt;At<Wt;At++){var lr=X[At];j[At]=pe[lr]}}return Y[z]=X.length,Q}function A(E,F){var B=E._values,M=E._index,O=E._ptr,C=E._datatype||E._data===void 0?E._datatype:E.getDataType(),N=F._values,I=F._index,L=F._ptr,k=F._datatype||F._data===void 0?F._datatype:F.getDataType(),z=E._size[0],R=F._size[1],V=B&&N,H,ee=r,te=n;C&&k&&C===k&&typeof C=="string"&&C!=="mixed"&&(H=C,ee=e.find(r,[H,H]),te=e.find(n,[H,H]));for(var j=V?[]:void 0,X=[],Y=[],Q=E.createSparseMatrix({values:j,index:X,ptr:Y,size:[z,R],datatype:C===E._datatype&&k===F._datatype?H:void 0}),pe=V?[]:void 0,De=[],we,Ee,Oe,Fe,nt,Ye,Ie,Le,yt=0;yt<R;yt++){Y[yt]=X.length;var Wt=yt+1;for(nt=L[yt],Ye=L[yt+1],Fe=nt;Fe<Ye;Fe++)if(Le=I[Fe],V)for(Ee=O[Le],Oe=O[Le+1],we=Ee;we<Oe;we++)Ie=M[we],De[Ie]!==Wt?(De[Ie]=Wt,X.push(Ie),pe[Ie]=te(N[Fe],B[we])):pe[Ie]=ee(pe[Ie],te(N[Fe],B[we]));else for(Ee=O[Le],Oe=O[Le+1],we=Ee;we<Oe;we++)Ie=M[we],De[Ie]!==Wt&&(De[Ie]=Wt,X.push(Ie));if(V)for(var At=Y[yt],lr=X.length,Rr=At;Rr<lr;Rr++){var cr=X[Rr];j[Rr]=pe[cr]}}return Y[R]=X.length,Q}return e(Pc,n,{"Array, Array":e.referTo("Matrix, Matrix",E=>(F,B)=>{c(Pt(F),Pt(B));var M=E(t(F),t(B));return xt(M)?M.valueOf():M}),"Matrix, Matrix":function(F,B){var M=F.size(),O=B.size();return c(M,O),M.length===1?O.length===1?h(F,B,M[0]):d(F,B):O.length===1?v(F,B):x(F,B)},"Matrix, Array":e.referTo("Matrix,Matrix",E=>(F,B)=>E(F,t(B))),"Array, Matrix":e.referToSelf(E=>(F,B)=>E(t(F,B.storage()),B)),"SparseMatrix, any":function(F,B){return u(F,B,n,!1)},"DenseMatrix, any":function(F,B){return f(F,B,n,!1)},"any, SparseMatrix":function(F,B){return u(B,F,n,!0)},"any, DenseMatrix":function(F,B){return f(B,F,n,!0)},"Array, any":function(F,B){return f(t(F),B,n,!1).valueOf()},"any, Array":function(F,B){return f(t(B),F,n,!0).valueOf()},"any, any":n,"any, any, ...any":e.referToSelf(E=>(F,B,M)=>{for(var O=E(F,B),C=0;C<M.length;C++)O=E(O,M[C]);return O})})}),kc="subtract",tm=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],rm=xe(kc,tm,s=>{var{typed:e,matrix:t,equalScalar:r,subtractScalar:n,unaryMinus:i,DenseMatrix:a,concat:u}=s,f=Lc({typed:e}),c=Bi({typed:e}),h=$c({typed:e,equalScalar:r}),d=Rc({typed:e,DenseMatrix:a}),p=Fi({typed:e,DenseMatrix:a}),v=ni({typed:e,matrix:t,concat:u});return e(kc,{"any, any":n},v({elop:n,SS:h,DS:f,SD:c,Ss:p,sS:d}))}),nm="matAlgo07xSSf",im=["typed","DenseMatrix"],lo=xe(nm,im,s=>{var{typed:e,DenseMatrix:t}=s;return function(i,a,u){var f=i._size,c=i._datatype||i._data===void 0?i._datatype:i.getDataType(),h=a._size,d=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(f.length!==h.length)throw new rt(f.length,h.length);if(f[0]!==h[0]||f[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+h+")");var p=f[0],v=f[1],x,_=0,y=u;typeof c=="string"&&c===d&&c!=="mixed"&&(x=c,_=e.convert(0,x),y=e.find(u,[x,x]));var m,w,D=[];for(m=0;m<p;m++)D[m]=[];var A=[],E=[],F=[],B=[];for(w=0;w<v;w++){var M=w+1;for(r(i,w,F,A,M),r(a,w,B,E,M),m=0;m<p;m++){var O=F[m]===M?A[m]:_,C=B[m]===M?E[m]:_;D[m][w]=y(O,C)}}return new t({data:D,size:[p,v],datatype:c===i._datatype&&d===a._datatype?x:void 0})};function r(n,i,a,u,f){for(var c=n._values,h=n._index,d=n._ptr,p=d[i],v=d[i+1];p<v;p++){var x=h[p];a[x]=f,u[x]=c[p]}}}),zc="conj",sm=["typed"],om=xe(zc,sm,s=>{var{typed:e}=s;return e(zc,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.conjugate(),"Array | Matrix":e.referToSelf(t=>r=>Jr(r,t))})}),qc="concat",am=["typed","matrix","isInteger"],um=xe(qc,am,s=>{var{typed:e,matrix:t,isInteger:r}=s;return e(qc,{"...Array | Matrix | number | BigNumber":function(i){var a,u=i.length,f=-1,c,h=!1,d=[];for(a=0;a<u;a++){var p=i[a];if(xt(p)&&(h=!0),_t(p)||Ot(p)){if(a!==u-1)throw new Error("Dimension must be specified as last argument");if(c=f,f=p.valueOf(),!r(f))throw new TypeError("Integer number expected for dimension");if(f<0||a>0&&f>c)throw new In(f,c+1)}else{var v=ut(p).valueOf(),x=Pt(v);if(d[a]=v,c=f,f=x.length-1,a>0&&f!==c)throw new rt(c+1,f+1)}}if(d.length===0)throw new SyntaxError("At least one matrix expected");for(var _=d.shift();d.length;)_=Zl(_,d.shift(),f);return h?t(_):_},"...string":function(i){return i.join("")}})}),Uc="count",lm=["typed","size","prod"],cm=xe(Uc,lm,s=>{var{typed:e,size:t,prod:r}=s;return e(Uc,{string:function(i){return i.length},"Matrix | Array":function(i){return r(t(i))}})}),Wc="identity",fm=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],hm=xe(Wc,fm,s=>{var{typed:e,config:t,matrix:r,BigNumber:n,DenseMatrix:i,SparseMatrix:a}=s;return e(Wc,{"":function(){return t.matrix==="Matrix"?r([]):[]},string:function(h){return r(h)},"number | BigNumber":function(h){return f(h,h,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(h,d){return f(h,h,d)},"number | BigNumber, number | BigNumber":function(h,d){return f(h,d,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(h,d,p){return f(h,d,p)},Array:function(h){return u(h)},"Array, string":function(h,d){return u(h,d)},Matrix:function(h){return u(h.valueOf(),h.storage())},"Matrix, string":function(h,d){return u(h.valueOf(),d)}});function u(c,h){switch(c.length){case 0:return h?r(h):[];case 1:return f(c[0],c[0],h);case 2:return f(c[0],c[1],h);default:throw new Error("Vector containing two values expected")}}function f(c,h,d){var p=Ot(c)||Ot(h)?n:null;if(Ot(c)&&(c=c.toNumber()),Ot(h)&&(h=h.toNumber()),!bt(c)||c<1)throw new Error("Parameters in function identity must be positive integers");if(!bt(h)||h<1)throw new Error("Parameters in function identity must be positive integers");var v=p?new n(1):1,x=p?new p(0):0,_=[c,h];if(d){if(d==="sparse")return a.diagonal(_,v,0,x);if(d==="dense")return i.diagonal(_,v,0,x);throw new TypeError('Unknown matrix type "'.concat(d,'"'))}for(var y=Sa([],_,x),m=c<h?c:h,w=0;w<m;w++)y[w][w]=v;return y}}),Hc="kron",dm=["typed","matrix","multiplyScalar"],pm=xe(Hc,dm,s=>{var{typed:e,matrix:t,multiplyScalar:r}=s;return e(Hc,{"Matrix, Matrix":function(a,u){return t(n(a.toArray(),u.toArray()))},"Matrix, Array":function(a,u){return t(n(a.toArray(),u))},"Array, Matrix":function(a,u){return t(n(a,u.toArray()))},"Array, Array":n});function n(i,a){if(Pt(i).length===1&&(i=[i]),Pt(a).length===1&&(a=[a]),Pt(i).length>2||Pt(a).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(i.length)+", y = "+JSON.stringify(a.length)+")");var u=[],f=[];return i.map(function(c){return a.map(function(h){return f=[],u.push(f),c.map(function(d){return h.map(function(p){return f.push(r(d,p))})})})})&&u}});function _m(){throw new Error('No "bignumber" implementation available')}function vm(){throw new Error('No "fraction" implementation available')}function gm(){throw new Error('No "matrix" implementation available')}var jc="reshape",mm=["typed","isInteger","matrix"],xm=xe(jc,mm,s=>{var{typed:e,isInteger:t}=s;return e(jc,{"Matrix, Array":function(n,i){return n.reshape(i,!0)},"Array, Array":function(n,i){return i.forEach(function(a){if(!t(a))throw new TypeError("Invalid size for dimension: "+a)}),Ia(n,i)}})}),Yc="size",ym=["typed","config","?matrix"],Dm=xe(Yc,ym,s=>{var{typed:e,config:t,matrix:r}=s;return e(Yc,{Matrix:function(i){return i.create(i.size())},Array:Pt,string:function(i){return t.matrix==="Array"?[i.length]:r([i.length])},"number | Complex | BigNumber | Unit | boolean | null":function(i){return t.matrix==="Array"?[]:r?r([]):gm()}})}),Kc="transpose",wm=["typed","matrix"],Em=xe(Kc,wm,s=>{var{typed:e,matrix:t}=s;return e(Kc,{Array:a=>r(t(a)).valueOf(),Matrix:r,any:ut});function r(a){var u=a.size(),f;switch(u.length){case 1:f=a.clone();break;case 2:{var c=u[0],h=u[1];if(h===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+ft(u)+")");switch(a.storage()){case"dense":f=n(a,c,h);break;case"sparse":f=i(a,c,h);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+ft(u)+")")}return f}function n(a,u,f){for(var c=a._data,h=[],d,p=0;p<f;p++){d=h[p]=[];for(var v=0;v<u;v++)d[v]=ut(c[v][p])}return a.createDenseMatrix({data:h,size:[f,u],datatype:a._datatype})}function i(a,u,f){for(var c=a._values,h=a._index,d=a._ptr,p=c?[]:void 0,v=[],x=[],_=[],y=0;y<u;y++)_[y]=0;var m,w,D;for(m=0,w=h.length;m<w;m++)_[h[m]]++;for(var A=0,E=0;E<u;E++)x.push(A),A+=_[E],_[E]=x[E];for(x.push(A),D=0;D<f;D++)for(var F=d[D],B=d[D+1],M=F;M<B;M++){var O=_[h[M]]++;v[O]=D,c&&(p[O]=ut(c[M]))}return a.createSparseMatrix({values:p,index:v,ptr:x,size:[f,u],datatype:a._datatype})}}),Zc="ctranspose",bm=["typed","transpose","conj"],Am=xe(Zc,bm,s=>{var{typed:e,transpose:t,conj:r}=s;return e(Zc,{any:function(i){return r(t(i))}})}),Vc="mode",Cm=["typed","isNaN","isNumeric"],Fm=xe(Vc,Cm,s=>{var{typed:e,isNaN:t,isNumeric:r}=s;return e(Vc,{"Array | Matrix":n,"...":function(a){return n(a)}});function n(i){i=$a(i.valueOf());var a=i.length;if(a===0)throw new Error("Cannot calculate mode of an empty array");for(var u={},f=[],c=0,h=0;h<i.length;h++){var d=i[h];if(r(d)&&t(d))throw new Error("Cannot calculate mode of an array containing NaN values");d in u||(u[d]=0),u[d]++,u[d]===c?f.push(d):u[d]>c&&(c=u[d],f=[d])}return f}});function Pn(s,e,t){var r;return String(s).indexOf("Unexpected type")!==-1?(r=arguments.length>2?" (type: "+On(t)+", value: "+JSON.stringify(t)+")":" (type: "+s.data.actual+")",new TypeError("Cannot calculate "+e+", unexpected type of argument"+r)):String(s).indexOf("complex numbers")!==-1?(r=arguments.length>2?" (type: "+On(t)+", value: "+JSON.stringify(t)+")":"",new TypeError("Cannot calculate "+e+", no ordering relation is defined for complex numbers"+r)):s}var Gc="prod",Bm=["typed","config","multiplyScalar","numeric"],Mm=xe(Gc,Bm,s=>{var{typed:e,config:t,multiplyScalar:r,numeric:n}=s;return e(Gc,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":function(u,f){throw new Error("prod(A, dim) is not yet supported")},"...":function(u){return i(u)}});function i(a){var u;if(ls(a,function(f){try{u=u===void 0?f:r(u,f)}catch(c){throw Pn(c,"prod",f)}}),typeof u=="string"&&(u=n(u,t.number)),u===void 0)throw new Error("Cannot calculate prod of an empty array");return u}}),Nm="numeric",Sm=["number","?bignumber","?fraction"],Om=xe(Nm,Sm,s=>{var{number:e,bignumber:t,fraction:r}=s,n={string:!0,number:!0,BigNumber:!0,Fraction:!0},i={number:a=>e(a),BigNumber:t?a=>t(a):_m,Fraction:r?a=>r(a):vm};return function(u){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",c=arguments.length>2?arguments[2]:void 0;if(c!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var h=On(u);if(!(h in n))throw new TypeError("Cannot convert "+u+' of type "'+h+'"; valid input types are '+Object.keys(n).join(", "));if(!(f in i))throw new TypeError("Cannot convert "+u+' to type "'+f+'"; valid output types are '+Object.keys(i).join(", "));return f===h?u:i[f](u)}}),Xc="divideScalar",Im=["typed","numeric"],Tm=xe(Xc,Im,s=>{var{typed:e,numeric:t}=s;return e(Xc,{"number, number":function(n,i){return n/i},"Complex, Complex":function(n,i){return n.div(i)},"BigNumber, BigNumber":function(n,i){return n.div(i)},"Fraction, Fraction":function(n,i){return n.div(i)},"Unit, number | Complex | Fraction | BigNumber | Unit":(r,n)=>r.divide(n),"number | Fraction | Complex | BigNumber, Unit":(r,n)=>n.divideInto(r)})}),Qc="pow",$m=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],Lm=xe(Qc,$m,s=>{var{typed:e,config:t,identity:r,multiply:n,matrix:i,inv:a,number:u,fraction:f,Complex:c}=s;return e(Qc,{"number, number":h,"Complex, Complex":function(x,_){return x.pow(_)},"BigNumber, BigNumber":function(x,_){return _.isInteger()||x>=0||t.predictable?x.pow(_):new c(x.toNumber(),0).pow(_.toNumber(),0)},"Fraction, Fraction":function(x,_){var y=x.pow(_);if(y!=null)return y;if(t.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return h(x.valueOf(),_.valueOf())},"Array, number":d,"Array, BigNumber":function(x,_){return d(x,_.toNumber())},"Matrix, number":p,"Matrix, BigNumber":function(x,_){return p(x,_.toNumber())},"Unit, number | BigNumber":function(x,_){return x.pow(_)}});function h(v,x){if(t.predictable&&!bt(x)&&v<0)try{var _=f(x),y=u(_);if((x===y||Math.abs((x-y)/x)<1e-14)&&_.d%2===1)return(_.n%2===0?1:-1)*Math.pow(-v,x)}catch{}return t.predictable&&(v<-1&&x===1/0||v>-1&&v<0&&x===-1/0)?NaN:bt(x)||v>=0||t.predictable?Ec(v,x):v*v<1&&x===1/0||v*v>1&&x===-1/0?0:new c(v,0).pow(x,0)}function d(v,x){if(!bt(x))throw new TypeError("For A^b, b must be an integer (value is "+x+")");var _=Pt(v);if(_.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+_.length+" dimensions)");if(_[0]!==_[1])throw new Error("For A^b, A must be square (size is "+_[0]+"x"+_[1]+")");if(x<0)try{return d(a(v),-x)}catch(w){throw w.message==="Cannot calculate inverse, determinant is zero"?new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+x+")"):w}for(var y=r(_[0]).valueOf(),m=v;x>=1;)(x&1)===1&&(y=n(m,y)),x>>=1,m=n(m,m);return y}function p(v,x){return i(d(v.valueOf(),x))}}),Jc="dotDivide",Rm=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],Pm=xe(Jc,Rm,s=>{var{typed:e,matrix:t,equalScalar:r,divideScalar:n,DenseMatrix:i,concat:a}=s,u=Ng({typed:e,equalScalar:r}),f=Bi({typed:e}),c=lo({typed:e,DenseMatrix:i}),h=ja({typed:e,equalScalar:r}),d=Fi({typed:e,DenseMatrix:i}),p=ni({typed:e,matrix:t,concat:a});return e(Jc,p({elop:n,SS:c,DS:f,SD:u,Ss:h,sS:d}))}),co="compare",km=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],zm=xe(co,km,s=>{var{typed:e,config:t,equalScalar:r,matrix:n,BigNumber:i,Fraction:a,DenseMatrix:u,concat:f}=s,c=Bi({typed:e}),h=$c({typed:e,equalScalar:r}),d=Fi({typed:e,DenseMatrix:u}),p=ni({typed:e,matrix:n,concat:f}),v=ao({typed:e});return e(co,qm({typed:e,config:t}),{"boolean, boolean":function(_,y){return _===y?0:_>y?1:-1},"BigNumber, BigNumber":function(_,y){return oo(_,y,t.epsilon)?new i(0):new i(_.cmp(y))},"Fraction, Fraction":function(_,y){return new a(_.compare(y))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},v,p({SS:h,DS:c,Ss:d}))}),qm=xe(co,["typed","config"],s=>{var{typed:e,config:t}=s;return e(co,{"number, number":function(n,i){return ri(n,i,t.epsilon)?0:n>i?1:-1}})}),fo="equal",Um=["typed","matrix","equalScalar","DenseMatrix","concat"],Wm=xe(fo,Um,s=>{var{typed:e,matrix:t,equalScalar:r,DenseMatrix:n,concat:i}=s,a=Bi({typed:e}),u=lo({typed:e,DenseMatrix:n}),f=Fi({typed:e,DenseMatrix:n}),c=ni({typed:e,matrix:t,concat:i});return e(fo,Hm({typed:e,equalScalar:r}),c({elop:r,SS:u,DS:a,Ss:f}))}),Hm=xe(fo,["typed","equalScalar"],s=>{var{typed:e,equalScalar:t}=s;return e(fo,{"any, any":function(n,i){return n===null?i===null:i===null?n===null:n===void 0?i===void 0:i===void 0?n===void 0:t(n,i)}})}),ho="smaller",jm=["typed","config","matrix","DenseMatrix","concat"],Ym=xe(ho,jm,s=>{var{typed:e,config:t,matrix:r,DenseMatrix:n,concat:i}=s,a=Bi({typed:e}),u=lo({typed:e,DenseMatrix:n}),f=Fi({typed:e,DenseMatrix:n}),c=ni({typed:e,matrix:r,concat:i}),h=ao({typed:e});return e(ho,Km({typed:e,config:t}),{"boolean, boolean":(d,p)=>d<p,"BigNumber, BigNumber":function(p,v){return p.lt(v)&&!oo(p,v,t.epsilon)},"Fraction, Fraction":(d,p)=>d.compare(p)===-1,"Complex, Complex":function(p,v){throw new TypeError("No ordering relation is defined for complex numbers")}},h,c({SS:u,DS:a,Ss:f}))}),Km=xe(ho,["typed","config"],s=>{var{typed:e,config:t}=s;return e(ho,{"number, number":function(n,i){return n<i&&!ri(n,i,t.epsilon)}})}),po="larger",Zm=["typed","config","matrix","DenseMatrix","concat"],Vm=xe(po,Zm,s=>{var{typed:e,config:t,matrix:r,DenseMatrix:n,concat:i}=s,a=Bi({typed:e}),u=lo({typed:e,DenseMatrix:n}),f=Fi({typed:e,DenseMatrix:n}),c=ni({typed:e,matrix:r,concat:i}),h=ao({typed:e});return e(po,Gm({typed:e,config:t}),{"boolean, boolean":(d,p)=>d>p,"BigNumber, BigNumber":function(p,v){return p.gt(v)&&!oo(p,v,t.epsilon)},"Fraction, Fraction":(d,p)=>d.compare(p)===1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},h,c({SS:u,DS:a,Ss:f}))}),Gm=xe(po,["typed","config"],s=>{var{typed:e,config:t}=s;return e(po,{"number, number":function(n,i){return n>i&&!ri(n,i,t.epsilon)}})}),ef="deepEqual",Xm=["typed","equal"],Qm=xe(ef,Xm,s=>{var{typed:e,equal:t}=s;return e(ef,{"any, any":function(i,a){return r(i.valueOf(),a.valueOf())}});function r(n,i){if(Array.isArray(n))if(Array.isArray(i)){var a=n.length;if(a!==i.length)return!1;for(var u=0;u<a;u++)if(!r(n[u],i[u]))return!1;return!0}else return!1;else return Array.isArray(i)?!1:t(n,i)}}),tf="partitionSelect",Jm=["typed","isNumeric","isNaN","compare"],ex=xe(tf,Jm,s=>{var{typed:e,isNumeric:t,isNaN:r,compare:n}=s,i=n,a=(c,h)=>-n(c,h);return e(tf,{"Array | Matrix, number":function(h,d){return u(h,d,i)},"Array | Matrix, number, string":function(h,d,p){if(p==="asc")return u(h,d,i);if(p==="desc")return u(h,d,a);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":u});function u(c,h,d){if(!bt(h)||h<0)throw new Error("k must be a non-negative integer");if(xt(c)){var p=c.size();if(p.length>1)throw new Error("Only one dimensional matrices supported");return f(c.valueOf(),h,d)}if(Array.isArray(c))return f(c,h,d)}function f(c,h,d){if(h>=c.length)throw new Error("k out of bounds");for(var p=0;p<c.length;p++)if(t(c[p])&&r(c[p]))return c[p];for(var v=0,x=c.length-1;v<x;){for(var _=v,y=x,m=c[Math.floor(Math.random()*(x-v+1))+v];_<y;)if(d(c[_],m)>=0){var w=c[y];c[y]=c[_],c[_]=w,--y}else++_;d(c[_],m)>0&&--_,h<=_?x=_:v=_+1}return c[h]}}),rf="max",tx=["typed","config","numeric","larger"],rx=xe(rf,tx,s=>{var{typed:e,config:t,numeric:r,larger:n}=s;return e(rf,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(f,c){return Ha(f,c.valueOf(),i)},"...":function(f){if(no(f))throw new TypeError("Scalar values expected in function max");return a(f)}});function i(u,f){try{return n(u,f)?u:f}catch(c){throw Pn(c,"max",f)}}function a(u){var f;if(ls(u,function(c){try{isNaN(c)&&typeof c=="number"?f=NaN:(f===void 0||n(c,f))&&(f=c)}catch(h){throw Pn(h,"max",c)}}),f===void 0)throw new Error("Cannot calculate max of an empty array");return typeof f=="string"&&(f=r(f,t.number)),f}}),nf="min",nx=["typed","config","numeric","smaller"],ix=xe(nf,nx,s=>{var{typed:e,config:t,numeric:r,smaller:n}=s;return e(nf,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(f,c){return Ha(f,c.valueOf(),i)},"...":function(f){if(no(f))throw new TypeError("Scalar values expected in function min");return a(f)}});function i(u,f){try{return n(u,f)?u:f}catch(c){throw Pn(c,"min",f)}}function a(u){var f;if(ls(u,function(c){try{isNaN(c)&&typeof c=="number"?f=NaN:(f===void 0||n(c,f))&&(f=c)}catch(h){throw Pn(h,"min",c)}}),f===void 0)throw new Error("Cannot calculate min of an empty array");return typeof f=="string"&&(f=r(f,t.number)),f}}),sf="add",sx=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],ox=xe(sf,sx,s=>{var{typed:e,matrix:t,addScalar:r,equalScalar:n,DenseMatrix:i,SparseMatrix:a,concat:u}=s,f=Lc({typed:e}),c=Kg({typed:e,equalScalar:n}),h=Rc({typed:e,DenseMatrix:i}),d=ni({typed:e,matrix:t,concat:u});return e(sf,{"any, any":r,"any, any, ...any":e.referToSelf(p=>(v,x,_)=>{for(var y=p(v,x),m=0;m<_.length;m++)y=p(y,_[m]);return y})},d({elop:r,DS:f,SS:c,Ss:h}))}),of="dot",ax=["typed","addScalar","multiplyScalar","conj","size"],ux=xe(of,ax,s=>{var{typed:e,addScalar:t,multiplyScalar:r,conj:n,size:i}=s;return e(of,{"Array | DenseMatrix, Array | DenseMatrix":u,"SparseMatrix, SparseMatrix":f});function a(h,d){var p=c(h),v=c(d),x,_;if(p.length===1)x=p[0];else if(p.length===2&&p[1]===1)x=p[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+p.join(", ")+")");if(v.length===1)_=v[0];else if(v.length===2&&v[1]===1)_=v[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+v.join(", ")+")");if(x!==_)throw new RangeError("Vectors must have equal length ("+x+" != "+_+")");if(x===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return x}function u(h,d){var p=a(h,d),v=xt(h)?h._data:h,x=xt(h)?h._datatype||h.getDataType():void 0,_=xt(d)?d._data:d,y=xt(d)?d._datatype||d.getDataType():void 0,m=c(h).length===2,w=c(d).length===2,D=t,A=r;if(x&&y&&x===y&&typeof x=="string"&&x!=="mixed"){var E=x;D=e.find(t,[E,E]),A=e.find(r,[E,E])}if(!m&&!w){for(var F=A(n(v[0]),_[0]),B=1;B<p;B++)F=D(F,A(n(v[B]),_[B]));return F}if(!m&&w){for(var M=A(n(v[0]),_[0][0]),O=1;O<p;O++)M=D(M,A(n(v[O]),_[O][0]));return M}if(m&&!w){for(var C=A(n(v[0][0]),_[0]),N=1;N<p;N++)C=D(C,A(n(v[N][0]),_[N]));return C}if(m&&w){for(var I=A(n(v[0][0]),_[0][0]),L=1;L<p;L++)I=D(I,A(n(v[L][0]),_[L][0]));return I}}function f(h,d){a(h,d);for(var p=h._index,v=h._values,x=d._index,_=d._values,y=0,m=t,w=r,D=0,A=0;D<p.length&&A<x.length;){var E=p[D],F=x[A];if(E<F){D++;continue}if(E>F){A++;continue}E===F&&(y=m(y,w(v[D],_[A])),D++,A++)}return y}function c(h){return xt(h)?h.size():i(h)}}),lx="trace",cx=["typed","matrix","add"],fx=xe(lx,cx,s=>{var{typed:e,matrix:t,add:r}=s;return e("trace",{Array:function(u){return n(t(u))},SparseMatrix:i,DenseMatrix:n,any:ut});function n(a){var u=a._size,f=a._data;switch(u.length){case 1:if(u[0]===1)return ut(f[0]);throw new RangeError("Matrix must be square (size: "+ft(u)+")");case 2:{var c=u[0],h=u[1];if(c===h){for(var d=0,p=0;p<c;p++)d=r(d,f[p][p]);return d}else throw new RangeError("Matrix must be square (size: "+ft(u)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+ft(u)+")")}}function i(a){var u=a._values,f=a._index,c=a._ptr,h=a._size,d=h[0],p=h[1];if(d===p){var v=0;if(u.length>0)for(var x=0;x<p;x++)for(var _=c[x],y=c[x+1],m=_;m<y;m++){var w=f[m];if(w===x){v=r(v,u[m]);break}if(w>x)break}return v}throw new RangeError("Matrix must be square (size: "+ft(h)+")")}}),af="det",hx=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],dx=xe(af,hx,s=>{var{typed:e,matrix:t,subtractScalar:r,multiply:n,divideScalar:i,isZero:a,unaryMinus:u}=s;return e(af,{any:function(h){return ut(h)},"Array | Matrix":function(h){var d;switch(xt(h)?d=h.size():Array.isArray(h)?(h=t(h),d=h.size()):d=[],d.length){case 0:return ut(h);case 1:if(d[0]===1)return ut(h.valueOf()[0]);if(d[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+ft(d)+")");case 2:{var p=d[0],v=d[1];if(p===v)return f(h.clone().valueOf(),p);if(v===0)return 1;throw new RangeError("Matrix must be square (size: "+ft(d)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+ft(d)+")")}}});function f(c,h,d){if(h===1)return ut(c[0][0]);if(h===2)return r(n(c[0][0],c[1][1]),n(c[1][0],c[0][1]));for(var p=!1,v=new Array(h).fill(0).map((B,M)=>M),x=0;x<h;x++){var _=v[x];if(a(c[_][x])){var y=void 0;for(y=x+1;y<h;y++)if(!a(c[v[y]][x])){_=v[y],v[y]=v[x],v[x]=_,p=!p;break}if(y===h)return c[_][x]}for(var m=c[_][x],w=x===0?1:c[v[x-1]][x-1],D=x+1;D<h;D++)for(var A=v[D],E=x+1;E<h;E++)c[A][E]=i(r(n(c[A][E],m),n(c[A][x],c[_][E])),w)}var F=c[v[h-1]][h-1];return p?u(F):F}}),uf="inv",px=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],_x=xe(uf,px,s=>{var{typed:e,matrix:t,divideScalar:r,addScalar:n,multiply:i,unaryMinus:a,det:u,identity:f,abs:c}=s;return e(uf,{"Array | Matrix":function(p){var v=xt(p)?p.size():Pt(p);switch(v.length){case 1:if(v[0]===1)return xt(p)?t([r(1,p.valueOf()[0])]):[r(1,p[0])];throw new RangeError("Matrix must be square (size: "+ft(v)+")");case 2:{var x=v[0],_=v[1];if(x===_)return xt(p)?t(h(p.valueOf(),x,_),p.storage()):h(p,x,_);throw new RangeError("Matrix must be square (size: "+ft(v)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+ft(v)+")")}},any:function(p){return r(1,p)}});function h(d,p,v){var x,_,y,m,w;if(p===1){if(m=d[0][0],m===0)throw Error("Cannot calculate inverse, determinant is zero");return[[r(1,m)]]}else if(p===2){var D=u(d);if(D===0)throw Error("Cannot calculate inverse, determinant is zero");return[[r(d[1][1],D),r(a(d[0][1]),D)],[r(a(d[1][0]),D),r(d[0][0],D)]]}else{var A=d.concat();for(x=0;x<p;x++)A[x]=A[x].concat();for(var E=f(p).valueOf(),F=0;F<v;F++){var B=c(A[F][F]),M=F;for(x=F+1;x<p;)c(A[x][F])>B&&(B=c(A[x][F]),M=x),x++;if(B===0)throw Error("Cannot calculate inverse, determinant is zero");x=M,x!==F&&(w=A[F],A[F]=A[x],A[x]=w,w=E[F],E[F]=E[x],E[x]=w);var O=A[F],C=E[F];for(x=0;x<p;x++){var N=A[x],I=E[x];if(x!==F){if(N[F]!==0){for(y=r(a(N[F]),O[F]),_=F;_<v;_++)N[_]=n(N[_],i(y,O[_]));for(_=0;_<v;_++)I[_]=n(I[_],i(y,C[_]))}}else{for(y=O[F],_=F;_<v;_++)N[_]=r(N[_],y);for(_=0;_<v;_++)I[_]=r(I[_],y)}}}return E}}}),lf="pinv",vx=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],gx=xe(lf,vx,s=>{var{typed:e,matrix:t,inv:r,deepEqual:n,equal:i,dotDivide:a,dot:u,ctranspose:f,divideScalar:c,multiply:h,add:d,Complex:p}=s;return e(lf,{"Array | Matrix":function(D){var A=xt(D)?D.size():Pt(D);switch(A.length){case 1:return m(D)?f(D):A[0]===1?r(D):a(f(D),u(D,D));case 2:{if(m(D))return f(D);var E=A[0],F=A[1];if(E===F)try{return r(D)}catch(B){if(!(B instanceof Error&&B.message.match(/Cannot calculate inverse, determinant is zero/)))throw B}return xt(D)?t(v(D.valueOf(),E,F),D.storage()):v(D,E,F)}default:throw new RangeError("Matrix must be two dimensional (size: "+ft(A)+")")}},any:function(D){return i(D,0)?ut(D):c(1,D)}});function v(w,D,A){var{C:E,F}=_(w,D,A),B=h(r(h(f(E),E)),f(E)),M=h(f(F),r(h(F,f(F))));return h(M,B)}function x(w,D,A){for(var E=ut(w),F=0,B=0;B<D;B++){if(A<=F)return E;for(var M=B;y(E[M][F]);)if(M++,D===M&&(M=B,F++,A===F))return E;[E[M],E[B]]=[E[B],E[M]];for(var O=E[B][F],C=0;C<A;C++)E[B][C]=a(E[B][C],O);for(var N=0;N<D;N++)if(N!==B){O=E[N][F];for(var I=0;I<A;I++)E[N][I]=d(E[N][I],h(-1,h(O,E[B][I])))}F++}return E}function _(w,D,A){var E=x(w,D,A),F=w.map((M,O)=>M.filter((C,N)=>N<D&&!y(u(E[N],E[N])))),B=E.filter((M,O)=>!y(u(E[O],E[O])));return{C:F,F:B}}function y(w){return i(d(w,p(1,1)),d(0,p(1,1)))}function m(w){return n(d(w,p(1,1)),d(h(w,0),p(1,1)))}}),mx="divide",xx=["typed","matrix","multiply","equalScalar","divideScalar","inv"],yx=xe(mx,xx,s=>{var{typed:e,matrix:t,multiply:r,equalScalar:n,divideScalar:i,inv:a}=s,u=ja({typed:e,equalScalar:n}),f=Ya({typed:e});return e("divide",Bl({"Array | Matrix, Array | Matrix":function(h,d){return r(h,a(d))},"DenseMatrix, any":function(h,d){return f(h,d,i,!1)},"SparseMatrix, any":function(h,d){return u(h,d,i,!1)},"Array, any":function(h,d){return f(t(h),d,i,!1).valueOf()},"any, Array | Matrix":function(h,d){return r(h,a(d))}},i.signatures))}),cf="sum",Dx=["typed","config","add","numeric"],wx=xe(cf,Dx,s=>{var{typed:e,config:t,add:r,numeric:n}=s;return e(cf,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":a,"...":function(f){if(no(f))throw new TypeError("Scalar values expected in function sum");return i(f)}});function i(u){var f;return ls(u,function(c){try{f=f===void 0?c:r(f,c)}catch(h){throw Pn(h,"sum",c)}}),f===void 0&&(f=n(0,t.number)),typeof f=="string"&&(f=n(f,t.number)),f}function a(u,f){try{var c=Ha(u,f,r);return c}catch(h){throw Pn(h,"sum")}}}),ff="median",Ex=["typed","add","divide","compare","partitionSelect"],bx=xe(ff,Ex,s=>{var{typed:e,add:t,divide:r,compare:n,partitionSelect:i}=s;function a(c){try{c=$a(c.valueOf());var h=c.length;if(h===0)throw new Error("Cannot calculate median of an empty array");if(h%2===0){for(var d=h/2-1,p=i(c,d+1),v=c[d],x=0;x<d;++x)n(c[x],v)>0&&(v=c[x]);return f(v,p)}else{var _=i(c,(h-1)/2);return u(_)}}catch(y){throw Pn(y,"median")}}var u=e({"number | BigNumber | Complex | Unit":function(h){return h}}),f=e({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(h,d){return r(t(h,d),2)}});return e(ff,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(h,d){throw new Error("median(A, dim) is not yet supported")},"...":function(h){if(no(h))throw new TypeError("Scalar values expected in function median");return a(h)}})}),Ax={},Cx=Object.freeze({__proto__:null,default:Ax}),Fx=Nt(Cx),_o=Av({config:br}),Ka=Mv({}),Za=Iv({}),Va=Lv({}),cn=kv({Matrix:Va}),Te=B_({BigNumber:_o,Complex:Ka,DenseMatrix:cn,Fraction:Za}),Bx=gg({typed:Te}),vo=xg({typed:Te}),Mx=ug({BigNumber:_o,typed:Te}),hf=om({typed:Te}),kn=Xv({config:br,typed:Te}),go=Uv({typed:Te}),Nx=Yv({typed:Te}),mo=Qg({typed:Te}),df=sg({typed:Te}),Ga=eg({Matrix:Va,equalScalar:kn,typed:Te}),pf=Dg({typed:Te}),_f=Zv({typed:Te}),Xa=_g({typed:Te}),vf=fg({Fraction:Za,typed:Te}),gf=Hv({typed:Te}),kt=dg({DenseMatrix:cn,Matrix:Va,SparseMatrix:Ga,typed:Te}),mf=Fm({isNaN:_f,isNumeric:gf,typed:Te}),cs=Om({bignumber:Mx,fraction:vf,number:df}),Sx=Mm({config:br,multiplyScalar:mo,numeric:cs,typed:Te}),Ox=xm({isInteger:go,matrix:kt,typed:Te}),xf=Dm({matrix:kt,config:br,typed:Te}),yf=Em({matrix:kt,typed:Te}),ii=um({isInteger:go,matrix:kt,typed:Te}),Ix=cm({prod:Sx,size:xf,typed:Te}),Tx=Am({conj:hf,transpose:yf,typed:Te}),fs=Tm({numeric:cs,typed:Te}),$x=Pm({DenseMatrix:cn,concat:ii,divideScalar:fs,equalScalar:kn,matrix:kt,typed:Te}),Df=Wm({DenseMatrix:cn,concat:ii,equalScalar:kn,matrix:kt,typed:Te}),wf=hm({BigNumber:_o,DenseMatrix:cn,SparseMatrix:Ga,config:br,matrix:kt,typed:Te}),Lx=pm({matrix:kt,multiplyScalar:mo,typed:Te}),Rx=Ym({DenseMatrix:cn,concat:ii,config:br,matrix:kt,typed:Te}),Px=rm({DenseMatrix:cn,concat:ii,equalScalar:kn,matrix:kt,subtractScalar:pf,typed:Te,unaryMinus:Xa}),hs=ox({DenseMatrix:cn,SparseMatrix:Ga,addScalar:vo,concat:ii,equalScalar:kn,matrix:kt,typed:Te}),Ef=zm({BigNumber:_o,DenseMatrix:cn,Fraction:Za,concat:ii,config:br,equalScalar:kn,matrix:kt,typed:Te}),kx=Qm({equal:Df,typed:Te}),bf=ux({addScalar:vo,conj:hf,multiplyScalar:mo,size:xf,typed:Te}),zx=Vm({DenseMatrix:cn,concat:ii,config:br,matrix:kt,typed:Te}),Qa=ix({config:br,numeric:cs,smaller:Rx,typed:Te}),Mi=em({addScalar:vo,dot:bf,equalScalar:kn,matrix:kt,multiplyScalar:mo,typed:Te}),qx=ex({compare:Ef,isNaN:_f,isNumeric:gf,typed:Te}),Ux=wx({add:hs,config:br,numeric:cs,typed:Te}),Wx=fx({add:hs,matrix:kt,typed:Te}),Af=dx({divideScalar:fs,isZero:Nx,matrix:kt,multiply:Mi,subtractScalar:pf,typed:Te,unaryMinus:Xa}),Hx=rx({config:br,larger:zx,numeric:cs,typed:Te}),xo=_x({abs:Bx,addScalar:vo,det:Af,divideScalar:fs,identity:wf,matrix:kt,multiply:Mi,typed:Te,unaryMinus:Xa}),jx=gx({Complex:Ka,add:hs,ctranspose:Tx,deepEqual:kx,divideScalar:fs,dot:bf,dotDivide:$x,equal:Df,inv:xo,matrix:kt,multiply:Mi,typed:Te}),Yx=Lm({Complex:Ka,config:br,fraction:vf,identity:wf,inv:xo,matrix:kt,multiply:Mi,number:df,typed:Te}),Kx=yx({divideScalar:fs,equalScalar:kn,inv:xo,matrix:kt,multiply:Mi,typed:Te}),Cf=bx({add:hs,compare:Ef,divide:Kx,partitionSelect:qx,typed:Te});class Zx{constructor(e,t,r){U(this,"_cacheData");U(this,"_variables");U(this,"_math");U(this,"_timeframe");this._cacheData={},this._variables=e,this._math=t,this._timeframe=r}alma({series:e,length:t,offset:r,sigma:n,floor:i},a){if(t===void 0||r===void 0||n===void 0)return;const u=this._cacheDataList(e,t,`alma_${a}`);if(u===void 0)return;let f=r*(t-1);i&&(f=Math.floor(f));const c=t/n;let h=0,d=0;for(let p=0;p<=t-1;p++){const v=Math.exp(-1*Math.pow(p-f,2)/(2*Math.pow(c,2)));h+=v,d+=u[u.length-1-(t-p-1)]*v}return d/h}sma({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return;let n=0;const i=this._cacheDataList(e,t,`sma_${r}`);if(i===void 0)return;const a=i.slice(-t);return n=Ux(...a)/t,n}rma({source:e,length:t},r){if(e===void 0||t===void 0||isNaN(e))return;this._cacheDataList(e,t,`sma_${r}`);const{sum:n}=this._cacheData[`rma_${r}`]||{},i=1/t,a=n===void 0?this.sma({source:e,length:t},r):i*e+(1-i)*(n||0);return this._cacheDataHandle(`rma_${r}`,{sum:a}),a}atr({length:e},t){const{high:r,close:n}=this._cacheData[`atr_${t}`]||{},{high:i,close:a,low:u}=this._variables,f=r===void 0?i-u:Math.max(Math.max(i-u,Math.abs(i-n)),Math.abs(u-n));return this._cacheDataHandle(`atr_${t}`,{high:i,close:a}),this.rma({source:f,length:e},t)}barssince({condition:e},t){let{count:r}=this._cacheData[`barssince_${t}`]||{};if(e)r=0;else{if(r===void 0)return;r+=1}return this._cacheDataHandle(`barssince_${t}`,{count:r}),r}stdev({source:e,length:t,biased:r=!0},n){if(e===void 0||isNaN(e)||t===void 0)return;const i=this._cacheDataList(e,t,`stdev_${n}`),a=this.sma({source:e,length:t},n);if(i===void 0)return;let u=0;for(let f=0;f<t;f++){const c=this._sum(i[i.length-1-f],-(a||0));u+=c*c}return r||t<=1?Math.sqrt(u/t):Math.sqrt(u/(t-1))}_sum(e,t){let n=e+t;return Math.abs(n)<=1e-10&&(n=0),n}bb({series:e,length:t,mult:r},n){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return[];const i=this.sma({source:e,length:t},n),a=this.stdev({source:e,length:t},n);if(i===void 0||a===void 0)return[];const u=r*a;return[i,i+u,i-u]}bbw({series:e,length:t,mult:r},n){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return;const i=this.sma({source:e,length:t},n),a=this.stdev({source:e,length:t},n);if(i===void 0||a===void 0)return;const u=r*a;return(i+u-(i-u))/i}cci({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return;const n=this.sma({source:e,length:t},r),i=this.dev({source:e,length:t},r);if(!(n===void 0||i===void 0))return(e-n)/(.015*i)}change({source:e,length:t=1},r){const n=this._cacheData[`change_${r}`]||[];n[this._variables.bar_index]=e,this._cacheData[`change_${r}`]=n;const i=n[n.length-1-t];if(!(e===void 0||isNaN(e)))return i===void 0?i:typeof e=="boolean"?i!==e:e-i}cmo({series:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return;const n=this.change({source:e},r);if(n===void 0)return;const i=this._math.sum({source:n>=0?n:0,length:t},`sm1_${r}`),a=this._math.sum({source:n>=0?0:-n,length:t},`sm2_${r}`);if(!(i===void 0||a===void 0))return 100*(i-a)/(i+a)}cog({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return;const n=this._cacheDataList(e,t,`cog_${r}`),i=this._math.sum({source:e,length:t},r);if(i===void 0||n===void 0)return;let a=0;for(let u=0;u<t;u++){const f=n[n.length-1-u];a+=f*(u+1)}return-a/i}correlation({source1:e,source2:t,length:r},n){if(e===void 0||isNaN(e)||t===void 0||isNaN(t)||r===void 0)return;const i=this._cacheDataList([e,t],r,`correlation_${n}`),a=this.sma({source:e,length:r},`sma1_${n}`),u=this.sma({source:t,length:r},`sma2_${n}`);if(a===void 0||u===void 0||i===void 0)return;let f=0,c=0,h=0;for(let p=0;p<r;p++){const[v,x]=i[i.length-1-p],_=v-a,y=x-u;f+=_*y,c+=_*_,h+=y*y}return isNaN(c)||isNaN(f)||isNaN(h)?void 0:f/Math.sqrt(c*h)}cross({source1:e,source2:t},r){if(e===void 0||t===void 0)return!1;const{source1:n,source2:i}=this._cacheData[`cross_${r}`]||{};return this._cacheDataHandle(`cross_${r}`,{source1:e,source2:t}),n===void 0||i===void 0?!1:n>=i&&e<t||n<=i&&e>t}crossover({source1:e,source2:t},r){if(e===void 0||t===void 0)return!1;const{source1:n,source2:i}=this._cacheData[`crossover_${r}`]||{};return this._cacheDataHandle(`crossover_${r}`,{source1:e,source2:t}),n===void 0||i===void 0?!1:n<=i&&e>t}crossunder({source1:e,source2:t},r){if(e===void 0||t===void 0)return!1;const{source1:n,source2:i}=this._cacheData[`crossunder_${r}`]||{};return this._cacheDataHandle(`crossunder_${r}`,{source1:e,source2:t}),n===void 0||i===void 0?!1:n>=i&&e<t}cum({source:e=0},t){e=isNaN(e)?0:e;let{sum:r}=this._cacheData[`cum_${t}`]||{};return r=r||0,r+=e,this._cacheDataHandle(`cum_${t}`,{sum:r}),r}dev({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return;const n=this.sma({source:e,length:t},r);let i=0;const a=this._cacheDataList(e,t,`dev_${r}`);if(!(!a||n===void 0)){for(let u=0;u<t;u++){const f=a[a.length-1-u];i+=Math.abs(f-n)}return i/t}}dmi({diLength:e,adxSmoothing:t},r){if(e===void 0||t===void 0)return[void 0,void 0,void 0];const n=`dmi_${r}`,{low:i,high:a,close:u,PDMS:f,NDMS:c,TRS:h,ADX:d,count:p=0}=this._cacheData[n]||{},{low:v,high:x,close:_}=this._variables;if(i===void 0||a===void 0||u===void 0)return this._cacheData[n]={low:v,high:x,close:_,PDMS:f,NDMS:c,TRS:x-v,count:1},[void 0,void 0,void 0];let y=x-a,m=i-v;y=y>m&&y>0?y:0,m=m>y&&m>0?m:0,y===m&&(y=m=0);const w=Math.max(x-v,Math.abs(x-u),Math.abs(v-u));if(p<e)return this._cacheDataHandle(n,{low:v,high:x,close:_,PDMS:(f||0)+y,NDMS:(c||0)+m,TRS:(h||0)+w,count:p+1}),[void 0,void 0,void 0];{const D=f-f/e+y,A=c-c/e+m,E=h-h/e+w,F=D/E*100,B=A/E*100,M=Math.abs((F-B)/(F+B))*100;let O=M,C=[F,B,void 0];if(p+1-e<t){const N=p+1-e;O=((d||0)*(N-1)+M)/N}else O=(d*(t-1)+M)/t,C=[F,B,O];return this._cacheDataHandle(n,{low:v,high:x,close:_,PDMS:D,NDMS:A,TRS:E,ADX:O,count:p+1}),C}}ema({source:e,length:t},r){if(e===void 0||t===void 0||isNaN(e))return;let{sum:n,count:i=1}=this._cacheData[`ema_${r}`]||{};const a=this.sma({source:e,length:t},r);if(i>t){const u=2/(t+1);n=n===void 0?e:u*e+(1-u)*(n||0)}else n=a;return i+=1,this._cacheDataHandle(`ema_${r}`,{sum:n,count:i}),n}falling({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return!1;const{source:n,fallings:i=[]}=this._cacheData[`falling_${r}`]||{};i.push(n>e);const a=i.slice(-t);return this._cacheDataHandle(`falling_${r}`,{source:e,fallings:a}),a.length<t?!1:a.every(u=>u)}rising({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return!1;const{source:n,risings:i=[]}=this._cacheData[`rising_${r}`]||{};i.push(n<e);const a=i.slice(-t);return this._cacheDataHandle(`rising_${r}`,{source:e,risings:a}),a.length<t?!1:a.every(u=>u)}highest({source:e,length:t},r){if(t===void 0||t<=0)return;const{high:n}=this._variables,i=this._cacheDataList(typeof e!="number"?n:e,t,`highest_${r}`);if(i)return Math.max(...i.slice(-t))}highestbars({source:e,length:t},r){if(t===void 0||t<=0)return;const{high:n}=this._variables,i=this._cacheDataList(typeof e!="number"?n:e,t,`highestbars_${r}`);return i?i.slice(-t).reduce((u,f,c,h)=>f>=h[u]?c:u,0)-t+1:void 0}wma({source:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const n=this._cacheDataList(e,t,`wma_${r}`);if(!n)return;let i=0,a=0;for(let u=0;u<t;u++){const f=(t-u)*t;i+=f,a+=n[n.length-1-u]*f}return a/i}hma({source:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const n=this.wma({source:e,length:t},r),i=this.wma({source:e,length:Math.round(t/2)},r);return n===void 0||i===void 0?void 0:this.wma({source:2*i-n,length:Math.floor(Math.sqrt(t))},`hma_${r}`)}kc({series:e,length:t,mult:r,useTrueRange:n=!0},i){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return[void 0,void 0,void 0];const a=this.ema({source:e,length:t},i),{ta:u,high:f,low:c}=this._variables,h=n?u.tr:f-c,d=this.ema({source:h,length:t},`range_${i}`);return[a,a+d*r,a-d*r]}kcw({series:e,length:t,mult:r,useTrueRange:n=!0},i){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return;const a=this.ema({source:e,length:t},i),{ta:u,high:f,low:c}=this._variables,h=n?u.tr:f-c,d=this.ema({source:h,length:t},`range_${i}`);return(a+d*r-(a-d*r))/a}linreg({source:e,length:t,offset:r},n){if(t===void 0||r===void 0)return;const i=this._cacheDataList(e,t,`dev_${n}`);if(!i)return;const a=i.slice(-t).filter(v=>v!==void 0);let u=0,f=0,c=0,h=0;for(const[v,x]of a.entries())u+=v,f+=x,c+=v*x,h+=v*v;const d=(t*c-u*f)/(t*h-u*u);return(f-d*u)/t+d*(t-1-r)}lowest({source:e,length:t},r){if(t===void 0||t<=0)return;const{low:n}=this._variables,i=this._cacheDataList(typeof e!="number"?n:e,t,`lowest_${r}`);if(i)return Math.min(...i.slice(-t))}lowestbars({source:e,length:t},r){if(t===void 0||t<=0)return;const{low:n}=this._variables,i=this._cacheDataList(typeof e!="number"?n:e,t,`lowestbars_${r}`);return i?i.slice(-t).reduce((u,f,c,h)=>f<=h[u]?c:u,0)-t+1:void 0}macd({source:e,fastlen:t,slowlen:r,siglen:n},i){if(e===void 0||isNaN(e)||t===void 0||r===void 0||n===void 0)return[void 0,void 0,void 0];const a=this.ema({source:e,length:t},`ema1_${i}`),u=this.ema({source:e,length:r},`ema2_${i}`);if(a===void 0||u===void 0)return[void 0,void 0,void 0];const f=a-u,c=this.ema({source:f,length:n},`macd_${i}`);if(c===void 0)return[f,c,void 0];const h=f-c;return[f,c,h]}max({source:e},t){if(e===void 0||isNaN(e))return;let r=this._cacheData[`max_${t}`]||0;return e>r&&(r=e),this._cacheData[`max_${t}`]=r,r}min({source:e},t){if(e===void 0||isNaN(e))return;let r=this._cacheData[`min_${t}`]||1/0;return e<r&&(r=e),this._cacheData[`min_${t}`]=r,r}median({source:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const n=this._cacheDataList(e,t,`dev_${r}`);if(n)return Cf(n.slice(-t))}mfi({series:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const{volume:n}=this._variables,i=this.change({source:e},r),a=this._math.sum({source:n*(i>=0?0:e),length:t},`lower_${r}`),u=this._math.sum({source:n*(i<=0?0:e),length:t},`upper_${r}`);if(!(u===void 0||a===void 0))return 100-100/(1+u/a)}mode({source:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const n=this._cacheDataList(e,t,`mode_${r}`);if(n)return Qa(mf(n.slice(-t)))}mom({source:e,length:t},r){if(t===void 0||t<0)return;const n=`mom_${r}`,i=this._cacheData[n]||[];if(i[this._variables.bar_index]=e,this._cacheData[n]=i,i.length<=t||e===void 0||isNaN(e))return;let a=i.length-t-1,u;for(;u===void 0&&a>=0;)u=i[a],a--;return u===void 0?u:e-u}percentile_linear_interpolation({source:e,length:t,percentage:r},n){if(t===void 0||r===void 0||t<0||r<0||r>100)return;const i=this._cacheDataList(e,t+1,`percentile_linear_interpolation_${n}`);if(!i)return;const a=this._sort(i.slice(-(t+1))),u=a.length;r/=100;const f=1/(u*2);if(r<=f)return a[0];if(r>=1-1/(u*2))return a[u-1];for(const[c,h]of a.entries()){const d=a[c-1];if(r<(c+.5)/u)return d===void 0||h===void 0?void 0:d+(h-d)*(r-(c-.5)/u)/(1/u)}}percentile_nearest_rank({source:e,length:t,percentage:r},n){if(t===void 0||r===void 0||e===void 0||isNaN(e)||t<0||r<0||r>100)return;const i=this._cacheDataList(e,t,`percentile_nearest_rank_${n}`);if(!i)return;const a=this._sort(i.slice(-t)),u=r/100*a.length,f=Math.ceil(u)-1;return a[f>=a.length?a.length-1:f]}percentrank({source:e,length:t},r){if(t===void 0||t<0)return;const n=this._cacheDataList(e,t+1,`percentile_nearest_rank_${r}`);if(!n)return;const i=n.slice(-(t+1)),a=e;if(a===void 0)return;let u=0;for(let f=0;f<i.length;f++)i[f]!==void 0&&(i[f]<a||i[f]===a&&f<t)&&u++;return u/(i.length-1)*100}pivot_point_levels({type:e,anchor:t,developing:r},n){const i=new it;let{close:a,open:u,low:f,high:c}=this._variables;const h=`pivot_point_levels_${n}`,{close:d,low:p,high:v,open:x,result:_}=this._cacheData[h]||{};if(!t&&(v&&p&&(c=Math.max(v,c),f=Math.min(p,f)),this._cacheDataHandle(h,{close:a,open:u,low:f,high:c,result:_}),!r))return i._value=_||[],i;const y={close:a,open:u,low:f,high:c};t===!0&&!r&&(a=d,u=x,f=p,c=v);const m=this._getPivotPointLevels(c,f,a,u,r,e);return this._cacheDataHandle(h,{...y,result:m}),i._value=m,i}_getPivotPointLevels(e,t,r,n,i,a){if(r===void 0||n===void 0||t===void 0||e===void 0)return[];switch(a){case ti.traditional:return this._traditional(e,t,r);case ti.fibonacci:return this._fibonacci(e,t,r);case ti.woodie:return i?[]:this._woodie(e,t);case ti.classic:return this._classic(e,t,r);case ti.dm:return this._DM(e,t,r,n);case ti.camarilla:return this._camarilla(e,t,r);default:return[]}}_traditional(e,t,r){const n=(e+t+r)/3,i=n*2-t,a=n+(e-t),u=n*2+(e-2*t),f=n*3+(e-3*t),c=n*4+(e-4*t),h=n*2-e,d=n-(e-t),p=n*2-(2*e-t),v=n*3-(3*e-t),x=n*4-(4*e-t);return[n,i,h,a,d,u,p,f,v,c,x]}_fibonacci(e,t,r){const n=(e+t+r)/3,i=n+.382*(e-t),a=n-.382*(e-t),u=n+.618*(e-t),f=n-.618*(e-t),c=n+(e-t),h=n-(e-t);return[n,i,a,u,f,c,h]}_woodie(e,t){const{open:r}=this._variables,n=(e+t+2*r)/4,i=2*n-t,a=2*n-e,u=n+(e-t),f=n-(e-t),c=e+2*(n-t),h=t-2*(e-n),d=c+(e-t),p=h-(e-t);return[n,i,a,u,f,c,h,d,p]}_classic(e,t,r){const n=(e+t+r)/3,i=2*n-t,a=2*n-e,u=n+(e-t),f=n-(e-t),c=n+2*(e-t),h=n-2*(e-t),d=n+3*(e-t),p=n-3*(e-t);return[n,i,a,u,f,c,h,d,p]}_DM(e,t,r,n){let i;n===r?i=e+t+2*r:r>n?i=2*e+t+r:i=2*t+e+r;const a=i/4,u=i/2-t,f=i/2-e;return[a,u,f]}_camarilla(e,t,r){const n=(e+t+r)/3,i=r+1.1*(e-t)/12,a=r-1.1*(e-t)/12,u=r+1.1*(e-t)/6,f=r-1.1*(e-t)/6,c=r+1.1*(e-t)/4,h=r-1.1*(e-t)/4,d=r+1.1*(e-t)/2,p=r-1.1*(e-t)/2,v=e/t*r,x=r-(v-r);return[n,i,a,u,f,c,h,d,p,v,x]}pivothigh({source:e=this._variables.high,leftbars:t,rightbars:r},n){if(t===void 0||r===void 0||t<0||r<0)return;const i=this._cacheDataList(e,t+r+1,`pivothigh_${n}`);if(!i)return;const a=i.slice(-(t+r+1)),u=a[t];return Math.max(...a)===u?u:void 0}pivotlow({source:e=this._variables.low,leftbars:t,rightbars:r},n){if(t===void 0||r===void 0||t<0||r<0)return;const i=this._cacheDataList(e,t+r+1,`pivotlow_${n}`);if(!i)return;const a=i.slice(-(t+r+1)),u=a[t];return Math.min(...a)===u?u:void 0}range({source:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<0)return;const n=this._cacheDataList(e,t,`range_${r}`);if(!n)return;const i=n.filter(f=>f!==void 0).slice(-t),a=Math.max(...i),u=Math.min(...i);return a-u}roc({source:e,length:t},r){if(t===void 0||t<0)return;const n=this._cacheDataList(e,t+1,`roc_${r}`),i=this.change({source:e,length:t},r);if(n)return 100*i/n[n.length-1-t]}rsi({source:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<0)return;const{source:n}=this._cacheData[`rsi_${r}`]||{},i=Math.max(e-n,0),a=Math.max(n-e,0),u=this.rma({source:i,length:t},`rma1_${r}`),f=this.rma({source:a,length:t},`rma2_${r}`);if(this._cacheDataHandle(`rsi_${r}`,{source:e}),!(u===void 0||f===void 0))return 100-100/(1+u/f)}sar({start:e,inc:t,max:r},n){if(e===void 0||t===void 0||r===void 0)return;const{close:i,low:a,high:u,preLow:f,preHigh:c,data:h={}}=this._cacheData[`sar_${n}`]||{};let{result:d,maxMin:p,acceleration:v,isBelow:x}=h,_=!1;const{close:y,low:m,high:w,bar_index:D}=this._variables;return D===1&&(y>i?(x=!0,p=w,d=a):(x=!1,p=m,d=u),_=!0,v=e),d=d+v*(p-d),x?d>m&&(_=!0,x=!1,d=Math.max(w,p||0),p=m,v=e):d<w&&(_=!0,x=!0,d=Math.min(m,p||0),p=w,v=e),_||(x?w>(p||0)&&(p=w,v=Math.min((v||0)+t,r)):m<(p||0)&&(p=m,v=Math.min((v||0)+t,r))),x?(d=Math.min(d,a),D>1&&(d=Math.min(d,f))):(d=Math.max(d,u),D>1&&(d=Math.max(d,c))),this._cacheDataHandle(`sar_${n}`,{high:w,close:y,low:m,preLow:a,preHigh:u,data:Object.assign(h,{result:d,maxMin:p,acceleration:v,isBelow:x})}),d}stoch({source:e,high:t,low:r,length:n},i){if(n===void 0||t===void 0||r===void 0||e===void 0||isNaN(e)||n<0)return;const a=this.lowest({source:r,length:n},i),u=this.highest({source:t,length:n},i);if(!(a===void 0||u===void 0))return 100*(this._variables.close-a)/(u-a)}supertrend({factor:e,atrPeriod:t},r){if(e===void 0||t===void 0)return[void 0,void 0];const{hl2:n,close:i}=this._variables,a=`supertrend_${r}`,{upperBand:u,lowerBand:f,superTrend:c,atr:h,close:d}=this._cacheData[a]||{},p=this.atr({length:t},r);if(p===void 0)return this._cacheDataHandle(a,{close:i}),[void 0,void 0];let v=n+e*p,x=n-e*p;const _=u||0,y=f||0;x=x>y||d<y?x:y,v=v<_||d>_?v:_;let m;h===void 0?m=1:c===_?m=i>v?-1:1:m=i<x?1:-1;const w=m===-1?x:v;return this._cacheDataHandle(a,{upperBand:v,lowerBand:x,superTrend:w,atr:p,close:i}),[w,m]}swma({source:e},t){let{list:r}=this._cacheData[`swma_${t}`]||{};if(r||(r=[]),r.push(e),r=r.slice(-4),this._cacheDataHandle(`swma_${t}`,{list:r}),!(r.filter(n=>n!==void 0).length<4))return r[3]*1/6+r[2]*2/6+r[1]*2/6+r[0]*1/6}tr({handle_na:e=!1},t){const{close:r,low:n,high:i}=this._variables,{close:a}=this._cacheData[`tr_${t}`]||{};return this._cacheDataHandle(`tr_${t}`,{close:r}),a===void 0?e?i-n:void 0:Math.max(i-n,Math.abs(i-a),Math.abs(n-a))}tsi({source:e,short_length:t,long_length:r},n){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return;const i=this.change({source:e},n);if(i===void 0)return;const a=this.ema({source:Math.abs(i),length:t},`absema1_${n}`),u=this.ema({source:i,length:t},`ema1_${n}`);if(u===void 0)return;const f=this.ema({source:u,length:r},`ema2_${n}`),c=this.ema({source:a,length:t},`absema2_${n}`);if(f!==void 0)return f/c}valuewhen({condition:e,source:t,occurrence:r},n){if(t===void 0||r===void 0||r<0)return;let{list:i}=this._cacheData[`valuewhen_${n}`]||{};return i||(i=[]),e&&i.push(t),this._cacheDataHandle(`valuewhen_${n}`,{list:i}),i[i.length-1-r]}variance({source:e,length:t,biased:r=!0},n){if(e===void 0||isNaN(e)||t===void 0||t<0)return;const i=this.sma({source:e,length:t},n),a=this._cacheDataList(e,t,`mode_${n}`);if(!a||i===void 0)return;const u=a.filter(c=>c!==void 0&&!isNaN(c)).slice(-t);if(u.length<t)return;const f=u.reduce((c,h)=>c+Math.pow(h-i,2),0);if(f!==void 0)return r||t<=1?f/t:f/(t-1)}vwap({source:e,anchor:t,stdev_mult:r},n){if(e===void 0)return;t=t===void 0?this._timeframe.change({timeframe:"1D"},n):t;const{volume:i}=this._variables;let{sum:a=0,sumV:u=0,count:f=0,isReset:c,sumS:h=0}=this._cacheData[`vwap_${n}`]||{};if(t&&(a=u=f=h=0,c=!0),!c)return r!==void 0?[]:void 0;const d=e*i+a,p=i+u,v=d/p;return f++,r!==void 0?(h=i*Math.pow(e,2)+h,this._cacheDataHandle(`vwap_${n}`,{sum:d,sumV:p,count:f,isReset:c,sumS:h}),this._computeBands(h,p,r,v)):(this._cacheDataHandle(`vwap_${n}`,{sum:d,sumV:p,count:f,isReset:c}),v)}_computeBands(e,t,r,n){let i=e/t-Math.pow(n,2);i=i<0?0:i;const a=Math.sqrt(i),u=a!==void 0&&!isNaN(a)?n+r*a:void 0,f=a!==void 0&&!isNaN(a)?n-r*a:void 0;return[n,u,f]}vwma({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0||t<=0)return;const{volume:n}=this._variables,i=this.sma({source:e*n,length:t},`sma1_${r}`),a=this.sma({source:n,length:t},`sma2_${r}`);if(!(i===void 0||a===void 0))return i/a}wpr({length:e},t){if(e===void 0||e<=0)return;const r=this.highest({length:e},t),n=this.lowest({length:e},t),{close:i}=this._variables;if(!(r===void 0||n===void 0))return(r-i)/(r-n)*-100}_sort(e){const t=e.length;for(let r=0;r<t;r++){let n={};for(let i=0;i<t-r;i++){const{currentVal:a,currentIndex:u}=n,f=e[i];if(f!==void 0){if(a!==void 0&&f<a){e.splice(i,1),e.splice(u,0,f),n={currentIndex:u+1,currentVal:a};continue}n={currentIndex:i,currentVal:f}}}}return e}_cacheDataList(e,t,r){const n=this._cacheData[r]||{barIndex:-1,list:[]},{bar_index:i}=this._variables;if(n.barIndex<=i&&(n.barIndex===i?n.list[n.list.length-1]=e:n.list.push(e),n.barIndex=i,this._cacheData[r]=n),!(n.list.length<t))return n.list}_cacheDataHandle(e,t){const{barIndex:r}=this._cacheData[e]||{};r!==this._variables.bar_index&&(this._cacheData[e]=Object.assign(t,{barIndex:this._variables.bar_index}))}}class Vx{constructor(e,t,r){U(this,"_cacheData");U(this,"_variables");U(this,"_errorListener");U(this,"_historyInputs");U(this,"_name");this._cacheData={},this._variables=e,this._errorListener=t,this._name=`inputs_${r}`,this._historyInputs=self.workerStorage.get(this._name)||{}}update(e){for(const t of e){const r=t.id;this._cacheData[r]=Object.assign(this._cacheData[r]||{},{...t,isModify:!0}),self.workerStorage.updateValue(this._name,`in_${t.index}`,{modifyDefval:t.sourceTypeName||t.defval})}}input(e,t){return this._cacheHandle(e,t)}int(e,t){return this._cacheHandle(e,t,ur.INT)}bool(e,t){return this._cacheHandle(e,t,ur.BOOL)}color(e,t){return this._cacheHandle(e,t,ur.COLOR)}time(e,t){return this._cacheHandle(e,t,ur.TIME)}float(e,t){return this._cacheHandle(e,t,ur.FLOAT)}price(e,t){return this._cacheHandle(e,t,ur.PRICE)}source(e,t){return this._cacheHandle(e,t,ur.SOURCE)}string(e,t){return this._cacheHandle(e,t,ur.STRING)}symbol(e,t){return this._cacheHandle(e,t,ur.SYMBOL)}session(e,t){return this._cacheHandle(e,t,ur.SESSION)}text_area(e,t){return this._cacheHandle(e,t,ur.TEXT_AREA)}timeframe(e,t){return this._cacheHandle(e,t,ur.TIMEFRAME)}enum(e,t){return this._cacheHandle(e,t,ur.ENUM)}_cacheHandle(e,t,r){if(t.startsWith("export"))return e.defval;const n=`${r||"input"}_${t}`,i=this._cacheData[n];if(e.defval===void 0&&this._errorListener.addError(ct.inputDefvalErr,t,Ze.Error),i)i.isModify?i.sourceTypeName&&(this._cacheData[n].defval=this._variables[i.sourceTypeName]):Object.assign(this._cacheData[n],e);else{const{defval:a,display:u}=e;this._displayVerify(t,u),e={inputType:r,...e},this._cacheData[n]=e,this._judgeHistoryInputs(e),(r||e.inputType)===ur.SOURCE?this._cacheData[n].options=m1:e.options&&!e.options.includes(a)&&this._errorListener.addError(Zt(ct.inputOptErr,{defval:String(a),args:e.options.toString()}),t,Ze.Error,6+((r==null?void 0:r.length)||-1))}return this._cacheData[n].defval}_judgeHistoryInputs(e){const{defval:t,sourceTypeName:r,index:n}=e;let i=r||t;const a=`in_${n}`,u=this._historyInputs[a];if(!u)self.workerStorage.setValue(this._name,a,{defval:i});else{const{defval:f,modifyDefval:c}=u;f===i?i=c||i:self.workerStorage.setValue(this._name,a,{defval:i})}r?e.sourceTypeName=i:e.defval=i}_displayVerify(e,t){!t||!t.length||t.includes(Vt.dataWindow)||t.includes(Vt.statusLine)||this._errorListener.addError(Zt(ct.displayErr,{func:"input",values:"[display.none, display.data_window, display.status_line, display.all]"}),e,Ze.Error)}getInputs(){const e=Object.keys(this._cacheData),t=[];for(const r of e){const n=this._cacheData[r];n.id=r,t.push(n)}return t.sort((r,n)=>(r.index||0)-(n.index||0))}}class Gx{color({x:e}){return e}new({color:e,transp:t=100}){me(t)&&(t=100);const r=(100-t)/100,{r:n,g:i,b:a}=this._parseColor(e||"");return`rgba(${Math.round(n)}, ${Math.round(i)}, ${Math.round(a)}, ${r})`}rgb({red:e=0,green:t=0,blue:r=0,transp:n=0}){return me(n)&&(n=0),me(e)&&(e=0),me(t)&&(t=0),me(r)&&(r=0),`rgba(${e}, ${t}, ${r}, ${(100-n)/100})`}g({color:e}){return e?this._parseColor(e).g:0}r({color:e}){return e?this._parseColor(e).r:0}b({color:e}){return e?this._parseColor(e).b:0}t({color:e}){return e?Math.round(this._parseColor(e).a*100):0}from_gradient({value:e,bottom_value:t,top_value:r,bottom_color:n,top_color:i}){if(me(e)||me(t)||me(r)||r===t)return"rgba(0,0,0,1)";const a=(e-t)/(r-t),u=Math.min(Math.max(a,0),1),{r:f,g:c,b:h,a:d}=this._parseColor(n||"rgba(0,0,0,0)"),{r:p,g:v,b:x,a:_}=this._parseColor(i||"rgba(0,0,0,0)"),y=f+u*(p-f),m=c+u*(v-c),w=h+u*(x-h),D=d+u*(_-d);return`rgba(${Math.round(y)}, ${Math.round(m)}, ${Math.round(w)}, ${D.toFixed(2)})`}_parseColor(e){let t,r,n,i;if(e.startsWith("#")){t=parseInt(e.substring(1,3),16),r=parseInt(e.substring(3,5),16),n=parseInt(e.substring(5,7),16);const a=e.substring(7);a?i=parseInt(a,16)/255:i=1}else{const a=this._parserRgbColor(e);t=a[0]||0,r=a[1]||0,n=a[2]||0,i=a[3]||1}return{r:t,g:r,b:n,a:i}}_parserRgbColor(e){var t;return((t=e.match(/\d+/g))==null?void 0:t.map(Number))||[]}}var We={};const Xx=Object.prototype.toString;function ds(s){const e=Xx.call(s);return e.endsWith("Array]")&&!e.includes("Big")}var Qx=Object.freeze({__proto__:null,isAnyArray:ds}),Jx=Nt(Qx);function ey(s){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!ds(s))throw new TypeError("input must be an array");if(s.length===0)throw new TypeError("input must not be empty");var t=e.fromIndex,r=t===void 0?0:t,n=e.toIndex,i=n===void 0?s.length:n;if(r<0||r>=s.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(i<=r||i>s.length||!Number.isInteger(i))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=s[r],u=r+1;u<i;u++)s[u]>a&&(a=s[u]);return a}function ty(s){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!ds(s))throw new TypeError("input must be an array");if(s.length===0)throw new TypeError("input must not be empty");var t=e.fromIndex,r=t===void 0?0:t,n=e.toIndex,i=n===void 0?s.length:n;if(r<0||r>=s.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(i<=r||i>s.length||!Number.isInteger(i))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=s[r],u=r+1;u<i;u++)s[u]<a&&(a=s[u]);return a}function ry(s){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(ds(s)){if(s.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var t;if(e.output!==void 0){if(!ds(e.output))throw new TypeError("output option must be an array if specified");t=e.output}else t=new Array(s.length);var r=ty(s),n=ey(s);if(r===n)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var i=e.min,a=i===void 0?e.autoMinMax?r:0:i,u=e.max,f=u===void 0?e.autoMinMax?n:1:u;if(a>=f)throw new RangeError("min option must be smaller than max option");for(var c=(f-a)/(n-r),h=0;h<s.length;h++)t[h]=(s[h]-r)*c+a;return t}var ny=Object.freeze({__proto__:null,default:ry}),iy=Nt(ny);Object.defineProperty(We,"__esModule",{value:!0});var gr=Jx,Ff=iy;const yo=" ".repeat(2),Bf=" ".repeat(4);function sy(){return Mf(this)}function Mf(s,e={}){const{maxRows:t=15,maxColumns:r=10,maxNumSize:n=8,padMinus:i="auto"}=e;return`${s.constructor.name} {
52
+ **/(function(s,e){(function(t){var r=2e3,n={s:1,n:0,d:1};function i(m,w){if(isNaN(m=parseInt(m,10)))throw _();return m*w}function a(m,w){if(w===0)throw x();var D=Object.create(v.prototype);D.s=m<0?-1:1,m=m<0?-m:m;var C=p(m,w);return D.n=m/C,D.d=w/C,D}function u(m){for(var w={},D=m,C=2,b=4;b<=D;){for(;D%C===0;)D/=C,w[C]=(w[C]||0)+1;b+=1+2*C++}return D!==m?D>1&&(w[D]=(w[D]||0)+1):w[m]=(w[m]||0)+1,w}var f=function(m,w){var D=0,C=1,b=1,F=0,B=0,M=0,O=1,A=1,N=0,I=1,L=1,k=1,z=1e7,R;if(m!=null)if(w!==void 0){if(D=m,C=w,b=D*C,D%1!==0||C%1!==0)throw y()}else switch(typeof m){case"object":{if("d"in m&&"n"in m)D=m.n,C=m.d,"s"in m&&(D*=m.s);else if(0 in m)D=m[0],1 in m&&(C=m[1]);else throw _();b=D*C;break}case"number":{if(m<0&&(b=m,m=-m),m%1===0)D=m;else if(m>0){for(m>=1&&(A=Math.pow(10,Math.floor(1+Math.log(m)/Math.LN10)),m/=A);I<=z&&k<=z;)if(R=(N+L)/(I+k),m===R){I+k<=z?(D=N+L,C=I+k):k>I?(D=L,C=k):(D=N,C=I);break}else m>R?(N+=L,I+=k):(L+=N,k+=I),I>z?(D=L,C=k):(D=N,C=I);D*=A}else(isNaN(m)||isNaN(w))&&(C=D=NaN);break}case"string":{if(I=m.match(/\d+|./g),I===null)throw _();if(I[N]==="-"?(b=-1,N++):I[N]==="+"&&N++,I.length===N+1?B=i(I[N++],b):I[N+1]==="."||I[N]==="."?(I[N]!=="."&&(F=i(I[N++],b)),N++,(N+1===I.length||I[N+1]==="("&&I[N+3]===")"||I[N+1]==="'"&&I[N+3]==="'")&&(B=i(I[N],b),O=Math.pow(10,I[N].length),N++),(I[N]==="("&&I[N+2]===")"||I[N]==="'"&&I[N+2]==="'")&&(M=i(I[N+1],b),A=Math.pow(10,I[N+1].length)-1,N+=3)):I[N+1]==="/"||I[N+1]===":"?(B=i(I[N],b),O=i(I[N+2],1),N+=3):I[N+3]==="/"&&I[N+1]===" "&&(F=i(I[N],b),B=i(I[N+2],b),O=i(I[N+4],1),N+=5),I.length<=N){C=O*A,b=D=M+C*F+A*B;break}}default:throw _()}if(C===0)throw x();n.s=b<0?-1:1,n.n=Math.abs(D),n.d=Math.abs(C)};function c(m,w,D){for(var C=1;w>0;m=m*m%D,w>>=1)w&1&&(C=C*m%D);return C}function h(m,w){for(;w%2===0;w/=2);for(;w%5===0;w/=5);if(w===1)return 0;for(var D=10%w,C=1;D!==1;C++)if(D=D*10%w,C>r)return 0;return C}function d(m,w,D){for(var C=1,b=c(10,D,w),F=0;F<300;F++){if(C===b)return F;C=C*10%w,b=b*10%w}return 0}function p(m,w){if(!m)return w;if(!w)return m;for(;;){if(m%=w,!m)return w;if(w%=m,!w)return m}}function v(m,w){if(f(m,w),this instanceof v)m=p(n.d,n.n),this.s=n.s,this.n=n.n/m,this.d=n.d/m;else return a(n.s*n.n,n.d)}var x=function(){return new Error("Division by Zero")},_=function(){return new Error("Invalid argument")},y=function(){return new Error("Parameters must be integer")};v.prototype={s:1,n:0,d:1,abs:function(){return a(this.n,this.d)},neg:function(){return a(-this.s*this.n,this.d)},add:function(m,w){return f(m,w),a(this.s*this.n*n.d+n.s*this.d*n.n,this.d*n.d)},sub:function(m,w){return f(m,w),a(this.s*this.n*n.d-n.s*this.d*n.n,this.d*n.d)},mul:function(m,w){return f(m,w),a(this.s*n.s*this.n*n.n,this.d*n.d)},div:function(m,w){return f(m,w),a(this.s*n.s*this.n*n.d,this.d*n.n)},clone:function(){return a(this.s*this.n,this.d)},mod:function(m,w){if(isNaN(this.n)||isNaN(this.d))return new v(NaN);if(m===void 0)return a(this.s*this.n%this.d,1);if(f(m,w),n.n===0&&this.d===0)throw x();return a(this.s*(n.d*this.n)%(n.n*this.d),n.d*this.d)},gcd:function(m,w){return f(m,w),a(p(n.n,this.n)*p(n.d,this.d),n.d*this.d)},lcm:function(m,w){return f(m,w),n.n===0&&this.n===0?a(0,1):a(n.n*this.n,p(n.n,this.n)*p(n.d,this.d))},ceil:function(m){return m=Math.pow(10,m||0),isNaN(this.n)||isNaN(this.d)?new v(NaN):a(Math.ceil(m*this.s*this.n/this.d),m)},floor:function(m){return m=Math.pow(10,m||0),isNaN(this.n)||isNaN(this.d)?new v(NaN):a(Math.floor(m*this.s*this.n/this.d),m)},round:function(m){return m=Math.pow(10,m||0),isNaN(this.n)||isNaN(this.d)?new v(NaN):a(Math.round(m*this.s*this.n/this.d),m)},inverse:function(){return a(this.s*this.d,this.n)},pow:function(m,w){if(f(m,w),n.d===1)return n.s<0?a(Math.pow(this.s*this.d,n.n),Math.pow(this.n,n.n)):a(Math.pow(this.s*this.n,n.n),Math.pow(this.d,n.n));if(this.s<0)return null;var D=u(this.n),C=u(this.d),b=1,F=1;for(var B in D)if(B!=="1"){if(B==="0"){b=0;break}if(D[B]*=n.n,D[B]%n.d===0)D[B]/=n.d;else return null;b*=Math.pow(B,D[B])}for(var B in C)if(B!=="1"){if(C[B]*=n.n,C[B]%n.d===0)C[B]/=n.d;else return null;F*=Math.pow(B,C[B])}return n.s<0?a(F,b):a(b,F)},equals:function(m,w){return f(m,w),this.s*this.n*n.d===n.s*n.n*this.d},compare:function(m,w){f(m,w);var D=this.s*this.n*n.d-n.s*n.n*this.d;return(0<D)-(D<0)},simplify:function(m){if(isNaN(this.n)||isNaN(this.d))return this;m=m||.001;for(var w=this.abs(),D=w.toContinued(),C=1;C<D.length;C++){for(var b=a(D[C-1],1),F=C-2;F>=0;F--)b=b.inverse().add(D[F]);if(Math.abs(b.sub(w).valueOf())<m)return b.mul(this.s)}return this},divisible:function(m,w){return f(m,w),!(!(n.n*this.d)||this.n*n.d%(n.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(m){var w,D="",C=this.n,b=this.d;return this.s<0&&(D+="-"),b===1?D+=C:(m&&(w=Math.floor(C/b))>0&&(D+=w,D+=" ",C%=b),D+=C,D+="/",D+=b),D},toLatex:function(m){var w,D="",C=this.n,b=this.d;return this.s<0&&(D+="-"),b===1?D+=C:(m&&(w=Math.floor(C/b))>0&&(D+=w,C%=b),D+="\\frac{",D+=C,D+="}{",D+=b,D+="}"),D},toContinued:function(){var m,w=this.n,D=this.d,C=[];if(isNaN(w)||isNaN(D))return C;do C.push(Math.floor(w/D)),m=w%D,w=D,D=m;while(w!==1);return C},toString:function(m){var w=this.n,D=this.d;if(isNaN(w)||isNaN(D))return"NaN";m=m||15;var C=h(w,D),b=d(w,D,C),F=this.s<0?"-":"";if(F+=w/D|0,w%=D,w*=10,w&&(F+="."),C){for(var B=b;B--;)F+=w/D|0,w%=D,w*=10;F+="(";for(var B=C;B--;)F+=w/D|0,w%=D,w*=10;F+=")"}else for(var B=m;w&&B--;)F+=w/D|0,w%=D,w*=10;return F}},Object.defineProperty(v,"__esModule",{value:!0}),v.default=v,v.Fraction=v,s.exports=v})()})(pc);var Nv=pc.exports,xn=tt(Nv),Sv="Fraction",Ov=[],Iv=xe(Sv,Ov,()=>(Object.defineProperty(xn,"name",{value:"Fraction"}),xn.prototype.constructor=xn,xn.prototype.type="Fraction",xn.prototype.isFraction=!0,xn.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},xn.fromJSON=function(s){return new xn(s)},xn),{isClass:!0}),Tv="Matrix",$v=[],Lv=xe(Tv,$v,()=>{function s(){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator")}return s.prototype.type="Matrix",s.prototype.isMatrix=!0,s.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},s.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},s.prototype.create=function(e,t){throw new Error("Cannot invoke create on a Matrix interface")},s.prototype.subset=function(e,t,r){throw new Error("Cannot invoke subset on a Matrix interface")},s.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},s.prototype.set=function(e,t,r){throw new Error("Cannot invoke set on a Matrix interface")},s.prototype.resize=function(e,t){throw new Error("Cannot invoke resize on a Matrix interface")},s.prototype.reshape=function(e,t){throw new Error("Cannot invoke reshape on a Matrix interface")},s.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},s.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},s.prototype.map=function(e,t){throw new Error("Cannot invoke map on a Matrix interface")},s.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},s.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},s.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},s.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},s.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},s.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},s},{isClass:!0});function _c(s){return Object.keys(s.signatures||{}).reduce(function(e,t){var r=(t.match(/,/g)||[]).length+1;return Math.max(e,r)},-1)}var Rv="DenseMatrix",Pv=["Matrix"],kv=xe(Rv,Pv,s=>{var{Matrix:e}=s;function t(h,d){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(d&&!un(d))throw new Error("Invalid datatype: "+d);if(xt(h))h.type==="DenseMatrix"?(this._data=ut(h._data),this._size=ut(h._size),this._datatype=d||h._datatype):(this._data=h.toArray(),this._size=h.size(),this._datatype=d||h._datatype);else if(h&&Ft(h.data)&&Ft(h.size))this._data=h.data,this._size=h.size,Wl(this._data,this._size),this._datatype=d||h.datatype;else if(Ft(h))this._data=c(h),this._size=Pt(this._data),Wl(this._data,this._size),this._datatype=d;else{if(h)throw new TypeError("Unsupported type of data ("+On(h)+")");this._data=[],this._size=[0],this._datatype=d}}t.prototype=new e,t.prototype.createDenseMatrix=function(h,d){return new t(h,d)},Object.defineProperty(t,"name",{value:"DenseMatrix"}),t.prototype.constructor=t,t.prototype.type="DenseMatrix",t.prototype.isDenseMatrix=!0,t.prototype.getDataType=function(){return Ks(this._data,On)},t.prototype.storage=function(){return"dense"},t.prototype.datatype=function(){return this._datatype},t.prototype.create=function(h,d){return new t(h,d)},t.prototype.subset=function(h,d,p){switch(arguments.length){case 1:return r(this,h);case 2:case 3:return i(this,h,d,p);default:throw new SyntaxError("Wrong number of arguments")}},t.prototype.get=function(h){if(!Ft(h))throw new TypeError("Array expected");if(h.length!==this._size.length)throw new rt(h.length,this._size.length);for(var d=0;d<h.length;d++)Bt(h[d],this._size[d]);for(var p=this._data,v=0,x=h.length;v<x;v++){var _=h[v];Bt(_,p.length),p=p[_]}return p},t.prototype.set=function(h,d,p){if(!Ft(h))throw new TypeError("Array expected");if(h.length<this._size.length)throw new rt(h.length,this._size.length,"<");var v,x,_,y=h.map(function(w){return w+1});f(this,y,p);var m=this._data;for(v=0,x=h.length-1;v<x;v++)_=h[v],Bt(_,m.length),m=m[_];return _=h[h.length-1],Bt(_,m.length),m[_]=d,this};function r(h,d){if(!Aa(d))throw new TypeError("Invalid index");var p=d.isScalar();if(p)return h.get(d.min());var v=d.size();if(v.length!==h._size.length)throw new rt(v.length,h._size.length);for(var x=d.min(),_=d.max(),y=0,m=h._size.length;y<m;y++)Bt(x[y],h._size[y]),Bt(_[y],h._size[y]);return new t(n(h._data,d,v.length,0),h._datatype)}function n(h,d,p,v){var x=v===p-1,_=d.dimension(v);return x?_.map(function(y){return Bt(y,h.length),h[y]}).valueOf():_.map(function(y){Bt(y,h.length);var m=h[y];return n(m,d,p,v+1)}).valueOf()}function i(h,d,p,v){if(!d||d.isIndex!==!0)throw new TypeError("Invalid index");var x=d.size(),_=d.isScalar(),y;if(xt(p)?(y=p.size(),p=p.valueOf()):y=Pt(p),_){if(y.length!==0)throw new TypeError("Scalar expected");h.set(d.min(),p,v)}else{if(!Di(y,x))try{y.length===0?p=Vl([p],x):p=Vl(p,x),y=Pt(p)}catch{}if(x.length<h._size.length)throw new rt(x.length,h._size.length,"<");if(y.length<x.length){for(var m=0,w=0;x[m]===1&&y[m]===1;)m++;for(;x[m]===1;)w++,m++;p=jl(p,x.length,w,y)}if(!Di(x,y))throw new rt(x,y,">");var D=d.max().map(function(F){return F+1});f(h,D,v);var C=x.length,b=0;a(h._data,d,p,C,b)}return h}function a(h,d,p,v,x){var _=x===v-1,y=d.dimension(x);_?y.forEach(function(m,w){Bt(m),h[m]=p[w[0]]}):y.forEach(function(m,w){Bt(m),a(h[m],d,p[w[0]],v,x+1)})}t.prototype.resize=function(h,d,p){if(!os(h))throw new TypeError("Array or Matrix expected");var v=h.valueOf().map(_=>Array.isArray(_)&&_.length===1?_[0]:_),x=p?this.clone():this;return u(x,v,d)};function u(h,d,p){if(d.length===0){for(var v=h._data;Ft(v);)v=v[0];return v}return h._size=d.slice(0),h._data=Sa(h._data,h._size,p),h}t.prototype.reshape=function(h,d){var p=d?this.clone():this;p._data=Ia(p._data,h);var v=p._size.reduce((x,_)=>x*_);return p._size=Ta(h,v),p};function f(h,d,p){for(var v=h._size.slice(0),x=!1;v.length<d.length;)v.push(0),x=!0;for(var _=0,y=d.length;_<y;_++)d[_]>v[_]&&(v[_]=d[_],x=!0);x&&u(h,v,p)}t.prototype.clone=function(){var h=new t({data:ut(this._data),size:ut(this._size),datatype:this._datatype});return h},t.prototype.size=function(){return this._size.slice(0)},t.prototype.map=function(h){var d=this,p=_c(h),v=function y(m,w){return Ft(m)?m.map(function(D,C){return y(D,w.concat(C))}):p===1?h(m):p===2?h(m,w):h(m,w,d)},x=v(this._data,[]),_=this._datatype!==void 0?Ks(x,On):void 0;return new t(x,_)},t.prototype.forEach=function(h){var d=this,p=function v(x,_){Ft(x)?x.forEach(function(y,m){v(y,_.concat(m))}):h(x,_,d)};p(this._data,[])},t.prototype[Symbol.iterator]=function*(){var h=function*d(p,v){if(Ft(p))for(var x=0;x<p.length;x++)yield*d(p[x],v.concat(x));else yield{value:p,index:v}};yield*h(this._data,[])},t.prototype.rows=function(){var h=[],d=this.size();if(d.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");var p=this._data;for(var v of p)h.push(new t([v],this._datatype));return h},t.prototype.columns=function(){var h=this,d=[],p=this.size();if(p.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var v=this._data,x=function(m){var w=v.map(D=>[D[m]]);d.push(new t(w,h._datatype))},_=0;_<p[1];_++)x(_);return d},t.prototype.toArray=function(){return ut(this._data)},t.prototype.valueOf=function(){return this._data},t.prototype.format=function(h){return ft(this._data,h)},t.prototype.toString=function(){return ft(this._data)},t.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},t.prototype.diagonal=function(h){if(h){if(Ot(h)&&(h=h.toNumber()),!_t(h)||!Et(h))throw new TypeError("The parameter k must be an integer number")}else h=0;for(var d=h>0?h:0,p=h<0?-h:0,v=this._size[0],x=this._size[1],_=Math.min(v-p,x-d),y=[],m=0;m<_;m++)y[m]=this._data[m+p][m+d];return new t({data:y,size:[_],datatype:this._datatype})},t.diagonal=function(h,d,p,v){if(!Ft(h))throw new TypeError("Array expected, size parameter");if(h.length!==2)throw new Error("Only two dimensions matrix are supported");if(h=h.map(function(B){if(Ot(B)&&(B=B.toNumber()),!_t(B)||!Et(B)||B<1)throw new Error("Size values must be positive integers");return B}),p){if(Ot(p)&&(p=p.toNumber()),!_t(p)||!Et(p))throw new TypeError("The parameter k must be an integer number")}else p=0;var x=p>0?p:0,_=p<0?-p:0,y=h[0],m=h[1],w=Math.min(y-_,m-x),D;if(Ft(d)){if(d.length!==w)throw new Error("Invalid value array length");D=function(M){return d[M]}}else if(xt(d)){var C=d.size();if(C.length!==1||C[0]!==w)throw new Error("Invalid matrix length");D=function(M){return d.get([M])}}else D=function(){return d};v||(v=Ot(D(0))?D(0).mul(0):0);var b=[];if(h.length>0){b=Sa(b,h,v);for(var F=0;F<w;F++)b[F+_][F+x]=D(F)}return new t({data:b,size:[y,m]})},t.fromJSON=function(h){return new t(h)},t.prototype.swapRows=function(h,d){if(!_t(h)||!Et(h)||!_t(d)||!Et(d))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return Bt(h,this._size[0]),Bt(d,this._size[0]),t._swapRows(h,d,this._data),this},t._swapRows=function(h,d,p){var v=p[h];p[h]=p[d],p[d]=v};function c(h){return xt(h)?c(h.valueOf()):Ft(h)?h.map(c):h}return t},{isClass:!0});function zv(s){var e=s.length,t=s[0].length,r,n,i=[];for(n=0;n<t;n++){var a=[];for(r=0;r<e;r++)a.push(s[r][n]);i.push(a)}return i}function no(s){for(var e=0;e<s.length;e++)if(os(s[e]))return!0;return!1}function ls(s,e){xt(s)&&(s=s.valueOf());for(var t=0,r=s.length;t<r;t++){var n=s[t];Array.isArray(n)?ls(n,e):e(n)}}function Jr(s,e,t){return s&&typeof s.map=="function"?s.map(function(r){return Jr(r,e)}):e(s)}function Ha(s,e,t){var r=Array.isArray(s)?Pt(s):s.size();if(e<0||e>=r.length)throw new In(e,r.length);return xt(s)?s.create(io(s.valueOf(),e,t)):io(s,e,t)}function io(s,e,t){var r,n,i,a;if(e<=0)if(Array.isArray(s[0])){for(a=zv(s),n=[],r=0;r<a.length;r++)n[r]=io(a[r],e-1,t);return n}else{for(i=s[0],r=1;r<s.length;r++)i=t(i,s[r]);return i}else{for(n=[],r=0;r<s.length;r++)n[r]=io(s[r],e-1,t);return n}}var vc="isInteger",qv=["typed"],Uv=xe(vc,qv,s=>{var{typed:e}=s;return e(vc,{number:Et,BigNumber:function(r){return r.isInt()},Fraction:function(r){return r.d===1&&isFinite(r.n)},"Array | Matrix":e.referToSelf(t=>r=>Jr(r,t))})}),gc="number",so="number, number";function mc(s){return Math.abs(s)}mc.signature=gc;function xc(s,e){return s+e}xc.signature=so;function yc(s,e){return s-e}yc.signature=so;function Dc(s,e){return s*e}Dc.signature=so;function wc(s){return-s}wc.signature=gc;function bc(s,e){return s*s<1&&e===1/0||s*s>1&&e===-1/0?0:Math.pow(s,e)}bc.signature=so;var Ec="number";function Cc(s){return s===0}Cc.signature=Ec;function Ac(s){return Number.isNaN(s)}Ac.signature=Ec;var Fc="isNumeric",Wv=["typed"],Hv=xe(Fc,Wv,s=>{var{typed:e}=s;return e(Fc,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":e.referToSelf(t=>r=>Jr(r,t))})}),Bc="isZero",jv=["typed"],Yv=xe(Bc,jv,s=>{var{typed:e}=s;return e(Bc,{number:Cc,BigNumber:function(r){return r.isZero()},Complex:function(r){return r.re===0&&r.im===0},Fraction:function(r){return r.d===1&&r.n===0},Unit:e.referToSelf(t=>r=>e.find(t,r.valueType())(r.value)),"Array | Matrix":e.referToSelf(t=>r=>Jr(r,t))})}),Mc="isNaN",Kv=["typed"],Zv=xe(Mc,Kv,s=>{var{typed:e}=s;return e(Mc,{number:Ac,BigNumber:function(r){return r.isNaN()},Fraction:function(r){return!1},Complex:function(r){return r.isNaN()},Unit:function(r){return Number.isNaN(r.value)},"Array | Matrix":function(r){return Jr(r,Number.isNaN)}})});function oo(s,e,t){if(t==null)return s.eq(e);if(s.eq(e))return!0;if(s.isNaN()||e.isNaN())return!1;if(s.isFinite()&&e.isFinite()){var r=s.minus(e).abs();if(r.isZero())return!0;var n=s.constructor.max(s.abs(),e.abs());return r.lte(n.times(t))}return!1}function Vv(s,e,t){return ri(s.re,e.re,t)&&ri(s.im,e.im,t)}var ao=xe("compareUnits",["typed"],s=>{var{typed:e}=s;return{"Unit, Unit":e.referToSelf(t=>(r,n)=>{if(!r.equalBase(n))throw new Error("Cannot compare units with different base");return e.find(t,[r.valueType(),n.valueType()])(r.value,n.value)})}}),uo="equalScalar",Gv=["typed","config"],Xv=xe(uo,Gv,s=>{var{typed:e,config:t}=s,r=ao({typed:e});return e(uo,{"boolean, boolean":function(i,a){return i===a},"number, number":function(i,a){return ri(i,a,t.epsilon)},"BigNumber, BigNumber":function(i,a){return i.eq(a)||oo(i,a,t.epsilon)},"Fraction, Fraction":function(i,a){return i.equals(a)},"Complex, Complex":function(i,a){return Vv(i,a,t.epsilon)}},r)});xe(uo,["typed","config"],s=>{var{typed:e,config:t}=s;return e(uo,{"number, number":function(n,i){return ri(n,i,t.epsilon)}})});var Qv="SparseMatrix",Jv=["typed","equalScalar","Matrix"],eg=xe(Qv,Jv,s=>{var{typed:e,equalScalar:t,Matrix:r}=s;function n(_,y){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(y&&!un(y))throw new Error("Invalid datatype: "+y);if(xt(_))i(this,_,y);else if(_&&Ft(_.index)&&Ft(_.ptr)&&Ft(_.size))this._values=_.values,this._index=_.index,this._ptr=_.ptr,this._size=_.size,this._datatype=y||_.datatype;else if(Ft(_))a(this,_,y);else{if(_)throw new TypeError("Unsupported type of data ("+On(_)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=y}}function i(_,y,m){y.type==="SparseMatrix"?(_._values=y._values?ut(y._values):void 0,_._index=ut(y._index),_._ptr=ut(y._ptr),_._size=ut(y._size),_._datatype=m||y._datatype):a(_,y.valueOf(),m||y._datatype)}function a(_,y,m){_._values=[],_._index=[],_._ptr=[],_._datatype=m;var w=y.length,D=0,C=t,b=0;if(un(m)&&(C=e.find(t,[m,m])||t,b=e.convert(0,m)),w>0){var F=0;do{_._ptr.push(_._index.length);for(var B=0;B<w;B++){var M=y[B];if(Ft(M)){if(F===0&&D<M.length&&(D=M.length),F<M.length){var O=M[F];C(O,b)||(_._values.push(O),_._index.push(B))}}else F===0&&D<1&&(D=1),C(M,b)||(_._values.push(M),_._index.push(B))}F++}while(F<D)}_._ptr.push(_._index.length),_._size=[w,D]}n.prototype=new r,n.prototype.createSparseMatrix=function(_,y){return new n(_,y)},Object.defineProperty(n,"name",{value:"SparseMatrix"}),n.prototype.constructor=n,n.prototype.type="SparseMatrix",n.prototype.isSparseMatrix=!0,n.prototype.getDataType=function(){return Ks(this._values,On)},n.prototype.storage=function(){return"sparse"},n.prototype.datatype=function(){return this._datatype},n.prototype.create=function(_,y){return new n(_,y)},n.prototype.density=function(){var _=this._size[0],y=this._size[1];return _!==0&&y!==0?this._index.length/(_*y):0},n.prototype.subset=function(_,y,m){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return u(this,_);case 2:case 3:return f(this,_,y,m);default:throw new SyntaxError("Wrong number of arguments")}};function u(_,y){if(!Aa(y))throw new TypeError("Invalid index");var m=y.isScalar();if(m)return _.get(y.min());var w=y.size();if(w.length!==_._size.length)throw new rt(w.length,_._size.length);var D,C,b,F,B=y.min(),M=y.max();for(D=0,C=_._size.length;D<C;D++)Bt(B[D],_._size[D]),Bt(M[D],_._size[D]);var O=_._values,A=_._index,N=_._ptr,I=y.dimension(0),L=y.dimension(1),k=[],z=[];I.forEach(function(ee,te){z[ee]=te[0],k[ee]=!0});var R=O?[]:void 0,V=[],H=[];return L.forEach(function(ee){for(H.push(V.length),b=N[ee],F=N[ee+1];b<F;b++)D=A[b],k[D]===!0&&(V.push(z[D]),R&&R.push(O[b]))}),H.push(V.length),new n({values:R,index:V,ptr:H,size:w,datatype:_._datatype})}function f(_,y,m,w){if(!y||y.isIndex!==!0)throw new TypeError("Invalid index");var D=y.size(),C=y.isScalar(),b;if(xt(m)?(b=m.size(),m=m.toArray()):b=Pt(m),C){if(b.length!==0)throw new TypeError("Scalar expected");_.set(y.min(),m,w)}else{if(D.length!==1&&D.length!==2)throw new rt(D.length,_._size.length,"<");if(b.length<D.length){for(var F=0,B=0;D[F]===1&&b[F]===1;)F++;for(;D[F]===1;)B++,F++;m=jl(m,D.length,B,b)}if(!Di(D,b))throw new rt(D,b,">");if(D.length===1){var M=y.dimension(0);M.forEach(function(N,I){Bt(N),_.set([N,0],m[I[0]],w)})}else{var O=y.dimension(0),A=y.dimension(1);O.forEach(function(N,I){Bt(N),A.forEach(function(L,k){Bt(L),_.set([N,L],m[I[0]][k[0]],w)})})}}return _}n.prototype.get=function(_){if(!Ft(_))throw new TypeError("Array expected");if(_.length!==this._size.length)throw new rt(_.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var y=_[0],m=_[1];Bt(y,this._size[0]),Bt(m,this._size[1]);var w=c(y,this._ptr[m],this._ptr[m+1],this._index);return w<this._ptr[m+1]&&this._index[w]===y?this._values[w]:0},n.prototype.set=function(_,y,m){if(!Ft(_))throw new TypeError("Array expected");if(_.length!==this._size.length)throw new rt(_.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var w=_[0],D=_[1],C=this._size[0],b=this._size[1],F=t,B=0;un(this._datatype)&&(F=e.find(t,[this._datatype,this._datatype])||t,B=e.convert(0,this._datatype)),(w>C-1||D>b-1)&&(p(this,Math.max(w+1,C),Math.max(D+1,b),m),C=this._size[0],b=this._size[1]),Bt(w,C),Bt(D,b);var M=c(w,this._ptr[D],this._ptr[D+1],this._index);return M<this._ptr[D+1]&&this._index[M]===w?F(y,B)?h(M,D,this._values,this._index,this._ptr):this._values[M]=y:F(y,B)||d(M,w,D,y,this._values,this._index,this._ptr),this};function c(_,y,m,w){if(m-y===0)return m;for(var D=y;D<m;D++)if(w[D]===_)return D;return y}function h(_,y,m,w,D){m.splice(_,1),w.splice(_,1);for(var C=y+1;C<D.length;C++)D[C]--}function d(_,y,m,w,D,C,b){D.splice(_,0,w),C.splice(_,0,y);for(var F=m+1;F<b.length;F++)b[F]++}n.prototype.resize=function(_,y,m){if(!os(_))throw new TypeError("Array or Matrix expected");var w=_.valueOf().map(C=>Array.isArray(C)&&C.length===1?C[0]:C);if(w.length!==2)throw new Error("Only two dimensions matrix are supported");w.forEach(function(C){if(!_t(C)||!Et(C)||C<0)throw new TypeError("Invalid size, must contain positive integers (size: "+ft(w)+")")});var D=m?this.clone():this;return p(D,w[0],w[1],y)};function p(_,y,m,w){var D=w||0,C=t,b=0;un(_._datatype)&&(C=e.find(t,[_._datatype,_._datatype])||t,b=e.convert(0,_._datatype),D=e.convert(D,_._datatype));var F=!C(D,b),B=_._size[0],M=_._size[1],O,A,N;if(m>M){for(A=M;A<m;A++)if(_._ptr[A]=_._values.length,F)for(O=0;O<B;O++)_._values.push(D),_._index.push(O);_._ptr[m]=_._values.length}else m<M&&(_._ptr.splice(m+1,M-m),_._values.splice(_._ptr[m],_._values.length),_._index.splice(_._ptr[m],_._index.length));if(M=m,y>B){if(F){var I=0;for(A=0;A<M;A++){_._ptr[A]=_._ptr[A]+I,N=_._ptr[A+1]+I;var L=0;for(O=B;O<y;O++,L++)_._values.splice(N+L,0,D),_._index.splice(N+L,0,O),I++}_._ptr[M]=_._values.length}}else if(y<B){var k=0;for(A=0;A<M;A++){_._ptr[A]=_._ptr[A]-k;var z=_._ptr[A],R=_._ptr[A+1]-k;for(N=z;N<R;N++)O=_._index[N],O>y-1&&(_._values.splice(N,1),_._index.splice(N,1),k++)}_._ptr[A]=_._values.length}return _._size[0]=y,_._size[1]=m,_}n.prototype.reshape=function(_,y){if(!Ft(_))throw new TypeError("Array expected");if(_.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");_.forEach(function(ee){if(!_t(ee)||!Et(ee)||ee<=-2||ee===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+ft(_)+")")});var m=this._size[0]*this._size[1];_=Ta(_,m);var w=_[0]*_[1];if(m!==w)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var D=y?this.clone():this;if(this._size[0]===_[0]&&this._size[1]===_[1])return D;for(var C=[],b=0;b<D._ptr.length;b++)for(var F=0;F<D._ptr[b+1]-D._ptr[b];F++)C.push(b);for(var B=D._values.slice(),M=D._index.slice(),O=0;O<D._index.length;O++){var A=M[O],N=C[O],I=A*D._size[1]+N;C[O]=I%_[1],M[O]=Math.floor(I/_[1])}D._values.length=0,D._index.length=0,D._ptr.length=_[1]+1,D._size=_.slice();for(var L=0;L<D._ptr.length;L++)D._ptr[L]=0;for(var k=0;k<B.length;k++){var z=M[k],R=C[k],V=B[k],H=c(z,D._ptr[R],D._ptr[R+1],D._index);d(H,z,R,V,D._values,D._index,D._ptr)}return D},n.prototype.clone=function(){var _=new n({values:this._values?ut(this._values):void 0,index:ut(this._index),ptr:ut(this._ptr),size:ut(this._size),datatype:this._datatype});return _},n.prototype.size=function(){return this._size.slice(0)},n.prototype.map=function(_,y){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var m=this,w=this._size[0],D=this._size[1],C=_c(_),b=function(B,M,O){return C===1?_(B):C===2?_(B,[M,O]):_(B,[M,O],m)};return v(this,0,w-1,0,D-1,b,y)};function v(_,y,m,w,D,C,b){var F=[],B=[],M=[],O=t,A=0;un(_._datatype)&&(O=e.find(t,[_._datatype,_._datatype])||t,A=e.convert(0,_._datatype));for(var N=function(Y,Q,pe){Y=C(Y,Q,pe),O(Y,A)||(F.push(Y),B.push(Q))},I=w;I<=D;I++){M.push(F.length);var L=_._ptr[I],k=_._ptr[I+1];if(b)for(var z=L;z<k;z++){var R=_._index[z];R>=y&&R<=m&&N(_._values[z],R-y,I-w)}else{for(var V={},H=L;H<k;H++){var ee=_._index[H];V[ee]=_._values[H]}for(var te=y;te<=m;te++){var j=te in V?V[te]:0;N(j,te-y,I-w)}}}return M.push(F.length),new n({values:F,index:B,ptr:M,size:[m-y+1,D-w+1]})}n.prototype.forEach=function(_,y){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var m=this,w=this._size[0],D=this._size[1],C=0;C<D;C++){var b=this._ptr[C],F=this._ptr[C+1];if(y)for(var B=b;B<F;B++){var M=this._index[B];_(this._values[B],[M,C],m)}else{for(var O={},A=b;A<F;A++){var N=this._index[A];O[N]=this._values[A]}for(var I=0;I<w;I++){var L=I in O?O[I]:0;_(L,[I,C],m)}}}},n.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var _=this._size[1],y=0;y<_;y++)for(var m=this._ptr[y],w=this._ptr[y+1],D=m;D<w;D++){var C=this._index[D];yield{value:this._values[D],index:[C,y]}}},n.prototype.toArray=function(){return x(this._values,this._index,this._ptr,this._size,!0)},n.prototype.valueOf=function(){return x(this._values,this._index,this._ptr,this._size,!1)};function x(_,y,m,w,D){var C=w[0],b=w[1],F=[],B,M;for(B=0;B<C;B++)for(F[B]=[],M=0;M<b;M++)F[B][M]=0;for(M=0;M<b;M++)for(var O=m[M],A=m[M+1],N=O;N<A;N++)B=y[N],F[B][M]=_?D?ut(_[N]):_[N]:1;return F}return n.prototype.format=function(_){for(var y=this._size[0],m=this._size[1],w=this.density(),D="Sparse Matrix ["+ft(y,_)+" x "+ft(m,_)+"] density: "+ft(w,_)+`
53
+ `,C=0;C<m;C++)for(var b=this._ptr[C],F=this._ptr[C+1],B=b;B<F;B++){var M=this._index[B];D+=`
54
+ (`+ft(M,_)+", "+ft(C,_)+") ==> "+(this._values?ft(this._values[B],_):"X")}return D},n.prototype.toString=function(){return ft(this.toArray())},n.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},n.prototype.diagonal=function(_){if(_){if(Ot(_)&&(_=_.toNumber()),!_t(_)||!Et(_))throw new TypeError("The parameter k must be an integer number")}else _=0;var y=_>0?_:0,m=_<0?-_:0,w=this._size[0],D=this._size[1],C=Math.min(w-m,D-y),b=[],F=[],B=[];B[0]=0;for(var M=y;M<D&&b.length<C;M++)for(var O=this._ptr[M],A=this._ptr[M+1],N=O;N<A;N++){var I=this._index[N];if(I===M-y+m){b.push(this._values[N]),F[b.length-1]=I-m;break}}return B.push(b.length),new n({values:b,index:F,ptr:B,size:[C,1]})},n.fromJSON=function(_){return new n(_)},n.diagonal=function(_,y,m,w,D){if(!Ft(_))throw new TypeError("Array expected, size parameter");if(_.length!==2)throw new Error("Only two dimensions matrix are supported");if(_=_.map(function(ee){if(Ot(ee)&&(ee=ee.toNumber()),!_t(ee)||!Et(ee)||ee<1)throw new Error("Size values must be positive integers");return ee}),m){if(Ot(m)&&(m=m.toNumber()),!_t(m)||!Et(m))throw new TypeError("The parameter k must be an integer number")}else m=0;var C=t,b=0;un(D)&&(C=e.find(t,[D,D])||t,b=e.convert(0,D));var F=m>0?m:0,B=m<0?-m:0,M=_[0],O=_[1],A=Math.min(M-B,O-F),N;if(Ft(y)){if(y.length!==A)throw new Error("Invalid value array length");N=function(te){return y[te]}}else if(xt(y)){var I=y.size();if(I.length!==1||I[0]!==A)throw new Error("Invalid matrix length");N=function(te){return y.get([te])}}else N=function(){return y};for(var L=[],k=[],z=[],R=0;R<O;R++){z.push(L.length);var V=R-F;if(V>=0&&V<A){var H=N(V);C(H,b)||(k.push(V+B),L.push(H))}}return z.push(L.length),new n({values:L,index:k,ptr:z,size:[M,O]})},n.prototype.swapRows=function(_,y){if(!_t(_)||!Et(_)||!_t(y)||!Et(y))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return Bt(_,this._size[0]),Bt(y,this._size[0]),n._swapRows(_,y,this._size[1],this._values,this._index,this._ptr),this},n._forEachRow=function(_,y,m,w,D){for(var C=w[_],b=w[_+1],F=C;F<b;F++)D(m[F],y[F])},n._swapRows=function(_,y,m,w,D,C){for(var b=0;b<m;b++){var F=C[b],B=C[b+1],M=c(_,F,B,D),O=c(y,F,B,D);if(M<B&&O<B&&D[M]===_&&D[O]===y){if(w){var A=w[M];w[M]=w[O],w[O]=A}continue}if(M<B&&D[M]===_&&(O>=B||D[O]!==y)){var N=w?w[M]:void 0;D.splice(O,0,y),w&&w.splice(O,0,N),D.splice(O<=M?M+1:M,1),w&&w.splice(O<=M?M+1:M,1);continue}if(O<B&&D[O]===y&&(M>=B||D[M]!==_)){var I=w?w[O]:void 0;D.splice(M,0,_),w&&w.splice(M,0,I),D.splice(M<=O?O+1:O,1),w&&w.splice(M<=O?O+1:O,1)}}},n},{isClass:!0}),tg="number",rg=["typed"];function ng(s){var e=s.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(e){var t={"0b":2,"0o":8,"0x":16}[e[1]],r=e[2],n=e[3];return{input:s,radix:t,integerPart:r,fractionalPart:n}}else return null}function ig(s){for(var e=parseInt(s.integerPart,s.radix),t=0,r=0;r<s.fractionalPart.length;r++){var n=parseInt(s.fractionalPart[r],s.radix);t+=n/Math.pow(s.radix,r+1)}var i=e+t;if(isNaN(i))throw new SyntaxError('String "'+s.input+'" is not a valid number');return i}var sg=xe(tg,rg,s=>{var{typed:e}=s,t=e("number",{"":function(){return 0},number:function(n){return n},string:function(n){if(n==="NaN")return NaN;var i=ng(n);if(i)return ig(i);var a=0,u=n.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);u&&(a=Number(u[2]),n=u[1]);var f=Number(n);if(isNaN(f))throw new SyntaxError('String "'+n+'" is not a valid number');if(u){if(f>2**a-1)throw new SyntaxError('String "'.concat(n,'" is out of range'));f>=2**(a-1)&&(f=f-2**a)}return f},BigNumber:function(n){return n.toNumber()},Fraction:function(n){return n.valueOf()},Unit:e.referToSelf(r=>n=>{var i=n.clone();return i.value=r(n.value),i}),null:function(n){return 0},"Unit, string | Unit":function(n,i){return n.toNumber(i)},"Array | Matrix":e.referToSelf(r=>n=>Jr(n,r))});return t.fromJSON=function(r){return parseFloat(r.value)},t}),og="bignumber",ag=["typed","BigNumber"],ug=xe(og,ag,s=>{var{typed:e,BigNumber:t}=s;return e("bignumber",{"":function(){return new t(0)},number:function(n){return new t(n+"")},string:function(n){var i=n.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(i){var a=i[2],u=t(i[1]),f=new t(2).pow(Number(a));if(u.gt(f.sub(1)))throw new SyntaxError('String "'.concat(n,'" is out of range'));var c=new t(2).pow(Number(a)-1);return u.gte(c)?u.sub(f):u}return new t(n)},BigNumber:function(n){return n},Unit:e.referToSelf(r=>n=>{var i=n.clone();return i.value=r(n.value),i}),Fraction:function(n){return new t(n.n).div(n.d).times(n.s)},null:function(n){return new t(0)},"Array | Matrix":e.referToSelf(r=>n=>Jr(n,r))})}),lg="fraction",cg=["typed","Fraction"],fg=xe(lg,cg,s=>{var{typed:e,Fraction:t}=s;return e("fraction",{number:function(n){if(!isFinite(n)||isNaN(n))throw new Error(n+" cannot be represented as a fraction");return new t(n)},string:function(n){return new t(n)},"number, number":function(n,i){return new t(n,i)},null:function(n){return new t(0)},BigNumber:function(n){return new t(n.toString())},Fraction:function(n){return n},Unit:e.referToSelf(r=>n=>{var i=n.clone();return i.value=r(n.value),i}),Object:function(n){return new t(n)},"Array | Matrix":e.referToSelf(r=>n=>Jr(n,r))})}),Nc="matrix",hg=["typed","Matrix","DenseMatrix","SparseMatrix"],dg=xe(Nc,hg,s=>{var{typed:e,Matrix:t,DenseMatrix:r,SparseMatrix:n}=s;return e(Nc,{"":function(){return i([])},string:function(u){return i([],u)},"string, string":function(u,f){return i([],u,f)},Array:function(u){return i(u)},Matrix:function(u){return i(u,u.storage())},"Array | Matrix, string":i,"Array | Matrix, string, string":i});function i(a,u,f){if(u==="dense"||u==="default"||u===void 0)return new r(a,f);if(u==="sparse")return new n(a,f);throw new TypeError("Unknown matrix type "+JSON.stringify(u)+".")}}),Sc="unaryMinus",pg=["typed"],_g=xe(Sc,pg,s=>{var{typed:e}=s;return e(Sc,{number:wc,"Complex | BigNumber | Fraction":t=>t.neg(),Unit:e.referToSelf(t=>r=>{var n=r.clone();return n.value=e.find(t,n.valueType())(r.value),n}),"Array | Matrix":e.referToSelf(t=>r=>Jr(r,t))})}),Oc="abs",vg=["typed"],gg=xe(Oc,vg,s=>{var{typed:e}=s;return e(Oc,{number:mc,"Complex | BigNumber | Fraction | Unit":t=>t.abs(),"Array | Matrix":e.referToSelf(t=>r=>Jr(r,t))})}),Ic="addScalar",mg=["typed"],xg=xe(Ic,mg,s=>{var{typed:e}=s;return e(Ic,{"number, number":xc,"Complex, Complex":function(r,n){return r.add(n)},"BigNumber, BigNumber":function(r,n){return r.plus(n)},"Fraction, Fraction":function(r,n){return r.add(n)},"Unit, Unit":e.referToSelf(t=>(r,n)=>{if(r.value===null||r.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(n.value===null||n.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!r.equalBase(n))throw new Error("Units do not match");var i=r.clone();return i.value=e.find(t,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i})})}),Tc="subtractScalar",yg=["typed"],Dg=xe(Tc,yg,s=>{var{typed:e}=s;return e(Tc,{"number, number":yc,"Complex, Complex":function(r,n){return r.sub(n)},"BigNumber, BigNumber":function(r,n){return r.minus(n)},"Fraction, Fraction":function(r,n){return r.sub(n)},"Unit, Unit":e.referToSelf(t=>(r,n)=>{if(r.value===null||r.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(n.value===null||n.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!r.equalBase(n))throw new Error("Units do not match");var i=r.clone();return i.value=e.find(t,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i})})}),wg="matAlgo11xS0s",bg=["typed","equalScalar"],ja=xe(wg,bg,s=>{var{typed:e,equalScalar:t}=s;return function(n,i,a,u){var f=n._values,c=n._index,h=n._ptr,d=n._size,p=n._datatype;if(!f)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var v=d[0],x=d[1],_,y=t,m=0,w=a;typeof p=="string"&&(_=p,y=e.find(t,[_,_]),m=e.convert(0,_),i=e.convert(i,_),w=e.find(a,[_,_]));for(var D=[],C=[],b=[],F=0;F<x;F++){b[F]=C.length;for(var B=h[F],M=h[F+1],O=B;O<M;O++){var A=c[O],N=u?w(i,f[O]):w(f[O],i);y(N,m)||(C.push(A),D.push(N))}}return b[x]=C.length,n.createSparseMatrix({values:D,index:C,ptr:b,size:[v,x],datatype:_})}}),Eg="matAlgo12xSfs",Cg=["typed","DenseMatrix"],Fi=xe(Eg,Cg,s=>{var{typed:e,DenseMatrix:t}=s;return function(n,i,a,u){var f=n._values,c=n._index,h=n._ptr,d=n._size,p=n._datatype;if(!f)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var v=d[0],x=d[1],_,y=a;typeof p=="string"&&(_=p,i=e.convert(i,_),y=e.find(a,[_,_]));for(var m=[],w=[],D=[],C=0;C<x;C++){for(var b=C+1,F=h[C],B=h[C+1],M=F;M<B;M++){var O=c[M];w[O]=f[M],D[O]=b}for(var A=0;A<v;A++)C===0&&(m[A]=[]),D[A]===b?m[A][C]=u?y(i,w[A]):y(w[A],i):m[A][C]=u?y(i,0):y(0,i)}return new t({data:m,size:[v,x],datatype:_})}}),Ag="matAlgo14xDs",Fg=["typed"],Ya=xe(Ag,Fg,s=>{var{typed:e}=s;return function(n,i,a,u){var f=n._data,c=n._size,h=n._datatype,d,p=a;typeof h=="string"&&(d=h,i=e.convert(i,d),p=e.find(a,[d,d]));var v=c.length>0?t(p,0,c,c[0],f,i,u):[];return n.createDenseMatrix({data:v,size:ut(c),datatype:d})};function t(r,n,i,a,u,f,c){var h=[];if(n===i.length-1)for(var d=0;d<a;d++)h[d]=c?r(f,u[d]):r(u[d],f);else for(var p=0;p<a;p++)h[p]=t(r,n+1,i,i[n+1],u[p],f,c);return h}}),Bg="matAlgo02xDS0",Mg=["typed","equalScalar"],Ng=xe(Bg,Mg,s=>{var{typed:e,equalScalar:t}=s;return function(n,i,a,u){var f=n._data,c=n._size,h=n._datatype||n.getDataType(),d=i._values,p=i._index,v=i._ptr,x=i._size,_=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(c.length!==x.length)throw new rt(c.length,x.length);if(c[0]!==x[0]||c[1]!==x[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+x+")");if(!d)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var y=c[0],m=c[1],w,D=t,C=0,b=a;typeof h=="string"&&h===_&&h!=="mixed"&&(w=h,D=e.find(t,[w,w]),C=e.convert(0,w),b=e.find(a,[w,w]));for(var F=[],B=[],M=[],O=0;O<m;O++){M[O]=B.length;for(var A=v[O],N=v[O+1],I=A;I<N;I++){var L=p[I],k=u?b(d[I],f[L][O]):b(f[L][O],d[I]);D(k,C)||(B.push(L),F.push(k))}}return M[m]=B.length,i.createSparseMatrix({values:F,index:B,ptr:M,size:[y,m],datatype:h===n._datatype&&_===i._datatype?w:void 0})}}),Sg="matAlgo03xDSf",Og=["typed"],Bi=xe(Sg,Og,s=>{var{typed:e}=s;return function(r,n,i,a){var u=r._data,f=r._size,c=r._datatype||r.getDataType(),h=n._values,d=n._index,p=n._ptr,v=n._size,x=n._datatype||n._data===void 0?n._datatype:n.getDataType();if(f.length!==v.length)throw new rt(f.length,v.length);if(f[0]!==v[0]||f[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+v+")");if(!h)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var _=f[0],y=f[1],m,w=0,D=i;typeof c=="string"&&c===x&&c!=="mixed"&&(m=c,w=e.convert(0,m),D=e.find(i,[m,m]));for(var C=[],b=0;b<_;b++)C[b]=[];for(var F=[],B=[],M=0;M<y;M++){for(var O=M+1,A=p[M],N=p[M+1],I=A;I<N;I++){var L=d[I];F[L]=a?D(h[I],u[L][M]):D(u[L][M],h[I]),B[L]=O}for(var k=0;k<_;k++)B[k]===O?C[k][M]=F[k]:C[k][M]=a?D(w,u[k][M]):D(u[k][M],w)}return r.createDenseMatrix({data:C,size:[_,y],datatype:c===r._datatype&&x===n._datatype?m:void 0})}}),Ig="matAlgo05xSfSf",Tg=["typed","equalScalar"],$c=xe(Ig,Tg,s=>{var{typed:e,equalScalar:t}=s;return function(n,i,a){var u=n._values,f=n._index,c=n._ptr,h=n._size,d=n._datatype||n._data===void 0?n._datatype:n.getDataType(),p=i._values,v=i._index,x=i._ptr,_=i._size,y=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(h.length!==_.length)throw new rt(h.length,_.length);if(h[0]!==_[0]||h[1]!==_[1])throw new RangeError("Dimension mismatch. Matrix A ("+h+") must match Matrix B ("+_+")");var m=h[0],w=h[1],D,C=t,b=0,F=a;typeof d=="string"&&d===y&&d!=="mixed"&&(D=d,C=e.find(t,[D,D]),b=e.convert(0,D),F=e.find(a,[D,D]));var B=u&&p?[]:void 0,M=[],O=[],A=B?[]:void 0,N=B?[]:void 0,I=[],L=[],k,z,R,V;for(z=0;z<w;z++){O[z]=M.length;var H=z+1;for(R=c[z],V=c[z+1];R<V;R++)k=f[R],M.push(k),I[k]=H,A&&(A[k]=u[R]);for(R=x[z],V=x[z+1];R<V;R++)k=v[R],I[k]!==H&&M.push(k),L[k]=H,N&&(N[k]=p[R]);if(B)for(R=O[z];R<M.length;){k=M[R];var ee=I[k],te=L[k];if(ee===H||te===H){var j=ee===H?A[k]:b,X=te===H?N[k]:b,Y=F(j,X);C(Y,b)?M.splice(R,1):(B.push(Y),R++)}}}return O[w]=M.length,n.createSparseMatrix({values:B,index:M,ptr:O,size:[m,w],datatype:d===n._datatype&&y===i._datatype?D:void 0})}}),$g="matAlgo13xDD",Lg=["typed"],Rg=xe($g,Lg,s=>{var{typed:e}=s;return function(n,i,a){var u=n._data,f=n._size,c=n._datatype,h=i._data,d=i._size,p=i._datatype,v=[];if(f.length!==d.length)throw new rt(f.length,d.length);for(var x=0;x<f.length;x++){if(f[x]!==d[x])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+d+")");v[x]=f[x]}var _,y=a;typeof c=="string"&&c===p&&(_=c,y=e.find(a,[_,_]));var m=v.length>0?t(y,0,v,v[0],u,h):[];return n.createDenseMatrix({data:m,size:v,datatype:_})};function t(r,n,i,a,u,f){var c=[];if(n===i.length-1)for(var h=0;h<a;h++)c[h]=r(u[h],f[h]);else for(var d=0;d<a;d++)c[d]=t(r,n+1,i,i[n+1],u[d],f[d]);return c}}),Pg="broadcast",kg=["concat"],zg=xe(Pg,kg,s=>{var{concat:e}=s;return function(n,i){var a=Math.max(n._size.length,i._size.length);if(n._size.length===i._size.length&&n._size.every((x,_)=>x===i._size[_]))return[n,i];for(var u=t(n._size,a,0),f=t(i._size,a,0),c=[],h=0;h<a;h++)c[h]=Math.max(u[h],f[h]);Zs(u,c),Zs(f,c);var d=n.clone(),p=i.clone();d._size.length<a?d.reshape(t(d._size,a,1)):p._size.length<a&&p.reshape(t(p._size,a,1));for(var v=0;v<a;v++)d._size[v]<c[v]&&(d=r(d,c[v],v)),p._size[v]<c[v]&&(p=r(p,c[v],v));return[d,p]};function t(n,i,a){return[...Array(i-n.length).fill(a),...n]}function r(n,i,a){return e(...Array(i).fill(n),a)}}),qg="matrixAlgorithmSuite",Ug=["typed","matrix","concat"],ni=xe(qg,Ug,s=>{var{typed:e,matrix:t,concat:r}=s,n=Rg({typed:e}),i=Ya({typed:e}),a=zg({concat:r});return function(f){var c=f.elop,h=f.SD||f.DS,d;c?(d={"DenseMatrix, DenseMatrix":(_,y)=>n(...a(_,y),c),"Array, Array":(_,y)=>n(...a(t(_),t(y)),c).valueOf(),"Array, DenseMatrix":(_,y)=>n(...a(t(_),y),c),"DenseMatrix, Array":(_,y)=>n(...a(_,t(y)),c)},f.SS&&(d["SparseMatrix, SparseMatrix"]=(_,y)=>f.SS(...a(_,y),c,!1)),f.DS&&(d["DenseMatrix, SparseMatrix"]=(_,y)=>f.DS(...a(_,y),c,!1),d["Array, SparseMatrix"]=(_,y)=>f.DS(...a(t(_),y),c,!1)),h&&(d["SparseMatrix, DenseMatrix"]=(_,y)=>h(...a(y,_),c,!0),d["SparseMatrix, Array"]=(_,y)=>h(...a(t(y),_),c,!0))):(d={"DenseMatrix, DenseMatrix":e.referToSelf(_=>(y,m)=>n(...a(y,m),_)),"Array, Array":e.referToSelf(_=>(y,m)=>n(...a(t(y),t(m)),_).valueOf()),"Array, DenseMatrix":e.referToSelf(_=>(y,m)=>n(...a(t(y),m),_)),"DenseMatrix, Array":e.referToSelf(_=>(y,m)=>n(...a(y,t(m)),_))},f.SS&&(d["SparseMatrix, SparseMatrix"]=e.referToSelf(_=>(y,m)=>f.SS(...a(y,m),_,!1))),f.DS&&(d["DenseMatrix, SparseMatrix"]=e.referToSelf(_=>(y,m)=>f.DS(...a(y,m),_,!1)),d["Array, SparseMatrix"]=e.referToSelf(_=>(y,m)=>f.DS(...a(t(y),m),_,!1))),h&&(d["SparseMatrix, DenseMatrix"]=e.referToSelf(_=>(y,m)=>h(...a(m,y),_,!0)),d["SparseMatrix, Array"]=e.referToSelf(_=>(y,m)=>h(...a(t(m),y),_,!0))));var p=f.scalar||"any",v=f.Ds||f.Ss;v&&(c?(d["DenseMatrix,"+p]=(_,y)=>i(_,y,c,!1),d[p+", DenseMatrix"]=(_,y)=>i(y,_,c,!0),d["Array,"+p]=(_,y)=>i(t(_),y,c,!1).valueOf(),d[p+", Array"]=(_,y)=>i(t(y),_,c,!0).valueOf()):(d["DenseMatrix,"+p]=e.referToSelf(_=>(y,m)=>i(y,m,_,!1)),d[p+", DenseMatrix"]=e.referToSelf(_=>(y,m)=>i(m,y,_,!0)),d["Array,"+p]=e.referToSelf(_=>(y,m)=>i(t(y),m,_,!1).valueOf()),d[p+", Array"]=e.referToSelf(_=>(y,m)=>i(t(m),y,_,!0).valueOf())));var x=f.sS!==void 0?f.sS:f.Ss;return c?(f.Ss&&(d["SparseMatrix,"+p]=(_,y)=>f.Ss(_,y,c,!1)),x&&(d[p+", SparseMatrix"]=(_,y)=>x(y,_,c,!0))):(f.Ss&&(d["SparseMatrix,"+p]=e.referToSelf(_=>(y,m)=>f.Ss(y,m,_,!1))),x&&(d[p+", SparseMatrix"]=e.referToSelf(_=>(y,m)=>x(m,y,_,!0)))),c&&c.signatures&&Bl(d,c.signatures),d}}),Wg="matAlgo01xDSid",Hg=["typed"],Lc=xe(Wg,Hg,s=>{var{typed:e}=s;return function(r,n,i,a){var u=r._data,f=r._size,c=r._datatype||r.getDataType(),h=n._values,d=n._index,p=n._ptr,v=n._size,x=n._datatype||n._data===void 0?n._datatype:n.getDataType();if(f.length!==v.length)throw new rt(f.length,v.length);if(f[0]!==v[0]||f[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+v+")");if(!h)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var _=f[0],y=f[1],m=typeof c=="string"&&c!=="mixed"&&c===x?c:void 0,w=m?e.find(i,[m,m]):i,D,C,b=[];for(D=0;D<_;D++)b[D]=[];var F=[],B=[];for(C=0;C<y;C++){for(var M=C+1,O=p[C],A=p[C+1],N=O;N<A;N++)D=d[N],F[D]=a?w(h[N],u[D][C]):w(u[D][C],h[N]),B[D]=M;for(D=0;D<_;D++)B[D]===M?b[D][C]=F[D]:b[D][C]=u[D][C]}return r.createDenseMatrix({data:b,size:[_,y],datatype:c===r._datatype&&x===n._datatype?m:void 0})}}),jg="matAlgo04xSidSid",Yg=["typed","equalScalar"],Kg=xe(jg,Yg,s=>{var{typed:e,equalScalar:t}=s;return function(n,i,a){var u=n._values,f=n._index,c=n._ptr,h=n._size,d=n._datatype||n._data===void 0?n._datatype:n.getDataType(),p=i._values,v=i._index,x=i._ptr,_=i._size,y=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(h.length!==_.length)throw new rt(h.length,_.length);if(h[0]!==_[0]||h[1]!==_[1])throw new RangeError("Dimension mismatch. Matrix A ("+h+") must match Matrix B ("+_+")");var m=h[0],w=h[1],D,C=t,b=0,F=a;typeof d=="string"&&d===y&&d!=="mixed"&&(D=d,C=e.find(t,[D,D]),b=e.convert(0,D),F=e.find(a,[D,D]));var B=u&&p?[]:void 0,M=[],O=[],A=u&&p?[]:void 0,N=u&&p?[]:void 0,I=[],L=[],k,z,R,V,H;for(z=0;z<w;z++){O[z]=M.length;var ee=z+1;for(V=c[z],H=c[z+1],R=V;R<H;R++)k=f[R],M.push(k),I[k]=ee,A&&(A[k]=u[R]);for(V=x[z],H=x[z+1],R=V;R<H;R++)if(k=v[R],I[k]===ee){if(A){var te=F(A[k],p[R]);C(te,b)?I[k]=null:A[k]=te}}else M.push(k),L[k]=ee,N&&(N[k]=p[R]);if(A&&N)for(R=O[z];R<M.length;)k=M[R],I[k]===ee?(B[R]=A[k],R++):L[k]===ee?(B[R]=N[k],R++):M.splice(R,1)}return O[w]=M.length,n.createSparseMatrix({values:B,index:M,ptr:O,size:[m,w],datatype:d===n._datatype&&y===i._datatype?D:void 0})}}),Zg="matAlgo10xSids",Vg=["typed","DenseMatrix"],Rc=xe(Zg,Vg,s=>{var{typed:e,DenseMatrix:t}=s;return function(n,i,a,u){var f=n._values,c=n._index,h=n._ptr,d=n._size,p=n._datatype;if(!f)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var v=d[0],x=d[1],_,y=a;typeof p=="string"&&(_=p,i=e.convert(i,_),y=e.find(a,[_,_]));for(var m=[],w=[],D=[],C=0;C<x;C++){for(var b=C+1,F=h[C],B=h[C+1],M=F;M<B;M++){var O=c[M];w[O]=f[M],D[O]=b}for(var A=0;A<v;A++)C===0&&(m[A]=[]),D[A]===b?m[A][C]=u?y(i,w[A]):y(w[A],i):m[A][C]=i}return new t({data:m,size:[v,x],datatype:_})}}),Gg="multiplyScalar",Xg=["typed"],Qg=xe(Gg,Xg,s=>{var{typed:e}=s;return e("multiplyScalar",{"number, number":Dc,"Complex, Complex":function(r,n){return r.mul(n)},"BigNumber, BigNumber":function(r,n){return r.times(n)},"Fraction, Fraction":function(r,n){return r.mul(n)},"number | Fraction | BigNumber | Complex, Unit":(t,r)=>r.multiply(t),"Unit, number | Fraction | BigNumber | Complex | Unit":(t,r)=>t.multiply(r)})}),Pc="multiply",Jg=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],em=xe(Pc,Jg,s=>{var{typed:e,matrix:t,addScalar:r,multiplyScalar:n,equalScalar:i,dot:a}=s,u=ja({typed:e,equalScalar:i}),f=Ya({typed:e});function c(b,F){switch(b.length){case 1:switch(F.length){case 1:if(b[0]!==F[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(b[0]!==F[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+b[0]+") must match Matrix rows ("+F[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+F.length+" dimensions)")}break;case 2:switch(F.length){case 1:if(b[1]!==F[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+b[1]+") must match Vector length ("+F[0]+")");break;case 2:if(b[1]!==F[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+b[1]+") must match Matrix B rows ("+F[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+F.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+b.length+" dimensions)")}}function h(b,F,B){if(B===0)throw new Error("Cannot multiply two empty vectors");return a(b,F)}function d(b,F){if(F.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return p(b,F)}function p(b,F){var B=b._data,M=b._size,O=b._datatype||b.getDataType(),A=F._data,N=F._size,I=F._datatype||F.getDataType(),L=M[0],k=N[1],z,R=r,V=n;O&&I&&O===I&&typeof O=="string"&&O!=="mixed"&&(z=O,R=e.find(r,[z,z]),V=e.find(n,[z,z]));for(var H=[],ee=0;ee<k;ee++){for(var te=V(B[0],A[0][ee]),j=1;j<L;j++)te=R(te,V(B[j],A[j][ee]));H[ee]=te}return b.createDenseMatrix({data:H,size:[k],datatype:O===b._datatype&&I===F._datatype?z:void 0})}var v=e("_multiplyMatrixVector",{"DenseMatrix, any":_,"SparseMatrix, any":w}),x=e("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":y,"DenseMatrix, SparseMatrix":m,"SparseMatrix, DenseMatrix":D,"SparseMatrix, SparseMatrix":C});function _(b,F){var B=b._data,M=b._size,O=b._datatype||b.getDataType(),A=F._data,N=F._datatype||F.getDataType(),I=M[0],L=M[1],k,z=r,R=n;O&&N&&O===N&&typeof O=="string"&&O!=="mixed"&&(k=O,z=e.find(r,[k,k]),R=e.find(n,[k,k]));for(var V=[],H=0;H<I;H++){for(var ee=B[H],te=R(ee[0],A[0]),j=1;j<L;j++)te=z(te,R(ee[j],A[j]));V[H]=te}return b.createDenseMatrix({data:V,size:[I],datatype:O===b._datatype&&N===F._datatype?k:void 0})}function y(b,F){var B=b._data,M=b._size,O=b._datatype||b.getDataType(),A=F._data,N=F._size,I=F._datatype||F.getDataType(),L=M[0],k=M[1],z=N[1],R,V=r,H=n;O&&I&&O===I&&typeof O=="string"&&O!=="mixed"&&O!=="mixed"&&(R=O,V=e.find(r,[R,R]),H=e.find(n,[R,R]));for(var ee=[],te=0;te<L;te++){var j=B[te];ee[te]=[];for(var X=0;X<z;X++){for(var Y=H(j[0],A[0][X]),Q=1;Q<k;Q++)Y=V(Y,H(j[Q],A[Q][X]));ee[te][X]=Y}}return b.createDenseMatrix({data:ee,size:[L,z],datatype:O===b._datatype&&I===F._datatype?R:void 0})}function m(b,F){var B=b._data,M=b._size,O=b._datatype||b.getDataType(),A=F._values,N=F._index,I=F._ptr,L=F._size,k=F._datatype||F._data===void 0?F._datatype:F.getDataType();if(!A)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var z=M[0],R=L[1],V,H=r,ee=n,te=i,j=0;O&&k&&O===k&&typeof O=="string"&&O!=="mixed"&&(V=O,H=e.find(r,[V,V]),ee=e.find(n,[V,V]),te=e.find(i,[V,V]),j=e.convert(0,V));for(var X=[],Y=[],Q=[],pe=F.createSparseMatrix({values:X,index:Y,ptr:Q,size:[z,R],datatype:O===b._datatype&&k===F._datatype?V:void 0}),De=0;De<R;De++){Q[De]=Y.length;var we=I[De],be=I[De+1];if(be>we)for(var Oe=0,Fe=0;Fe<z;Fe++){for(var nt=Fe+1,Ye=void 0,Ie=we;Ie<be;Ie++){var Le=N[Ie];Oe!==nt?(Ye=ee(B[Fe][Le],A[Ie]),Oe=nt):Ye=H(Ye,ee(B[Fe][Le],A[Ie]))}Oe===nt&&!te(Ye,j)&&(Y.push(Fe),X.push(Ye))}}return Q[R]=Y.length,pe}function w(b,F){var B=b._values,M=b._index,O=b._ptr,A=b._datatype||b._data===void 0?b._datatype:b.getDataType();if(!B)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var N=F._data,I=F._datatype||F.getDataType(),L=b._size[0],k=F._size[0],z=[],R=[],V=[],H,ee=r,te=n,j=i,X=0;A&&I&&A===I&&typeof A=="string"&&A!=="mixed"&&(H=A,ee=e.find(r,[H,H]),te=e.find(n,[H,H]),j=e.find(i,[H,H]),X=e.convert(0,H));var Y=[],Q=[];V[0]=0;for(var pe=0;pe<k;pe++){var De=N[pe];if(!j(De,X))for(var we=O[pe],be=O[pe+1],Oe=we;Oe<be;Oe++){var Fe=M[Oe];Q[Fe]?Y[Fe]=ee(Y[Fe],te(De,B[Oe])):(Q[Fe]=!0,R.push(Fe),Y[Fe]=te(De,B[Oe]))}}for(var nt=R.length,Ye=0;Ye<nt;Ye++){var Ie=R[Ye];z[Ye]=Y[Ie]}return V[1]=R.length,b.createSparseMatrix({values:z,index:R,ptr:V,size:[L,1],datatype:A===b._datatype&&I===F._datatype?H:void 0})}function D(b,F){var B=b._values,M=b._index,O=b._ptr,A=b._datatype||b._data===void 0?b._datatype:b.getDataType();if(!B)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var N=F._data,I=F._datatype||F.getDataType(),L=b._size[0],k=F._size[0],z=F._size[1],R,V=r,H=n,ee=i,te=0;A&&I&&A===I&&typeof A=="string"&&A!=="mixed"&&(R=A,V=e.find(r,[R,R]),H=e.find(n,[R,R]),ee=e.find(i,[R,R]),te=e.convert(0,R));for(var j=[],X=[],Y=[],Q=b.createSparseMatrix({values:j,index:X,ptr:Y,size:[L,z],datatype:A===b._datatype&&I===F._datatype?R:void 0}),pe=[],De=[],we=0;we<z;we++){Y[we]=X.length;for(var be=we+1,Oe=0;Oe<k;Oe++){var Fe=N[Oe][we];if(!ee(Fe,te))for(var nt=O[Oe],Ye=O[Oe+1],Ie=nt;Ie<Ye;Ie++){var Le=M[Ie];De[Le]!==be?(De[Le]=be,X.push(Le),pe[Le]=H(Fe,B[Ie])):pe[Le]=V(pe[Le],H(Fe,B[Ie]))}}for(var yt=Y[we],Wt=X.length,Ct=yt;Ct<Wt;Ct++){var lr=X[Ct];j[Ct]=pe[lr]}}return Y[z]=X.length,Q}function C(b,F){var B=b._values,M=b._index,O=b._ptr,A=b._datatype||b._data===void 0?b._datatype:b.getDataType(),N=F._values,I=F._index,L=F._ptr,k=F._datatype||F._data===void 0?F._datatype:F.getDataType(),z=b._size[0],R=F._size[1],V=B&&N,H,ee=r,te=n;A&&k&&A===k&&typeof A=="string"&&A!=="mixed"&&(H=A,ee=e.find(r,[H,H]),te=e.find(n,[H,H]));for(var j=V?[]:void 0,X=[],Y=[],Q=b.createSparseMatrix({values:j,index:X,ptr:Y,size:[z,R],datatype:A===b._datatype&&k===F._datatype?H:void 0}),pe=V?[]:void 0,De=[],we,be,Oe,Fe,nt,Ye,Ie,Le,yt=0;yt<R;yt++){Y[yt]=X.length;var Wt=yt+1;for(nt=L[yt],Ye=L[yt+1],Fe=nt;Fe<Ye;Fe++)if(Le=I[Fe],V)for(be=O[Le],Oe=O[Le+1],we=be;we<Oe;we++)Ie=M[we],De[Ie]!==Wt?(De[Ie]=Wt,X.push(Ie),pe[Ie]=te(N[Fe],B[we])):pe[Ie]=ee(pe[Ie],te(N[Fe],B[we]));else for(be=O[Le],Oe=O[Le+1],we=be;we<Oe;we++)Ie=M[we],De[Ie]!==Wt&&(De[Ie]=Wt,X.push(Ie));if(V)for(var Ct=Y[yt],lr=X.length,Rr=Ct;Rr<lr;Rr++){var cr=X[Rr];j[Rr]=pe[cr]}}return Y[R]=X.length,Q}return e(Pc,n,{"Array, Array":e.referTo("Matrix, Matrix",b=>(F,B)=>{c(Pt(F),Pt(B));var M=b(t(F),t(B));return xt(M)?M.valueOf():M}),"Matrix, Matrix":function(F,B){var M=F.size(),O=B.size();return c(M,O),M.length===1?O.length===1?h(F,B,M[0]):d(F,B):O.length===1?v(F,B):x(F,B)},"Matrix, Array":e.referTo("Matrix,Matrix",b=>(F,B)=>b(F,t(B))),"Array, Matrix":e.referToSelf(b=>(F,B)=>b(t(F,B.storage()),B)),"SparseMatrix, any":function(F,B){return u(F,B,n,!1)},"DenseMatrix, any":function(F,B){return f(F,B,n,!1)},"any, SparseMatrix":function(F,B){return u(B,F,n,!0)},"any, DenseMatrix":function(F,B){return f(B,F,n,!0)},"Array, any":function(F,B){return f(t(F),B,n,!1).valueOf()},"any, Array":function(F,B){return f(t(B),F,n,!0).valueOf()},"any, any":n,"any, any, ...any":e.referToSelf(b=>(F,B,M)=>{for(var O=b(F,B),A=0;A<M.length;A++)O=b(O,M[A]);return O})})}),kc="subtract",tm=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],rm=xe(kc,tm,s=>{var{typed:e,matrix:t,equalScalar:r,subtractScalar:n,unaryMinus:i,DenseMatrix:a,concat:u}=s,f=Lc({typed:e}),c=Bi({typed:e}),h=$c({typed:e,equalScalar:r}),d=Rc({typed:e,DenseMatrix:a}),p=Fi({typed:e,DenseMatrix:a}),v=ni({typed:e,matrix:t,concat:u});return e(kc,{"any, any":n},v({elop:n,SS:h,DS:f,SD:c,Ss:p,sS:d}))}),nm="matAlgo07xSSf",im=["typed","DenseMatrix"],lo=xe(nm,im,s=>{var{typed:e,DenseMatrix:t}=s;return function(i,a,u){var f=i._size,c=i._datatype||i._data===void 0?i._datatype:i.getDataType(),h=a._size,d=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(f.length!==h.length)throw new rt(f.length,h.length);if(f[0]!==h[0]||f[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+h+")");var p=f[0],v=f[1],x,_=0,y=u;typeof c=="string"&&c===d&&c!=="mixed"&&(x=c,_=e.convert(0,x),y=e.find(u,[x,x]));var m,w,D=[];for(m=0;m<p;m++)D[m]=[];var C=[],b=[],F=[],B=[];for(w=0;w<v;w++){var M=w+1;for(r(i,w,F,C,M),r(a,w,B,b,M),m=0;m<p;m++){var O=F[m]===M?C[m]:_,A=B[m]===M?b[m]:_;D[m][w]=y(O,A)}}return new t({data:D,size:[p,v],datatype:c===i._datatype&&d===a._datatype?x:void 0})};function r(n,i,a,u,f){for(var c=n._values,h=n._index,d=n._ptr,p=d[i],v=d[i+1];p<v;p++){var x=h[p];a[x]=f,u[x]=c[p]}}}),zc="conj",sm=["typed"],om=xe(zc,sm,s=>{var{typed:e}=s;return e(zc,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.conjugate(),"Array | Matrix":e.referToSelf(t=>r=>Jr(r,t))})}),qc="concat",am=["typed","matrix","isInteger"],um=xe(qc,am,s=>{var{typed:e,matrix:t,isInteger:r}=s;return e(qc,{"...Array | Matrix | number | BigNumber":function(i){var a,u=i.length,f=-1,c,h=!1,d=[];for(a=0;a<u;a++){var p=i[a];if(xt(p)&&(h=!0),_t(p)||Ot(p)){if(a!==u-1)throw new Error("Dimension must be specified as last argument");if(c=f,f=p.valueOf(),!r(f))throw new TypeError("Integer number expected for dimension");if(f<0||a>0&&f>c)throw new In(f,c+1)}else{var v=ut(p).valueOf(),x=Pt(v);if(d[a]=v,c=f,f=x.length-1,a>0&&f!==c)throw new rt(c+1,f+1)}}if(d.length===0)throw new SyntaxError("At least one matrix expected");for(var _=d.shift();d.length;)_=Zl(_,d.shift(),f);return h?t(_):_},"...string":function(i){return i.join("")}})}),Uc="count",lm=["typed","size","prod"],cm=xe(Uc,lm,s=>{var{typed:e,size:t,prod:r}=s;return e(Uc,{string:function(i){return i.length},"Matrix | Array":function(i){return r(t(i))}})}),Wc="identity",fm=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],hm=xe(Wc,fm,s=>{var{typed:e,config:t,matrix:r,BigNumber:n,DenseMatrix:i,SparseMatrix:a}=s;return e(Wc,{"":function(){return t.matrix==="Matrix"?r([]):[]},string:function(h){return r(h)},"number | BigNumber":function(h){return f(h,h,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(h,d){return f(h,h,d)},"number | BigNumber, number | BigNumber":function(h,d){return f(h,d,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(h,d,p){return f(h,d,p)},Array:function(h){return u(h)},"Array, string":function(h,d){return u(h,d)},Matrix:function(h){return u(h.valueOf(),h.storage())},"Matrix, string":function(h,d){return u(h.valueOf(),d)}});function u(c,h){switch(c.length){case 0:return h?r(h):[];case 1:return f(c[0],c[0],h);case 2:return f(c[0],c[1],h);default:throw new Error("Vector containing two values expected")}}function f(c,h,d){var p=Ot(c)||Ot(h)?n:null;if(Ot(c)&&(c=c.toNumber()),Ot(h)&&(h=h.toNumber()),!Et(c)||c<1)throw new Error("Parameters in function identity must be positive integers");if(!Et(h)||h<1)throw new Error("Parameters in function identity must be positive integers");var v=p?new n(1):1,x=p?new p(0):0,_=[c,h];if(d){if(d==="sparse")return a.diagonal(_,v,0,x);if(d==="dense")return i.diagonal(_,v,0,x);throw new TypeError('Unknown matrix type "'.concat(d,'"'))}for(var y=Sa([],_,x),m=c<h?c:h,w=0;w<m;w++)y[w][w]=v;return y}}),Hc="kron",dm=["typed","matrix","multiplyScalar"],pm=xe(Hc,dm,s=>{var{typed:e,matrix:t,multiplyScalar:r}=s;return e(Hc,{"Matrix, Matrix":function(a,u){return t(n(a.toArray(),u.toArray()))},"Matrix, Array":function(a,u){return t(n(a.toArray(),u))},"Array, Matrix":function(a,u){return t(n(a,u.toArray()))},"Array, Array":n});function n(i,a){if(Pt(i).length===1&&(i=[i]),Pt(a).length===1&&(a=[a]),Pt(i).length>2||Pt(a).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(i.length)+", y = "+JSON.stringify(a.length)+")");var u=[],f=[];return i.map(function(c){return a.map(function(h){return f=[],u.push(f),c.map(function(d){return h.map(function(p){return f.push(r(d,p))})})})})&&u}});function _m(){throw new Error('No "bignumber" implementation available')}function vm(){throw new Error('No "fraction" implementation available')}function gm(){throw new Error('No "matrix" implementation available')}var jc="reshape",mm=["typed","isInteger","matrix"],xm=xe(jc,mm,s=>{var{typed:e,isInteger:t}=s;return e(jc,{"Matrix, Array":function(n,i){return n.reshape(i,!0)},"Array, Array":function(n,i){return i.forEach(function(a){if(!t(a))throw new TypeError("Invalid size for dimension: "+a)}),Ia(n,i)}})}),Yc="size",ym=["typed","config","?matrix"],Dm=xe(Yc,ym,s=>{var{typed:e,config:t,matrix:r}=s;return e(Yc,{Matrix:function(i){return i.create(i.size())},Array:Pt,string:function(i){return t.matrix==="Array"?[i.length]:r([i.length])},"number | Complex | BigNumber | Unit | boolean | null":function(i){return t.matrix==="Array"?[]:r?r([]):gm()}})}),Kc="transpose",wm=["typed","matrix"],bm=xe(Kc,wm,s=>{var{typed:e,matrix:t}=s;return e(Kc,{Array:a=>r(t(a)).valueOf(),Matrix:r,any:ut});function r(a){var u=a.size(),f;switch(u.length){case 1:f=a.clone();break;case 2:{var c=u[0],h=u[1];if(h===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+ft(u)+")");switch(a.storage()){case"dense":f=n(a,c,h);break;case"sparse":f=i(a,c,h);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+ft(u)+")")}return f}function n(a,u,f){for(var c=a._data,h=[],d,p=0;p<f;p++){d=h[p]=[];for(var v=0;v<u;v++)d[v]=ut(c[v][p])}return a.createDenseMatrix({data:h,size:[f,u],datatype:a._datatype})}function i(a,u,f){for(var c=a._values,h=a._index,d=a._ptr,p=c?[]:void 0,v=[],x=[],_=[],y=0;y<u;y++)_[y]=0;var m,w,D;for(m=0,w=h.length;m<w;m++)_[h[m]]++;for(var C=0,b=0;b<u;b++)x.push(C),C+=_[b],_[b]=x[b];for(x.push(C),D=0;D<f;D++)for(var F=d[D],B=d[D+1],M=F;M<B;M++){var O=_[h[M]]++;v[O]=D,c&&(p[O]=ut(c[M]))}return a.createSparseMatrix({values:p,index:v,ptr:x,size:[f,u],datatype:a._datatype})}}),Zc="ctranspose",Em=["typed","transpose","conj"],Cm=xe(Zc,Em,s=>{var{typed:e,transpose:t,conj:r}=s;return e(Zc,{any:function(i){return r(t(i))}})}),Vc="mode",Am=["typed","isNaN","isNumeric"],Fm=xe(Vc,Am,s=>{var{typed:e,isNaN:t,isNumeric:r}=s;return e(Vc,{"Array | Matrix":n,"...":function(a){return n(a)}});function n(i){i=$a(i.valueOf());var a=i.length;if(a===0)throw new Error("Cannot calculate mode of an empty array");for(var u={},f=[],c=0,h=0;h<i.length;h++){var d=i[h];if(r(d)&&t(d))throw new Error("Cannot calculate mode of an array containing NaN values");d in u||(u[d]=0),u[d]++,u[d]===c?f.push(d):u[d]>c&&(c=u[d],f=[d])}return f}});function Pn(s,e,t){var r;return String(s).indexOf("Unexpected type")!==-1?(r=arguments.length>2?" (type: "+On(t)+", value: "+JSON.stringify(t)+")":" (type: "+s.data.actual+")",new TypeError("Cannot calculate "+e+", unexpected type of argument"+r)):String(s).indexOf("complex numbers")!==-1?(r=arguments.length>2?" (type: "+On(t)+", value: "+JSON.stringify(t)+")":"",new TypeError("Cannot calculate "+e+", no ordering relation is defined for complex numbers"+r)):s}var Gc="prod",Bm=["typed","config","multiplyScalar","numeric"],Mm=xe(Gc,Bm,s=>{var{typed:e,config:t,multiplyScalar:r,numeric:n}=s;return e(Gc,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":function(u,f){throw new Error("prod(A, dim) is not yet supported")},"...":function(u){return i(u)}});function i(a){var u;if(ls(a,function(f){try{u=u===void 0?f:r(u,f)}catch(c){throw Pn(c,"prod",f)}}),typeof u=="string"&&(u=n(u,t.number)),u===void 0)throw new Error("Cannot calculate prod of an empty array");return u}}),Nm="numeric",Sm=["number","?bignumber","?fraction"],Om=xe(Nm,Sm,s=>{var{number:e,bignumber:t,fraction:r}=s,n={string:!0,number:!0,BigNumber:!0,Fraction:!0},i={number:a=>e(a),BigNumber:t?a=>t(a):_m,Fraction:r?a=>r(a):vm};return function(u){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",c=arguments.length>2?arguments[2]:void 0;if(c!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var h=On(u);if(!(h in n))throw new TypeError("Cannot convert "+u+' of type "'+h+'"; valid input types are '+Object.keys(n).join(", "));if(!(f in i))throw new TypeError("Cannot convert "+u+' to type "'+f+'"; valid output types are '+Object.keys(i).join(", "));return f===h?u:i[f](u)}}),Xc="divideScalar",Im=["typed","numeric"],Tm=xe(Xc,Im,s=>{var{typed:e,numeric:t}=s;return e(Xc,{"number, number":function(n,i){return n/i},"Complex, Complex":function(n,i){return n.div(i)},"BigNumber, BigNumber":function(n,i){return n.div(i)},"Fraction, Fraction":function(n,i){return n.div(i)},"Unit, number | Complex | Fraction | BigNumber | Unit":(r,n)=>r.divide(n),"number | Fraction | Complex | BigNumber, Unit":(r,n)=>n.divideInto(r)})}),Qc="pow",$m=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],Lm=xe(Qc,$m,s=>{var{typed:e,config:t,identity:r,multiply:n,matrix:i,inv:a,number:u,fraction:f,Complex:c}=s;return e(Qc,{"number, number":h,"Complex, Complex":function(x,_){return x.pow(_)},"BigNumber, BigNumber":function(x,_){return _.isInteger()||x>=0||t.predictable?x.pow(_):new c(x.toNumber(),0).pow(_.toNumber(),0)},"Fraction, Fraction":function(x,_){var y=x.pow(_);if(y!=null)return y;if(t.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return h(x.valueOf(),_.valueOf())},"Array, number":d,"Array, BigNumber":function(x,_){return d(x,_.toNumber())},"Matrix, number":p,"Matrix, BigNumber":function(x,_){return p(x,_.toNumber())},"Unit, number | BigNumber":function(x,_){return x.pow(_)}});function h(v,x){if(t.predictable&&!Et(x)&&v<0)try{var _=f(x),y=u(_);if((x===y||Math.abs((x-y)/x)<1e-14)&&_.d%2===1)return(_.n%2===0?1:-1)*Math.pow(-v,x)}catch{}return t.predictable&&(v<-1&&x===1/0||v>-1&&v<0&&x===-1/0)?NaN:Et(x)||v>=0||t.predictable?bc(v,x):v*v<1&&x===1/0||v*v>1&&x===-1/0?0:new c(v,0).pow(x,0)}function d(v,x){if(!Et(x))throw new TypeError("For A^b, b must be an integer (value is "+x+")");var _=Pt(v);if(_.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+_.length+" dimensions)");if(_[0]!==_[1])throw new Error("For A^b, A must be square (size is "+_[0]+"x"+_[1]+")");if(x<0)try{return d(a(v),-x)}catch(w){throw w.message==="Cannot calculate inverse, determinant is zero"?new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+x+")"):w}for(var y=r(_[0]).valueOf(),m=v;x>=1;)(x&1)===1&&(y=n(m,y)),x>>=1,m=n(m,m);return y}function p(v,x){return i(d(v.valueOf(),x))}}),Jc="dotDivide",Rm=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],Pm=xe(Jc,Rm,s=>{var{typed:e,matrix:t,equalScalar:r,divideScalar:n,DenseMatrix:i,concat:a}=s,u=Ng({typed:e,equalScalar:r}),f=Bi({typed:e}),c=lo({typed:e,DenseMatrix:i}),h=ja({typed:e,equalScalar:r}),d=Fi({typed:e,DenseMatrix:i}),p=ni({typed:e,matrix:t,concat:a});return e(Jc,p({elop:n,SS:c,DS:f,SD:u,Ss:h,sS:d}))}),co="compare",km=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],zm=xe(co,km,s=>{var{typed:e,config:t,equalScalar:r,matrix:n,BigNumber:i,Fraction:a,DenseMatrix:u,concat:f}=s,c=Bi({typed:e}),h=$c({typed:e,equalScalar:r}),d=Fi({typed:e,DenseMatrix:u}),p=ni({typed:e,matrix:n,concat:f}),v=ao({typed:e});return e(co,qm({typed:e,config:t}),{"boolean, boolean":function(_,y){return _===y?0:_>y?1:-1},"BigNumber, BigNumber":function(_,y){return oo(_,y,t.epsilon)?new i(0):new i(_.cmp(y))},"Fraction, Fraction":function(_,y){return new a(_.compare(y))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},v,p({SS:h,DS:c,Ss:d}))}),qm=xe(co,["typed","config"],s=>{var{typed:e,config:t}=s;return e(co,{"number, number":function(n,i){return ri(n,i,t.epsilon)?0:n>i?1:-1}})}),fo="equal",Um=["typed","matrix","equalScalar","DenseMatrix","concat"],Wm=xe(fo,Um,s=>{var{typed:e,matrix:t,equalScalar:r,DenseMatrix:n,concat:i}=s,a=Bi({typed:e}),u=lo({typed:e,DenseMatrix:n}),f=Fi({typed:e,DenseMatrix:n}),c=ni({typed:e,matrix:t,concat:i});return e(fo,Hm({typed:e,equalScalar:r}),c({elop:r,SS:u,DS:a,Ss:f}))}),Hm=xe(fo,["typed","equalScalar"],s=>{var{typed:e,equalScalar:t}=s;return e(fo,{"any, any":function(n,i){return n===null?i===null:i===null?n===null:n===void 0?i===void 0:i===void 0?n===void 0:t(n,i)}})}),ho="smaller",jm=["typed","config","matrix","DenseMatrix","concat"],Ym=xe(ho,jm,s=>{var{typed:e,config:t,matrix:r,DenseMatrix:n,concat:i}=s,a=Bi({typed:e}),u=lo({typed:e,DenseMatrix:n}),f=Fi({typed:e,DenseMatrix:n}),c=ni({typed:e,matrix:r,concat:i}),h=ao({typed:e});return e(ho,Km({typed:e,config:t}),{"boolean, boolean":(d,p)=>d<p,"BigNumber, BigNumber":function(p,v){return p.lt(v)&&!oo(p,v,t.epsilon)},"Fraction, Fraction":(d,p)=>d.compare(p)===-1,"Complex, Complex":function(p,v){throw new TypeError("No ordering relation is defined for complex numbers")}},h,c({SS:u,DS:a,Ss:f}))}),Km=xe(ho,["typed","config"],s=>{var{typed:e,config:t}=s;return e(ho,{"number, number":function(n,i){return n<i&&!ri(n,i,t.epsilon)}})}),po="larger",Zm=["typed","config","matrix","DenseMatrix","concat"],Vm=xe(po,Zm,s=>{var{typed:e,config:t,matrix:r,DenseMatrix:n,concat:i}=s,a=Bi({typed:e}),u=lo({typed:e,DenseMatrix:n}),f=Fi({typed:e,DenseMatrix:n}),c=ni({typed:e,matrix:r,concat:i}),h=ao({typed:e});return e(po,Gm({typed:e,config:t}),{"boolean, boolean":(d,p)=>d>p,"BigNumber, BigNumber":function(p,v){return p.gt(v)&&!oo(p,v,t.epsilon)},"Fraction, Fraction":(d,p)=>d.compare(p)===1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},h,c({SS:u,DS:a,Ss:f}))}),Gm=xe(po,["typed","config"],s=>{var{typed:e,config:t}=s;return e(po,{"number, number":function(n,i){return n>i&&!ri(n,i,t.epsilon)}})}),ef="deepEqual",Xm=["typed","equal"],Qm=xe(ef,Xm,s=>{var{typed:e,equal:t}=s;return e(ef,{"any, any":function(i,a){return r(i.valueOf(),a.valueOf())}});function r(n,i){if(Array.isArray(n))if(Array.isArray(i)){var a=n.length;if(a!==i.length)return!1;for(var u=0;u<a;u++)if(!r(n[u],i[u]))return!1;return!0}else return!1;else return Array.isArray(i)?!1:t(n,i)}}),tf="partitionSelect",Jm=["typed","isNumeric","isNaN","compare"],ex=xe(tf,Jm,s=>{var{typed:e,isNumeric:t,isNaN:r,compare:n}=s,i=n,a=(c,h)=>-n(c,h);return e(tf,{"Array | Matrix, number":function(h,d){return u(h,d,i)},"Array | Matrix, number, string":function(h,d,p){if(p==="asc")return u(h,d,i);if(p==="desc")return u(h,d,a);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":u});function u(c,h,d){if(!Et(h)||h<0)throw new Error("k must be a non-negative integer");if(xt(c)){var p=c.size();if(p.length>1)throw new Error("Only one dimensional matrices supported");return f(c.valueOf(),h,d)}if(Array.isArray(c))return f(c,h,d)}function f(c,h,d){if(h>=c.length)throw new Error("k out of bounds");for(var p=0;p<c.length;p++)if(t(c[p])&&r(c[p]))return c[p];for(var v=0,x=c.length-1;v<x;){for(var _=v,y=x,m=c[Math.floor(Math.random()*(x-v+1))+v];_<y;)if(d(c[_],m)>=0){var w=c[y];c[y]=c[_],c[_]=w,--y}else++_;d(c[_],m)>0&&--_,h<=_?x=_:v=_+1}return c[h]}}),rf="max",tx=["typed","config","numeric","larger"],rx=xe(rf,tx,s=>{var{typed:e,config:t,numeric:r,larger:n}=s;return e(rf,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(f,c){return Ha(f,c.valueOf(),i)},"...":function(f){if(no(f))throw new TypeError("Scalar values expected in function max");return a(f)}});function i(u,f){try{return n(u,f)?u:f}catch(c){throw Pn(c,"max",f)}}function a(u){var f;if(ls(u,function(c){try{isNaN(c)&&typeof c=="number"?f=NaN:(f===void 0||n(c,f))&&(f=c)}catch(h){throw Pn(h,"max",c)}}),f===void 0)throw new Error("Cannot calculate max of an empty array");return typeof f=="string"&&(f=r(f,t.number)),f}}),nf="min",nx=["typed","config","numeric","smaller"],ix=xe(nf,nx,s=>{var{typed:e,config:t,numeric:r,smaller:n}=s;return e(nf,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(f,c){return Ha(f,c.valueOf(),i)},"...":function(f){if(no(f))throw new TypeError("Scalar values expected in function min");return a(f)}});function i(u,f){try{return n(u,f)?u:f}catch(c){throw Pn(c,"min",f)}}function a(u){var f;if(ls(u,function(c){try{isNaN(c)&&typeof c=="number"?f=NaN:(f===void 0||n(c,f))&&(f=c)}catch(h){throw Pn(h,"min",c)}}),f===void 0)throw new Error("Cannot calculate min of an empty array");return typeof f=="string"&&(f=r(f,t.number)),f}}),sf="add",sx=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],ox=xe(sf,sx,s=>{var{typed:e,matrix:t,addScalar:r,equalScalar:n,DenseMatrix:i,SparseMatrix:a,concat:u}=s,f=Lc({typed:e}),c=Kg({typed:e,equalScalar:n}),h=Rc({typed:e,DenseMatrix:i}),d=ni({typed:e,matrix:t,concat:u});return e(sf,{"any, any":r,"any, any, ...any":e.referToSelf(p=>(v,x,_)=>{for(var y=p(v,x),m=0;m<_.length;m++)y=p(y,_[m]);return y})},d({elop:r,DS:f,SS:c,Ss:h}))}),of="dot",ax=["typed","addScalar","multiplyScalar","conj","size"],ux=xe(of,ax,s=>{var{typed:e,addScalar:t,multiplyScalar:r,conj:n,size:i}=s;return e(of,{"Array | DenseMatrix, Array | DenseMatrix":u,"SparseMatrix, SparseMatrix":f});function a(h,d){var p=c(h),v=c(d),x,_;if(p.length===1)x=p[0];else if(p.length===2&&p[1]===1)x=p[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+p.join(", ")+")");if(v.length===1)_=v[0];else if(v.length===2&&v[1]===1)_=v[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+v.join(", ")+")");if(x!==_)throw new RangeError("Vectors must have equal length ("+x+" != "+_+")");if(x===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return x}function u(h,d){var p=a(h,d),v=xt(h)?h._data:h,x=xt(h)?h._datatype||h.getDataType():void 0,_=xt(d)?d._data:d,y=xt(d)?d._datatype||d.getDataType():void 0,m=c(h).length===2,w=c(d).length===2,D=t,C=r;if(x&&y&&x===y&&typeof x=="string"&&x!=="mixed"){var b=x;D=e.find(t,[b,b]),C=e.find(r,[b,b])}if(!m&&!w){for(var F=C(n(v[0]),_[0]),B=1;B<p;B++)F=D(F,C(n(v[B]),_[B]));return F}if(!m&&w){for(var M=C(n(v[0]),_[0][0]),O=1;O<p;O++)M=D(M,C(n(v[O]),_[O][0]));return M}if(m&&!w){for(var A=C(n(v[0][0]),_[0]),N=1;N<p;N++)A=D(A,C(n(v[N][0]),_[N]));return A}if(m&&w){for(var I=C(n(v[0][0]),_[0][0]),L=1;L<p;L++)I=D(I,C(n(v[L][0]),_[L][0]));return I}}function f(h,d){a(h,d);for(var p=h._index,v=h._values,x=d._index,_=d._values,y=0,m=t,w=r,D=0,C=0;D<p.length&&C<x.length;){var b=p[D],F=x[C];if(b<F){D++;continue}if(b>F){C++;continue}b===F&&(y=m(y,w(v[D],_[C])),D++,C++)}return y}function c(h){return xt(h)?h.size():i(h)}}),lx="trace",cx=["typed","matrix","add"],fx=xe(lx,cx,s=>{var{typed:e,matrix:t,add:r}=s;return e("trace",{Array:function(u){return n(t(u))},SparseMatrix:i,DenseMatrix:n,any:ut});function n(a){var u=a._size,f=a._data;switch(u.length){case 1:if(u[0]===1)return ut(f[0]);throw new RangeError("Matrix must be square (size: "+ft(u)+")");case 2:{var c=u[0],h=u[1];if(c===h){for(var d=0,p=0;p<c;p++)d=r(d,f[p][p]);return d}else throw new RangeError("Matrix must be square (size: "+ft(u)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+ft(u)+")")}}function i(a){var u=a._values,f=a._index,c=a._ptr,h=a._size,d=h[0],p=h[1];if(d===p){var v=0;if(u.length>0)for(var x=0;x<p;x++)for(var _=c[x],y=c[x+1],m=_;m<y;m++){var w=f[m];if(w===x){v=r(v,u[m]);break}if(w>x)break}return v}throw new RangeError("Matrix must be square (size: "+ft(h)+")")}}),af="det",hx=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],dx=xe(af,hx,s=>{var{typed:e,matrix:t,subtractScalar:r,multiply:n,divideScalar:i,isZero:a,unaryMinus:u}=s;return e(af,{any:function(h){return ut(h)},"Array | Matrix":function(h){var d;switch(xt(h)?d=h.size():Array.isArray(h)?(h=t(h),d=h.size()):d=[],d.length){case 0:return ut(h);case 1:if(d[0]===1)return ut(h.valueOf()[0]);if(d[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+ft(d)+")");case 2:{var p=d[0],v=d[1];if(p===v)return f(h.clone().valueOf(),p);if(v===0)return 1;throw new RangeError("Matrix must be square (size: "+ft(d)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+ft(d)+")")}}});function f(c,h,d){if(h===1)return ut(c[0][0]);if(h===2)return r(n(c[0][0],c[1][1]),n(c[1][0],c[0][1]));for(var p=!1,v=new Array(h).fill(0).map((B,M)=>M),x=0;x<h;x++){var _=v[x];if(a(c[_][x])){var y=void 0;for(y=x+1;y<h;y++)if(!a(c[v[y]][x])){_=v[y],v[y]=v[x],v[x]=_,p=!p;break}if(y===h)return c[_][x]}for(var m=c[_][x],w=x===0?1:c[v[x-1]][x-1],D=x+1;D<h;D++)for(var C=v[D],b=x+1;b<h;b++)c[C][b]=i(r(n(c[C][b],m),n(c[C][x],c[_][b])),w)}var F=c[v[h-1]][h-1];return p?u(F):F}}),uf="inv",px=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],_x=xe(uf,px,s=>{var{typed:e,matrix:t,divideScalar:r,addScalar:n,multiply:i,unaryMinus:a,det:u,identity:f,abs:c}=s;return e(uf,{"Array | Matrix":function(p){var v=xt(p)?p.size():Pt(p);switch(v.length){case 1:if(v[0]===1)return xt(p)?t([r(1,p.valueOf()[0])]):[r(1,p[0])];throw new RangeError("Matrix must be square (size: "+ft(v)+")");case 2:{var x=v[0],_=v[1];if(x===_)return xt(p)?t(h(p.valueOf(),x,_),p.storage()):h(p,x,_);throw new RangeError("Matrix must be square (size: "+ft(v)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+ft(v)+")")}},any:function(p){return r(1,p)}});function h(d,p,v){var x,_,y,m,w;if(p===1){if(m=d[0][0],m===0)throw Error("Cannot calculate inverse, determinant is zero");return[[r(1,m)]]}else if(p===2){var D=u(d);if(D===0)throw Error("Cannot calculate inverse, determinant is zero");return[[r(d[1][1],D),r(a(d[0][1]),D)],[r(a(d[1][0]),D),r(d[0][0],D)]]}else{var C=d.concat();for(x=0;x<p;x++)C[x]=C[x].concat();for(var b=f(p).valueOf(),F=0;F<v;F++){var B=c(C[F][F]),M=F;for(x=F+1;x<p;)c(C[x][F])>B&&(B=c(C[x][F]),M=x),x++;if(B===0)throw Error("Cannot calculate inverse, determinant is zero");x=M,x!==F&&(w=C[F],C[F]=C[x],C[x]=w,w=b[F],b[F]=b[x],b[x]=w);var O=C[F],A=b[F];for(x=0;x<p;x++){var N=C[x],I=b[x];if(x!==F){if(N[F]!==0){for(y=r(a(N[F]),O[F]),_=F;_<v;_++)N[_]=n(N[_],i(y,O[_]));for(_=0;_<v;_++)I[_]=n(I[_],i(y,A[_]))}}else{for(y=O[F],_=F;_<v;_++)N[_]=r(N[_],y);for(_=0;_<v;_++)I[_]=r(I[_],y)}}}return b}}}),lf="pinv",vx=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],gx=xe(lf,vx,s=>{var{typed:e,matrix:t,inv:r,deepEqual:n,equal:i,dotDivide:a,dot:u,ctranspose:f,divideScalar:c,multiply:h,add:d,Complex:p}=s;return e(lf,{"Array | Matrix":function(D){var C=xt(D)?D.size():Pt(D);switch(C.length){case 1:return m(D)?f(D):C[0]===1?r(D):a(f(D),u(D,D));case 2:{if(m(D))return f(D);var b=C[0],F=C[1];if(b===F)try{return r(D)}catch(B){if(!(B instanceof Error&&B.message.match(/Cannot calculate inverse, determinant is zero/)))throw B}return xt(D)?t(v(D.valueOf(),b,F),D.storage()):v(D,b,F)}default:throw new RangeError("Matrix must be two dimensional (size: "+ft(C)+")")}},any:function(D){return i(D,0)?ut(D):c(1,D)}});function v(w,D,C){var{C:b,F}=_(w,D,C),B=h(r(h(f(b),b)),f(b)),M=h(f(F),r(h(F,f(F))));return h(M,B)}function x(w,D,C){for(var b=ut(w),F=0,B=0;B<D;B++){if(C<=F)return b;for(var M=B;y(b[M][F]);)if(M++,D===M&&(M=B,F++,C===F))return b;[b[M],b[B]]=[b[B],b[M]];for(var O=b[B][F],A=0;A<C;A++)b[B][A]=a(b[B][A],O);for(var N=0;N<D;N++)if(N!==B){O=b[N][F];for(var I=0;I<C;I++)b[N][I]=d(b[N][I],h(-1,h(O,b[B][I])))}F++}return b}function _(w,D,C){var b=x(w,D,C),F=w.map((M,O)=>M.filter((A,N)=>N<D&&!y(u(b[N],b[N])))),B=b.filter((M,O)=>!y(u(b[O],b[O])));return{C:F,F:B}}function y(w){return i(d(w,p(1,1)),d(0,p(1,1)))}function m(w){return n(d(w,p(1,1)),d(h(w,0),p(1,1)))}}),mx="divide",xx=["typed","matrix","multiply","equalScalar","divideScalar","inv"],yx=xe(mx,xx,s=>{var{typed:e,matrix:t,multiply:r,equalScalar:n,divideScalar:i,inv:a}=s,u=ja({typed:e,equalScalar:n}),f=Ya({typed:e});return e("divide",Bl({"Array | Matrix, Array | Matrix":function(h,d){return r(h,a(d))},"DenseMatrix, any":function(h,d){return f(h,d,i,!1)},"SparseMatrix, any":function(h,d){return u(h,d,i,!1)},"Array, any":function(h,d){return f(t(h),d,i,!1).valueOf()},"any, Array | Matrix":function(h,d){return r(h,a(d))}},i.signatures))}),cf="sum",Dx=["typed","config","add","numeric"],wx=xe(cf,Dx,s=>{var{typed:e,config:t,add:r,numeric:n}=s;return e(cf,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":a,"...":function(f){if(no(f))throw new TypeError("Scalar values expected in function sum");return i(f)}});function i(u){var f;return ls(u,function(c){try{f=f===void 0?c:r(f,c)}catch(h){throw Pn(h,"sum",c)}}),f===void 0&&(f=n(0,t.number)),typeof f=="string"&&(f=n(f,t.number)),f}function a(u,f){try{var c=Ha(u,f,r);return c}catch(h){throw Pn(h,"sum")}}}),ff="median",bx=["typed","add","divide","compare","partitionSelect"],Ex=xe(ff,bx,s=>{var{typed:e,add:t,divide:r,compare:n,partitionSelect:i}=s;function a(c){try{c=$a(c.valueOf());var h=c.length;if(h===0)throw new Error("Cannot calculate median of an empty array");if(h%2===0){for(var d=h/2-1,p=i(c,d+1),v=c[d],x=0;x<d;++x)n(c[x],v)>0&&(v=c[x]);return f(v,p)}else{var _=i(c,(h-1)/2);return u(_)}}catch(y){throw Pn(y,"median")}}var u=e({"number | BigNumber | Complex | Unit":function(h){return h}}),f=e({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(h,d){return r(t(h,d),2)}});return e(ff,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(h,d){throw new Error("median(A, dim) is not yet supported")},"...":function(h){if(no(h))throw new TypeError("Scalar values expected in function median");return a(h)}})}),Cx={},Ax=Object.freeze({__proto__:null,default:Cx}),Fx=Nt(Ax),_o=Cv({config:Er}),Ka=Mv({}),Za=Iv({}),Va=Lv({}),cn=kv({Matrix:Va}),Te=B_({BigNumber:_o,Complex:Ka,DenseMatrix:cn,Fraction:Za}),Bx=gg({typed:Te}),vo=xg({typed:Te}),Mx=ug({BigNumber:_o,typed:Te}),hf=om({typed:Te}),kn=Xv({config:Er,typed:Te}),go=Uv({typed:Te}),Nx=Yv({typed:Te}),mo=Qg({typed:Te}),df=sg({typed:Te}),Ga=eg({Matrix:Va,equalScalar:kn,typed:Te}),pf=Dg({typed:Te}),_f=Zv({typed:Te}),Xa=_g({typed:Te}),vf=fg({Fraction:Za,typed:Te}),gf=Hv({typed:Te}),kt=dg({DenseMatrix:cn,Matrix:Va,SparseMatrix:Ga,typed:Te}),mf=Fm({isNaN:_f,isNumeric:gf,typed:Te}),cs=Om({bignumber:Mx,fraction:vf,number:df}),Sx=Mm({config:Er,multiplyScalar:mo,numeric:cs,typed:Te}),Ox=xm({isInteger:go,matrix:kt,typed:Te}),xf=Dm({matrix:kt,config:Er,typed:Te}),yf=bm({matrix:kt,typed:Te}),ii=um({isInteger:go,matrix:kt,typed:Te}),Ix=cm({prod:Sx,size:xf,typed:Te}),Tx=Cm({conj:hf,transpose:yf,typed:Te}),fs=Tm({numeric:cs,typed:Te}),$x=Pm({DenseMatrix:cn,concat:ii,divideScalar:fs,equalScalar:kn,matrix:kt,typed:Te}),Df=Wm({DenseMatrix:cn,concat:ii,equalScalar:kn,matrix:kt,typed:Te}),wf=hm({BigNumber:_o,DenseMatrix:cn,SparseMatrix:Ga,config:Er,matrix:kt,typed:Te}),Lx=pm({matrix:kt,multiplyScalar:mo,typed:Te}),Rx=Ym({DenseMatrix:cn,concat:ii,config:Er,matrix:kt,typed:Te}),Px=rm({DenseMatrix:cn,concat:ii,equalScalar:kn,matrix:kt,subtractScalar:pf,typed:Te,unaryMinus:Xa}),hs=ox({DenseMatrix:cn,SparseMatrix:Ga,addScalar:vo,concat:ii,equalScalar:kn,matrix:kt,typed:Te}),bf=zm({BigNumber:_o,DenseMatrix:cn,Fraction:Za,concat:ii,config:Er,equalScalar:kn,matrix:kt,typed:Te}),kx=Qm({equal:Df,typed:Te}),Ef=ux({addScalar:vo,conj:hf,multiplyScalar:mo,size:xf,typed:Te}),zx=Vm({DenseMatrix:cn,concat:ii,config:Er,matrix:kt,typed:Te}),Qa=ix({config:Er,numeric:cs,smaller:Rx,typed:Te}),Mi=em({addScalar:vo,dot:Ef,equalScalar:kn,matrix:kt,multiplyScalar:mo,typed:Te}),qx=ex({compare:bf,isNaN:_f,isNumeric:gf,typed:Te}),Ux=wx({add:hs,config:Er,numeric:cs,typed:Te}),Wx=fx({add:hs,matrix:kt,typed:Te}),Cf=dx({divideScalar:fs,isZero:Nx,matrix:kt,multiply:Mi,subtractScalar:pf,typed:Te,unaryMinus:Xa}),Hx=rx({config:Er,larger:zx,numeric:cs,typed:Te}),xo=_x({abs:Bx,addScalar:vo,det:Cf,divideScalar:fs,identity:wf,matrix:kt,multiply:Mi,typed:Te,unaryMinus:Xa}),jx=gx({Complex:Ka,add:hs,ctranspose:Tx,deepEqual:kx,divideScalar:fs,dot:Ef,dotDivide:$x,equal:Df,inv:xo,matrix:kt,multiply:Mi,typed:Te}),Yx=Lm({Complex:Ka,config:Er,fraction:vf,identity:wf,inv:xo,matrix:kt,multiply:Mi,number:df,typed:Te}),Kx=yx({divideScalar:fs,equalScalar:kn,inv:xo,matrix:kt,multiply:Mi,typed:Te}),Af=Ex({add:hs,compare:bf,divide:Kx,partitionSelect:qx,typed:Te});class Zx{constructor(e,t,r){q(this,"_cacheData");q(this,"_variables");q(this,"_math");q(this,"_timeframe");this._cacheData={},this._variables=e,this._math=t,this._timeframe=r}alma({series:e,length:t,offset:r,sigma:n,floor:i},a){if(t===void 0||r===void 0||n===void 0)return;const u=this._cacheDataList(e,t,`alma_${a}`);if(u===void 0)return;let f=r*(t-1);i&&(f=Math.floor(f));const c=t/n;let h=0,d=0;for(let p=0;p<=t-1;p++){const v=Math.exp(-1*Math.pow(p-f,2)/(2*Math.pow(c,2)));h+=v,d+=u[u.length-1-(t-p-1)]*v}return d/h}sma({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return;let n=0;const i=this._cacheDataList(e,t,`sma_${r}`);if(i===void 0)return;const a=i.slice(-t);return n=Ux(...a)/t,n}rma({source:e,length:t},r){if(e===void 0||t===void 0||isNaN(e))return;this._cacheDataList(e,t,`sma_${r}`);const{sum:n}=this._cacheData[`rma_${r}`]||{},i=1/t,a=n===void 0?this.sma({source:e,length:t},r):i*e+(1-i)*(n||0);return this._cacheDataHandle(`rma_${r}`,{sum:a}),a}atr({length:e},t){const{high:r,close:n}=this._cacheData[`atr_${t}`]||{},{high:i,close:a,low:u}=this._variables,f=r===void 0?i-u:Math.max(Math.max(i-u,Math.abs(i-n)),Math.abs(u-n));return this._cacheDataHandle(`atr_${t}`,{high:i,close:a}),this.rma({source:f,length:e},t)}barssince({condition:e},t){let{count:r}=this._cacheData[`barssince_${t}`]||{};if(e)r=0;else{if(r===void 0)return;r+=1}return this._cacheDataHandle(`barssince_${t}`,{count:r}),r}stdev({source:e,length:t,biased:r=!0},n){if(e===void 0||isNaN(e)||t===void 0)return;const i=this._cacheDataList(e,t,`stdev_${n}`),a=this.sma({source:e,length:t},n);if(i===void 0)return;let u=0;for(let f=0;f<t;f++){const c=this._sum(i[i.length-1-f],-(a||0));u+=c*c}return r||t<=1?Math.sqrt(u/t):Math.sqrt(u/(t-1))}_sum(e,t){let n=e+t;return Math.abs(n)<=1e-10&&(n=0),n}bb({series:e,length:t,mult:r},n){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return[];const i=this.sma({source:e,length:t},n),a=this.stdev({source:e,length:t},n);if(i===void 0||a===void 0)return[];const u=r*a;return[i,i+u,i-u]}bbw({series:e,length:t,mult:r},n){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return;const i=this.sma({source:e,length:t},n),a=this.stdev({source:e,length:t},n);if(i===void 0||a===void 0)return;const u=r*a;return(i+u-(i-u))/i}cci({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return;const n=this.sma({source:e,length:t},r),i=this.dev({source:e,length:t},r);if(!(n===void 0||i===void 0))return(e-n)/(.015*i)}change({source:e,length:t=1},r){const n=this._cacheData[`change_${r}`]||[];n[this._variables.bar_index]=e,this._cacheData[`change_${r}`]=n;const i=n[n.length-1-t];if(!(e===void 0||isNaN(e)))return i===void 0?i:typeof e=="boolean"?i!==e:e-i}cmo({series:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return;const n=this.change({source:e},r);if(n===void 0)return;const i=this._math.sum({source:n>=0?n:0,length:t},`sm1_${r}`),a=this._math.sum({source:n>=0?0:-n,length:t},`sm2_${r}`);if(!(i===void 0||a===void 0))return 100*(i-a)/(i+a)}cog({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return;const n=this._cacheDataList(e,t,`cog_${r}`),i=this._math.sum({source:e,length:t},r);if(i===void 0||n===void 0)return;let a=0;for(let u=0;u<t;u++){const f=n[n.length-1-u];a+=f*(u+1)}return-a/i}correlation({source1:e,source2:t,length:r},n){if(e===void 0||isNaN(e)||t===void 0||isNaN(t)||r===void 0)return;const i=this._cacheDataList([e,t],r,`correlation_${n}`),a=this.sma({source:e,length:r},`sma1_${n}`),u=this.sma({source:t,length:r},`sma2_${n}`);if(a===void 0||u===void 0||i===void 0)return;let f=0,c=0,h=0;for(let p=0;p<r;p++){const[v,x]=i[i.length-1-p],_=v-a,y=x-u;f+=_*y,c+=_*_,h+=y*y}return isNaN(c)||isNaN(f)||isNaN(h)?void 0:f/Math.sqrt(c*h)}cross({source1:e,source2:t},r){if(e===void 0||t===void 0)return!1;const{source1:n,source2:i}=this._cacheData[`cross_${r}`]||{};return this._cacheDataHandle(`cross_${r}`,{source1:e,source2:t}),n===void 0||i===void 0?!1:n>=i&&e<t||n<=i&&e>t}crossover({source1:e,source2:t},r){if(e===void 0||t===void 0)return!1;const{source1:n,source2:i}=this._cacheData[`crossover_${r}`]||{};return this._cacheDataHandle(`crossover_${r}`,{source1:e,source2:t}),n===void 0||i===void 0?!1:n<=i&&e>t}crossunder({source1:e,source2:t},r){if(e===void 0||t===void 0)return!1;const{source1:n,source2:i}=this._cacheData[`crossunder_${r}`]||{};return this._cacheDataHandle(`crossunder_${r}`,{source1:e,source2:t}),n===void 0||i===void 0?!1:n>=i&&e<t}cum({source:e=0},t){e=isNaN(e)?0:e;let{sum:r}=this._cacheData[`cum_${t}`]||{};return r=r||0,r+=e,this._cacheDataHandle(`cum_${t}`,{sum:r}),r}dev({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return;const n=this.sma({source:e,length:t},r);let i=0;const a=this._cacheDataList(e,t,`dev_${r}`);if(!(!a||n===void 0)){for(let u=0;u<t;u++){const f=a[a.length-1-u];i+=Math.abs(f-n)}return i/t}}dmi({diLength:e,adxSmoothing:t},r){if(e===void 0||t===void 0)return[void 0,void 0,void 0];const n=`dmi_${r}`,{low:i,high:a,close:u,PDMS:f,NDMS:c,TRS:h,ADX:d,count:p=0}=this._cacheData[n]||{},{low:v,high:x,close:_}=this._variables;if(i===void 0||a===void 0||u===void 0)return this._cacheData[n]={low:v,high:x,close:_,PDMS:f,NDMS:c,TRS:x-v,count:1},[void 0,void 0,void 0];let y=x-a,m=i-v;y=y>m&&y>0?y:0,m=m>y&&m>0?m:0,y===m&&(y=m=0);const w=Math.max(x-v,Math.abs(x-u),Math.abs(v-u));if(p<e)return this._cacheDataHandle(n,{low:v,high:x,close:_,PDMS:(f||0)+y,NDMS:(c||0)+m,TRS:(h||0)+w,count:p+1}),[void 0,void 0,void 0];{const D=f-f/e+y,C=c-c/e+m,b=h-h/e+w,F=D/b*100,B=C/b*100,M=Math.abs((F-B)/(F+B))*100;let O=M,A=[F,B,void 0];if(p+1-e<t){const N=p+1-e;O=((d||0)*(N-1)+M)/N}else O=(d*(t-1)+M)/t,A=[F,B,O];return this._cacheDataHandle(n,{low:v,high:x,close:_,PDMS:D,NDMS:C,TRS:b,ADX:O,count:p+1}),A}}ema({source:e,length:t},r){if(e===void 0||t===void 0||isNaN(e))return;let{sum:n,count:i=1}=this._cacheData[`ema_${r}`]||{};const a=this.sma({source:e,length:t},r);if(i>t){const u=2/(t+1);n=n===void 0?e:u*e+(1-u)*(n||0)}else n=a;return i+=1,this._cacheDataHandle(`ema_${r}`,{sum:n,count:i}),n}falling({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return!1;const{source:n,fallings:i=[]}=this._cacheData[`falling_${r}`]||{};i.push(n>e);const a=i.slice(-t);return this._cacheDataHandle(`falling_${r}`,{source:e,fallings:a}),a.length<t?!1:a.every(u=>u)}rising({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return!1;const{source:n,risings:i=[]}=this._cacheData[`rising_${r}`]||{};i.push(n<e);const a=i.slice(-t);return this._cacheDataHandle(`rising_${r}`,{source:e,risings:a}),a.length<t?!1:a.every(u=>u)}highest({source:e,length:t},r){if(t===void 0||t<=0)return;const{high:n}=this._variables,i=this._cacheDataList(typeof e!="number"?n:e,t,`highest_${r}`);if(i)return Math.max(...i.slice(-t))}highestbars({source:e,length:t},r){if(t===void 0||t<=0)return;const{high:n}=this._variables,i=this._cacheDataList(typeof e!="number"?n:e,t,`highestbars_${r}`);return i?i.slice(-t).reduce((u,f,c,h)=>f>=h[u]?c:u,0)-t+1:void 0}wma({source:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const n=this._cacheDataList(e,t,`wma_${r}`);if(!n)return;let i=0,a=0;for(let u=0;u<t;u++){const f=(t-u)*t;i+=f,a+=n[n.length-1-u]*f}return a/i}hma({source:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const n=this.wma({source:e,length:t},r),i=this.wma({source:e,length:Math.round(t/2)},r);return n===void 0||i===void 0?void 0:this.wma({source:2*i-n,length:Math.floor(Math.sqrt(t))},`hma_${r}`)}kc({series:e,length:t,mult:r,useTrueRange:n=!0},i){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return[void 0,void 0,void 0];const a=this.ema({source:e,length:t},i),{ta:u,high:f,low:c}=this._variables,h=n?u.tr:f-c,d=this.ema({source:h,length:t},`range_${i}`);return[a,a+d*r,a-d*r]}kcw({series:e,length:t,mult:r,useTrueRange:n=!0},i){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return;const a=this.ema({source:e,length:t},i),{ta:u,high:f,low:c}=this._variables,h=n?u.tr:f-c,d=this.ema({source:h,length:t},`range_${i}`);return(a+d*r-(a-d*r))/a}linreg({source:e,length:t,offset:r},n){if(t===void 0||r===void 0)return;const i=this._cacheDataList(e,t,`dev_${n}`);if(!i)return;const a=i.slice(-t).filter(v=>v!==void 0);let u=0,f=0,c=0,h=0;for(const[v,x]of a.entries())u+=v,f+=x,c+=v*x,h+=v*v;const d=(t*c-u*f)/(t*h-u*u);return(f-d*u)/t+d*(t-1-r)}lowest({source:e,length:t},r){if(t===void 0||t<=0)return;const{low:n}=this._variables,i=this._cacheDataList(typeof e!="number"?n:e,t,`lowest_${r}`);if(i)return Math.min(...i.slice(-t))}lowestbars({source:e,length:t},r){if(t===void 0||t<=0)return;const{low:n}=this._variables,i=this._cacheDataList(typeof e!="number"?n:e,t,`lowestbars_${r}`);return i?i.slice(-t).reduce((u,f,c,h)=>f<=h[u]?c:u,0)-t+1:void 0}macd({source:e,fastlen:t,slowlen:r,siglen:n},i){if(e===void 0||isNaN(e)||t===void 0||r===void 0||n===void 0)return[void 0,void 0,void 0];const a=this.ema({source:e,length:t},`ema1_${i}`),u=this.ema({source:e,length:r},`ema2_${i}`);if(a===void 0||u===void 0)return[void 0,void 0,void 0];const f=a-u,c=this.ema({source:f,length:n},`macd_${i}`);if(c===void 0)return[f,c,void 0];const h=f-c;return[f,c,h]}max({source:e},t){if(e===void 0||isNaN(e))return;let r=this._cacheData[`max_${t}`]||0;return e>r&&(r=e),this._cacheData[`max_${t}`]=r,r}min({source:e},t){if(e===void 0||isNaN(e))return;let r=this._cacheData[`min_${t}`]||1/0;return e<r&&(r=e),this._cacheData[`min_${t}`]=r,r}median({source:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const n=this._cacheDataList(e,t,`dev_${r}`);if(n)return Af(n.slice(-t))}mfi({series:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const{volume:n}=this._variables,i=this.change({source:e},r),a=this._math.sum({source:n*(i>=0?0:e),length:t},`lower_${r}`),u=this._math.sum({source:n*(i<=0?0:e),length:t},`upper_${r}`);if(!(u===void 0||a===void 0))return 100-100/(1+u/a)}mode({source:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const n=this._cacheDataList(e,t,`mode_${r}`);if(n)return Qa(mf(n.slice(-t)))}mom({source:e,length:t},r){if(t===void 0||t<0)return;const n=`mom_${r}`,i=this._cacheData[n]||[];if(i[this._variables.bar_index]=e,this._cacheData[n]=i,i.length<=t||e===void 0||isNaN(e))return;let a=i.length-t-1,u;for(;u===void 0&&a>=0;)u=i[a],a--;return u===void 0?u:e-u}percentile_linear_interpolation({source:e,length:t,percentage:r},n){if(t===void 0||r===void 0||t<0||r<0||r>100)return;const i=this._cacheDataList(e,t+1,`percentile_linear_interpolation_${n}`);if(!i)return;const a=this._sort(i.slice(-(t+1))),u=a.length;r/=100;const f=1/(u*2);if(r<=f)return a[0];if(r>=1-1/(u*2))return a[u-1];for(const[c,h]of a.entries()){const d=a[c-1];if(r<(c+.5)/u)return d===void 0||h===void 0?void 0:d+(h-d)*(r-(c-.5)/u)/(1/u)}}percentile_nearest_rank({source:e,length:t,percentage:r},n){if(t===void 0||r===void 0||e===void 0||isNaN(e)||t<0||r<0||r>100)return;const i=this._cacheDataList(e,t,`percentile_nearest_rank_${n}`);if(!i)return;const a=this._sort(i.slice(-t)),u=r/100*a.length,f=Math.ceil(u)-1;return a[f>=a.length?a.length-1:f]}percentrank({source:e,length:t},r){if(t===void 0||t<0)return;const n=this._cacheDataList(e,t+1,`percentile_nearest_rank_${r}`);if(!n)return;const i=n.slice(-(t+1)),a=e;if(a===void 0)return;let u=0;for(let f=0;f<i.length;f++)i[f]!==void 0&&(i[f]<a||i[f]===a&&f<t)&&u++;return u/(i.length-1)*100}pivot_point_levels({type:e,anchor:t,developing:r},n){const i=new it;let{close:a,open:u,low:f,high:c}=this._variables;const h=`pivot_point_levels_${n}`,{close:d,low:p,high:v,open:x,result:_}=this._cacheData[h]||{};if(!t&&(v&&p&&(c=Math.max(v,c),f=Math.min(p,f)),this._cacheDataHandle(h,{close:a,open:u,low:f,high:c,result:_}),!r))return i._value=_||[],i;const y={close:a,open:u,low:f,high:c};t===!0&&!r&&(a=d,u=x,f=p,c=v);const m=this._getPivotPointLevels(c,f,a,u,r,e);return this._cacheDataHandle(h,{...y,result:m}),i._value=m,i}_getPivotPointLevels(e,t,r,n,i,a){if(r===void 0||n===void 0||t===void 0||e===void 0)return[];switch(a){case ti.traditional:return this._traditional(e,t,r);case ti.fibonacci:return this._fibonacci(e,t,r);case ti.woodie:return i?[]:this._woodie(e,t);case ti.classic:return this._classic(e,t,r);case ti.dm:return this._DM(e,t,r,n);case ti.camarilla:return this._camarilla(e,t,r);default:return[]}}_traditional(e,t,r){const n=(e+t+r)/3,i=n*2-t,a=n+(e-t),u=n*2+(e-2*t),f=n*3+(e-3*t),c=n*4+(e-4*t),h=n*2-e,d=n-(e-t),p=n*2-(2*e-t),v=n*3-(3*e-t),x=n*4-(4*e-t);return[n,i,h,a,d,u,p,f,v,c,x]}_fibonacci(e,t,r){const n=(e+t+r)/3,i=n+.382*(e-t),a=n-.382*(e-t),u=n+.618*(e-t),f=n-.618*(e-t),c=n+(e-t),h=n-(e-t);return[n,i,a,u,f,c,h]}_woodie(e,t){const{open:r}=this._variables,n=(e+t+2*r)/4,i=2*n-t,a=2*n-e,u=n+(e-t),f=n-(e-t),c=e+2*(n-t),h=t-2*(e-n),d=c+(e-t),p=h-(e-t);return[n,i,a,u,f,c,h,d,p]}_classic(e,t,r){const n=(e+t+r)/3,i=2*n-t,a=2*n-e,u=n+(e-t),f=n-(e-t),c=n+2*(e-t),h=n-2*(e-t),d=n+3*(e-t),p=n-3*(e-t);return[n,i,a,u,f,c,h,d,p]}_DM(e,t,r,n){let i;n===r?i=e+t+2*r:r>n?i=2*e+t+r:i=2*t+e+r;const a=i/4,u=i/2-t,f=i/2-e;return[a,u,f]}_camarilla(e,t,r){const n=(e+t+r)/3,i=r+1.1*(e-t)/12,a=r-1.1*(e-t)/12,u=r+1.1*(e-t)/6,f=r-1.1*(e-t)/6,c=r+1.1*(e-t)/4,h=r-1.1*(e-t)/4,d=r+1.1*(e-t)/2,p=r-1.1*(e-t)/2,v=e/t*r,x=r-(v-r);return[n,i,a,u,f,c,h,d,p,v,x]}pivothigh({source:e=this._variables.high,leftbars:t,rightbars:r},n){if(t===void 0||r===void 0||t<0||r<0)return;const i=this._cacheDataList(e,t+r+1,`pivothigh_${n}`);if(!i)return;const a=i.slice(-(t+r+1)),u=a[t];return Math.max(...a)===u?u:void 0}pivotlow({source:e=this._variables.low,leftbars:t,rightbars:r},n){if(t===void 0||r===void 0||t<0||r<0)return;const i=this._cacheDataList(e,t+r+1,`pivotlow_${n}`);if(!i)return;const a=i.slice(-(t+r+1)),u=a[t];return Math.min(...a)===u?u:void 0}range({source:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<0)return;const n=this._cacheDataList(e,t,`range_${r}`);if(!n)return;const i=n.filter(f=>f!==void 0).slice(-t),a=Math.max(...i),u=Math.min(...i);return a-u}roc({source:e,length:t},r){if(t===void 0||t<0)return;const n=this._cacheDataList(e,t+1,`roc_${r}`),i=this.change({source:e,length:t},r);if(n)return 100*i/n[n.length-1-t]}rsi({source:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<0)return;const{source:n}=this._cacheData[`rsi_${r}`]||{},i=Math.max(e-n,0),a=Math.max(n-e,0),u=this.rma({source:i,length:t},`rma1_${r}`),f=this.rma({source:a,length:t},`rma2_${r}`);if(this._cacheDataHandle(`rsi_${r}`,{source:e}),!(u===void 0||f===void 0))return 100-100/(1+u/f)}sar({start:e,inc:t,max:r},n){if(e===void 0||t===void 0||r===void 0)return;const{close:i,low:a,high:u,preLow:f,preHigh:c,data:h={}}=this._cacheData[`sar_${n}`]||{};let{result:d,maxMin:p,acceleration:v,isBelow:x}=h,_=!1;const{close:y,low:m,high:w,bar_index:D}=this._variables;return D===1&&(y>i?(x=!0,p=w,d=a):(x=!1,p=m,d=u),_=!0,v=e),d=d+v*(p-d),x?d>m&&(_=!0,x=!1,d=Math.max(w,p||0),p=m,v=e):d<w&&(_=!0,x=!0,d=Math.min(m,p||0),p=w,v=e),_||(x?w>(p||0)&&(p=w,v=Math.min((v||0)+t,r)):m<(p||0)&&(p=m,v=Math.min((v||0)+t,r))),x?(d=Math.min(d,a),D>1&&(d=Math.min(d,f))):(d=Math.max(d,u),D>1&&(d=Math.max(d,c))),this._cacheDataHandle(`sar_${n}`,{high:w,close:y,low:m,preLow:a,preHigh:u,data:Object.assign(h,{result:d,maxMin:p,acceleration:v,isBelow:x})}),d}stoch({source:e,high:t,low:r,length:n},i){if(n===void 0||t===void 0||r===void 0||e===void 0||isNaN(e)||n<0)return;const a=this.lowest({source:r,length:n},i),u=this.highest({source:t,length:n},i);if(!(a===void 0||u===void 0))return 100*(this._variables.close-a)/(u-a)}supertrend({factor:e,atrPeriod:t},r){if(e===void 0||t===void 0)return[void 0,void 0];const{hl2:n,close:i}=this._variables,a=`supertrend_${r}`,{upperBand:u,lowerBand:f,superTrend:c,atr:h,close:d}=this._cacheData[a]||{},p=this.atr({length:t},r);if(p===void 0)return this._cacheDataHandle(a,{close:i}),[void 0,void 0];let v=n+e*p,x=n-e*p;const _=u||0,y=f||0;x=x>y||d<y?x:y,v=v<_||d>_?v:_;let m;h===void 0?m=1:c===_?m=i>v?-1:1:m=i<x?1:-1;const w=m===-1?x:v;return this._cacheDataHandle(a,{upperBand:v,lowerBand:x,superTrend:w,atr:p,close:i}),[w,m]}swma({source:e},t){let{list:r}=this._cacheData[`swma_${t}`]||{};if(r||(r=[]),r.push(e),r=r.slice(-4),this._cacheDataHandle(`swma_${t}`,{list:r}),!(r.filter(n=>n!==void 0).length<4))return r[3]*1/6+r[2]*2/6+r[1]*2/6+r[0]*1/6}tr({handle_na:e=!1},t){const{close:r,low:n,high:i}=this._variables,{close:a}=this._cacheData[`tr_${t}`]||{};return this._cacheDataHandle(`tr_${t}`,{close:r}),a===void 0?e?i-n:void 0:Math.max(i-n,Math.abs(i-a),Math.abs(n-a))}tsi({source:e,short_length:t,long_length:r},n){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return;const i=this.change({source:e},n);if(i===void 0)return;const a=this.ema({source:Math.abs(i),length:t},`absema1_${n}`),u=this.ema({source:i,length:t},`ema1_${n}`);if(u===void 0)return;const f=this.ema({source:u,length:r},`ema2_${n}`),c=this.ema({source:a,length:t},`absema2_${n}`);if(f!==void 0)return f/c}valuewhen({condition:e,source:t,occurrence:r},n){if(t===void 0||r===void 0||r<0)return;let{list:i}=this._cacheData[`valuewhen_${n}`]||{};return i||(i=[]),e&&i.push(t),this._cacheDataHandle(`valuewhen_${n}`,{list:i}),i[i.length-1-r]}variance({source:e,length:t,biased:r=!0},n){if(e===void 0||isNaN(e)||t===void 0||t<0)return;const i=this.sma({source:e,length:t},n),a=this._cacheDataList(e,t,`mode_${n}`);if(!a||i===void 0)return;const u=a.filter(c=>c!==void 0&&!isNaN(c)).slice(-t);if(u.length<t)return;const f=u.reduce((c,h)=>c+Math.pow(h-i,2),0);if(f!==void 0)return r||t<=1?f/t:f/(t-1)}vwap({source:e,anchor:t,stdev_mult:r},n){if(e===void 0)return;t=t===void 0?this._timeframe.change({timeframe:"1D"},n):t;const{volume:i}=this._variables;let{sum:a=0,sumV:u=0,count:f=0,isReset:c,sumS:h=0}=this._cacheData[`vwap_${n}`]||{};if(t&&(a=u=f=h=0,c=!0),!c)return r!==void 0?[]:void 0;const d=e*i+a,p=i+u,v=d/p;return f++,r!==void 0?(h=i*Math.pow(e,2)+h,this._cacheDataHandle(`vwap_${n}`,{sum:d,sumV:p,count:f,isReset:c,sumS:h}),this._computeBands(h,p,r,v)):(this._cacheDataHandle(`vwap_${n}`,{sum:d,sumV:p,count:f,isReset:c}),v)}_computeBands(e,t,r,n){let i=e/t-Math.pow(n,2);i=i<0?0:i;const a=Math.sqrt(i),u=a!==void 0&&!isNaN(a)?n+r*a:void 0,f=a!==void 0&&!isNaN(a)?n-r*a:void 0;return[n,u,f]}vwma({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0||t<=0)return;const{volume:n}=this._variables,i=this.sma({source:e*n,length:t},`sma1_${r}`),a=this.sma({source:n,length:t},`sma2_${r}`);if(!(i===void 0||a===void 0))return i/a}wpr({length:e},t){if(e===void 0||e<=0)return;const r=this.highest({length:e},t),n=this.lowest({length:e},t),{close:i}=this._variables;if(!(r===void 0||n===void 0))return(r-i)/(r-n)*-100}_sort(e){const t=e.length;for(let r=0;r<t;r++){let n={};for(let i=0;i<t-r;i++){const{currentVal:a,currentIndex:u}=n,f=e[i];if(f!==void 0){if(a!==void 0&&f<a){e.splice(i,1),e.splice(u,0,f),n={currentIndex:u+1,currentVal:a};continue}n={currentIndex:i,currentVal:f}}}}return e}_cacheDataList(e,t,r){const n=this._cacheData[r]||{barIndex:-1,list:[]},{bar_index:i}=this._variables;if(n.barIndex<=i&&(n.barIndex===i?n.list[n.list.length-1]=e:n.list.push(e),n.barIndex=i,this._cacheData[r]=n),!(n.list.length<t))return n.list}_cacheDataHandle(e,t){const{barIndex:r}=this._cacheData[e]||{};r!==this._variables.bar_index&&(this._cacheData[e]=Object.assign(t,{barIndex:this._variables.bar_index}))}}class Vx{constructor(e,t,r){q(this,"_cacheData");q(this,"_variables");q(this,"_errorListener");q(this,"_historyInputs");q(this,"_name");this._cacheData={},this._variables=e,this._errorListener=t,this._name=`inputs_${r}`,this._historyInputs=self.workerStorage.get(this._name)||{}}update(e){for(const t of e){const r=t.id;this._cacheData[r]=Object.assign(this._cacheData[r]||{},{...t,isModify:!0}),self.workerStorage.updateValue(this._name,`in_${t.index}`,{modifyDefval:t.sourceTypeName||t.defval})}}input(e,t){return this._cacheHandle(e,t)}int(e,t){return this._cacheHandle(e,t,ur.INT)}bool(e,t){return this._cacheHandle(e,t,ur.BOOL)}color(e,t){return this._cacheHandle(e,t,ur.COLOR)}time(e,t){return this._cacheHandle(e,t,ur.TIME)}float(e,t){return this._cacheHandle(e,t,ur.FLOAT)}price(e,t){return this._cacheHandle(e,t,ur.PRICE)}source(e,t){return this._cacheHandle(e,t,ur.SOURCE)}string(e,t){return this._cacheHandle(e,t,ur.STRING)}symbol(e,t){return this._cacheHandle(e,t,ur.SYMBOL)}session(e,t){return this._cacheHandle(e,t,ur.SESSION)}text_area(e,t){return this._cacheHandle(e,t,ur.TEXT_AREA)}timeframe(e,t){return this._cacheHandle(e,t,ur.TIMEFRAME)}enum(e,t){return this._cacheHandle(e,t,ur.ENUM)}_cacheHandle(e,t,r){if(t.startsWith("export"))return e.defval;const n=`${r||"input"}_${t}`,i=this._cacheData[n];if(e.defval===void 0&&this._errorListener.addError(ct.inputDefvalErr,t,Ze.Error),i)i.isModify?i.sourceTypeName&&(this._cacheData[n].defval=this._variables[i.sourceTypeName]):Object.assign(this._cacheData[n],e);else{const{defval:a,display:u}=e;this._displayVerify(t,u),e={inputType:r,...e},this._cacheData[n]=e,this._judgeHistoryInputs(e),(r||e.inputType)===ur.SOURCE?this._cacheData[n].options=m1:e.options&&!e.options.includes(a)&&this._errorListener.addError(Zt(ct.inputOptErr,{defval:String(a),args:e.options.toString()}),t,Ze.Error,6+((r==null?void 0:r.length)||-1))}return this._cacheData[n].defval}_judgeHistoryInputs(e){const{defval:t,sourceTypeName:r,index:n}=e;let i=r||t;const a=`in_${n}`,u=this._historyInputs[a];if(!u)self.workerStorage.setValue(this._name,a,{defval:i});else{const{defval:f,modifyDefval:c}=u;f===i?i=c||i:self.workerStorage.setValue(this._name,a,{defval:i})}r?e.sourceTypeName=i:e.defval=i}_displayVerify(e,t){!t||!t.length||t.includes(Vt.dataWindow)||t.includes(Vt.statusLine)||this._errorListener.addError(Zt(ct.displayErr,{func:"input",values:"[display.none, display.data_window, display.status_line, display.all]"}),e,Ze.Error)}getInputs(){const e=Object.keys(this._cacheData),t=[];for(const r of e){const n=this._cacheData[r];n.id=r,t.push(n)}return t.sort((r,n)=>(r.index||0)-(n.index||0))}}class Gx{color({x:e}){return e}new({color:e,transp:t=100}){me(t)&&(t=100);const r=(100-t)/100,{r:n,g:i,b:a}=this._parseColor(e||"");return`rgba(${Math.round(n)}, ${Math.round(i)}, ${Math.round(a)}, ${r})`}rgb({red:e=0,green:t=0,blue:r=0,transp:n=0}){return me(n)&&(n=0),me(e)&&(e=0),me(t)&&(t=0),me(r)&&(r=0),`rgba(${e}, ${t}, ${r}, ${(100-n)/100})`}g({color:e}){return e?this._parseColor(e).g:0}r({color:e}){return e?this._parseColor(e).r:0}b({color:e}){return e?this._parseColor(e).b:0}t({color:e}){return e?Math.round(this._parseColor(e).a*100):0}from_gradient({value:e,bottom_value:t,top_value:r,bottom_color:n,top_color:i}){if(me(e)||me(t)||me(r)||r===t)return"rgba(0,0,0,1)";const a=(e-t)/(r-t),u=Math.min(Math.max(a,0),1),{r:f,g:c,b:h,a:d}=this._parseColor(n||"rgba(0,0,0,0)"),{r:p,g:v,b:x,a:_}=this._parseColor(i||"rgba(0,0,0,0)"),y=f+u*(p-f),m=c+u*(v-c),w=h+u*(x-h),D=d+u*(_-d);return`rgba(${Math.round(y)}, ${Math.round(m)}, ${Math.round(w)}, ${D.toFixed(2)})`}_parseColor(e){let t,r,n,i;if(e.startsWith("#")){t=parseInt(e.substring(1,3),16),r=parseInt(e.substring(3,5),16),n=parseInt(e.substring(5,7),16);const a=e.substring(7);a?i=parseInt(a,16)/255:i=1}else{const a=this._parserRgbColor(e);t=a[0]||0,r=a[1]||0,n=a[2]||0,i=a[3]||1}return{r:t,g:r,b:n,a:i}}_parserRgbColor(e){var t;return((t=e.match(/\d+/g))==null?void 0:t.map(Number))||[]}}var We={};const Xx=Object.prototype.toString;function ds(s){const e=Xx.call(s);return e.endsWith("Array]")&&!e.includes("Big")}var Qx=Object.freeze({__proto__:null,isAnyArray:ds}),Jx=Nt(Qx);function ey(s){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!ds(s))throw new TypeError("input must be an array");if(s.length===0)throw new TypeError("input must not be empty");var t=e.fromIndex,r=t===void 0?0:t,n=e.toIndex,i=n===void 0?s.length:n;if(r<0||r>=s.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(i<=r||i>s.length||!Number.isInteger(i))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=s[r],u=r+1;u<i;u++)s[u]>a&&(a=s[u]);return a}function ty(s){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!ds(s))throw new TypeError("input must be an array");if(s.length===0)throw new TypeError("input must not be empty");var t=e.fromIndex,r=t===void 0?0:t,n=e.toIndex,i=n===void 0?s.length:n;if(r<0||r>=s.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(i<=r||i>s.length||!Number.isInteger(i))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=s[r],u=r+1;u<i;u++)s[u]<a&&(a=s[u]);return a}function ry(s){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(ds(s)){if(s.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var t;if(e.output!==void 0){if(!ds(e.output))throw new TypeError("output option must be an array if specified");t=e.output}else t=new Array(s.length);var r=ty(s),n=ey(s);if(r===n)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var i=e.min,a=i===void 0?e.autoMinMax?r:0:i,u=e.max,f=u===void 0?e.autoMinMax?n:1:u;if(a>=f)throw new RangeError("min option must be smaller than max option");for(var c=(f-a)/(n-r),h=0;h<s.length;h++)t[h]=(s[h]-r)*c+a;return t}var ny=Object.freeze({__proto__:null,default:ry}),iy=Nt(ny);Object.defineProperty(We,"__esModule",{value:!0});var gr=Jx,Ff=iy;const yo=" ".repeat(2),Bf=" ".repeat(4);function sy(){return Mf(this)}function Mf(s,e={}){const{maxRows:t=15,maxColumns:r=10,maxNumSize:n=8,padMinus:i="auto"}=e;return`${s.constructor.name} {
55
55
  ${yo}[
56
56
  ${Bf}${oy(s,t,r,n,i)}
57
57
  ${yo}]
58
58
  ${yo}rows: ${s.rows}
59
59
  ${yo}columns: ${s.columns}
60
60
  }`}function oy(s,e,t,r,n){const{rows:i,columns:a}=s,u=Math.min(i,e),f=Math.min(a,t),c=[];if(n==="auto"){n=!1;e:for(let h=0;h<u;h++)for(let d=0;d<f;d++)if(s.get(h,d)<0){n=!0;break e}}for(let h=0;h<u;h++){let d=[];for(let p=0;p<f;p++)d.push(ay(s.get(h,p),r,n));c.push(`${d.join(" ")}`)}return f!==a&&(c[c.length-1]+=` ... ${a-t} more columns`),u!==i&&c.push(`... ${i-e} more rows`),c.join(`
61
- ${Bf}`)}function ay(s,e,t){return(s>=0&&t?` ${Nf(s,e-1)}`:Nf(s,e)).padEnd(e)}function Nf(s,e){let t=s.toString();if(t.length<=e)return t;let r=s.toFixed(e);if(r.length>e&&(r=s.toFixed(Math.max(0,e-(r.length-e)))),r.length<=e&&!r.startsWith("0.000")&&!r.startsWith("-0.000"))return r;let n=s.toExponential(e);return n.length>e&&(n=s.toExponential(Math.max(0,e-(n.length-e)))),n.slice(0)}function uy(s,e){s.prototype.add=function(r){return typeof r=="number"?this.addS(r):this.addM(r)},s.prototype.addS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)+r);return this},s.prototype.addM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)+r.get(n,i));return this},s.add=function(r,n){return new e(r).add(n)},s.prototype.sub=function(r){return typeof r=="number"?this.subS(r):this.subM(r)},s.prototype.subS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)-r);return this},s.prototype.subM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)-r.get(n,i));return this},s.sub=function(r,n){return new e(r).sub(n)},s.prototype.subtract=s.prototype.sub,s.prototype.subtractS=s.prototype.subS,s.prototype.subtractM=s.prototype.subM,s.subtract=s.sub,s.prototype.mul=function(r){return typeof r=="number"?this.mulS(r):this.mulM(r)},s.prototype.mulS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)*r);return this},s.prototype.mulM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)*r.get(n,i));return this},s.mul=function(r,n){return new e(r).mul(n)},s.prototype.multiply=s.prototype.mul,s.prototype.multiplyS=s.prototype.mulS,s.prototype.multiplyM=s.prototype.mulM,s.multiply=s.mul,s.prototype.div=function(r){return typeof r=="number"?this.divS(r):this.divM(r)},s.prototype.divS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)/r);return this},s.prototype.divM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)/r.get(n,i));return this},s.div=function(r,n){return new e(r).div(n)},s.prototype.divide=s.prototype.div,s.prototype.divideS=s.prototype.divS,s.prototype.divideM=s.prototype.divM,s.divide=s.div,s.prototype.mod=function(r){return typeof r=="number"?this.modS(r):this.modM(r)},s.prototype.modS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)%r);return this},s.prototype.modM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)%r.get(n,i));return this},s.mod=function(r,n){return new e(r).mod(n)},s.prototype.modulus=s.prototype.mod,s.prototype.modulusS=s.prototype.modS,s.prototype.modulusM=s.prototype.modM,s.modulus=s.mod,s.prototype.and=function(r){return typeof r=="number"?this.andS(r):this.andM(r)},s.prototype.andS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)&r);return this},s.prototype.andM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)&r.get(n,i));return this},s.and=function(r,n){return new e(r).and(n)},s.prototype.or=function(r){return typeof r=="number"?this.orS(r):this.orM(r)},s.prototype.orS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)|r);return this},s.prototype.orM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)|r.get(n,i));return this},s.or=function(r,n){return new e(r).or(n)},s.prototype.xor=function(r){return typeof r=="number"?this.xorS(r):this.xorM(r)},s.prototype.xorS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)^r);return this},s.prototype.xorM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)^r.get(n,i));return this},s.xor=function(r,n){return new e(r).xor(n)},s.prototype.leftShift=function(r){return typeof r=="number"?this.leftShiftS(r):this.leftShiftM(r)},s.prototype.leftShiftS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)<<r);return this},s.prototype.leftShiftM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)<<r.get(n,i));return this},s.leftShift=function(r,n){return new e(r).leftShift(n)},s.prototype.signPropagatingRightShift=function(r){return typeof r=="number"?this.signPropagatingRightShiftS(r):this.signPropagatingRightShiftM(r)},s.prototype.signPropagatingRightShiftS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)>>r);return this},s.prototype.signPropagatingRightShiftM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)>>r.get(n,i));return this},s.signPropagatingRightShift=function(r,n){return new e(r).signPropagatingRightShift(n)},s.prototype.rightShift=function(r){return typeof r=="number"?this.rightShiftS(r):this.rightShiftM(r)},s.prototype.rightShiftS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)>>>r);return this},s.prototype.rightShiftM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)>>>r.get(n,i));return this},s.rightShift=function(r,n){return new e(r).rightShift(n)},s.prototype.zeroFillRightShift=s.prototype.rightShift,s.prototype.zeroFillRightShiftS=s.prototype.rightShiftS,s.prototype.zeroFillRightShiftM=s.prototype.rightShiftM,s.zeroFillRightShift=s.rightShift,s.prototype.not=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,~this.get(r,n));return this},s.not=function(r){return new e(r).not()},s.prototype.abs=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.abs(this.get(r,n)));return this},s.abs=function(r){return new e(r).abs()},s.prototype.acos=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.acos(this.get(r,n)));return this},s.acos=function(r){return new e(r).acos()},s.prototype.acosh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.acosh(this.get(r,n)));return this},s.acosh=function(r){return new e(r).acosh()},s.prototype.asin=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.asin(this.get(r,n)));return this},s.asin=function(r){return new e(r).asin()},s.prototype.asinh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.asinh(this.get(r,n)));return this},s.asinh=function(r){return new e(r).asinh()},s.prototype.atan=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.atan(this.get(r,n)));return this},s.atan=function(r){return new e(r).atan()},s.prototype.atanh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.atanh(this.get(r,n)));return this},s.atanh=function(r){return new e(r).atanh()},s.prototype.cbrt=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.cbrt(this.get(r,n)));return this},s.cbrt=function(r){return new e(r).cbrt()},s.prototype.ceil=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.ceil(this.get(r,n)));return this},s.ceil=function(r){return new e(r).ceil()},s.prototype.clz32=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.clz32(this.get(r,n)));return this},s.clz32=function(r){return new e(r).clz32()},s.prototype.cos=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.cos(this.get(r,n)));return this},s.cos=function(r){return new e(r).cos()},s.prototype.cosh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.cosh(this.get(r,n)));return this},s.cosh=function(r){return new e(r).cosh()},s.prototype.exp=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.exp(this.get(r,n)));return this},s.exp=function(r){return new e(r).exp()},s.prototype.expm1=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.expm1(this.get(r,n)));return this},s.expm1=function(r){return new e(r).expm1()},s.prototype.floor=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.floor(this.get(r,n)));return this},s.floor=function(r){return new e(r).floor()},s.prototype.fround=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.fround(this.get(r,n)));return this},s.fround=function(r){return new e(r).fround()},s.prototype.log=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.log(this.get(r,n)));return this},s.log=function(r){return new e(r).log()},s.prototype.log1p=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.log1p(this.get(r,n)));return this},s.log1p=function(r){return new e(r).log1p()},s.prototype.log10=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.log10(this.get(r,n)));return this},s.log10=function(r){return new e(r).log10()},s.prototype.log2=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.log2(this.get(r,n)));return this},s.log2=function(r){return new e(r).log2()},s.prototype.round=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.round(this.get(r,n)));return this},s.round=function(r){return new e(r).round()},s.prototype.sign=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.sign(this.get(r,n)));return this},s.sign=function(r){return new e(r).sign()},s.prototype.sin=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.sin(this.get(r,n)));return this},s.sin=function(r){return new e(r).sin()},s.prototype.sinh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.sinh(this.get(r,n)));return this},s.sinh=function(r){return new e(r).sinh()},s.prototype.sqrt=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.sqrt(this.get(r,n)));return this},s.sqrt=function(r){return new e(r).sqrt()},s.prototype.tan=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.tan(this.get(r,n)));return this},s.tan=function(r){return new e(r).tan()},s.prototype.tanh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.tanh(this.get(r,n)));return this},s.tanh=function(r){return new e(r).tanh()},s.prototype.trunc=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.trunc(this.get(r,n)));return this},s.trunc=function(r){return new e(r).trunc()},s.pow=function(r,n){return new e(r).pow(n)},s.prototype.pow=function(r){return typeof r=="number"?this.powS(r):this.powM(r)},s.prototype.powS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.pow(this.get(n,i),r));return this},s.prototype.powM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.pow(this.get(n,i),r.get(n,i)));return this}}function $r(s,e,t){let r=t?s.rows:s.rows-1;if(e<0||e>r)throw new RangeError("Row index out of range")}function Lr(s,e,t){let r=t?s.columns:s.columns-1;if(e<0||e>r)throw new RangeError("Column index out of range")}function Ni(s,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==s.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function Si(s,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==s.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function Ja(s,e){if(!gr.isAnyArray(e))throw new TypeError("row indices must be an array");for(let t=0;t<e.length;t++)if(e[t]<0||e[t]>=s.rows)throw new RangeError("row indices are out of range")}function eu(s,e){if(!gr.isAnyArray(e))throw new TypeError("column indices must be an array");for(let t=0;t<e.length;t++)if(e[t]<0||e[t]>=s.columns)throw new RangeError("column indices are out of range")}function tu(s,e,t,r,n){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(wo("startRow",e),wo("endRow",t),wo("startColumn",r),wo("endColumn",n),e>t||r>n||e<0||e>=s.rows||t<0||t>=s.rows||r<0||r>=s.columns||n<0||n>=s.columns)throw new RangeError("Submatrix indices are out of range")}function Do(s,e=0){let t=[];for(let r=0;r<s;r++)t.push(e);return t}function wo(s,e){if(typeof e!="number")throw new TypeError(`${s} must be a number`)}function Oi(s){if(s.isEmpty())throw new Error("Empty matrix has no elements to index")}function ly(s){let e=Do(s.rows);for(let t=0;t<s.rows;++t)for(let r=0;r<s.columns;++r)e[t]+=s.get(t,r);return e}function cy(s){let e=Do(s.columns);for(let t=0;t<s.rows;++t)for(let r=0;r<s.columns;++r)e[r]+=s.get(t,r);return e}function fy(s){let e=0;for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)e+=s.get(t,r);return e}function hy(s){let e=Do(s.rows,1);for(let t=0;t<s.rows;++t)for(let r=0;r<s.columns;++r)e[t]*=s.get(t,r);return e}function dy(s){let e=Do(s.columns,1);for(let t=0;t<s.rows;++t)for(let r=0;r<s.columns;++r)e[r]*=s.get(t,r);return e}function py(s){let e=1;for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)e*=s.get(t,r);return e}function _y(s,e,t){const r=s.rows,n=s.columns,i=[];for(let a=0;a<r;a++){let u=0,f=0,c=0;for(let h=0;h<n;h++)c=s.get(a,h)-t[a],u+=c,f+=c*c;e?i.push((f-u*u/n)/(n-1)):i.push((f-u*u/n)/n)}return i}function vy(s,e,t){const r=s.rows,n=s.columns,i=[];for(let a=0;a<n;a++){let u=0,f=0,c=0;for(let h=0;h<r;h++)c=s.get(h,a)-t[a],u+=c,f+=c*c;e?i.push((f-u*u/r)/(r-1)):i.push((f-u*u/r)/r)}return i}function gy(s,e,t){const r=s.rows,n=s.columns,i=r*n;let a=0,u=0,f=0;for(let c=0;c<r;c++)for(let h=0;h<n;h++)f=s.get(c,h)-t,a+=f,u+=f*f;return e?(u-a*a/i)/(i-1):(u-a*a/i)/i}function my(s,e){for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)s.set(t,r,s.get(t,r)-e[t])}function xy(s,e){for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)s.set(t,r,s.get(t,r)-e[r])}function yy(s,e){for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)s.set(t,r,s.get(t,r)-e)}function Dy(s){const e=[];for(let t=0;t<s.rows;t++){let r=0;for(let n=0;n<s.columns;n++)r+=Math.pow(s.get(t,n),2)/(s.columns-1);e.push(Math.sqrt(r))}return e}function wy(s,e){for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)s.set(t,r,s.get(t,r)/e[t])}function Ey(s){const e=[];for(let t=0;t<s.columns;t++){let r=0;for(let n=0;n<s.rows;n++)r+=Math.pow(s.get(n,t),2)/(s.rows-1);e.push(Math.sqrt(r))}return e}function by(s,e){for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)s.set(t,r,s.get(t,r)/e[r])}function Ay(s){const e=s.size-1;let t=0;for(let r=0;r<s.columns;r++)for(let n=0;n<s.rows;n++)t+=Math.pow(s.get(n,r),2)/e;return Math.sqrt(t)}function Cy(s,e){for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)s.set(t,r,s.get(t,r)/e)}class ke{static from1DArray(e,t,r){if(e*t!==r.length)throw new RangeError("data length does not match given dimensions");let i=new ve(e,t);for(let a=0;a<e;a++)for(let u=0;u<t;u++)i.set(a,u,r[a*t+u]);return i}static rowVector(e){let t=new ve(1,e.length);for(let r=0;r<e.length;r++)t.set(0,r,e[r]);return t}static columnVector(e){let t=new ve(e.length,1);for(let r=0;r<e.length;r++)t.set(r,0,e[r]);return t}static zeros(e,t){return new ve(e,t)}static ones(e,t){return new ve(e,t).fill(1)}static rand(e,t,r={}){if(typeof r!="object")throw new TypeError("options must be an object");const{random:n=Math.random}=r;let i=new ve(e,t);for(let a=0;a<e;a++)for(let u=0;u<t;u++)i.set(a,u,n());return i}static randInt(e,t,r={}){if(typeof r!="object")throw new TypeError("options must be an object");const{min:n=0,max:i=1e3,random:a=Math.random}=r;if(!Number.isInteger(n))throw new TypeError("min must be an integer");if(!Number.isInteger(i))throw new TypeError("max must be an integer");if(n>=i)throw new RangeError("min must be smaller than max");let u=i-n,f=new ve(e,t);for(let c=0;c<e;c++)for(let h=0;h<t;h++){let d=n+Math.round(a()*u);f.set(c,h,d)}return f}static eye(e,t,r){t===void 0&&(t=e),r===void 0&&(r=1);let n=Math.min(e,t),i=this.zeros(e,t);for(let a=0;a<n;a++)i.set(a,a,r);return i}static diag(e,t,r){let n=e.length;t===void 0&&(t=n),r===void 0&&(r=t);let i=Math.min(n,t,r),a=this.zeros(t,r);for(let u=0;u<i;u++)a.set(u,u,e[u]);return a}static min(e,t){e=this.checkMatrix(e),t=this.checkMatrix(t);let r=e.rows,n=e.columns,i=new ve(r,n);for(let a=0;a<r;a++)for(let u=0;u<n;u++)i.set(a,u,Math.min(e.get(a,u),t.get(a,u)));return i}static max(e,t){e=this.checkMatrix(e),t=this.checkMatrix(t);let r=e.rows,n=e.columns,i=new this(r,n);for(let a=0;a<r;a++)for(let u=0;u<n;u++)i.set(a,u,Math.max(e.get(a,u),t.get(a,u)));return i}static checkMatrix(e){return ke.isMatrix(e)?e:new ve(e)}static isMatrix(e){return e!=null&&e.klass==="Matrix"}get size(){return this.rows*this.columns}apply(e){if(typeof e!="function")throw new TypeError("callback must be a function");for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)e.call(this,t,r);return this}to1DArray(){let e=[];for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)e.push(this.get(t,r));return e}to2DArray(){let e=[];for(let t=0;t<this.rows;t++){e.push([]);for(let r=0;r<this.columns;r++)e[t].push(this.get(t,r))}return e}toJSON(){return this.to2DArray()}isRowVector(){return this.rows===1}isColumnVector(){return this.columns===1}isVector(){return this.rows===1||this.columns===1}isSquare(){return this.rows===this.columns}isEmpty(){return this.rows===0||this.columns===0}isSymmetric(){if(this.isSquare()){for(let e=0;e<this.rows;e++)for(let t=0;t<=e;t++)if(this.get(e,t)!==this.get(t,e))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let e=0;e<this.rows;e++)if(this.get(e,e)!==0)return!1;return!0}isEchelonForm(){let e=0,t=0,r=-1,n=!0,i=!1;for(;e<this.rows&&n;){for(t=0,i=!1;t<this.columns&&i===!1;)this.get(e,t)===0?t++:this.get(e,t)===1&&t>r?(i=!0,r=t):(n=!1,i=!0);e++}return n}isReducedEchelonForm(){let e=0,t=0,r=-1,n=!0,i=!1;for(;e<this.rows&&n;){for(t=0,i=!1;t<this.columns&&i===!1;)this.get(e,t)===0?t++:this.get(e,t)===1&&t>r?(i=!0,r=t):(n=!1,i=!0);for(let a=t+1;a<this.rows;a++)this.get(e,a)!==0&&(n=!1);e++}return n}echelonForm(){let e=this.clone(),t=0,r=0;for(;t<e.rows&&r<e.columns;){let n=t;for(let i=t;i<e.rows;i++)e.get(i,r)>e.get(n,r)&&(n=i);if(e.get(n,r)===0)r++;else{e.swapRows(t,n);let i=e.get(t,r);for(let a=r;a<e.columns;a++)e.set(t,a,e.get(t,a)/i);for(let a=t+1;a<e.rows;a++){let u=e.get(a,r)/e.get(t,r);e.set(a,r,0);for(let f=r+1;f<e.columns;f++)e.set(a,f,e.get(a,f)-e.get(t,f)*u)}t++,r++}}return e}reducedEchelonForm(){let e=this.echelonForm(),t=e.columns,r=e.rows,n=r-1;for(;n>=0;)if(e.maxRow(n)===0)n--;else{let i=0,a=!1;for(;i<r&&a===!1;)e.get(n,i)===1?a=!0:i++;for(let u=0;u<n;u++){let f=e.get(u,i);for(let c=i;c<t;c++){let h=e.get(u,c)-f*e.get(n,c);e.set(u,c,h)}}n--}return e}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(e={}){if(typeof e!="object")throw new TypeError("options must be an object");const{rows:t=1,columns:r=1}=e;if(!Number.isInteger(t)||t<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(r)||r<=0)throw new TypeError("columns must be a positive integer");let n=new ve(this.rows*t,this.columns*r);for(let i=0;i<t;i++)for(let a=0;a<r;a++)n.setSubMatrix(this,this.rows*i,this.columns*a);return n}fill(e){for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,e);return this}neg(){return this.mulS(-1)}getRow(e){$r(this,e);let t=[];for(let r=0;r<this.columns;r++)t.push(this.get(e,r));return t}getRowVector(e){return ve.rowVector(this.getRow(e))}setRow(e,t){$r(this,e),t=Ni(this,t);for(let r=0;r<this.columns;r++)this.set(e,r,t[r]);return this}swapRows(e,t){$r(this,e),$r(this,t);for(let r=0;r<this.columns;r++){let n=this.get(e,r);this.set(e,r,this.get(t,r)),this.set(t,r,n)}return this}getColumn(e){Lr(this,e);let t=[];for(let r=0;r<this.rows;r++)t.push(this.get(r,e));return t}getColumnVector(e){return ve.columnVector(this.getColumn(e))}setColumn(e,t){Lr(this,e),t=Si(this,t);for(let r=0;r<this.rows;r++)this.set(r,e,t[r]);return this}swapColumns(e,t){Lr(this,e),Lr(this,t);for(let r=0;r<this.rows;r++){let n=this.get(r,e);this.set(r,e,this.get(r,t)),this.set(r,t,n)}return this}addRowVector(e){e=Ni(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)+e[r]);return this}subRowVector(e){e=Ni(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)-e[r]);return this}mulRowVector(e){e=Ni(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e[r]);return this}divRowVector(e){e=Ni(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)/e[r]);return this}addColumnVector(e){e=Si(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)+e[t]);return this}subColumnVector(e){e=Si(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)-e[t]);return this}mulColumnVector(e){e=Si(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e[t]);return this}divColumnVector(e){e=Si(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)/e[t]);return this}mulRow(e,t){$r(this,e);for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t);return this}mulColumn(e,t){Lr(this,e);for(let r=0;r<this.rows;r++)this.set(r,e,this.get(r,e)*t);return this}max(e){if(this.isEmpty())return NaN;switch(e){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>t[r]&&(t[r]=this.get(r,n));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>t[n]&&(t[n]=this.get(r,n));return t}case void 0:{let t=this.get(0,0);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>t&&(t=this.get(r,n));return t}default:throw new Error(`invalid option: ${e}`)}}maxIndex(){Oi(this);let e=this.get(0,0),t=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>e&&(e=this.get(r,n),t[0]=r,t[1]=n);return t}min(e){if(this.isEmpty())return NaN;switch(e){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<t[r]&&(t[r]=this.get(r,n));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<t[n]&&(t[n]=this.get(r,n));return t}case void 0:{let t=this.get(0,0);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<t&&(t=this.get(r,n));return t}default:throw new Error(`invalid option: ${e}`)}}minIndex(){Oi(this);let e=this.get(0,0),t=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<e&&(e=this.get(r,n),t[0]=r,t[1]=n);return t}maxRow(e){if($r(this,e),this.isEmpty())return NaN;let t=this.get(e,0);for(let r=1;r<this.columns;r++)this.get(e,r)>t&&(t=this.get(e,r));return t}maxRowIndex(e){$r(this,e),Oi(this);let t=this.get(e,0),r=[e,0];for(let n=1;n<this.columns;n++)this.get(e,n)>t&&(t=this.get(e,n),r[1]=n);return r}minRow(e){if($r(this,e),this.isEmpty())return NaN;let t=this.get(e,0);for(let r=1;r<this.columns;r++)this.get(e,r)<t&&(t=this.get(e,r));return t}minRowIndex(e){$r(this,e),Oi(this);let t=this.get(e,0),r=[e,0];for(let n=1;n<this.columns;n++)this.get(e,n)<t&&(t=this.get(e,n),r[1]=n);return r}maxColumn(e){if(Lr(this,e),this.isEmpty())return NaN;let t=this.get(0,e);for(let r=1;r<this.rows;r++)this.get(r,e)>t&&(t=this.get(r,e));return t}maxColumnIndex(e){Lr(this,e),Oi(this);let t=this.get(0,e),r=[0,e];for(let n=1;n<this.rows;n++)this.get(n,e)>t&&(t=this.get(n,e),r[0]=n);return r}minColumn(e){if(Lr(this,e),this.isEmpty())return NaN;let t=this.get(0,e);for(let r=1;r<this.rows;r++)this.get(r,e)<t&&(t=this.get(r,e));return t}minColumnIndex(e){Lr(this,e),Oi(this);let t=this.get(0,e),r=[0,e];for(let n=1;n<this.rows;n++)this.get(n,e)<t&&(t=this.get(n,e),r[0]=n);return r}diag(){let e=Math.min(this.rows,this.columns),t=[];for(let r=0;r<e;r++)t.push(this.get(r,r));return t}norm(e="frobenius"){switch(e){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${e}`)}}cumulativeSum(){let e=0;for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)e+=this.get(t,r),this.set(t,r,e);return this}dot(e){ke.isMatrix(e)&&(e=e.to1DArray());let t=this.to1DArray();if(t.length!==e.length)throw new RangeError("vectors do not have the same size");let r=0;for(let n=0;n<t.length;n++)r+=t[n]*e[n];return r}mmul(e){e=ve.checkMatrix(e);let t=this.rows,r=this.columns,n=e.columns,i=new ve(t,n),a=new Float64Array(r);for(let u=0;u<n;u++){for(let f=0;f<r;f++)a[f]=e.get(f,u);for(let f=0;f<t;f++){let c=0;for(let h=0;h<r;h++)c+=this.get(f,h)*a[h];i.set(f,u,c)}}return i}strassen2x2(e){e=ve.checkMatrix(e);let t=new ve(2,2);const r=this.get(0,0),n=e.get(0,0),i=this.get(0,1),a=e.get(0,1),u=this.get(1,0),f=e.get(1,0),c=this.get(1,1),h=e.get(1,1),d=(r+c)*(n+h),p=(u+c)*n,v=r*(a-h),x=c*(f-n),_=(r+i)*h,y=(u-r)*(n+a),m=(i-c)*(f+h),w=d+x-_+m,D=v+_,A=p+x,E=d-p+v+y;return t.set(0,0,w),t.set(0,1,D),t.set(1,0,A),t.set(1,1,E),t}strassen3x3(e){e=ve.checkMatrix(e);let t=new ve(3,3);const r=this.get(0,0),n=this.get(0,1),i=this.get(0,2),a=this.get(1,0),u=this.get(1,1),f=this.get(1,2),c=this.get(2,0),h=this.get(2,1),d=this.get(2,2),p=e.get(0,0),v=e.get(0,1),x=e.get(0,2),_=e.get(1,0),y=e.get(1,1),m=e.get(1,2),w=e.get(2,0),D=e.get(2,1),A=e.get(2,2),E=(r+n+i-a-u-h-d)*y,F=(r-a)*(-v+y),B=u*(-p+v+_-y-m-w+A),M=(-r+a+u)*(p-v+y),O=(a+u)*(-p+v),C=r*p,N=(-r+c+h)*(p-x+m),I=(-r+c)*(x-m),L=(c+h)*(-p+x),k=(r+n+i-u-f-c-h)*m,z=h*(-p+x+_-y-m-w+D),R=(-i+h+d)*(y+w-D),V=(i-d)*(y-D),H=i*w,ee=(h+d)*(-w+D),te=(-i+u+f)*(m+w-A),j=(i-f)*(m-A),X=(u+f)*(-w+A),Y=n*_,Q=f*D,pe=a*x,De=c*v,we=d*A,Ee=C+H+Y,Oe=E+M+O+C+R+H+ee,Fe=C+N+L+k+H+te+X,nt=F+B+M+C+H+te+j,Ye=F+M+O+C+Q,Ie=H+te+j+X+pe,Le=C+N+I+z+R+V+H,yt=R+V+H+ee+De,Wt=C+N+I+L+we;return t.set(0,0,Ee),t.set(0,1,Oe),t.set(0,2,Fe),t.set(1,0,nt),t.set(1,1,Ye),t.set(1,2,Ie),t.set(2,0,Le),t.set(2,1,yt),t.set(2,2,Wt),t}mmulStrassen(e){e=ve.checkMatrix(e);let t=this.clone(),r=t.rows,n=t.columns,i=e.rows,a=e.columns;n!==i&&console.warn(`Multiplying ${r} x ${n} and ${i} x ${a} matrix: dimensions do not match.`);function u(d,p,v){let x=d.rows,_=d.columns;if(x===p&&_===v)return d;{let y=ke.zeros(p,v);return y=y.setSubMatrix(d,0,0),y}}let f=Math.max(r,i),c=Math.max(n,a);t=u(t,f,c),e=u(e,f,c);function h(d,p,v,x){if(v<=512||x<=512)return d.mmul(p);v%2===1&&x%2===1?(d=u(d,v+1,x+1),p=u(p,v+1,x+1)):v%2===1?(d=u(d,v+1,x),p=u(p,v+1,x)):x%2===1&&(d=u(d,v,x+1),p=u(p,v,x+1));let _=parseInt(d.rows/2,10),y=parseInt(d.columns/2,10),m=d.subMatrix(0,_-1,0,y-1),w=p.subMatrix(0,_-1,0,y-1),D=d.subMatrix(0,_-1,y,d.columns-1),A=p.subMatrix(0,_-1,y,p.columns-1),E=d.subMatrix(_,d.rows-1,0,y-1),F=p.subMatrix(_,p.rows-1,0,y-1),B=d.subMatrix(_,d.rows-1,y,d.columns-1),M=p.subMatrix(_,p.rows-1,y,p.columns-1),O=h(ke.add(m,B),ke.add(w,M),_,y),C=h(ke.add(E,B),w,_,y),N=h(m,ke.sub(A,M),_,y),I=h(B,ke.sub(F,w),_,y),L=h(ke.add(m,D),M,_,y),k=h(ke.sub(E,m),ke.add(w,A),_,y),z=h(ke.sub(D,B),ke.add(F,M),_,y),R=ke.add(O,I);R.sub(L),R.add(z);let V=ke.add(N,L),H=ke.add(C,I),ee=ke.sub(O,C);ee.add(N),ee.add(k);let te=ke.zeros(2*R.rows,2*R.columns);return te=te.setSubMatrix(R,0,0),te=te.setSubMatrix(V,R.rows,0),te=te.setSubMatrix(H,0,R.columns),te=te.setSubMatrix(ee,R.rows,R.columns),te.subMatrix(0,v-1,0,x-1)}return h(t,e,f,c)}scaleRows(e={}){if(typeof e!="object")throw new TypeError("options must be an object");const{min:t=0,max:r=1}=e;if(!Number.isFinite(t))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(t>=r)throw new RangeError("min must be smaller than max");let n=new ve(this.rows,this.columns);for(let i=0;i<this.rows;i++){const a=this.getRow(i);a.length>0&&Ff(a,{min:t,max:r,output:a}),n.setRow(i,a)}return n}scaleColumns(e={}){if(typeof e!="object")throw new TypeError("options must be an object");const{min:t=0,max:r=1}=e;if(!Number.isFinite(t))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(t>=r)throw new RangeError("min must be smaller than max");let n=new ve(this.rows,this.columns);for(let i=0;i<this.columns;i++){const a=this.getColumn(i);a.length&&Ff(a,{min:t,max:r,output:a}),n.setColumn(i,a)}return n}flipRows(){const e=Math.ceil(this.columns/2);for(let t=0;t<this.rows;t++)for(let r=0;r<e;r++){let n=this.get(t,r),i=this.get(t,this.columns-1-r);this.set(t,r,i),this.set(t,this.columns-1-r,n)}return this}flipColumns(){const e=Math.ceil(this.rows/2);for(let t=0;t<this.columns;t++)for(let r=0;r<e;r++){let n=this.get(r,t),i=this.get(this.rows-1-r,t);this.set(r,t,i),this.set(this.rows-1-r,t,n)}return this}kroneckerProduct(e){e=ve.checkMatrix(e);let t=this.rows,r=this.columns,n=e.rows,i=e.columns,a=new ve(t*n,r*i);for(let u=0;u<t;u++)for(let f=0;f<r;f++)for(let c=0;c<n;c++)for(let h=0;h<i;h++)a.set(n*u+c,i*f+h,this.get(u,f)*e.get(c,h));return a}kroneckerSum(e){if(e=ve.checkMatrix(e),!this.isSquare()||!e.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let t=this.rows,r=e.rows,n=this.kroneckerProduct(ve.eye(r,r)),i=ve.eye(t,t).kroneckerProduct(e);return n.add(i)}transpose(){let e=new ve(this.columns,this.rows);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)e.set(r,t,this.get(t,r));return e}sortRows(e=Sf){for(let t=0;t<this.rows;t++)this.setRow(t,this.getRow(t).sort(e));return this}sortColumns(e=Sf){for(let t=0;t<this.columns;t++)this.setColumn(t,this.getColumn(t).sort(e));return this}subMatrix(e,t,r,n){tu(this,e,t,r,n);let i=new ve(t-e+1,n-r+1);for(let a=e;a<=t;a++)for(let u=r;u<=n;u++)i.set(a-e,u-r,this.get(a,u));return i}subMatrixRow(e,t,r){if(t===void 0&&(t=0),r===void 0&&(r=this.columns-1),t>r||t<0||t>=this.columns||r<0||r>=this.columns)throw new RangeError("Argument out of range");let n=new ve(e.length,r-t+1);for(let i=0;i<e.length;i++)for(let a=t;a<=r;a++){if(e[i]<0||e[i]>=this.rows)throw new RangeError(`Row index out of range: ${e[i]}`);n.set(i,a-t,this.get(e[i],a))}return n}subMatrixColumn(e,t,r){if(t===void 0&&(t=0),r===void 0&&(r=this.rows-1),t>r||t<0||t>=this.rows||r<0||r>=this.rows)throw new RangeError("Argument out of range");let n=new ve(r-t+1,e.length);for(let i=0;i<e.length;i++)for(let a=t;a<=r;a++){if(e[i]<0||e[i]>=this.columns)throw new RangeError(`Column index out of range: ${e[i]}`);n.set(a-t,i,this.get(a,e[i]))}return n}setSubMatrix(e,t,r){if(e=ve.checkMatrix(e),e.isEmpty())return this;let n=t+e.rows-1,i=r+e.columns-1;tu(this,t,n,r,i);for(let a=0;a<e.rows;a++)for(let u=0;u<e.columns;u++)this.set(t+a,r+u,e.get(a,u));return this}selection(e,t){Ja(this,e),eu(this,t);let r=new ve(e.length,t.length);for(let n=0;n<e.length;n++){let i=e[n];for(let a=0;a<t.length;a++){let u=t[a];r.set(n,a,this.get(i,u))}}return r}trace(){let e=Math.min(this.rows,this.columns),t=0;for(let r=0;r<e;r++)t+=this.get(r,r);return t}clone(){return this.constructor.copy(this,new ve(this.rows,this.columns))}static copy(e,t){for(const[r,n,i]of e.entries())t.set(r,n,i);return t}sum(e){switch(e){case"row":return ly(this);case"column":return cy(this);case void 0:return fy(this);default:throw new Error(`invalid option: ${e}`)}}product(e){switch(e){case"row":return hy(this);case"column":return dy(this);case void 0:return py(this);default:throw new Error(`invalid option: ${e}`)}}mean(e){const t=this.sum(e);switch(e){case"row":{for(let r=0;r<this.rows;r++)t[r]/=this.columns;return t}case"column":{for(let r=0;r<this.columns;r++)t[r]/=this.rows;return t}case void 0:return t/this.size;default:throw new Error(`invalid option: ${e}`)}}variance(e,t={}){if(typeof e=="object"&&(t=e,e=void 0),typeof t!="object")throw new TypeError("options must be an object");const{unbiased:r=!0,mean:n=this.mean(e)}=t;if(typeof r!="boolean")throw new TypeError("unbiased must be a boolean");switch(e){case"row":{if(!gr.isAnyArray(n))throw new TypeError("mean must be an array");return _y(this,r,n)}case"column":{if(!gr.isAnyArray(n))throw new TypeError("mean must be an array");return vy(this,r,n)}case void 0:{if(typeof n!="number")throw new TypeError("mean must be a number");return gy(this,r,n)}default:throw new Error(`invalid option: ${e}`)}}standardDeviation(e,t){typeof e=="object"&&(t=e,e=void 0);const r=this.variance(e,t);if(e===void 0)return Math.sqrt(r);for(let n=0;n<r.length;n++)r[n]=Math.sqrt(r[n]);return r}center(e,t={}){if(typeof e=="object"&&(t=e,e=void 0),typeof t!="object")throw new TypeError("options must be an object");const{center:r=this.mean(e)}=t;switch(e){case"row":{if(!gr.isAnyArray(r))throw new TypeError("center must be an array");return my(this,r),this}case"column":{if(!gr.isAnyArray(r))throw new TypeError("center must be an array");return xy(this,r),this}case void 0:{if(typeof r!="number")throw new TypeError("center must be a number");return yy(this,r),this}default:throw new Error(`invalid option: ${e}`)}}scale(e,t={}){if(typeof e=="object"&&(t=e,e=void 0),typeof t!="object")throw new TypeError("options must be an object");let r=t.scale;switch(e){case"row":{if(r===void 0)r=Dy(this);else if(!gr.isAnyArray(r))throw new TypeError("scale must be an array");return wy(this,r),this}case"column":{if(r===void 0)r=Ey(this);else if(!gr.isAnyArray(r))throw new TypeError("scale must be an array");return by(this,r),this}case void 0:{if(r===void 0)r=Ay(this);else if(typeof r!="number")throw new TypeError("scale must be a number");return Cy(this,r),this}default:throw new Error(`invalid option: ${e}`)}}toString(e){return Mf(this,e)}[Symbol.iterator](){return this.entries()}*entries(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)yield[e,t,this.get(e,t)]}*values(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)yield this.get(e,t)}}ke.prototype.klass="Matrix",typeof Symbol<"u"&&(ke.prototype[Symbol.for("nodejs.util.inspect.custom")]=sy);function Sf(s,e){return s-e}function Fy(s){return s.every(e=>typeof e=="number")}ke.random=ke.rand,ke.randomInt=ke.randInt,ke.diagonal=ke.diag,ke.prototype.diagonal=ke.prototype.diag,ke.identity=ke.eye,ke.prototype.negate=ke.prototype.neg,ke.prototype.tensorProduct=ke.prototype.kroneckerProduct;let ve=(Pi=class extends ke{constructor(t,r){super();vl(this,gs);U(this,"data");if(Pi.isMatrix(t))gl(this,gs,ml).call(this,t.rows,t.columns),Pi.copy(t,this);else if(Number.isInteger(t)&&t>=0)gl(this,gs,ml).call(this,t,r);else if(gr.isAnyArray(t)){const n=t;if(t=n.length,r=t?n[0].length:0,typeof r!="number")throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let i=0;i<t;i++){if(n[i].length!==r)throw new RangeError("Inconsistent array dimensions");if(!Fy(n[i]))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(n[i]))}this.rows=t,this.columns=r}else throw new TypeError("First argument must be a positive number or an array")}set(t,r,n){return this.data[t][r]=n,this}get(t,r){return this.data[t][r]}removeRow(t){return $r(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,r){return r===void 0&&(r=t,t=this.rows),$r(this,t,!0),r=Float64Array.from(Ni(this,r)),this.data.splice(t,0,r),this.rows+=1,this}removeColumn(t){Lr(this,t);for(let r=0;r<this.rows;r++){const n=new Float64Array(this.columns-1);for(let i=0;i<t;i++)n[i]=this.data[r][i];for(let i=t+1;i<this.columns;i++)n[i-1]=this.data[r][i];this.data[r]=n}return this.columns-=1,this}addColumn(t,r){typeof r>"u"&&(r=t,t=this.columns),Lr(this,t,!0),r=Si(this,r);for(let n=0;n<this.rows;n++){const i=new Float64Array(this.columns+1);let a=0;for(;a<t;a++)i[a]=this.data[n][a];for(i[a++]=r[n];a<this.columns+1;a++)i[a]=this.data[n][a-1];this.data[n]=i}return this.columns+=1,this}},gs=new WeakSet,ml=function(t,r){if(this.data=[],Number.isInteger(r)&&r>=0)for(let n=0;n<t;n++)this.data.push(new Float64Array(r));else throw new TypeError("nColumns must be a positive integer");this.rows=t,this.columns=r},Pi);uy(ke,ve);const Lo=class Lo extends ke{constructor(t){super();vl(this,rr,void 0);if(ve.isMatrix(t)){if(!t.isSymmetric())throw new TypeError("not symmetric data");Aa(this,rr,ve.copy(t,new ve(t.rows,t.rows)))}else if(Number.isInteger(t)&&t>=0)Aa(this,rr,new ve(t,t));else if(Aa(this,rr,new ve(t)),!this.isSymmetric())throw new TypeError("not symmetric data")}get size(){return on(this,rr).size}get rows(){return on(this,rr).rows}get columns(){return on(this,rr).columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(t){return ve.isMatrix(t)&&t.klassType==="SymmetricMatrix"}static zeros(t){return new this(t)}static ones(t){return new this(t).fill(1)}clone(){const t=new Lo(this.diagonalSize);for(const[r,n,i]of this.upperRightEntries())t.set(r,n,i);return t}toMatrix(){return new ve(this)}get(t,r){return on(this,rr).get(t,r)}set(t,r,n){return on(this,rr).set(t,r,n),on(this,rr).set(r,t,n),this}removeCross(t){return on(this,rr).removeRow(t),on(this,rr).removeColumn(t),this}addCross(t,r){r===void 0&&(r=t,t=this.diagonalSize);const n=r.slice();return n.splice(t,1),on(this,rr).addRow(t,n),on(this,rr).addColumn(t,r),this}applyMask(t){if(t.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const r=[];for(const[n,i]of t.entries())i||r.push(n);r.reverse();for(const n of r)this.removeCross(n);return this}toCompact(){const{diagonalSize:t}=this,r=new Array(t*(t+1)/2);for(let n=0,i=0,a=0;a<r.length;a++)r[a]=this.get(i,n),++n>=t&&(n=++i);return r}static fromCompact(t){const r=t.length,n=(Math.sqrt(8*r+1)-1)/2;if(!Number.isInteger(n))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(t)}`);const i=new Lo(n);for(let a=0,u=0,f=0;f<r;f++)i.set(a,u,t[f]),++a>=n&&(a=++u);return i}*upperRightEntries(){for(let t=0,r=0;t<this.diagonalSize;void 0){const n=this.get(t,r);yield[t,r,n],++r>=this.diagonalSize&&(r=++t)}}*upperRightValues(){for(let t=0,r=0;t<this.diagonalSize;void 0)yield this.get(t,r),++r>=this.diagonalSize&&(r=++t)}};rr=new WeakMap;let si=Lo;si.prototype.klassType="SymmetricMatrix";class Eo extends si{static isDistanceMatrix(e){return si.isSymmetricMatrix(e)&&e.klassSubType==="DistanceMatrix"}constructor(e){if(super(e),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(e,t,r){return e===t&&(r=0),super.set(e,t,r)}addCross(e,t){return t===void 0&&(t=e,e=this.diagonalSize),t=t.slice(),t[e]=0,super.addCross(e,t)}toSymmetricMatrix(){return new si(this)}clone(){const e=new Eo(this.diagonalSize);for(const[t,r,n]of this.upperRightEntries())t!==r&&e.set(t,r,n);return e}toCompact(){const{diagonalSize:e}=this,t=(e-1)*e/2,r=new Array(t);for(let n=1,i=0,a=0;a<r.length;a++)r[a]=this.get(i,n),++n>=e&&(n=++i+1);return r}static fromCompact(e){const t=e.length,r=(Math.sqrt(8*t+1)+1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(e)}`);const n=new this(r);for(let i=1,a=0,u=0;u<t;u++)n.set(i,a,e[u]),++i>=r&&(i=++a+1);return n}}Eo.prototype.klassSubType="DistanceMatrix";class yn extends ke{constructor(e,t,r){super(),this.matrix=e,this.rows=t,this.columns=r}}class By extends yn{constructor(e,t){Lr(e,t),super(e,e.rows,1),this.column=t}set(e,t,r){return this.matrix.set(e,this.column,r),this}get(e){return this.matrix.get(e,this.column)}}class My extends yn{constructor(e,t){eu(e,t),super(e,e.rows,t.length),this.columnIndices=t}set(e,t,r){return this.matrix.set(e,this.columnIndices[t],r),this}get(e,t){return this.matrix.get(e,this.columnIndices[t])}}class Ny extends yn{constructor(e){super(e,e.rows,e.columns)}set(e,t,r){return this.matrix.set(e,this.columns-t-1,r),this}get(e,t){return this.matrix.get(e,this.columns-t-1)}}class Sy extends yn{constructor(e){super(e,e.rows,e.columns)}set(e,t,r){return this.matrix.set(this.rows-e-1,t,r),this}get(e,t){return this.matrix.get(this.rows-e-1,t)}}class Oy extends yn{constructor(e,t){$r(e,t),super(e,1,e.columns),this.row=t}set(e,t,r){return this.matrix.set(this.row,t,r),this}get(e,t){return this.matrix.get(this.row,t)}}class Iy extends yn{constructor(e,t){Ja(e,t),super(e,t.length,e.columns),this.rowIndices=t}set(e,t,r){return this.matrix.set(this.rowIndices[e],t,r),this}get(e,t){return this.matrix.get(this.rowIndices[e],t)}}class bo extends yn{constructor(e,t,r){Ja(e,t),eu(e,r),super(e,t.length,r.length),this.rowIndices=t,this.columnIndices=r}set(e,t,r){return this.matrix.set(this.rowIndices[e],this.columnIndices[t],r),this}get(e,t){return this.matrix.get(this.rowIndices[e],this.columnIndices[t])}}class Ty extends yn{constructor(e,t,r,n,i){tu(e,t,r,n,i),super(e,r-t+1,i-n+1),this.startRow=t,this.startColumn=n}set(e,t,r){return this.matrix.set(this.startRow+e,this.startColumn+t,r),this}get(e,t){return this.matrix.get(this.startRow+e,this.startColumn+t)}}class $y extends yn{constructor(e){super(e,e.columns,e.rows)}set(e,t,r){return this.matrix.set(t,e,r),this}get(e,t){return this.matrix.get(t,e)}}class Of extends ke{constructor(e,t={}){const{rows:r=1}=t;if(e.length%r!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=r,this.columns=e.length/r,this.data=e}set(e,t,r){let n=this._calculateIndex(e,t);return this.data[n]=r,this}get(e,t){let r=this._calculateIndex(e,t);return this.data[r]}_calculateIndex(e,t){return e*this.columns+t}}class Ar extends ke{constructor(e){super(),this.data=e,this.rows=e.length,this.columns=e[0].length}set(e,t,r){return this.data[e][t]=r,this}get(e,t){return this.data[e][t]}}function Ly(s,e){if(gr.isAnyArray(s))return s[0]&&gr.isAnyArray(s[0])?new Ar(s):new Of(s,e);throw new Error("the argument is not an array")}class Ao{constructor(e){e=Ar.checkMatrix(e);let t=e.clone(),r=t.rows,n=t.columns,i=new Float64Array(r),a=1,u,f,c,h,d,p,v,x,_;for(u=0;u<r;u++)i[u]=u;for(x=new Float64Array(r),f=0;f<n;f++){for(u=0;u<r;u++)x[u]=t.get(u,f);for(u=0;u<r;u++){for(_=Math.min(u,f),d=0,c=0;c<_;c++)d+=t.get(u,c)*x[c];x[u]-=d,t.set(u,f,x[u])}for(h=f,u=f+1;u<r;u++)Math.abs(x[u])>Math.abs(x[h])&&(h=u);if(h!==f){for(c=0;c<n;c++)p=t.get(h,c),t.set(h,c,t.get(f,c)),t.set(f,c,p);v=i[h],i[h]=i[f],i[f]=v,a=-a}if(f<r&&t.get(f,f)!==0)for(u=f+1;u<r;u++)t.set(u,f,t.get(u,f)/t.get(f,f))}this.LU=t,this.pivotVector=i,this.pivotSign=a}isSingular(){let e=this.LU,t=e.columns;for(let r=0;r<t;r++)if(e.get(r,r)===0)return!0;return!1}solve(e){e=ve.checkMatrix(e);let t=this.LU;if(t.rows!==e.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let n=e.columns,i=e.subMatrixRow(this.pivotVector,0,n-1),a=t.columns,u,f,c;for(c=0;c<a;c++)for(u=c+1;u<a;u++)for(f=0;f<n;f++)i.set(u,f,i.get(u,f)-i.get(c,f)*t.get(u,c));for(c=a-1;c>=0;c--){for(f=0;f<n;f++)i.set(c,f,i.get(c,f)/t.get(c,c));for(u=0;u<c;u++)for(f=0;f<n;f++)i.set(u,f,i.get(u,f)-i.get(c,f)*t.get(u,c))}return i}get determinant(){let e=this.LU;if(!e.isSquare())throw new Error("Matrix must be square");let t=this.pivotSign,r=e.columns;for(let n=0;n<r;n++)t*=e.get(n,n);return t}get lowerTriangularMatrix(){let e=this.LU,t=e.rows,r=e.columns,n=new ve(t,r);for(let i=0;i<t;i++)for(let a=0;a<r;a++)i>a?n.set(i,a,e.get(i,a)):i===a?n.set(i,a,1):n.set(i,a,0);return n}get upperTriangularMatrix(){let e=this.LU,t=e.rows,r=e.columns,n=new ve(t,r);for(let i=0;i<t;i++)for(let a=0;a<r;a++)i<=a?n.set(i,a,e.get(i,a)):n.set(i,a,0);return n}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function Dn(s,e){let t=0;return Math.abs(s)>Math.abs(e)?(t=e/s,Math.abs(s)*Math.sqrt(1+t*t)):e!==0?(t=s/e,Math.abs(e)*Math.sqrt(1+t*t)):0}class ru{constructor(e){e=Ar.checkMatrix(e);let t=e.clone(),r=e.rows,n=e.columns,i=new Float64Array(n),a,u,f,c;for(f=0;f<n;f++){let h=0;for(a=f;a<r;a++)h=Dn(h,t.get(a,f));if(h!==0){for(t.get(f,f)<0&&(h=-h),a=f;a<r;a++)t.set(a,f,t.get(a,f)/h);for(t.set(f,f,t.get(f,f)+1),u=f+1;u<n;u++){for(c=0,a=f;a<r;a++)c+=t.get(a,f)*t.get(a,u);for(c=-c/t.get(f,f),a=f;a<r;a++)t.set(a,u,t.get(a,u)+c*t.get(a,f))}}i[f]=-h}this.QR=t,this.Rdiag=i}solve(e){e=ve.checkMatrix(e);let t=this.QR,r=t.rows;if(e.rows!==r)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let n=e.columns,i=e.clone(),a=t.columns,u,f,c,h;for(c=0;c<a;c++)for(f=0;f<n;f++){for(h=0,u=c;u<r;u++)h+=t.get(u,c)*i.get(u,f);for(h=-h/t.get(c,c),u=c;u<r;u++)i.set(u,f,i.get(u,f)+h*t.get(u,c))}for(c=a-1;c>=0;c--){for(f=0;f<n;f++)i.set(c,f,i.get(c,f)/this.Rdiag[c]);for(u=0;u<c;u++)for(f=0;f<n;f++)i.set(u,f,i.get(u,f)-i.get(c,f)*t.get(u,c))}return i.subMatrix(0,a-1,0,n-1)}isFullRank(){let e=this.QR.columns;for(let t=0;t<e;t++)if(this.Rdiag[t]===0)return!1;return!0}get upperTriangularMatrix(){let e=this.QR,t=e.columns,r=new ve(t,t),n,i;for(n=0;n<t;n++)for(i=0;i<t;i++)n<i?r.set(n,i,e.get(n,i)):n===i?r.set(n,i,this.Rdiag[n]):r.set(n,i,0);return r}get orthogonalMatrix(){let e=this.QR,t=e.rows,r=e.columns,n=new ve(t,r),i,a,u,f;for(u=r-1;u>=0;u--){for(i=0;i<t;i++)n.set(i,u,0);for(n.set(u,u,1),a=u;a<r;a++)if(e.get(u,u)!==0){for(f=0,i=u;i<t;i++)f+=e.get(i,u)*n.get(i,a);for(f=-f/e.get(u,u),i=u;i<t;i++)n.set(i,a,n.get(i,a)+f*e.get(i,u))}}return n}}class Ii{constructor(e,t={}){if(e=Ar.checkMatrix(e),e.isEmpty())throw new Error("Matrix must be non-empty");let r=e.rows,n=e.columns;const{computeLeftSingularVectors:i=!0,computeRightSingularVectors:a=!0,autoTranspose:u=!1}=t;let f=!!i,c=!!a,h=!1,d;if(r<n)if(!u)d=e.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else{d=e.transpose(),r=d.rows,n=d.columns,h=!0;let C=f;f=c,c=C}else d=e.clone();let p=Math.min(r,n),v=Math.min(r+1,n),x=new Float64Array(v),_=new ve(r,p),y=new ve(n,n),m=new Float64Array(n),w=new Float64Array(r),D=new Float64Array(v);for(let C=0;C<v;C++)D[C]=C;let A=Math.min(r-1,n),E=Math.max(0,Math.min(n-2,r)),F=Math.max(A,E);for(let C=0;C<F;C++){if(C<A){x[C]=0;for(let N=C;N<r;N++)x[C]=Dn(x[C],d.get(N,C));if(x[C]!==0){d.get(C,C)<0&&(x[C]=-x[C]);for(let N=C;N<r;N++)d.set(N,C,d.get(N,C)/x[C]);d.set(C,C,d.get(C,C)+1)}x[C]=-x[C]}for(let N=C+1;N<n;N++){if(C<A&&x[C]!==0){let I=0;for(let L=C;L<r;L++)I+=d.get(L,C)*d.get(L,N);I=-I/d.get(C,C);for(let L=C;L<r;L++)d.set(L,N,d.get(L,N)+I*d.get(L,C))}m[N]=d.get(C,N)}if(f&&C<A)for(let N=C;N<r;N++)_.set(N,C,d.get(N,C));if(C<E){m[C]=0;for(let N=C+1;N<n;N++)m[C]=Dn(m[C],m[N]);if(m[C]!==0){m[C+1]<0&&(m[C]=0-m[C]);for(let N=C+1;N<n;N++)m[N]/=m[C];m[C+1]+=1}if(m[C]=-m[C],C+1<r&&m[C]!==0){for(let N=C+1;N<r;N++)w[N]=0;for(let N=C+1;N<r;N++)for(let I=C+1;I<n;I++)w[N]+=m[I]*d.get(N,I);for(let N=C+1;N<n;N++){let I=-m[N]/m[C+1];for(let L=C+1;L<r;L++)d.set(L,N,d.get(L,N)+I*w[L])}}if(c)for(let N=C+1;N<n;N++)y.set(N,C,m[N])}}let B=Math.min(n,r+1);if(A<n&&(x[A]=d.get(A,A)),r<B&&(x[B-1]=0),E+1<B&&(m[E]=d.get(E,B-1)),m[B-1]=0,f){for(let C=A;C<p;C++){for(let N=0;N<r;N++)_.set(N,C,0);_.set(C,C,1)}for(let C=A-1;C>=0;C--)if(x[C]!==0){for(let N=C+1;N<p;N++){let I=0;for(let L=C;L<r;L++)I+=_.get(L,C)*_.get(L,N);I=-I/_.get(C,C);for(let L=C;L<r;L++)_.set(L,N,_.get(L,N)+I*_.get(L,C))}for(let N=C;N<r;N++)_.set(N,C,-_.get(N,C));_.set(C,C,1+_.get(C,C));for(let N=0;N<C-1;N++)_.set(N,C,0)}else{for(let N=0;N<r;N++)_.set(N,C,0);_.set(C,C,1)}}if(c)for(let C=n-1;C>=0;C--){if(C<E&&m[C]!==0)for(let N=C+1;N<n;N++){let I=0;for(let L=C+1;L<n;L++)I+=y.get(L,C)*y.get(L,N);I=-I/y.get(C+1,C);for(let L=C+1;L<n;L++)y.set(L,N,y.get(L,N)+I*y.get(L,C))}for(let N=0;N<n;N++)y.set(N,C,0);y.set(C,C,1)}let M=B-1,O=Number.EPSILON;for(;B>0;){let C,N;for(C=B-2;C>=-1&&C!==-1;C--){const I=Number.MIN_VALUE+O*Math.abs(x[C]+Math.abs(x[C+1]));if(Math.abs(m[C])<=I||Number.isNaN(m[C])){m[C]=0;break}}if(C===B-2)N=4;else{let I;for(I=B-1;I>=C&&I!==C;I--){let L=(I!==B?Math.abs(m[I]):0)+(I!==C+1?Math.abs(m[I-1]):0);if(Math.abs(x[I])<=O*L){x[I]=0;break}}I===C?N=3:I===B-1?N=1:(N=2,C=I)}switch(C++,N){case 1:{let I=m[B-2];m[B-2]=0;for(let L=B-2;L>=C;L--){let k=Dn(x[L],I),z=x[L]/k,R=I/k;if(x[L]=k,L!==C&&(I=-R*m[L-1],m[L-1]=z*m[L-1]),c)for(let V=0;V<n;V++)k=z*y.get(V,L)+R*y.get(V,B-1),y.set(V,B-1,-R*y.get(V,L)+z*y.get(V,B-1)),y.set(V,L,k)}break}case 2:{let I=m[C-1];m[C-1]=0;for(let L=C;L<B;L++){let k=Dn(x[L],I),z=x[L]/k,R=I/k;if(x[L]=k,I=-R*m[L],m[L]=z*m[L],f)for(let V=0;V<r;V++)k=z*_.get(V,L)+R*_.get(V,C-1),_.set(V,C-1,-R*_.get(V,L)+z*_.get(V,C-1)),_.set(V,L,k)}break}case 3:{const I=Math.max(Math.abs(x[B-1]),Math.abs(x[B-2]),Math.abs(m[B-2]),Math.abs(x[C]),Math.abs(m[C])),L=x[B-1]/I,k=x[B-2]/I,z=m[B-2]/I,R=x[C]/I,V=m[C]/I,H=((k+L)*(k-L)+z*z)/2,ee=L*z*(L*z);let te=0;(H!==0||ee!==0)&&(H<0?te=0-Math.sqrt(H*H+ee):te=Math.sqrt(H*H+ee),te=ee/(H+te));let j=(R+L)*(R-L)+te,X=R*V;for(let Y=C;Y<B-1;Y++){let Q=Dn(j,X);Q===0&&(Q=Number.MIN_VALUE);let pe=j/Q,De=X/Q;if(Y!==C&&(m[Y-1]=Q),j=pe*x[Y]+De*m[Y],m[Y]=pe*m[Y]-De*x[Y],X=De*x[Y+1],x[Y+1]=pe*x[Y+1],c)for(let we=0;we<n;we++)Q=pe*y.get(we,Y)+De*y.get(we,Y+1),y.set(we,Y+1,-De*y.get(we,Y)+pe*y.get(we,Y+1)),y.set(we,Y,Q);if(Q=Dn(j,X),Q===0&&(Q=Number.MIN_VALUE),pe=j/Q,De=X/Q,x[Y]=Q,j=pe*m[Y]+De*x[Y+1],x[Y+1]=-De*m[Y]+pe*x[Y+1],X=De*m[Y+1],m[Y+1]=pe*m[Y+1],f&&Y<r-1)for(let we=0;we<r;we++)Q=pe*_.get(we,Y)+De*_.get(we,Y+1),_.set(we,Y+1,-De*_.get(we,Y)+pe*_.get(we,Y+1)),_.set(we,Y,Q)}m[B-2]=j;break}case 4:{if(x[C]<=0&&(x[C]=x[C]<0?-x[C]:0,c))for(let I=0;I<=M;I++)y.set(I,C,-y.get(I,C));for(;C<M&&!(x[C]>=x[C+1]);){let I=x[C];if(x[C]=x[C+1],x[C+1]=I,c&&C<n-1)for(let L=0;L<n;L++)I=y.get(L,C+1),y.set(L,C+1,y.get(L,C)),y.set(L,C,I);if(f&&C<r-1)for(let L=0;L<r;L++)I=_.get(L,C+1),_.set(L,C+1,_.get(L,C)),_.set(L,C,I);C++}B--;break}}}if(h){let C=y;y=_,_=C}this.m=r,this.n=n,this.s=x,this.U=_,this.V=y}solve(e){let t=e,r=this.threshold,n=this.s.length,i=ve.zeros(n,n);for(let p=0;p<n;p++)Math.abs(this.s[p])<=r?i.set(p,p,0):i.set(p,p,1/this.s[p]);let a=this.U,u=this.rightSingularVectors,f=u.mmul(i),c=u.rows,h=a.rows,d=ve.zeros(c,h);for(let p=0;p<c;p++)for(let v=0;v<h;v++){let x=0;for(let _=0;_<n;_++)x+=f.get(p,_)*a.get(v,_);d.set(p,v,x)}return d.mmul(t)}solveForDiagonal(e){return this.solve(ve.diag(e))}inverse(){let e=this.V,t=this.threshold,r=e.rows,n=e.columns,i=new ve(r,this.s.length);for(let h=0;h<r;h++)for(let d=0;d<n;d++)Math.abs(this.s[d])>t&&i.set(h,d,e.get(h,d)/this.s[d]);let a=this.U,u=a.rows,f=a.columns,c=new ve(r,u);for(let h=0;h<r;h++)for(let d=0;d<u;d++){let p=0;for(let v=0;v<f;v++)p+=i.get(h,v)*a.get(d,v);c.set(h,d,p)}return c}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let e=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,t=0,r=this.s;for(let n=0,i=r.length;n<i;n++)r[n]>e&&t++;return t}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return ve.diag(this.s)}}function Ry(s,e=!1){return s=Ar.checkMatrix(s),e?new Ii(s).inverse():If(s,ve.eye(s.rows))}function If(s,e,t=!1){return s=Ar.checkMatrix(s),e=Ar.checkMatrix(e),t?new Ii(s).solve(e):s.isSquare()?new Ao(s).solve(e):new ru(s).solve(e)}function Co(s){if(s=ve.checkMatrix(s),s.isSquare()){if(s.columns===0)return 1;let e,t,r,n;if(s.columns===2)return e=s.get(0,0),t=s.get(0,1),r=s.get(1,0),n=s.get(1,1),e*n-t*r;if(s.columns===3){let i,a,u;return i=new bo(s,[1,2],[1,2]),a=new bo(s,[1,2],[0,2]),u=new bo(s,[1,2],[0,1]),e=s.get(0,0),t=s.get(0,1),r=s.get(0,2),e*Co(i)-t*Co(a)+r*Co(u)}else return new Ao(s).determinant}else throw Error("determinant can only be calculated for a square matrix")}function Py(s,e){let t=[];for(let r=0;r<s;r++)r!==e&&t.push(r);return t}function ky(s,e,t,r=1e-9,n=1e-9){if(s>n)return new Array(e.rows+1).fill(0);{let i=e.addRow(t,[0]);for(let a=0;a<i.rows;a++)Math.abs(i.get(a,0))<r&&i.set(a,0,0);return i.to1DArray()}}function zy(s,e={}){const{thresholdValue:t=1e-9,thresholdError:r=1e-9}=e;s=ve.checkMatrix(s);let n=s.rows,i=new ve(n,n);for(let a=0;a<n;a++){let u=ve.columnVector(s.getRow(a)),f=s.subMatrixRow(Py(n,a)).transpose(),h=new Ii(f).solve(u),d=ve.sub(u,f.mmul(h)).abs().max();i.setRow(a,ky(d,h,a,t,r))}return i}function qy(s,e=Number.EPSILON){if(s=ve.checkMatrix(s),s.isEmpty())return s.transpose();let t=new Ii(s,{autoTranspose:!0}),r=t.leftSingularVectors,n=t.rightSingularVectors,i=t.diagonal;for(let a=0;a<i.length;a++)Math.abs(i[a])>e?i[a]=1/i[a]:i[a]=0;return n.mmul(ve.diag(i).mmul(r.transpose()))}function Uy(s,e=s,t={}){s=new ve(s);let r=!1;if(typeof e=="object"&&!ve.isMatrix(e)&&!gr.isAnyArray(e)?(t=e,e=s,r=!0):e=new ve(e),s.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:n=!0}=t;n&&(s=s.center("column"),r||(e=e.center("column")));const i=s.transpose().mmul(e);for(let a=0;a<i.rows;a++)for(let u=0;u<i.columns;u++)i.set(a,u,i.get(a,u)*(1/(s.rows-1)));return i}function Wy(s,e=s,t={}){s=new ve(s);let r=!1;if(typeof e=="object"&&!ve.isMatrix(e)&&!gr.isAnyArray(e)?(t=e,e=s,r=!0):e=new ve(e),s.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:n=!0,scale:i=!0}=t;n&&(s.center("column"),r||e.center("column")),i&&(s.scale("column"),r||e.scale("column"));const a=s.standardDeviation("column",{unbiased:!0}),u=r?a:e.standardDeviation("column",{unbiased:!0}),f=s.transpose().mmul(e);for(let c=0;c<f.rows;c++)for(let h=0;h<f.columns;h++)f.set(c,h,f.get(c,h)*(1/(a[c]*u[h]))*(1/(s.rows-1)));return f}let Tf=class{constructor(e,t={}){const{assumeSymmetric:r=!1}=t;if(e=Ar.checkMatrix(e),!e.isSquare())throw new Error("Matrix is not a square matrix");if(e.isEmpty())throw new Error("Matrix must be non-empty");let n=e.columns,i=new ve(n,n),a=new Float64Array(n),u=new Float64Array(n),f=e,c,h,d=!1;if(r?d=!0:d=e.isSymmetric(),d){for(c=0;c<n;c++)for(h=0;h<n;h++)i.set(c,h,f.get(c,h));Hy(n,u,a,i),jy(n,u,a,i)}else{let p=new ve(n,n),v=new Float64Array(n);for(h=0;h<n;h++)for(c=0;c<n;c++)p.set(c,h,f.get(c,h));Yy(n,p,v,i),Ky(n,u,a,i,p)}this.n=n,this.e=u,this.d=a,this.V=i}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let e=this.n,t=this.e,r=this.d,n=new ve(e,e),i,a;for(i=0;i<e;i++){for(a=0;a<e;a++)n.set(i,a,0);n.set(i,i,r[i]),t[i]>0?n.set(i,i+1,t[i]):t[i]<0&&n.set(i,i-1,t[i])}return n}};function Hy(s,e,t,r){let n,i,a,u,f,c,h,d;for(f=0;f<s;f++)t[f]=r.get(s-1,f);for(u=s-1;u>0;u--){for(d=0,a=0,c=0;c<u;c++)d=d+Math.abs(t[c]);if(d===0)for(e[u]=t[u-1],f=0;f<u;f++)t[f]=r.get(u-1,f),r.set(u,f,0),r.set(f,u,0);else{for(c=0;c<u;c++)t[c]/=d,a+=t[c]*t[c];for(n=t[u-1],i=Math.sqrt(a),n>0&&(i=-i),e[u]=d*i,a=a-n*i,t[u-1]=n-i,f=0;f<u;f++)e[f]=0;for(f=0;f<u;f++){for(n=t[f],r.set(f,u,n),i=e[f]+r.get(f,f)*n,c=f+1;c<=u-1;c++)i+=r.get(c,f)*t[c],e[c]+=r.get(c,f)*n;e[f]=i}for(n=0,f=0;f<u;f++)e[f]/=a,n+=e[f]*t[f];for(h=n/(a+a),f=0;f<u;f++)e[f]-=h*t[f];for(f=0;f<u;f++){for(n=t[f],i=e[f],c=f;c<=u-1;c++)r.set(c,f,r.get(c,f)-(n*e[c]+i*t[c]));t[f]=r.get(u-1,f),r.set(u,f,0)}}t[u]=a}for(u=0;u<s-1;u++){if(r.set(s-1,u,r.get(u,u)),r.set(u,u,1),a=t[u+1],a!==0){for(c=0;c<=u;c++)t[c]=r.get(c,u+1)/a;for(f=0;f<=u;f++){for(i=0,c=0;c<=u;c++)i+=r.get(c,u+1)*r.get(c,f);for(c=0;c<=u;c++)r.set(c,f,r.get(c,f)-i*t[c])}}for(c=0;c<=u;c++)r.set(c,u+1,0)}for(f=0;f<s;f++)t[f]=r.get(s-1,f),r.set(s-1,f,0);r.set(s-1,s-1,1),e[0]=0}function jy(s,e,t,r){let n,i,a,u,f,c,h,d,p,v,x,_,y,m,w,D;for(a=1;a<s;a++)e[a-1]=e[a];e[s-1]=0;let A=0,E=0,F=Number.EPSILON;for(c=0;c<s;c++){for(E=Math.max(E,Math.abs(t[c])+Math.abs(e[c])),h=c;h<s&&!(Math.abs(e[h])<=F*E);)h++;if(h>c)do{for(n=t[c],d=(t[c+1]-n)/(2*e[c]),p=Dn(d,1),d<0&&(p=-p),t[c]=e[c]/(d+p),t[c+1]=e[c]*(d+p),v=t[c+1],i=n-t[c],a=c+2;a<s;a++)t[a]-=i;for(A=A+i,d=t[h],x=1,_=x,y=x,m=e[c+1],w=0,D=0,a=h-1;a>=c;a--)for(y=_,_=x,D=w,n=x*e[a],i=x*d,p=Dn(d,e[a]),e[a+1]=w*p,w=e[a]/p,x=d/p,d=x*t[a]-w*n,t[a+1]=i+w*(x*n+w*t[a]),f=0;f<s;f++)i=r.get(f,a+1),r.set(f,a+1,w*r.get(f,a)+x*i),r.set(f,a,x*r.get(f,a)-w*i);d=-w*D*y*m*e[c]/v,e[c]=w*d,t[c]=x*d}while(Math.abs(e[c])>F*E);t[c]=t[c]+A,e[c]=0}for(a=0;a<s-1;a++){for(f=a,d=t[a],u=a+1;u<s;u++)t[u]<d&&(f=u,d=t[u]);if(f!==a)for(t[f]=t[a],t[a]=d,u=0;u<s;u++)d=r.get(u,a),r.set(u,a,r.get(u,f)),r.set(u,f,d)}}function Yy(s,e,t,r){let n=0,i=s-1,a,u,f,c,h,d,p;for(d=n+1;d<=i-1;d++){for(p=0,c=d;c<=i;c++)p=p+Math.abs(e.get(c,d-1));if(p!==0){for(f=0,c=i;c>=d;c--)t[c]=e.get(c,d-1)/p,f+=t[c]*t[c];for(u=Math.sqrt(f),t[d]>0&&(u=-u),f=f-t[d]*u,t[d]=t[d]-u,h=d;h<s;h++){for(a=0,c=i;c>=d;c--)a+=t[c]*e.get(c,h);for(a=a/f,c=d;c<=i;c++)e.set(c,h,e.get(c,h)-a*t[c])}for(c=0;c<=i;c++){for(a=0,h=i;h>=d;h--)a+=t[h]*e.get(c,h);for(a=a/f,h=d;h<=i;h++)e.set(c,h,e.get(c,h)-a*t[h])}t[d]=p*t[d],e.set(d,d-1,p*u)}}for(c=0;c<s;c++)for(h=0;h<s;h++)r.set(c,h,c===h?1:0);for(d=i-1;d>=n+1;d--)if(e.get(d,d-1)!==0){for(c=d+1;c<=i;c++)t[c]=e.get(c,d-1);for(h=d;h<=i;h++){for(u=0,c=d;c<=i;c++)u+=t[c]*r.get(c,h);for(u=u/t[d]/e.get(d,d-1),c=d;c<=i;c++)r.set(c,h,r.get(c,h)+u*t[c])}}}function Ky(s,e,t,r,n){let i=s-1,a=0,u=s-1,f=Number.EPSILON,c=0,h=0,d=0,p=0,v=0,x=0,_=0,y=0,m,w,D,A,E,F,B,M,O,C,N,I,L,k,z;for(m=0;m<s;m++)for((m<a||m>u)&&(t[m]=n.get(m,m),e[m]=0),w=Math.max(m-1,0);w<s;w++)h=h+Math.abs(n.get(m,w));for(;i>=a;){for(A=i;A>a&&(x=Math.abs(n.get(A-1,A-1))+Math.abs(n.get(A,A)),x===0&&(x=h),!(Math.abs(n.get(A,A-1))<f*x));)A--;if(A===i)n.set(i,i,n.get(i,i)+c),t[i]=n.get(i,i),e[i]=0,i--,y=0;else if(A===i-1){if(B=n.get(i,i-1)*n.get(i-1,i),d=(n.get(i-1,i-1)-n.get(i,i))/2,p=d*d+B,_=Math.sqrt(Math.abs(p)),n.set(i,i,n.get(i,i)+c),n.set(i-1,i-1,n.get(i-1,i-1)+c),M=n.get(i,i),p>=0){for(_=d>=0?d+_:d-_,t[i-1]=M+_,t[i]=t[i-1],_!==0&&(t[i]=M-B/_),e[i-1]=0,e[i]=0,M=n.get(i,i-1),x=Math.abs(M)+Math.abs(_),d=M/x,p=_/x,v=Math.sqrt(d*d+p*p),d=d/v,p=p/v,w=i-1;w<s;w++)_=n.get(i-1,w),n.set(i-1,w,p*_+d*n.get(i,w)),n.set(i,w,p*n.get(i,w)-d*_);for(m=0;m<=i;m++)_=n.get(m,i-1),n.set(m,i-1,p*_+d*n.get(m,i)),n.set(m,i,p*n.get(m,i)-d*_);for(m=a;m<=u;m++)_=r.get(m,i-1),r.set(m,i-1,p*_+d*r.get(m,i)),r.set(m,i,p*r.get(m,i)-d*_)}else t[i-1]=M+d,t[i]=M+d,e[i-1]=_,e[i]=-_;i=i-2,y=0}else{if(M=n.get(i,i),O=0,B=0,A<i&&(O=n.get(i-1,i-1),B=n.get(i,i-1)*n.get(i-1,i)),y===10){for(c+=M,m=a;m<=i;m++)n.set(m,m,n.get(m,m)-M);x=Math.abs(n.get(i,i-1))+Math.abs(n.get(i-1,i-2)),M=O=.75*x,B=-.4375*x*x}if(y===30&&(x=(O-M)/2,x=x*x+B,x>0)){for(x=Math.sqrt(x),O<M&&(x=-x),x=M-B/((O-M)/2+x),m=a;m<=i;m++)n.set(m,m,n.get(m,m)-x);c+=x,M=O=B=.964}for(y=y+1,E=i-2;E>=A&&(_=n.get(E,E),v=M-_,x=O-_,d=(v*x-B)/n.get(E+1,E)+n.get(E,E+1),p=n.get(E+1,E+1)-_-v-x,v=n.get(E+2,E+1),x=Math.abs(d)+Math.abs(p)+Math.abs(v),d=d/x,p=p/x,v=v/x,!(E===A||Math.abs(n.get(E,E-1))*(Math.abs(p)+Math.abs(v))<f*(Math.abs(d)*(Math.abs(n.get(E-1,E-1))+Math.abs(_)+Math.abs(n.get(E+1,E+1))))));)E--;for(m=E+2;m<=i;m++)n.set(m,m-2,0),m>E+2&&n.set(m,m-3,0);for(D=E;D<=i-1&&(k=D!==i-1,D!==E&&(d=n.get(D,D-1),p=n.get(D+1,D-1),v=k?n.get(D+2,D-1):0,M=Math.abs(d)+Math.abs(p)+Math.abs(v),M!==0&&(d=d/M,p=p/M,v=v/M)),M!==0);D++)if(x=Math.sqrt(d*d+p*p+v*v),d<0&&(x=-x),x!==0){for(D!==E?n.set(D,D-1,-x*M):A!==E&&n.set(D,D-1,-n.get(D,D-1)),d=d+x,M=d/x,O=p/x,_=v/x,p=p/d,v=v/d,w=D;w<s;w++)d=n.get(D,w)+p*n.get(D+1,w),k&&(d=d+v*n.get(D+2,w),n.set(D+2,w,n.get(D+2,w)-d*_)),n.set(D,w,n.get(D,w)-d*M),n.set(D+1,w,n.get(D+1,w)-d*O);for(m=0;m<=Math.min(i,D+3);m++)d=M*n.get(m,D)+O*n.get(m,D+1),k&&(d=d+_*n.get(m,D+2),n.set(m,D+2,n.get(m,D+2)-d*v)),n.set(m,D,n.get(m,D)-d),n.set(m,D+1,n.get(m,D+1)-d*p);for(m=a;m<=u;m++)d=M*r.get(m,D)+O*r.get(m,D+1),k&&(d=d+_*r.get(m,D+2),r.set(m,D+2,r.get(m,D+2)-d*v)),r.set(m,D,r.get(m,D)-d),r.set(m,D+1,r.get(m,D+1)-d*p)}}}if(h!==0){for(i=s-1;i>=0;i--)if(d=t[i],p=e[i],p===0)for(A=i,n.set(i,i,1),m=i-1;m>=0;m--){for(B=n.get(m,m)-d,v=0,w=A;w<=i;w++)v=v+n.get(m,w)*n.get(w,i);if(e[m]<0)_=B,x=v;else if(A=m,e[m]===0?n.set(m,i,B!==0?-v/B:-v/(f*h)):(M=n.get(m,m+1),O=n.get(m+1,m),p=(t[m]-d)*(t[m]-d)+e[m]*e[m],F=(M*x-_*v)/p,n.set(m,i,F),n.set(m+1,i,Math.abs(M)>Math.abs(_)?(-v-B*F)/M:(-x-O*F)/_)),F=Math.abs(n.get(m,i)),f*F*F>1)for(w=m;w<=i;w++)n.set(w,i,n.get(w,i)/F)}else if(p<0)for(A=i-1,Math.abs(n.get(i,i-1))>Math.abs(n.get(i-1,i))?(n.set(i-1,i-1,p/n.get(i,i-1)),n.set(i-1,i,-(n.get(i,i)-d)/n.get(i,i-1))):(z=Fo(0,-n.get(i-1,i),n.get(i-1,i-1)-d,p),n.set(i-1,i-1,z[0]),n.set(i-1,i,z[1])),n.set(i,i-1,0),n.set(i,i,1),m=i-2;m>=0;m--){for(C=0,N=0,w=A;w<=i;w++)C=C+n.get(m,w)*n.get(w,i-1),N=N+n.get(m,w)*n.get(w,i);if(B=n.get(m,m)-d,e[m]<0)_=B,v=C,x=N;else if(A=m,e[m]===0?(z=Fo(-C,-N,B,p),n.set(m,i-1,z[0]),n.set(m,i,z[1])):(M=n.get(m,m+1),O=n.get(m+1,m),I=(t[m]-d)*(t[m]-d)+e[m]*e[m]-p*p,L=(t[m]-d)*2*p,I===0&&L===0&&(I=f*h*(Math.abs(B)+Math.abs(p)+Math.abs(M)+Math.abs(O)+Math.abs(_))),z=Fo(M*v-_*C+p*N,M*x-_*N-p*C,I,L),n.set(m,i-1,z[0]),n.set(m,i,z[1]),Math.abs(M)>Math.abs(_)+Math.abs(p)?(n.set(m+1,i-1,(-C-B*n.get(m,i-1)+p*n.get(m,i))/M),n.set(m+1,i,(-N-B*n.get(m,i)-p*n.get(m,i-1))/M)):(z=Fo(-v-O*n.get(m,i-1),-x-O*n.get(m,i),_,p),n.set(m+1,i-1,z[0]),n.set(m+1,i,z[1]))),F=Math.max(Math.abs(n.get(m,i-1)),Math.abs(n.get(m,i))),f*F*F>1)for(w=m;w<=i;w++)n.set(w,i-1,n.get(w,i-1)/F),n.set(w,i,n.get(w,i)/F)}for(m=0;m<s;m++)if(m<a||m>u)for(w=m;w<s;w++)r.set(m,w,n.get(m,w));for(w=s-1;w>=a;w--)for(m=a;m<=u;m++){for(_=0,D=a;D<=Math.min(w,u);D++)_=_+r.get(m,D)*n.get(D,w);r.set(m,w,_)}}}function Fo(s,e,t,r){let n,i;return Math.abs(t)>Math.abs(r)?(n=r/t,i=t+n*r,[(s+n*e)/i,(e-n*s)/i]):(n=t/r,i=r+n*t,[(n*s+e)/i,(n*e-s)/i])}class $f{constructor(e){if(e=Ar.checkMatrix(e),!e.isSymmetric())throw new Error("Matrix is not symmetric");let t=e,r=t.rows,n=new ve(r,r),i=!0,a,u,f;for(u=0;u<r;u++){let c=0;for(f=0;f<u;f++){let h=0;for(a=0;a<f;a++)h+=n.get(f,a)*n.get(u,a);h=(t.get(u,f)-h)/n.get(f,f),n.set(u,f,h),c=c+h*h}for(c=t.get(u,u)-c,i&=c>0,n.set(u,u,Math.sqrt(Math.max(c,0))),f=u+1;f<r;f++)n.set(u,f,0)}this.L=n,this.positiveDefinite=!!i}isPositiveDefinite(){return this.positiveDefinite}solve(e){e=Ar.checkMatrix(e);let t=this.L,r=t.rows;if(e.rows!==r)throw new Error("Matrix dimensions do not match");if(this.isPositiveDefinite()===!1)throw new Error("Matrix is not positive definite");let n=e.columns,i=e.clone(),a,u,f;for(f=0;f<r;f++)for(u=0;u<n;u++){for(a=0;a<f;a++)i.set(f,u,i.get(f,u)-i.get(a,u)*t.get(f,a));i.set(f,u,i.get(f,u)/t.get(f,f))}for(f=r-1;f>=0;f--)for(u=0;u<n;u++){for(a=f+1;a<r;a++)i.set(f,u,i.get(f,u)-i.get(a,u)*t.get(a,f));i.set(f,u,i.get(f,u)/t.get(f,f))}return i}get lowerTriangularMatrix(){return this.L}}class Lf{constructor(e,t={}){e=Ar.checkMatrix(e);let{Y:r}=t;const{scaleScores:n=!1,maxIterations:i=1e3,terminationCriteria:a=1e-10}=t;let u;if(r){if(gr.isAnyArray(r)&&typeof r[0]=="number"?r=ve.columnVector(r):r=Ar.checkMatrix(r),r.rows!==e.rows)throw new Error("Y should have the same number of rows as X");u=r.getColumnVector(0)}else u=e.getColumnVector(0);let f=1,c,h,d,p;for(let v=0;v<i&&f>a;v++)d=e.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),d=d.div(d.norm()),c=e.mmul(d).div(d.transpose().mmul(d).get(0,0)),v>0&&(f=c.clone().sub(p).pow(2).sum()),p=c.clone(),r?(h=r.transpose().mmul(c).div(c.transpose().mmul(c).get(0,0)),h=h.div(h.norm()),u=r.mmul(h).div(h.transpose().mmul(h).get(0,0))):u=c;if(r){let v=e.transpose().mmul(c).div(c.transpose().mmul(c).get(0,0));v=v.div(v.norm());let x=e.clone().sub(c.clone().mmul(v.transpose())),_=u.transpose().mmul(c).div(c.transpose().mmul(c).get(0,0)),y=r.clone().sub(c.clone().mulS(_.get(0,0)).mmul(h.transpose()));this.t=c,this.p=v.transpose(),this.w=d.transpose(),this.q=h,this.u=u,this.s=c.transpose().mmul(c),this.xResidual=x,this.yResidual=y,this.betas=_}else this.w=d.transpose(),this.s=c.transpose().mmul(c).sqrt(),n?this.t=c.clone().div(this.s.get(0,0)):this.t=c,this.xResidual=e.sub(c.mmul(d.transpose()))}}We.AbstractMatrix=ke,We.CHO=$f,We.CholeskyDecomposition=$f,We.DistanceMatrix=Eo,We.EVD=Tf;var Zy=We.EigenvalueDecomposition=Tf;We.LU=Ao,We.LuDecomposition=Ao;var Rf=We.Matrix=ve;We.MatrixColumnSelectionView=My,We.MatrixColumnView=By,We.MatrixFlipColumnView=Ny,We.MatrixFlipRowView=Sy,We.MatrixRowSelectionView=Iy,We.MatrixRowView=Oy,We.MatrixSelectionView=bo,We.MatrixSubView=Ty,We.MatrixTransposeView=$y,We.NIPALS=Lf,We.Nipals=Lf,We.QR=ru,We.QrDecomposition=ru,We.SVD=Ii,We.SingularValueDecomposition=Ii,We.SymmetricMatrix=si,We.WrapperMatrix1D=Of,We.WrapperMatrix2D=Ar,We.correlation=Wy,We.covariance=Uy;var Pf=We.default=ve;We.determinant=Co,We.inverse=Ry,We.linearDependencies=zy,We.pseudoInverse=qy,We.solve=If,We.wrap=Ly;const kf=Zy,zf=Rf;Pf.Matrix&&Pf.Matrix;class Vy{constructor(e){U(this,"_errorListener");this._errorListener=e}new({rows:e,columns:t,initial_value:r}={}){return new nu(e,t,r,this._errorListener)}avg({id:e}){return e==null?void 0:e.avg()}col({id:e,column:t}){return e==null?void 0:e.col({column:t})}det({id:e}){return e==null?void 0:e.det()}get({id:e,row:t,column:r}){return e==null?void 0:e.get({row:t,column:r})}inv({id:e}){return e==null?void 0:e.inv()}max({id:e}){return e==null?void 0:e.max()}min({id:e}){return e==null?void 0:e.min()}pow({id:e,power:t}){return e==null?void 0:e.pow({power:t})}row({id:e,row:t}){return e==null?void 0:e.row({row:t})}set({id:e,row:t,column:r,value:n}){e==null||e.set({row:t,column:r,value:n})}sum({id1:e,id2:t}){return e==null?void 0:e.sum({id2:t})}copy({id:e}){return e==null?void 0:e.copy()}diff({id1:e,id2:t}){return e==null?void 0:e.diff({id2:t})}rows({id:e}){return e==null?void 0:e.rows()}columns({id:e}){return e==null?void 0:e.columns()}fill({id:e,value:t,from_row:r,to_row:n,from_column:i,to_column:a}){e==null||e.fill({value:t,from_row:r,to_row:n,from_column:i,to_column:a})}kron({id1:e,id2:t}){return e==null?void 0:e.kron({id2:t})}mode({id:e}){return e==null?void 0:e.mode()}mult({id1:e,id2:t}){return e==null?void 0:e.mult({id2:t})}pinv({id:e}){return e==null?void 0:e.pinv()}rank({id:e}){return e==null?void 0:e.rank()}sort({id:e,column:t,order:r}){e==null||e.sort({column:t,order:r})}trace({id:e}){return e==null?void 0:e.trace()}concat({id1:e,id2:t}){return e==null?void 0:e.concat({id2:t})}median({id:e}){return e==null?void 0:e.median()}add_col({id:e,column:t,array_id:r}){e==null||e.add_col({column:t,array_id:r})}add_row({id:e,row:t,array_id:r}){e==null||e.add_row({row:t,array_id:r})}is_zero({id:e}){return e==null?void 0:e.is_zero()}reshape({id:e,rows:t,columns:r},n){return e==null?void 0:e.reshape({rows:t,columns:r},n)}reverse({id:e}){e==null||e.reverse()}is_binary({id:e}){return e==null?void 0:e.is_binary()}is_square({id:e}){return e==null?void 0:e.is_square()}submatrix({id:e,from_row:t,to_row:r,from_column:n,to_column:i}){return e==null?void 0:e.submatrix({from_row:t,to_row:r,from_column:n,to_column:i})}swap_rows({id:e,row1:t,row2:r}){e==null||e.swap_rows({row1:t,row2:r})}transpose({id:e}){return e==null?void 0:e.transpose()}remove_col({id:e,column:t}){return e==null?void 0:e.remove_col({column:t})}remove_row({id:e,row:t}){return e==null?void 0:e.remove_row({row:t})}eigenvalues({id:e}){return e==null?void 0:e.eigenvalues()}is_diagonal({id:e}){return e==null?void 0:e.is_diagonal()}is_identity({id:e}){return e==null?void 0:e.is_identity()}eigenvectors({id:e}){return e==null?void 0:e.eigenvectors()}is_symmetric({id:e}){return e==null?void 0:e.is_symmetric()}swap_columns({id:e,column1:t,column2:r}){e==null||e.swap_columns({column1:t,column2:r})}is_stochastic({id:e}){return e==null?void 0:e.is_stochastic()}is_triangular({id:e}){return e==null?void 0:e.is_triangular()}elements_count({id:e}){return e==null?void 0:e.elements_count()}is_antidiagonal({id:e}){return e==null?void 0:e.is_antidiagonal()}is_antisymmetric({id:e}){return e==null?void 0:e.is_antisymmetric()}}class nu{constructor(e=0,t=0,r=void 0,n){U(this,"_matrixInstance");U(this,"_errorListener");this._matrixInstance=this._createMatrix(e,t,r),this._errorListener=n}get _matrixArray(){return this._matrixInstance.map(e=>[...e._value])}get _value(){return this._matrixInstance}set _value(e){this._matrixInstance=e}get isMatrix(){return!0}_createMatrix(e,t,r){return Array.from(new Array(e),()=>new it(t,r,this._errorListener))}avg(){let e=0,t=0;for(const n of this._matrixInstance)for(const i of n._value)e+=me(i)?0:i,t+=1;return e/t}col({column:e}){const t=[],r=new it(0,void 0,this._errorListener);if(me(e))return r;for(const n of this._matrixInstance)t.push(n._value[e]);return r._value=t,r}det(){return Af(this._matrixArray)}get({row:e,column:t}){var r,n;if(!(me(e)||me(t)))return(n=(r=this._matrixInstance[e])==null?void 0:r._value)==null?void 0:n[t]}inv(){const e=xo(this._matrixArray);return this._newMatrix(e)}max(){return Hx(this._matrixArray)}min(){return Qa(this._matrixArray)}pow({power:e}){const t=me(e)?this._matrixArray:Yx(this._matrixArray,e);return this._newMatrix(t)}row({row:e}){return me(e)?new it(0,void 0,this._errorListener):this._matrixInstance[e]}set({row:e,column:t,value:r}){me(e)||me(t)||this._matrixInstance[e].set({index:t,value:r})}sum({id2:e}){const t=hs(this._matrixArray,typeof e=="number"?e:e._matrixArray);return this._newMatrix(t)}copy(){return this._newMatrix(this._matrixArray)}diff({id2:e}){const t=Px(this._matrixArray,typeof e=="number"?e:e._matrixArray);return this._newMatrix(t)}rows(){return this._matrixInstance.length}columns(){return this._matrixArray.length&&this._matrixArray[0].length}fill({value:e,from_row:t,to_row:r,from_column:n,to_column:i}={}){me(t)&&(t=0),me(r)&&(r=this.rows()),me(n)&&(n=0),me(i)&&(i=this.columns());for(const[a,u]of this._matrixInstance.entries())for(const[f]of u._value.entries())a<r&&a>=t&&f>=n&&f<i&&u.set({index:f,value:e})}kron({id2:e}){const t=Lx(this._matrixArray,e._matrixArray);return this._newMatrix(t)}mode(){return Qa(mf(this._matrixArray))}mult({id2:e}){const t=typeof e=="number"?e:e._matrixArray?e._matrixArray:e._value,r=Mi(this._matrixArray,t);return this._newMatrix(r)}pinv(){const e=jx(this._matrixArray);return this._newMatrix(e)}rank(){return this._matrixRank(this._matrixArray)}sort({column:e,order:t=Jn.ascending}={}){me(e)&&(e=0),this._matrixInstance.sort((r,n)=>{const i=r._value[e],a=n._value[e];return t!==Jn.descending?i-a:a-i})}trace(){return Wx(this._matrixArray)}concat({id2:e}){for(const t of e._value)this._matrixInstance.push(t);return this}median(){return Cf(this._matrixArray)}add_col({column:e,array_id:t}={}){me(e)&&(e=this.columns());for(const[r,n]of this._matrixInstance.entries())n.insert({index:e,value:t?t._value[r]:void 0})}add_row({row:e,array_id:t}){me(e)&&(e=this.rows()),this._matrixInstance.splice(e,0,t||new it(this.columns(),void 0,this._errorListener))}is_zero(){return this._matrixArray.every(e=>e.every(t=>t===0))}reshape({rows:e=0,columns:t=0},r){if(e*t!==this.columns()*this.rows()){this._errorListener.addError(ct.matrixRehapeErr,r,Ze.Error);return}const n=Ox(this._matrixArray,[e,t]);this._matrixInstance=n.map(i=>{const a=new it(0,void 0,this._errorListener);return a._value=[...i],a})}reverse(){this._matrixInstance.reverse();for(const e of this._matrixInstance)e.reverse()}is_binary(){return this._matrixArray.every(e=>e.every(t=>t===0||t===1))}is_square(){return this.rows()===this.columns()}submatrix({from_row:e,to_row:t,from_column:r,to_column:n}={}){me(e)&&(e=0),me(t)&&(t=this.rows()),me(r)&&(r=0),me(n)&&(n=this.columns());const i=this._matrixArray.splice(e,t),a=[];for(const u of i)a.push(u.splice(r,n));return this._newMatrix(a)}swap_rows({row1:e,row2:t}){if(me(e)||me(t))return;const r=this._matrixInstance[e],n=this._matrixInstance[t];this._matrixInstance[e]=n,this._matrixInstance[t]=r}transpose(){const e=yf(this._matrixArray);return this._newMatrix(e)}remove_col({column:e}={}){me(e)&&(e=this.columns());const t=[];for(const n of this._matrixInstance){const i=n._value.splice(e,1);t.push(i[0])}const r=new it(0,void 0,this._errorListener);return r._value=t,r}remove_row({row:e}={}){return me(e)&&(e=this.rows()),this._matrixInstance.splice(e,1)[0]}eigenvalues(){const e=new kf(new zf(this._matrixArray)),t=new it(0,void 0,this._errorListener);return t._value=e.realEigenvalues,t}is_diagonal(){const e=this.rows(),t=this.columns();if(e!==t)return!1;const r=this._matrixArray;for(let n=0;n<e;n++)for(let i=0;i<t;i++)if(n!==i&&r[n][i]!==0)return!1;return!0}is_identity(){const e=this.rows(),t=this.columns();if(e!==t)return!1;const r=this._matrixArray;for(let n=0;n<e;n++)for(let i=0;i<t;i++)if(n!==i&&r[n][i]!==0||n===i&&r[n][i]!==1)return!1;return!0}eigenvectors(){const e=new kf(new zf(this._matrixArray));return this._newMatrix(e.eigenvectorMatrix.to2DArray())}is_symmetric(){const e=this.rows(),t=this.columns();if(e!==t)return!1;const r=this._matrixArray;for(let n=0;n<e;n++)for(let i=n+1;i<t;i++)if(r[n][i]!==r[i][n])return!1;return!0}swap_columns({column1:e,column2:t}){if(!(me(e)||me(t)))for(const r of this._matrixInstance){const n=r._value[e],i=r._value[t];r.set({index:e,value:i}),r.set({index:t,value:n})}}is_stochastic(){const e=this._matrixArray;for(let t=0;t<e.length;t++){let r=0;for(let n=0;n<e[t].length;n++){if(e[t][n]<0)return!1;r+=e[t][n]}if(Math.abs(r-1)>Number.EPSILON)return!1}return!0}is_triangular(){const e=this.rows(),t=this.columns();return e!==t?!1:this._isUpperTriangular(e)||this._isLowerTriangular(e)}elements_count(){return Ix(this._matrixArray)}is_antidiagonal(){const e=this.rows(),t=this.columns();if(e!==t)return!1;const r=this._matrixArray;for(let n=0;n<e;n++)for(let i=0;i<e;i++)if(n+i!==e-1&&r[n][i]!==0)return!1;return!0}is_antisymmetric(){const e=this.rows(),t=this.columns();if(e!==t)return!1;const r=this._matrixArray;for(let n=0;n<e;n++)for(let i=0;i<e;i++)if(n!==i&&r[n][i]!==-r[i][n])return!1;return!0}_isUpperTriangular(e){const t=this._matrixArray;for(let r=1;r<e;r++)for(let n=0;n<r;n++)if(t[r][n]!==0)return!1;return!0}_isLowerTriangular(e){const t=this._matrixArray;for(let r=0;r<e-1;r++)for(let n=r+1;n<e;n++)if(t[r][n]!==0)return!1;return!0}_newMatrix(e){const t=new nu(0,0,void 0,this._errorListener);return t._value=e.map(r=>{const n=new it(0,void 0,this._errorListener);return n._value=[...r],n}),t}_matrixRank(e){let t=0;const r=e.length,n=e[0].length,i=[...e].map(a=>[...a]);for(let a=0;a<r&&!(a>=n);a++){let u=a;for(;u<r&&i[u][a]===0;)u++;if(u===r)continue;if(u!==a){const c=i[u];i[u]=i[a],i[a]=c}const f=i[a][a];for(let c=0;c<n;c++)i[a][c]/=f;for(let c=a+1;c<r;c++){const h=i[c][a];i[c]=i[c].map((d,p)=>d-h*i[a][p]),i[c][a]=0}}for(let a=0;a<r;a++)i[a].some(u=>Number(u.toFixed(8))!==0)&&t++;return t}}class Gy{constructor(e){U(this,"_variables");U(this,"_cacheData");this._variables=e,this._cacheData={}}change({timeframe:e},t){if(!e)return!0;const r=pn(e),n=pn(this._variables.timeframe.period);if(r<n)return!0;const i=`change_${t}`,a=this._cacheData[i],u=this._variables.time;if(a){if(a.offset){if(a.currentTime+a.offset<=u)return this._cacheData[i]={currentTime:u,offset:0},!0}else if(a.currentTime+r*1e3<=u)return this._cacheData[i]={currentTime:u,offset:0},!0}else{const f=this._calcTimeOffset(u,e);return this._cacheData[i]={currentTime:u,offset:f},!1}return!1}in_seconds({timeframe:e}={}){return pn(e||this._variables.timeframe.period)}from_seconds({seconds:e=0}){const t=e*1e3,r=ot.duration(t);if(r.years())return"12M";const i=r.asMonths();if(go(i))return`${i}M`;const a=r.asWeeks();if(go(a))return`${a}M`;const u=r.asDays();if(u>=1)return`${Math.ceil(u)}D`;const f=r.asMinutes();if(f>=1)return`${Math.ceil(f)}`;const c=r.asSeconds();return c<=1?"1S":c<=5?"5S":c<=10?"10S":c<=15?"15S":c<=30?"30S":"1"}_calcTimeOffset(e,t){let r=0;if(t.includes("W")){const u=ot(e).day();t="1D",u!==1&&(r=(8-u)*60*60*24*1e3)}else if(t.includes("M")){const u=ot(e).date();t="1D";const f=ot(e).daysInMonth();u!==1&&(r=(f-u+1)*60*60*24*1e3)}const n=this._variables.getTimeTradingday(e,t),i=pn(t)*1e3,a=e-n-Math.floor((e-n)/i)*i;return r?r-a:a}}class Xy{constructor(e,t){U(this,"_errorListener");U(this,"_intlNumberFormatter");U(this,"_precision");this._errorListener=e,this._precision=t,this._intlNumberFormatter=new Intl.NumberFormat("en",{notation:"compact"})}pos({source:e="",str:t=""}){return e==null?void 0:e.indexOf(t)}trim({source:e=""}){return e==null?void 0:e.trim()}lower({source:e=""}){return e==null?void 0:e.toLocaleLowerCase()}match({source:e="",regex:t=""}){const r=e==null?void 0:e.match(new RegExp(t));return r?r[0]:""}split({string:e="",separator:t=""}){const r=e==null?void 0:e.split(t),n=new it;return n._value=r||[],n}upper({source:e=""}){return e==null?void 0:e.toLocaleUpperCase()}format({formatString:e=""},t){return this._strFormat(e,t)}length({string:e=""}){return e==null?void 0:e.length}repeat({source:e="",repeat:t,separator:r=""},n){if(me(t)){this._errorListener.addError(ct.arrLenErr,n,Ze.Error);return}return Array.from(new Array(t),()=>e).join(r)}replace({source:e="",target:t="",replacement:r="",occurrence:n}){me(n)&&(n=0);let i=-1;for(let a=0;a<n+1&&(i=e.indexOf(t,i+1),i!==-1);a++);return i!==-1?e.substring(0,i)+r+e.substring(i+t.length):e}contains({source:e="",str:t=""}){return e==null?void 0:e.includes(t)}endswith({source:e="",str:t=""}){return e==null?void 0:e.endsWith(t)}tonumber({string:e=""}){if(/[^\d.]/.test(e))return;const t=parseFloat(e);return isNaN(t)?void 0:t}tostring({value:e,format:t}){if(e===void 0)return"NaN";if(typeof e=="object"){if(e.isArray)return this._arrToStr(e._value,t);if(e.isMatrix){const r=[];for(const n of e._matrixArray)r.push(this._arrToStr(n,t));return r.join(`
62
- `)}}if(typeof e=="string")return e;if(typeof e=="boolean")return String(e);if(typeof e=="number")return String(this._toStringFormat(e,t))}_arrToStr(e,t){return`[${e.map(n=>typeof n=="number"?this._toStringFormat(n,t):n).toString()}]`}substring({source:e="",begin_pos:t=0,end_pos:r}){return me(t)&&(t=0),me(r)&&(r=void 0),e==null?void 0:e.substring(t,r)}startswith({source:e="",str:t=""}){return e==null?void 0:e.startsWith(t)}format_time({time:e,format:t="yyyy-MM-dd'T'HH:mm:ssZ",timezone:r}){return me(e)&&(e=0),Kr(e,r).format(t)}replace_all({source:e="",target:t="",replacement:r=""}){return e==null?void 0:e.replace(new RegExp(t,"g"),r)}_toStringFormat(e,t){if(!t)return e;switch(t){case Je.mintick:return e.toFixed(this._precision);case Je.price:return`${e}%`;case Je.volume:return this._intlNumberFormatter.format(Math.round(e));default:const[r,n]=t.split(".");let[i,a=""]=String(e).split(".");if(r.includes("#")?i=r.replace(/#/,i).replace(/#/g,""):i=`${r}${i}`,n&&n.includes("#")){const u=n.split("#").length-1;a=`${a.substring(0,u)}${n.replace(/#/g,"")}`}else a=n||"";return a?`${i}.${a}`:i}}_formatNumber(e,t){if(!t)return e;switch(t){case"integer":return String(Math.round(e));case"currency":return`$${e}`;case"percent":return`${e*100}%`;default:const r=t.split(".")[1],n=r?r.length:0;return parseFloat(e.toFixed(n))}}_strFormat(e,t){let r=e;return t.forEach((n,i)=>{if(typeof n=="number"){const a=`\\{\\s*${i}\\s*,\\s*number\\s*,\\s*([^\\}]+)\\s*\\}`,u=e.match(new RegExp(a));if(u){const f=u[1];r=r.replace(new RegExp(a,"g"),String(this._formatNumber(n,f)))}else r=r.replace(new RegExp(`\\{${i}\\}`,"g"),String(n))}else r=r.replace(new RegExp(`\\{${i}\\}`,"g"),n)}),r}}class Qy{constructor(e){U(this,"_errorListener");this._errorListener=e}new(){return new iu(this._errorListener)}copy({id:e}){return e==null?void 0:e.copy()}get({id:e,key:t}){return e==null?void 0:e.get({key:t})}put({id:e,key:t,value:r}){return e==null?void 0:e.put({key:t,value:r})}keys({id:e}){return e==null?void 0:e.keys()}size({id:e}){return e==null?void 0:e.size()}clear({id:e}){e==null||e.clear()}remove({id:e,key:t}){return e==null?void 0:e.remove({key:t})}values({id:e}){return e==null?void 0:e.values()}put_all({id:e,id2:t}){e==null||e.put_all({id2:t})}contains({id:e,key:t}){return e==null?void 0:e.contains({key:t})}}class iu{constructor(e){U(this,"_errorListener");U(this,"_mapInstance");this._errorListener=e,this._mapInstance=new Map}get isMap(){return!0}_copyMap(e){const t=new iu(this._errorListener);return t._mapInstance=new Map(e.entries()),t}copy(){return this._copyMap(this._mapInstance)}get({key:e}){return this._mapInstance.get(e)}put({key:e,value:t}){return this._mapInstance.set(e,t)}keys(){const e=new it(0,void 0,this._errorListener);return e._value=[...this._mapInstance.keys()],e}size(){return this._mapInstance.size}clear(){this._mapInstance.clear()}remove({key:e}){const t=this._mapInstance.get(e);return this._mapInstance.delete(e),t||void 0}values(){const e=new it(0,void 0,this._errorListener);return e._value=[...this._mapInstance.values()],e}put_all({id2:e}){this._mapInstance=new Map([...this._mapInstance,...e._mapInstance])}contains({key:e}){return this._mapInstance.has(e)}}class Jy{constructor(e){U(this,"_variables");this._variables=e}new({price:e,time:t,index:r}){return new Ti(e,r,t)}now({price:e}){const{time:t,bar_index:r}=this._variables;return new Ti(e,r,t)}copy({id:e}){return e==null?void 0:e.copy()}from_index({price:e,index:t}){return new Ti(e,t)}from_time({price:e,time:t}){return new Ti(e,void 0,t)}}class Ti{constructor(e,t,r){U(this,"_index");U(this,"_price");U(this,"_time");this._index=t,this._price=e,this._time=r}get index(){return this._index}get price(){return this._price}get time(){return this._time}copy(){return new Ti(this._price,this._index,this._time)}}class eD{constructor(e,t){U(this,"_variables");U(this,"_errorListener");U(this,"_defaultLabel",{text:"",xloc:Et.bar_index,yloc:Gr.price,size:ar.normal,style:gt.styleLabelDown,textalign:je.alignCenter});this._variables=e,this._errorListener=t}new(e,t){const{time:r,high:n,low:i,bar_index:a}=this._variables,u=`label_${t}_${a}`,f={...this._defaultLabel,...e,id:u,time:r};e.point&&(f.x=f.xloc===Et.bar_index?e.point.index:e.point.time,f.y=e.point.price),f.yloc===Gr.abovebar?f.y=n:f.yloc===Gr.belowbar&&(f.y=i),this._verfiyArgs(e,t);const c=new ps(u,this._variables,this._errorListener);return t.startsWith("export")||this._variables.label.add(u,f,c),c}_verfiyArgs(e,t){const{xloc:r,yloc:n,style:i,size:a,textalign:u,text_font_family:f}=e,c="label.new";this._paramVerfiy(i,t,c,Object.values(gt),"style"),this._paramVerfiy(r,t,c,Object.values(Et),"xloc"),this._paramVerfiy(n,t,c,Object.values(Gr),"yloc"),this._paramVerfiy(a,t,c,Object.values(ar),"size"),this._paramVerfiy(u,t,c,[je.alignLeft,je.alignCenter,je.alignRight],"textalign"),this._paramVerfiy(f,t,c,Object.values(ei),"text_font_family")}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}label(e,t){return e.x?e.x:new ps(t,this._variables,this._errorListener)}copy({id:e},t){return e==null?void 0:e.copy(t)}get_x({id:e},t){return e==null?void 0:e.get_x(t)}get_y({id:e},t){return e==null?void 0:e.get_y(t)}set_x({id:e,...t},r){e==null||e.set_x(t,r)}set_y({id:e,...t},r){e==null||e.set_y(t,r)}delete({id:e}){e==null||e.delete()}get_text({id:e},t){return e==null?void 0:e.get_text(t)}set_xy({id:e,...t},r){e==null||e.set_xy(t,r)}set_size({id:e,...t},r){e==null||e.set_size(t,r)}set_xloc({id:e,...t},r){e==null||e.set_xloc(t,r)}set_yloc({id:e,...t},r){e==null||e.set_yloc(t,r)}set_style({id:e,...t},r){e==null||e.set_style(t,r)}set_color({id:e,...t},r){e==null||e.set_color(t,r)}set_tooltip({id:e,...t},r){e==null||e.set_tooltip(t,r)}set_point({id:e,...t},r){e==null||e.set_point(t,r)}set_text({id:e,...t},r){e==null||e.set_text(t,r)}set_textcolor({id:e,...t},r){e==null||e.set_textcolor(t,r)}set_textalign({id:e,...t},r){e==null||e.set_textalign(t,r)}set_text_font_family({id:e,...t},r){e==null||e.set_text_font_family(t,r)}}class ps{constructor(e,t,r){U(this,"_id");U(this,"_variables");U(this,"_errorListener");this._id=e,this._variables=t,this._errorListener=r}copy(e){const t=`label_${e}_${this._variables.bar_index}`,r=this._getLabel(e),n=new ps(t,this._variables,this._errorListener);if(r){const i={...r,id:t};this._variables.label.add(t,i,n)}return n}get_x(e){var t;return(t=this._getLabel(e))==null?void 0:t.x}get_y(e){var t;return(t=this._getLabel(e))==null?void 0:t.y}set_x({x:e},t){const r=this._getLabel(t);r&&(r.x=e)}set_y({y:e},t){const r=this._getLabel(t);r&&(r.y=e)}delete(){this._variables.label.delete(this._id)}set_xy({x:e,y:t},r){const n=this._getLabel(r);n&&(n.x=e,n.y=t)}get_text(e){var t;return(t=this._getLabel(e))==null?void 0:t.text}set_size({size:e},t){const r=this._getLabel(t);r&&(r.size=e),this._paramVerfiy(e,t,"label.set_size",Object.values(ar),"size")}set_text({text:e},t){const r=this._getLabel(t);r&&(r.text=e)}set_xloc({x:e,xloc:t},r){const n=this._getLabel(r);n&&(n.x=e,n.xloc=t,this._paramVerfiy(t,r,"label.set_xloc",Object.values(Et),"xloc"))}set_yloc({yloc:e},t){const r=this._getLabel(t),{high:n,low:i}=this._variables;r&&(r.yloc=e,e===Gr.abovebar?r.y=n:e===Gr.belowbar&&(r.y=i),this._paramVerfiy(e,t,"label.set_yloc",Object.values(Gr),"yloc"))}set_color({color:e},t){const r=this._getLabel(t);r&&(r.color=e)}set_point({point:e},t){const r=this._getLabel(t);r&&(r.x=r.xloc===Et.bar_index?e==null?void 0:e.index:e==null?void 0:e.time,r.y=e==null?void 0:e.price)}set_style({style:e},t){const r=this._getLabel(t);r&&(r.style=e),this._paramVerfiy(e,t,"label.set_style",Object.values(gt),"style")}set_tooltip({tooltip:e},t){const r=this._getLabel(t);r&&(r.tooltip=e)}set_textalign({textalign:e},t){const r=this._getLabel(t);r&&(r.textalign=e),this._paramVerfiy(e,t,"label.set_textalign",[je.alignLeft,je.alignCenter,je.alignRight],"textalign")}set_textcolor({textcolor:e},t){const r=this._getLabel(t);r&&(r.textcolor=e)}set_text_font_family({text_font_family:e},t){const r=this._getLabel(t);r&&(r.text_font_family=e),this._paramVerfiy(e,t,"label.set_text_font_family",Object.values(ei),"text_font_family")}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}_getLabel(e){const t=this._variables.label.get(this._id);return t||console.log(`错误${e}: label 不存在`),t}}const tD={freq_all:Zr.freqAll,freq_once_per_bar:Zr.freqOncePerBar,freq_once_per_bar_close:Zr.freqOncePerBarClose},rD={gaps_off:ss.gapsOff,gaps_on:ss.gapsOn,lookahead_off:ss.lookaheadOff,lookahead_on:ss.lookaheadOn},$i={aqua:"#00BCD4",black:"#363A45",blue:"#2196F3",fuchsia:"#E040FB",gray:"#787B86",green:"#4CAF50",lime:"#00E676",maroon:"#880E4F",navy:"#311B92",olive:"#808000",orange:"#FF9800",purple:"#9C27B0",red:"#FF5252",silver:"#B2B5BE",teal:"#00897B",white:"#FFFFFF",yellow:"#FFEB3B"},qf={AUD:"AUD",BTC:"BTC",CAD:"CAD",CHF:"CHF",ETH:"ETH",EUR:"EUR",GBP:"GBP",HKD:"HKD",INR:"INR",JPY:"JPY",KRW:"KRW",MYR:"MYR",NOK:"NOK",NONE:"NONE",NZD:"NZD",RUB:"RUB",SEK:"SEK",SGD:"SGD",TRY:"TRY",USD:"USD",USDT:"USDT",ZAR:"ZAR"},nD={friday:6,monday:2,saturday:7,sunday:1,thursday:5,tuesday:3,wednesday:4},Uf={all:[Vt.dataWindow,Vt.pane,Vt.priceScale,Vt.statusLine],data_window:[Vt.dataWindow],none:[],pane:[Vt.pane],price_scale:[Vt.priceScale],status_line:[Vt.statusLine]},iD={both:Vr.both,left:Vr.left,none:Vr.none,right:Vr.right},sD={inherit:Je.inherit,mintick:Je.mintick,percent:Je.percent,price:Je.price,volume:Je.volume},oD={style_solid:qs.styleSolid,style_dashed:qs.styleDashed,style_dotted:qs.styleDotted},aD={style_arrowdown:gt.styleArrowdown,style_arrowup:gt.styleArrowup,style_circle:gt.styleCircle,style_cross:gt.styleCross,style_diamond:gt.styleDiamond,style_flag:gt.styleFlag,style_label_center:gt.styleLabelCenter,style_label_down:gt.styleLabelDown,style_label_left:gt.styleLabelLeft,style_label_lower_left:gt.styleLabelLowerLeft,style_label_lower_right:gt.styleLabelLowerRight,style_label_right:gt.styleLabelRight,style_label_up:gt.styleLabelUp,style_label_upper_left:gt.styleLabelUpperLeft,style_label_upper_right:gt.styleLabelUpperRight,style_none:gt.styleNone,style_square:gt.styleSquare,style_text_outline:gt.styleTextOutline,style_triangledown:gt.styleTriangledown,style_triangleup:gt.styleTriangleup,style_xcross:gt.styleXcross},uD={style_arrow_both:qt.styleArrowBoth,style_arrow_left:qt.styleArrowLeft,style_arrow_right:qt.styleArrowRight,style_dashed:qt.styleDashed,style_dotted:qt.styleDotted,style_solid:qt.styleSolid},lD={abovebar:vn.abovebar,absolute:vn.absolute,belowbar:vn.belowbar,bottom:vn.bottom,top:vn.top},cD={e:2.718281828459045,phi:1.618033988749895,pi:3.141592653589793,rphi:.6180339887498948},fD={style_area:Or.styleArea,style_areabr:Or.styleAreabr,style_circles:Or.styleCircles,style_columns:Or.styleColumns,style_cross:Or.styleCross,style_histogram:Or.styleHistogram,style_line:Or.styleLine,style_linebr:Or.styleLinebr,style_stepline:Or.styleStepline,style_stepline_diamond:Or.styleSteplineDiamond,style_steplinebr:Or.styleSteplinebr},hD={bottom_center:Er.bottomCenter,bottom_left:Er.bottomLeft,bottom_right:Er.bottomRight,middle_center:Er.middleCenter,middle_left:Er.middleLeft,middle_right:Er.middleRight,top_center:Er.topCenter,top_left:Er.topLeft,top_right:Er.topRight},dD={left:Us.left,none:Us.none,right:Us.right},pD={arrowdown:_r.arrowdown,arrowup:_r.arrowup,circle:_r.circle,cross:_r.cross,diamond:_r.diamond,flag:_r.flag,labeldown:_r.labeldown,labelup:_r.labelup,square:_r.square,triangledown:_r.triangledown,triangleup:_r.triangleup,xcross:_r.xcross},_D={auto:ar.auto,huge:ar.huge,large:ar.large,normal:ar.normal,small:ar.small,tiny:ar.tiny},vD={cash:Rt.cash,fixed:Rt.fixed,percent_of_equity:Rt.percentOfEquity,commission:{cash_per_contract:Ir.cashPerContract,cash_per_order:Ir.cashPerOrder,percent:Ir.percent},direction:{all:mt.all,long:mt.long,short:mt.short},oca:{cancel:gn.cancel,none:gn.none,reduce:gn.reduce}},gD={align_bottom:je.alignBottom,align_center:je.alignCenter,align_left:je.alignLeft,align_right:je.alignRight,align_top:je.alignTop,wrap_auto:je.wrapAuto,wrap_none:je.wrapNone},mD={bar_index:Et.bar_index,bar_time:Et.bar_time},xD={abovebar:Gr.abovebar,belowbar:Gr.belowbar,price:Gr.price},yD={actual:Ws.actual,estimate:Ws.estimate,standardized:Ws.standardized};class Wf{constructor(){U(this,"adjustment",{dividends:zs.dividends,none:zs.none,splits:zs.splits});U(this,"alert",tD);U(this,"barmerge",rD);U(this,"color",$i);U(this,"currency",qf);U(this,"dayofweek",nD);U(this,"earnings",yD);U(this,"display",Uf);U(this,"extend",iD);U(this,"font",{family_default:ei.familyDefault,family_monospace:ei.familyMonospace});U(this,"format",sD);U(this,"hline",oD);U(this,"label",aD);U(this,"line",uD);U(this,"location",lD);U(this,"math",cD);U(this,"order",{ascending:Jn.ascending,descending:Jn.descending});U(this,"plot",fD);U(this,"position",hD);U(this,"scale",dD);U(this,"session",{extended:yi.extended,regular:yi.regular});U(this,"shape",pD);U(this,"size",_D);U(this,"splits",{denominator:"denominator",numerator:"numerator"});U(this,"strategy",vD);U(this,"text",gD);U(this,"xloc",mD);U(this,"yloc",xD)}updateData(){}}class DD{constructor(e,t){U(this,"_variables");U(this,"_errorListener");U(this,"_defaultPolyline",{curved:!1,closed:!1,xloc:Et.bar_index,line_color:$i.blue,line_style:qt.styleSolid,line_width:1});this._variables=e,this._errorListener=t}new(e,t){var a;const r=`polyline_${t}_${this._variables.bar_index}`,n=Object.assign({},this._defaultPolyline,e,{id:r,points:(a=e.points)==null?void 0:a._value.map(u=>({time:u.time,index:u.index,price:u.price}))}),i=new Hf(r,this._variables);return this._verfiyArgs(e,t),t.startsWith("export")||this._variables.polyline.add(r,n,i),i}_verfiyArgs(e,t){const{line_style:r,xloc:n}=e,i="polyline.new";this._paramVerfiy(r,t,i,Object.values(qt),"line_style"),this._paramVerfiy(n,t,i,Object.values(Et),"xloc")}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}delete({id:e}){e&&e.delete()}}class Hf{constructor(e,t){U(this,"_id");U(this,"_variables");this._variables=t,this._id=e}delete(){this._variables.polyline.delete(this._id)}}class wD{constructor(e,t){U(this,"_variables");U(this,"_errorListener");U(this,"_defaultLine",{xloc:Et.bar_index,extend:Vr.none,style:qt.styleSolid});this._variables=e,this._errorListener=t}new({first_point:e,second_point:t,...r},n){const i=`line_${n}_${this._variables.bar_index}`,a={...this._defaultLine,...r,id:i};if(e&&t){const f=a.xloc===Et.bar_index?e.index:e.time,c=a.xloc===Et.bar_index?t.index:t.time;Object.assign(a,{x1:f,y1:e.price,x2:c,y2:t.price})}this._verfiyArgs(r,n);const u=new _s(i,this._variables,this._errorListener);return n.startsWith("export")||this._variables.line.add(i,a,u),u}_verfiyArgs(e,t){const{extend:r,xloc:n,style:i}=e,a="line.new";this._paramVerfiy(i,t,a,Object.values(qt),"style"),this._paramVerfiy(r,t,a,Object.values(Vr),"extend"),this._paramVerfiy(n,t,a,Object.values(Et),"xloc")}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}line(e,t){return e.x?e.x:new _s(t,this._variables,this._errorListener)}copy({id:e},t){return e==null?void 0:e.copy(t)}delete({id:e}){e==null||e.delete()}get_x1({id:e},t){return e==null?void 0:e.get_x1(t)}get_x2({id:e},t){return e==null?void 0:e.get_x2(t)}get_y1({id:e},t){return e==null?void 0:e.get_y1(t)}get_y2({id:e},t){return e==null?void 0:e.get_y2(t)}set_x1({id:e,...t},r){e==null||e.set_x1(t,r)}set_x2({id:e,...t},r){e==null||e.set_x2(t,r)}set_y1({id:e,...t},r){e==null||e.set_y1(t,r)}set_y2({id:e,...t},r){e==null||e.set_y2(t,r)}set_xy1({id:e,...t},r){e==null||e.set_xy1(t,r)}set_xy2({id:e,...t},r){e==null||e.set_xy2(t,r)}set_xloc({id:e,...t},r){e==null||e.set_xloc(t,r)}get_price({id:e,...t},r){return e==null?void 0:e.get_price(t,r)}set_color({id:e,...t},r){e==null||e.set_color(t,r)}set_style({id:e,...t},r){e==null||e.set_style(t,r)}set_width({id:e,...t},r){e==null||e.set_width(t,r)}set_extend({id:e,...t},r){e==null||e.set_extend(t,r)}set_first_point({id:e,...t},r){e==null||e.set_first_point(t,r)}set_second_point({id:e,...t},r){e==null||e.set_second_point(t,r)}}class _s{constructor(e,t,r){U(this,"_variables");U(this,"_id");U(this,"_errorListener");this._id=e,this._variables=t,this._errorListener=r}get data(){return this._variables.line.get(this._id)}copy(e){const t=`line_${e}_${this._variables.bar_index}`,r=this._getLine(e),n=new _s(t,this._variables,this._errorListener);return r&&this._variables.line.add(t,{...r,id:t},n),n}delete(){this._variables.line.delete(this._id)}get_price({x:e},t){const r=this._getLine(t);if(e===void 0)return e;if(r&&r.xloc===Et.bar_index){const{x1:n,y1:i,x2:a,y2:u}=r;return n===void 0||a===void 0||i===void 0||u===void 0?void 0:(u-i)/(a-n)*(e-n)+i}}get_x1(e){var t;return(t=this._getLine(e))==null?void 0:t.x1}get_x2(e){var t;return(t=this._getLine(e))==null?void 0:t.x2}get_y1(e){var t;return(t=this._getLine(e))==null?void 0:t.y1}get_y2(e){var t;return(t=this._getLine(e))==null?void 0:t.y2}set_x1({x:e},t){const r=this._getLine(t);r&&(r.x1=e)}set_x2({x:e},t){const r=this._getLine(t);r&&(r.x2=e)}set_y1({y:e},t){const r=this._getLine(t);r&&(r.y1=e)}set_y2({y:e},t){const r=this._getLine(t);r&&(r.y2=e)}set_xy1({x:e,y:t},r){const n=this._getLine(r);n&&(n.x1=e,n.y1=t)}set_xy2({x:e,y:t},r){const n=this._getLine(r);n&&(n.x2=e,n.y2=t)}set_xloc({xloc:e,x1:t,x2:r},n){const i=this._getLine(n);i&&(i.xloc=e,i.x1=t,i.x2=r,this._paramVerfiy(e,n,"line.set_xloc",Object.values(Et),"xloc"))}set_color({color:e},t){const r=this._getLine(t);r&&(r.color=e)}set_style({style:e},t){const r=this._getLine(t);r&&(r.style=e,this._paramVerfiy(e,t,"line.set_style",Object.values(qt),"style"))}set_width({width:e},t){const r=this._getLine(t);r&&(r.width=e)}set_extend({extend:e},t){const r=this._getLine(t);r&&(r.extend=e,this._paramVerfiy(e,t,"line.set_extend",Object.values(Vr),"extend"))}set_first_point({point:e},t){const r=this._getLine(t);if(r){const{index:n,time:i,price:a}=e||{},u=r.xloc===Et.bar_index?n:i,f=a;u&&(r.x1=u),f&&(r.y1=f)}}set_second_point({point:e},t){const r=this._getLine(t);if(r){const{index:n,time:i,price:a}=e||{},u=r.xloc===Et.bar_index?n:i,f=a;u&&(r.x2=u),f&&(r.y2=f)}}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}_getLine(e){const t=this._variables.line.get(this._id);return t||console.log(`${e}: line 不存在`),t}}class ED{constructor(e){U(this,"_variables");this._variables=e}new({line1:e,line2:t,color:r},n){const i=`linefill_${n}_${this._variables.bar_index}`,a=e==null?void 0:e.data,u=t==null?void 0:t.data;a&&(a.linefills=a.linefills||[],a.linefills.push(i)),u&&(u.linefills=u.linefills||[],u.linefills.push(i));const f=new Bo(this._variables,i,e,t);return n.startsWith("export")||(a||u)&&this._variables.linefill.add(i,{line1:a,line2:u,color:r,id:i},f),f}delete({id:e}){e==null||e.delete()}get_line1({id:e}){return e==null?void 0:e.get_line1()}get_line2({id:e}){return e==null?void 0:e.get_line2()}set_color({id:e,...t}){e==null||e.set_color(t)}}class Bo{constructor(e,t,r,n){U(this,"_id");U(this,"_line1");U(this,"_line2");U(this,"_variables");this._variables=e,this._id=t,this._line1=r,this._line2=n}linefill(e,t){return e.x?e.x:new Bo(this._variables,t)}delete(){var t,r;const e=this._variables.linefill.get(this._id);if(e){const{line1:n,line2:i}=e;n&&(n.linefills=(t=n.linefills)==null?void 0:t.filter(a=>a!==this._id)),i&&(i.linefills=(r=i.linefills)==null?void 0:r.filter(a=>a!==this._id))}this._line1=void 0,this._line2=void 0,this._variables.linefill.delete(this._id)}get_line1(){return this._line1}get_line2(){return this._line2}set_color({color:e}){const t=this._variables.linefill.get(this._id);t&&(t.color=e)}}class bD{constructor(e,t){U(this,"_variables");U(this,"_errorListener");U(this,"_defaultBox",{border_color:$i.blue,border_width:1,bgcolor:$i.blue,xloc:Et.bar_index,extend:Vr.none,style:qt.styleSolid,text:"",text_size:ar.auto,text_color:$i.black,text_halign:je.alignCenter,text_valign:je.alignCenter,text_wrap:je.wrapNone});this._variables=e,this._errorListener=t}box({x:e},t){return e===void 0?new vs(this._variables,t,this._errorListener):e}new({top_left:e,bottom_right:t,...r},n){const i=`box_${n}_${this._variables.bar_index}`,a={...this._defaultBox,...r,id:i};if(e){const{price:f,time:c,index:h}=e;a.top=f,a.left=a.xloc===Et.bar_index?h:c}if(t){const{price:f,time:c,index:h}=t;a.bottom=f,a.right=a.xloc===Et.bar_index?h:c}this._verfiyArgs(r,n);const u=new vs(this._variables,i,this._errorListener);return n.startsWith("export")||this._variables.box.add(i,a,u),u}_verfiyArgs(e,t){const{border_style:r,extend:n,xloc:i,text_size:a,text_halign:u,text_valign:f,text_wrap:c,text_font_family:h}=e,d="box.new";this._paramVerfiy(r,t,d,[qt.styleDashed,qt.styleDotted,qt.styleSolid],"border_style"),this._paramVerfiy(n,t,d,Object.values(Vr),"extend"),this._paramVerfiy(i,t,d,Object.values(Et),"xloc"),this._paramVerfiy(a,t,d,Object.values(ar),"text_size"),this._paramVerfiy(u,t,d,[je.alignLeft,je.alignCenter,je.alignRight],"text_halign"),this._paramVerfiy(f,t,d,[je.alignBottom,je.alignCenter,je.alignTop],"text_valign"),this._paramVerfiy(c,t,d,[je.wrapAuto,je.wrapNone],"text_wrap"),this._paramVerfiy(h,t,d,Object.values(ei),"text_font_family")}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}copy({id:e},t){return e==null?void 0:e.copy(t)}delete({id:e}){e==null||e.delete()}get_top({id:e}){return e==null?void 0:e.get_top()}get_bottom({id:e}){return e==null?void 0:e.get_bottom()}get_left({id:e}){return e==null?void 0:e.get_left()}get_right({id:e}){return e==null?void 0:e.get_right()}set_top({id:e,...t}){e==null||e.set_top(t)}set_bottom({id:e,...t}){e==null||e.set_bottom(t)}set_left({id:e,...t}){e==null||e.set_left(t)}set_right({id:e,...t}){e==null||e.set_right(t)}set_extend({id:e,...t},r){e==null||e.set_extend(t,r)}set_bgcolor({id:e,...t}){e==null||e.set_bgcolor(t)}set_border_color({id:e,...t}){e==null||e.set_border_color(t)}set_border_width({id:e,...t}){e==null||e.set_border_width(t)}set_border_style({id:e,...t},r){e==null||e.set_border_style(t,r)}set_lefttop({id:e,...t}){e==null||e.set_lefttop(t)}set_rightbottom({id:e,...t}){e==null||e.set_rightbottom(t)}set_text_size({id:e,...t},r){e==null||e.set_text_size(t,r)}set_text_wrap({id:e,...t},r){e==null||e.set_text_wrap(t,r)}set_text_color({id:e,...t}){e==null||e.set_text_color(t)}set_text_halign({id:e,...t},r){e==null||e.set_text_halign(t,r)}set_text_valign({id:e,...t},r){e==null||e.set_text_valign(t,r)}set_top_left_point({id:e,...t}){e==null||e.set_top_left_point(t)}set_bottom_right_point({id:e,...t}){e==null||e.set_bottom_right_point(t)}set_text_font_family({id:e,...t},r){e==null||e.set_text_font_family(t,r)}}class vs{constructor(e,t,r){U(this,"_id");U(this,"_variables");U(this,"_errorListener");this._variables=e,this._id=t,this._errorListener=r}copy(e){const t=`box_${e}_${this._variables.bar_index}`,r=this._getBox(),n=new vs(this._variables,t,this._errorListener);return r&&this._variables.box.add(t,{...r,id:t},n),n}delete(){this._variables.box.delete(this._id)}get_top(){const e=this._getBox();return e&&e.top}set_top({top:e}){const t=this._getBox();t&&(t.top=e)}get_left(){const e=this._getBox();return e&&e.left}set_left({left:e}){const t=this._getBox();t&&(t.left=e)}set_text({text:e}){const t=this._getBox();t&&(t.text=e)}get_right(){const e=this._getBox();return e&&e.right}set_right({right:e}){const t=this._getBox();t&&(t.right=e)}get_bottom(){const e=this._getBox();return e&&e.bottom}set_bottom({bottom:e}){const t=this._getBox();t&&(t.bottom=e)}set_extend({extend:e},t){const r=this._getBox();r&&(r.extend=e,this._paramVerfiy(e,t,"box.set_extend",Object.values(Vr),"extend"))}set_bgcolor({color:e}){const t=this._getBox();t&&(t.bgcolor=e)}set_lefttop({left:e,top:t}){const r=this._getBox();r&&(r.left=e,r.top=t)}set_text_size({text_size:e},t){const r=this._getBox();r&&(r.text_size=e,this._paramVerfiy(e,t,"box.set_text_size",Object.values(ar),"text_size"))}set_text_wrap({text_wrap:e},t){const r=this._getBox();r&&(r.text_wrap=e,this._paramVerfiy(e,t,"box.set_text_wrap",[je.wrapAuto,je.wrapNone],"text_wrap"))}set_text_color({text_color:e}){const t=this._getBox();t&&(t.text_color=e)}set_rightbottom({right:e,bottom:t}){const r=this._getBox();r&&(r.right=e,r.bottom=t)}set_text_halign({text_halign:e},t){const r=this._getBox();r&&(r.text_halign=e,this._paramVerfiy(e,t,"box.set_text_halign",[je.alignLeft,je.alignCenter,je.alignRight],"text_halign"))}set_text_valign({text_valign:e},t){const r=this._getBox();r&&(r.text_valign=e,this._paramVerfiy(e,t,"box.set_text_valign",[je.alignBottom,je.alignCenter,je.alignTop],"text_valign"))}set_top_left_point({point:e}){const t=this._getBox();if(t){const{index:r,price:n,time:i}=e||{};t.top=n,t.left=t.xloc===Et.bar_index?r:i}}set_border_color({color:e}){const t=this._getBox();t&&(t.border_color=e)}set_border_style({style:e},t){const r=this._getBox();r&&(r.border_style=e,this._paramVerfiy(e,t,"box.set_border_style",[qt.styleDashed,qt.styleDotted,qt.styleSolid],"style"))}set_border_width({width:e}){const t=this._getBox();t&&(t.border_width=e)}set_bottom_right_point({point:e}){const t=this._getBox();if(t){const{index:r,price:n,time:i}=e||{};t.bottom=n,t.right=t.xloc===Et.bar_index?r:i}}set_text_font_family({text_font_family:e},t){const r=this._getBox();r&&(r.text_font_family=e,this._paramVerfiy(e,t,"box.set_text_font_family",Object.values(ei),"text_font_family"))}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}_getBox(){return this._variables.box.get(this._id)}}class AD{constructor(e,t){U(this,"_variables");U(this,"_errorListener");U(this,"_defaultTable",{position:Er.topLeft,columns:0,rows:0,frame_width:0,border_width:0});this._variables=e,this._errorListener=t}table({x:e},t){return e||new su(this._variables,t,this._errorListener)}new(e,t){const r=`table_${t}_${this._variables.bar_index}`,n={...this._defaultTable,...e,cell:[],id:r},i=new su(this._variables,r,this._errorListener);return this._paramVerfiy(e.position,t,"table.new",Object.values(Er),"position"),t.startsWith("export")||this._variables.table.add(r,n,i),i}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}cell({table_id:e,...t}){e==null||e.cell(t)}cell_set_bgcolor({table_id:e,...t}){e==null||e.cell_set_bgcolor(t)}cell_set_height({table_id:e,...t}){e==null||e.cell_set_height(t)}cell_set_text({table_id:e,...t}){e==null||e.cell_set_text(t)}cell_set_text_color({table_id:e,...t}){e==null||e.cell_set_text_color(t)}cell_set_text_font_family({table_id:e,...t}){e==null||e.cell_set_text_font_family(t)}cell_set_text_halign({table_id:e,...t}){e==null||e.cell_set_text_halign(t)}cell_set_text_valign({table_id:e,...t}){e==null||e.cell_set_text_valign(t)}cell_set_text_size({table_id:e,...t}){e==null||e.cell_set_text_size(t)}cell_set_tooltip({table_id:e,...t}){e==null||e.cell_set_tooltip(t)}cell_set_width({table_id:e,...t}){e==null||e.cell_set_width(t)}clear({table_id:e,...t}){e==null||e.clear(t)}delete({table_id:e}){e==null||e.delete()}merge_cells({table_id:e,...t},r){e==null||e.merge_cells(t,r)}set_bgcolor({table_id:e,...t}){e==null||e.set_bgcolor(t)}set_border_color({table_id:e,...t}){e==null||e.set_border_color(t)}set_border_width({table_id:e,...t}){e==null||e.set_border_width(t)}set_frame_color({table_id:e,...t}){e==null||e.set_frame_color(t)}set_frame_width({table_id:e,...t}){e==null||e.set_frame_width(t)}set_position({table_id:e,...t},r){e==null||e.set_position(t,r)}}class su{constructor(e,t,r){U(this,"_id");U(this,"_variables");U(this,"_errorListener");U(this,"_defaultCell",{column:0,row:0,text:"",text_color:$i.black,text_halign:je.alignCenter,text_valign:je.alignCenter,text_size:ar.normal});this._variables=e,this._id=t,this._errorListener=r}cell(e){const t={...this._defaultCell,...e},{column:r=0,row:n=0}=t,i=this._variables.table.get(this._id);if(i){const a=i.cell||[],u=a[n]||[];u[r]=t,a[n]=u,i.cell=a}}cell_set_bgcolor({column:e=0,row:t=0,bgcolor:r}){const n=this._getTableItem(e,t);n&&(n.bgcolor=r)}cell_set_height({column:e=0,row:t=0,height:r}){const n=this._getTableItem(e,t);n&&(n.height=r)}cell_set_text({column:e=0,row:t=0,text:r}){const n=this._getTableItem(e,t);n&&(n.text=r)}cell_set_text_color({column:e=0,row:t=0,text_color:r}){const n=this._getTableItem(e,t);n&&(n.text_color=r)}cell_set_text_font_family({column:e=0,row:t=0,text_font_family:r}){const n=this._getTableItem(e,t);n&&(n.text_font_family=r)}cell_set_text_halign({column:e=0,row:t=0,text_halign:r}){const n=this._getTableItem(e,t);n&&(n.text_halign=r)}cell_set_text_valign({column:e=0,row:t=0,text_valign:r}){const n=this._getTableItem(e,t);n&&(n.text_valign=r)}cell_set_text_size({column:e=0,row:t=0,text_size:r}){const n=this._getTableItem(e,t);n&&(n.text_size=r)}cell_set_tooltip({column:e=0,row:t=0,tooltip:r}){const n=this._getTableItem(e,t);n&&(n.tooltip=r)}cell_set_width({column:e=0,row:t=0,width:r}){const n=this._getTableItem(e,t);n&&(n.width=r)}clear({start_column:e=0,start_row:t=0,end_column:r=0,end_row:n=0}){const i=this._variables.table.get(this._id);if(i){const a=i.cell;if(a)for(let u=t;u<=n;u++)for(let f=e;f<=r;f++){const c=a[u];c&&(c[f]=void 0)}}}delete(){this._variables.table.delete(this._id)}merge_cells({start_column:e=0,start_row:t=0,end_column:r=0,end_row:n=0},i){if(e>r||t>n){console.log(`error ${i}: start_column > end_column or start_row > end_row`);return}const a=this._getTableItem(e,t);if(!a)return;this.clear({start_column:e,start_row:t,end_column:r,end_row:n});const u=this._variables.table.get(this._id);u.cell[t][e]={...a,isMerge:!0,merge_columns:r-e+1,merge_rows:n-t+1}}set_bgcolor({bgcolor:e}){const t=this._variables.table.get(this._id);t&&(t.bgcolor=e)}set_border_color({border_color:e}){const t=this._variables.table.get(this._id);t&&(t.border_color=e)}set_border_width({border_width:e}){const t=this._variables.table.get(this._id);t&&(t.border_width=e)}set_frame_color({frame_color:e}){const t=this._variables.table.get(this._id);t&&(t.frame_color=e)}set_frame_width({frame_width:e}){const t=this._variables.table.get(this._id);t&&(t.frame_width=e)}set_position({position:e},t){const r=this._variables.table.get(this._id);r&&(r.position=e,this._paramVerfiy(e,t,"table.set_position",Object.values(Er),"position"))}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}_getTableItem(e,t){const r=this._variables.table.get(this._id);if(r){const n=r.cell;return n?n[t][e]:void 0}}}class CD{constructor(e){U(this,"_strategy");this._strategy=e}commission({trade_num:e}){return this._verifyTradeNum(e)&&this._strategy.historyOrders[e].commission||0}entry_bar_index({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.historyOrders[e].in_index}entry_comment({trade_num:e}){if(!this._verifyTradeNum(e))return"";const{comment:t,id:r}=this._strategy.historyOrders[e];return t||r}entry_id({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].id:""}entry_price({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.historyOrders[e].in_price}entry_time({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.historyOrders[e].in_time}exit_bar_index({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.historyOrders[e].out_index}exit_comment({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].out_comment:""}exit_id({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].out_id:""}exit_price({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.historyOrders[e].out_price}exit_time({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.historyOrders[e].out_time}max_drawdown({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].trading_loss:0}max_drawdown_percent({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].trading_loss_percent:0}max_runup({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].max_profit:0}max_runup_percent({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].max_profit_percent:0}profit({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].profit:0}profit_percent({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].profit_percent:0}size({trade_num:e}){if(!this._verifyTradeNum(e))return 0;const{out_qty:t=0,direction:r}=this._strategy.historyOrders[e];return r===mt.long?t:-t}_verifyTradeNum(e){if(typeof e!="number"||e<0)return!1;const t=this._strategy.historyOrders.length;return!(e>=t)}}class FD{constructor(e){U(this,"_strategy");this._strategy=e}commission({trade_num:e}){if(!this._verifyTradeNum(e))return 0;const{qty:t=0,original_qty:r=0,commission:n=0}=this._strategy.orders[e];return n*t/r}entry_bar_index({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.orders[e].in_index}entry_comment({trade_num:e}){if(!this._verifyTradeNum(e))return"";const{comment:t,id:r}=this._strategy.orders[e];return t||r}entry_id({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.orders[e].id:""}entry_price({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.orders[e].in_price}entry_time({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.orders[e].in_time}max_drawdown({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.orders[e].trading_loss:0}max_drawdown_percent({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.orders[e].trading_loss_percent:0}max_runup({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.orders[e].max_profit:0}max_runup_percent({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.orders[e].max_profit_percent:0}profit({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.orders[e].profit:0}profit_percent({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.orders[e].profit_percent:0}size({trade_num:e}){if(!this._verifyTradeNum(e))return 0;const{qty:t=0,direction:r}=this._strategy.orders[e];return r===mt.long?t:-t}_verifyTradeNum(e){if(typeof e!="number"||e<0)return!1;const t=this._strategy.orders.length;return!(e>=t)}}class BD{constructor(e,t){U(this,"_strategy");U(this,"_errorListener");this._strategy=e,this._errorListener=t}allow_entry_in({value:e},t){this._paramVerfiy(e,t,"strategy.risk.allow_entry_in",Object.values(mt),"value"),this._strategy.updateRisk({allow_entry_in:e})}max_cons_loss_days({count:e}){this._strategy.updateRisk({max_cons_loss_days:e})}max_drawdown({value:e,type:t},r){this._paramVerfiy(t,r,"strategy.risk.max_drawdown",[Rt.percentOfEquity,Rt.cash],"type"),t===Rt.percentOfEquity&&(e=e>100?100:e),this._strategy.updateRisk({max_drawdown:e,max_drawdown_type:t})}max_intraday_filled_orders({count:e}){this._strategy.updateRisk({max_intraday_filled_orders:e})}max_intraday_loss({value:e,type:t},r){this._paramVerfiy(t,r,"strategy.risk.max_intraday_loss",[Rt.percentOfEquity,Rt.cash],"type"),t===Rt.percentOfEquity&&(e=e>100?100:e),this._strategy.updateRisk({max_intraday_loss:e,max_intraday_loss_type:t})}max_position_size({contracts:e}){this._strategy.updateRisk({max_position_size:e})}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}}let MD=class{constructor(e,t,r,n){U(this,"_variables");U(this,"_options");U(this,"_totalChangeCapital");U(this,"_historyOrder");U(this,"_orders");U(this,"_pendingOrders");U(this,"_mintick");U(this,"_funcOptions");U(this,"_pendingCloseOrders");U(this,"_errorListener");U(this,"_risk");U(this,"_opentrades");U(this,"_closedtrades");U(this,"_riskNamespace");this._variables=e,this._errorListener=n,this._options={overlay:!1,format:Je.inherit,pyramiding:0,calc_on_order_fills:!1,calc_on_every_tick:!1,max_bars_back:0,backtest_fill_limits_assumption:0,default_qty_type:Rt.fixed,default_qty_value:1,initial_capital:1e6,currency:qf.NONE,slippage:0,commission_type:Ir.percent,commission_value:0,process_orders_on_close:!1,close_entries_rule:"FIFO",margin_long:0,margin_short:0,explicit_plot_zorder:!1,max_lines_count:50,max_labels_count:50,max_boxes_count:50,calc_bars_count:0,risk_free_rate:2,use_bar_magnifier:!1,fill_orders_on_standard_ohlc:!1,max_polylines_count:50},this._funcOptions=t,this._totalChangeCapital=0,this._orders=[],this._pendingOrders=[],this._historyOrder=[],this._pendingCloseOrders=[],this._mintick=r,this._variables.strategy.updateOrders(this._orders),this._variables.strategy.updateHistoryOrders(this._historyOrder),this._variables.strategy.updateStrategyOptions(this._options),this._risk={intradayOrders:0},this._opentrades=new FD(this),this._closedtrades=new CD(this),this._riskNamespace=new BD(this,n)}get orders(){return[...this._orders]}get historyOrders(){return[...this._historyOrder]}get _orderProfit(){return this._orders.reduce((e,t)=>e+(t.profit||0),0)}get _freezeCapital(){const{close:e}=this._variables;return this._orders.reduce((t,r)=>t+e*(r.qty||0),0)}get opentrades(){return this._opentrades}get closedtrades(){return this._closedtrades}get risk(){return this._riskNamespace}updateOptions(e){Object.assign(this._options,e),this._maxConsLossDaysVerify(),this._pendingOrderHandle(),this._maxIntradayFilledOrdersVerify(),this._ordersHandle(),!this._options.process_orders_on_close&&this._calcLiquidate()}updateRisk(e){Object.assign(this._risk,e)}endExecution(){this._calcProfitAndLoss(),this._variables.strategy.update(),this._maxDrawdownVerify(),this._maxIntradayLoss(),this._pendingCloseOrderHandle(),this._options.process_orders_on_close&&this._calcLiquidate()}_maxIntradayLoss(){var v;const{max_intraday_loss:e,max_intraday_loss_type:t,isDisabledOpen:r}=this._risk;if(e===void 0||!t||r)return;const{high:n,low:i,time_tradingday:a,time:u,strategy:{netprofit:f,initial_capital:c}}=this._variables;let{preNetprofit:h=0}=this._risk;u===a&&(h=f,this._risk.preNetprofit=f,this._risk.isTemporaryBan=!1);let d=h-f;d+=this._orders.reduce((x,_)=>{const{in_price:y,direction:m,qty:w=0,commission:D=0,original_qty:A=0}=_,E=m===mt.long?1:-1,F=(n-y)*w,B=(i-y)*w,M=E===1?-B:F;return x+M+w/A*D},0);let p=!1;switch(t){case Rt.cash:p=e<d;break;case Rt.percentOfEquity:const x=d/(c+f)*100;p=e<x;break}if(p){this._risk.isTemporaryBan=!0;const x=(v=this._orders[0])==null?void 0:v.direction;this._closeOrders(this._orders,x===mt.long?i:n,"Close Position (Max intraday Loss)"),this._pendingOrders=[]}}_maxIntradayFilledOrdersVerify(){const{max_intraday_filled_orders:e,intradayOrders:t=0,isDisabledOpen:r}=this._risk;if(e===void 0||r)return;const{time:n,time_tradingday:i,open:a}=this._variables;n===i&&(this._risk.intradayOrders=0,this._risk.isTemporaryBan=!1),e<=t&&(this._risk.isTemporaryBan=!0,this._closeOrders(this._orders,a,"Close Position (Max number of filled orders in one day)"),this._pendingOrders=[])}_maxConsLossDaysVerify(){const{max_cons_loss_days:e,lossDays:t=0,isDisabledOpen:r,totalProfit:n=0}=this._risk;if(e===void 0||r)return;const{time:i,time_tradingday:a,strategy:u,open:f}=this._variables;let c=t;if(i===a){const h=u.netprofit+u.openprofit;h<n?c=0:c++,Object.assign(this._risk,{lossDays:c,totalProfit:h})}e<=c&&this._riskTouchOff(f,"Close Position (Max consecutive loss days)")}_maxDrawdownVerify(){var n;const{max_drawdown:e,max_drawdown_type:t,isDisabledOpen:r}=this._risk;if(!r&&e!==void 0&&t){const{max_drawdown:i,max_drawdown_percent:a}=this._variables.strategy;let u=!1;switch(t){case Rt.percentOfEquity:u=a<i;break;case Rt.cash:u=e<i;break}if(u){const{high:f,low:c}=this._variables,h=(n=this._orders[0])==null?void 0:n.direction;this._riskTouchOff(h===mt.long?f:c,"Close Position (Max Drawdown)")}}}_riskTouchOff(e,t){this._risk.isDisabledOpen=!0,this._closeOrders(this._orders,e,t),this._pendingOrders=[]}strategy(e,t){this._variables.bar_index||(this._paramVerfiy(e.format,t,"strategy",[Je.inherit,Je.price,Je.percent,Je.volume],"format"),this._paramVerfiy(e.default_qty_type,t,"strategy",Object.values(Rt),"default_qty_type"),this._paramVerfiy(e.commission_type,t,"strategy",Object.values(Ir),"commission_type"),this._options={...e},this._variables.updateMaxLength(e),Object.assign(this._funcOptions,{strategy:this._options,scriptType:"strategy"}))}order(e,t){this._risk.isDisabledOpen||(this._paramVerfiy(e.oca_type,t,"strategy.order",Object.values(gn),"oca_type"),this._orderHandle(e))}entry(e,t){this._risk.isDisabledOpen||(this._paramVerfiy(e.oca_type,t,"strategy.entry",Object.values(gn),"oca_type"),this._entryHandle(e))}close(e){if(!this._orders.length)return;const{immediately:t}=e;t||this._options.process_orders_on_close?this._pendingCloseOrders.push({...e,place_order_type:"close"}):this._pendingOrders.push({...e,place_order_type:"close"})}close_all(e){if(typeof e=="string"&&(e={}),!this._orders.length)return;const{immediately:t}=e;t||this._options.process_orders_on_close?this._pendingCloseOrders.push({...e,place_order_type:"close_all"}):this._pendingOrders.push({...e,place_order_type:"close_all"})}cancel({id:e}){this._pendingOrders=this._pendingOrders.filter(t=>!(t.id===e&&t.place_order_type!=="close"))}cancel_all(){this._pendingOrders=this._pendingOrders.filter(e=>e.place_order_type==="close_all")}exit(e,t){this._exit(e,t)}convert_to_account({value:e}){return e}convert_to_symbol({value:e}){return e}default_entry_qty({fill_price:e}){return e?this._calcDefaultQty(e):0}_calcDefaultQty(e){const{default_qty_type:t=Rt.fixed,default_qty_value:r=1,initial_capital:n}=this._options;switch(t){case Rt.fixed:return r;case Rt.cash:return r/e;case Rt.percentOfEquity:return(n+this._orderProfit+this._totalChangeCapital)*r/100/e}}_getCapital(e,t){const{margin_long:r=0,margin_short:n=0}=this._options;return r<100&&r>0&&e===1?t=t*100/r:n<=100&&n>0&&e===-1&&(t=t*100/n),t}_calcProfitAndLoss(){const{high:e,low:t,close:r}=this._variables;for(const n of this._orders){const{in_price:i,qty:a=0,direction:u}=n,f=u===mt.long?1:-1,c=(r-i)*f*a,h=(e-i)*a,d=(t-i)*a,p=f===1?h:-d,v=f===1?-d:h;this._calcOrderPercent(n,c,p,v)}}_calcOrderPercent(e,t,r,n){const{commission_value:i}=this._options,{close:a}=this._variables,{original_qty:u=0,qty:f=0,in_price:c,max_profit:h=0,trading_loss:d=0}=e;let{commission:p=0}=e;const v=c*f;if(i){const x=this._getCommission(a,f);t=t-x,p=p*f/u,r-=p,n+=p}r=Math.max(r,h),n=Math.min(n,d),Object.assign(e,{profit:t-p,total_profit:this._totalChangeCapital+t,max_profit:r,trading_loss:n,profit_percent:t/v*100,max_profit_percent:r/v*100,trading_loss_percent:n/v*100})}_calcLiquidate(){if(!this._orders.length)return;const{high:e,low:t}=this._variables,{initial_capital:r,margin_long:n=0,margin_short:i=0,commission_value:a=0}=this._options,u=this._orders[0].direction===mt.long?1:-1,f=u===1?t:e,c=(u===1?n:i)/100;if(c<=0)return;const[h,d,p]=this._orders.reduce((m,w)=>{let[D,A,E]=m;const{in_price:F,qty:B=0,original_qty:M=0,commission:O=0}=w,C=F*B,N=f*B;if(D+=C,A+=N,a){const I=this._getCommission(f,B);E+=I+B/M*O}return[D,A,E]},[0,0,0]),v=u*(d-h),_=r+this._totalChangeCapital+v-p-d*c;if(_>=0)return;const y=Math.trunc(_/c/f)*4;this._marginCallOrders(f,y,"Margin Call")}_marginCallOrders(e,t,r){const{close_entries_rule:n="FIFO"}=this._options;if(n==="FIFO"){this._processOrders(this._orders,e,t*this._orders.length,r,r);return}for(const i of this.orders)this._processOrder(i,e,t,r,r);this._orders=this._orders.filter(i=>!i.isDeal),this._variables.strategy.updateOrders(this._orders)}_orderHandle(e){const{process_orders_on_close:t,slippage:r=0}=this._options,{orders:n,isMarketPrice:i,quantities:a,close:u,price:f,activePrice:c}=this._orderArgsParse(e),h=e.direction===mt.long?1:-1;if(a<=0)return;let d=a;if(i&&t){if(n.length){const _=this._processOrders(n,u,d,e.id,e.comment);if(_<=0)return;d=_}const v=u+h*r*this._mintick;if(!this._judgeCapitalEnough(d,v,h))return;this._ocaGroupVerify(d,e.oca_name,e.oca_type),this._calcCurrentOrder({...e,in_price:v,in_index:this._variables.bar_index,in_time:this._variables.time,qty:d,place_order_type:"order"});return}this._judgeCapitalEnough(a,f,h)&&this._addPendingOrders(e,f,d,i,c)}_judgeCapitalEnough(e,t,r){if(e<=0)return!1;const{margin_long:n=0,margin_short:i=0}=this._options;if((n===0||n===100)&&r===1||i===0&&r===-1)return!0;const u=this._getCapital(r,this._options.initial_capital+this._orderProfit+this._totalChangeCapital)-this._freezeCapital;return e*t<=u}_ocaGroupVerify(e,t,r){if(!t||!r||r===gn.none)return!1;let n=!1;switch(r){case gn.cancel:this._pendingOrders=this._pendingOrders.filter(i=>{if(i.oca_name===t)i.isCancel=!0,n=!0;else return!0});break;case gn.reduce:this._pendingOrders=this._pendingOrders.filter(i=>{const{qty:a=0,oca_name:u}=i;if(t===u){const f=a-e;return n=!0,f<=0?(i.isCancel=!0,!1):(i.qty=f,!0)}else return!0});break}return n}_processOrders(e,t,r,n,i){let a=r;for(const u of e)if(a=this._processOrder(u,t,a,n,i),a<=0)break;return this._orders=this._orders.filter(u=>!u.isDeal),this._variables.strategy.updateOrders(this._orders),a}_addPendingOrders(e,t,r,n,i){const a=this._pendingOrders.find(u=>u.id===e.id&&!u.isMarketPrice);if(a)Object.assign(a,{...e,in_price:t,isMarketPrice:n,qty:r,active_price:i});else{const u={...e,in_price:t,isMarketPrice:n,qty:r,active_price:i,place_order_type:"order"};this._pendingOrders.push(u)}}_orderArgsParse(e){const{direction:t,qty:r,stop:n}=e;let i=e.limit||0;const{close:a}=this._variables;let u=a,f=!1,c;const h=t===mt.long?1:-1,d=n&&(n-a)*h>0,{backtest_fill_limits_assumption:p=0}=this._options;p>0&&i&&(i-=p*this._mintick*h);const v=i&&(i-a)*h<0;d&&v?(c=n,u=i):d?u=n:v?u=i:f=!0;const x=r||this._calcDefaultQty(u)||1;return{orders:this._orders.filter(y=>y.direction!==t),isMarketPrice:f,activePrice:c,quantities:x,close:a,price:u}}_entryHandle(e){const{process_orders_on_close:t}=this._options,{orders:r,isMarketPrice:n,quantities:i,close:a,price:u,activePrice:f}=this._orderArgsParse(e);if(i<=0)return;if(r.length&&n&&t){this._entryOrder(r,a,i,e);return}this._judgeCapitalEnough(i,a,e.direction===mt.long?1:-1)&&this._addPendingEntry(e,u,i,n,f)}_entryOrder(e,t,r,n){const{time:i,bar_index:a}=this._variables,{slippage:u=0}=this._options,{oca_name:f,oca_type:c,direction:h,comment:d,isMarketPrice:p,id:v}=n,x=h===mt.long?1:-1;if(this._closeOrders(e,t,v,d),r=this._getAvailablePositionSize(r,h),r<=0)return;t=t+u*this._mintick*x;const _={...n,in_price:t,original_qty:r,qty:r,in_index:a,in_time:i,place_order_type:"entry"};if(p){this._calcCurrentOrder(_);return}const{pendingOrders:y,orders:m}=this._getEntryOrders(h),w=y.length+m.length;w&&w>=(this._options.pyramiding||0)||!this._judgeCapitalEnough(r,t,x)||(this._ocaGroupVerify(r,f,c),this._calcCurrentOrder(_))}_getAvailablePositionSize(e,t){const{max_position_size:r,allow_entry_in:n}=this._risk;if(n&&n!==mt.all&&n!==t)return 0;if(r===void 0)return e;const i=this._orders.reduce((a,u)=>a+(u.qty||0),0);return i?i+e>r?0:e:e>r?e-r:0}_getEntryOrders(e){const t=this._pendingOrders.filter(n=>["entry","order"].includes(n.place_order_type)&&n.direction===e),r=this._orders.filter(n=>n.direction===e);return{pendingOrders:t,orders:r}}_addPendingEntry(e,t,r,n,i){if(r=this._getAvailablePositionSize(r,e.direction),r<=0)return;const{pendingOrders:a,orders:u}=this._getEntryOrders(e.direction),f=a.length+u.length,c=a.find(h=>h.id===e.id&&h.place_order_type==="entry");if(c)Object.assign(c,{...e,in_price:t,isMarketPrice:n,qty:r,active_price:i});else if(!f||f<(this._options.pyramiding||1)){const h={...e,in_price:t,isMarketPrice:n,qty:r,active_price:i,place_order_type:"entry"};this._pendingOrders.push(h)}}_closeAllOrders(e,t){const{comment:r}=e,{bar_index:n}=this._variables,i=this._orders.filter(a=>a.in_index!==n);i.length&&(this._closeOrders(i,t,"Close position order",r),this._orders=[],this._variables.strategy.updateOrders(this._orders))}_closeOrders(e,t,r,n){for(const i of e)this._closeOrder(i,t,r,n);this._orders=this._orders.filter(i=>!i.isDeal),this._variables.strategy.updateOrders(this._orders)}_closeOrder(e,t,r,n){const{time:i,bar_index:a}=this._variables,{slippage:u=0}=this._options,{in_price:f,qty:c=0,direction:h}=e,d=h===mt.long?1:-1;t=t-d*u*this._mintick,e.isDeal=!0;const p=(t-f)*d*c,v={...e,out_price:t,out_id:r,out_index:a,out_time:i,out_comment:n,out_qty:c,profit:p};this._calcPercent(v),this._risk.intradayOrders+=1,this._historyOrder.push(v),this._variables.strategy.updateHistoryOrders(this._historyOrder)}_ordersHandle(){const e=this._orders.filter(a=>a.place_order_type==="exit"&&!a.hasExit);if(!e.length)return;const{open:t,low:r,high:n,close:i}=this._variables;for(const a of e){const{stop:u,limit:f,trail_stop_price:c,isMarketPriceLimit:h,isMarketPriceStop:d,direction:p,id:v,out_comment:x,active_price:_,trail_offset:y=0,out_qty:m,comment_loss:w,comment_profit:D,comment_trailing:A}=a;let E=c;const F=p===mt.long?1:-1;let B,M=x;if(h||d?B=t:(f&&r<=f&&n>=f&&(M=D||x,B=f),u&&r<=u&&n>=u&&(B=E?(u-E)*F>0?u:E:u,M=(E===B?A:w)||x)),B)this._processExitOnClose(a,B,{from_entry:v,comment:M,qty:m});else{let O=!1;if(_&&_<=n&&_>=r&&(E=_-y*F*this._mintick,(E-i)*F>=0&&(a.isMarketPriceStop=!0,this._options.process_orders_on_close&&(B=E)),O=!0,a.trail_stop_price=E),E)if((E-t)*F>=0&&!O)B=E;else{const C=(F===1?n:r)-y*F*this._mintick;F===1?E<t&&E>=r&&C>E&&C<i?B=E:C>E?(E=C,C>=i&&(B=C)):E<=n&&r<=E&&(B=E):E>t&&E<=n&&C<E&&C>i?B=E:C<E?(E=C,C<=i&&(B=C)):E<=n&&r<=E&&(B=E),a.trail_stop_price=E}B&&this._processExitOnClose(a,B,{from_entry:v,comment:A||x,qty:m})}}}_pendingOrderHandle(){if(!this._pendingOrders.length)return;const e=[],t=this._pendingOrders.filter(n=>n.place_order_type==="exit"),r=this._pendingOrders.filter(n=>["close","close_all"].includes(n.place_order_type||""));for(const n of r)switch(n.place_order_type){case"close":this._closeOrderHandle(n);break;case"close_all":this._closeAllOrders(n,this._variables.open);break}for(const n of this._pendingOrders){const{isCancel:i,place_order_type:a}=n;if(i)continue;let u;switch(a){case"entry":u=this._entryOrderHandle(n);break;case"order":u=this._orderOrderHandle(n);break}u&&e.push(u)}for(const n of t){const i=this._exitOrderHandle(n);i&&e.push(i)}this._pendingOrders=e}_pendingCloseOrderHandle(){if(!this._pendingCloseOrders.length)return;const e=this._pendingCloseOrders.filter(n=>n.place_order_type==="exit"),t=this._pendingCloseOrders.filter(n=>["close","close_all"].includes(n.place_order_type||"")),{close:r}=this._variables;for(const n of t)switch(n.place_order_type){case"close":this._closeOrderHandle(n,!0);break;case"close_all":this._closeAllOrders(n,r);break}for(const n of e){const{from_entry:i}=n,a=this._orders.filter(u=>!i||u.id===i&&(u.isMarketPriceLimit||u.isMarketPriceStop));for(const u of a)this._processExitOnClose(u,u.limit||u.stop||u.trail_stop_price||r,n)}this._pendingCloseOrders=[]}_entryOrderHandle(e){const{open:t,low:r,high:n}=this._variables,{isMarketPrice:i,qty:a=0,in_price:u,direction:f,active_price:c}=e;if(c&&n>=c&&r<=c)return delete e.active_price,e;let h=u;if(i&&(h=t),h<=n&&h>=r){const d=this._orders.filter(p=>p.direction!==f);this._entryOrder(d,h,a,e)}else return e}_orderOrderHandle(e){const{open:t,low:r,high:n,time:i,bar_index:a}=this._variables,{slippage:u=0}=this._options,{isMarketPrice:f,qty:c=0,in_price:h,direction:d,comment:p,oca_name:v,oca_type:x,active_price:_,id:y}=e;if(_&&n>=_&&r<=_)return delete e.active_price,e;let m=h,w=c;if(f&&(m=t),m<=n&&m>=r){const D=this._orders.filter(E=>E.direction!==d);if(D.length&&(w=this._processOrders(D,m,c,y,p),w<=0))return;const A=d===mt.long?1:-1;this._ocaGroupVerify(w,v,x),this._calcCurrentOrder({...e,in_price:m+A*u*this._mintick,in_index:a,in_time:i,qty:w});return}else return e}_closeOrderHandle(e,t){const{id:r,qty:n,qty_percent:i=100,comment:a}=e,{bar_index:u}=this._variables,f=this._orders.filter(v=>v.id===r&&v.in_index!==u&&(!v.close_qty||v.close_qty<(v.qty||0)));if(!f.length)return;let c=0;if(n?c=n:(c=f.reduce((v,x)=>v+(x.qty||0),c),c=i/100*c),c<=0)return;const{open:h,close:d}=this._variables;let p=c;for(const v of f){const{qty:x=0}=v;p<x?v.close_qty=p:(v.close_qty=x,p-=x)}this._processOrders(this._options.close_entries_rule==="ANY"?f:this._orders,t?d:h,c,`Close entry(s) order ${r}`,a)}_exitOrderHandle(e){const{from_entry:t}=e,r=this._orders.filter(n=>(!t||t===n.id)&&!n.hasExit);if(!(r.length&&!this._ordersToExit(r,e)))return e}_exit(e,t){const{profit:r,loss:n,stop:i,limit:a,trail_offset:u,trail_price:f,trail_points:c,from_entry:h="",id:d}=e;if(this._isNaN(r)&&this._isNaN(n)&&this._isNaN(i)&&this._isNaN(a)&&(this._isNaN(u)||this._isNaN(c)&&this._isNaN(f))){this._errorListener.addError(ct.strategyExitErr,t,Ze.Error);return}const p={...e,place_order_type:"exit"},v=this._orders.filter(y=>(!h||h===y.id)&&!y.hasExit),x=this._pendingOrders.filter(y=>!h||h===y.id);if(v.length){if(!this._ordersToExit(v,p))return}else if(!x.length)return;const _=this._pendingOrders.find(y=>y.id===d);_?Object.assign(_,{...e}):this._pendingOrders.push(p)}_ordersToExit(e,t){const{qty:r,qty_percent:n=100,id:i,comment:a,comment_loss:u,comment_profit:f,comment_trailing:c}=t;let h=r,d=!1;t.comment=a||i;for(const p of e){const{qty:v=0}=p,x=p.direction===mt.long?1:-1;h=r?r>=v?v:r:n/100*v,p.out_qty=h,h<v&&(d=!0),Object.assign(p,{out_comment:a||i,comment_loss:u,comment_profit:f,comment_trailing:c}),!(this._stopProfit(p,x,{...t,qty:h})||this._stopLoss(p,x,{...t,qty:h})||this._trailStopLoss(p,x,{...t,qty:h}))&&(p.place_order_type="exit")}return d}_addExitPendingCloseOrders(e){e.place_order_type="exit";const t=this._pendingCloseOrders.find(r=>r.id===e.id);t?Object.assign(t,{...e}):this._pendingCloseOrders.push(e)}_stopProfit(e,t,r){const{limit:n,profit:i,comment_profit:a,comment:u}=r;let f=n;const{close:c}=this._variables,{in_price:h}=e,{process_orders_on_close:d}=this._options;if(!this._isNaN(i)&&this._isNaN(n)&&(f=h+t*i*this._mintick),e.limit=f,f&&(f-c)*t<=0&&(e.isMarketPriceLimit=!0,r.comment=a||u,Object.assign(e,{out_comment:r.comment}),f=c,d))return this._addExitPendingCloseOrders(r),!0}_stopLoss(e,t,r){const{stop:n,loss:i,comment_loss:a,comment:u}=r;let f=n;const{close:c}=this._variables,{in_price:h}=e,{process_orders_on_close:d}=this._options;if(!this._isNaN(i)&&this._isNaN(n)&&(f=h-t*i*this._mintick),e.stop=f,f&&(f-c)*t>=0&&(e.isMarketPriceStop=!0,r.comment=a||u,Object.assign(e,{out_comment:r.comment}),f=c,d))return this._addExitPendingCloseOrders(r),!0}_trailStopLoss(e,t,r){const{trail_offset:n,trail_price:i,trail_points:a,comment_trailing:u,comment:f}=r;if(!this._isNaN(n)){const{close:c}=this._variables,{in_price:h}=e,{process_orders_on_close:d}=this._options;let p;if(this._isNaN(i)?this._isNaN(a)||(p=h+a*t*this._mintick):p=i,e.trail_offset=n,p&&(p-c)*t<=0){const v=c-n*t*this._mintick;if((v-c)*t>=0&&(e.trail_stop_price=c,e.isMarketPriceStop=!0,r.comment=u||f,Object.assign(e,{out_comment:r.comment}),d))return this._addExitPendingCloseOrders(r),!0;e.trail_stop_price=v}e.active_price=p}}_processExitOnClose(e,t,r){const{qty:n=0,comment:i,id:a}=r,{close_entries_rule:u="FIFO"}=this._options;if(u==="FIFO"){const f=this._processExitOrders(this._orders,t,n,a,i);f&&!f.hasExit?(f.hasExit=!0,Object.assign(e,{trail_stop_price:f.trail_stop_price,stop:f.stop,limit:f.limit,trail_offset:f.trail_offset,active_price:f.active_price})):f&&(e.hasExit=!0)}else e.hasExit=!0,this._processOrders([e],t,n,a,i)}_processExitOrders(e,t,r,n,i){let a=r,u;for(const f of e)if(u=f,a=this._processOrder(f,t,a,n,i),a<=0||!f.hasExit)break;return this._orders=this._orders.filter(f=>!f.isDeal),this._variables.strategy.updateOrders(this._orders),u}_processOrder(e,t,r,n,i){const{time:a,bar_index:u}=this._variables,{slippage:f=0}=this._options,{in_price:c,qty:h=0,max_profit:d=0,trading_loss:p=0,direction:v,commission:x=0,original_qty:_=0}=e,y=v===mt.long?1:-1;if(t=t-y*f*this._mintick,r<h){const m=h-r,w=(t-c)*y*r,D=d/h*r,A=p/h*r;this._calcPercent({...e,out_price:t,out_id:n,out_index:u,out_time:a,out_comment:i,profit:w,out_qty:r,max_profit:D,trading_loss:A});const E=(t-c)*y*m-x*m/_;Object.assign(e,{qty:m,profit:E,max_profit:d-D,trading_loss:p-A,total_profit:this._totalChangeCapital+E}),r=0}else{e.isDeal=!0;const m=(t-c)*y*h;this._calcPercent({...e,out_price:t,out_id:n,out_index:u,out_time:a,out_comment:i,out_qty:h,profit:m}),r-=h}return r}_calcPercent(e){const{commission_value:t}=this._options,{in_price:r,out_qty:n=0,out_price:i=0,original_qty:a=0}=e;let{profit:u=0,max_profit:f=0,trading_loss:c=0,commission:h=0}=e;f=f<0?0:f;const d=r*n;if(this._totalChangeCapital+=u,t){const p=this._getCommission(i,n);this._totalChangeCapital-=p,h=h*n/a+p,u=u-h,Object.assign(e,{commission:h,profit:u,max_profit:f})}Object.assign(e,{total_profit:this._totalChangeCapital,profit_percent:u/d*100,max_profit_percent:f/d*100,trading_loss_percent:c/d*100}),this._risk.intradayOrders+=1,this._historyOrder.push(e),this._variables.strategy.updateHistoryOrders(this._historyOrder)}_getCommission(e,t){const{commission_value:r=0,commission_type:n}=this._options,i=e*t;let a=0;switch(n){case Ir.percent:a=i*r/100;break;case Ir.cashPerContract:a=t*r;break;case Ir.cashPerOrder:a=r;break}return a}_calcCurrentOrder(e){const{commission_value:t}=this._options,{in_price:r,qty:n=0,max_profit:i=0,trading_loss:a=0}=e;let{profit:u=0}=e;const f=r*n;if(t){const c=this._getCommission(r,n);this._totalChangeCapital-=c,u=u-c,Object.assign(e,{commission:c,profit:u,total_profit:this._totalChangeCapital})}Object.assign(e,{original_qty:n,profit_percent:u/f*100,max_profit_percent:i/f*100,trading_loss_percent:a/f*100}),this._risk.intradayOrders+=1,this._orders.push(e),this._variables.strategy.updateOrders(this._orders)}_isNaN(e){return e===void 0||isNaN(e)}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}};var jf={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(ye,function(){return function(t,r,n){r.prototype.isBetween=function(i,a,u,f){var c=n(i),h=n(a),d=(f=f||"()")[0]==="(",p=f[1]===")";return(d?this.isAfter(c,u):!this.isBefore(c,u))&&(p?this.isBefore(h,u):!this.isAfter(h,u))||(d?this.isBefore(c,u):!this.isAfter(c,u))&&(p?this.isAfter(h,u):!this.isBefore(h,u))}}})})(jf);var ND=jf.exports,SD=tt(ND),Yf={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(ye,function(){return function(t,r,n){var i=r.prototype,a=function(p){var v,x=p.date,_=p.utc,y={};if(!((v=x)===null||v instanceof Date||v instanceof Array||i.$utils().u(v)||v.constructor.name!=="Object")){if(!Object.keys(x).length)return new Date;var m=_?n.utc():n();Object.keys(x).forEach(function(O){var C,N;y[C=O,N=i.$utils().p(C),N==="date"?"day":N]=x[O]});var w=y.day||(y.year||y.month>=0?1:m.date()),D=y.year||m.year(),A=y.month>=0?y.month:y.year||y.day?0:m.month(),E=y.hour||0,F=y.minute||0,B=y.second||0,M=y.millisecond||0;return _?new Date(Date.UTC(D,A,w,E,F,B,M)):new Date(D,A,w,E,F,B,M)}return x},u=i.parse;i.parse=function(p){p.date=a.bind(this)(p),u.bind(this)(p)};var f=i.set,c=i.add,h=i.subtract,d=function(p,v,x,_){_===void 0&&(_=1);var y=Object.keys(v),m=this;return y.forEach(function(w){m=p.bind(m)(v[w]*_,w)}),m};i.set=function(p,v){return v=v===void 0?p:v,p.constructor.name==="Object"?d.bind(this)(function(x,_){return f.bind(this)(_,x)},v,p):f.bind(this)(p,v)},i.add=function(p,v){return p.constructor.name==="Object"?d.bind(this)(c,p,v):c.bind(this)(p,v)},i.subtract=function(p,v){return p.constructor.name==="Object"?d.bind(this)(c,p,v,-1):h.bind(this)(p,v)}}})})(Yf);var OD=Yf.exports,ID=tt(OD),Kf={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(ye,function(){var t,r,n=1e3,i=6e4,a=36e5,u=864e5,f=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,c=31536e6,h=2628e6,d=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,p={years:c,months:h,days:u,hours:a,minutes:i,seconds:n,milliseconds:1,weeks:6048e5},v=function(F){return F instanceof A},x=function(F,B,M){return new A(F,M,B.$l)},_=function(F){return r.p(F)+"s"},y=function(F){return F<0},m=function(F){return y(F)?Math.ceil(F):Math.floor(F)},w=function(F){return Math.abs(F)},D=function(F,B){return F?y(F)?{negative:!0,format:""+w(F)+B}:{negative:!1,format:""+F+B}:{negative:!1,format:""}},A=function(){function F(M,O,C){var N=this;if(this.$d={},this.$l=C,M===void 0&&(this.$ms=0,this.parseFromMilliseconds()),O)return x(M*p[_(O)],this);if(typeof M=="number")return this.$ms=M,this.parseFromMilliseconds(),this;if(typeof M=="object")return Object.keys(M).forEach(function(k){N.$d[_(k)]=M[k]}),this.calMilliseconds(),this;if(typeof M=="string"){var I=M.match(d);if(I){var L=I.slice(2).map(function(k){return k!=null?Number(k):0});return this.$d.years=L[0],this.$d.months=L[1],this.$d.weeks=L[2],this.$d.days=L[3],this.$d.hours=L[4],this.$d.minutes=L[5],this.$d.seconds=L[6],this.calMilliseconds(),this}}return this}var B=F.prototype;return B.calMilliseconds=function(){var M=this;this.$ms=Object.keys(this.$d).reduce(function(O,C){return O+(M.$d[C]||0)*p[C]},0)},B.parseFromMilliseconds=function(){var M=this.$ms;this.$d.years=m(M/c),M%=c,this.$d.months=m(M/h),M%=h,this.$d.days=m(M/u),M%=u,this.$d.hours=m(M/a),M%=a,this.$d.minutes=m(M/i),M%=i,this.$d.seconds=m(M/n),M%=n,this.$d.milliseconds=M},B.toISOString=function(){var M=D(this.$d.years,"Y"),O=D(this.$d.months,"M"),C=+this.$d.days||0;this.$d.weeks&&(C+=7*this.$d.weeks);var N=D(C,"D"),I=D(this.$d.hours,"H"),L=D(this.$d.minutes,"M"),k=this.$d.seconds||0;this.$d.milliseconds&&(k+=this.$d.milliseconds/1e3,k=Math.round(1e3*k)/1e3);var z=D(k,"S"),R=M.negative||O.negative||N.negative||I.negative||L.negative||z.negative,V=I.format||L.format||z.format?"T":"",H=(R?"-":"")+"P"+M.format+O.format+N.format+V+I.format+L.format+z.format;return H==="P"||H==="-P"?"P0D":H},B.toJSON=function(){return this.toISOString()},B.format=function(M){var O=M||"YYYY-MM-DDTHH:mm:ss",C={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return O.replace(f,function(N,I){return I||String(C[N])})},B.as=function(M){return this.$ms/p[_(M)]},B.get=function(M){var O=this.$ms,C=_(M);return C==="milliseconds"?O%=1e3:O=C==="weeks"?m(O/p[C]):this.$d[C],O||0},B.add=function(M,O,C){var N;return N=O?M*p[_(O)]:v(M)?M.$ms:x(M,this).$ms,x(this.$ms+N*(C?-1:1),this)},B.subtract=function(M,O){return this.add(M,O,!0)},B.locale=function(M){var O=this.clone();return O.$l=M,O},B.clone=function(){return x(this.$ms,this)},B.humanize=function(M){return t().add(this.$ms,"ms").locale(this.$l).fromNow(!M)},B.valueOf=function(){return this.asMilliseconds()},B.milliseconds=function(){return this.get("milliseconds")},B.asMilliseconds=function(){return this.as("milliseconds")},B.seconds=function(){return this.get("seconds")},B.asSeconds=function(){return this.as("seconds")},B.minutes=function(){return this.get("minutes")},B.asMinutes=function(){return this.as("minutes")},B.hours=function(){return this.get("hours")},B.asHours=function(){return this.as("hours")},B.days=function(){return this.get("days")},B.asDays=function(){return this.as("days")},B.weeks=function(){return this.get("weeks")},B.asWeeks=function(){return this.as("weeks")},B.months=function(){return this.get("months")},B.asMonths=function(){return this.as("months")},B.years=function(){return this.get("years")},B.asYears=function(){return this.as("years")},F}(),E=function(F,B,M){return F.add(B.years()*M,"y").add(B.months()*M,"M").add(B.days()*M,"d").add(B.hours()*M,"h").add(B.minutes()*M,"m").add(B.seconds()*M,"s").add(B.milliseconds()*M,"ms")};return function(F,B,M){t=M,r=M().$utils(),M.duration=function(N,I){var L=M.locale();return x(N,{$l:L},I)},M.isDuration=v;var O=B.prototype.add,C=B.prototype.subtract;B.prototype.add=function(N,I){return v(N)?E(this,N,1):O.bind(this)(N,I)},B.prototype.subtract=function(N,I){return v(N)?E(this,N,-1):C.bind(this)(N,I)}}})})(Kf);var TD=Kf.exports,$D=tt(TD);ot.extend(Dl),ot.extend(SD),ot.extend(ID),ot.extend($D);class Zf{constructor(e,t,r){U(this,"array");U(this,"color");U(this,"math");U(this,"str");U(this,"map");U(this,"matrix");U(this,"timeframe");U(this,"ta");U(this,"input");U(this,"_variables");U(this,"_cacheData");U(this,"_options");U(this,"_errorListener");U(this,"_plots");U(this,"_plotshapes");U(this,"_plotbars");U(this,"_plotchars");U(this,"_plotarrows");U(this,"_plotcandles");U(this,"_alerts");U(this,"_bgColors");U(this,"_hlines");U(this,"_fills");U(this,"chart");U(this,"line");U(this,"label");U(this,"polyline");U(this,"box");U(this,"table");U(this,"linefill");U(this,"log");U(this,"runtime");U(this,"strategy");U(this,"request");U(this,"syminfo");U(this,"_count",0);var i;const n=((i=e.toString().split(".")[1])==null?void 0:i.length)||4;this._variables=t,this._errorListener=new hw,this.array=new D1(this._errorListener),this.math=new w1(n,this._errorListener),this.color=new Gx,this.str=new Xy(this._errorListener,n),this.map=new Qy(this._errorListener),this.timeframe=new Gy(t),this.matrix=new Vy(this._errorListener),this.ta=new Zx(t,this.math,this.timeframe),this._cacheData={},this._options={},this._bgColors={},this._alerts=new Map,this._hlines=new Map,this._fills=new Map,this.input=new Vx(t,this._errorListener,r),this._plots=new Map,this._plotshapes=new Map,this._plotbars=new Map,this._plotcandles=new Map,this._plotchars=new Map,this._plotarrows=new Map,this.chart={point:new Jy(t)},this.line=new wD(t,this._errorListener),this.label=new eD(t,this._errorListener),this.polyline=new DD(t,this._errorListener),this.box=new bD(t,this._errorListener),this.table=new AD(t,this._errorListener),this.linefill=new ED(t),this.log=new cw(t),this.runtime=new fw(this._errorListener),this.strategy=new MD(this._variables,this._options,e,this._errorListener),this.request=new uw(this._variables,r),this.syminfo=new lw}get errors(){return this._errorListener.errors}options(e){if(e.length)return this._getDataOfBarindex(e);const t=this.input.getInputs(),r=this._alerts.size?[...this._alerts.values()]:void 0;this._alerts.clear();const n=Object.keys(this._bgColors);let i;if(n.length){i={};for(const y of n)i[y]=[...this._bgColors[y].values()]}const a=this._hlines.size?[...this._hlines.values()]:void 0,u=this._fills.size?[...this._fills.values()]:void 0,f=this.log.logs.length?this.log.logs:void 0;this.log.clearLogs(),this._options.scriptType==="strategy"&&Object.assign(this._options,{orders:this.strategy.orders,historyOrders:this.strategy.historyOrders});const c=this._plots.size>0?[...this._plots.values()]:void 0,h=this._plotbars.size>0?[...this._plotbars.values()]:void 0,d=this._plotshapes.size>0?[...this._plotshapes.values()]:void 0,p=this._plotarrows.size>0?[...this._plotarrows.values()]:void 0,v=this._plotcandles.size>0?[...this._plotcandles.values()]:void 0,x=this._plotchars.size>0?[...this._plotchars.values()]:void 0,_=this._getDraws();return Object.assign(this._options,{inputs:t,plots:c,draws:_,alerts:r,colors:i,hlines:a,fills:u,logs:f,plotshapes:d,plotarrows:p,plotcandles:v,plotchars:x,plotbars:h})}_getDataOfBarindex(e){const t=this._alerts.size?[...this._alerts.values()]:void 0;this._alerts.clear();const r=Object.keys(this._bgColors);let n;if(r.length){n={};for(const d of r)n[d]=[...this._bgColors[d].values()].map(p=>{const v=[];for(const x of e){const _=p.colors[x];_&&v.push(_)}return p.colors=v,p})}const i=this._hlines.size?[...this._hlines.values()]:void 0,a=this._fills.size?this._getDataFromBarindex(e,[...this._fills.values()]):void 0,u=this.log.logs.length?this.log.logs:void 0;this.log.clearLogs(),this._options.scriptType==="strategy"&&Object.assign(this._options,{orders:this.strategy.orders,historyOrders:this.strategy.historyOrders});const f=this._getDataFromBarindex(e,[...this._plots.values()]),c=this._plotshapes.size>0?this._getDataFromBarindex(e,[...this._plotshapes.values()]):void 0,h=this._getDrawsFromBarindex(e);return Object.assign(this._options,{plots:f,draws:h,alerts:t,colors:n,hlines:i,fills:a,logs:u,plotshapes:c})}_getDataFromBarindex(e,t){return t.map(r=>{const n=[];for(const i of e){const a=r.data[i];a&&n.push(a)}return r.data=n,{...r}})}_getDraws(){const{line:e,linefill:t,table:r,box:n,polyline:i,label:a}=this._variables,u={};return e.data.length&&(u.lines=e.data),t.data.length&&(u.linefills=t.data),r.data.length&&(u.tables=r.data),n.data.length&&(u.boxes=n.data),i.data.length&&(u.polylines=i.data),a.data.length&&(u.labels=a.data),Object.keys(u).length?u:void 0}_getDrawsFromBarindex(e){const{line:t,linefill:r,table:n,box:i,polyline:a,label:u}=this._variables,f={};return t.data.length&&(f.lines=t.getValOfBarIndex(e)),r.data.length&&(f.linefills=r.getValOfBarIndex(e)),n.data.length&&(f.tables=n.getValOfBarIndex(e)),i.data.length&&(f.boxes=i.getValOfBarIndex(e)),a.data.length&&(f.polylines=a.getValOfBarIndex(e)),u.data.length&&(f.labels=u.getValOfBarIndex(e)),Object.keys(f).length?f:void 0}updateOptions(e){const{inputs:t}=e;t&&t.length&&this.input.update(t)}update(e){const{barIndex:t}=e;this.strategy.updateOptions(),this.math.update(t)}endExecution(){this.strategy.endExecution()}library(e,t){if(!this._variables.bar_index){const r=/^[^\W\d\s][^\W\s]*$/,{title:n}=e;r.test(n)?(y1.includes(n)||x1.includes(n))&&this._errorListener.addError(Zt(ct.libraryTitleIsKeywordErr,{name:n}),t,Ze.Error):this._errorListener.addError(ct.libraryTitleErr,t,Ze.Error),this._options.scriptType="library",this._options.library=e}}indicator(e,t){if(!this._variables.bar_index){const{format:r}=e;this._paramVerfiy(r,t,"indicator",[Je.inherit,Je.percent,Je.price,Je.volume]),this._variables.updateMaxLength(e),this._options.scriptType="indicator",this._options.indicator=e}}_paramVerfiy(e="",t,r,n,i="format"){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}plot(e,t){const r=["color"];_n(e,r);const{series:n,color:i,...a}=e,{bar_index:u,time:f}=this._variables,c=`plot_${t}`,h=this._plots.get(c),d=(h==null?void 0:h.data)||[],p=n!==void 0&&isNaN(n)?void 0:n;if(d[u]={value:[f,p],itemStyle:{color:i}},this._seriesColorHandle(e,r,h),!h){this._count++,this._paramVerfiy(e.format,t,"plot",[Je.percent,Je.price,Je.volume]);const v=i?[i]:void 0;this._plots.set(c,{editable:!0,...a,colors:v,data:d,id:c,zIndex:this._count})}return{type:"plot",key:c}}plotbar(e,t){const r=["color"];_n(e,r);const{open:n,close:i,low:a,high:u,color:f,...c}=e,{bar_index:h,time:d}=this._variables,p=`plotbar_${t}`,v=this._plotbars.get(p),x=(v==null?void 0:v.data)||[],_=i!==void 0&&isNaN(i)?void 0:i,y=n!==void 0&&isNaN(n)?void 0:n,m=a!==void 0&&isNaN(a)?void 0:a,w=u!==void 0&&isNaN(u)?void 0:u,D=[d,y,_,m,w];if(x[h]={value:D,itemStyle:{color:f}},this._seriesColorHandle(e,r,v),!v){this._count++,this._paramVerfiy(e.format,t,"plotbar",[Je.percent,Je.price,Je.volume]);const A=f?[f]:void 0;this._plotbars.set(p,{editable:!0,...c,colors:A,data:x,id:p,zIndex:this._count})}}_verfiyArgs(e,t,r){const{size:n,format:i,location:a,style:u}=e;this._paramVerfiy(u,r,t,Object.values(_r),"style"),this._paramVerfiy(a,r,t,Object.values(vn),"location"),this._paramVerfiy(n,r,t,Object.values(ar),"size"),this._paramVerfiy(i,r,t,[Je.percent,Je.price,Je.volume],"format")}plotchar(e,t){const r=["color","textcolor"];_n(e,r);const{series:n,color:i,textcolor:a,location:u=vn.abovebar,...f}=e,{bar_index:c,time:h,high:d,low:p}=this._variables,v=`plotchar_${t}`,x=this._plotchars.get(v),_=(x==null?void 0:x.data)||[],y={value:[h,n],itemStyle:{color:i,textcolor:a},low:p,high:d};_[c]=y,this._seriesColorHandle(e,r,x),x||(this._count++,this._verfiyArgs(e,"plotchar",t),this._plotchars.set(v,{editable:!0,...f,location:u,data:_,id:v,zIndex:this._count}))}plotarrow(e,t){const r=["colorup","colordown"];_n(e,r);const{series:n,colorup:i,colordown:a,...u}=e,{bar_index:f,time:c}=this._variables,h=`plotarrow_${t}`,d=this._plotarrows.get(h),p=(d==null?void 0:d.data)||[];p[f]={value:[c,n!==void 0&&isNaN(n)?void 0:n],itemStyle:{colorup:i,colordown:a}},this._seriesColorHandle(e,r,d),d||(this._count++,this._paramVerfiy(e.format,t,"plotarrow",[Je.percent,Je.price,Je.volume]),this._plotarrows.set(h,{editable:!0,...u,data:p,id:h,zIndex:this._count}))}plotshape(e,t){const r=["color","textcolor"];_n(e,r);const{series:n,color:i,textcolor:a,location:u=vn.abovebar,...f}=e,{bar_index:c,time:h,low:d,high:p}=this._variables,v=`plotshape_${t}`,x=this._plotshapes.get(v),_=(x==null?void 0:x.data)||[],y={value:n,color:i,textcolor:a,time:h,low:d,high:p};if(_[c]=y,this._seriesColorHandle(e,r,x),!x){this._count++;const m=i?[i]:void 0;this._verfiyArgs(e,"plotshape",t),this._plotshapes.set(v,{editable:!0,...f,data:_,location:u,id:v,colors:m,zIndex:this._count})}}plotcandle(e,t){const r=["wickcolor","bordercolor","color"];_n(e,r);const{wickcolor:n,bordercolor:i,color:a,close:u,open:f,low:c,high:h,...d}=e,{bar_index:p,time:v}=this._variables,x=`plotcandle_${t}`,_=this._plotcandles.get(x),y=(_==null?void 0:_.data)||[],m=u!==void 0&&isNaN(u)?void 0:u,w=f!==void 0&&isNaN(f)?void 0:f,D=c!==void 0&&isNaN(c)?void 0:c,A=h!==void 0&&isNaN(h)?void 0:h,E=[v,w,m,D,A];y[p]={value:E,wickcolor:n,bordercolor:i,color:a},this._seriesColorHandle(e,r,_),_||(this._count++,this._paramVerfiy(e.format,t,"plotcandle",[Je.percent,Je.price,Je.volume]),this._plotcandles.set(x,{editable:!0,...d,data:y,id:x,zIndex:this._count}))}hline(e,t){const r=`hline_${t}`;_n(e,["color"]),this._verifyDisplay(e.display,"hline",t);const i=e.display&&!e.display.length?Vt.none:Vt.all;return this._hlines.has(r)||(this._count++,this._hlines.set(r,{id:r,linewidth:1,editable:!0,display:i,...e,zIndex:this._count})),{type:"hline",key:r}}fill(e,t){var F,B,M,O,C,N,I,L,k,z;const r=["color","top_color","bottom_color"];_n(e,r);const{color:n,top_color:i,bottom_color:a,seriesColors:u,hline1:f,hline2:c,plot1:h,plot2:d,...p}=e,{bar_index:v,time:x}=this._variables,_=`fill_${t}`,y=this._fills.get(_),m=(y==null?void 0:y.data)||[];this._verifyDisplay(e.display,"fill",t);const w=e.display&&!e.display.length?Vt.none:Vt.all;let D,A,E="plot";if(f&&c)D=(F=this._hlines.get(f==null?void 0:f.key))==null?void 0:F.price,A=(B=this._hlines.get(c==null?void 0:c.key))==null?void 0:B.price,E="hline";else{const R=((M=this._plots.get(h==null?void 0:h.key))==null?void 0:M.data)||[],V=((O=this._plots.get(d==null?void 0:d.key))==null?void 0:O.data)||[];D=(N=(C=R[v])==null?void 0:C.value)==null?void 0:N[1],A=(L=(I=V[v])==null?void 0:I.value)==null?void 0:L[1]}if(m[v]={time:x,color:n,top_color:i,bottom_color:a,plot1:D,plot2:A},this._seriesColorHandle(e,r,y),!y){this._count++;const R=((k=this._options.indicator)==null?void 0:k.explicit_plot_zorder)||((z=this._options.strategy)==null?void 0:z.explicit_plot_zorder),V=n?[n]:void 0,H=i?[i]:void 0,ee=a?[a]:void 0;this._fills.set(_,{id:_,colors:V,top_colors:H,bottom_colors:ee,display:w,data:m,type:E,editable:!0,fillgaps:!1,hline1:f,hline2:c,plot1:h,plot2:d,...p,zIndex:R?this._count:void 0})}}alert({message:e,freq:t=Zr.freqOncePerBar},r){const{bar_index:n,_isRealTimeBar:i,last_bar_index:a}=this._variables,u=`alert_${r}`,f=this._cacheData[u]||{},c=f.barIndex;if(this._paramVerfiy(t,r,"alert",[Zr.freqAll,Zr.freqOncePerBar,Zr.freqOncePerBarClose]),t===Zr.freqOncePerBar&&n===c){this._alerts.delete(u);return}this._cacheData[u]=f;const h={message:e,freq:t,id:u,type:"alert"};if(i){t!==Zr.freqOncePerBarClose&&this._alerts.set(u,h),f.barIndex=n;return}if(!i&&t===Zr.freqOncePerBarClose&&n===c&&a===n-1){this._alerts.set(u,h),f.barIndex=n;return}this._alerts.delete(u)}alertcondition({condition:e,message:t,title:r},n){const{_isRealTimeBar:i}=this._variables,a=`alertcondition_${n}`;i&&e?this._alerts.set(a,{message:t,title:r,id:a,type:"alertcondition"}):this._alerts.delete(a)}barcolor(e,t){this._setColors(e,"barcolor",t)}bgcolor(e,t){this._setColors(e,"bgcolor",t)}_verifyDisplay(e=Uf.all,t,r){e.length&&e.length<4&&this._errorListener.addError(Zt(ct.displayErr,{func:t,values:"[display.none, display.all]"}),r,Ze.Error)}_setColors(e,t,r){_n(e,["color"]);const{color:i,...a}=e;this._verifyDisplay(a.display,t,r);const u=e.display&&!e.display.length?Vt.none:Vt.all,{bar_index:f,time:c}=this._variables,h=`${t}_${r}`;this._bgColors[t]||(this._bgColors[t]=new Map);const d=this._bgColors[t].get(h),p=(d==null?void 0:d.colors)||[],v=(d==null?void 0:d.setColors)||[];i&&!v.includes(i)&&v.push(i),p[f]={color:i,time:c},d||this._bgColors[t].set(h,{...a,display:u,colors:p,setColors:v,id:h})}max_bars_back({var:e,num:t,var_name:r}){console.log(e,t,r)}float({x:e}){return e}bool({x:e}){return e||!1}string({x:e}){return e}int({x:e}){return e&&Math.trunc(e)}na({x:e}){return!!(e===void 0||isNaN(e))}fixnan({source:e},t){return e===void 0||isNaN(e)?this._cacheData[`fixnan_${t}`]:(this._cacheData[`fixnan_${t}`]=e,e)}nz({source:e,replacement:t}){return e!==void 0&&!isNaN(e)?e:t||0}time({timeframe:e="",session:t,timezone:r,bars_back:n=0},i){return this._timeHandle(this._variables.time,i,e,t,r,n)}time_close({timeframe:e="",session:t,timezone:r,bars_back:n=0},i){return this._variables.time_close&&this._timeHandle(this._variables.time_close,i,e,t,r,n)}timestamp(e){const{dateString:t,timezone:r,year:n,month:i,day:a,hour:u=0,minute:f=0,second:c=0}=e;if(t)return ot(t).utc(!/GMT|UTC/.test(t)).valueOf();let h=i-1,d=n;if(h<0){const v=Math.ceil(Math.abs(h/12));h=12*v+h,d=n-v}let p=ot({year:d,month:h,day:a,hour:u,minute:f,second:c});return r&&(p=Kr(p.utc(!0).valueOf(),r)),p.utc(!0).valueOf()}weekofyear({time:e,timezone:t}){return Kr(e,t).week()}year({time:e,timezone:t}){return Kr(e,t).year()}second({time:e,timezone:t}){return Kr(e,t).second()}month({time:e,timezone:t}){return Kr(e,t).month()+1}minute({time:e,timezone:t}){return Kr(e,t).minute()}hour({time:e,timezone:t}){return Kr(e,t).hour()}dayofweek({time:e,timezone:t}){return Kr(e,t).day()+1}dayofmonth({time:e,timezone:t}){return Kr(e,t).date()}_calcTimeOffset(e,t){const r=this._variables.getTimeTradingday(e,t),n=pn(t)*1e3;return e-r-Math.floor((e-r)/n)*n}_timeHandle(e,t,r="",n,i,a=0){const u=r||this._variables.timeframe.period,f=pn(u),c=pn(this._variables.timeframe.period);let h;if(f<=c)h=e;else{const d=`time_${t}`,p=this._cacheData[d];if(p)p.currentTime+f*1e3-p.offset<=e?(h=e,this._cacheData[d]={currentTime:e,offset:0}):h=p;else{const v=this._calcTimeOffset(e,u);this._cacheData[d]={currentTime:e,offset:v},h=e}}if(n){const{timePeriods:d,weeks:p}=this._parserSession(n,t),v=ot(e).format("YYYY-MM-DD"),x=h;h=void 0;for(const y of d){const[m,w]=y;if(ot(e).isBetween(`${v} ${m}`,`${v} ${w}`,"hour")){ot(x).isBetween(`${v} ${m}`,`${v} ${w}`,"hour")?h=x:h=ot(`${v} ${m}`).valueOf();break}}const _=this._variables.dayofweek;h&&!p.includes(_)&&(h=void 0)}return i&&(h=h&&Kr(h,i).valueOf()),h&&h-a*c*1e3}_seriesColorHandle(e,t,r){var n;if(r&&t!=null&&t.length)for(const i of t){if((n=r.gradientColorKeys)!=null&&n.includes(i))continue;const a=e[i];if(!a)continue;const u=r[`${i}s`]||[];u.includes(a)||(u.push(a),r[`${i}s`]=u,u.length>5&&(r[`${i}s`]=[],r.gradientColorKeys=r.gradientColorKeys||[],r.gradientColorKeys.push(i)))}}_parserSession(e,t){const r=e.split(":"),n=r[0],a=(r[1]||"1234567").split("").map(f=>{const c=parseInt(f,10);if(c<1||c>7){this._errorListener.addError(`Invalid day of week: ${f}`,t,Ze.Error);return}return c});return{timePeriods:n.split(",").map(f=>{f===""||f===yi.regular?f="0930-1500":f===yi.extended&&(f="1500-1830");const c=f.split("-");return c.length!==2?(this._errorListener.addError(`Invalid time period: ${f}`,t,Ze.Error),[]):[this._processTime(c[0],t),this._processTime(c[1],t)]}),weeks:a}}_processTime(e,t){const r=parseInt(e.slice(0,2),10),n=parseInt(e.slice(2),10);if(!(r>=0&&r<=23)&&n>=0&&n<=59){this._errorListener.addError("Invalid time: Time must be within 00:00 to 23:59",t,Ze.Error);return}return`${r}:${n}`}}var Vf={exports:{}};function LD(s){throw new Error('Could not dynamically require "'+s+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ou={exports:{}},Gf;function Ve(){return Gf||(Gf=1,function(s,e){(function(t,r){s.exports=r()})(ye,function(){var t=t||function(r,n){var i;if(typeof window<"u"&&window.crypto&&(i=window.crypto),typeof self<"u"&&self.crypto&&(i=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window<"u"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof ye<"u"&&ye.crypto&&(i=ye.crypto),!i&&typeof LD=="function")try{i=Fx}catch{}var a=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},u=Object.create||function(){function w(){}return function(D){var A;return w.prototype=D,A=new w,w.prototype=null,A}}(),f={},c=f.lib={},h=c.Base=function(){return{extend:function(w){var D=u(this);return w&&D.mixIn(w),(!D.hasOwnProperty("init")||this.init===D.init)&&(D.init=function(){D.$super.init.apply(this,arguments)}),D.init.prototype=D,D.$super=this,D},create:function(){var w=this.extend();return w.init.apply(w,arguments),w},init:function(){},mixIn:function(w){for(var D in w)w.hasOwnProperty(D)&&(this[D]=w[D]);w.hasOwnProperty("toString")&&(this.toString=w.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),d=c.WordArray=h.extend({init:function(w,D){w=this.words=w||[],D!=n?this.sigBytes=D:this.sigBytes=w.length*4},toString:function(w){return(w||v).stringify(this)},concat:function(w){var D=this.words,A=w.words,E=this.sigBytes,F=w.sigBytes;if(this.clamp(),E%4)for(var B=0;B<F;B++){var M=A[B>>>2]>>>24-B%4*8&255;D[E+B>>>2]|=M<<24-(E+B)%4*8}else for(var O=0;O<F;O+=4)D[E+O>>>2]=A[O>>>2];return this.sigBytes+=F,this},clamp:function(){var w=this.words,D=this.sigBytes;w[D>>>2]&=4294967295<<32-D%4*8,w.length=r.ceil(D/4)},clone:function(){var w=h.clone.call(this);return w.words=this.words.slice(0),w},random:function(w){for(var D=[],A=0;A<w;A+=4)D.push(a());return new d.init(D,w)}}),p=f.enc={},v=p.Hex={stringify:function(w){for(var D=w.words,A=w.sigBytes,E=[],F=0;F<A;F++){var B=D[F>>>2]>>>24-F%4*8&255;E.push((B>>>4).toString(16)),E.push((B&15).toString(16))}return E.join("")},parse:function(w){for(var D=w.length,A=[],E=0;E<D;E+=2)A[E>>>3]|=parseInt(w.substr(E,2),16)<<24-E%8*4;return new d.init(A,D/2)}},x=p.Latin1={stringify:function(w){for(var D=w.words,A=w.sigBytes,E=[],F=0;F<A;F++){var B=D[F>>>2]>>>24-F%4*8&255;E.push(String.fromCharCode(B))}return E.join("")},parse:function(w){for(var D=w.length,A=[],E=0;E<D;E++)A[E>>>2]|=(w.charCodeAt(E)&255)<<24-E%4*8;return new d.init(A,D)}},_=p.Utf8={stringify:function(w){try{return decodeURIComponent(escape(x.stringify(w)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(w){return x.parse(unescape(encodeURIComponent(w)))}},y=c.BufferedBlockAlgorithm=h.extend({reset:function(){this._data=new d.init,this._nDataBytes=0},_append:function(w){typeof w=="string"&&(w=_.parse(w)),this._data.concat(w),this._nDataBytes+=w.sigBytes},_process:function(w){var D,A=this._data,E=A.words,F=A.sigBytes,B=this.blockSize,M=B*4,O=F/M;w?O=r.ceil(O):O=r.max((O|0)-this._minBufferSize,0);var C=O*B,N=r.min(C*4,F);if(C){for(var I=0;I<C;I+=B)this._doProcessBlock(E,I);D=E.splice(0,C),A.sigBytes-=N}return new d.init(D,N)},clone:function(){var w=h.clone.call(this);return w._data=this._data.clone(),w},_minBufferSize:0});c.Hasher=y.extend({cfg:h.extend(),init:function(w){this.cfg=this.cfg.extend(w),this.reset()},reset:function(){y.reset.call(this),this._doReset()},update:function(w){return this._append(w),this._process(),this},finalize:function(w){w&&this._append(w);var D=this._doFinalize();return D},blockSize:16,_createHelper:function(w){return function(D,A){return new w.init(A).finalize(D)}},_createHmacHelper:function(w){return function(D,A){return new m.HMAC.init(w,A).finalize(D)}}});var m=f.algo={};return f}(Math);return t})}(ou)),ou.exports}var au={exports:{}},Xf;function Mo(){return Xf||(Xf=1,function(s,e){(function(t,r){s.exports=r(Ve())})(ye,function(t){return function(r){var n=t,i=n.lib,a=i.Base,u=i.WordArray,f=n.x64={};f.Word=a.extend({init:function(c,h){this.high=c,this.low=h}}),f.WordArray=a.extend({init:function(c,h){c=this.words=c||[],h!=r?this.sigBytes=h:this.sigBytes=c.length*8},toX32:function(){for(var c=this.words,h=c.length,d=[],p=0;p<h;p++){var v=c[p];d.push(v.high),d.push(v.low)}return u.create(d,this.sigBytes)},clone:function(){for(var c=a.clone.call(this),h=c.words=this.words.slice(0),d=h.length,p=0;p<d;p++)h[p]=h[p].clone();return c}})}(),t})}(au)),au.exports}var uu={exports:{}},Qf;function RD(){return Qf||(Qf=1,function(s,e){(function(t,r){s.exports=r(Ve())})(ye,function(t){return function(){if(typeof ArrayBuffer=="function"){var r=t,n=r.lib,i=n.WordArray,a=i.init,u=i.init=function(f){if(f instanceof ArrayBuffer&&(f=new Uint8Array(f)),(f instanceof Int8Array||typeof Uint8ClampedArray<"u"&&f instanceof Uint8ClampedArray||f instanceof Int16Array||f instanceof Uint16Array||f instanceof Int32Array||f instanceof Uint32Array||f instanceof Float32Array||f instanceof Float64Array)&&(f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength)),f instanceof Uint8Array){for(var c=f.byteLength,h=[],d=0;d<c;d++)h[d>>>2]|=f[d]<<24-d%4*8;a.call(this,h,c)}else a.apply(this,arguments)};u.prototype=i}}(),t.lib.WordArray})}(uu)),uu.exports}var lu={exports:{}},Jf;function PD(){return Jf||(Jf=1,function(s,e){(function(t,r){s.exports=r(Ve())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.WordArray,a=r.enc;a.Utf16=a.Utf16BE={stringify:function(f){for(var c=f.words,h=f.sigBytes,d=[],p=0;p<h;p+=2){var v=c[p>>>2]>>>16-p%4*8&65535;d.push(String.fromCharCode(v))}return d.join("")},parse:function(f){for(var c=f.length,h=[],d=0;d<c;d++)h[d>>>1]|=f.charCodeAt(d)<<16-d%2*16;return i.create(h,c*2)}},a.Utf16LE={stringify:function(f){for(var c=f.words,h=f.sigBytes,d=[],p=0;p<h;p+=2){var v=u(c[p>>>2]>>>16-p%4*8&65535);d.push(String.fromCharCode(v))}return d.join("")},parse:function(f){for(var c=f.length,h=[],d=0;d<c;d++)h[d>>>1]|=u(f.charCodeAt(d)<<16-d%2*16);return i.create(h,c*2)}};function u(f){return f<<8&4278255360|f>>>8&16711935}}(),t.enc.Utf16})}(lu)),lu.exports}var cu={exports:{}},eh;function oi(){return eh||(eh=1,function(s,e){(function(t,r){s.exports=r(Ve())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.WordArray,a=r.enc;a.Base64={stringify:function(f){var c=f.words,h=f.sigBytes,d=this._map;f.clamp();for(var p=[],v=0;v<h;v+=3)for(var x=c[v>>>2]>>>24-v%4*8&255,_=c[v+1>>>2]>>>24-(v+1)%4*8&255,y=c[v+2>>>2]>>>24-(v+2)%4*8&255,m=x<<16|_<<8|y,w=0;w<4&&v+w*.75<h;w++)p.push(d.charAt(m>>>6*(3-w)&63));var D=d.charAt(64);if(D)for(;p.length%4;)p.push(D);return p.join("")},parse:function(f){var c=f.length,h=this._map,d=this._reverseMap;if(!d){d=this._reverseMap=[];for(var p=0;p<h.length;p++)d[h.charCodeAt(p)]=p}var v=h.charAt(64);if(v){var x=f.indexOf(v);x!==-1&&(c=x)}return u(f,c,d)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function u(f,c,h){for(var d=[],p=0,v=0;v<c;v++)if(v%4){var x=h[f.charCodeAt(v-1)]<<v%4*2,_=h[f.charCodeAt(v)]>>>6-v%4*2,y=x|_;d[p>>>2]|=y<<24-p%4*8,p++}return i.create(d,p)}}(),t.enc.Base64})}(cu)),cu.exports}var fu={exports:{}},th;function kD(){return th||(th=1,function(s,e){(function(t,r){s.exports=r(Ve())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.WordArray,a=r.enc;a.Base64url={stringify:function(f,c){c===void 0&&(c=!0);var h=f.words,d=f.sigBytes,p=c?this._safe_map:this._map;f.clamp();for(var v=[],x=0;x<d;x+=3)for(var _=h[x>>>2]>>>24-x%4*8&255,y=h[x+1>>>2]>>>24-(x+1)%4*8&255,m=h[x+2>>>2]>>>24-(x+2)%4*8&255,w=_<<16|y<<8|m,D=0;D<4&&x+D*.75<d;D++)v.push(p.charAt(w>>>6*(3-D)&63));var A=p.charAt(64);if(A)for(;v.length%4;)v.push(A);return v.join("")},parse:function(f,c){c===void 0&&(c=!0);var h=f.length,d=c?this._safe_map:this._map,p=this._reverseMap;if(!p){p=this._reverseMap=[];for(var v=0;v<d.length;v++)p[d.charCodeAt(v)]=v}var x=d.charAt(64);if(x){var _=f.indexOf(x);_!==-1&&(h=_)}return u(f,h,p)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function u(f,c,h){for(var d=[],p=0,v=0;v<c;v++)if(v%4){var x=h[f.charCodeAt(v-1)]<<v%4*2,_=h[f.charCodeAt(v)]>>>6-v%4*2,y=x|_;d[p>>>2]|=y<<24-p%4*8,p++}return i.create(d,p)}}(),t.enc.Base64url})}(fu)),fu.exports}var hu={exports:{}},rh;function ai(){return rh||(rh=1,function(s,e){(function(t,r){s.exports=r(Ve())})(ye,function(t){return function(r){var n=t,i=n.lib,a=i.WordArray,u=i.Hasher,f=n.algo,c=[];(function(){for(var _=0;_<64;_++)c[_]=r.abs(r.sin(_+1))*4294967296|0})();var h=f.MD5=u.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(_,y){for(var m=0;m<16;m++){var w=y+m,D=_[w];_[w]=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360}var A=this._hash.words,E=_[y+0],F=_[y+1],B=_[y+2],M=_[y+3],O=_[y+4],C=_[y+5],N=_[y+6],I=_[y+7],L=_[y+8],k=_[y+9],z=_[y+10],R=_[y+11],V=_[y+12],H=_[y+13],ee=_[y+14],te=_[y+15],j=A[0],X=A[1],Y=A[2],Q=A[3];j=d(j,X,Y,Q,E,7,c[0]),Q=d(Q,j,X,Y,F,12,c[1]),Y=d(Y,Q,j,X,B,17,c[2]),X=d(X,Y,Q,j,M,22,c[3]),j=d(j,X,Y,Q,O,7,c[4]),Q=d(Q,j,X,Y,C,12,c[5]),Y=d(Y,Q,j,X,N,17,c[6]),X=d(X,Y,Q,j,I,22,c[7]),j=d(j,X,Y,Q,L,7,c[8]),Q=d(Q,j,X,Y,k,12,c[9]),Y=d(Y,Q,j,X,z,17,c[10]),X=d(X,Y,Q,j,R,22,c[11]),j=d(j,X,Y,Q,V,7,c[12]),Q=d(Q,j,X,Y,H,12,c[13]),Y=d(Y,Q,j,X,ee,17,c[14]),X=d(X,Y,Q,j,te,22,c[15]),j=p(j,X,Y,Q,F,5,c[16]),Q=p(Q,j,X,Y,N,9,c[17]),Y=p(Y,Q,j,X,R,14,c[18]),X=p(X,Y,Q,j,E,20,c[19]),j=p(j,X,Y,Q,C,5,c[20]),Q=p(Q,j,X,Y,z,9,c[21]),Y=p(Y,Q,j,X,te,14,c[22]),X=p(X,Y,Q,j,O,20,c[23]),j=p(j,X,Y,Q,k,5,c[24]),Q=p(Q,j,X,Y,ee,9,c[25]),Y=p(Y,Q,j,X,M,14,c[26]),X=p(X,Y,Q,j,L,20,c[27]),j=p(j,X,Y,Q,H,5,c[28]),Q=p(Q,j,X,Y,B,9,c[29]),Y=p(Y,Q,j,X,I,14,c[30]),X=p(X,Y,Q,j,V,20,c[31]),j=v(j,X,Y,Q,C,4,c[32]),Q=v(Q,j,X,Y,L,11,c[33]),Y=v(Y,Q,j,X,R,16,c[34]),X=v(X,Y,Q,j,ee,23,c[35]),j=v(j,X,Y,Q,F,4,c[36]),Q=v(Q,j,X,Y,O,11,c[37]),Y=v(Y,Q,j,X,I,16,c[38]),X=v(X,Y,Q,j,z,23,c[39]),j=v(j,X,Y,Q,H,4,c[40]),Q=v(Q,j,X,Y,E,11,c[41]),Y=v(Y,Q,j,X,M,16,c[42]),X=v(X,Y,Q,j,N,23,c[43]),j=v(j,X,Y,Q,k,4,c[44]),Q=v(Q,j,X,Y,V,11,c[45]),Y=v(Y,Q,j,X,te,16,c[46]),X=v(X,Y,Q,j,B,23,c[47]),j=x(j,X,Y,Q,E,6,c[48]),Q=x(Q,j,X,Y,I,10,c[49]),Y=x(Y,Q,j,X,ee,15,c[50]),X=x(X,Y,Q,j,C,21,c[51]),j=x(j,X,Y,Q,V,6,c[52]),Q=x(Q,j,X,Y,M,10,c[53]),Y=x(Y,Q,j,X,z,15,c[54]),X=x(X,Y,Q,j,F,21,c[55]),j=x(j,X,Y,Q,L,6,c[56]),Q=x(Q,j,X,Y,te,10,c[57]),Y=x(Y,Q,j,X,N,15,c[58]),X=x(X,Y,Q,j,H,21,c[59]),j=x(j,X,Y,Q,O,6,c[60]),Q=x(Q,j,X,Y,R,10,c[61]),Y=x(Y,Q,j,X,B,15,c[62]),X=x(X,Y,Q,j,k,21,c[63]),A[0]=A[0]+j|0,A[1]=A[1]+X|0,A[2]=A[2]+Y|0,A[3]=A[3]+Q|0},_doFinalize:function(){var _=this._data,y=_.words,m=this._nDataBytes*8,w=_.sigBytes*8;y[w>>>5]|=128<<24-w%32;var D=r.floor(m/4294967296),A=m;y[(w+64>>>9<<4)+15]=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,y[(w+64>>>9<<4)+14]=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360,_.sigBytes=(y.length+1)*4,this._process();for(var E=this._hash,F=E.words,B=0;B<4;B++){var M=F[B];F[B]=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360}return E},clone:function(){var _=u.clone.call(this);return _._hash=this._hash.clone(),_}});function d(_,y,m,w,D,A,E){var F=_+(y&m|~y&w)+D+E;return(F<<A|F>>>32-A)+y}function p(_,y,m,w,D,A,E){var F=_+(y&w|m&~w)+D+E;return(F<<A|F>>>32-A)+y}function v(_,y,m,w,D,A,E){var F=_+(y^m^w)+D+E;return(F<<A|F>>>32-A)+y}function x(_,y,m,w,D,A,E){var F=_+(m^(y|~w))+D+E;return(F<<A|F>>>32-A)+y}n.MD5=u._createHelper(h),n.HmacMD5=u._createHmacHelper(h)}(Math),t.MD5})}(hu)),hu.exports}var du={exports:{}},nh;function ih(){return nh||(nh=1,function(s,e){(function(t,r){s.exports=r(Ve())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.WordArray,a=n.Hasher,u=r.algo,f=[],c=u.SHA1=a.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(h,d){for(var p=this._hash.words,v=p[0],x=p[1],_=p[2],y=p[3],m=p[4],w=0;w<80;w++){if(w<16)f[w]=h[d+w]|0;else{var D=f[w-3]^f[w-8]^f[w-14]^f[w-16];f[w]=D<<1|D>>>31}var A=(v<<5|v>>>27)+m+f[w];w<20?A+=(x&_|~x&y)+1518500249:w<40?A+=(x^_^y)+1859775393:w<60?A+=(x&_|x&y|_&y)-1894007588:A+=(x^_^y)-899497514,m=y,y=_,_=x<<30|x>>>2,x=v,v=A}p[0]=p[0]+v|0,p[1]=p[1]+x|0,p[2]=p[2]+_|0,p[3]=p[3]+y|0,p[4]=p[4]+m|0},_doFinalize:function(){var h=this._data,d=h.words,p=this._nDataBytes*8,v=h.sigBytes*8;return d[v>>>5]|=128<<24-v%32,d[(v+64>>>9<<4)+14]=Math.floor(p/4294967296),d[(v+64>>>9<<4)+15]=p,h.sigBytes=d.length*4,this._process(),this._hash},clone:function(){var h=a.clone.call(this);return h._hash=this._hash.clone(),h}});r.SHA1=a._createHelper(c),r.HmacSHA1=a._createHmacHelper(c)}(),t.SHA1})}(du)),du.exports}var pu={exports:{}},sh;function _u(){return sh||(sh=1,function(s,e){(function(t,r){s.exports=r(Ve())})(ye,function(t){return function(r){var n=t,i=n.lib,a=i.WordArray,u=i.Hasher,f=n.algo,c=[],h=[];(function(){function v(m){for(var w=r.sqrt(m),D=2;D<=w;D++)if(!(m%D))return!1;return!0}function x(m){return(m-(m|0))*4294967296|0}for(var _=2,y=0;y<64;)v(_)&&(y<8&&(c[y]=x(r.pow(_,1/2))),h[y]=x(r.pow(_,1/3)),y++),_++})();var d=[],p=f.SHA256=u.extend({_doReset:function(){this._hash=new a.init(c.slice(0))},_doProcessBlock:function(v,x){for(var _=this._hash.words,y=_[0],m=_[1],w=_[2],D=_[3],A=_[4],E=_[5],F=_[6],B=_[7],M=0;M<64;M++){if(M<16)d[M]=v[x+M]|0;else{var O=d[M-15],C=(O<<25|O>>>7)^(O<<14|O>>>18)^O>>>3,N=d[M-2],I=(N<<15|N>>>17)^(N<<13|N>>>19)^N>>>10;d[M]=C+d[M-7]+I+d[M-16]}var L=A&E^~A&F,k=y&m^y&w^m&w,z=(y<<30|y>>>2)^(y<<19|y>>>13)^(y<<10|y>>>22),R=(A<<26|A>>>6)^(A<<21|A>>>11)^(A<<7|A>>>25),V=B+R+L+h[M]+d[M],H=z+k;B=F,F=E,E=A,A=D+V|0,D=w,w=m,m=y,y=V+H|0}_[0]=_[0]+y|0,_[1]=_[1]+m|0,_[2]=_[2]+w|0,_[3]=_[3]+D|0,_[4]=_[4]+A|0,_[5]=_[5]+E|0,_[6]=_[6]+F|0,_[7]=_[7]+B|0},_doFinalize:function(){var v=this._data,x=v.words,_=this._nDataBytes*8,y=v.sigBytes*8;return x[y>>>5]|=128<<24-y%32,x[(y+64>>>9<<4)+14]=r.floor(_/4294967296),x[(y+64>>>9<<4)+15]=_,v.sigBytes=x.length*4,this._process(),this._hash},clone:function(){var v=u.clone.call(this);return v._hash=this._hash.clone(),v}});n.SHA256=u._createHelper(p),n.HmacSHA256=u._createHmacHelper(p)}(Math),t.SHA256})}(pu)),pu.exports}var vu={exports:{}},oh;function zD(){return oh||(oh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),_u())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.WordArray,a=r.algo,u=a.SHA256,f=a.SHA224=u.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var c=u._doFinalize.call(this);return c.sigBytes-=4,c}});r.SHA224=u._createHelper(f),r.HmacSHA224=u._createHmacHelper(f)}(),t.SHA224})}(vu)),vu.exports}var gu={exports:{}},ah;function uh(){return ah||(ah=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Mo())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.Hasher,a=r.x64,u=a.Word,f=a.WordArray,c=r.algo;function h(){return u.create.apply(u,arguments)}var d=[h(1116352408,3609767458),h(1899447441,602891725),h(3049323471,3964484399),h(3921009573,2173295548),h(961987163,4081628472),h(1508970993,3053834265),h(2453635748,2937671579),h(2870763221,3664609560),h(3624381080,2734883394),h(310598401,1164996542),h(607225278,1323610764),h(1426881987,3590304994),h(1925078388,4068182383),h(2162078206,991336113),h(2614888103,633803317),h(3248222580,3479774868),h(3835390401,2666613458),h(4022224774,944711139),h(264347078,2341262773),h(604807628,2007800933),h(770255983,1495990901),h(1249150122,1856431235),h(1555081692,3175218132),h(1996064986,2198950837),h(2554220882,3999719339),h(2821834349,766784016),h(2952996808,2566594879),h(3210313671,3203337956),h(3336571891,1034457026),h(3584528711,2466948901),h(113926993,3758326383),h(338241895,168717936),h(666307205,1188179964),h(773529912,1546045734),h(1294757372,1522805485),h(1396182291,2643833823),h(1695183700,2343527390),h(1986661051,1014477480),h(2177026350,1206759142),h(2456956037,344077627),h(2730485921,1290863460),h(2820302411,3158454273),h(3259730800,3505952657),h(3345764771,106217008),h(3516065817,3606008344),h(3600352804,1432725776),h(4094571909,1467031594),h(275423344,851169720),h(430227734,3100823752),h(506948616,1363258195),h(659060556,3750685593),h(883997877,3785050280),h(958139571,3318307427),h(1322822218,3812723403),h(1537002063,2003034995),h(1747873779,3602036899),h(1955562222,1575990012),h(2024104815,1125592928),h(2227730452,2716904306),h(2361852424,442776044),h(2428436474,593698344),h(2756734187,3733110249),h(3204031479,2999351573),h(3329325298,3815920427),h(3391569614,3928383900),h(3515267271,566280711),h(3940187606,3454069534),h(4118630271,4000239992),h(116418474,1914138554),h(174292421,2731055270),h(289380356,3203993006),h(460393269,320620315),h(685471733,587496836),h(852142971,1086792851),h(1017036298,365543100),h(1126000580,2618297676),h(1288033470,3409855158),h(1501505948,4234509866),h(1607167915,987167468),h(1816402316,1246189591)],p=[];(function(){for(var x=0;x<80;x++)p[x]=h()})();var v=c.SHA512=i.extend({_doReset:function(){this._hash=new f.init([new u.init(1779033703,4089235720),new u.init(3144134277,2227873595),new u.init(1013904242,4271175723),new u.init(2773480762,1595750129),new u.init(1359893119,2917565137),new u.init(2600822924,725511199),new u.init(528734635,4215389547),new u.init(1541459225,327033209)])},_doProcessBlock:function(x,_){for(var y=this._hash.words,m=y[0],w=y[1],D=y[2],A=y[3],E=y[4],F=y[5],B=y[6],M=y[7],O=m.high,C=m.low,N=w.high,I=w.low,L=D.high,k=D.low,z=A.high,R=A.low,V=E.high,H=E.low,ee=F.high,te=F.low,j=B.high,X=B.low,Y=M.high,Q=M.low,pe=O,De=C,we=N,Ee=I,Oe=L,Fe=k,nt=z,Ye=R,Ie=V,Le=H,yt=ee,Wt=te,At=j,lr=X,Rr=Y,cr=Q,Dt=0;Dt<80;Dt++){var It,P,Z=p[Dt];if(Dt<16)P=Z.high=x[_+Dt*2]|0,It=Z.low=x[_+Dt*2+1]|0;else{var J=p[Dt-15],ie=J.high,ue=J.low,se=(ie>>>1|ue<<31)^(ie>>>8|ue<<24)^ie>>>7,_e=(ue>>>1|ie<<31)^(ue>>>8|ie<<24)^(ue>>>7|ie<<25),he=p[Dt-2],de=he.high,fe=he.low,Xe=(de>>>19|fe<<13)^(de<<3|fe>>>29)^de>>>6,et=(fe>>>19|de<<13)^(fe<<3|de>>>29)^(fe>>>6|de<<26),dt=p[Dt-7],zt=dt.high,Tt=dt.low,nr=p[Dt-16],fr=nr.high,en=nr.low;It=_e+Tt,P=se+zt+(It>>>0<_e>>>0?1:0),It=It+et,P=P+Xe+(It>>>0<et>>>0?1:0),It=It+en,P=P+fr+(It>>>0<en>>>0?1:0),Z.high=P,Z.low=It}var wn=Ie&yt^~Ie&At,li=Le&Wt^~Le&lr,ms=pe&we^pe&Oe^we&Oe,xs=De&Ee^De&Fe^Ee&Fe,ys=(pe>>>28|De<<4)^(pe<<30|De>>>2)^(pe<<25|De>>>7),ki=(De>>>28|pe<<4)^(De<<30|pe>>>2)^(De<<25|pe>>>7),zi=(Ie>>>14|Le<<18)^(Ie>>>18|Le<<14)^(Ie<<23|Le>>>9),Ds=(Le>>>14|Ie<<18)^(Le>>>18|Ie<<14)^(Le<<23|Ie>>>9),qi=d[Dt],ws=qi.high,qn=qi.low,Qt=cr+Ds,mr=Rr+zi+(Qt>>>0<cr>>>0?1:0),Qt=Qt+li,mr=mr+wn+(Qt>>>0<li>>>0?1:0),Qt=Qt+qn,mr=mr+ws+(Qt>>>0<qn>>>0?1:0),Qt=Qt+It,mr=mr+P+(Qt>>>0<It>>>0?1:0),Ui=ki+xs,Es=ys+ms+(Ui>>>0<ki>>>0?1:0);Rr=At,cr=lr,At=yt,lr=Wt,yt=Ie,Wt=Le,Le=Ye+Qt|0,Ie=nt+mr+(Le>>>0<Ye>>>0?1:0)|0,nt=Oe,Ye=Fe,Oe=we,Fe=Ee,we=pe,Ee=De,De=Qt+Ui|0,pe=mr+Es+(De>>>0<Qt>>>0?1:0)|0}C=m.low=C+De,m.high=O+pe+(C>>>0<De>>>0?1:0),I=w.low=I+Ee,w.high=N+we+(I>>>0<Ee>>>0?1:0),k=D.low=k+Fe,D.high=L+Oe+(k>>>0<Fe>>>0?1:0),R=A.low=R+Ye,A.high=z+nt+(R>>>0<Ye>>>0?1:0),H=E.low=H+Le,E.high=V+Ie+(H>>>0<Le>>>0?1:0),te=F.low=te+Wt,F.high=ee+yt+(te>>>0<Wt>>>0?1:0),X=B.low=X+lr,B.high=j+At+(X>>>0<lr>>>0?1:0),Q=M.low=Q+cr,M.high=Y+Rr+(Q>>>0<cr>>>0?1:0)},_doFinalize:function(){var x=this._data,_=x.words,y=this._nDataBytes*8,m=x.sigBytes*8;_[m>>>5]|=128<<24-m%32,_[(m+128>>>10<<5)+30]=Math.floor(y/4294967296),_[(m+128>>>10<<5)+31]=y,x.sigBytes=_.length*4,this._process();var w=this._hash.toX32();return w},clone:function(){var x=i.clone.call(this);return x._hash=this._hash.clone(),x},blockSize:1024/32});r.SHA512=i._createHelper(v),r.HmacSHA512=i._createHmacHelper(v)}(),t.SHA512})}(gu)),gu.exports}var mu={exports:{}},lh;function qD(){return lh||(lh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Mo(),uh())})(ye,function(t){return function(){var r=t,n=r.x64,i=n.Word,a=n.WordArray,u=r.algo,f=u.SHA512,c=u.SHA384=f.extend({_doReset:function(){this._hash=new a.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var h=f._doFinalize.call(this);return h.sigBytes-=16,h}});r.SHA384=f._createHelper(c),r.HmacSHA384=f._createHmacHelper(c)}(),t.SHA384})}(mu)),mu.exports}var xu={exports:{}},ch;function UD(){return ch||(ch=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Mo())})(ye,function(t){return function(r){var n=t,i=n.lib,a=i.WordArray,u=i.Hasher,f=n.x64,c=f.Word,h=n.algo,d=[],p=[],v=[];(function(){for(var y=1,m=0,w=0;w<24;w++){d[y+5*m]=(w+1)*(w+2)/2%64;var D=m%5,A=(2*y+3*m)%5;y=D,m=A}for(var y=0;y<5;y++)for(var m=0;m<5;m++)p[y+5*m]=m+(2*y+3*m)%5*5;for(var E=1,F=0;F<24;F++){for(var B=0,M=0,O=0;O<7;O++){if(E&1){var C=(1<<O)-1;C<32?M^=1<<C:B^=1<<C-32}E&128?E=E<<1^113:E<<=1}v[F]=c.create(B,M)}})();var x=[];(function(){for(var y=0;y<25;y++)x[y]=c.create()})();var _=h.SHA3=u.extend({cfg:u.cfg.extend({outputLength:512}),_doReset:function(){for(var y=this._state=[],m=0;m<25;m++)y[m]=new c.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(y,m){for(var w=this._state,D=this.blockSize/2,A=0;A<D;A++){var E=y[m+2*A],F=y[m+2*A+1];E=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,F=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360;var B=w[A];B.high^=F,B.low^=E}for(var M=0;M<24;M++){for(var O=0;O<5;O++){for(var C=0,N=0,I=0;I<5;I++){var B=w[O+5*I];C^=B.high,N^=B.low}var L=x[O];L.high=C,L.low=N}for(var O=0;O<5;O++)for(var k=x[(O+4)%5],z=x[(O+1)%5],R=z.high,V=z.low,C=k.high^(R<<1|V>>>31),N=k.low^(V<<1|R>>>31),I=0;I<5;I++){var B=w[O+5*I];B.high^=C,B.low^=N}for(var H=1;H<25;H++){var C,N,B=w[H],ee=B.high,te=B.low,j=d[H];j<32?(C=ee<<j|te>>>32-j,N=te<<j|ee>>>32-j):(C=te<<j-32|ee>>>64-j,N=ee<<j-32|te>>>64-j);var X=x[p[H]];X.high=C,X.low=N}var Y=x[0],Q=w[0];Y.high=Q.high,Y.low=Q.low;for(var O=0;O<5;O++)for(var I=0;I<5;I++){var H=O+5*I,B=w[H],pe=x[H],De=x[(O+1)%5+5*I],we=x[(O+2)%5+5*I];B.high=pe.high^~De.high&we.high,B.low=pe.low^~De.low&we.low}var B=w[0],Ee=v[M];B.high^=Ee.high,B.low^=Ee.low}},_doFinalize:function(){var y=this._data,m=y.words;this._nDataBytes*8;var w=y.sigBytes*8,D=this.blockSize*32;m[w>>>5]|=1<<24-w%32,m[(r.ceil((w+1)/D)*D>>>5)-1]|=128,y.sigBytes=m.length*4,this._process();for(var A=this._state,E=this.cfg.outputLength/8,F=E/8,B=[],M=0;M<F;M++){var O=A[M],C=O.high,N=O.low;C=(C<<8|C>>>24)&16711935|(C<<24|C>>>8)&4278255360,N=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360,B.push(N),B.push(C)}return new a.init(B,E)},clone:function(){for(var y=u.clone.call(this),m=y._state=this._state.slice(0),w=0;w<25;w++)m[w]=m[w].clone();return y}});n.SHA3=u._createHelper(_),n.HmacSHA3=u._createHmacHelper(_)}(Math),t.SHA3})}(xu)),xu.exports}var yu={exports:{}},fh;function WD(){return fh||(fh=1,function(s,e){(function(t,r){s.exports=r(Ve())})(ye,function(t){/** @preserve
61
+ ${Bf}`)}function ay(s,e,t){return(s>=0&&t?` ${Nf(s,e-1)}`:Nf(s,e)).padEnd(e)}function Nf(s,e){let t=s.toString();if(t.length<=e)return t;let r=s.toFixed(e);if(r.length>e&&(r=s.toFixed(Math.max(0,e-(r.length-e)))),r.length<=e&&!r.startsWith("0.000")&&!r.startsWith("-0.000"))return r;let n=s.toExponential(e);return n.length>e&&(n=s.toExponential(Math.max(0,e-(n.length-e)))),n.slice(0)}function uy(s,e){s.prototype.add=function(r){return typeof r=="number"?this.addS(r):this.addM(r)},s.prototype.addS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)+r);return this},s.prototype.addM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)+r.get(n,i));return this},s.add=function(r,n){return new e(r).add(n)},s.prototype.sub=function(r){return typeof r=="number"?this.subS(r):this.subM(r)},s.prototype.subS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)-r);return this},s.prototype.subM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)-r.get(n,i));return this},s.sub=function(r,n){return new e(r).sub(n)},s.prototype.subtract=s.prototype.sub,s.prototype.subtractS=s.prototype.subS,s.prototype.subtractM=s.prototype.subM,s.subtract=s.sub,s.prototype.mul=function(r){return typeof r=="number"?this.mulS(r):this.mulM(r)},s.prototype.mulS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)*r);return this},s.prototype.mulM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)*r.get(n,i));return this},s.mul=function(r,n){return new e(r).mul(n)},s.prototype.multiply=s.prototype.mul,s.prototype.multiplyS=s.prototype.mulS,s.prototype.multiplyM=s.prototype.mulM,s.multiply=s.mul,s.prototype.div=function(r){return typeof r=="number"?this.divS(r):this.divM(r)},s.prototype.divS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)/r);return this},s.prototype.divM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)/r.get(n,i));return this},s.div=function(r,n){return new e(r).div(n)},s.prototype.divide=s.prototype.div,s.prototype.divideS=s.prototype.divS,s.prototype.divideM=s.prototype.divM,s.divide=s.div,s.prototype.mod=function(r){return typeof r=="number"?this.modS(r):this.modM(r)},s.prototype.modS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)%r);return this},s.prototype.modM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)%r.get(n,i));return this},s.mod=function(r,n){return new e(r).mod(n)},s.prototype.modulus=s.prototype.mod,s.prototype.modulusS=s.prototype.modS,s.prototype.modulusM=s.prototype.modM,s.modulus=s.mod,s.prototype.and=function(r){return typeof r=="number"?this.andS(r):this.andM(r)},s.prototype.andS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)&r);return this},s.prototype.andM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)&r.get(n,i));return this},s.and=function(r,n){return new e(r).and(n)},s.prototype.or=function(r){return typeof r=="number"?this.orS(r):this.orM(r)},s.prototype.orS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)|r);return this},s.prototype.orM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)|r.get(n,i));return this},s.or=function(r,n){return new e(r).or(n)},s.prototype.xor=function(r){return typeof r=="number"?this.xorS(r):this.xorM(r)},s.prototype.xorS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)^r);return this},s.prototype.xorM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)^r.get(n,i));return this},s.xor=function(r,n){return new e(r).xor(n)},s.prototype.leftShift=function(r){return typeof r=="number"?this.leftShiftS(r):this.leftShiftM(r)},s.prototype.leftShiftS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)<<r);return this},s.prototype.leftShiftM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)<<r.get(n,i));return this},s.leftShift=function(r,n){return new e(r).leftShift(n)},s.prototype.signPropagatingRightShift=function(r){return typeof r=="number"?this.signPropagatingRightShiftS(r):this.signPropagatingRightShiftM(r)},s.prototype.signPropagatingRightShiftS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)>>r);return this},s.prototype.signPropagatingRightShiftM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)>>r.get(n,i));return this},s.signPropagatingRightShift=function(r,n){return new e(r).signPropagatingRightShift(n)},s.prototype.rightShift=function(r){return typeof r=="number"?this.rightShiftS(r):this.rightShiftM(r)},s.prototype.rightShiftS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)>>>r);return this},s.prototype.rightShiftM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)>>>r.get(n,i));return this},s.rightShift=function(r,n){return new e(r).rightShift(n)},s.prototype.zeroFillRightShift=s.prototype.rightShift,s.prototype.zeroFillRightShiftS=s.prototype.rightShiftS,s.prototype.zeroFillRightShiftM=s.prototype.rightShiftM,s.zeroFillRightShift=s.rightShift,s.prototype.not=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,~this.get(r,n));return this},s.not=function(r){return new e(r).not()},s.prototype.abs=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.abs(this.get(r,n)));return this},s.abs=function(r){return new e(r).abs()},s.prototype.acos=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.acos(this.get(r,n)));return this},s.acos=function(r){return new e(r).acos()},s.prototype.acosh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.acosh(this.get(r,n)));return this},s.acosh=function(r){return new e(r).acosh()},s.prototype.asin=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.asin(this.get(r,n)));return this},s.asin=function(r){return new e(r).asin()},s.prototype.asinh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.asinh(this.get(r,n)));return this},s.asinh=function(r){return new e(r).asinh()},s.prototype.atan=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.atan(this.get(r,n)));return this},s.atan=function(r){return new e(r).atan()},s.prototype.atanh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.atanh(this.get(r,n)));return this},s.atanh=function(r){return new e(r).atanh()},s.prototype.cbrt=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.cbrt(this.get(r,n)));return this},s.cbrt=function(r){return new e(r).cbrt()},s.prototype.ceil=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.ceil(this.get(r,n)));return this},s.ceil=function(r){return new e(r).ceil()},s.prototype.clz32=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.clz32(this.get(r,n)));return this},s.clz32=function(r){return new e(r).clz32()},s.prototype.cos=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.cos(this.get(r,n)));return this},s.cos=function(r){return new e(r).cos()},s.prototype.cosh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.cosh(this.get(r,n)));return this},s.cosh=function(r){return new e(r).cosh()},s.prototype.exp=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.exp(this.get(r,n)));return this},s.exp=function(r){return new e(r).exp()},s.prototype.expm1=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.expm1(this.get(r,n)));return this},s.expm1=function(r){return new e(r).expm1()},s.prototype.floor=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.floor(this.get(r,n)));return this},s.floor=function(r){return new e(r).floor()},s.prototype.fround=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.fround(this.get(r,n)));return this},s.fround=function(r){return new e(r).fround()},s.prototype.log=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.log(this.get(r,n)));return this},s.log=function(r){return new e(r).log()},s.prototype.log1p=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.log1p(this.get(r,n)));return this},s.log1p=function(r){return new e(r).log1p()},s.prototype.log10=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.log10(this.get(r,n)));return this},s.log10=function(r){return new e(r).log10()},s.prototype.log2=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.log2(this.get(r,n)));return this},s.log2=function(r){return new e(r).log2()},s.prototype.round=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.round(this.get(r,n)));return this},s.round=function(r){return new e(r).round()},s.prototype.sign=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.sign(this.get(r,n)));return this},s.sign=function(r){return new e(r).sign()},s.prototype.sin=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.sin(this.get(r,n)));return this},s.sin=function(r){return new e(r).sin()},s.prototype.sinh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.sinh(this.get(r,n)));return this},s.sinh=function(r){return new e(r).sinh()},s.prototype.sqrt=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.sqrt(this.get(r,n)));return this},s.sqrt=function(r){return new e(r).sqrt()},s.prototype.tan=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.tan(this.get(r,n)));return this},s.tan=function(r){return new e(r).tan()},s.prototype.tanh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.tanh(this.get(r,n)));return this},s.tanh=function(r){return new e(r).tanh()},s.prototype.trunc=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.trunc(this.get(r,n)));return this},s.trunc=function(r){return new e(r).trunc()},s.pow=function(r,n){return new e(r).pow(n)},s.prototype.pow=function(r){return typeof r=="number"?this.powS(r):this.powM(r)},s.prototype.powS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.pow(this.get(n,i),r));return this},s.prototype.powM=function(r){if(r=e.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.pow(this.get(n,i),r.get(n,i)));return this}}function $r(s,e,t){let r=t?s.rows:s.rows-1;if(e<0||e>r)throw new RangeError("Row index out of range")}function Lr(s,e,t){let r=t?s.columns:s.columns-1;if(e<0||e>r)throw new RangeError("Column index out of range")}function Ni(s,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==s.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function Si(s,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==s.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function Ja(s,e){if(!gr.isAnyArray(e))throw new TypeError("row indices must be an array");for(let t=0;t<e.length;t++)if(e[t]<0||e[t]>=s.rows)throw new RangeError("row indices are out of range")}function eu(s,e){if(!gr.isAnyArray(e))throw new TypeError("column indices must be an array");for(let t=0;t<e.length;t++)if(e[t]<0||e[t]>=s.columns)throw new RangeError("column indices are out of range")}function tu(s,e,t,r,n){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(wo("startRow",e),wo("endRow",t),wo("startColumn",r),wo("endColumn",n),e>t||r>n||e<0||e>=s.rows||t<0||t>=s.rows||r<0||r>=s.columns||n<0||n>=s.columns)throw new RangeError("Submatrix indices are out of range")}function Do(s,e=0){let t=[];for(let r=0;r<s;r++)t.push(e);return t}function wo(s,e){if(typeof e!="number")throw new TypeError(`${s} must be a number`)}function Oi(s){if(s.isEmpty())throw new Error("Empty matrix has no elements to index")}function ly(s){let e=Do(s.rows);for(let t=0;t<s.rows;++t)for(let r=0;r<s.columns;++r)e[t]+=s.get(t,r);return e}function cy(s){let e=Do(s.columns);for(let t=0;t<s.rows;++t)for(let r=0;r<s.columns;++r)e[r]+=s.get(t,r);return e}function fy(s){let e=0;for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)e+=s.get(t,r);return e}function hy(s){let e=Do(s.rows,1);for(let t=0;t<s.rows;++t)for(let r=0;r<s.columns;++r)e[t]*=s.get(t,r);return e}function dy(s){let e=Do(s.columns,1);for(let t=0;t<s.rows;++t)for(let r=0;r<s.columns;++r)e[r]*=s.get(t,r);return e}function py(s){let e=1;for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)e*=s.get(t,r);return e}function _y(s,e,t){const r=s.rows,n=s.columns,i=[];for(let a=0;a<r;a++){let u=0,f=0,c=0;for(let h=0;h<n;h++)c=s.get(a,h)-t[a],u+=c,f+=c*c;e?i.push((f-u*u/n)/(n-1)):i.push((f-u*u/n)/n)}return i}function vy(s,e,t){const r=s.rows,n=s.columns,i=[];for(let a=0;a<n;a++){let u=0,f=0,c=0;for(let h=0;h<r;h++)c=s.get(h,a)-t[a],u+=c,f+=c*c;e?i.push((f-u*u/r)/(r-1)):i.push((f-u*u/r)/r)}return i}function gy(s,e,t){const r=s.rows,n=s.columns,i=r*n;let a=0,u=0,f=0;for(let c=0;c<r;c++)for(let h=0;h<n;h++)f=s.get(c,h)-t,a+=f,u+=f*f;return e?(u-a*a/i)/(i-1):(u-a*a/i)/i}function my(s,e){for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)s.set(t,r,s.get(t,r)-e[t])}function xy(s,e){for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)s.set(t,r,s.get(t,r)-e[r])}function yy(s,e){for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)s.set(t,r,s.get(t,r)-e)}function Dy(s){const e=[];for(let t=0;t<s.rows;t++){let r=0;for(let n=0;n<s.columns;n++)r+=Math.pow(s.get(t,n),2)/(s.columns-1);e.push(Math.sqrt(r))}return e}function wy(s,e){for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)s.set(t,r,s.get(t,r)/e[t])}function by(s){const e=[];for(let t=0;t<s.columns;t++){let r=0;for(let n=0;n<s.rows;n++)r+=Math.pow(s.get(n,t),2)/(s.rows-1);e.push(Math.sqrt(r))}return e}function Ey(s,e){for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)s.set(t,r,s.get(t,r)/e[r])}function Cy(s){const e=s.size-1;let t=0;for(let r=0;r<s.columns;r++)for(let n=0;n<s.rows;n++)t+=Math.pow(s.get(n,r),2)/e;return Math.sqrt(t)}function Ay(s,e){for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)s.set(t,r,s.get(t,r)/e)}class ke{static from1DArray(e,t,r){if(e*t!==r.length)throw new RangeError("data length does not match given dimensions");let i=new ve(e,t);for(let a=0;a<e;a++)for(let u=0;u<t;u++)i.set(a,u,r[a*t+u]);return i}static rowVector(e){let t=new ve(1,e.length);for(let r=0;r<e.length;r++)t.set(0,r,e[r]);return t}static columnVector(e){let t=new ve(e.length,1);for(let r=0;r<e.length;r++)t.set(r,0,e[r]);return t}static zeros(e,t){return new ve(e,t)}static ones(e,t){return new ve(e,t).fill(1)}static rand(e,t,r={}){if(typeof r!="object")throw new TypeError("options must be an object");const{random:n=Math.random}=r;let i=new ve(e,t);for(let a=0;a<e;a++)for(let u=0;u<t;u++)i.set(a,u,n());return i}static randInt(e,t,r={}){if(typeof r!="object")throw new TypeError("options must be an object");const{min:n=0,max:i=1e3,random:a=Math.random}=r;if(!Number.isInteger(n))throw new TypeError("min must be an integer");if(!Number.isInteger(i))throw new TypeError("max must be an integer");if(n>=i)throw new RangeError("min must be smaller than max");let u=i-n,f=new ve(e,t);for(let c=0;c<e;c++)for(let h=0;h<t;h++){let d=n+Math.round(a()*u);f.set(c,h,d)}return f}static eye(e,t,r){t===void 0&&(t=e),r===void 0&&(r=1);let n=Math.min(e,t),i=this.zeros(e,t);for(let a=0;a<n;a++)i.set(a,a,r);return i}static diag(e,t,r){let n=e.length;t===void 0&&(t=n),r===void 0&&(r=t);let i=Math.min(n,t,r),a=this.zeros(t,r);for(let u=0;u<i;u++)a.set(u,u,e[u]);return a}static min(e,t){e=this.checkMatrix(e),t=this.checkMatrix(t);let r=e.rows,n=e.columns,i=new ve(r,n);for(let a=0;a<r;a++)for(let u=0;u<n;u++)i.set(a,u,Math.min(e.get(a,u),t.get(a,u)));return i}static max(e,t){e=this.checkMatrix(e),t=this.checkMatrix(t);let r=e.rows,n=e.columns,i=new this(r,n);for(let a=0;a<r;a++)for(let u=0;u<n;u++)i.set(a,u,Math.max(e.get(a,u),t.get(a,u)));return i}static checkMatrix(e){return ke.isMatrix(e)?e:new ve(e)}static isMatrix(e){return e!=null&&e.klass==="Matrix"}get size(){return this.rows*this.columns}apply(e){if(typeof e!="function")throw new TypeError("callback must be a function");for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)e.call(this,t,r);return this}to1DArray(){let e=[];for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)e.push(this.get(t,r));return e}to2DArray(){let e=[];for(let t=0;t<this.rows;t++){e.push([]);for(let r=0;r<this.columns;r++)e[t].push(this.get(t,r))}return e}toJSON(){return this.to2DArray()}isRowVector(){return this.rows===1}isColumnVector(){return this.columns===1}isVector(){return this.rows===1||this.columns===1}isSquare(){return this.rows===this.columns}isEmpty(){return this.rows===0||this.columns===0}isSymmetric(){if(this.isSquare()){for(let e=0;e<this.rows;e++)for(let t=0;t<=e;t++)if(this.get(e,t)!==this.get(t,e))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let e=0;e<this.rows;e++)if(this.get(e,e)!==0)return!1;return!0}isEchelonForm(){let e=0,t=0,r=-1,n=!0,i=!1;for(;e<this.rows&&n;){for(t=0,i=!1;t<this.columns&&i===!1;)this.get(e,t)===0?t++:this.get(e,t)===1&&t>r?(i=!0,r=t):(n=!1,i=!0);e++}return n}isReducedEchelonForm(){let e=0,t=0,r=-1,n=!0,i=!1;for(;e<this.rows&&n;){for(t=0,i=!1;t<this.columns&&i===!1;)this.get(e,t)===0?t++:this.get(e,t)===1&&t>r?(i=!0,r=t):(n=!1,i=!0);for(let a=t+1;a<this.rows;a++)this.get(e,a)!==0&&(n=!1);e++}return n}echelonForm(){let e=this.clone(),t=0,r=0;for(;t<e.rows&&r<e.columns;){let n=t;for(let i=t;i<e.rows;i++)e.get(i,r)>e.get(n,r)&&(n=i);if(e.get(n,r)===0)r++;else{e.swapRows(t,n);let i=e.get(t,r);for(let a=r;a<e.columns;a++)e.set(t,a,e.get(t,a)/i);for(let a=t+1;a<e.rows;a++){let u=e.get(a,r)/e.get(t,r);e.set(a,r,0);for(let f=r+1;f<e.columns;f++)e.set(a,f,e.get(a,f)-e.get(t,f)*u)}t++,r++}}return e}reducedEchelonForm(){let e=this.echelonForm(),t=e.columns,r=e.rows,n=r-1;for(;n>=0;)if(e.maxRow(n)===0)n--;else{let i=0,a=!1;for(;i<r&&a===!1;)e.get(n,i)===1?a=!0:i++;for(let u=0;u<n;u++){let f=e.get(u,i);for(let c=i;c<t;c++){let h=e.get(u,c)-f*e.get(n,c);e.set(u,c,h)}}n--}return e}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(e={}){if(typeof e!="object")throw new TypeError("options must be an object");const{rows:t=1,columns:r=1}=e;if(!Number.isInteger(t)||t<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(r)||r<=0)throw new TypeError("columns must be a positive integer");let n=new ve(this.rows*t,this.columns*r);for(let i=0;i<t;i++)for(let a=0;a<r;a++)n.setSubMatrix(this,this.rows*i,this.columns*a);return n}fill(e){for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,e);return this}neg(){return this.mulS(-1)}getRow(e){$r(this,e);let t=[];for(let r=0;r<this.columns;r++)t.push(this.get(e,r));return t}getRowVector(e){return ve.rowVector(this.getRow(e))}setRow(e,t){$r(this,e),t=Ni(this,t);for(let r=0;r<this.columns;r++)this.set(e,r,t[r]);return this}swapRows(e,t){$r(this,e),$r(this,t);for(let r=0;r<this.columns;r++){let n=this.get(e,r);this.set(e,r,this.get(t,r)),this.set(t,r,n)}return this}getColumn(e){Lr(this,e);let t=[];for(let r=0;r<this.rows;r++)t.push(this.get(r,e));return t}getColumnVector(e){return ve.columnVector(this.getColumn(e))}setColumn(e,t){Lr(this,e),t=Si(this,t);for(let r=0;r<this.rows;r++)this.set(r,e,t[r]);return this}swapColumns(e,t){Lr(this,e),Lr(this,t);for(let r=0;r<this.rows;r++){let n=this.get(r,e);this.set(r,e,this.get(r,t)),this.set(r,t,n)}return this}addRowVector(e){e=Ni(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)+e[r]);return this}subRowVector(e){e=Ni(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)-e[r]);return this}mulRowVector(e){e=Ni(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e[r]);return this}divRowVector(e){e=Ni(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)/e[r]);return this}addColumnVector(e){e=Si(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)+e[t]);return this}subColumnVector(e){e=Si(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)-e[t]);return this}mulColumnVector(e){e=Si(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e[t]);return this}divColumnVector(e){e=Si(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)/e[t]);return this}mulRow(e,t){$r(this,e);for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t);return this}mulColumn(e,t){Lr(this,e);for(let r=0;r<this.rows;r++)this.set(r,e,this.get(r,e)*t);return this}max(e){if(this.isEmpty())return NaN;switch(e){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>t[r]&&(t[r]=this.get(r,n));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>t[n]&&(t[n]=this.get(r,n));return t}case void 0:{let t=this.get(0,0);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>t&&(t=this.get(r,n));return t}default:throw new Error(`invalid option: ${e}`)}}maxIndex(){Oi(this);let e=this.get(0,0),t=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>e&&(e=this.get(r,n),t[0]=r,t[1]=n);return t}min(e){if(this.isEmpty())return NaN;switch(e){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<t[r]&&(t[r]=this.get(r,n));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<t[n]&&(t[n]=this.get(r,n));return t}case void 0:{let t=this.get(0,0);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<t&&(t=this.get(r,n));return t}default:throw new Error(`invalid option: ${e}`)}}minIndex(){Oi(this);let e=this.get(0,0),t=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<e&&(e=this.get(r,n),t[0]=r,t[1]=n);return t}maxRow(e){if($r(this,e),this.isEmpty())return NaN;let t=this.get(e,0);for(let r=1;r<this.columns;r++)this.get(e,r)>t&&(t=this.get(e,r));return t}maxRowIndex(e){$r(this,e),Oi(this);let t=this.get(e,0),r=[e,0];for(let n=1;n<this.columns;n++)this.get(e,n)>t&&(t=this.get(e,n),r[1]=n);return r}minRow(e){if($r(this,e),this.isEmpty())return NaN;let t=this.get(e,0);for(let r=1;r<this.columns;r++)this.get(e,r)<t&&(t=this.get(e,r));return t}minRowIndex(e){$r(this,e),Oi(this);let t=this.get(e,0),r=[e,0];for(let n=1;n<this.columns;n++)this.get(e,n)<t&&(t=this.get(e,n),r[1]=n);return r}maxColumn(e){if(Lr(this,e),this.isEmpty())return NaN;let t=this.get(0,e);for(let r=1;r<this.rows;r++)this.get(r,e)>t&&(t=this.get(r,e));return t}maxColumnIndex(e){Lr(this,e),Oi(this);let t=this.get(0,e),r=[0,e];for(let n=1;n<this.rows;n++)this.get(n,e)>t&&(t=this.get(n,e),r[0]=n);return r}minColumn(e){if(Lr(this,e),this.isEmpty())return NaN;let t=this.get(0,e);for(let r=1;r<this.rows;r++)this.get(r,e)<t&&(t=this.get(r,e));return t}minColumnIndex(e){Lr(this,e),Oi(this);let t=this.get(0,e),r=[0,e];for(let n=1;n<this.rows;n++)this.get(n,e)<t&&(t=this.get(n,e),r[0]=n);return r}diag(){let e=Math.min(this.rows,this.columns),t=[];for(let r=0;r<e;r++)t.push(this.get(r,r));return t}norm(e="frobenius"){switch(e){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${e}`)}}cumulativeSum(){let e=0;for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)e+=this.get(t,r),this.set(t,r,e);return this}dot(e){ke.isMatrix(e)&&(e=e.to1DArray());let t=this.to1DArray();if(t.length!==e.length)throw new RangeError("vectors do not have the same size");let r=0;for(let n=0;n<t.length;n++)r+=t[n]*e[n];return r}mmul(e){e=ve.checkMatrix(e);let t=this.rows,r=this.columns,n=e.columns,i=new ve(t,n),a=new Float64Array(r);for(let u=0;u<n;u++){for(let f=0;f<r;f++)a[f]=e.get(f,u);for(let f=0;f<t;f++){let c=0;for(let h=0;h<r;h++)c+=this.get(f,h)*a[h];i.set(f,u,c)}}return i}strassen2x2(e){e=ve.checkMatrix(e);let t=new ve(2,2);const r=this.get(0,0),n=e.get(0,0),i=this.get(0,1),a=e.get(0,1),u=this.get(1,0),f=e.get(1,0),c=this.get(1,1),h=e.get(1,1),d=(r+c)*(n+h),p=(u+c)*n,v=r*(a-h),x=c*(f-n),_=(r+i)*h,y=(u-r)*(n+a),m=(i-c)*(f+h),w=d+x-_+m,D=v+_,C=p+x,b=d-p+v+y;return t.set(0,0,w),t.set(0,1,D),t.set(1,0,C),t.set(1,1,b),t}strassen3x3(e){e=ve.checkMatrix(e);let t=new ve(3,3);const r=this.get(0,0),n=this.get(0,1),i=this.get(0,2),a=this.get(1,0),u=this.get(1,1),f=this.get(1,2),c=this.get(2,0),h=this.get(2,1),d=this.get(2,2),p=e.get(0,0),v=e.get(0,1),x=e.get(0,2),_=e.get(1,0),y=e.get(1,1),m=e.get(1,2),w=e.get(2,0),D=e.get(2,1),C=e.get(2,2),b=(r+n+i-a-u-h-d)*y,F=(r-a)*(-v+y),B=u*(-p+v+_-y-m-w+C),M=(-r+a+u)*(p-v+y),O=(a+u)*(-p+v),A=r*p,N=(-r+c+h)*(p-x+m),I=(-r+c)*(x-m),L=(c+h)*(-p+x),k=(r+n+i-u-f-c-h)*m,z=h*(-p+x+_-y-m-w+D),R=(-i+h+d)*(y+w-D),V=(i-d)*(y-D),H=i*w,ee=(h+d)*(-w+D),te=(-i+u+f)*(m+w-C),j=(i-f)*(m-C),X=(u+f)*(-w+C),Y=n*_,Q=f*D,pe=a*x,De=c*v,we=d*C,be=A+H+Y,Oe=b+M+O+A+R+H+ee,Fe=A+N+L+k+H+te+X,nt=F+B+M+A+H+te+j,Ye=F+M+O+A+Q,Ie=H+te+j+X+pe,Le=A+N+I+z+R+V+H,yt=R+V+H+ee+De,Wt=A+N+I+L+we;return t.set(0,0,be),t.set(0,1,Oe),t.set(0,2,Fe),t.set(1,0,nt),t.set(1,1,Ye),t.set(1,2,Ie),t.set(2,0,Le),t.set(2,1,yt),t.set(2,2,Wt),t}mmulStrassen(e){e=ve.checkMatrix(e);let t=this.clone(),r=t.rows,n=t.columns,i=e.rows,a=e.columns;n!==i&&console.warn(`Multiplying ${r} x ${n} and ${i} x ${a} matrix: dimensions do not match.`);function u(d,p,v){let x=d.rows,_=d.columns;if(x===p&&_===v)return d;{let y=ke.zeros(p,v);return y=y.setSubMatrix(d,0,0),y}}let f=Math.max(r,i),c=Math.max(n,a);t=u(t,f,c),e=u(e,f,c);function h(d,p,v,x){if(v<=512||x<=512)return d.mmul(p);v%2===1&&x%2===1?(d=u(d,v+1,x+1),p=u(p,v+1,x+1)):v%2===1?(d=u(d,v+1,x),p=u(p,v+1,x)):x%2===1&&(d=u(d,v,x+1),p=u(p,v,x+1));let _=parseInt(d.rows/2,10),y=parseInt(d.columns/2,10),m=d.subMatrix(0,_-1,0,y-1),w=p.subMatrix(0,_-1,0,y-1),D=d.subMatrix(0,_-1,y,d.columns-1),C=p.subMatrix(0,_-1,y,p.columns-1),b=d.subMatrix(_,d.rows-1,0,y-1),F=p.subMatrix(_,p.rows-1,0,y-1),B=d.subMatrix(_,d.rows-1,y,d.columns-1),M=p.subMatrix(_,p.rows-1,y,p.columns-1),O=h(ke.add(m,B),ke.add(w,M),_,y),A=h(ke.add(b,B),w,_,y),N=h(m,ke.sub(C,M),_,y),I=h(B,ke.sub(F,w),_,y),L=h(ke.add(m,D),M,_,y),k=h(ke.sub(b,m),ke.add(w,C),_,y),z=h(ke.sub(D,B),ke.add(F,M),_,y),R=ke.add(O,I);R.sub(L),R.add(z);let V=ke.add(N,L),H=ke.add(A,I),ee=ke.sub(O,A);ee.add(N),ee.add(k);let te=ke.zeros(2*R.rows,2*R.columns);return te=te.setSubMatrix(R,0,0),te=te.setSubMatrix(V,R.rows,0),te=te.setSubMatrix(H,0,R.columns),te=te.setSubMatrix(ee,R.rows,R.columns),te.subMatrix(0,v-1,0,x-1)}return h(t,e,f,c)}scaleRows(e={}){if(typeof e!="object")throw new TypeError("options must be an object");const{min:t=0,max:r=1}=e;if(!Number.isFinite(t))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(t>=r)throw new RangeError("min must be smaller than max");let n=new ve(this.rows,this.columns);for(let i=0;i<this.rows;i++){const a=this.getRow(i);a.length>0&&Ff(a,{min:t,max:r,output:a}),n.setRow(i,a)}return n}scaleColumns(e={}){if(typeof e!="object")throw new TypeError("options must be an object");const{min:t=0,max:r=1}=e;if(!Number.isFinite(t))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(t>=r)throw new RangeError("min must be smaller than max");let n=new ve(this.rows,this.columns);for(let i=0;i<this.columns;i++){const a=this.getColumn(i);a.length&&Ff(a,{min:t,max:r,output:a}),n.setColumn(i,a)}return n}flipRows(){const e=Math.ceil(this.columns/2);for(let t=0;t<this.rows;t++)for(let r=0;r<e;r++){let n=this.get(t,r),i=this.get(t,this.columns-1-r);this.set(t,r,i),this.set(t,this.columns-1-r,n)}return this}flipColumns(){const e=Math.ceil(this.rows/2);for(let t=0;t<this.columns;t++)for(let r=0;r<e;r++){let n=this.get(r,t),i=this.get(this.rows-1-r,t);this.set(r,t,i),this.set(this.rows-1-r,t,n)}return this}kroneckerProduct(e){e=ve.checkMatrix(e);let t=this.rows,r=this.columns,n=e.rows,i=e.columns,a=new ve(t*n,r*i);for(let u=0;u<t;u++)for(let f=0;f<r;f++)for(let c=0;c<n;c++)for(let h=0;h<i;h++)a.set(n*u+c,i*f+h,this.get(u,f)*e.get(c,h));return a}kroneckerSum(e){if(e=ve.checkMatrix(e),!this.isSquare()||!e.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let t=this.rows,r=e.rows,n=this.kroneckerProduct(ve.eye(r,r)),i=ve.eye(t,t).kroneckerProduct(e);return n.add(i)}transpose(){let e=new ve(this.columns,this.rows);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)e.set(r,t,this.get(t,r));return e}sortRows(e=Sf){for(let t=0;t<this.rows;t++)this.setRow(t,this.getRow(t).sort(e));return this}sortColumns(e=Sf){for(let t=0;t<this.columns;t++)this.setColumn(t,this.getColumn(t).sort(e));return this}subMatrix(e,t,r,n){tu(this,e,t,r,n);let i=new ve(t-e+1,n-r+1);for(let a=e;a<=t;a++)for(let u=r;u<=n;u++)i.set(a-e,u-r,this.get(a,u));return i}subMatrixRow(e,t,r){if(t===void 0&&(t=0),r===void 0&&(r=this.columns-1),t>r||t<0||t>=this.columns||r<0||r>=this.columns)throw new RangeError("Argument out of range");let n=new ve(e.length,r-t+1);for(let i=0;i<e.length;i++)for(let a=t;a<=r;a++){if(e[i]<0||e[i]>=this.rows)throw new RangeError(`Row index out of range: ${e[i]}`);n.set(i,a-t,this.get(e[i],a))}return n}subMatrixColumn(e,t,r){if(t===void 0&&(t=0),r===void 0&&(r=this.rows-1),t>r||t<0||t>=this.rows||r<0||r>=this.rows)throw new RangeError("Argument out of range");let n=new ve(r-t+1,e.length);for(let i=0;i<e.length;i++)for(let a=t;a<=r;a++){if(e[i]<0||e[i]>=this.columns)throw new RangeError(`Column index out of range: ${e[i]}`);n.set(a-t,i,this.get(a,e[i]))}return n}setSubMatrix(e,t,r){if(e=ve.checkMatrix(e),e.isEmpty())return this;let n=t+e.rows-1,i=r+e.columns-1;tu(this,t,n,r,i);for(let a=0;a<e.rows;a++)for(let u=0;u<e.columns;u++)this.set(t+a,r+u,e.get(a,u));return this}selection(e,t){Ja(this,e),eu(this,t);let r=new ve(e.length,t.length);for(let n=0;n<e.length;n++){let i=e[n];for(let a=0;a<t.length;a++){let u=t[a];r.set(n,a,this.get(i,u))}}return r}trace(){let e=Math.min(this.rows,this.columns),t=0;for(let r=0;r<e;r++)t+=this.get(r,r);return t}clone(){return this.constructor.copy(this,new ve(this.rows,this.columns))}static copy(e,t){for(const[r,n,i]of e.entries())t.set(r,n,i);return t}sum(e){switch(e){case"row":return ly(this);case"column":return cy(this);case void 0:return fy(this);default:throw new Error(`invalid option: ${e}`)}}product(e){switch(e){case"row":return hy(this);case"column":return dy(this);case void 0:return py(this);default:throw new Error(`invalid option: ${e}`)}}mean(e){const t=this.sum(e);switch(e){case"row":{for(let r=0;r<this.rows;r++)t[r]/=this.columns;return t}case"column":{for(let r=0;r<this.columns;r++)t[r]/=this.rows;return t}case void 0:return t/this.size;default:throw new Error(`invalid option: ${e}`)}}variance(e,t={}){if(typeof e=="object"&&(t=e,e=void 0),typeof t!="object")throw new TypeError("options must be an object");const{unbiased:r=!0,mean:n=this.mean(e)}=t;if(typeof r!="boolean")throw new TypeError("unbiased must be a boolean");switch(e){case"row":{if(!gr.isAnyArray(n))throw new TypeError("mean must be an array");return _y(this,r,n)}case"column":{if(!gr.isAnyArray(n))throw new TypeError("mean must be an array");return vy(this,r,n)}case void 0:{if(typeof n!="number")throw new TypeError("mean must be a number");return gy(this,r,n)}default:throw new Error(`invalid option: ${e}`)}}standardDeviation(e,t){typeof e=="object"&&(t=e,e=void 0);const r=this.variance(e,t);if(e===void 0)return Math.sqrt(r);for(let n=0;n<r.length;n++)r[n]=Math.sqrt(r[n]);return r}center(e,t={}){if(typeof e=="object"&&(t=e,e=void 0),typeof t!="object")throw new TypeError("options must be an object");const{center:r=this.mean(e)}=t;switch(e){case"row":{if(!gr.isAnyArray(r))throw new TypeError("center must be an array");return my(this,r),this}case"column":{if(!gr.isAnyArray(r))throw new TypeError("center must be an array");return xy(this,r),this}case void 0:{if(typeof r!="number")throw new TypeError("center must be a number");return yy(this,r),this}default:throw new Error(`invalid option: ${e}`)}}scale(e,t={}){if(typeof e=="object"&&(t=e,e=void 0),typeof t!="object")throw new TypeError("options must be an object");let r=t.scale;switch(e){case"row":{if(r===void 0)r=Dy(this);else if(!gr.isAnyArray(r))throw new TypeError("scale must be an array");return wy(this,r),this}case"column":{if(r===void 0)r=by(this);else if(!gr.isAnyArray(r))throw new TypeError("scale must be an array");return Ey(this,r),this}case void 0:{if(r===void 0)r=Cy(this);else if(typeof r!="number")throw new TypeError("scale must be a number");return Ay(this,r),this}default:throw new Error(`invalid option: ${e}`)}}toString(e){return Mf(this,e)}[Symbol.iterator](){return this.entries()}*entries(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)yield[e,t,this.get(e,t)]}*values(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)yield this.get(e,t)}}ke.prototype.klass="Matrix",typeof Symbol<"u"&&(ke.prototype[Symbol.for("nodejs.util.inspect.custom")]=sy);function Sf(s,e){return s-e}function Fy(s){return s.every(e=>typeof e=="number")}ke.random=ke.rand,ke.randomInt=ke.randInt,ke.diagonal=ke.diag,ke.prototype.diagonal=ke.prototype.diag,ke.identity=ke.eye,ke.prototype.negate=ke.prototype.neg,ke.prototype.tensorProduct=ke.prototype.kroneckerProduct;let ve=(Pi=class extends ke{constructor(t,r){super();vl(this,gs);q(this,"data");if(Pi.isMatrix(t))gl(this,gs,ml).call(this,t.rows,t.columns),Pi.copy(t,this);else if(Number.isInteger(t)&&t>=0)gl(this,gs,ml).call(this,t,r);else if(gr.isAnyArray(t)){const n=t;if(t=n.length,r=t?n[0].length:0,typeof r!="number")throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let i=0;i<t;i++){if(n[i].length!==r)throw new RangeError("Inconsistent array dimensions");if(!Fy(n[i]))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(n[i]))}this.rows=t,this.columns=r}else throw new TypeError("First argument must be a positive number or an array")}set(t,r,n){return this.data[t][r]=n,this}get(t,r){return this.data[t][r]}removeRow(t){return $r(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,r){return r===void 0&&(r=t,t=this.rows),$r(this,t,!0),r=Float64Array.from(Ni(this,r)),this.data.splice(t,0,r),this.rows+=1,this}removeColumn(t){Lr(this,t);for(let r=0;r<this.rows;r++){const n=new Float64Array(this.columns-1);for(let i=0;i<t;i++)n[i]=this.data[r][i];for(let i=t+1;i<this.columns;i++)n[i-1]=this.data[r][i];this.data[r]=n}return this.columns-=1,this}addColumn(t,r){typeof r>"u"&&(r=t,t=this.columns),Lr(this,t,!0),r=Si(this,r);for(let n=0;n<this.rows;n++){const i=new Float64Array(this.columns+1);let a=0;for(;a<t;a++)i[a]=this.data[n][a];for(i[a++]=r[n];a<this.columns+1;a++)i[a]=this.data[n][a-1];this.data[n]=i}return this.columns+=1,this}},gs=new WeakSet,ml=function(t,r){if(this.data=[],Number.isInteger(r)&&r>=0)for(let n=0;n<t;n++)this.data.push(new Float64Array(r));else throw new TypeError("nColumns must be a positive integer");this.rows=t,this.columns=r},Pi);uy(ke,ve);const Lo=class Lo extends ke{constructor(t){super();vl(this,rr,void 0);if(ve.isMatrix(t)){if(!t.isSymmetric())throw new TypeError("not symmetric data");Ca(this,rr,ve.copy(t,new ve(t.rows,t.rows)))}else if(Number.isInteger(t)&&t>=0)Ca(this,rr,new ve(t,t));else if(Ca(this,rr,new ve(t)),!this.isSymmetric())throw new TypeError("not symmetric data")}get size(){return on(this,rr).size}get rows(){return on(this,rr).rows}get columns(){return on(this,rr).columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(t){return ve.isMatrix(t)&&t.klassType==="SymmetricMatrix"}static zeros(t){return new this(t)}static ones(t){return new this(t).fill(1)}clone(){const t=new Lo(this.diagonalSize);for(const[r,n,i]of this.upperRightEntries())t.set(r,n,i);return t}toMatrix(){return new ve(this)}get(t,r){return on(this,rr).get(t,r)}set(t,r,n){return on(this,rr).set(t,r,n),on(this,rr).set(r,t,n),this}removeCross(t){return on(this,rr).removeRow(t),on(this,rr).removeColumn(t),this}addCross(t,r){r===void 0&&(r=t,t=this.diagonalSize);const n=r.slice();return n.splice(t,1),on(this,rr).addRow(t,n),on(this,rr).addColumn(t,r),this}applyMask(t){if(t.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const r=[];for(const[n,i]of t.entries())i||r.push(n);r.reverse();for(const n of r)this.removeCross(n);return this}toCompact(){const{diagonalSize:t}=this,r=new Array(t*(t+1)/2);for(let n=0,i=0,a=0;a<r.length;a++)r[a]=this.get(i,n),++n>=t&&(n=++i);return r}static fromCompact(t){const r=t.length,n=(Math.sqrt(8*r+1)-1)/2;if(!Number.isInteger(n))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(t)}`);const i=new Lo(n);for(let a=0,u=0,f=0;f<r;f++)i.set(a,u,t[f]),++a>=n&&(a=++u);return i}*upperRightEntries(){for(let t=0,r=0;t<this.diagonalSize;void 0){const n=this.get(t,r);yield[t,r,n],++r>=this.diagonalSize&&(r=++t)}}*upperRightValues(){for(let t=0,r=0;t<this.diagonalSize;void 0)yield this.get(t,r),++r>=this.diagonalSize&&(r=++t)}};rr=new WeakMap;let si=Lo;si.prototype.klassType="SymmetricMatrix";class bo extends si{static isDistanceMatrix(e){return si.isSymmetricMatrix(e)&&e.klassSubType==="DistanceMatrix"}constructor(e){if(super(e),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(e,t,r){return e===t&&(r=0),super.set(e,t,r)}addCross(e,t){return t===void 0&&(t=e,e=this.diagonalSize),t=t.slice(),t[e]=0,super.addCross(e,t)}toSymmetricMatrix(){return new si(this)}clone(){const e=new bo(this.diagonalSize);for(const[t,r,n]of this.upperRightEntries())t!==r&&e.set(t,r,n);return e}toCompact(){const{diagonalSize:e}=this,t=(e-1)*e/2,r=new Array(t);for(let n=1,i=0,a=0;a<r.length;a++)r[a]=this.get(i,n),++n>=e&&(n=++i+1);return r}static fromCompact(e){const t=e.length,r=(Math.sqrt(8*t+1)+1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(e)}`);const n=new this(r);for(let i=1,a=0,u=0;u<t;u++)n.set(i,a,e[u]),++i>=r&&(i=++a+1);return n}}bo.prototype.klassSubType="DistanceMatrix";class yn extends ke{constructor(e,t,r){super(),this.matrix=e,this.rows=t,this.columns=r}}class By extends yn{constructor(e,t){Lr(e,t),super(e,e.rows,1),this.column=t}set(e,t,r){return this.matrix.set(e,this.column,r),this}get(e){return this.matrix.get(e,this.column)}}class My extends yn{constructor(e,t){eu(e,t),super(e,e.rows,t.length),this.columnIndices=t}set(e,t,r){return this.matrix.set(e,this.columnIndices[t],r),this}get(e,t){return this.matrix.get(e,this.columnIndices[t])}}class Ny extends yn{constructor(e){super(e,e.rows,e.columns)}set(e,t,r){return this.matrix.set(e,this.columns-t-1,r),this}get(e,t){return this.matrix.get(e,this.columns-t-1)}}class Sy extends yn{constructor(e){super(e,e.rows,e.columns)}set(e,t,r){return this.matrix.set(this.rows-e-1,t,r),this}get(e,t){return this.matrix.get(this.rows-e-1,t)}}class Oy extends yn{constructor(e,t){$r(e,t),super(e,1,e.columns),this.row=t}set(e,t,r){return this.matrix.set(this.row,t,r),this}get(e,t){return this.matrix.get(this.row,t)}}class Iy extends yn{constructor(e,t){Ja(e,t),super(e,t.length,e.columns),this.rowIndices=t}set(e,t,r){return this.matrix.set(this.rowIndices[e],t,r),this}get(e,t){return this.matrix.get(this.rowIndices[e],t)}}class Eo extends yn{constructor(e,t,r){Ja(e,t),eu(e,r),super(e,t.length,r.length),this.rowIndices=t,this.columnIndices=r}set(e,t,r){return this.matrix.set(this.rowIndices[e],this.columnIndices[t],r),this}get(e,t){return this.matrix.get(this.rowIndices[e],this.columnIndices[t])}}class Ty extends yn{constructor(e,t,r,n,i){tu(e,t,r,n,i),super(e,r-t+1,i-n+1),this.startRow=t,this.startColumn=n}set(e,t,r){return this.matrix.set(this.startRow+e,this.startColumn+t,r),this}get(e,t){return this.matrix.get(this.startRow+e,this.startColumn+t)}}class $y extends yn{constructor(e){super(e,e.columns,e.rows)}set(e,t,r){return this.matrix.set(t,e,r),this}get(e,t){return this.matrix.get(t,e)}}class Of extends ke{constructor(e,t={}){const{rows:r=1}=t;if(e.length%r!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=r,this.columns=e.length/r,this.data=e}set(e,t,r){let n=this._calculateIndex(e,t);return this.data[n]=r,this}get(e,t){let r=this._calculateIndex(e,t);return this.data[r]}_calculateIndex(e,t){return e*this.columns+t}}class Cr extends ke{constructor(e){super(),this.data=e,this.rows=e.length,this.columns=e[0].length}set(e,t,r){return this.data[e][t]=r,this}get(e,t){return this.data[e][t]}}function Ly(s,e){if(gr.isAnyArray(s))return s[0]&&gr.isAnyArray(s[0])?new Cr(s):new Of(s,e);throw new Error("the argument is not an array")}class Co{constructor(e){e=Cr.checkMatrix(e);let t=e.clone(),r=t.rows,n=t.columns,i=new Float64Array(r),a=1,u,f,c,h,d,p,v,x,_;for(u=0;u<r;u++)i[u]=u;for(x=new Float64Array(r),f=0;f<n;f++){for(u=0;u<r;u++)x[u]=t.get(u,f);for(u=0;u<r;u++){for(_=Math.min(u,f),d=0,c=0;c<_;c++)d+=t.get(u,c)*x[c];x[u]-=d,t.set(u,f,x[u])}for(h=f,u=f+1;u<r;u++)Math.abs(x[u])>Math.abs(x[h])&&(h=u);if(h!==f){for(c=0;c<n;c++)p=t.get(h,c),t.set(h,c,t.get(f,c)),t.set(f,c,p);v=i[h],i[h]=i[f],i[f]=v,a=-a}if(f<r&&t.get(f,f)!==0)for(u=f+1;u<r;u++)t.set(u,f,t.get(u,f)/t.get(f,f))}this.LU=t,this.pivotVector=i,this.pivotSign=a}isSingular(){let e=this.LU,t=e.columns;for(let r=0;r<t;r++)if(e.get(r,r)===0)return!0;return!1}solve(e){e=ve.checkMatrix(e);let t=this.LU;if(t.rows!==e.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let n=e.columns,i=e.subMatrixRow(this.pivotVector,0,n-1),a=t.columns,u,f,c;for(c=0;c<a;c++)for(u=c+1;u<a;u++)for(f=0;f<n;f++)i.set(u,f,i.get(u,f)-i.get(c,f)*t.get(u,c));for(c=a-1;c>=0;c--){for(f=0;f<n;f++)i.set(c,f,i.get(c,f)/t.get(c,c));for(u=0;u<c;u++)for(f=0;f<n;f++)i.set(u,f,i.get(u,f)-i.get(c,f)*t.get(u,c))}return i}get determinant(){let e=this.LU;if(!e.isSquare())throw new Error("Matrix must be square");let t=this.pivotSign,r=e.columns;for(let n=0;n<r;n++)t*=e.get(n,n);return t}get lowerTriangularMatrix(){let e=this.LU,t=e.rows,r=e.columns,n=new ve(t,r);for(let i=0;i<t;i++)for(let a=0;a<r;a++)i>a?n.set(i,a,e.get(i,a)):i===a?n.set(i,a,1):n.set(i,a,0);return n}get upperTriangularMatrix(){let e=this.LU,t=e.rows,r=e.columns,n=new ve(t,r);for(let i=0;i<t;i++)for(let a=0;a<r;a++)i<=a?n.set(i,a,e.get(i,a)):n.set(i,a,0);return n}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function Dn(s,e){let t=0;return Math.abs(s)>Math.abs(e)?(t=e/s,Math.abs(s)*Math.sqrt(1+t*t)):e!==0?(t=s/e,Math.abs(e)*Math.sqrt(1+t*t)):0}class ru{constructor(e){e=Cr.checkMatrix(e);let t=e.clone(),r=e.rows,n=e.columns,i=new Float64Array(n),a,u,f,c;for(f=0;f<n;f++){let h=0;for(a=f;a<r;a++)h=Dn(h,t.get(a,f));if(h!==0){for(t.get(f,f)<0&&(h=-h),a=f;a<r;a++)t.set(a,f,t.get(a,f)/h);for(t.set(f,f,t.get(f,f)+1),u=f+1;u<n;u++){for(c=0,a=f;a<r;a++)c+=t.get(a,f)*t.get(a,u);for(c=-c/t.get(f,f),a=f;a<r;a++)t.set(a,u,t.get(a,u)+c*t.get(a,f))}}i[f]=-h}this.QR=t,this.Rdiag=i}solve(e){e=ve.checkMatrix(e);let t=this.QR,r=t.rows;if(e.rows!==r)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let n=e.columns,i=e.clone(),a=t.columns,u,f,c,h;for(c=0;c<a;c++)for(f=0;f<n;f++){for(h=0,u=c;u<r;u++)h+=t.get(u,c)*i.get(u,f);for(h=-h/t.get(c,c),u=c;u<r;u++)i.set(u,f,i.get(u,f)+h*t.get(u,c))}for(c=a-1;c>=0;c--){for(f=0;f<n;f++)i.set(c,f,i.get(c,f)/this.Rdiag[c]);for(u=0;u<c;u++)for(f=0;f<n;f++)i.set(u,f,i.get(u,f)-i.get(c,f)*t.get(u,c))}return i.subMatrix(0,a-1,0,n-1)}isFullRank(){let e=this.QR.columns;for(let t=0;t<e;t++)if(this.Rdiag[t]===0)return!1;return!0}get upperTriangularMatrix(){let e=this.QR,t=e.columns,r=new ve(t,t),n,i;for(n=0;n<t;n++)for(i=0;i<t;i++)n<i?r.set(n,i,e.get(n,i)):n===i?r.set(n,i,this.Rdiag[n]):r.set(n,i,0);return r}get orthogonalMatrix(){let e=this.QR,t=e.rows,r=e.columns,n=new ve(t,r),i,a,u,f;for(u=r-1;u>=0;u--){for(i=0;i<t;i++)n.set(i,u,0);for(n.set(u,u,1),a=u;a<r;a++)if(e.get(u,u)!==0){for(f=0,i=u;i<t;i++)f+=e.get(i,u)*n.get(i,a);for(f=-f/e.get(u,u),i=u;i<t;i++)n.set(i,a,n.get(i,a)+f*e.get(i,u))}}return n}}class Ii{constructor(e,t={}){if(e=Cr.checkMatrix(e),e.isEmpty())throw new Error("Matrix must be non-empty");let r=e.rows,n=e.columns;const{computeLeftSingularVectors:i=!0,computeRightSingularVectors:a=!0,autoTranspose:u=!1}=t;let f=!!i,c=!!a,h=!1,d;if(r<n)if(!u)d=e.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else{d=e.transpose(),r=d.rows,n=d.columns,h=!0;let A=f;f=c,c=A}else d=e.clone();let p=Math.min(r,n),v=Math.min(r+1,n),x=new Float64Array(v),_=new ve(r,p),y=new ve(n,n),m=new Float64Array(n),w=new Float64Array(r),D=new Float64Array(v);for(let A=0;A<v;A++)D[A]=A;let C=Math.min(r-1,n),b=Math.max(0,Math.min(n-2,r)),F=Math.max(C,b);for(let A=0;A<F;A++){if(A<C){x[A]=0;for(let N=A;N<r;N++)x[A]=Dn(x[A],d.get(N,A));if(x[A]!==0){d.get(A,A)<0&&(x[A]=-x[A]);for(let N=A;N<r;N++)d.set(N,A,d.get(N,A)/x[A]);d.set(A,A,d.get(A,A)+1)}x[A]=-x[A]}for(let N=A+1;N<n;N++){if(A<C&&x[A]!==0){let I=0;for(let L=A;L<r;L++)I+=d.get(L,A)*d.get(L,N);I=-I/d.get(A,A);for(let L=A;L<r;L++)d.set(L,N,d.get(L,N)+I*d.get(L,A))}m[N]=d.get(A,N)}if(f&&A<C)for(let N=A;N<r;N++)_.set(N,A,d.get(N,A));if(A<b){m[A]=0;for(let N=A+1;N<n;N++)m[A]=Dn(m[A],m[N]);if(m[A]!==0){m[A+1]<0&&(m[A]=0-m[A]);for(let N=A+1;N<n;N++)m[N]/=m[A];m[A+1]+=1}if(m[A]=-m[A],A+1<r&&m[A]!==0){for(let N=A+1;N<r;N++)w[N]=0;for(let N=A+1;N<r;N++)for(let I=A+1;I<n;I++)w[N]+=m[I]*d.get(N,I);for(let N=A+1;N<n;N++){let I=-m[N]/m[A+1];for(let L=A+1;L<r;L++)d.set(L,N,d.get(L,N)+I*w[L])}}if(c)for(let N=A+1;N<n;N++)y.set(N,A,m[N])}}let B=Math.min(n,r+1);if(C<n&&(x[C]=d.get(C,C)),r<B&&(x[B-1]=0),b+1<B&&(m[b]=d.get(b,B-1)),m[B-1]=0,f){for(let A=C;A<p;A++){for(let N=0;N<r;N++)_.set(N,A,0);_.set(A,A,1)}for(let A=C-1;A>=0;A--)if(x[A]!==0){for(let N=A+1;N<p;N++){let I=0;for(let L=A;L<r;L++)I+=_.get(L,A)*_.get(L,N);I=-I/_.get(A,A);for(let L=A;L<r;L++)_.set(L,N,_.get(L,N)+I*_.get(L,A))}for(let N=A;N<r;N++)_.set(N,A,-_.get(N,A));_.set(A,A,1+_.get(A,A));for(let N=0;N<A-1;N++)_.set(N,A,0)}else{for(let N=0;N<r;N++)_.set(N,A,0);_.set(A,A,1)}}if(c)for(let A=n-1;A>=0;A--){if(A<b&&m[A]!==0)for(let N=A+1;N<n;N++){let I=0;for(let L=A+1;L<n;L++)I+=y.get(L,A)*y.get(L,N);I=-I/y.get(A+1,A);for(let L=A+1;L<n;L++)y.set(L,N,y.get(L,N)+I*y.get(L,A))}for(let N=0;N<n;N++)y.set(N,A,0);y.set(A,A,1)}let M=B-1,O=Number.EPSILON;for(;B>0;){let A,N;for(A=B-2;A>=-1&&A!==-1;A--){const I=Number.MIN_VALUE+O*Math.abs(x[A]+Math.abs(x[A+1]));if(Math.abs(m[A])<=I||Number.isNaN(m[A])){m[A]=0;break}}if(A===B-2)N=4;else{let I;for(I=B-1;I>=A&&I!==A;I--){let L=(I!==B?Math.abs(m[I]):0)+(I!==A+1?Math.abs(m[I-1]):0);if(Math.abs(x[I])<=O*L){x[I]=0;break}}I===A?N=3:I===B-1?N=1:(N=2,A=I)}switch(A++,N){case 1:{let I=m[B-2];m[B-2]=0;for(let L=B-2;L>=A;L--){let k=Dn(x[L],I),z=x[L]/k,R=I/k;if(x[L]=k,L!==A&&(I=-R*m[L-1],m[L-1]=z*m[L-1]),c)for(let V=0;V<n;V++)k=z*y.get(V,L)+R*y.get(V,B-1),y.set(V,B-1,-R*y.get(V,L)+z*y.get(V,B-1)),y.set(V,L,k)}break}case 2:{let I=m[A-1];m[A-1]=0;for(let L=A;L<B;L++){let k=Dn(x[L],I),z=x[L]/k,R=I/k;if(x[L]=k,I=-R*m[L],m[L]=z*m[L],f)for(let V=0;V<r;V++)k=z*_.get(V,L)+R*_.get(V,A-1),_.set(V,A-1,-R*_.get(V,L)+z*_.get(V,A-1)),_.set(V,L,k)}break}case 3:{const I=Math.max(Math.abs(x[B-1]),Math.abs(x[B-2]),Math.abs(m[B-2]),Math.abs(x[A]),Math.abs(m[A])),L=x[B-1]/I,k=x[B-2]/I,z=m[B-2]/I,R=x[A]/I,V=m[A]/I,H=((k+L)*(k-L)+z*z)/2,ee=L*z*(L*z);let te=0;(H!==0||ee!==0)&&(H<0?te=0-Math.sqrt(H*H+ee):te=Math.sqrt(H*H+ee),te=ee/(H+te));let j=(R+L)*(R-L)+te,X=R*V;for(let Y=A;Y<B-1;Y++){let Q=Dn(j,X);Q===0&&(Q=Number.MIN_VALUE);let pe=j/Q,De=X/Q;if(Y!==A&&(m[Y-1]=Q),j=pe*x[Y]+De*m[Y],m[Y]=pe*m[Y]-De*x[Y],X=De*x[Y+1],x[Y+1]=pe*x[Y+1],c)for(let we=0;we<n;we++)Q=pe*y.get(we,Y)+De*y.get(we,Y+1),y.set(we,Y+1,-De*y.get(we,Y)+pe*y.get(we,Y+1)),y.set(we,Y,Q);if(Q=Dn(j,X),Q===0&&(Q=Number.MIN_VALUE),pe=j/Q,De=X/Q,x[Y]=Q,j=pe*m[Y]+De*x[Y+1],x[Y+1]=-De*m[Y]+pe*x[Y+1],X=De*m[Y+1],m[Y+1]=pe*m[Y+1],f&&Y<r-1)for(let we=0;we<r;we++)Q=pe*_.get(we,Y)+De*_.get(we,Y+1),_.set(we,Y+1,-De*_.get(we,Y)+pe*_.get(we,Y+1)),_.set(we,Y,Q)}m[B-2]=j;break}case 4:{if(x[A]<=0&&(x[A]=x[A]<0?-x[A]:0,c))for(let I=0;I<=M;I++)y.set(I,A,-y.get(I,A));for(;A<M&&!(x[A]>=x[A+1]);){let I=x[A];if(x[A]=x[A+1],x[A+1]=I,c&&A<n-1)for(let L=0;L<n;L++)I=y.get(L,A+1),y.set(L,A+1,y.get(L,A)),y.set(L,A,I);if(f&&A<r-1)for(let L=0;L<r;L++)I=_.get(L,A+1),_.set(L,A+1,_.get(L,A)),_.set(L,A,I);A++}B--;break}}}if(h){let A=y;y=_,_=A}this.m=r,this.n=n,this.s=x,this.U=_,this.V=y}solve(e){let t=e,r=this.threshold,n=this.s.length,i=ve.zeros(n,n);for(let p=0;p<n;p++)Math.abs(this.s[p])<=r?i.set(p,p,0):i.set(p,p,1/this.s[p]);let a=this.U,u=this.rightSingularVectors,f=u.mmul(i),c=u.rows,h=a.rows,d=ve.zeros(c,h);for(let p=0;p<c;p++)for(let v=0;v<h;v++){let x=0;for(let _=0;_<n;_++)x+=f.get(p,_)*a.get(v,_);d.set(p,v,x)}return d.mmul(t)}solveForDiagonal(e){return this.solve(ve.diag(e))}inverse(){let e=this.V,t=this.threshold,r=e.rows,n=e.columns,i=new ve(r,this.s.length);for(let h=0;h<r;h++)for(let d=0;d<n;d++)Math.abs(this.s[d])>t&&i.set(h,d,e.get(h,d)/this.s[d]);let a=this.U,u=a.rows,f=a.columns,c=new ve(r,u);for(let h=0;h<r;h++)for(let d=0;d<u;d++){let p=0;for(let v=0;v<f;v++)p+=i.get(h,v)*a.get(d,v);c.set(h,d,p)}return c}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let e=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,t=0,r=this.s;for(let n=0,i=r.length;n<i;n++)r[n]>e&&t++;return t}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return ve.diag(this.s)}}function Ry(s,e=!1){return s=Cr.checkMatrix(s),e?new Ii(s).inverse():If(s,ve.eye(s.rows))}function If(s,e,t=!1){return s=Cr.checkMatrix(s),e=Cr.checkMatrix(e),t?new Ii(s).solve(e):s.isSquare()?new Co(s).solve(e):new ru(s).solve(e)}function Ao(s){if(s=ve.checkMatrix(s),s.isSquare()){if(s.columns===0)return 1;let e,t,r,n;if(s.columns===2)return e=s.get(0,0),t=s.get(0,1),r=s.get(1,0),n=s.get(1,1),e*n-t*r;if(s.columns===3){let i,a,u;return i=new Eo(s,[1,2],[1,2]),a=new Eo(s,[1,2],[0,2]),u=new Eo(s,[1,2],[0,1]),e=s.get(0,0),t=s.get(0,1),r=s.get(0,2),e*Ao(i)-t*Ao(a)+r*Ao(u)}else return new Co(s).determinant}else throw Error("determinant can only be calculated for a square matrix")}function Py(s,e){let t=[];for(let r=0;r<s;r++)r!==e&&t.push(r);return t}function ky(s,e,t,r=1e-9,n=1e-9){if(s>n)return new Array(e.rows+1).fill(0);{let i=e.addRow(t,[0]);for(let a=0;a<i.rows;a++)Math.abs(i.get(a,0))<r&&i.set(a,0,0);return i.to1DArray()}}function zy(s,e={}){const{thresholdValue:t=1e-9,thresholdError:r=1e-9}=e;s=ve.checkMatrix(s);let n=s.rows,i=new ve(n,n);for(let a=0;a<n;a++){let u=ve.columnVector(s.getRow(a)),f=s.subMatrixRow(Py(n,a)).transpose(),h=new Ii(f).solve(u),d=ve.sub(u,f.mmul(h)).abs().max();i.setRow(a,ky(d,h,a,t,r))}return i}function qy(s,e=Number.EPSILON){if(s=ve.checkMatrix(s),s.isEmpty())return s.transpose();let t=new Ii(s,{autoTranspose:!0}),r=t.leftSingularVectors,n=t.rightSingularVectors,i=t.diagonal;for(let a=0;a<i.length;a++)Math.abs(i[a])>e?i[a]=1/i[a]:i[a]=0;return n.mmul(ve.diag(i).mmul(r.transpose()))}function Uy(s,e=s,t={}){s=new ve(s);let r=!1;if(typeof e=="object"&&!ve.isMatrix(e)&&!gr.isAnyArray(e)?(t=e,e=s,r=!0):e=new ve(e),s.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:n=!0}=t;n&&(s=s.center("column"),r||(e=e.center("column")));const i=s.transpose().mmul(e);for(let a=0;a<i.rows;a++)for(let u=0;u<i.columns;u++)i.set(a,u,i.get(a,u)*(1/(s.rows-1)));return i}function Wy(s,e=s,t={}){s=new ve(s);let r=!1;if(typeof e=="object"&&!ve.isMatrix(e)&&!gr.isAnyArray(e)?(t=e,e=s,r=!0):e=new ve(e),s.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:n=!0,scale:i=!0}=t;n&&(s.center("column"),r||e.center("column")),i&&(s.scale("column"),r||e.scale("column"));const a=s.standardDeviation("column",{unbiased:!0}),u=r?a:e.standardDeviation("column",{unbiased:!0}),f=s.transpose().mmul(e);for(let c=0;c<f.rows;c++)for(let h=0;h<f.columns;h++)f.set(c,h,f.get(c,h)*(1/(a[c]*u[h]))*(1/(s.rows-1)));return f}let Tf=class{constructor(e,t={}){const{assumeSymmetric:r=!1}=t;if(e=Cr.checkMatrix(e),!e.isSquare())throw new Error("Matrix is not a square matrix");if(e.isEmpty())throw new Error("Matrix must be non-empty");let n=e.columns,i=new ve(n,n),a=new Float64Array(n),u=new Float64Array(n),f=e,c,h,d=!1;if(r?d=!0:d=e.isSymmetric(),d){for(c=0;c<n;c++)for(h=0;h<n;h++)i.set(c,h,f.get(c,h));Hy(n,u,a,i),jy(n,u,a,i)}else{let p=new ve(n,n),v=new Float64Array(n);for(h=0;h<n;h++)for(c=0;c<n;c++)p.set(c,h,f.get(c,h));Yy(n,p,v,i),Ky(n,u,a,i,p)}this.n=n,this.e=u,this.d=a,this.V=i}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let e=this.n,t=this.e,r=this.d,n=new ve(e,e),i,a;for(i=0;i<e;i++){for(a=0;a<e;a++)n.set(i,a,0);n.set(i,i,r[i]),t[i]>0?n.set(i,i+1,t[i]):t[i]<0&&n.set(i,i-1,t[i])}return n}};function Hy(s,e,t,r){let n,i,a,u,f,c,h,d;for(f=0;f<s;f++)t[f]=r.get(s-1,f);for(u=s-1;u>0;u--){for(d=0,a=0,c=0;c<u;c++)d=d+Math.abs(t[c]);if(d===0)for(e[u]=t[u-1],f=0;f<u;f++)t[f]=r.get(u-1,f),r.set(u,f,0),r.set(f,u,0);else{for(c=0;c<u;c++)t[c]/=d,a+=t[c]*t[c];for(n=t[u-1],i=Math.sqrt(a),n>0&&(i=-i),e[u]=d*i,a=a-n*i,t[u-1]=n-i,f=0;f<u;f++)e[f]=0;for(f=0;f<u;f++){for(n=t[f],r.set(f,u,n),i=e[f]+r.get(f,f)*n,c=f+1;c<=u-1;c++)i+=r.get(c,f)*t[c],e[c]+=r.get(c,f)*n;e[f]=i}for(n=0,f=0;f<u;f++)e[f]/=a,n+=e[f]*t[f];for(h=n/(a+a),f=0;f<u;f++)e[f]-=h*t[f];for(f=0;f<u;f++){for(n=t[f],i=e[f],c=f;c<=u-1;c++)r.set(c,f,r.get(c,f)-(n*e[c]+i*t[c]));t[f]=r.get(u-1,f),r.set(u,f,0)}}t[u]=a}for(u=0;u<s-1;u++){if(r.set(s-1,u,r.get(u,u)),r.set(u,u,1),a=t[u+1],a!==0){for(c=0;c<=u;c++)t[c]=r.get(c,u+1)/a;for(f=0;f<=u;f++){for(i=0,c=0;c<=u;c++)i+=r.get(c,u+1)*r.get(c,f);for(c=0;c<=u;c++)r.set(c,f,r.get(c,f)-i*t[c])}}for(c=0;c<=u;c++)r.set(c,u+1,0)}for(f=0;f<s;f++)t[f]=r.get(s-1,f),r.set(s-1,f,0);r.set(s-1,s-1,1),e[0]=0}function jy(s,e,t,r){let n,i,a,u,f,c,h,d,p,v,x,_,y,m,w,D;for(a=1;a<s;a++)e[a-1]=e[a];e[s-1]=0;let C=0,b=0,F=Number.EPSILON;for(c=0;c<s;c++){for(b=Math.max(b,Math.abs(t[c])+Math.abs(e[c])),h=c;h<s&&!(Math.abs(e[h])<=F*b);)h++;if(h>c)do{for(n=t[c],d=(t[c+1]-n)/(2*e[c]),p=Dn(d,1),d<0&&(p=-p),t[c]=e[c]/(d+p),t[c+1]=e[c]*(d+p),v=t[c+1],i=n-t[c],a=c+2;a<s;a++)t[a]-=i;for(C=C+i,d=t[h],x=1,_=x,y=x,m=e[c+1],w=0,D=0,a=h-1;a>=c;a--)for(y=_,_=x,D=w,n=x*e[a],i=x*d,p=Dn(d,e[a]),e[a+1]=w*p,w=e[a]/p,x=d/p,d=x*t[a]-w*n,t[a+1]=i+w*(x*n+w*t[a]),f=0;f<s;f++)i=r.get(f,a+1),r.set(f,a+1,w*r.get(f,a)+x*i),r.set(f,a,x*r.get(f,a)-w*i);d=-w*D*y*m*e[c]/v,e[c]=w*d,t[c]=x*d}while(Math.abs(e[c])>F*b);t[c]=t[c]+C,e[c]=0}for(a=0;a<s-1;a++){for(f=a,d=t[a],u=a+1;u<s;u++)t[u]<d&&(f=u,d=t[u]);if(f!==a)for(t[f]=t[a],t[a]=d,u=0;u<s;u++)d=r.get(u,a),r.set(u,a,r.get(u,f)),r.set(u,f,d)}}function Yy(s,e,t,r){let n=0,i=s-1,a,u,f,c,h,d,p;for(d=n+1;d<=i-1;d++){for(p=0,c=d;c<=i;c++)p=p+Math.abs(e.get(c,d-1));if(p!==0){for(f=0,c=i;c>=d;c--)t[c]=e.get(c,d-1)/p,f+=t[c]*t[c];for(u=Math.sqrt(f),t[d]>0&&(u=-u),f=f-t[d]*u,t[d]=t[d]-u,h=d;h<s;h++){for(a=0,c=i;c>=d;c--)a+=t[c]*e.get(c,h);for(a=a/f,c=d;c<=i;c++)e.set(c,h,e.get(c,h)-a*t[c])}for(c=0;c<=i;c++){for(a=0,h=i;h>=d;h--)a+=t[h]*e.get(c,h);for(a=a/f,h=d;h<=i;h++)e.set(c,h,e.get(c,h)-a*t[h])}t[d]=p*t[d],e.set(d,d-1,p*u)}}for(c=0;c<s;c++)for(h=0;h<s;h++)r.set(c,h,c===h?1:0);for(d=i-1;d>=n+1;d--)if(e.get(d,d-1)!==0){for(c=d+1;c<=i;c++)t[c]=e.get(c,d-1);for(h=d;h<=i;h++){for(u=0,c=d;c<=i;c++)u+=t[c]*r.get(c,h);for(u=u/t[d]/e.get(d,d-1),c=d;c<=i;c++)r.set(c,h,r.get(c,h)+u*t[c])}}}function Ky(s,e,t,r,n){let i=s-1,a=0,u=s-1,f=Number.EPSILON,c=0,h=0,d=0,p=0,v=0,x=0,_=0,y=0,m,w,D,C,b,F,B,M,O,A,N,I,L,k,z;for(m=0;m<s;m++)for((m<a||m>u)&&(t[m]=n.get(m,m),e[m]=0),w=Math.max(m-1,0);w<s;w++)h=h+Math.abs(n.get(m,w));for(;i>=a;){for(C=i;C>a&&(x=Math.abs(n.get(C-1,C-1))+Math.abs(n.get(C,C)),x===0&&(x=h),!(Math.abs(n.get(C,C-1))<f*x));)C--;if(C===i)n.set(i,i,n.get(i,i)+c),t[i]=n.get(i,i),e[i]=0,i--,y=0;else if(C===i-1){if(B=n.get(i,i-1)*n.get(i-1,i),d=(n.get(i-1,i-1)-n.get(i,i))/2,p=d*d+B,_=Math.sqrt(Math.abs(p)),n.set(i,i,n.get(i,i)+c),n.set(i-1,i-1,n.get(i-1,i-1)+c),M=n.get(i,i),p>=0){for(_=d>=0?d+_:d-_,t[i-1]=M+_,t[i]=t[i-1],_!==0&&(t[i]=M-B/_),e[i-1]=0,e[i]=0,M=n.get(i,i-1),x=Math.abs(M)+Math.abs(_),d=M/x,p=_/x,v=Math.sqrt(d*d+p*p),d=d/v,p=p/v,w=i-1;w<s;w++)_=n.get(i-1,w),n.set(i-1,w,p*_+d*n.get(i,w)),n.set(i,w,p*n.get(i,w)-d*_);for(m=0;m<=i;m++)_=n.get(m,i-1),n.set(m,i-1,p*_+d*n.get(m,i)),n.set(m,i,p*n.get(m,i)-d*_);for(m=a;m<=u;m++)_=r.get(m,i-1),r.set(m,i-1,p*_+d*r.get(m,i)),r.set(m,i,p*r.get(m,i)-d*_)}else t[i-1]=M+d,t[i]=M+d,e[i-1]=_,e[i]=-_;i=i-2,y=0}else{if(M=n.get(i,i),O=0,B=0,C<i&&(O=n.get(i-1,i-1),B=n.get(i,i-1)*n.get(i-1,i)),y===10){for(c+=M,m=a;m<=i;m++)n.set(m,m,n.get(m,m)-M);x=Math.abs(n.get(i,i-1))+Math.abs(n.get(i-1,i-2)),M=O=.75*x,B=-.4375*x*x}if(y===30&&(x=(O-M)/2,x=x*x+B,x>0)){for(x=Math.sqrt(x),O<M&&(x=-x),x=M-B/((O-M)/2+x),m=a;m<=i;m++)n.set(m,m,n.get(m,m)-x);c+=x,M=O=B=.964}for(y=y+1,b=i-2;b>=C&&(_=n.get(b,b),v=M-_,x=O-_,d=(v*x-B)/n.get(b+1,b)+n.get(b,b+1),p=n.get(b+1,b+1)-_-v-x,v=n.get(b+2,b+1),x=Math.abs(d)+Math.abs(p)+Math.abs(v),d=d/x,p=p/x,v=v/x,!(b===C||Math.abs(n.get(b,b-1))*(Math.abs(p)+Math.abs(v))<f*(Math.abs(d)*(Math.abs(n.get(b-1,b-1))+Math.abs(_)+Math.abs(n.get(b+1,b+1))))));)b--;for(m=b+2;m<=i;m++)n.set(m,m-2,0),m>b+2&&n.set(m,m-3,0);for(D=b;D<=i-1&&(k=D!==i-1,D!==b&&(d=n.get(D,D-1),p=n.get(D+1,D-1),v=k?n.get(D+2,D-1):0,M=Math.abs(d)+Math.abs(p)+Math.abs(v),M!==0&&(d=d/M,p=p/M,v=v/M)),M!==0);D++)if(x=Math.sqrt(d*d+p*p+v*v),d<0&&(x=-x),x!==0){for(D!==b?n.set(D,D-1,-x*M):C!==b&&n.set(D,D-1,-n.get(D,D-1)),d=d+x,M=d/x,O=p/x,_=v/x,p=p/d,v=v/d,w=D;w<s;w++)d=n.get(D,w)+p*n.get(D+1,w),k&&(d=d+v*n.get(D+2,w),n.set(D+2,w,n.get(D+2,w)-d*_)),n.set(D,w,n.get(D,w)-d*M),n.set(D+1,w,n.get(D+1,w)-d*O);for(m=0;m<=Math.min(i,D+3);m++)d=M*n.get(m,D)+O*n.get(m,D+1),k&&(d=d+_*n.get(m,D+2),n.set(m,D+2,n.get(m,D+2)-d*v)),n.set(m,D,n.get(m,D)-d),n.set(m,D+1,n.get(m,D+1)-d*p);for(m=a;m<=u;m++)d=M*r.get(m,D)+O*r.get(m,D+1),k&&(d=d+_*r.get(m,D+2),r.set(m,D+2,r.get(m,D+2)-d*v)),r.set(m,D,r.get(m,D)-d),r.set(m,D+1,r.get(m,D+1)-d*p)}}}if(h!==0){for(i=s-1;i>=0;i--)if(d=t[i],p=e[i],p===0)for(C=i,n.set(i,i,1),m=i-1;m>=0;m--){for(B=n.get(m,m)-d,v=0,w=C;w<=i;w++)v=v+n.get(m,w)*n.get(w,i);if(e[m]<0)_=B,x=v;else if(C=m,e[m]===0?n.set(m,i,B!==0?-v/B:-v/(f*h)):(M=n.get(m,m+1),O=n.get(m+1,m),p=(t[m]-d)*(t[m]-d)+e[m]*e[m],F=(M*x-_*v)/p,n.set(m,i,F),n.set(m+1,i,Math.abs(M)>Math.abs(_)?(-v-B*F)/M:(-x-O*F)/_)),F=Math.abs(n.get(m,i)),f*F*F>1)for(w=m;w<=i;w++)n.set(w,i,n.get(w,i)/F)}else if(p<0)for(C=i-1,Math.abs(n.get(i,i-1))>Math.abs(n.get(i-1,i))?(n.set(i-1,i-1,p/n.get(i,i-1)),n.set(i-1,i,-(n.get(i,i)-d)/n.get(i,i-1))):(z=Fo(0,-n.get(i-1,i),n.get(i-1,i-1)-d,p),n.set(i-1,i-1,z[0]),n.set(i-1,i,z[1])),n.set(i,i-1,0),n.set(i,i,1),m=i-2;m>=0;m--){for(A=0,N=0,w=C;w<=i;w++)A=A+n.get(m,w)*n.get(w,i-1),N=N+n.get(m,w)*n.get(w,i);if(B=n.get(m,m)-d,e[m]<0)_=B,v=A,x=N;else if(C=m,e[m]===0?(z=Fo(-A,-N,B,p),n.set(m,i-1,z[0]),n.set(m,i,z[1])):(M=n.get(m,m+1),O=n.get(m+1,m),I=(t[m]-d)*(t[m]-d)+e[m]*e[m]-p*p,L=(t[m]-d)*2*p,I===0&&L===0&&(I=f*h*(Math.abs(B)+Math.abs(p)+Math.abs(M)+Math.abs(O)+Math.abs(_))),z=Fo(M*v-_*A+p*N,M*x-_*N-p*A,I,L),n.set(m,i-1,z[0]),n.set(m,i,z[1]),Math.abs(M)>Math.abs(_)+Math.abs(p)?(n.set(m+1,i-1,(-A-B*n.get(m,i-1)+p*n.get(m,i))/M),n.set(m+1,i,(-N-B*n.get(m,i)-p*n.get(m,i-1))/M)):(z=Fo(-v-O*n.get(m,i-1),-x-O*n.get(m,i),_,p),n.set(m+1,i-1,z[0]),n.set(m+1,i,z[1]))),F=Math.max(Math.abs(n.get(m,i-1)),Math.abs(n.get(m,i))),f*F*F>1)for(w=m;w<=i;w++)n.set(w,i-1,n.get(w,i-1)/F),n.set(w,i,n.get(w,i)/F)}for(m=0;m<s;m++)if(m<a||m>u)for(w=m;w<s;w++)r.set(m,w,n.get(m,w));for(w=s-1;w>=a;w--)for(m=a;m<=u;m++){for(_=0,D=a;D<=Math.min(w,u);D++)_=_+r.get(m,D)*n.get(D,w);r.set(m,w,_)}}}function Fo(s,e,t,r){let n,i;return Math.abs(t)>Math.abs(r)?(n=r/t,i=t+n*r,[(s+n*e)/i,(e-n*s)/i]):(n=t/r,i=r+n*t,[(n*s+e)/i,(n*e-s)/i])}class $f{constructor(e){if(e=Cr.checkMatrix(e),!e.isSymmetric())throw new Error("Matrix is not symmetric");let t=e,r=t.rows,n=new ve(r,r),i=!0,a,u,f;for(u=0;u<r;u++){let c=0;for(f=0;f<u;f++){let h=0;for(a=0;a<f;a++)h+=n.get(f,a)*n.get(u,a);h=(t.get(u,f)-h)/n.get(f,f),n.set(u,f,h),c=c+h*h}for(c=t.get(u,u)-c,i&=c>0,n.set(u,u,Math.sqrt(Math.max(c,0))),f=u+1;f<r;f++)n.set(u,f,0)}this.L=n,this.positiveDefinite=!!i}isPositiveDefinite(){return this.positiveDefinite}solve(e){e=Cr.checkMatrix(e);let t=this.L,r=t.rows;if(e.rows!==r)throw new Error("Matrix dimensions do not match");if(this.isPositiveDefinite()===!1)throw new Error("Matrix is not positive definite");let n=e.columns,i=e.clone(),a,u,f;for(f=0;f<r;f++)for(u=0;u<n;u++){for(a=0;a<f;a++)i.set(f,u,i.get(f,u)-i.get(a,u)*t.get(f,a));i.set(f,u,i.get(f,u)/t.get(f,f))}for(f=r-1;f>=0;f--)for(u=0;u<n;u++){for(a=f+1;a<r;a++)i.set(f,u,i.get(f,u)-i.get(a,u)*t.get(a,f));i.set(f,u,i.get(f,u)/t.get(f,f))}return i}get lowerTriangularMatrix(){return this.L}}class Lf{constructor(e,t={}){e=Cr.checkMatrix(e);let{Y:r}=t;const{scaleScores:n=!1,maxIterations:i=1e3,terminationCriteria:a=1e-10}=t;let u;if(r){if(gr.isAnyArray(r)&&typeof r[0]=="number"?r=ve.columnVector(r):r=Cr.checkMatrix(r),r.rows!==e.rows)throw new Error("Y should have the same number of rows as X");u=r.getColumnVector(0)}else u=e.getColumnVector(0);let f=1,c,h,d,p;for(let v=0;v<i&&f>a;v++)d=e.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),d=d.div(d.norm()),c=e.mmul(d).div(d.transpose().mmul(d).get(0,0)),v>0&&(f=c.clone().sub(p).pow(2).sum()),p=c.clone(),r?(h=r.transpose().mmul(c).div(c.transpose().mmul(c).get(0,0)),h=h.div(h.norm()),u=r.mmul(h).div(h.transpose().mmul(h).get(0,0))):u=c;if(r){let v=e.transpose().mmul(c).div(c.transpose().mmul(c).get(0,0));v=v.div(v.norm());let x=e.clone().sub(c.clone().mmul(v.transpose())),_=u.transpose().mmul(c).div(c.transpose().mmul(c).get(0,0)),y=r.clone().sub(c.clone().mulS(_.get(0,0)).mmul(h.transpose()));this.t=c,this.p=v.transpose(),this.w=d.transpose(),this.q=h,this.u=u,this.s=c.transpose().mmul(c),this.xResidual=x,this.yResidual=y,this.betas=_}else this.w=d.transpose(),this.s=c.transpose().mmul(c).sqrt(),n?this.t=c.clone().div(this.s.get(0,0)):this.t=c,this.xResidual=e.sub(c.mmul(d.transpose()))}}We.AbstractMatrix=ke,We.CHO=$f,We.CholeskyDecomposition=$f,We.DistanceMatrix=bo,We.EVD=Tf;var Zy=We.EigenvalueDecomposition=Tf;We.LU=Co,We.LuDecomposition=Co;var Rf=We.Matrix=ve;We.MatrixColumnSelectionView=My,We.MatrixColumnView=By,We.MatrixFlipColumnView=Ny,We.MatrixFlipRowView=Sy,We.MatrixRowSelectionView=Iy,We.MatrixRowView=Oy,We.MatrixSelectionView=Eo,We.MatrixSubView=Ty,We.MatrixTransposeView=$y,We.NIPALS=Lf,We.Nipals=Lf,We.QR=ru,We.QrDecomposition=ru,We.SVD=Ii,We.SingularValueDecomposition=Ii,We.SymmetricMatrix=si,We.WrapperMatrix1D=Of,We.WrapperMatrix2D=Cr,We.correlation=Wy,We.covariance=Uy;var Pf=We.default=ve;We.determinant=Ao,We.inverse=Ry,We.linearDependencies=zy,We.pseudoInverse=qy,We.solve=If,We.wrap=Ly;const kf=Zy,zf=Rf;Pf.Matrix&&Pf.Matrix;class Vy{constructor(e){q(this,"_errorListener");this._errorListener=e}new({rows:e,columns:t,initial_value:r}={}){return new nu(e,t,r,this._errorListener)}avg({id:e}){return e==null?void 0:e.avg()}col({id:e,column:t}){return e==null?void 0:e.col({column:t})}det({id:e}){return e==null?void 0:e.det()}get({id:e,row:t,column:r}){return e==null?void 0:e.get({row:t,column:r})}inv({id:e}){return e==null?void 0:e.inv()}max({id:e}){return e==null?void 0:e.max()}min({id:e}){return e==null?void 0:e.min()}pow({id:e,power:t}){return e==null?void 0:e.pow({power:t})}row({id:e,row:t}){return e==null?void 0:e.row({row:t})}set({id:e,row:t,column:r,value:n}){e==null||e.set({row:t,column:r,value:n})}sum({id1:e,id2:t}){return e==null?void 0:e.sum({id2:t})}copy({id:e}){return e==null?void 0:e.copy()}diff({id1:e,id2:t}){return e==null?void 0:e.diff({id2:t})}rows({id:e}){return e==null?void 0:e.rows()}columns({id:e}){return e==null?void 0:e.columns()}fill({id:e,value:t,from_row:r,to_row:n,from_column:i,to_column:a}){e==null||e.fill({value:t,from_row:r,to_row:n,from_column:i,to_column:a})}kron({id1:e,id2:t}){return e==null?void 0:e.kron({id2:t})}mode({id:e}){return e==null?void 0:e.mode()}mult({id1:e,id2:t}){return e==null?void 0:e.mult({id2:t})}pinv({id:e}){return e==null?void 0:e.pinv()}rank({id:e}){return e==null?void 0:e.rank()}sort({id:e,column:t,order:r}){e==null||e.sort({column:t,order:r})}trace({id:e}){return e==null?void 0:e.trace()}concat({id1:e,id2:t}){return e==null?void 0:e.concat({id2:t})}median({id:e}){return e==null?void 0:e.median()}add_col({id:e,column:t,array_id:r}){e==null||e.add_col({column:t,array_id:r})}add_row({id:e,row:t,array_id:r}){e==null||e.add_row({row:t,array_id:r})}is_zero({id:e}){return e==null?void 0:e.is_zero()}reshape({id:e,rows:t,columns:r},n){return e==null?void 0:e.reshape({rows:t,columns:r},n)}reverse({id:e}){e==null||e.reverse()}is_binary({id:e}){return e==null?void 0:e.is_binary()}is_square({id:e}){return e==null?void 0:e.is_square()}submatrix({id:e,from_row:t,to_row:r,from_column:n,to_column:i}){return e==null?void 0:e.submatrix({from_row:t,to_row:r,from_column:n,to_column:i})}swap_rows({id:e,row1:t,row2:r}){e==null||e.swap_rows({row1:t,row2:r})}transpose({id:e}){return e==null?void 0:e.transpose()}remove_col({id:e,column:t}){return e==null?void 0:e.remove_col({column:t})}remove_row({id:e,row:t}){return e==null?void 0:e.remove_row({row:t})}eigenvalues({id:e}){return e==null?void 0:e.eigenvalues()}is_diagonal({id:e}){return e==null?void 0:e.is_diagonal()}is_identity({id:e}){return e==null?void 0:e.is_identity()}eigenvectors({id:e}){return e==null?void 0:e.eigenvectors()}is_symmetric({id:e}){return e==null?void 0:e.is_symmetric()}swap_columns({id:e,column1:t,column2:r}){e==null||e.swap_columns({column1:t,column2:r})}is_stochastic({id:e}){return e==null?void 0:e.is_stochastic()}is_triangular({id:e}){return e==null?void 0:e.is_triangular()}elements_count({id:e}){return e==null?void 0:e.elements_count()}is_antidiagonal({id:e}){return e==null?void 0:e.is_antidiagonal()}is_antisymmetric({id:e}){return e==null?void 0:e.is_antisymmetric()}}class nu{constructor(e=0,t=0,r=void 0,n){q(this,"_matrixInstance");q(this,"_errorListener");this._matrixInstance=this._createMatrix(e,t,r),this._errorListener=n}get _matrixArray(){return this._matrixInstance.map(e=>[...e._value])}get _value(){return this._matrixInstance}set _value(e){this._matrixInstance=e}get isMatrix(){return!0}_createMatrix(e,t,r){return Array.from(new Array(e),()=>new it(t,r,this._errorListener))}avg(){let e=0,t=0;for(const n of this._matrixInstance)for(const i of n._value)e+=me(i)?0:i,t+=1;return e/t}col({column:e}){const t=[],r=new it(0,void 0,this._errorListener);if(me(e))return r;for(const n of this._matrixInstance)t.push(n._value[e]);return r._value=t,r}det(){return Cf(this._matrixArray)}get({row:e,column:t}){var r,n;if(!(me(e)||me(t)))return(n=(r=this._matrixInstance[e])==null?void 0:r._value)==null?void 0:n[t]}inv(){const e=xo(this._matrixArray);return this._newMatrix(e)}max(){return Hx(this._matrixArray)}min(){return Qa(this._matrixArray)}pow({power:e}){const t=me(e)?this._matrixArray:Yx(this._matrixArray,e);return this._newMatrix(t)}row({row:e}){return me(e)?new it(0,void 0,this._errorListener):this._matrixInstance[e]}set({row:e,column:t,value:r}){me(e)||me(t)||this._matrixInstance[e].set({index:t,value:r})}sum({id2:e}){const t=hs(this._matrixArray,typeof e=="number"?e:e._matrixArray);return this._newMatrix(t)}copy(){return this._newMatrix(this._matrixArray)}diff({id2:e}){const t=Px(this._matrixArray,typeof e=="number"?e:e._matrixArray);return this._newMatrix(t)}rows(){return this._matrixInstance.length}columns(){return this._matrixArray.length&&this._matrixArray[0].length}fill({value:e,from_row:t,to_row:r,from_column:n,to_column:i}={}){me(t)&&(t=0),me(r)&&(r=this.rows()),me(n)&&(n=0),me(i)&&(i=this.columns());for(const[a,u]of this._matrixInstance.entries())for(const[f]of u._value.entries())a<r&&a>=t&&f>=n&&f<i&&u.set({index:f,value:e})}kron({id2:e}){const t=Lx(this._matrixArray,e._matrixArray);return this._newMatrix(t)}mode(){return Qa(mf(this._matrixArray))}mult({id2:e}){const t=typeof e=="number"?e:e._matrixArray?e._matrixArray:e._value,r=Mi(this._matrixArray,t);return this._newMatrix(r)}pinv(){const e=jx(this._matrixArray);return this._newMatrix(e)}rank(){return this._matrixRank(this._matrixArray)}sort({column:e,order:t=Jn.ascending}={}){me(e)&&(e=0),this._matrixInstance.sort((r,n)=>{const i=r._value[e],a=n._value[e];return t!==Jn.descending?i-a:a-i})}trace(){return Wx(this._matrixArray)}concat({id2:e}){for(const t of e._value)this._matrixInstance.push(t);return this}median(){return Af(this._matrixArray)}add_col({column:e,array_id:t}={}){me(e)&&(e=this.columns());for(const[r,n]of this._matrixInstance.entries())n.insert({index:e,value:t?t._value[r]:void 0})}add_row({row:e,array_id:t}){me(e)&&(e=this.rows()),this._matrixInstance.splice(e,0,t||new it(this.columns(),void 0,this._errorListener))}is_zero(){return this._matrixArray.every(e=>e.every(t=>t===0))}reshape({rows:e=0,columns:t=0},r){if(e*t!==this.columns()*this.rows()){this._errorListener.addError(ct.matrixRehapeErr,r,Ze.Error);return}const n=Ox(this._matrixArray,[e,t]);this._matrixInstance=n.map(i=>{const a=new it(0,void 0,this._errorListener);return a._value=[...i],a})}reverse(){this._matrixInstance.reverse();for(const e of this._matrixInstance)e.reverse()}is_binary(){return this._matrixArray.every(e=>e.every(t=>t===0||t===1))}is_square(){return this.rows()===this.columns()}submatrix({from_row:e,to_row:t,from_column:r,to_column:n}={}){me(e)&&(e=0),me(t)&&(t=this.rows()),me(r)&&(r=0),me(n)&&(n=this.columns());const i=this._matrixArray.splice(e,t),a=[];for(const u of i)a.push(u.splice(r,n));return this._newMatrix(a)}swap_rows({row1:e,row2:t}){if(me(e)||me(t))return;const r=this._matrixInstance[e],n=this._matrixInstance[t];this._matrixInstance[e]=n,this._matrixInstance[t]=r}transpose(){const e=yf(this._matrixArray);return this._newMatrix(e)}remove_col({column:e}={}){me(e)&&(e=this.columns());const t=[];for(const n of this._matrixInstance){const i=n._value.splice(e,1);t.push(i[0])}const r=new it(0,void 0,this._errorListener);return r._value=t,r}remove_row({row:e}={}){return me(e)&&(e=this.rows()),this._matrixInstance.splice(e,1)[0]}eigenvalues(){const e=new kf(new zf(this._matrixArray)),t=new it(0,void 0,this._errorListener);return t._value=e.realEigenvalues,t}is_diagonal(){const e=this.rows(),t=this.columns();if(e!==t)return!1;const r=this._matrixArray;for(let n=0;n<e;n++)for(let i=0;i<t;i++)if(n!==i&&r[n][i]!==0)return!1;return!0}is_identity(){const e=this.rows(),t=this.columns();if(e!==t)return!1;const r=this._matrixArray;for(let n=0;n<e;n++)for(let i=0;i<t;i++)if(n!==i&&r[n][i]!==0||n===i&&r[n][i]!==1)return!1;return!0}eigenvectors(){const e=new kf(new zf(this._matrixArray));return this._newMatrix(e.eigenvectorMatrix.to2DArray())}is_symmetric(){const e=this.rows(),t=this.columns();if(e!==t)return!1;const r=this._matrixArray;for(let n=0;n<e;n++)for(let i=n+1;i<t;i++)if(r[n][i]!==r[i][n])return!1;return!0}swap_columns({column1:e,column2:t}){if(!(me(e)||me(t)))for(const r of this._matrixInstance){const n=r._value[e],i=r._value[t];r.set({index:e,value:i}),r.set({index:t,value:n})}}is_stochastic(){const e=this._matrixArray;for(let t=0;t<e.length;t++){let r=0;for(let n=0;n<e[t].length;n++){if(e[t][n]<0)return!1;r+=e[t][n]}if(Math.abs(r-1)>Number.EPSILON)return!1}return!0}is_triangular(){const e=this.rows(),t=this.columns();return e!==t?!1:this._isUpperTriangular(e)||this._isLowerTriangular(e)}elements_count(){return Ix(this._matrixArray)}is_antidiagonal(){const e=this.rows(),t=this.columns();if(e!==t)return!1;const r=this._matrixArray;for(let n=0;n<e;n++)for(let i=0;i<e;i++)if(n+i!==e-1&&r[n][i]!==0)return!1;return!0}is_antisymmetric(){const e=this.rows(),t=this.columns();if(e!==t)return!1;const r=this._matrixArray;for(let n=0;n<e;n++)for(let i=0;i<e;i++)if(n!==i&&r[n][i]!==-r[i][n])return!1;return!0}_isUpperTriangular(e){const t=this._matrixArray;for(let r=1;r<e;r++)for(let n=0;n<r;n++)if(t[r][n]!==0)return!1;return!0}_isLowerTriangular(e){const t=this._matrixArray;for(let r=0;r<e-1;r++)for(let n=r+1;n<e;n++)if(t[r][n]!==0)return!1;return!0}_newMatrix(e){const t=new nu(0,0,void 0,this._errorListener);return t._value=e.map(r=>{const n=new it(0,void 0,this._errorListener);return n._value=[...r],n}),t}_matrixRank(e){let t=0;const r=e.length,n=e[0].length,i=[...e].map(a=>[...a]);for(let a=0;a<r&&!(a>=n);a++){let u=a;for(;u<r&&i[u][a]===0;)u++;if(u===r)continue;if(u!==a){const c=i[u];i[u]=i[a],i[a]=c}const f=i[a][a];for(let c=0;c<n;c++)i[a][c]/=f;for(let c=a+1;c<r;c++){const h=i[c][a];i[c]=i[c].map((d,p)=>d-h*i[a][p]),i[c][a]=0}}for(let a=0;a<r;a++)i[a].some(u=>Number(u.toFixed(8))!==0)&&t++;return t}}class Gy{constructor(e){q(this,"_variables");q(this,"_cacheData");this._variables=e,this._cacheData={}}change({timeframe:e},t){if(!e)return!0;const r=pn(e),n=pn(this._variables.timeframe.period);if(r<n)return!0;const i=`change_${t}`,a=this._cacheData[i],u=this._variables.time;if(a){if(a.offset){if(a.currentTime+a.offset<=u)return this._cacheData[i]={currentTime:u,offset:0},!0}else if(a.currentTime+r*1e3<=u)return this._cacheData[i]={currentTime:u,offset:0},!0}else{const f=this._calcTimeOffset(u,e);return this._cacheData[i]={currentTime:u,offset:f},!1}return!1}in_seconds({timeframe:e}={}){return pn(e||this._variables.timeframe.period)}from_seconds({seconds:e=0}){const t=e*1e3,r=ot.duration(t);if(r.years())return"12M";const i=r.asMonths();if(go(i))return`${i}M`;const a=r.asWeeks();if(go(a))return`${a}M`;const u=r.asDays();if(u>=1)return`${Math.ceil(u)}D`;const f=r.asMinutes();if(f>=1)return`${Math.ceil(f)}`;const c=r.asSeconds();return c<=1?"1S":c<=5?"5S":c<=10?"10S":c<=15?"15S":c<=30?"30S":"1"}_calcTimeOffset(e,t){let r=0;if(t.includes("W")){const u=ot(e).day();t="1D",u!==1&&(r=(8-u)*60*60*24*1e3)}else if(t.includes("M")){const u=ot(e).date();t="1D";const f=ot(e).daysInMonth();u!==1&&(r=(f-u+1)*60*60*24*1e3)}const n=this._variables.getTimeTradingday(e,t),i=pn(t)*1e3,a=e-n-Math.floor((e-n)/i)*i;return r?r-a:a}}class Xy{constructor(e,t){q(this,"_errorListener");q(this,"_intlNumberFormatter");q(this,"_precision");this._errorListener=e,this._precision=t,this._intlNumberFormatter=new Intl.NumberFormat("en",{notation:"compact"})}pos({source:e="",str:t=""}){return e==null?void 0:e.indexOf(t)}trim({source:e=""}){return e==null?void 0:e.trim()}lower({source:e=""}){return e==null?void 0:e.toLocaleLowerCase()}match({source:e="",regex:t=""}){const r=e==null?void 0:e.match(new RegExp(t));return r?r[0]:""}split({string:e="",separator:t=""}){const r=e==null?void 0:e.split(t),n=new it;return n._value=r||[],n}upper({source:e=""}){return e==null?void 0:e.toLocaleUpperCase()}format({formatString:e=""},t){return this._strFormat(e,t)}length({string:e=""}){return e==null?void 0:e.length}repeat({source:e="",repeat:t,separator:r=""},n){if(me(t)){this._errorListener.addError(ct.arrLenErr,n,Ze.Error);return}return Array.from(new Array(t),()=>e).join(r)}replace({source:e="",target:t="",replacement:r="",occurrence:n}){me(n)&&(n=0);let i=-1;for(let a=0;a<n+1&&(i=e.indexOf(t,i+1),i!==-1);a++);return i!==-1?e.substring(0,i)+r+e.substring(i+t.length):e}contains({source:e="",str:t=""}){return e==null?void 0:e.includes(t)}endswith({source:e="",str:t=""}){return e==null?void 0:e.endsWith(t)}tonumber({string:e=""}){if(/[^\d.]/.test(e))return;const t=parseFloat(e);return isNaN(t)?void 0:t}tostring({value:e,format:t}){if(e===void 0)return"NaN";if(typeof e=="object"){if(e.isArray)return this._arrToStr(e._value,t);if(e.isMatrix){const r=[];for(const n of e._matrixArray)r.push(this._arrToStr(n,t));return r.join(`
62
+ `)}}if(typeof e=="string")return e;if(typeof e=="boolean")return String(e);if(typeof e=="number")return String(this._toStringFormat(e,t))}_arrToStr(e,t){return`[${e.map(n=>typeof n=="number"?this._toStringFormat(n,t):n).toString()}]`}substring({source:e="",begin_pos:t=0,end_pos:r}){return me(t)&&(t=0),me(r)&&(r=void 0),e==null?void 0:e.substring(t,r)}startswith({source:e="",str:t=""}){return e==null?void 0:e.startsWith(t)}format_time({time:e,format:t="yyyy-MM-dd'T'HH:mm:ssZ",timezone:r}){return me(e)&&(e=0),Kr(e,r).format(t)}replace_all({source:e="",target:t="",replacement:r=""}){return e==null?void 0:e.replace(new RegExp(t,"g"),r)}_toStringFormat(e,t){if(!t)return e;switch(t){case Je.mintick:return e.toFixed(this._precision);case Je.price:return`${e}%`;case Je.volume:return this._intlNumberFormatter.format(Math.round(e));default:const[r,n]=t.split(".");let[i,a=""]=String(e).split(".");if(r.includes("#")?i=r.replace(/#/,i).replace(/#/g,""):i=`${r}${i}`,n&&n.includes("#")){const u=n.split("#").length-1;a=`${a.substring(0,u)}${n.replace(/#/g,"")}`}else a=n||"";return a?`${i}.${a}`:i}}_formatNumber(e,t){if(!t)return e;switch(t){case"integer":return String(Math.round(e));case"currency":return`$${e}`;case"percent":return`${e*100}%`;default:const r=t.split(".")[1],n=r?r.length:0;return parseFloat(e.toFixed(n))}}_strFormat(e,t){let r=e;return t.forEach((n,i)=>{if(typeof n=="number"){const a=`\\{\\s*${i}\\s*,\\s*number\\s*,\\s*([^\\}]+)\\s*\\}`,u=e.match(new RegExp(a));if(u){const f=u[1];r=r.replace(new RegExp(a,"g"),String(this._formatNumber(n,f)))}else r=r.replace(new RegExp(`\\{${i}\\}`,"g"),String(n))}else r=r.replace(new RegExp(`\\{${i}\\}`,"g"),n)}),r}}class Qy{constructor(e){q(this,"_errorListener");this._errorListener=e}new(){return new iu(this._errorListener)}copy({id:e}){return e==null?void 0:e.copy()}get({id:e,key:t}){return e==null?void 0:e.get({key:t})}put({id:e,key:t,value:r}){return e==null?void 0:e.put({key:t,value:r})}keys({id:e}){return e==null?void 0:e.keys()}size({id:e}){return e==null?void 0:e.size()}clear({id:e}){e==null||e.clear()}remove({id:e,key:t}){return e==null?void 0:e.remove({key:t})}values({id:e}){return e==null?void 0:e.values()}put_all({id:e,id2:t}){e==null||e.put_all({id2:t})}contains({id:e,key:t}){return e==null?void 0:e.contains({key:t})}}class iu{constructor(e){q(this,"_errorListener");q(this,"_mapInstance");this._errorListener=e,this._mapInstance=new Map}get isMap(){return!0}_copyMap(e){const t=new iu(this._errorListener);return t._mapInstance=new Map(e.entries()),t}copy(){return this._copyMap(this._mapInstance)}get({key:e}){return this._mapInstance.get(e)}put({key:e,value:t}){return this._mapInstance.set(e,t)}keys(){const e=new it(0,void 0,this._errorListener);return e._value=[...this._mapInstance.keys()],e}size(){return this._mapInstance.size}clear(){this._mapInstance.clear()}remove({key:e}){const t=this._mapInstance.get(e);return this._mapInstance.delete(e),t||void 0}values(){const e=new it(0,void 0,this._errorListener);return e._value=[...this._mapInstance.values()],e}put_all({id2:e}){this._mapInstance=new Map([...this._mapInstance,...e._mapInstance])}contains({key:e}){return this._mapInstance.has(e)}}class Jy{constructor(e){q(this,"_variables");this._variables=e}new({price:e,time:t,index:r}){return new Ti(e,r,t)}now({price:e}){const{time:t,bar_index:r}=this._variables;return new Ti(e,r,t)}copy({id:e}){return e==null?void 0:e.copy()}from_index({price:e,index:t}){return new Ti(e,t)}from_time({price:e,time:t}){return new Ti(e,void 0,t)}}class Ti{constructor(e,t,r){q(this,"_index");q(this,"_price");q(this,"_time");this._index=t,this._price=e,this._time=r}get index(){return this._index}get price(){return this._price}get time(){return this._time}copy(){return new Ti(this._price,this._index,this._time)}}class eD{constructor(e,t){q(this,"_variables");q(this,"_errorListener");q(this,"_defaultLabel",{text:"",xloc:bt.bar_index,yloc:Gr.price,size:ar.normal,style:gt.styleLabelDown,textalign:je.alignCenter});this._variables=e,this._errorListener=t}new(e,t){const{time:r,high:n,low:i,bar_index:a}=this._variables,u=`label_${t}_${a}`,f={...this._defaultLabel,...e,id:u,time:r};e.point&&(f.x=f.xloc===bt.bar_index?e.point.index:e.point.time,f.y=e.point.price),f.yloc===Gr.abovebar?f.y=n:f.yloc===Gr.belowbar&&(f.y=i),this._verfiyArgs(e,t);const c=new ps(u,this._variables,this._errorListener);return t.startsWith("export")||this._variables.label.add(u,f,c),c}_verfiyArgs(e,t){const{xloc:r,yloc:n,style:i,size:a,textalign:u,text_font_family:f}=e,c="label.new";this._paramVerfiy(i,t,c,Object.values(gt),"style"),this._paramVerfiy(r,t,c,Object.values(bt),"xloc"),this._paramVerfiy(n,t,c,Object.values(Gr),"yloc"),this._paramVerfiy(a,t,c,Object.values(ar),"size"),this._paramVerfiy(u,t,c,[je.alignLeft,je.alignCenter,je.alignRight],"textalign"),this._paramVerfiy(f,t,c,Object.values(ei),"text_font_family")}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}label(e,t){return e.x?e.x:new ps(t,this._variables,this._errorListener)}copy({id:e},t){return e==null?void 0:e.copy(t)}get_x({id:e},t){return e==null?void 0:e.get_x(t)}get_y({id:e},t){return e==null?void 0:e.get_y(t)}set_x({id:e,...t},r){e==null||e.set_x(t,r)}set_y({id:e,...t},r){e==null||e.set_y(t,r)}delete({id:e}){e==null||e.delete()}get_text({id:e},t){return e==null?void 0:e.get_text(t)}set_xy({id:e,...t},r){e==null||e.set_xy(t,r)}set_size({id:e,...t},r){e==null||e.set_size(t,r)}set_xloc({id:e,...t},r){e==null||e.set_xloc(t,r)}set_yloc({id:e,...t},r){e==null||e.set_yloc(t,r)}set_style({id:e,...t},r){e==null||e.set_style(t,r)}set_color({id:e,...t},r){e==null||e.set_color(t,r)}set_tooltip({id:e,...t},r){e==null||e.set_tooltip(t,r)}set_point({id:e,...t},r){e==null||e.set_point(t,r)}set_text({id:e,...t},r){e==null||e.set_text(t,r)}set_textcolor({id:e,...t},r){e==null||e.set_textcolor(t,r)}set_textalign({id:e,...t},r){e==null||e.set_textalign(t,r)}set_text_font_family({id:e,...t},r){e==null||e.set_text_font_family(t,r)}}class ps{constructor(e,t,r){q(this,"_id");q(this,"_variables");q(this,"_errorListener");this._id=e,this._variables=t,this._errorListener=r}copy(e){const t=`label_${e}_${this._variables.bar_index}`,r=this._getLabel(e),n=new ps(t,this._variables,this._errorListener);if(r){const i={...r,id:t};this._variables.label.add(t,i,n)}return n}get_x(e){var t;return(t=this._getLabel(e))==null?void 0:t.x}get_y(e){var t;return(t=this._getLabel(e))==null?void 0:t.y}set_x({x:e},t){const r=this._getLabel(t);r&&(r.x=e)}set_y({y:e},t){const r=this._getLabel(t);r&&(r.y=e)}delete(){this._variables.label.delete(this._id)}set_xy({x:e,y:t},r){const n=this._getLabel(r);n&&(n.x=e,n.y=t)}get_text(e){var t;return(t=this._getLabel(e))==null?void 0:t.text}set_size({size:e},t){const r=this._getLabel(t);r&&(r.size=e),this._paramVerfiy(e,t,"label.set_size",Object.values(ar),"size")}set_text({text:e},t){const r=this._getLabel(t);r&&(r.text=e)}set_xloc({x:e,xloc:t},r){const n=this._getLabel(r);n&&(n.x=e,n.xloc=t,this._paramVerfiy(t,r,"label.set_xloc",Object.values(bt),"xloc"))}set_yloc({yloc:e},t){const r=this._getLabel(t),{high:n,low:i}=this._variables;r&&(r.yloc=e,e===Gr.abovebar?r.y=n:e===Gr.belowbar&&(r.y=i),this._paramVerfiy(e,t,"label.set_yloc",Object.values(Gr),"yloc"))}set_color({color:e},t){const r=this._getLabel(t);r&&(r.color=e)}set_point({point:e},t){const r=this._getLabel(t);r&&(r.x=r.xloc===bt.bar_index?e==null?void 0:e.index:e==null?void 0:e.time,r.y=e==null?void 0:e.price)}set_style({style:e},t){const r=this._getLabel(t);r&&(r.style=e),this._paramVerfiy(e,t,"label.set_style",Object.values(gt),"style")}set_tooltip({tooltip:e},t){const r=this._getLabel(t);r&&(r.tooltip=e)}set_textalign({textalign:e},t){const r=this._getLabel(t);r&&(r.textalign=e),this._paramVerfiy(e,t,"label.set_textalign",[je.alignLeft,je.alignCenter,je.alignRight],"textalign")}set_textcolor({textcolor:e},t){const r=this._getLabel(t);r&&(r.textcolor=e)}set_text_font_family({text_font_family:e},t){const r=this._getLabel(t);r&&(r.text_font_family=e),this._paramVerfiy(e,t,"label.set_text_font_family",Object.values(ei),"text_font_family")}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}_getLabel(e){const t=this._variables.label.get(this._id);return t||console.log(`错误${e}: label 不存在`),t}}const tD={freq_all:Zr.freqAll,freq_once_per_bar:Zr.freqOncePerBar,freq_once_per_bar_close:Zr.freqOncePerBarClose},rD={gaps_off:ss.gapsOff,gaps_on:ss.gapsOn,lookahead_off:ss.lookaheadOff,lookahead_on:ss.lookaheadOn},$i={aqua:"#00BCD4",black:"#363A45",blue:"#2196F3",fuchsia:"#E040FB",gray:"#787B86",green:"#4CAF50",lime:"#00E676",maroon:"#880E4F",navy:"#311B92",olive:"#808000",orange:"#FF9800",purple:"#9C27B0",red:"#FF5252",silver:"#B2B5BE",teal:"#00897B",white:"#FFFFFF",yellow:"#FFEB3B"},qf={AUD:"AUD",BTC:"BTC",CAD:"CAD",CHF:"CHF",ETH:"ETH",EUR:"EUR",GBP:"GBP",HKD:"HKD",INR:"INR",JPY:"JPY",KRW:"KRW",MYR:"MYR",NOK:"NOK",NONE:"NONE",NZD:"NZD",RUB:"RUB",SEK:"SEK",SGD:"SGD",TRY:"TRY",USD:"USD",USDT:"USDT",ZAR:"ZAR"},nD={friday:6,monday:2,saturday:7,sunday:1,thursday:5,tuesday:3,wednesday:4},Uf={all:[Vt.dataWindow,Vt.pane,Vt.priceScale,Vt.statusLine],data_window:[Vt.dataWindow],none:[],pane:[Vt.pane],price_scale:[Vt.priceScale],status_line:[Vt.statusLine]},iD={both:Vr.both,left:Vr.left,none:Vr.none,right:Vr.right},sD={inherit:Je.inherit,mintick:Je.mintick,percent:Je.percent,price:Je.price,volume:Je.volume},oD={style_solid:qs.styleSolid,style_dashed:qs.styleDashed,style_dotted:qs.styleDotted},aD={style_arrowdown:gt.styleArrowdown,style_arrowup:gt.styleArrowup,style_circle:gt.styleCircle,style_cross:gt.styleCross,style_diamond:gt.styleDiamond,style_flag:gt.styleFlag,style_label_center:gt.styleLabelCenter,style_label_down:gt.styleLabelDown,style_label_left:gt.styleLabelLeft,style_label_lower_left:gt.styleLabelLowerLeft,style_label_lower_right:gt.styleLabelLowerRight,style_label_right:gt.styleLabelRight,style_label_up:gt.styleLabelUp,style_label_upper_left:gt.styleLabelUpperLeft,style_label_upper_right:gt.styleLabelUpperRight,style_none:gt.styleNone,style_square:gt.styleSquare,style_text_outline:gt.styleTextOutline,style_triangledown:gt.styleTriangledown,style_triangleup:gt.styleTriangleup,style_xcross:gt.styleXcross},uD={style_arrow_both:qt.styleArrowBoth,style_arrow_left:qt.styleArrowLeft,style_arrow_right:qt.styleArrowRight,style_dashed:qt.styleDashed,style_dotted:qt.styleDotted,style_solid:qt.styleSolid},lD={abovebar:vn.abovebar,absolute:vn.absolute,belowbar:vn.belowbar,bottom:vn.bottom,top:vn.top},cD={e:2.718281828459045,phi:1.618033988749895,pi:3.141592653589793,rphi:.6180339887498948},fD={style_area:Or.styleArea,style_areabr:Or.styleAreabr,style_circles:Or.styleCircles,style_columns:Or.styleColumns,style_cross:Or.styleCross,style_histogram:Or.styleHistogram,style_line:Or.styleLine,style_linebr:Or.styleLinebr,style_stepline:Or.styleStepline,style_stepline_diamond:Or.styleSteplineDiamond,style_steplinebr:Or.styleSteplinebr},hD={bottom_center:br.bottomCenter,bottom_left:br.bottomLeft,bottom_right:br.bottomRight,middle_center:br.middleCenter,middle_left:br.middleLeft,middle_right:br.middleRight,top_center:br.topCenter,top_left:br.topLeft,top_right:br.topRight},dD={left:Us.left,none:Us.none,right:Us.right},pD={arrowdown:_r.arrowdown,arrowup:_r.arrowup,circle:_r.circle,cross:_r.cross,diamond:_r.diamond,flag:_r.flag,labeldown:_r.labeldown,labelup:_r.labelup,square:_r.square,triangledown:_r.triangledown,triangleup:_r.triangleup,xcross:_r.xcross},_D={auto:ar.auto,huge:ar.huge,large:ar.large,normal:ar.normal,small:ar.small,tiny:ar.tiny},vD={cash:Rt.cash,fixed:Rt.fixed,percent_of_equity:Rt.percentOfEquity,commission:{cash_per_contract:Ir.cashPerContract,cash_per_order:Ir.cashPerOrder,percent:Ir.percent},direction:{all:mt.all,long:mt.long,short:mt.short},oca:{cancel:gn.cancel,none:gn.none,reduce:gn.reduce}},gD={align_bottom:je.alignBottom,align_center:je.alignCenter,align_left:je.alignLeft,align_right:je.alignRight,align_top:je.alignTop,wrap_auto:je.wrapAuto,wrap_none:je.wrapNone},mD={bar_index:bt.bar_index,bar_time:bt.bar_time},xD={abovebar:Gr.abovebar,belowbar:Gr.belowbar,price:Gr.price},yD={actual:Ws.actual,estimate:Ws.estimate,standardized:Ws.standardized};class Wf{constructor(){q(this,"adjustment",{dividends:zs.dividends,none:zs.none,splits:zs.splits});q(this,"alert",tD);q(this,"barmerge",rD);q(this,"color",$i);q(this,"currency",qf);q(this,"dayofweek",nD);q(this,"earnings",yD);q(this,"display",Uf);q(this,"extend",iD);q(this,"font",{family_default:ei.familyDefault,family_monospace:ei.familyMonospace});q(this,"format",sD);q(this,"hline",oD);q(this,"label",aD);q(this,"line",uD);q(this,"location",lD);q(this,"math",cD);q(this,"order",{ascending:Jn.ascending,descending:Jn.descending});q(this,"plot",fD);q(this,"position",hD);q(this,"scale",dD);q(this,"session",{extended:yi.extended,regular:yi.regular});q(this,"shape",pD);q(this,"size",_D);q(this,"splits",{denominator:"denominator",numerator:"numerator"});q(this,"strategy",vD);q(this,"text",gD);q(this,"xloc",mD);q(this,"yloc",xD)}updateData(){}}class DD{constructor(e,t){q(this,"_variables");q(this,"_errorListener");q(this,"_defaultPolyline",{curved:!1,closed:!1,xloc:bt.bar_index,line_color:$i.blue,line_style:qt.styleSolid,line_width:1});this._variables=e,this._errorListener=t}new(e,t){var a;const r=`polyline_${t}_${this._variables.bar_index}`,n=Object.assign({},this._defaultPolyline,e,{id:r,points:(a=e.points)==null?void 0:a._value.map(u=>({time:u.time,index:u.index,price:u.price}))}),i=new Hf(r,this._variables);return this._verfiyArgs(e,t),t.startsWith("export")||this._variables.polyline.add(r,n,i),i}_verfiyArgs(e,t){const{line_style:r,xloc:n}=e,i="polyline.new";this._paramVerfiy(r,t,i,Object.values(qt),"line_style"),this._paramVerfiy(n,t,i,Object.values(bt),"xloc")}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}delete({id:e}){e&&e.delete()}}class Hf{constructor(e,t){q(this,"_id");q(this,"_variables");this._variables=t,this._id=e}delete(){this._variables.polyline.delete(this._id)}}class wD{constructor(e,t){q(this,"_variables");q(this,"_errorListener");q(this,"_defaultLine",{xloc:bt.bar_index,extend:Vr.none,style:qt.styleSolid});this._variables=e,this._errorListener=t}new({first_point:e,second_point:t,...r},n){const i=`line_${n}_${this._variables.bar_index}`,a={...this._defaultLine,...r,id:i};if(e&&t){const f=a.xloc===bt.bar_index?e.index:e.time,c=a.xloc===bt.bar_index?t.index:t.time;Object.assign(a,{x1:f,y1:e.price,x2:c,y2:t.price})}this._verfiyArgs(r,n);const u=new _s(i,this._variables,this._errorListener);return n.startsWith("export")||this._variables.line.add(i,a,u),u}_verfiyArgs(e,t){const{extend:r,xloc:n,style:i}=e,a="line.new";this._paramVerfiy(i,t,a,Object.values(qt),"style"),this._paramVerfiy(r,t,a,Object.values(Vr),"extend"),this._paramVerfiy(n,t,a,Object.values(bt),"xloc")}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}line(e,t){return e.x?e.x:new _s(t,this._variables,this._errorListener)}copy({id:e},t){return e==null?void 0:e.copy(t)}delete({id:e}){e==null||e.delete()}get_x1({id:e},t){return e==null?void 0:e.get_x1(t)}get_x2({id:e},t){return e==null?void 0:e.get_x2(t)}get_y1({id:e},t){return e==null?void 0:e.get_y1(t)}get_y2({id:e},t){return e==null?void 0:e.get_y2(t)}set_x1({id:e,...t},r){e==null||e.set_x1(t,r)}set_x2({id:e,...t},r){e==null||e.set_x2(t,r)}set_y1({id:e,...t},r){e==null||e.set_y1(t,r)}set_y2({id:e,...t},r){e==null||e.set_y2(t,r)}set_xy1({id:e,...t},r){e==null||e.set_xy1(t,r)}set_xy2({id:e,...t},r){e==null||e.set_xy2(t,r)}set_xloc({id:e,...t},r){e==null||e.set_xloc(t,r)}get_price({id:e,...t},r){return e==null?void 0:e.get_price(t,r)}set_color({id:e,...t},r){e==null||e.set_color(t,r)}set_style({id:e,...t},r){e==null||e.set_style(t,r)}set_width({id:e,...t},r){e==null||e.set_width(t,r)}set_extend({id:e,...t},r){e==null||e.set_extend(t,r)}set_first_point({id:e,...t},r){e==null||e.set_first_point(t,r)}set_second_point({id:e,...t},r){e==null||e.set_second_point(t,r)}}class _s{constructor(e,t,r){q(this,"_variables");q(this,"_id");q(this,"_errorListener");this._id=e,this._variables=t,this._errorListener=r}get data(){return this._variables.line.get(this._id)}copy(e){const t=`line_${e}_${this._variables.bar_index}`,r=this._getLine(e),n=new _s(t,this._variables,this._errorListener);return r&&this._variables.line.add(t,{...r,id:t},n),n}delete(){this._variables.line.delete(this._id)}get_price({x:e},t){const r=this._getLine(t);if(e===void 0)return e;if(r&&r.xloc===bt.bar_index){const{x1:n,y1:i,x2:a,y2:u}=r;return n===void 0||a===void 0||i===void 0||u===void 0?void 0:(u-i)/(a-n)*(e-n)+i}}get_x1(e){var t;return(t=this._getLine(e))==null?void 0:t.x1}get_x2(e){var t;return(t=this._getLine(e))==null?void 0:t.x2}get_y1(e){var t;return(t=this._getLine(e))==null?void 0:t.y1}get_y2(e){var t;return(t=this._getLine(e))==null?void 0:t.y2}set_x1({x:e},t){const r=this._getLine(t);r&&(r.x1=e)}set_x2({x:e},t){const r=this._getLine(t);r&&(r.x2=e)}set_y1({y:e},t){const r=this._getLine(t);r&&(r.y1=e)}set_y2({y:e},t){const r=this._getLine(t);r&&(r.y2=e)}set_xy1({x:e,y:t},r){const n=this._getLine(r);n&&(n.x1=e,n.y1=t)}set_xy2({x:e,y:t},r){const n=this._getLine(r);n&&(n.x2=e,n.y2=t)}set_xloc({xloc:e,x1:t,x2:r},n){const i=this._getLine(n);i&&(i.xloc=e,i.x1=t,i.x2=r,this._paramVerfiy(e,n,"line.set_xloc",Object.values(bt),"xloc"))}set_color({color:e},t){const r=this._getLine(t);r&&(r.color=e)}set_style({style:e},t){const r=this._getLine(t);r&&(r.style=e,this._paramVerfiy(e,t,"line.set_style",Object.values(qt),"style"))}set_width({width:e},t){const r=this._getLine(t);r&&(r.width=e)}set_extend({extend:e},t){const r=this._getLine(t);r&&(r.extend=e,this._paramVerfiy(e,t,"line.set_extend",Object.values(Vr),"extend"))}set_first_point({point:e},t){const r=this._getLine(t);if(r){const{index:n,time:i,price:a}=e||{},u=r.xloc===bt.bar_index?n:i,f=a;u&&(r.x1=u),f&&(r.y1=f)}}set_second_point({point:e},t){const r=this._getLine(t);if(r){const{index:n,time:i,price:a}=e||{},u=r.xloc===bt.bar_index?n:i,f=a;u&&(r.x2=u),f&&(r.y2=f)}}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}_getLine(e){const t=this._variables.line.get(this._id);return t||console.log(`${e}: line 不存在`),t}}class bD{constructor(e){q(this,"_variables");this._variables=e}new({line1:e,line2:t,color:r},n){const i=`linefill_${n}_${this._variables.bar_index}`,a=e==null?void 0:e.data,u=t==null?void 0:t.data;a&&(a.linefills=a.linefills||[],a.linefills.push(i)),u&&(u.linefills=u.linefills||[],u.linefills.push(i));const f=new Bo(this._variables,i,e,t);return n.startsWith("export")||(a||u)&&this._variables.linefill.add(i,{line1:a,line2:u,color:r,id:i},f),f}delete({id:e}){e==null||e.delete()}get_line1({id:e}){return e==null?void 0:e.get_line1()}get_line2({id:e}){return e==null?void 0:e.get_line2()}set_color({id:e,...t}){e==null||e.set_color(t)}}class Bo{constructor(e,t,r,n){q(this,"_id");q(this,"_line1");q(this,"_line2");q(this,"_variables");this._variables=e,this._id=t,this._line1=r,this._line2=n}linefill(e,t){return e.x?e.x:new Bo(this._variables,t)}delete(){var t,r;const e=this._variables.linefill.get(this._id);if(e){const{line1:n,line2:i}=e;n&&(n.linefills=(t=n.linefills)==null?void 0:t.filter(a=>a!==this._id)),i&&(i.linefills=(r=i.linefills)==null?void 0:r.filter(a=>a!==this._id))}this._line1=void 0,this._line2=void 0,this._variables.linefill.delete(this._id)}get_line1(){return this._line1}get_line2(){return this._line2}set_color({color:e}){const t=this._variables.linefill.get(this._id);t&&(t.color=e)}}class ED{constructor(e,t){q(this,"_variables");q(this,"_errorListener");q(this,"_defaultBox",{border_color:$i.blue,border_width:1,bgcolor:$i.blue,xloc:bt.bar_index,extend:Vr.none,style:qt.styleSolid,text:"",text_size:ar.auto,text_color:$i.black,text_halign:je.alignCenter,text_valign:je.alignCenter,text_wrap:je.wrapNone});this._variables=e,this._errorListener=t}box({x:e},t){return e===void 0?new vs(this._variables,t,this._errorListener):e}new({top_left:e,bottom_right:t,...r},n){const i=`box_${n}_${this._variables.bar_index}`,a={...this._defaultBox,...r,id:i};if(e){const{price:f,time:c,index:h}=e;a.top=f,a.left=a.xloc===bt.bar_index?h:c}if(t){const{price:f,time:c,index:h}=t;a.bottom=f,a.right=a.xloc===bt.bar_index?h:c}this._verfiyArgs(r,n);const u=new vs(this._variables,i,this._errorListener);return n.startsWith("export")||this._variables.box.add(i,a,u),u}_verfiyArgs(e,t){const{border_style:r,extend:n,xloc:i,text_size:a,text_halign:u,text_valign:f,text_wrap:c,text_font_family:h}=e,d="box.new";this._paramVerfiy(r,t,d,[qt.styleDashed,qt.styleDotted,qt.styleSolid],"border_style"),this._paramVerfiy(n,t,d,Object.values(Vr),"extend"),this._paramVerfiy(i,t,d,Object.values(bt),"xloc"),this._paramVerfiy(a,t,d,Object.values(ar),"text_size"),this._paramVerfiy(u,t,d,[je.alignLeft,je.alignCenter,je.alignRight],"text_halign"),this._paramVerfiy(f,t,d,[je.alignBottom,je.alignCenter,je.alignTop],"text_valign"),this._paramVerfiy(c,t,d,[je.wrapAuto,je.wrapNone],"text_wrap"),this._paramVerfiy(h,t,d,Object.values(ei),"text_font_family")}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}copy({id:e},t){return e==null?void 0:e.copy(t)}delete({id:e}){e==null||e.delete()}get_top({id:e}){return e==null?void 0:e.get_top()}get_bottom({id:e}){return e==null?void 0:e.get_bottom()}get_left({id:e}){return e==null?void 0:e.get_left()}get_right({id:e}){return e==null?void 0:e.get_right()}set_top({id:e,...t}){e==null||e.set_top(t)}set_bottom({id:e,...t}){e==null||e.set_bottom(t)}set_left({id:e,...t}){e==null||e.set_left(t)}set_right({id:e,...t}){e==null||e.set_right(t)}set_extend({id:e,...t},r){e==null||e.set_extend(t,r)}set_bgcolor({id:e,...t}){e==null||e.set_bgcolor(t)}set_border_color({id:e,...t}){e==null||e.set_border_color(t)}set_border_width({id:e,...t}){e==null||e.set_border_width(t)}set_border_style({id:e,...t},r){e==null||e.set_border_style(t,r)}set_lefttop({id:e,...t}){e==null||e.set_lefttop(t)}set_rightbottom({id:e,...t}){e==null||e.set_rightbottom(t)}set_text_size({id:e,...t},r){e==null||e.set_text_size(t,r)}set_text_wrap({id:e,...t},r){e==null||e.set_text_wrap(t,r)}set_text_color({id:e,...t}){e==null||e.set_text_color(t)}set_text_halign({id:e,...t},r){e==null||e.set_text_halign(t,r)}set_text_valign({id:e,...t},r){e==null||e.set_text_valign(t,r)}set_top_left_point({id:e,...t}){e==null||e.set_top_left_point(t)}set_bottom_right_point({id:e,...t}){e==null||e.set_bottom_right_point(t)}set_text_font_family({id:e,...t},r){e==null||e.set_text_font_family(t,r)}}class vs{constructor(e,t,r){q(this,"_id");q(this,"_variables");q(this,"_errorListener");this._variables=e,this._id=t,this._errorListener=r}copy(e){const t=`box_${e}_${this._variables.bar_index}`,r=this._getBox(),n=new vs(this._variables,t,this._errorListener);return r&&this._variables.box.add(t,{...r,id:t},n),n}delete(){this._variables.box.delete(this._id)}get_top(){const e=this._getBox();return e&&e.top}set_top({top:e}){const t=this._getBox();t&&(t.top=e)}get_left(){const e=this._getBox();return e&&e.left}set_left({left:e}){const t=this._getBox();t&&(t.left=e)}set_text({text:e}){const t=this._getBox();t&&(t.text=e)}get_right(){const e=this._getBox();return e&&e.right}set_right({right:e}){const t=this._getBox();t&&(t.right=e)}get_bottom(){const e=this._getBox();return e&&e.bottom}set_bottom({bottom:e}){const t=this._getBox();t&&(t.bottom=e)}set_extend({extend:e},t){const r=this._getBox();r&&(r.extend=e,this._paramVerfiy(e,t,"box.set_extend",Object.values(Vr),"extend"))}set_bgcolor({color:e}){const t=this._getBox();t&&(t.bgcolor=e)}set_lefttop({left:e,top:t}){const r=this._getBox();r&&(r.left=e,r.top=t)}set_text_size({text_size:e},t){const r=this._getBox();r&&(r.text_size=e,this._paramVerfiy(e,t,"box.set_text_size",Object.values(ar),"text_size"))}set_text_wrap({text_wrap:e},t){const r=this._getBox();r&&(r.text_wrap=e,this._paramVerfiy(e,t,"box.set_text_wrap",[je.wrapAuto,je.wrapNone],"text_wrap"))}set_text_color({text_color:e}){const t=this._getBox();t&&(t.text_color=e)}set_rightbottom({right:e,bottom:t}){const r=this._getBox();r&&(r.right=e,r.bottom=t)}set_text_halign({text_halign:e},t){const r=this._getBox();r&&(r.text_halign=e,this._paramVerfiy(e,t,"box.set_text_halign",[je.alignLeft,je.alignCenter,je.alignRight],"text_halign"))}set_text_valign({text_valign:e},t){const r=this._getBox();r&&(r.text_valign=e,this._paramVerfiy(e,t,"box.set_text_valign",[je.alignBottom,je.alignCenter,je.alignTop],"text_valign"))}set_top_left_point({point:e}){const t=this._getBox();if(t){const{index:r,price:n,time:i}=e||{};t.top=n,t.left=t.xloc===bt.bar_index?r:i}}set_border_color({color:e}){const t=this._getBox();t&&(t.border_color=e)}set_border_style({style:e},t){const r=this._getBox();r&&(r.border_style=e,this._paramVerfiy(e,t,"box.set_border_style",[qt.styleDashed,qt.styleDotted,qt.styleSolid],"style"))}set_border_width({width:e}){const t=this._getBox();t&&(t.border_width=e)}set_bottom_right_point({point:e}){const t=this._getBox();if(t){const{index:r,price:n,time:i}=e||{};t.bottom=n,t.right=t.xloc===bt.bar_index?r:i}}set_text_font_family({text_font_family:e},t){const r=this._getBox();r&&(r.text_font_family=e,this._paramVerfiy(e,t,"box.set_text_font_family",Object.values(ei),"text_font_family"))}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}_getBox(){return this._variables.box.get(this._id)}}class CD{constructor(e,t){q(this,"_variables");q(this,"_errorListener");q(this,"_defaultTable",{position:br.topLeft,columns:0,rows:0,frame_width:0,border_width:0});this._variables=e,this._errorListener=t}table({x:e},t){return e||new su(this._variables,t,this._errorListener)}new(e,t){const r=`table_${t}_${this._variables.bar_index}`,n={...this._defaultTable,...e,cell:[],id:r},i=new su(this._variables,r,this._errorListener);return this._paramVerfiy(e.position,t,"table.new",Object.values(br),"position"),t.startsWith("export")||this._variables.table.add(r,n,i),i}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}cell({table_id:e,...t}){e==null||e.cell(t)}cell_set_bgcolor({table_id:e,...t}){e==null||e.cell_set_bgcolor(t)}cell_set_height({table_id:e,...t}){e==null||e.cell_set_height(t)}cell_set_text({table_id:e,...t}){e==null||e.cell_set_text(t)}cell_set_text_color({table_id:e,...t}){e==null||e.cell_set_text_color(t)}cell_set_text_font_family({table_id:e,...t}){e==null||e.cell_set_text_font_family(t)}cell_set_text_halign({table_id:e,...t}){e==null||e.cell_set_text_halign(t)}cell_set_text_valign({table_id:e,...t}){e==null||e.cell_set_text_valign(t)}cell_set_text_size({table_id:e,...t}){e==null||e.cell_set_text_size(t)}cell_set_tooltip({table_id:e,...t}){e==null||e.cell_set_tooltip(t)}cell_set_width({table_id:e,...t}){e==null||e.cell_set_width(t)}clear({table_id:e,...t}){e==null||e.clear(t)}delete({table_id:e}){e==null||e.delete()}merge_cells({table_id:e,...t},r){e==null||e.merge_cells(t,r)}set_bgcolor({table_id:e,...t}){e==null||e.set_bgcolor(t)}set_border_color({table_id:e,...t}){e==null||e.set_border_color(t)}set_border_width({table_id:e,...t}){e==null||e.set_border_width(t)}set_frame_color({table_id:e,...t}){e==null||e.set_frame_color(t)}set_frame_width({table_id:e,...t}){e==null||e.set_frame_width(t)}set_position({table_id:e,...t},r){e==null||e.set_position(t,r)}}class su{constructor(e,t,r){q(this,"_id");q(this,"_variables");q(this,"_errorListener");q(this,"_defaultCell",{column:0,row:0,text:"",text_color:$i.black,text_halign:je.alignCenter,text_valign:je.alignCenter,text_size:ar.normal});this._variables=e,this._id=t,this._errorListener=r}cell(e){const t={...this._defaultCell,...e},{column:r=0,row:n=0}=t,i=this._variables.table.get(this._id);if(i){const a=i.cell||[],u=a[n]||[];u[r]=t,a[n]=u,i.cell=a}}cell_set_bgcolor({column:e=0,row:t=0,bgcolor:r}){const n=this._getTableItem(e,t);n&&(n.bgcolor=r)}cell_set_height({column:e=0,row:t=0,height:r}){const n=this._getTableItem(e,t);n&&(n.height=r)}cell_set_text({column:e=0,row:t=0,text:r}){const n=this._getTableItem(e,t);n&&(n.text=r)}cell_set_text_color({column:e=0,row:t=0,text_color:r}){const n=this._getTableItem(e,t);n&&(n.text_color=r)}cell_set_text_font_family({column:e=0,row:t=0,text_font_family:r}){const n=this._getTableItem(e,t);n&&(n.text_font_family=r)}cell_set_text_halign({column:e=0,row:t=0,text_halign:r}){const n=this._getTableItem(e,t);n&&(n.text_halign=r)}cell_set_text_valign({column:e=0,row:t=0,text_valign:r}){const n=this._getTableItem(e,t);n&&(n.text_valign=r)}cell_set_text_size({column:e=0,row:t=0,text_size:r}){const n=this._getTableItem(e,t);n&&(n.text_size=r)}cell_set_tooltip({column:e=0,row:t=0,tooltip:r}){const n=this._getTableItem(e,t);n&&(n.tooltip=r)}cell_set_width({column:e=0,row:t=0,width:r}){const n=this._getTableItem(e,t);n&&(n.width=r)}clear({start_column:e=0,start_row:t=0,end_column:r=0,end_row:n=0}){const i=this._variables.table.get(this._id);if(i){const a=i.cell;if(a)for(let u=t;u<=n;u++)for(let f=e;f<=r;f++){const c=a[u];c&&(c[f]=void 0)}}}delete(){this._variables.table.delete(this._id)}merge_cells({start_column:e=0,start_row:t=0,end_column:r=0,end_row:n=0},i){if(e>r||t>n){console.log(`error ${i}: start_column > end_column or start_row > end_row`);return}const a=this._getTableItem(e,t);if(!a)return;this.clear({start_column:e,start_row:t,end_column:r,end_row:n});const u=this._variables.table.get(this._id);u.cell[t][e]={...a,isMerge:!0,merge_columns:r-e+1,merge_rows:n-t+1}}set_bgcolor({bgcolor:e}){const t=this._variables.table.get(this._id);t&&(t.bgcolor=e)}set_border_color({border_color:e}){const t=this._variables.table.get(this._id);t&&(t.border_color=e)}set_border_width({border_width:e}){const t=this._variables.table.get(this._id);t&&(t.border_width=e)}set_frame_color({frame_color:e}){const t=this._variables.table.get(this._id);t&&(t.frame_color=e)}set_frame_width({frame_width:e}){const t=this._variables.table.get(this._id);t&&(t.frame_width=e)}set_position({position:e},t){const r=this._variables.table.get(this._id);r&&(r.position=e,this._paramVerfiy(e,t,"table.set_position",Object.values(br),"position"))}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}_getTableItem(e,t){const r=this._variables.table.get(this._id);if(r){const n=r.cell;return n?n[t][e]:void 0}}}class AD{constructor(e){q(this,"_strategy");this._strategy=e}commission({trade_num:e}){return this._verifyTradeNum(e)&&this._strategy.historyOrders[e].commission||0}entry_bar_index({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.historyOrders[e].in_index}entry_comment({trade_num:e}){if(!this._verifyTradeNum(e))return"";const{comment:t,id:r}=this._strategy.historyOrders[e];return t||r}entry_id({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].id:""}entry_price({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.historyOrders[e].in_price}entry_time({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.historyOrders[e].in_time}exit_bar_index({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.historyOrders[e].out_index}exit_comment({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].out_comment:""}exit_id({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].out_id:""}exit_price({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.historyOrders[e].out_price}exit_time({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.historyOrders[e].out_time}max_drawdown({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].trading_loss:0}max_drawdown_percent({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].trading_loss_percent:0}max_runup({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].max_profit:0}max_runup_percent({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].max_profit_percent:0}profit({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].profit:0}profit_percent({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].profit_percent:0}size({trade_num:e}){if(!this._verifyTradeNum(e))return 0;const{out_qty:t=0,direction:r}=this._strategy.historyOrders[e];return r===mt.long?t:-t}_verifyTradeNum(e){if(typeof e!="number"||e<0)return!1;const t=this._strategy.historyOrders.length;return!(e>=t)}}class FD{constructor(e){q(this,"_strategy");this._strategy=e}commission({trade_num:e}){if(!this._verifyTradeNum(e))return 0;const{qty:t=0,original_qty:r=0,commission:n=0}=this._strategy.orders[e];return n*t/r}entry_bar_index({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.orders[e].in_index}entry_comment({trade_num:e}){if(!this._verifyTradeNum(e))return"";const{comment:t,id:r}=this._strategy.orders[e];return t||r}entry_id({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.orders[e].id:""}entry_price({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.orders[e].in_price}entry_time({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.orders[e].in_time}max_drawdown({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.orders[e].trading_loss:0}max_drawdown_percent({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.orders[e].trading_loss_percent:0}max_runup({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.orders[e].max_profit:0}max_runup_percent({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.orders[e].max_profit_percent:0}profit({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.orders[e].profit:0}profit_percent({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.orders[e].profit_percent:0}size({trade_num:e}){if(!this._verifyTradeNum(e))return 0;const{qty:t=0,direction:r}=this._strategy.orders[e];return r===mt.long?t:-t}_verifyTradeNum(e){if(typeof e!="number"||e<0)return!1;const t=this._strategy.orders.length;return!(e>=t)}}class BD{constructor(e,t){q(this,"_strategy");q(this,"_errorListener");this._strategy=e,this._errorListener=t}allow_entry_in({value:e},t){this._paramVerfiy(e,t,"strategy.risk.allow_entry_in",Object.values(mt),"value"),this._strategy.updateRisk({allow_entry_in:e})}max_cons_loss_days({count:e}){this._strategy.updateRisk({max_cons_loss_days:e})}max_drawdown({value:e,type:t},r){this._paramVerfiy(t,r,"strategy.risk.max_drawdown",[Rt.percentOfEquity,Rt.cash],"type"),t===Rt.percentOfEquity&&(e=e>100?100:e),this._strategy.updateRisk({max_drawdown:e,max_drawdown_type:t})}max_intraday_filled_orders({count:e}){this._strategy.updateRisk({max_intraday_filled_orders:e})}max_intraday_loss({value:e,type:t},r){this._paramVerfiy(t,r,"strategy.risk.max_intraday_loss",[Rt.percentOfEquity,Rt.cash],"type"),t===Rt.percentOfEquity&&(e=e>100?100:e),this._strategy.updateRisk({max_intraday_loss:e,max_intraday_loss_type:t})}max_position_size({contracts:e}){this._strategy.updateRisk({max_position_size:e})}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}}let MD=class{constructor(e,t,r,n){q(this,"_variables");q(this,"_options");q(this,"_totalChangeCapital");q(this,"_historyOrder");q(this,"_orders");q(this,"_pendingOrders");q(this,"_mintick");q(this,"_funcOptions");q(this,"_pendingCloseOrders");q(this,"_errorListener");q(this,"_risk");q(this,"_opentrades");q(this,"_closedtrades");q(this,"_riskNamespace");this._variables=e,this._errorListener=n,this._options={overlay:!1,format:Je.inherit,pyramiding:0,calc_on_order_fills:!1,calc_on_every_tick:!1,max_bars_back:0,backtest_fill_limits_assumption:0,default_qty_type:Rt.fixed,default_qty_value:1,initial_capital:1e6,currency:qf.NONE,slippage:0,commission_type:Ir.percent,commission_value:0,process_orders_on_close:!1,close_entries_rule:"FIFO",margin_long:0,margin_short:0,explicit_plot_zorder:!1,max_lines_count:50,max_labels_count:50,max_boxes_count:50,calc_bars_count:0,risk_free_rate:2,use_bar_magnifier:!1,fill_orders_on_standard_ohlc:!1,max_polylines_count:50},this._funcOptions=t,this._totalChangeCapital=0,this._orders=[],this._pendingOrders=[],this._historyOrder=[],this._pendingCloseOrders=[],this._mintick=r,this._variables.strategy.updateOrders(this._orders),this._variables.strategy.updateHistoryOrders(this._historyOrder),this._variables.strategy.updateStrategyOptions(this._options),this._risk={intradayOrders:0},this._opentrades=new FD(this),this._closedtrades=new AD(this),this._riskNamespace=new BD(this,n)}get orders(){return[...this._orders]}get historyOrders(){return[...this._historyOrder]}get _orderProfit(){return this._orders.reduce((e,t)=>e+(t.profit||0),0)}get _freezeCapital(){const{close:e}=this._variables;return this._orders.reduce((t,r)=>t+e*(r.qty||0),0)}get opentrades(){return this._opentrades}get closedtrades(){return this._closedtrades}get risk(){return this._riskNamespace}updateOptions(e){Object.assign(this._options,e),this._maxConsLossDaysVerify(),this._pendingOrderHandle(),this._maxIntradayFilledOrdersVerify(),this._ordersHandle(),!this._options.process_orders_on_close&&this._calcLiquidate()}updateRisk(e){Object.assign(this._risk,e)}endExecution(){this._calcProfitAndLoss(),this._variables.strategy.update(),this._maxDrawdownVerify(),this._maxIntradayLoss(),this._pendingCloseOrderHandle(),this._options.process_orders_on_close&&this._calcLiquidate()}_maxIntradayLoss(){var v;const{max_intraday_loss:e,max_intraday_loss_type:t,isDisabledOpen:r}=this._risk;if(e===void 0||!t||r)return;const{high:n,low:i,time_tradingday:a,time:u,strategy:{netprofit:f,initial_capital:c}}=this._variables;let{preNetprofit:h=0}=this._risk;u===a&&(h=f,this._risk.preNetprofit=f,this._risk.isTemporaryBan=!1);let d=h-f;d+=this._orders.reduce((x,_)=>{const{in_price:y,direction:m,qty:w=0,commission:D=0,original_qty:C=0}=_,b=m===mt.long?1:-1,F=(n-y)*w,B=(i-y)*w,M=b===1?-B:F;return x+M+w/C*D},0);let p=!1;switch(t){case Rt.cash:p=e<d;break;case Rt.percentOfEquity:const x=d/(c+f)*100;p=e<x;break}if(p){this._risk.isTemporaryBan=!0;const x=(v=this._orders[0])==null?void 0:v.direction;this._closeOrders(this._orders,x===mt.long?i:n,"Close Position (Max intraday Loss)"),this._pendingOrders=[]}}_maxIntradayFilledOrdersVerify(){const{max_intraday_filled_orders:e,intradayOrders:t=0,isDisabledOpen:r}=this._risk;if(e===void 0||r)return;const{time:n,time_tradingday:i,open:a}=this._variables;n===i&&(this._risk.intradayOrders=0,this._risk.isTemporaryBan=!1),e<=t&&(this._risk.isTemporaryBan=!0,this._closeOrders(this._orders,a,"Close Position (Max number of filled orders in one day)"),this._pendingOrders=[])}_maxConsLossDaysVerify(){const{max_cons_loss_days:e,lossDays:t=0,isDisabledOpen:r,totalProfit:n=0}=this._risk;if(e===void 0||r)return;const{time:i,time_tradingday:a,strategy:u,open:f}=this._variables;let c=t;if(i===a){const h=u.netprofit+u.openprofit;h<n?c=0:c++,Object.assign(this._risk,{lossDays:c,totalProfit:h})}e<=c&&this._riskTouchOff(f,"Close Position (Max consecutive loss days)")}_maxDrawdownVerify(){var n;const{max_drawdown:e,max_drawdown_type:t,isDisabledOpen:r}=this._risk;if(!r&&e!==void 0&&t){const{max_drawdown:i,max_drawdown_percent:a}=this._variables.strategy;let u=!1;switch(t){case Rt.percentOfEquity:u=a<i;break;case Rt.cash:u=e<i;break}if(u){const{high:f,low:c}=this._variables,h=(n=this._orders[0])==null?void 0:n.direction;this._riskTouchOff(h===mt.long?f:c,"Close Position (Max Drawdown)")}}}_riskTouchOff(e,t){this._risk.isDisabledOpen=!0,this._closeOrders(this._orders,e,t),this._pendingOrders=[]}strategy(e,t){this._variables.bar_index||(this._paramVerfiy(e.format,t,"strategy",[Je.inherit,Je.price,Je.percent,Je.volume],"format"),this._paramVerfiy(e.default_qty_type,t,"strategy",Object.values(Rt),"default_qty_type"),this._paramVerfiy(e.commission_type,t,"strategy",Object.values(Ir),"commission_type"),this._options={...e},this._variables.updateMaxLength(e),Object.assign(this._funcOptions,{strategy:this._options,scriptType:"strategy"}))}order(e,t){this._risk.isDisabledOpen||(this._paramVerfiy(e.oca_type,t,"strategy.order",Object.values(gn),"oca_type"),this._orderHandle(e))}entry(e,t){this._risk.isDisabledOpen||(this._paramVerfiy(e.oca_type,t,"strategy.entry",Object.values(gn),"oca_type"),this._entryHandle(e))}close(e){if(!this._orders.length)return;const{immediately:t}=e;t||this._options.process_orders_on_close?this._pendingCloseOrders.push({...e,place_order_type:"close"}):this._pendingOrders.push({...e,place_order_type:"close"})}close_all(e){if(typeof e=="string"&&(e={}),!this._orders.length)return;const{immediately:t}=e;t||this._options.process_orders_on_close?this._pendingCloseOrders.push({...e,place_order_type:"close_all"}):this._pendingOrders.push({...e,place_order_type:"close_all"})}cancel({id:e}){this._pendingOrders=this._pendingOrders.filter(t=>!(t.id===e&&t.place_order_type!=="close"))}cancel_all(){this._pendingOrders=this._pendingOrders.filter(e=>e.place_order_type==="close_all")}exit(e,t){this._exit(e,t)}convert_to_account({value:e}){return e}convert_to_symbol({value:e}){return e}default_entry_qty({fill_price:e}){return e?this._calcDefaultQty(e):0}_calcDefaultQty(e){const{default_qty_type:t=Rt.fixed,default_qty_value:r=1,initial_capital:n}=this._options;switch(t){case Rt.fixed:return r;case Rt.cash:return r/e;case Rt.percentOfEquity:return(n+this._orderProfit+this._totalChangeCapital)*r/100/e}}_getCapital(e,t){const{margin_long:r=0,margin_short:n=0}=this._options;return r<100&&r>0&&e===1?t=t*100/r:n<=100&&n>0&&e===-1&&(t=t*100/n),t}_calcProfitAndLoss(){const{high:e,low:t,close:r}=this._variables;for(const n of this._orders){const{in_price:i,qty:a=0,direction:u}=n,f=u===mt.long?1:-1,c=(r-i)*f*a,h=(e-i)*a,d=(t-i)*a,p=f===1?h:-d,v=f===1?-d:h;this._calcOrderPercent(n,c,p,v)}}_calcOrderPercent(e,t,r,n){const{commission_value:i}=this._options,{close:a}=this._variables,{original_qty:u=0,qty:f=0,in_price:c,max_profit:h=0,trading_loss:d=0}=e;let{commission:p=0}=e;const v=c*f;if(i){const x=this._getCommission(a,f);t=t-x,p=p*f/u,r-=p,n+=p}r=Math.max(r,h),n=Math.min(n,d),Object.assign(e,{profit:t-p,total_profit:this._totalChangeCapital+t,max_profit:r,trading_loss:n,profit_percent:t/v*100,max_profit_percent:r/v*100,trading_loss_percent:n/v*100})}_calcLiquidate(){if(!this._orders.length)return;const{high:e,low:t}=this._variables,{initial_capital:r,margin_long:n=0,margin_short:i=0,commission_value:a=0}=this._options,u=this._orders[0].direction===mt.long?1:-1,f=u===1?t:e,c=(u===1?n:i)/100;if(c<=0)return;const[h,d,p]=this._orders.reduce((m,w)=>{let[D,C,b]=m;const{in_price:F,qty:B=0,original_qty:M=0,commission:O=0}=w,A=F*B,N=f*B;if(D+=A,C+=N,a){const I=this._getCommission(f,B);b+=I+B/M*O}return[D,C,b]},[0,0,0]),v=u*(d-h),_=r+this._totalChangeCapital+v-p-d*c;if(_>=0)return;const y=Math.trunc(_/c/f)*4;this._marginCallOrders(f,y,"Margin Call")}_marginCallOrders(e,t,r){const{close_entries_rule:n="FIFO"}=this._options;if(n==="FIFO"){this._processOrders(this._orders,e,t*this._orders.length,r,r);return}for(const i of this.orders)this._processOrder(i,e,t,r,r);this._orders=this._orders.filter(i=>!i.isDeal),this._variables.strategy.updateOrders(this._orders)}_orderHandle(e){const{process_orders_on_close:t,slippage:r=0}=this._options,{orders:n,isMarketPrice:i,quantities:a,close:u,price:f,activePrice:c}=this._orderArgsParse(e),h=e.direction===mt.long?1:-1;if(a<=0)return;let d=a;if(i&&t){if(n.length){const _=this._processOrders(n,u,d,e.id,e.comment);if(_<=0)return;d=_}const v=u+h*r*this._mintick;if(!this._judgeCapitalEnough(d,v,h))return;this._ocaGroupVerify(d,e.oca_name,e.oca_type),this._calcCurrentOrder({...e,in_price:v,in_index:this._variables.bar_index,in_time:this._variables.time,qty:d,place_order_type:"order"});return}this._judgeCapitalEnough(a,f,h)&&this._addPendingOrders(e,f,d,i,c)}_judgeCapitalEnough(e,t,r){if(e<=0)return!1;const{margin_long:n=0,margin_short:i=0}=this._options;if((n===0||n===100)&&r===1||i===0&&r===-1)return!0;const u=this._getCapital(r,this._options.initial_capital+this._orderProfit+this._totalChangeCapital)-this._freezeCapital;return e*t<=u}_ocaGroupVerify(e,t,r){if(!t||!r||r===gn.none)return!1;let n=!1;switch(r){case gn.cancel:this._pendingOrders=this._pendingOrders.filter(i=>{if(i.oca_name===t)i.isCancel=!0,n=!0;else return!0});break;case gn.reduce:this._pendingOrders=this._pendingOrders.filter(i=>{const{qty:a=0,oca_name:u}=i;if(t===u){const f=a-e;return n=!0,f<=0?(i.isCancel=!0,!1):(i.qty=f,!0)}else return!0});break}return n}_processOrders(e,t,r,n,i){let a=r;for(const u of e)if(a=this._processOrder(u,t,a,n,i),a<=0)break;return this._orders=this._orders.filter(u=>!u.isDeal),this._variables.strategy.updateOrders(this._orders),a}_addPendingOrders(e,t,r,n,i){const a=this._pendingOrders.find(u=>u.id===e.id&&!u.isMarketPrice);if(a)Object.assign(a,{...e,in_price:t,isMarketPrice:n,qty:r,active_price:i});else{const u={...e,in_price:t,isMarketPrice:n,qty:r,active_price:i,place_order_type:"order"};this._pendingOrders.push(u)}}_orderArgsParse(e){const{direction:t,qty:r,stop:n}=e;let i=e.limit||0;const{close:a}=this._variables;let u=a,f=!1,c;const h=t===mt.long?1:-1,d=n&&(n-a)*h>0,{backtest_fill_limits_assumption:p=0}=this._options;p>0&&i&&(i-=p*this._mintick*h);const v=i&&(i-a)*h<0;d&&v?(c=n,u=i):d?u=n:v?u=i:f=!0;const x=r||this._calcDefaultQty(u)||1;return{orders:this._orders.filter(y=>y.direction!==t),isMarketPrice:f,activePrice:c,quantities:x,close:a,price:u}}_entryHandle(e){const{process_orders_on_close:t}=this._options,{orders:r,isMarketPrice:n,quantities:i,close:a,price:u,activePrice:f}=this._orderArgsParse(e);if(i<=0)return;if(r.length&&n&&t){this._entryOrder(r,a,i,e);return}this._judgeCapitalEnough(i,a,e.direction===mt.long?1:-1)&&this._addPendingEntry(e,u,i,n,f)}_entryOrder(e,t,r,n){const{time:i,bar_index:a}=this._variables,{slippage:u=0}=this._options,{oca_name:f,oca_type:c,direction:h,comment:d,isMarketPrice:p,id:v}=n,x=h===mt.long?1:-1;if(this._closeOrders(e,t,v,d),r=this._getAvailablePositionSize(r,h),r<=0)return;t=t+u*this._mintick*x;const _={...n,in_price:t,original_qty:r,qty:r,in_index:a,in_time:i,place_order_type:"entry"};if(p){this._calcCurrentOrder(_);return}const{pendingOrders:y,orders:m}=this._getEntryOrders(h),w=y.length+m.length;w&&w>=(this._options.pyramiding||0)||!this._judgeCapitalEnough(r,t,x)||(this._ocaGroupVerify(r,f,c),this._calcCurrentOrder(_))}_getAvailablePositionSize(e,t){const{max_position_size:r,allow_entry_in:n}=this._risk;if(n&&n!==mt.all&&n!==t)return 0;if(r===void 0)return e;const i=this._orders.reduce((a,u)=>a+(u.qty||0),0);return i?i+e>r?0:e:e>r?e-r:0}_getEntryOrders(e){const t=this._pendingOrders.filter(n=>["entry","order"].includes(n.place_order_type)&&n.direction===e),r=this._orders.filter(n=>n.direction===e);return{pendingOrders:t,orders:r}}_addPendingEntry(e,t,r,n,i){if(r=this._getAvailablePositionSize(r,e.direction),r<=0)return;const{pendingOrders:a,orders:u}=this._getEntryOrders(e.direction),f=a.length+u.length,c=a.find(h=>h.id===e.id&&h.place_order_type==="entry");if(c)Object.assign(c,{...e,in_price:t,isMarketPrice:n,qty:r,active_price:i});else if(!f||f<(this._options.pyramiding||1)){const h={...e,in_price:t,isMarketPrice:n,qty:r,active_price:i,place_order_type:"entry"};this._pendingOrders.push(h)}}_closeAllOrders(e,t){const{comment:r}=e,{bar_index:n}=this._variables,i=this._orders.filter(a=>a.in_index!==n);i.length&&(this._closeOrders(i,t,"Close position order",r),this._orders=[],this._variables.strategy.updateOrders(this._orders))}_closeOrders(e,t,r,n){for(const i of e)this._closeOrder(i,t,r,n);this._orders=this._orders.filter(i=>!i.isDeal),this._variables.strategy.updateOrders(this._orders)}_closeOrder(e,t,r,n){const{time:i,bar_index:a}=this._variables,{slippage:u=0}=this._options,{in_price:f,qty:c=0,direction:h}=e,d=h===mt.long?1:-1;t=t-d*u*this._mintick,e.isDeal=!0;const p=(t-f)*d*c,v={...e,out_price:t,out_id:r,out_index:a,out_time:i,out_comment:n,out_qty:c,profit:p};this._calcPercent(v),this._risk.intradayOrders+=1,this._historyOrder.push(v),this._variables.strategy.updateHistoryOrders(this._historyOrder)}_ordersHandle(){const e=this._orders.filter(a=>a.place_order_type==="exit"&&!a.hasExit);if(!e.length)return;const{open:t,low:r,high:n,close:i}=this._variables;for(const a of e){const{stop:u,limit:f,trail_stop_price:c,isMarketPriceLimit:h,isMarketPriceStop:d,direction:p,id:v,out_comment:x,active_price:_,trail_offset:y=0,out_qty:m,comment_loss:w,comment_profit:D,comment_trailing:C}=a;let b=c;const F=p===mt.long?1:-1;let B,M=x;if(h||d?B=t:(f&&r<=f&&n>=f&&(M=D||x,B=f),u&&r<=u&&n>=u&&(B=b?(u-b)*F>0?u:b:u,M=(b===B?C:w)||x)),B)this._processExitOnClose(a,B,{from_entry:v,comment:M,qty:m});else{let O=!1;if(_&&_<=n&&_>=r&&(b=_-y*F*this._mintick,(b-i)*F>=0&&(a.isMarketPriceStop=!0,this._options.process_orders_on_close&&(B=b)),O=!0,a.trail_stop_price=b),b)if((b-t)*F>=0&&!O)B=b;else{const A=(F===1?n:r)-y*F*this._mintick;F===1?b<t&&b>=r&&A>b&&A<i?B=b:A>b?(b=A,A>=i&&(B=A)):b<=n&&r<=b&&(B=b):b>t&&b<=n&&A<b&&A>i?B=b:A<b?(b=A,A<=i&&(B=A)):b<=n&&r<=b&&(B=b),a.trail_stop_price=b}B&&this._processExitOnClose(a,B,{from_entry:v,comment:C||x,qty:m})}}}_pendingOrderHandle(){if(!this._pendingOrders.length)return;const e=[],t=this._pendingOrders.filter(n=>n.place_order_type==="exit"),r=this._pendingOrders.filter(n=>["close","close_all"].includes(n.place_order_type||""));for(const n of r)switch(n.place_order_type){case"close":this._closeOrderHandle(n);break;case"close_all":this._closeAllOrders(n,this._variables.open);break}for(const n of this._pendingOrders){const{isCancel:i,place_order_type:a}=n;if(i)continue;let u;switch(a){case"entry":u=this._entryOrderHandle(n);break;case"order":u=this._orderOrderHandle(n);break}u&&e.push(u)}for(const n of t){const i=this._exitOrderHandle(n);i&&e.push(i)}this._pendingOrders=e}_pendingCloseOrderHandle(){if(!this._pendingCloseOrders.length)return;const e=this._pendingCloseOrders.filter(n=>n.place_order_type==="exit"),t=this._pendingCloseOrders.filter(n=>["close","close_all"].includes(n.place_order_type||"")),{close:r}=this._variables;for(const n of t)switch(n.place_order_type){case"close":this._closeOrderHandle(n,!0);break;case"close_all":this._closeAllOrders(n,r);break}for(const n of e){const{from_entry:i}=n,a=this._orders.filter(u=>!i||u.id===i&&(u.isMarketPriceLimit||u.isMarketPriceStop));for(const u of a)this._processExitOnClose(u,u.limit||u.stop||u.trail_stop_price||r,n)}this._pendingCloseOrders=[]}_entryOrderHandle(e){const{open:t,low:r,high:n}=this._variables,{isMarketPrice:i,qty:a=0,in_price:u,direction:f,active_price:c}=e;if(c&&n>=c&&r<=c)return delete e.active_price,e;let h=u;if(i&&(h=t),h<=n&&h>=r){const d=this._orders.filter(p=>p.direction!==f);this._entryOrder(d,h,a,e)}else return e}_orderOrderHandle(e){const{open:t,low:r,high:n,time:i,bar_index:a}=this._variables,{slippage:u=0}=this._options,{isMarketPrice:f,qty:c=0,in_price:h,direction:d,comment:p,oca_name:v,oca_type:x,active_price:_,id:y}=e;if(_&&n>=_&&r<=_)return delete e.active_price,e;let m=h,w=c;if(f&&(m=t),m<=n&&m>=r){const D=this._orders.filter(b=>b.direction!==d);if(D.length&&(w=this._processOrders(D,m,c,y,p),w<=0))return;const C=d===mt.long?1:-1;this._ocaGroupVerify(w,v,x),this._calcCurrentOrder({...e,in_price:m+C*u*this._mintick,in_index:a,in_time:i,qty:w});return}else return e}_closeOrderHandle(e,t){const{id:r,qty:n,qty_percent:i=100,comment:a}=e,{bar_index:u}=this._variables,f=this._orders.filter(v=>v.id===r&&v.in_index!==u&&(!v.close_qty||v.close_qty<(v.qty||0)));if(!f.length)return;let c=0;if(n?c=n:(c=f.reduce((v,x)=>v+(x.qty||0),c),c=i/100*c),c<=0)return;const{open:h,close:d}=this._variables;let p=c;for(const v of f){const{qty:x=0}=v;p<x?v.close_qty=p:(v.close_qty=x,p-=x)}this._processOrders(this._options.close_entries_rule==="ANY"?f:this._orders,t?d:h,c,`Close entry(s) order ${r}`,a)}_exitOrderHandle(e){const{from_entry:t}=e,r=this._orders.filter(n=>(!t||t===n.id)&&!n.hasExit);if(!(r.length&&!this._ordersToExit(r,e)))return e}_exit(e,t){const{profit:r,loss:n,stop:i,limit:a,trail_offset:u,trail_price:f,trail_points:c,from_entry:h="",id:d}=e;if(this._isNaN(r)&&this._isNaN(n)&&this._isNaN(i)&&this._isNaN(a)&&(this._isNaN(u)||this._isNaN(c)&&this._isNaN(f))){this._errorListener.addError(ct.strategyExitErr,t,Ze.Error);return}const p={...e,place_order_type:"exit"},v=this._orders.filter(y=>(!h||h===y.id)&&!y.hasExit),x=this._pendingOrders.filter(y=>!h||h===y.id);if(v.length){if(!this._ordersToExit(v,p))return}else if(!x.length)return;const _=this._pendingOrders.find(y=>y.id===d);_?Object.assign(_,{...e}):this._pendingOrders.push(p)}_ordersToExit(e,t){const{qty:r,qty_percent:n=100,id:i,comment:a,comment_loss:u,comment_profit:f,comment_trailing:c}=t;let h=r,d=!1;t.comment=a||i;for(const p of e){const{qty:v=0}=p,x=p.direction===mt.long?1:-1;h=r?r>=v?v:r:n/100*v,p.out_qty=h,h<v&&(d=!0),Object.assign(p,{out_comment:a||i,comment_loss:u,comment_profit:f,comment_trailing:c}),!(this._stopProfit(p,x,{...t,qty:h})||this._stopLoss(p,x,{...t,qty:h})||this._trailStopLoss(p,x,{...t,qty:h}))&&(p.place_order_type="exit")}return d}_addExitPendingCloseOrders(e){e.place_order_type="exit";const t=this._pendingCloseOrders.find(r=>r.id===e.id);t?Object.assign(t,{...e}):this._pendingCloseOrders.push(e)}_stopProfit(e,t,r){const{limit:n,profit:i,comment_profit:a,comment:u}=r;let f=n;const{close:c}=this._variables,{in_price:h}=e,{process_orders_on_close:d}=this._options;if(!this._isNaN(i)&&this._isNaN(n)&&(f=h+t*i*this._mintick),e.limit=f,f&&(f-c)*t<=0&&(e.isMarketPriceLimit=!0,r.comment=a||u,Object.assign(e,{out_comment:r.comment}),f=c,d))return this._addExitPendingCloseOrders(r),!0}_stopLoss(e,t,r){const{stop:n,loss:i,comment_loss:a,comment:u}=r;let f=n;const{close:c}=this._variables,{in_price:h}=e,{process_orders_on_close:d}=this._options;if(!this._isNaN(i)&&this._isNaN(n)&&(f=h-t*i*this._mintick),e.stop=f,f&&(f-c)*t>=0&&(e.isMarketPriceStop=!0,r.comment=a||u,Object.assign(e,{out_comment:r.comment}),f=c,d))return this._addExitPendingCloseOrders(r),!0}_trailStopLoss(e,t,r){const{trail_offset:n,trail_price:i,trail_points:a,comment_trailing:u,comment:f}=r;if(!this._isNaN(n)){const{close:c}=this._variables,{in_price:h}=e,{process_orders_on_close:d}=this._options;let p;if(this._isNaN(i)?this._isNaN(a)||(p=h+a*t*this._mintick):p=i,e.trail_offset=n,p&&(p-c)*t<=0){const v=c-n*t*this._mintick;if((v-c)*t>=0&&(e.trail_stop_price=c,e.isMarketPriceStop=!0,r.comment=u||f,Object.assign(e,{out_comment:r.comment}),d))return this._addExitPendingCloseOrders(r),!0;e.trail_stop_price=v}e.active_price=p}}_processExitOnClose(e,t,r){const{qty:n=0,comment:i,id:a}=r,{close_entries_rule:u="FIFO"}=this._options;if(u==="FIFO"){const f=this._processExitOrders(this._orders,t,n,a,i);f&&!f.hasExit?(f.hasExit=!0,Object.assign(e,{trail_stop_price:f.trail_stop_price,stop:f.stop,limit:f.limit,trail_offset:f.trail_offset,active_price:f.active_price})):f&&(e.hasExit=!0)}else e.hasExit=!0,this._processOrders([e],t,n,a,i)}_processExitOrders(e,t,r,n,i){let a=r,u;for(const f of e)if(u=f,a=this._processOrder(f,t,a,n,i),a<=0||!f.hasExit)break;return this._orders=this._orders.filter(f=>!f.isDeal),this._variables.strategy.updateOrders(this._orders),u}_processOrder(e,t,r,n,i){const{time:a,bar_index:u}=this._variables,{slippage:f=0}=this._options,{in_price:c,qty:h=0,max_profit:d=0,trading_loss:p=0,direction:v,commission:x=0,original_qty:_=0}=e,y=v===mt.long?1:-1;if(t=t-y*f*this._mintick,r<h){const m=h-r,w=(t-c)*y*r,D=d/h*r,C=p/h*r;this._calcPercent({...e,out_price:t,out_id:n,out_index:u,out_time:a,out_comment:i,profit:w,out_qty:r,max_profit:D,trading_loss:C});const b=(t-c)*y*m-x*m/_;Object.assign(e,{qty:m,profit:b,max_profit:d-D,trading_loss:p-C,total_profit:this._totalChangeCapital+b}),r=0}else{e.isDeal=!0;const m=(t-c)*y*h;this._calcPercent({...e,out_price:t,out_id:n,out_index:u,out_time:a,out_comment:i,out_qty:h,profit:m}),r-=h}return r}_calcPercent(e){const{commission_value:t}=this._options,{in_price:r,out_qty:n=0,out_price:i=0,original_qty:a=0}=e;let{profit:u=0,max_profit:f=0,trading_loss:c=0,commission:h=0}=e;f=f<0?0:f;const d=r*n;if(this._totalChangeCapital+=u,t){const p=this._getCommission(i,n);this._totalChangeCapital-=p,h=h*n/a+p,u=u-h,Object.assign(e,{commission:h,profit:u,max_profit:f})}Object.assign(e,{total_profit:this._totalChangeCapital,profit_percent:u/d*100,max_profit_percent:f/d*100,trading_loss_percent:c/d*100}),this._risk.intradayOrders+=1,this._historyOrder.push(e),this._variables.strategy.updateHistoryOrders(this._historyOrder)}_getCommission(e,t){const{commission_value:r=0,commission_type:n}=this._options,i=e*t;let a=0;switch(n){case Ir.percent:a=i*r/100;break;case Ir.cashPerContract:a=t*r;break;case Ir.cashPerOrder:a=r;break}return a}_calcCurrentOrder(e){const{commission_value:t}=this._options,{in_price:r,qty:n=0,max_profit:i=0,trading_loss:a=0}=e;let{profit:u=0}=e;const f=r*n;if(t){const c=this._getCommission(r,n);this._totalChangeCapital-=c,u=u-c,Object.assign(e,{commission:c,profit:u,total_profit:this._totalChangeCapital})}Object.assign(e,{original_qty:n,profit_percent:u/f*100,max_profit_percent:i/f*100,trading_loss_percent:a/f*100}),this._risk.intradayOrders+=1,this._orders.push(e),this._variables.strategy.updateOrders(this._orders)}_isNaN(e){return e===void 0||isNaN(e)}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}};var jf={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(ye,function(){return function(t,r,n){r.prototype.isBetween=function(i,a,u,f){var c=n(i),h=n(a),d=(f=f||"()")[0]==="(",p=f[1]===")";return(d?this.isAfter(c,u):!this.isBefore(c,u))&&(p?this.isBefore(h,u):!this.isAfter(h,u))||(d?this.isBefore(c,u):!this.isAfter(c,u))&&(p?this.isAfter(h,u):!this.isBefore(h,u))}}})})(jf);var ND=jf.exports,SD=tt(ND),Yf={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(ye,function(){return function(t,r,n){var i=r.prototype,a=function(p){var v,x=p.date,_=p.utc,y={};if(!((v=x)===null||v instanceof Date||v instanceof Array||i.$utils().u(v)||v.constructor.name!=="Object")){if(!Object.keys(x).length)return new Date;var m=_?n.utc():n();Object.keys(x).forEach(function(O){var A,N;y[A=O,N=i.$utils().p(A),N==="date"?"day":N]=x[O]});var w=y.day||(y.year||y.month>=0?1:m.date()),D=y.year||m.year(),C=y.month>=0?y.month:y.year||y.day?0:m.month(),b=y.hour||0,F=y.minute||0,B=y.second||0,M=y.millisecond||0;return _?new Date(Date.UTC(D,C,w,b,F,B,M)):new Date(D,C,w,b,F,B,M)}return x},u=i.parse;i.parse=function(p){p.date=a.bind(this)(p),u.bind(this)(p)};var f=i.set,c=i.add,h=i.subtract,d=function(p,v,x,_){_===void 0&&(_=1);var y=Object.keys(v),m=this;return y.forEach(function(w){m=p.bind(m)(v[w]*_,w)}),m};i.set=function(p,v){return v=v===void 0?p:v,p.constructor.name==="Object"?d.bind(this)(function(x,_){return f.bind(this)(_,x)},v,p):f.bind(this)(p,v)},i.add=function(p,v){return p.constructor.name==="Object"?d.bind(this)(c,p,v):c.bind(this)(p,v)},i.subtract=function(p,v){return p.constructor.name==="Object"?d.bind(this)(c,p,v,-1):h.bind(this)(p,v)}}})})(Yf);var OD=Yf.exports,ID=tt(OD),Kf={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(ye,function(){var t,r,n=1e3,i=6e4,a=36e5,u=864e5,f=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,c=31536e6,h=2628e6,d=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,p={years:c,months:h,days:u,hours:a,minutes:i,seconds:n,milliseconds:1,weeks:6048e5},v=function(F){return F instanceof C},x=function(F,B,M){return new C(F,M,B.$l)},_=function(F){return r.p(F)+"s"},y=function(F){return F<0},m=function(F){return y(F)?Math.ceil(F):Math.floor(F)},w=function(F){return Math.abs(F)},D=function(F,B){return F?y(F)?{negative:!0,format:""+w(F)+B}:{negative:!1,format:""+F+B}:{negative:!1,format:""}},C=function(){function F(M,O,A){var N=this;if(this.$d={},this.$l=A,M===void 0&&(this.$ms=0,this.parseFromMilliseconds()),O)return x(M*p[_(O)],this);if(typeof M=="number")return this.$ms=M,this.parseFromMilliseconds(),this;if(typeof M=="object")return Object.keys(M).forEach(function(k){N.$d[_(k)]=M[k]}),this.calMilliseconds(),this;if(typeof M=="string"){var I=M.match(d);if(I){var L=I.slice(2).map(function(k){return k!=null?Number(k):0});return this.$d.years=L[0],this.$d.months=L[1],this.$d.weeks=L[2],this.$d.days=L[3],this.$d.hours=L[4],this.$d.minutes=L[5],this.$d.seconds=L[6],this.calMilliseconds(),this}}return this}var B=F.prototype;return B.calMilliseconds=function(){var M=this;this.$ms=Object.keys(this.$d).reduce(function(O,A){return O+(M.$d[A]||0)*p[A]},0)},B.parseFromMilliseconds=function(){var M=this.$ms;this.$d.years=m(M/c),M%=c,this.$d.months=m(M/h),M%=h,this.$d.days=m(M/u),M%=u,this.$d.hours=m(M/a),M%=a,this.$d.minutes=m(M/i),M%=i,this.$d.seconds=m(M/n),M%=n,this.$d.milliseconds=M},B.toISOString=function(){var M=D(this.$d.years,"Y"),O=D(this.$d.months,"M"),A=+this.$d.days||0;this.$d.weeks&&(A+=7*this.$d.weeks);var N=D(A,"D"),I=D(this.$d.hours,"H"),L=D(this.$d.minutes,"M"),k=this.$d.seconds||0;this.$d.milliseconds&&(k+=this.$d.milliseconds/1e3,k=Math.round(1e3*k)/1e3);var z=D(k,"S"),R=M.negative||O.negative||N.negative||I.negative||L.negative||z.negative,V=I.format||L.format||z.format?"T":"",H=(R?"-":"")+"P"+M.format+O.format+N.format+V+I.format+L.format+z.format;return H==="P"||H==="-P"?"P0D":H},B.toJSON=function(){return this.toISOString()},B.format=function(M){var O=M||"YYYY-MM-DDTHH:mm:ss",A={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return O.replace(f,function(N,I){return I||String(A[N])})},B.as=function(M){return this.$ms/p[_(M)]},B.get=function(M){var O=this.$ms,A=_(M);return A==="milliseconds"?O%=1e3:O=A==="weeks"?m(O/p[A]):this.$d[A],O||0},B.add=function(M,O,A){var N;return N=O?M*p[_(O)]:v(M)?M.$ms:x(M,this).$ms,x(this.$ms+N*(A?-1:1),this)},B.subtract=function(M,O){return this.add(M,O,!0)},B.locale=function(M){var O=this.clone();return O.$l=M,O},B.clone=function(){return x(this.$ms,this)},B.humanize=function(M){return t().add(this.$ms,"ms").locale(this.$l).fromNow(!M)},B.valueOf=function(){return this.asMilliseconds()},B.milliseconds=function(){return this.get("milliseconds")},B.asMilliseconds=function(){return this.as("milliseconds")},B.seconds=function(){return this.get("seconds")},B.asSeconds=function(){return this.as("seconds")},B.minutes=function(){return this.get("minutes")},B.asMinutes=function(){return this.as("minutes")},B.hours=function(){return this.get("hours")},B.asHours=function(){return this.as("hours")},B.days=function(){return this.get("days")},B.asDays=function(){return this.as("days")},B.weeks=function(){return this.get("weeks")},B.asWeeks=function(){return this.as("weeks")},B.months=function(){return this.get("months")},B.asMonths=function(){return this.as("months")},B.years=function(){return this.get("years")},B.asYears=function(){return this.as("years")},F}(),b=function(F,B,M){return F.add(B.years()*M,"y").add(B.months()*M,"M").add(B.days()*M,"d").add(B.hours()*M,"h").add(B.minutes()*M,"m").add(B.seconds()*M,"s").add(B.milliseconds()*M,"ms")};return function(F,B,M){t=M,r=M().$utils(),M.duration=function(N,I){var L=M.locale();return x(N,{$l:L},I)},M.isDuration=v;var O=B.prototype.add,A=B.prototype.subtract;B.prototype.add=function(N,I){return v(N)?b(this,N,1):O.bind(this)(N,I)},B.prototype.subtract=function(N,I){return v(N)?b(this,N,-1):A.bind(this)(N,I)}}})})(Kf);var TD=Kf.exports,$D=tt(TD);ot.extend(Dl),ot.extend(SD),ot.extend(ID),ot.extend($D);class Zf{constructor(e,t,r){q(this,"array");q(this,"color");q(this,"math");q(this,"str");q(this,"map");q(this,"matrix");q(this,"timeframe");q(this,"ta");q(this,"input");q(this,"_variables");q(this,"_cacheData");q(this,"_options");q(this,"_errorListener");q(this,"_plots");q(this,"_plotshapes");q(this,"_plotbars");q(this,"_plotchars");q(this,"_plotarrows");q(this,"_plotcandles");q(this,"_alerts");q(this,"_bgColors");q(this,"_hlines");q(this,"_fills");q(this,"chart");q(this,"line");q(this,"label");q(this,"polyline");q(this,"box");q(this,"table");q(this,"linefill");q(this,"log");q(this,"runtime");q(this,"strategy");q(this,"request");q(this,"syminfo");q(this,"_count",0);var i;const n=((i=e.toString().split(".")[1])==null?void 0:i.length)||4;this._variables=t,this._errorListener=new hw,this.array=new D1(this._errorListener),this.math=new w1(n,this._errorListener),this.color=new Gx,this.str=new Xy(this._errorListener,n),this.map=new Qy(this._errorListener),this.timeframe=new Gy(t),this.matrix=new Vy(this._errorListener),this.ta=new Zx(t,this.math,this.timeframe),this._cacheData={},this._options={},this._bgColors={},this._alerts=new Map,this._hlines=new Map,this._fills=new Map,this.input=new Vx(t,this._errorListener,r),this._plots=new Map,this._plotshapes=new Map,this._plotbars=new Map,this._plotcandles=new Map,this._plotchars=new Map,this._plotarrows=new Map,this.chart={point:new Jy(t)},this.line=new wD(t,this._errorListener),this.label=new eD(t,this._errorListener),this.polyline=new DD(t,this._errorListener),this.box=new ED(t,this._errorListener),this.table=new CD(t,this._errorListener),this.linefill=new bD(t),this.log=new cw(t),this.runtime=new fw(this._errorListener),this.strategy=new MD(this._variables,this._options,e,this._errorListener),this.request=new uw(this._variables,r),this.syminfo=new lw}get errors(){return this._errorListener.errors}options(e){if(e.length)return this._getDataOfBarindex(e);const t=this.input.getInputs(),r=this._alerts.size?[...this._alerts.values()]:void 0;this._alerts.clear();const n=Object.keys(this._bgColors);let i;if(n.length){i={};for(const m of n)i[m]=[...this._bgColors[m].values()]}const a=this._hlines.size?[...this._hlines.values()]:void 0,u=this._fills.size?[...this._fills.values()]:void 0,f=this.log.logs.length?this.log.logs:void 0;this.log.clearLogs(),this._options.scriptType==="strategy"&&Object.assign(this._options,{orders:this.strategy.orders,historyOrders:this.strategy.historyOrders});const c=this._plots.size>0?[...this._plots.values()]:void 0,h=this._plotbars.size>0?[...this._plotbars.values()]:void 0,d=this._plotshapes.size>0?[...this._plotshapes.values()]:void 0,p=this._plotarrows.size>0?[...this._plotarrows.values()]:void 0,v=this._plotcandles.size>0?[...this._plotcandles.values()]:void 0,x=this._plotchars.size>0?[...this._plotchars.values()]:void 0,_=this._getDraws(),y=this._variables.chart.isUseBgColor;return Object.assign(this._options,{inputs:t,plots:c,draws:_,alerts:r,colors:i,hlines:a,fills:u,logs:f,plotshapes:d,plotarrows:p,plotcandles:v,plotchars:x,plotbars:h,isUseBgColor:y})}_getDataOfBarindex(e){const t=this._alerts.size?[...this._alerts.values()]:void 0;this._alerts.clear();const r=Object.keys(this._bgColors);let n;if(r.length){n={};for(const p of r)n[p]=[...this._bgColors[p].values()].map(v=>{const x=[];for(const _ of e){const y=v.colors[_];y&&x.push(y)}return v.colors=x,v})}const i=this._hlines.size?[...this._hlines.values()]:void 0,a=this._fills.size?this._getDataFromBarindex(e,[...this._fills.values()]):void 0,u=this.log.logs.length?this.log.logs:void 0;this.log.clearLogs(),this._options.scriptType==="strategy"&&Object.assign(this._options,{orders:this.strategy.orders,historyOrders:this.strategy.historyOrders});const f=this._getDataFromBarindex(e,[...this._plots.values()]),c=this._plotshapes.size>0?this._getDataFromBarindex(e,[...this._plotshapes.values()]):void 0,h=this._getDrawsFromBarindex(e),d=this._variables.chart.isUseBgColor;return Object.assign(this._options,{plots:f,draws:h,alerts:t,colors:n,hlines:i,fills:a,logs:u,plotshapes:c,isUseBgColor:d})}_getDataFromBarindex(e,t){return t.map(r=>{const n=[];for(const i of e){const a=r.data[i];a&&n.push(a)}return r.data=n,{...r}})}_getDraws(){const{line:e,linefill:t,table:r,box:n,polyline:i,label:a}=this._variables,u={};return e.data.length&&(u.lines=e.data),t.data.length&&(u.linefills=t.data),r.data.length&&(u.tables=r.data),n.data.length&&(u.boxes=n.data),i.data.length&&(u.polylines=i.data),a.data.length&&(u.labels=a.data),Object.keys(u).length?u:void 0}_getDrawsFromBarindex(e){const{line:t,linefill:r,table:n,box:i,polyline:a,label:u}=this._variables,f={};return t.data.length&&(f.lines=t.getValOfBarIndex(e)),r.data.length&&(f.linefills=r.getValOfBarIndex(e)),n.data.length&&(f.tables=n.getValOfBarIndex(e)),i.data.length&&(f.boxes=i.getValOfBarIndex(e)),a.data.length&&(f.polylines=a.getValOfBarIndex(e)),u.data.length&&(f.labels=u.getValOfBarIndex(e)),Object.keys(f).length?f:void 0}updateOptions(e){const{inputs:t}=e;t&&t.length&&this.input.update(t)}update(e){const{barIndex:t}=e;this.strategy.updateOptions(),this.math.update(t)}endExecution(){this.strategy.endExecution()}library(e,t){if(!this._variables.bar_index){const r=/^[^\W\d\s][^\W\s]*$/,{title:n}=e;r.test(n)?(y1.includes(n)||x1.includes(n))&&this._errorListener.addError(Zt(ct.libraryTitleIsKeywordErr,{name:n}),t,Ze.Error):this._errorListener.addError(ct.libraryTitleErr,t,Ze.Error),this._options.scriptType="library",this._options.library=e}}indicator(e,t){if(!this._variables.bar_index){const{format:r}=e;this._paramVerfiy(r,t,"indicator",[Je.inherit,Je.percent,Je.price,Je.volume]),this._variables.updateMaxLength(e),this._options.scriptType="indicator",this._options.indicator=e}}_paramVerfiy(e="",t,r,n,i="format"){e&&!n.includes(e)&&this._errorListener.addError(Zt(ct.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ze.Error)}plot(e,t){const r=["color"];_n(e,r);const{series:n,color:i,...a}=e,{bar_index:u,time:f}=this._variables,c=`plot_${t}`,h=this._plots.get(c),d=(h==null?void 0:h.data)||[],p=n!==void 0&&isNaN(n)?void 0:n;if(d[u]={value:[f,p],itemStyle:{color:i}},this._seriesColorHandle(e,r,h),!h){this._count++,this._paramVerfiy(e.format,t,"plot",[Je.percent,Je.price,Je.volume]);const v=i?[i]:void 0;this._plots.set(c,{editable:!0,...a,colors:v,data:d,id:c,zIndex:this._count})}return{type:"plot",key:c}}plotbar(e,t){const r=["color"];_n(e,r);const{open:n,close:i,low:a,high:u,color:f,...c}=e,{bar_index:h,time:d}=this._variables,p=`plotbar_${t}`,v=this._plotbars.get(p),x=(v==null?void 0:v.data)||[],_=i!==void 0&&isNaN(i)?void 0:i,y=n!==void 0&&isNaN(n)?void 0:n,m=a!==void 0&&isNaN(a)?void 0:a,w=u!==void 0&&isNaN(u)?void 0:u,D=[d,y,_,m,w];if(x[h]={value:D,itemStyle:{color:f}},this._seriesColorHandle(e,r,v),!v){this._count++,this._paramVerfiy(e.format,t,"plotbar",[Je.percent,Je.price,Je.volume]);const C=f?[f]:void 0;this._plotbars.set(p,{editable:!0,...c,colors:C,data:x,id:p,zIndex:this._count})}}_verfiyArgs(e,t,r){const{size:n,format:i,location:a,style:u}=e;this._paramVerfiy(u,r,t,Object.values(_r),"style"),this._paramVerfiy(a,r,t,Object.values(vn),"location"),this._paramVerfiy(n,r,t,Object.values(ar),"size"),this._paramVerfiy(i,r,t,[Je.percent,Je.price,Je.volume],"format")}plotchar(e,t){const r=["color","textcolor"];_n(e,r);const{series:n,color:i,textcolor:a,location:u=vn.abovebar,...f}=e,{bar_index:c,time:h,high:d,low:p}=this._variables,v=`plotchar_${t}`,x=this._plotchars.get(v),_=(x==null?void 0:x.data)||[],y={value:[h,n],itemStyle:{color:i,textcolor:a},low:p,high:d};_[c]=y,this._seriesColorHandle(e,r,x),x||(this._count++,this._verfiyArgs(e,"plotchar",t),this._plotchars.set(v,{editable:!0,...f,location:u,data:_,id:v,zIndex:this._count}))}plotarrow(e,t){const r=["colorup","colordown"];_n(e,r);const{series:n,colorup:i,colordown:a,...u}=e,{bar_index:f,time:c}=this._variables,h=`plotarrow_${t}`,d=this._plotarrows.get(h),p=(d==null?void 0:d.data)||[];p[f]={value:[c,n!==void 0&&isNaN(n)?void 0:n],itemStyle:{colorup:i,colordown:a}},this._seriesColorHandle(e,r,d),d||(this._count++,this._paramVerfiy(e.format,t,"plotarrow",[Je.percent,Je.price,Je.volume]),this._plotarrows.set(h,{editable:!0,...u,data:p,id:h,zIndex:this._count}))}plotshape(e,t){const r=["color","textcolor"];_n(e,r);const{series:n,color:i,textcolor:a,location:u=vn.abovebar,...f}=e,{bar_index:c,time:h,low:d,high:p}=this._variables,v=`plotshape_${t}`,x=this._plotshapes.get(v),_=(x==null?void 0:x.data)||[],y={value:n,color:i,textcolor:a,time:h,low:d,high:p};if(_[c]=y,this._seriesColorHandle(e,r,x),!x){this._count++;const m=i?[i]:void 0;this._verfiyArgs(e,"plotshape",t),this._plotshapes.set(v,{editable:!0,...f,data:_,location:u,id:v,colors:m,zIndex:this._count})}}plotcandle(e,t){const r=["wickcolor","bordercolor","color"];_n(e,r);const{wickcolor:n,bordercolor:i,color:a,close:u,open:f,low:c,high:h,...d}=e,{bar_index:p,time:v}=this._variables,x=`plotcandle_${t}`,_=this._plotcandles.get(x),y=(_==null?void 0:_.data)||[],m=u!==void 0&&isNaN(u)?void 0:u,w=f!==void 0&&isNaN(f)?void 0:f,D=c!==void 0&&isNaN(c)?void 0:c,C=h!==void 0&&isNaN(h)?void 0:h,b=[v,w,m,D,C];y[p]={value:b,wickcolor:n,bordercolor:i,color:a},this._seriesColorHandle(e,r,_),_||(this._count++,this._paramVerfiy(e.format,t,"plotcandle",[Je.percent,Je.price,Je.volume]),this._plotcandles.set(x,{editable:!0,...d,data:y,id:x,zIndex:this._count}))}hline(e,t){const r=`hline_${t}`;_n(e,["color"]),this._verifyDisplay(e.display,"hline",t);const i=e.display&&!e.display.length?Vt.none:Vt.all;return this._hlines.has(r)||(this._count++,this._hlines.set(r,{id:r,linewidth:1,editable:!0,display:i,...e,zIndex:this._count})),{type:"hline",key:r}}fill(e,t){var F,B,M,O,A,N,I,L,k,z;const r=["color","top_color","bottom_color"];_n(e,r);const{color:n,top_color:i,bottom_color:a,seriesColors:u,hline1:f,hline2:c,plot1:h,plot2:d,...p}=e,{bar_index:v,time:x}=this._variables,_=`fill_${t}`,y=this._fills.get(_),m=(y==null?void 0:y.data)||[];this._verifyDisplay(e.display,"fill",t);const w=e.display&&!e.display.length?Vt.none:Vt.all;let D,C,b="plot";if(f&&c)D=(F=this._hlines.get(f==null?void 0:f.key))==null?void 0:F.price,C=(B=this._hlines.get(c==null?void 0:c.key))==null?void 0:B.price,b="hline";else{const R=((M=this._plots.get(h==null?void 0:h.key))==null?void 0:M.data)||[],V=((O=this._plots.get(d==null?void 0:d.key))==null?void 0:O.data)||[];D=(N=(A=R[v])==null?void 0:A.value)==null?void 0:N[1],C=(L=(I=V[v])==null?void 0:I.value)==null?void 0:L[1]}if(m[v]={time:x,color:n,top_color:i,bottom_color:a,plot1:D,plot2:C},this._seriesColorHandle(e,r,y),!y){this._count++;const R=((k=this._options.indicator)==null?void 0:k.explicit_plot_zorder)||((z=this._options.strategy)==null?void 0:z.explicit_plot_zorder),V=n?[n]:void 0,H=i?[i]:void 0,ee=a?[a]:void 0;this._fills.set(_,{id:_,colors:V,top_colors:H,bottom_colors:ee,display:w,data:m,type:b,editable:!0,fillgaps:!1,hline1:f,hline2:c,plot1:h,plot2:d,...p,zIndex:R?this._count:void 0})}}alert({message:e,freq:t=Zr.freqOncePerBar},r){const{bar_index:n,_isRealTimeBar:i,last_bar_index:a}=this._variables,u=`alert_${r}`,f=this._cacheData[u]||{},c=f.barIndex;if(this._paramVerfiy(t,r,"alert",[Zr.freqAll,Zr.freqOncePerBar,Zr.freqOncePerBarClose]),t===Zr.freqOncePerBar&&n===c){this._alerts.delete(u);return}this._cacheData[u]=f;const h={message:e,freq:t,id:u,type:"alert"};if(i){t!==Zr.freqOncePerBarClose&&this._alerts.set(u,h),f.barIndex=n;return}if(!i&&t===Zr.freqOncePerBarClose&&n===c&&a===n-1){this._alerts.set(u,h),f.barIndex=n;return}this._alerts.delete(u)}alertcondition({condition:e,message:t,title:r},n){const{_isRealTimeBar:i}=this._variables,a=`alertcondition_${n}`;i&&e?this._alerts.set(a,{message:t,title:r,id:a,type:"alertcondition"}):this._alerts.delete(a)}barcolor(e,t){this._setColors(e,"barcolor",t)}bgcolor(e,t){this._setColors(e,"bgcolor",t)}_verifyDisplay(e=Uf.all,t,r){e.length&&e.length<4&&this._errorListener.addError(Zt(ct.displayErr,{func:t,values:"[display.none, display.all]"}),r,Ze.Error)}_setColors(e,t,r){_n(e,["color"]);const{color:i,...a}=e;this._verifyDisplay(a.display,t,r);const u=e.display&&!e.display.length?Vt.none:Vt.all,{bar_index:f,time:c}=this._variables,h=`${t}_${r}`;this._bgColors[t]||(this._bgColors[t]=new Map);const d=this._bgColors[t].get(h),p=(d==null?void 0:d.colors)||[],v=(d==null?void 0:d.setColors)||[];i&&!v.includes(i)&&v.push(i),p[f]={color:i,time:c},d||this._bgColors[t].set(h,{...a,display:u,colors:p,setColors:v,id:h})}max_bars_back({var:e,num:t,var_name:r}){console.log(e,t,r)}float({x:e}){return e}bool({x:e}){return e||!1}string({x:e}){return e}int({x:e}){return e&&Math.trunc(e)}na({x:e}){return!!(e===void 0||isNaN(e))}fixnan({source:e},t){return e===void 0||isNaN(e)?this._cacheData[`fixnan_${t}`]:(this._cacheData[`fixnan_${t}`]=e,e)}nz({source:e,replacement:t}){return e!==void 0&&!isNaN(e)?e:t||0}time({timeframe:e="",session:t,timezone:r,bars_back:n=0},i){return this._timeHandle(this._variables.time,i,e,t,r,n)}time_close({timeframe:e="",session:t,timezone:r,bars_back:n=0},i){return this._variables.time_close&&this._timeHandle(this._variables.time_close,i,e,t,r,n)}timestamp(e){const{dateString:t,timezone:r,year:n,month:i,day:a,hour:u=0,minute:f=0,second:c=0}=e;if(t)return ot(t).utc(!/GMT|UTC/.test(t)).valueOf();let h=i-1,d=n;if(h<0){const v=Math.ceil(Math.abs(h/12));h=12*v+h,d=n-v}let p=ot({year:d,month:h,day:a,hour:u,minute:f,second:c});return r&&(p=Kr(p.utc(!0).valueOf(),r)),p.utc(!0).valueOf()}weekofyear({time:e,timezone:t}){return Kr(e,t).week()}year({time:e,timezone:t}){return Kr(e,t).year()}second({time:e,timezone:t}){return Kr(e,t).second()}month({time:e,timezone:t}){return Kr(e,t).month()+1}minute({time:e,timezone:t}){return Kr(e,t).minute()}hour({time:e,timezone:t}){return Kr(e,t).hour()}dayofweek({time:e,timezone:t}){return Kr(e,t).day()+1}dayofmonth({time:e,timezone:t}){return Kr(e,t).date()}_calcTimeOffset(e,t){const r=this._variables.getTimeTradingday(e,t),n=pn(t)*1e3;return e-r-Math.floor((e-r)/n)*n}_timeHandle(e,t,r="",n,i,a=0){const u=r||this._variables.timeframe.period,f=pn(u),c=pn(this._variables.timeframe.period);let h;if(f<=c)h=e;else{const d=`time_${t}`,p=this._cacheData[d];if(p)p.currentTime+f*1e3-p.offset<=e?(h=e,this._cacheData[d]={currentTime:e,offset:0}):h=p;else{const v=this._calcTimeOffset(e,u);this._cacheData[d]={currentTime:e,offset:v},h=e}}if(n){const{timePeriods:d,weeks:p}=this._parserSession(n,t),v=ot(e).format("YYYY-MM-DD"),x=h;h=void 0;for(const y of d){const[m,w]=y;if(ot(e).isBetween(`${v} ${m}`,`${v} ${w}`,"hour")){ot(x).isBetween(`${v} ${m}`,`${v} ${w}`,"hour")?h=x:h=ot(`${v} ${m}`).valueOf();break}}const _=this._variables.dayofweek;h&&!p.includes(_)&&(h=void 0)}return i&&(h=h&&Kr(h,i).valueOf()),h&&h-a*c*1e3}_seriesColorHandle(e,t,r){var n;if(r&&t!=null&&t.length)for(const i of t){if((n=r.gradientColorKeys)!=null&&n.includes(i))continue;const a=e[i];if(!a)continue;const u=r[`${i}s`]||[];u.includes(a)||(u.push(a),r[`${i}s`]=u,u.length>5&&(r[`${i}s`]=[],r.gradientColorKeys=r.gradientColorKeys||[],r.gradientColorKeys.push(i)))}}_parserSession(e,t){const r=e.split(":"),n=r[0],a=(r[1]||"1234567").split("").map(f=>{const c=parseInt(f,10);if(c<1||c>7){this._errorListener.addError(`Invalid day of week: ${f}`,t,Ze.Error);return}return c});return{timePeriods:n.split(",").map(f=>{f===""||f===yi.regular?f="0930-1500":f===yi.extended&&(f="1500-1830");const c=f.split("-");return c.length!==2?(this._errorListener.addError(`Invalid time period: ${f}`,t,Ze.Error),[]):[this._processTime(c[0],t),this._processTime(c[1],t)]}),weeks:a}}_processTime(e,t){const r=parseInt(e.slice(0,2),10),n=parseInt(e.slice(2),10);if(!(r>=0&&r<=23)&&n>=0&&n<=59){this._errorListener.addError("Invalid time: Time must be within 00:00 to 23:59",t,Ze.Error);return}return`${r}:${n}`}}var Vf={exports:{}};function LD(s){throw new Error('Could not dynamically require "'+s+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ou={exports:{}},Gf;function Ve(){return Gf||(Gf=1,function(s,e){(function(t,r){s.exports=r()})(ye,function(){var t=t||function(r,n){var i;if(typeof window<"u"&&window.crypto&&(i=window.crypto),typeof self<"u"&&self.crypto&&(i=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window<"u"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof ye<"u"&&ye.crypto&&(i=ye.crypto),!i&&typeof LD=="function")try{i=Fx}catch{}var a=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},u=Object.create||function(){function w(){}return function(D){var C;return w.prototype=D,C=new w,w.prototype=null,C}}(),f={},c=f.lib={},h=c.Base=function(){return{extend:function(w){var D=u(this);return w&&D.mixIn(w),(!D.hasOwnProperty("init")||this.init===D.init)&&(D.init=function(){D.$super.init.apply(this,arguments)}),D.init.prototype=D,D.$super=this,D},create:function(){var w=this.extend();return w.init.apply(w,arguments),w},init:function(){},mixIn:function(w){for(var D in w)w.hasOwnProperty(D)&&(this[D]=w[D]);w.hasOwnProperty("toString")&&(this.toString=w.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),d=c.WordArray=h.extend({init:function(w,D){w=this.words=w||[],D!=n?this.sigBytes=D:this.sigBytes=w.length*4},toString:function(w){return(w||v).stringify(this)},concat:function(w){var D=this.words,C=w.words,b=this.sigBytes,F=w.sigBytes;if(this.clamp(),b%4)for(var B=0;B<F;B++){var M=C[B>>>2]>>>24-B%4*8&255;D[b+B>>>2]|=M<<24-(b+B)%4*8}else for(var O=0;O<F;O+=4)D[b+O>>>2]=C[O>>>2];return this.sigBytes+=F,this},clamp:function(){var w=this.words,D=this.sigBytes;w[D>>>2]&=4294967295<<32-D%4*8,w.length=r.ceil(D/4)},clone:function(){var w=h.clone.call(this);return w.words=this.words.slice(0),w},random:function(w){for(var D=[],C=0;C<w;C+=4)D.push(a());return new d.init(D,w)}}),p=f.enc={},v=p.Hex={stringify:function(w){for(var D=w.words,C=w.sigBytes,b=[],F=0;F<C;F++){var B=D[F>>>2]>>>24-F%4*8&255;b.push((B>>>4).toString(16)),b.push((B&15).toString(16))}return b.join("")},parse:function(w){for(var D=w.length,C=[],b=0;b<D;b+=2)C[b>>>3]|=parseInt(w.substr(b,2),16)<<24-b%8*4;return new d.init(C,D/2)}},x=p.Latin1={stringify:function(w){for(var D=w.words,C=w.sigBytes,b=[],F=0;F<C;F++){var B=D[F>>>2]>>>24-F%4*8&255;b.push(String.fromCharCode(B))}return b.join("")},parse:function(w){for(var D=w.length,C=[],b=0;b<D;b++)C[b>>>2]|=(w.charCodeAt(b)&255)<<24-b%4*8;return new d.init(C,D)}},_=p.Utf8={stringify:function(w){try{return decodeURIComponent(escape(x.stringify(w)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(w){return x.parse(unescape(encodeURIComponent(w)))}},y=c.BufferedBlockAlgorithm=h.extend({reset:function(){this._data=new d.init,this._nDataBytes=0},_append:function(w){typeof w=="string"&&(w=_.parse(w)),this._data.concat(w),this._nDataBytes+=w.sigBytes},_process:function(w){var D,C=this._data,b=C.words,F=C.sigBytes,B=this.blockSize,M=B*4,O=F/M;w?O=r.ceil(O):O=r.max((O|0)-this._minBufferSize,0);var A=O*B,N=r.min(A*4,F);if(A){for(var I=0;I<A;I+=B)this._doProcessBlock(b,I);D=b.splice(0,A),C.sigBytes-=N}return new d.init(D,N)},clone:function(){var w=h.clone.call(this);return w._data=this._data.clone(),w},_minBufferSize:0});c.Hasher=y.extend({cfg:h.extend(),init:function(w){this.cfg=this.cfg.extend(w),this.reset()},reset:function(){y.reset.call(this),this._doReset()},update:function(w){return this._append(w),this._process(),this},finalize:function(w){w&&this._append(w);var D=this._doFinalize();return D},blockSize:16,_createHelper:function(w){return function(D,C){return new w.init(C).finalize(D)}},_createHmacHelper:function(w){return function(D,C){return new m.HMAC.init(w,C).finalize(D)}}});var m=f.algo={};return f}(Math);return t})}(ou)),ou.exports}var au={exports:{}},Xf;function Mo(){return Xf||(Xf=1,function(s,e){(function(t,r){s.exports=r(Ve())})(ye,function(t){return function(r){var n=t,i=n.lib,a=i.Base,u=i.WordArray,f=n.x64={};f.Word=a.extend({init:function(c,h){this.high=c,this.low=h}}),f.WordArray=a.extend({init:function(c,h){c=this.words=c||[],h!=r?this.sigBytes=h:this.sigBytes=c.length*8},toX32:function(){for(var c=this.words,h=c.length,d=[],p=0;p<h;p++){var v=c[p];d.push(v.high),d.push(v.low)}return u.create(d,this.sigBytes)},clone:function(){for(var c=a.clone.call(this),h=c.words=this.words.slice(0),d=h.length,p=0;p<d;p++)h[p]=h[p].clone();return c}})}(),t})}(au)),au.exports}var uu={exports:{}},Qf;function RD(){return Qf||(Qf=1,function(s,e){(function(t,r){s.exports=r(Ve())})(ye,function(t){return function(){if(typeof ArrayBuffer=="function"){var r=t,n=r.lib,i=n.WordArray,a=i.init,u=i.init=function(f){if(f instanceof ArrayBuffer&&(f=new Uint8Array(f)),(f instanceof Int8Array||typeof Uint8ClampedArray<"u"&&f instanceof Uint8ClampedArray||f instanceof Int16Array||f instanceof Uint16Array||f instanceof Int32Array||f instanceof Uint32Array||f instanceof Float32Array||f instanceof Float64Array)&&(f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength)),f instanceof Uint8Array){for(var c=f.byteLength,h=[],d=0;d<c;d++)h[d>>>2]|=f[d]<<24-d%4*8;a.call(this,h,c)}else a.apply(this,arguments)};u.prototype=i}}(),t.lib.WordArray})}(uu)),uu.exports}var lu={exports:{}},Jf;function PD(){return Jf||(Jf=1,function(s,e){(function(t,r){s.exports=r(Ve())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.WordArray,a=r.enc;a.Utf16=a.Utf16BE={stringify:function(f){for(var c=f.words,h=f.sigBytes,d=[],p=0;p<h;p+=2){var v=c[p>>>2]>>>16-p%4*8&65535;d.push(String.fromCharCode(v))}return d.join("")},parse:function(f){for(var c=f.length,h=[],d=0;d<c;d++)h[d>>>1]|=f.charCodeAt(d)<<16-d%2*16;return i.create(h,c*2)}},a.Utf16LE={stringify:function(f){for(var c=f.words,h=f.sigBytes,d=[],p=0;p<h;p+=2){var v=u(c[p>>>2]>>>16-p%4*8&65535);d.push(String.fromCharCode(v))}return d.join("")},parse:function(f){for(var c=f.length,h=[],d=0;d<c;d++)h[d>>>1]|=u(f.charCodeAt(d)<<16-d%2*16);return i.create(h,c*2)}};function u(f){return f<<8&4278255360|f>>>8&16711935}}(),t.enc.Utf16})}(lu)),lu.exports}var cu={exports:{}},eh;function oi(){return eh||(eh=1,function(s,e){(function(t,r){s.exports=r(Ve())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.WordArray,a=r.enc;a.Base64={stringify:function(f){var c=f.words,h=f.sigBytes,d=this._map;f.clamp();for(var p=[],v=0;v<h;v+=3)for(var x=c[v>>>2]>>>24-v%4*8&255,_=c[v+1>>>2]>>>24-(v+1)%4*8&255,y=c[v+2>>>2]>>>24-(v+2)%4*8&255,m=x<<16|_<<8|y,w=0;w<4&&v+w*.75<h;w++)p.push(d.charAt(m>>>6*(3-w)&63));var D=d.charAt(64);if(D)for(;p.length%4;)p.push(D);return p.join("")},parse:function(f){var c=f.length,h=this._map,d=this._reverseMap;if(!d){d=this._reverseMap=[];for(var p=0;p<h.length;p++)d[h.charCodeAt(p)]=p}var v=h.charAt(64);if(v){var x=f.indexOf(v);x!==-1&&(c=x)}return u(f,c,d)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function u(f,c,h){for(var d=[],p=0,v=0;v<c;v++)if(v%4){var x=h[f.charCodeAt(v-1)]<<v%4*2,_=h[f.charCodeAt(v)]>>>6-v%4*2,y=x|_;d[p>>>2]|=y<<24-p%4*8,p++}return i.create(d,p)}}(),t.enc.Base64})}(cu)),cu.exports}var fu={exports:{}},th;function kD(){return th||(th=1,function(s,e){(function(t,r){s.exports=r(Ve())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.WordArray,a=r.enc;a.Base64url={stringify:function(f,c){c===void 0&&(c=!0);var h=f.words,d=f.sigBytes,p=c?this._safe_map:this._map;f.clamp();for(var v=[],x=0;x<d;x+=3)for(var _=h[x>>>2]>>>24-x%4*8&255,y=h[x+1>>>2]>>>24-(x+1)%4*8&255,m=h[x+2>>>2]>>>24-(x+2)%4*8&255,w=_<<16|y<<8|m,D=0;D<4&&x+D*.75<d;D++)v.push(p.charAt(w>>>6*(3-D)&63));var C=p.charAt(64);if(C)for(;v.length%4;)v.push(C);return v.join("")},parse:function(f,c){c===void 0&&(c=!0);var h=f.length,d=c?this._safe_map:this._map,p=this._reverseMap;if(!p){p=this._reverseMap=[];for(var v=0;v<d.length;v++)p[d.charCodeAt(v)]=v}var x=d.charAt(64);if(x){var _=f.indexOf(x);_!==-1&&(h=_)}return u(f,h,p)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function u(f,c,h){for(var d=[],p=0,v=0;v<c;v++)if(v%4){var x=h[f.charCodeAt(v-1)]<<v%4*2,_=h[f.charCodeAt(v)]>>>6-v%4*2,y=x|_;d[p>>>2]|=y<<24-p%4*8,p++}return i.create(d,p)}}(),t.enc.Base64url})}(fu)),fu.exports}var hu={exports:{}},rh;function ai(){return rh||(rh=1,function(s,e){(function(t,r){s.exports=r(Ve())})(ye,function(t){return function(r){var n=t,i=n.lib,a=i.WordArray,u=i.Hasher,f=n.algo,c=[];(function(){for(var _=0;_<64;_++)c[_]=r.abs(r.sin(_+1))*4294967296|0})();var h=f.MD5=u.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(_,y){for(var m=0;m<16;m++){var w=y+m,D=_[w];_[w]=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360}var C=this._hash.words,b=_[y+0],F=_[y+1],B=_[y+2],M=_[y+3],O=_[y+4],A=_[y+5],N=_[y+6],I=_[y+7],L=_[y+8],k=_[y+9],z=_[y+10],R=_[y+11],V=_[y+12],H=_[y+13],ee=_[y+14],te=_[y+15],j=C[0],X=C[1],Y=C[2],Q=C[3];j=d(j,X,Y,Q,b,7,c[0]),Q=d(Q,j,X,Y,F,12,c[1]),Y=d(Y,Q,j,X,B,17,c[2]),X=d(X,Y,Q,j,M,22,c[3]),j=d(j,X,Y,Q,O,7,c[4]),Q=d(Q,j,X,Y,A,12,c[5]),Y=d(Y,Q,j,X,N,17,c[6]),X=d(X,Y,Q,j,I,22,c[7]),j=d(j,X,Y,Q,L,7,c[8]),Q=d(Q,j,X,Y,k,12,c[9]),Y=d(Y,Q,j,X,z,17,c[10]),X=d(X,Y,Q,j,R,22,c[11]),j=d(j,X,Y,Q,V,7,c[12]),Q=d(Q,j,X,Y,H,12,c[13]),Y=d(Y,Q,j,X,ee,17,c[14]),X=d(X,Y,Q,j,te,22,c[15]),j=p(j,X,Y,Q,F,5,c[16]),Q=p(Q,j,X,Y,N,9,c[17]),Y=p(Y,Q,j,X,R,14,c[18]),X=p(X,Y,Q,j,b,20,c[19]),j=p(j,X,Y,Q,A,5,c[20]),Q=p(Q,j,X,Y,z,9,c[21]),Y=p(Y,Q,j,X,te,14,c[22]),X=p(X,Y,Q,j,O,20,c[23]),j=p(j,X,Y,Q,k,5,c[24]),Q=p(Q,j,X,Y,ee,9,c[25]),Y=p(Y,Q,j,X,M,14,c[26]),X=p(X,Y,Q,j,L,20,c[27]),j=p(j,X,Y,Q,H,5,c[28]),Q=p(Q,j,X,Y,B,9,c[29]),Y=p(Y,Q,j,X,I,14,c[30]),X=p(X,Y,Q,j,V,20,c[31]),j=v(j,X,Y,Q,A,4,c[32]),Q=v(Q,j,X,Y,L,11,c[33]),Y=v(Y,Q,j,X,R,16,c[34]),X=v(X,Y,Q,j,ee,23,c[35]),j=v(j,X,Y,Q,F,4,c[36]),Q=v(Q,j,X,Y,O,11,c[37]),Y=v(Y,Q,j,X,I,16,c[38]),X=v(X,Y,Q,j,z,23,c[39]),j=v(j,X,Y,Q,H,4,c[40]),Q=v(Q,j,X,Y,b,11,c[41]),Y=v(Y,Q,j,X,M,16,c[42]),X=v(X,Y,Q,j,N,23,c[43]),j=v(j,X,Y,Q,k,4,c[44]),Q=v(Q,j,X,Y,V,11,c[45]),Y=v(Y,Q,j,X,te,16,c[46]),X=v(X,Y,Q,j,B,23,c[47]),j=x(j,X,Y,Q,b,6,c[48]),Q=x(Q,j,X,Y,I,10,c[49]),Y=x(Y,Q,j,X,ee,15,c[50]),X=x(X,Y,Q,j,A,21,c[51]),j=x(j,X,Y,Q,V,6,c[52]),Q=x(Q,j,X,Y,M,10,c[53]),Y=x(Y,Q,j,X,z,15,c[54]),X=x(X,Y,Q,j,F,21,c[55]),j=x(j,X,Y,Q,L,6,c[56]),Q=x(Q,j,X,Y,te,10,c[57]),Y=x(Y,Q,j,X,N,15,c[58]),X=x(X,Y,Q,j,H,21,c[59]),j=x(j,X,Y,Q,O,6,c[60]),Q=x(Q,j,X,Y,R,10,c[61]),Y=x(Y,Q,j,X,B,15,c[62]),X=x(X,Y,Q,j,k,21,c[63]),C[0]=C[0]+j|0,C[1]=C[1]+X|0,C[2]=C[2]+Y|0,C[3]=C[3]+Q|0},_doFinalize:function(){var _=this._data,y=_.words,m=this._nDataBytes*8,w=_.sigBytes*8;y[w>>>5]|=128<<24-w%32;var D=r.floor(m/4294967296),C=m;y[(w+64>>>9<<4)+15]=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,y[(w+64>>>9<<4)+14]=(C<<8|C>>>24)&16711935|(C<<24|C>>>8)&4278255360,_.sigBytes=(y.length+1)*4,this._process();for(var b=this._hash,F=b.words,B=0;B<4;B++){var M=F[B];F[B]=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360}return b},clone:function(){var _=u.clone.call(this);return _._hash=this._hash.clone(),_}});function d(_,y,m,w,D,C,b){var F=_+(y&m|~y&w)+D+b;return(F<<C|F>>>32-C)+y}function p(_,y,m,w,D,C,b){var F=_+(y&w|m&~w)+D+b;return(F<<C|F>>>32-C)+y}function v(_,y,m,w,D,C,b){var F=_+(y^m^w)+D+b;return(F<<C|F>>>32-C)+y}function x(_,y,m,w,D,C,b){var F=_+(m^(y|~w))+D+b;return(F<<C|F>>>32-C)+y}n.MD5=u._createHelper(h),n.HmacMD5=u._createHmacHelper(h)}(Math),t.MD5})}(hu)),hu.exports}var du={exports:{}},nh;function ih(){return nh||(nh=1,function(s,e){(function(t,r){s.exports=r(Ve())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.WordArray,a=n.Hasher,u=r.algo,f=[],c=u.SHA1=a.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(h,d){for(var p=this._hash.words,v=p[0],x=p[1],_=p[2],y=p[3],m=p[4],w=0;w<80;w++){if(w<16)f[w]=h[d+w]|0;else{var D=f[w-3]^f[w-8]^f[w-14]^f[w-16];f[w]=D<<1|D>>>31}var C=(v<<5|v>>>27)+m+f[w];w<20?C+=(x&_|~x&y)+1518500249:w<40?C+=(x^_^y)+1859775393:w<60?C+=(x&_|x&y|_&y)-1894007588:C+=(x^_^y)-899497514,m=y,y=_,_=x<<30|x>>>2,x=v,v=C}p[0]=p[0]+v|0,p[1]=p[1]+x|0,p[2]=p[2]+_|0,p[3]=p[3]+y|0,p[4]=p[4]+m|0},_doFinalize:function(){var h=this._data,d=h.words,p=this._nDataBytes*8,v=h.sigBytes*8;return d[v>>>5]|=128<<24-v%32,d[(v+64>>>9<<4)+14]=Math.floor(p/4294967296),d[(v+64>>>9<<4)+15]=p,h.sigBytes=d.length*4,this._process(),this._hash},clone:function(){var h=a.clone.call(this);return h._hash=this._hash.clone(),h}});r.SHA1=a._createHelper(c),r.HmacSHA1=a._createHmacHelper(c)}(),t.SHA1})}(du)),du.exports}var pu={exports:{}},sh;function _u(){return sh||(sh=1,function(s,e){(function(t,r){s.exports=r(Ve())})(ye,function(t){return function(r){var n=t,i=n.lib,a=i.WordArray,u=i.Hasher,f=n.algo,c=[],h=[];(function(){function v(m){for(var w=r.sqrt(m),D=2;D<=w;D++)if(!(m%D))return!1;return!0}function x(m){return(m-(m|0))*4294967296|0}for(var _=2,y=0;y<64;)v(_)&&(y<8&&(c[y]=x(r.pow(_,1/2))),h[y]=x(r.pow(_,1/3)),y++),_++})();var d=[],p=f.SHA256=u.extend({_doReset:function(){this._hash=new a.init(c.slice(0))},_doProcessBlock:function(v,x){for(var _=this._hash.words,y=_[0],m=_[1],w=_[2],D=_[3],C=_[4],b=_[5],F=_[6],B=_[7],M=0;M<64;M++){if(M<16)d[M]=v[x+M]|0;else{var O=d[M-15],A=(O<<25|O>>>7)^(O<<14|O>>>18)^O>>>3,N=d[M-2],I=(N<<15|N>>>17)^(N<<13|N>>>19)^N>>>10;d[M]=A+d[M-7]+I+d[M-16]}var L=C&b^~C&F,k=y&m^y&w^m&w,z=(y<<30|y>>>2)^(y<<19|y>>>13)^(y<<10|y>>>22),R=(C<<26|C>>>6)^(C<<21|C>>>11)^(C<<7|C>>>25),V=B+R+L+h[M]+d[M],H=z+k;B=F,F=b,b=C,C=D+V|0,D=w,w=m,m=y,y=V+H|0}_[0]=_[0]+y|0,_[1]=_[1]+m|0,_[2]=_[2]+w|0,_[3]=_[3]+D|0,_[4]=_[4]+C|0,_[5]=_[5]+b|0,_[6]=_[6]+F|0,_[7]=_[7]+B|0},_doFinalize:function(){var v=this._data,x=v.words,_=this._nDataBytes*8,y=v.sigBytes*8;return x[y>>>5]|=128<<24-y%32,x[(y+64>>>9<<4)+14]=r.floor(_/4294967296),x[(y+64>>>9<<4)+15]=_,v.sigBytes=x.length*4,this._process(),this._hash},clone:function(){var v=u.clone.call(this);return v._hash=this._hash.clone(),v}});n.SHA256=u._createHelper(p),n.HmacSHA256=u._createHmacHelper(p)}(Math),t.SHA256})}(pu)),pu.exports}var vu={exports:{}},oh;function zD(){return oh||(oh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),_u())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.WordArray,a=r.algo,u=a.SHA256,f=a.SHA224=u.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var c=u._doFinalize.call(this);return c.sigBytes-=4,c}});r.SHA224=u._createHelper(f),r.HmacSHA224=u._createHmacHelper(f)}(),t.SHA224})}(vu)),vu.exports}var gu={exports:{}},ah;function uh(){return ah||(ah=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Mo())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.Hasher,a=r.x64,u=a.Word,f=a.WordArray,c=r.algo;function h(){return u.create.apply(u,arguments)}var d=[h(1116352408,3609767458),h(1899447441,602891725),h(3049323471,3964484399),h(3921009573,2173295548),h(961987163,4081628472),h(1508970993,3053834265),h(2453635748,2937671579),h(2870763221,3664609560),h(3624381080,2734883394),h(310598401,1164996542),h(607225278,1323610764),h(1426881987,3590304994),h(1925078388,4068182383),h(2162078206,991336113),h(2614888103,633803317),h(3248222580,3479774868),h(3835390401,2666613458),h(4022224774,944711139),h(264347078,2341262773),h(604807628,2007800933),h(770255983,1495990901),h(1249150122,1856431235),h(1555081692,3175218132),h(1996064986,2198950837),h(2554220882,3999719339),h(2821834349,766784016),h(2952996808,2566594879),h(3210313671,3203337956),h(3336571891,1034457026),h(3584528711,2466948901),h(113926993,3758326383),h(338241895,168717936),h(666307205,1188179964),h(773529912,1546045734),h(1294757372,1522805485),h(1396182291,2643833823),h(1695183700,2343527390),h(1986661051,1014477480),h(2177026350,1206759142),h(2456956037,344077627),h(2730485921,1290863460),h(2820302411,3158454273),h(3259730800,3505952657),h(3345764771,106217008),h(3516065817,3606008344),h(3600352804,1432725776),h(4094571909,1467031594),h(275423344,851169720),h(430227734,3100823752),h(506948616,1363258195),h(659060556,3750685593),h(883997877,3785050280),h(958139571,3318307427),h(1322822218,3812723403),h(1537002063,2003034995),h(1747873779,3602036899),h(1955562222,1575990012),h(2024104815,1125592928),h(2227730452,2716904306),h(2361852424,442776044),h(2428436474,593698344),h(2756734187,3733110249),h(3204031479,2999351573),h(3329325298,3815920427),h(3391569614,3928383900),h(3515267271,566280711),h(3940187606,3454069534),h(4118630271,4000239992),h(116418474,1914138554),h(174292421,2731055270),h(289380356,3203993006),h(460393269,320620315),h(685471733,587496836),h(852142971,1086792851),h(1017036298,365543100),h(1126000580,2618297676),h(1288033470,3409855158),h(1501505948,4234509866),h(1607167915,987167468),h(1816402316,1246189591)],p=[];(function(){for(var x=0;x<80;x++)p[x]=h()})();var v=c.SHA512=i.extend({_doReset:function(){this._hash=new f.init([new u.init(1779033703,4089235720),new u.init(3144134277,2227873595),new u.init(1013904242,4271175723),new u.init(2773480762,1595750129),new u.init(1359893119,2917565137),new u.init(2600822924,725511199),new u.init(528734635,4215389547),new u.init(1541459225,327033209)])},_doProcessBlock:function(x,_){for(var y=this._hash.words,m=y[0],w=y[1],D=y[2],C=y[3],b=y[4],F=y[5],B=y[6],M=y[7],O=m.high,A=m.low,N=w.high,I=w.low,L=D.high,k=D.low,z=C.high,R=C.low,V=b.high,H=b.low,ee=F.high,te=F.low,j=B.high,X=B.low,Y=M.high,Q=M.low,pe=O,De=A,we=N,be=I,Oe=L,Fe=k,nt=z,Ye=R,Ie=V,Le=H,yt=ee,Wt=te,Ct=j,lr=X,Rr=Y,cr=Q,Dt=0;Dt<80;Dt++){var It,P,Z=p[Dt];if(Dt<16)P=Z.high=x[_+Dt*2]|0,It=Z.low=x[_+Dt*2+1]|0;else{var J=p[Dt-15],ie=J.high,ue=J.low,se=(ie>>>1|ue<<31)^(ie>>>8|ue<<24)^ie>>>7,_e=(ue>>>1|ie<<31)^(ue>>>8|ie<<24)^(ue>>>7|ie<<25),he=p[Dt-2],de=he.high,fe=he.low,Xe=(de>>>19|fe<<13)^(de<<3|fe>>>29)^de>>>6,et=(fe>>>19|de<<13)^(fe<<3|de>>>29)^(fe>>>6|de<<26),dt=p[Dt-7],zt=dt.high,Tt=dt.low,nr=p[Dt-16],fr=nr.high,en=nr.low;It=_e+Tt,P=se+zt+(It>>>0<_e>>>0?1:0),It=It+et,P=P+Xe+(It>>>0<et>>>0?1:0),It=It+en,P=P+fr+(It>>>0<en>>>0?1:0),Z.high=P,Z.low=It}var wn=Ie&yt^~Ie&Ct,li=Le&Wt^~Le&lr,ms=pe&we^pe&Oe^we&Oe,xs=De&be^De&Fe^be&Fe,ys=(pe>>>28|De<<4)^(pe<<30|De>>>2)^(pe<<25|De>>>7),ki=(De>>>28|pe<<4)^(De<<30|pe>>>2)^(De<<25|pe>>>7),zi=(Ie>>>14|Le<<18)^(Ie>>>18|Le<<14)^(Ie<<23|Le>>>9),Ds=(Le>>>14|Ie<<18)^(Le>>>18|Ie<<14)^(Le<<23|Ie>>>9),qi=d[Dt],ws=qi.high,qn=qi.low,Qt=cr+Ds,mr=Rr+zi+(Qt>>>0<cr>>>0?1:0),Qt=Qt+li,mr=mr+wn+(Qt>>>0<li>>>0?1:0),Qt=Qt+qn,mr=mr+ws+(Qt>>>0<qn>>>0?1:0),Qt=Qt+It,mr=mr+P+(Qt>>>0<It>>>0?1:0),Ui=ki+xs,bs=ys+ms+(Ui>>>0<ki>>>0?1:0);Rr=Ct,cr=lr,Ct=yt,lr=Wt,yt=Ie,Wt=Le,Le=Ye+Qt|0,Ie=nt+mr+(Le>>>0<Ye>>>0?1:0)|0,nt=Oe,Ye=Fe,Oe=we,Fe=be,we=pe,be=De,De=Qt+Ui|0,pe=mr+bs+(De>>>0<Qt>>>0?1:0)|0}A=m.low=A+De,m.high=O+pe+(A>>>0<De>>>0?1:0),I=w.low=I+be,w.high=N+we+(I>>>0<be>>>0?1:0),k=D.low=k+Fe,D.high=L+Oe+(k>>>0<Fe>>>0?1:0),R=C.low=R+Ye,C.high=z+nt+(R>>>0<Ye>>>0?1:0),H=b.low=H+Le,b.high=V+Ie+(H>>>0<Le>>>0?1:0),te=F.low=te+Wt,F.high=ee+yt+(te>>>0<Wt>>>0?1:0),X=B.low=X+lr,B.high=j+Ct+(X>>>0<lr>>>0?1:0),Q=M.low=Q+cr,M.high=Y+Rr+(Q>>>0<cr>>>0?1:0)},_doFinalize:function(){var x=this._data,_=x.words,y=this._nDataBytes*8,m=x.sigBytes*8;_[m>>>5]|=128<<24-m%32,_[(m+128>>>10<<5)+30]=Math.floor(y/4294967296),_[(m+128>>>10<<5)+31]=y,x.sigBytes=_.length*4,this._process();var w=this._hash.toX32();return w},clone:function(){var x=i.clone.call(this);return x._hash=this._hash.clone(),x},blockSize:1024/32});r.SHA512=i._createHelper(v),r.HmacSHA512=i._createHmacHelper(v)}(),t.SHA512})}(gu)),gu.exports}var mu={exports:{}},lh;function qD(){return lh||(lh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Mo(),uh())})(ye,function(t){return function(){var r=t,n=r.x64,i=n.Word,a=n.WordArray,u=r.algo,f=u.SHA512,c=u.SHA384=f.extend({_doReset:function(){this._hash=new a.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var h=f._doFinalize.call(this);return h.sigBytes-=16,h}});r.SHA384=f._createHelper(c),r.HmacSHA384=f._createHmacHelper(c)}(),t.SHA384})}(mu)),mu.exports}var xu={exports:{}},ch;function UD(){return ch||(ch=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Mo())})(ye,function(t){return function(r){var n=t,i=n.lib,a=i.WordArray,u=i.Hasher,f=n.x64,c=f.Word,h=n.algo,d=[],p=[],v=[];(function(){for(var y=1,m=0,w=0;w<24;w++){d[y+5*m]=(w+1)*(w+2)/2%64;var D=m%5,C=(2*y+3*m)%5;y=D,m=C}for(var y=0;y<5;y++)for(var m=0;m<5;m++)p[y+5*m]=m+(2*y+3*m)%5*5;for(var b=1,F=0;F<24;F++){for(var B=0,M=0,O=0;O<7;O++){if(b&1){var A=(1<<O)-1;A<32?M^=1<<A:B^=1<<A-32}b&128?b=b<<1^113:b<<=1}v[F]=c.create(B,M)}})();var x=[];(function(){for(var y=0;y<25;y++)x[y]=c.create()})();var _=h.SHA3=u.extend({cfg:u.cfg.extend({outputLength:512}),_doReset:function(){for(var y=this._state=[],m=0;m<25;m++)y[m]=new c.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(y,m){for(var w=this._state,D=this.blockSize/2,C=0;C<D;C++){var b=y[m+2*C],F=y[m+2*C+1];b=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,F=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360;var B=w[C];B.high^=F,B.low^=b}for(var M=0;M<24;M++){for(var O=0;O<5;O++){for(var A=0,N=0,I=0;I<5;I++){var B=w[O+5*I];A^=B.high,N^=B.low}var L=x[O];L.high=A,L.low=N}for(var O=0;O<5;O++)for(var k=x[(O+4)%5],z=x[(O+1)%5],R=z.high,V=z.low,A=k.high^(R<<1|V>>>31),N=k.low^(V<<1|R>>>31),I=0;I<5;I++){var B=w[O+5*I];B.high^=A,B.low^=N}for(var H=1;H<25;H++){var A,N,B=w[H],ee=B.high,te=B.low,j=d[H];j<32?(A=ee<<j|te>>>32-j,N=te<<j|ee>>>32-j):(A=te<<j-32|ee>>>64-j,N=ee<<j-32|te>>>64-j);var X=x[p[H]];X.high=A,X.low=N}var Y=x[0],Q=w[0];Y.high=Q.high,Y.low=Q.low;for(var O=0;O<5;O++)for(var I=0;I<5;I++){var H=O+5*I,B=w[H],pe=x[H],De=x[(O+1)%5+5*I],we=x[(O+2)%5+5*I];B.high=pe.high^~De.high&we.high,B.low=pe.low^~De.low&we.low}var B=w[0],be=v[M];B.high^=be.high,B.low^=be.low}},_doFinalize:function(){var y=this._data,m=y.words;this._nDataBytes*8;var w=y.sigBytes*8,D=this.blockSize*32;m[w>>>5]|=1<<24-w%32,m[(r.ceil((w+1)/D)*D>>>5)-1]|=128,y.sigBytes=m.length*4,this._process();for(var C=this._state,b=this.cfg.outputLength/8,F=b/8,B=[],M=0;M<F;M++){var O=C[M],A=O.high,N=O.low;A=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360,N=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360,B.push(N),B.push(A)}return new a.init(B,b)},clone:function(){for(var y=u.clone.call(this),m=y._state=this._state.slice(0),w=0;w<25;w++)m[w]=m[w].clone();return y}});n.SHA3=u._createHelper(_),n.HmacSHA3=u._createHmacHelper(_)}(Math),t.SHA3})}(xu)),xu.exports}var yu={exports:{}},fh;function WD(){return fh||(fh=1,function(s,e){(function(t,r){s.exports=r(Ve())})(ye,function(t){/** @preserve
63
63
  (c) 2012 by Cédric Mesnil. All rights reserved.
64
64
 
65
65
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
@@ -68,13 +68,13 @@ ${Bf}`)}function ay(s,e,t){return(s>=0&&t?` ${Nf(s,e-1)}`:Nf(s,e)).padEnd(e)}fun
68
68
  - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
69
69
 
70
70
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
71
- */return function(r){var n=t,i=n.lib,a=i.WordArray,u=i.Hasher,f=n.algo,c=a.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),h=a.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),d=a.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),p=a.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),v=a.create([0,1518500249,1859775393,2400959708,2840853838]),x=a.create([1352829926,1548603684,1836072691,2053994217,0]),_=f.RIPEMD160=u.extend({_doReset:function(){this._hash=a.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(F,B){for(var M=0;M<16;M++){var O=B+M,C=F[O];F[O]=(C<<8|C>>>24)&16711935|(C<<24|C>>>8)&4278255360}var N=this._hash.words,I=v.words,L=x.words,k=c.words,z=h.words,R=d.words,V=p.words,H,ee,te,j,X,Y,Q,pe,De,we;Y=H=N[0],Q=ee=N[1],pe=te=N[2],De=j=N[3],we=X=N[4];for(var Ee,M=0;M<80;M+=1)Ee=H+F[B+k[M]]|0,M<16?Ee+=y(ee,te,j)+I[0]:M<32?Ee+=m(ee,te,j)+I[1]:M<48?Ee+=w(ee,te,j)+I[2]:M<64?Ee+=D(ee,te,j)+I[3]:Ee+=A(ee,te,j)+I[4],Ee=Ee|0,Ee=E(Ee,R[M]),Ee=Ee+X|0,H=X,X=j,j=E(te,10),te=ee,ee=Ee,Ee=Y+F[B+z[M]]|0,M<16?Ee+=A(Q,pe,De)+L[0]:M<32?Ee+=D(Q,pe,De)+L[1]:M<48?Ee+=w(Q,pe,De)+L[2]:M<64?Ee+=m(Q,pe,De)+L[3]:Ee+=y(Q,pe,De)+L[4],Ee=Ee|0,Ee=E(Ee,V[M]),Ee=Ee+we|0,Y=we,we=De,De=E(pe,10),pe=Q,Q=Ee;Ee=N[1]+te+De|0,N[1]=N[2]+j+we|0,N[2]=N[3]+X+Y|0,N[3]=N[4]+H+Q|0,N[4]=N[0]+ee+pe|0,N[0]=Ee},_doFinalize:function(){var F=this._data,B=F.words,M=this._nDataBytes*8,O=F.sigBytes*8;B[O>>>5]|=128<<24-O%32,B[(O+64>>>9<<4)+14]=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360,F.sigBytes=(B.length+1)*4,this._process();for(var C=this._hash,N=C.words,I=0;I<5;I++){var L=N[I];N[I]=(L<<8|L>>>24)&16711935|(L<<24|L>>>8)&4278255360}return C},clone:function(){var F=u.clone.call(this);return F._hash=this._hash.clone(),F}});function y(F,B,M){return F^B^M}function m(F,B,M){return F&B|~F&M}function w(F,B,M){return(F|~B)^M}function D(F,B,M){return F&M|B&~M}function A(F,B,M){return F^(B|~M)}function E(F,B){return F<<B|F>>>32-B}n.RIPEMD160=u._createHelper(_),n.HmacRIPEMD160=u._createHmacHelper(_)}(),t.RIPEMD160})}(yu)),yu.exports}var Du={exports:{}},hh;function wu(){return hh||(hh=1,function(s,e){(function(t,r){s.exports=r(Ve())})(ye,function(t){(function(){var r=t,n=r.lib,i=n.Base,a=r.enc,u=a.Utf8,f=r.algo;f.HMAC=i.extend({init:function(c,h){c=this._hasher=new c.init,typeof h=="string"&&(h=u.parse(h));var d=c.blockSize,p=d*4;h.sigBytes>p&&(h=c.finalize(h)),h.clamp();for(var v=this._oKey=h.clone(),x=this._iKey=h.clone(),_=v.words,y=x.words,m=0;m<d;m++)_[m]^=1549556828,y[m]^=909522486;v.sigBytes=x.sigBytes=p,this.reset()},reset:function(){var c=this._hasher;c.reset(),c.update(this._iKey)},update:function(c){return this._hasher.update(c),this},finalize:function(c){var h=this._hasher,d=h.finalize(c);h.reset();var p=h.finalize(this._oKey.clone().concat(d));return p}})})()})}(Du)),Du.exports}var Eu={exports:{}},dh;function HD(){return dh||(dh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),_u(),wu())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.Base,a=n.WordArray,u=r.algo,f=u.SHA256,c=u.HMAC,h=u.PBKDF2=i.extend({cfg:i.extend({keySize:128/32,hasher:f,iterations:25e4}),init:function(d){this.cfg=this.cfg.extend(d)},compute:function(d,p){for(var v=this.cfg,x=c.create(v.hasher,d),_=a.create(),y=a.create([1]),m=_.words,w=y.words,D=v.keySize,A=v.iterations;m.length<D;){var E=x.update(p).finalize(y);x.reset();for(var F=E.words,B=F.length,M=E,O=1;O<A;O++){M=x.finalize(M),x.reset();for(var C=M.words,N=0;N<B;N++)F[N]^=C[N]}_.concat(E),w[0]++}return _.sigBytes=D*4,_}});r.PBKDF2=function(d,p,v){return h.create(v).compute(d,p)}}(),t.PBKDF2})}(Eu)),Eu.exports}var bu={exports:{}},ph;function zn(){return ph||(ph=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),ih(),wu())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.Base,a=n.WordArray,u=r.algo,f=u.MD5,c=u.EvpKDF=i.extend({cfg:i.extend({keySize:128/32,hasher:f,iterations:1}),init:function(h){this.cfg=this.cfg.extend(h)},compute:function(h,d){for(var p,v=this.cfg,x=v.hasher.create(),_=a.create(),y=_.words,m=v.keySize,w=v.iterations;y.length<m;){p&&x.update(p),p=x.update(h).finalize(d),x.reset();for(var D=1;D<w;D++)p=x.finalize(p),x.reset();_.concat(p)}return _.sigBytes=m*4,_}});r.EvpKDF=function(h,d,p){return c.create(p).compute(h,d)}}(),t.EvpKDF})}(bu)),bu.exports}var Au={exports:{}},_h;function Yt(){return _h||(_h=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),zn())})(ye,function(t){t.lib.Cipher||function(r){var n=t,i=n.lib,a=i.Base,u=i.WordArray,f=i.BufferedBlockAlgorithm,c=n.enc;c.Utf8;var h=c.Base64,d=n.algo,p=d.EvpKDF,v=i.Cipher=f.extend({cfg:a.extend(),createEncryptor:function(C,N){return this.create(this._ENC_XFORM_MODE,C,N)},createDecryptor:function(C,N){return this.create(this._DEC_XFORM_MODE,C,N)},init:function(C,N,I){this.cfg=this.cfg.extend(I),this._xformMode=C,this._key=N,this.reset()},reset:function(){f.reset.call(this),this._doReset()},process:function(C){return this._append(C),this._process()},finalize:function(C){C&&this._append(C);var N=this._doFinalize();return N},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function C(N){return typeof N=="string"?O:F}return function(N){return{encrypt:function(I,L,k){return C(L).encrypt(N,I,L,k)},decrypt:function(I,L,k){return C(L).decrypt(N,I,L,k)}}}}()});i.StreamCipher=v.extend({_doFinalize:function(){var C=this._process(!0);return C},blockSize:1});var x=n.mode={},_=i.BlockCipherMode=a.extend({createEncryptor:function(C,N){return this.Encryptor.create(C,N)},createDecryptor:function(C,N){return this.Decryptor.create(C,N)},init:function(C,N){this._cipher=C,this._iv=N}}),y=x.CBC=function(){var C=_.extend();C.Encryptor=C.extend({processBlock:function(I,L){var k=this._cipher,z=k.blockSize;N.call(this,I,L,z),k.encryptBlock(I,L),this._prevBlock=I.slice(L,L+z)}}),C.Decryptor=C.extend({processBlock:function(I,L){var k=this._cipher,z=k.blockSize,R=I.slice(L,L+z);k.decryptBlock(I,L),N.call(this,I,L,z),this._prevBlock=R}});function N(I,L,k){var z,R=this._iv;R?(z=R,this._iv=r):z=this._prevBlock;for(var V=0;V<k;V++)I[L+V]^=z[V]}return C}(),m=n.pad={},w=m.Pkcs7={pad:function(C,N){for(var I=N*4,L=I-C.sigBytes%I,k=L<<24|L<<16|L<<8|L,z=[],R=0;R<L;R+=4)z.push(k);var V=u.create(z,L);C.concat(V)},unpad:function(C){var N=C.words[C.sigBytes-1>>>2]&255;C.sigBytes-=N}};i.BlockCipher=v.extend({cfg:v.cfg.extend({mode:y,padding:w}),reset:function(){var C;v.reset.call(this);var N=this.cfg,I=N.iv,L=N.mode;this._xformMode==this._ENC_XFORM_MODE?C=L.createEncryptor:(C=L.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==C?this._mode.init(this,I&&I.words):(this._mode=C.call(L,this,I&&I.words),this._mode.__creator=C)},_doProcessBlock:function(C,N){this._mode.processBlock(C,N)},_doFinalize:function(){var C,N=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(N.pad(this._data,this.blockSize),C=this._process(!0)):(C=this._process(!0),N.unpad(C)),C},blockSize:128/32});var D=i.CipherParams=a.extend({init:function(C){this.mixIn(C)},toString:function(C){return(C||this.formatter).stringify(this)}}),A=n.format={},E=A.OpenSSL={stringify:function(C){var N,I=C.ciphertext,L=C.salt;return L?N=u.create([1398893684,1701076831]).concat(L).concat(I):N=I,N.toString(h)},parse:function(C){var N,I=h.parse(C),L=I.words;return L[0]==1398893684&&L[1]==1701076831&&(N=u.create(L.slice(2,4)),L.splice(0,4),I.sigBytes-=16),D.create({ciphertext:I,salt:N})}},F=i.SerializableCipher=a.extend({cfg:a.extend({format:E}),encrypt:function(C,N,I,L){L=this.cfg.extend(L);var k=C.createEncryptor(I,L),z=k.finalize(N),R=k.cfg;return D.create({ciphertext:z,key:I,iv:R.iv,algorithm:C,mode:R.mode,padding:R.padding,blockSize:C.blockSize,formatter:L.format})},decrypt:function(C,N,I,L){L=this.cfg.extend(L),N=this._parse(N,L.format);var k=C.createDecryptor(I,L).finalize(N.ciphertext);return k},_parse:function(C,N){return typeof C=="string"?N.parse(C,this):C}}),B=n.kdf={},M=B.OpenSSL={execute:function(C,N,I,L,k){if(L||(L=u.random(64/8)),k)var z=p.create({keySize:N+I,hasher:k}).compute(C,L);else var z=p.create({keySize:N+I}).compute(C,L);var R=u.create(z.words.slice(N),I*4);return z.sigBytes=N*4,D.create({key:z,iv:R,salt:L})}},O=i.PasswordBasedCipher=F.extend({cfg:F.cfg.extend({kdf:M}),encrypt:function(C,N,I,L){L=this.cfg.extend(L);var k=L.kdf.execute(I,C.keySize,C.ivSize,L.salt,L.hasher);L.iv=k.iv;var z=F.encrypt.call(this,C,N,k.key,L);return z.mixIn(k),z},decrypt:function(C,N,I,L){L=this.cfg.extend(L),N=this._parse(N,L.format);var k=L.kdf.execute(I,C.keySize,C.ivSize,N.salt,L.hasher);L.iv=k.iv;var z=F.decrypt.call(this,C,N,k.key,L);return z}})}()})}(Au)),Au.exports}var Cu={exports:{}},vh;function jD(){return vh||(vh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Yt())})(ye,function(t){return t.mode.CFB=function(){var r=t.lib.BlockCipherMode.extend();r.Encryptor=r.extend({processBlock:function(i,a){var u=this._cipher,f=u.blockSize;n.call(this,i,a,f,u),this._prevBlock=i.slice(a,a+f)}}),r.Decryptor=r.extend({processBlock:function(i,a){var u=this._cipher,f=u.blockSize,c=i.slice(a,a+f);n.call(this,i,a,f,u),this._prevBlock=c}});function n(i,a,u,f){var c,h=this._iv;h?(c=h.slice(0),this._iv=void 0):c=this._prevBlock,f.encryptBlock(c,0);for(var d=0;d<u;d++)i[a+d]^=c[d]}return r}(),t.mode.CFB})}(Cu)),Cu.exports}var Fu={exports:{}},gh;function YD(){return gh||(gh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Yt())})(ye,function(t){return t.mode.CTR=function(){var r=t.lib.BlockCipherMode.extend(),n=r.Encryptor=r.extend({processBlock:function(i,a){var u=this._cipher,f=u.blockSize,c=this._iv,h=this._counter;c&&(h=this._counter=c.slice(0),this._iv=void 0);var d=h.slice(0);u.encryptBlock(d,0),h[f-1]=h[f-1]+1|0;for(var p=0;p<f;p++)i[a+p]^=d[p]}});return r.Decryptor=n,r}(),t.mode.CTR})}(Fu)),Fu.exports}var Bu={exports:{}},mh;function KD(){return mh||(mh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Yt())})(ye,function(t){/** @preserve
71
+ */return function(r){var n=t,i=n.lib,a=i.WordArray,u=i.Hasher,f=n.algo,c=a.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),h=a.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),d=a.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),p=a.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),v=a.create([0,1518500249,1859775393,2400959708,2840853838]),x=a.create([1352829926,1548603684,1836072691,2053994217,0]),_=f.RIPEMD160=u.extend({_doReset:function(){this._hash=a.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(F,B){for(var M=0;M<16;M++){var O=B+M,A=F[O];F[O]=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360}var N=this._hash.words,I=v.words,L=x.words,k=c.words,z=h.words,R=d.words,V=p.words,H,ee,te,j,X,Y,Q,pe,De,we;Y=H=N[0],Q=ee=N[1],pe=te=N[2],De=j=N[3],we=X=N[4];for(var be,M=0;M<80;M+=1)be=H+F[B+k[M]]|0,M<16?be+=y(ee,te,j)+I[0]:M<32?be+=m(ee,te,j)+I[1]:M<48?be+=w(ee,te,j)+I[2]:M<64?be+=D(ee,te,j)+I[3]:be+=C(ee,te,j)+I[4],be=be|0,be=b(be,R[M]),be=be+X|0,H=X,X=j,j=b(te,10),te=ee,ee=be,be=Y+F[B+z[M]]|0,M<16?be+=C(Q,pe,De)+L[0]:M<32?be+=D(Q,pe,De)+L[1]:M<48?be+=w(Q,pe,De)+L[2]:M<64?be+=m(Q,pe,De)+L[3]:be+=y(Q,pe,De)+L[4],be=be|0,be=b(be,V[M]),be=be+we|0,Y=we,we=De,De=b(pe,10),pe=Q,Q=be;be=N[1]+te+De|0,N[1]=N[2]+j+we|0,N[2]=N[3]+X+Y|0,N[3]=N[4]+H+Q|0,N[4]=N[0]+ee+pe|0,N[0]=be},_doFinalize:function(){var F=this._data,B=F.words,M=this._nDataBytes*8,O=F.sigBytes*8;B[O>>>5]|=128<<24-O%32,B[(O+64>>>9<<4)+14]=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360,F.sigBytes=(B.length+1)*4,this._process();for(var A=this._hash,N=A.words,I=0;I<5;I++){var L=N[I];N[I]=(L<<8|L>>>24)&16711935|(L<<24|L>>>8)&4278255360}return A},clone:function(){var F=u.clone.call(this);return F._hash=this._hash.clone(),F}});function y(F,B,M){return F^B^M}function m(F,B,M){return F&B|~F&M}function w(F,B,M){return(F|~B)^M}function D(F,B,M){return F&M|B&~M}function C(F,B,M){return F^(B|~M)}function b(F,B){return F<<B|F>>>32-B}n.RIPEMD160=u._createHelper(_),n.HmacRIPEMD160=u._createHmacHelper(_)}(),t.RIPEMD160})}(yu)),yu.exports}var Du={exports:{}},hh;function wu(){return hh||(hh=1,function(s,e){(function(t,r){s.exports=r(Ve())})(ye,function(t){(function(){var r=t,n=r.lib,i=n.Base,a=r.enc,u=a.Utf8,f=r.algo;f.HMAC=i.extend({init:function(c,h){c=this._hasher=new c.init,typeof h=="string"&&(h=u.parse(h));var d=c.blockSize,p=d*4;h.sigBytes>p&&(h=c.finalize(h)),h.clamp();for(var v=this._oKey=h.clone(),x=this._iKey=h.clone(),_=v.words,y=x.words,m=0;m<d;m++)_[m]^=1549556828,y[m]^=909522486;v.sigBytes=x.sigBytes=p,this.reset()},reset:function(){var c=this._hasher;c.reset(),c.update(this._iKey)},update:function(c){return this._hasher.update(c),this},finalize:function(c){var h=this._hasher,d=h.finalize(c);h.reset();var p=h.finalize(this._oKey.clone().concat(d));return p}})})()})}(Du)),Du.exports}var bu={exports:{}},dh;function HD(){return dh||(dh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),_u(),wu())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.Base,a=n.WordArray,u=r.algo,f=u.SHA256,c=u.HMAC,h=u.PBKDF2=i.extend({cfg:i.extend({keySize:128/32,hasher:f,iterations:25e4}),init:function(d){this.cfg=this.cfg.extend(d)},compute:function(d,p){for(var v=this.cfg,x=c.create(v.hasher,d),_=a.create(),y=a.create([1]),m=_.words,w=y.words,D=v.keySize,C=v.iterations;m.length<D;){var b=x.update(p).finalize(y);x.reset();for(var F=b.words,B=F.length,M=b,O=1;O<C;O++){M=x.finalize(M),x.reset();for(var A=M.words,N=0;N<B;N++)F[N]^=A[N]}_.concat(b),w[0]++}return _.sigBytes=D*4,_}});r.PBKDF2=function(d,p,v){return h.create(v).compute(d,p)}}(),t.PBKDF2})}(bu)),bu.exports}var Eu={exports:{}},ph;function zn(){return ph||(ph=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),ih(),wu())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.Base,a=n.WordArray,u=r.algo,f=u.MD5,c=u.EvpKDF=i.extend({cfg:i.extend({keySize:128/32,hasher:f,iterations:1}),init:function(h){this.cfg=this.cfg.extend(h)},compute:function(h,d){for(var p,v=this.cfg,x=v.hasher.create(),_=a.create(),y=_.words,m=v.keySize,w=v.iterations;y.length<m;){p&&x.update(p),p=x.update(h).finalize(d),x.reset();for(var D=1;D<w;D++)p=x.finalize(p),x.reset();_.concat(p)}return _.sigBytes=m*4,_}});r.EvpKDF=function(h,d,p){return c.create(p).compute(h,d)}}(),t.EvpKDF})}(Eu)),Eu.exports}var Cu={exports:{}},_h;function Yt(){return _h||(_h=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),zn())})(ye,function(t){t.lib.Cipher||function(r){var n=t,i=n.lib,a=i.Base,u=i.WordArray,f=i.BufferedBlockAlgorithm,c=n.enc;c.Utf8;var h=c.Base64,d=n.algo,p=d.EvpKDF,v=i.Cipher=f.extend({cfg:a.extend(),createEncryptor:function(A,N){return this.create(this._ENC_XFORM_MODE,A,N)},createDecryptor:function(A,N){return this.create(this._DEC_XFORM_MODE,A,N)},init:function(A,N,I){this.cfg=this.cfg.extend(I),this._xformMode=A,this._key=N,this.reset()},reset:function(){f.reset.call(this),this._doReset()},process:function(A){return this._append(A),this._process()},finalize:function(A){A&&this._append(A);var N=this._doFinalize();return N},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function A(N){return typeof N=="string"?O:F}return function(N){return{encrypt:function(I,L,k){return A(L).encrypt(N,I,L,k)},decrypt:function(I,L,k){return A(L).decrypt(N,I,L,k)}}}}()});i.StreamCipher=v.extend({_doFinalize:function(){var A=this._process(!0);return A},blockSize:1});var x=n.mode={},_=i.BlockCipherMode=a.extend({createEncryptor:function(A,N){return this.Encryptor.create(A,N)},createDecryptor:function(A,N){return this.Decryptor.create(A,N)},init:function(A,N){this._cipher=A,this._iv=N}}),y=x.CBC=function(){var A=_.extend();A.Encryptor=A.extend({processBlock:function(I,L){var k=this._cipher,z=k.blockSize;N.call(this,I,L,z),k.encryptBlock(I,L),this._prevBlock=I.slice(L,L+z)}}),A.Decryptor=A.extend({processBlock:function(I,L){var k=this._cipher,z=k.blockSize,R=I.slice(L,L+z);k.decryptBlock(I,L),N.call(this,I,L,z),this._prevBlock=R}});function N(I,L,k){var z,R=this._iv;R?(z=R,this._iv=r):z=this._prevBlock;for(var V=0;V<k;V++)I[L+V]^=z[V]}return A}(),m=n.pad={},w=m.Pkcs7={pad:function(A,N){for(var I=N*4,L=I-A.sigBytes%I,k=L<<24|L<<16|L<<8|L,z=[],R=0;R<L;R+=4)z.push(k);var V=u.create(z,L);A.concat(V)},unpad:function(A){var N=A.words[A.sigBytes-1>>>2]&255;A.sigBytes-=N}};i.BlockCipher=v.extend({cfg:v.cfg.extend({mode:y,padding:w}),reset:function(){var A;v.reset.call(this);var N=this.cfg,I=N.iv,L=N.mode;this._xformMode==this._ENC_XFORM_MODE?A=L.createEncryptor:(A=L.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==A?this._mode.init(this,I&&I.words):(this._mode=A.call(L,this,I&&I.words),this._mode.__creator=A)},_doProcessBlock:function(A,N){this._mode.processBlock(A,N)},_doFinalize:function(){var A,N=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(N.pad(this._data,this.blockSize),A=this._process(!0)):(A=this._process(!0),N.unpad(A)),A},blockSize:128/32});var D=i.CipherParams=a.extend({init:function(A){this.mixIn(A)},toString:function(A){return(A||this.formatter).stringify(this)}}),C=n.format={},b=C.OpenSSL={stringify:function(A){var N,I=A.ciphertext,L=A.salt;return L?N=u.create([1398893684,1701076831]).concat(L).concat(I):N=I,N.toString(h)},parse:function(A){var N,I=h.parse(A),L=I.words;return L[0]==1398893684&&L[1]==1701076831&&(N=u.create(L.slice(2,4)),L.splice(0,4),I.sigBytes-=16),D.create({ciphertext:I,salt:N})}},F=i.SerializableCipher=a.extend({cfg:a.extend({format:b}),encrypt:function(A,N,I,L){L=this.cfg.extend(L);var k=A.createEncryptor(I,L),z=k.finalize(N),R=k.cfg;return D.create({ciphertext:z,key:I,iv:R.iv,algorithm:A,mode:R.mode,padding:R.padding,blockSize:A.blockSize,formatter:L.format})},decrypt:function(A,N,I,L){L=this.cfg.extend(L),N=this._parse(N,L.format);var k=A.createDecryptor(I,L).finalize(N.ciphertext);return k},_parse:function(A,N){return typeof A=="string"?N.parse(A,this):A}}),B=n.kdf={},M=B.OpenSSL={execute:function(A,N,I,L,k){if(L||(L=u.random(64/8)),k)var z=p.create({keySize:N+I,hasher:k}).compute(A,L);else var z=p.create({keySize:N+I}).compute(A,L);var R=u.create(z.words.slice(N),I*4);return z.sigBytes=N*4,D.create({key:z,iv:R,salt:L})}},O=i.PasswordBasedCipher=F.extend({cfg:F.cfg.extend({kdf:M}),encrypt:function(A,N,I,L){L=this.cfg.extend(L);var k=L.kdf.execute(I,A.keySize,A.ivSize,L.salt,L.hasher);L.iv=k.iv;var z=F.encrypt.call(this,A,N,k.key,L);return z.mixIn(k),z},decrypt:function(A,N,I,L){L=this.cfg.extend(L),N=this._parse(N,L.format);var k=L.kdf.execute(I,A.keySize,A.ivSize,N.salt,L.hasher);L.iv=k.iv;var z=F.decrypt.call(this,A,N,k.key,L);return z}})}()})}(Cu)),Cu.exports}var Au={exports:{}},vh;function jD(){return vh||(vh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Yt())})(ye,function(t){return t.mode.CFB=function(){var r=t.lib.BlockCipherMode.extend();r.Encryptor=r.extend({processBlock:function(i,a){var u=this._cipher,f=u.blockSize;n.call(this,i,a,f,u),this._prevBlock=i.slice(a,a+f)}}),r.Decryptor=r.extend({processBlock:function(i,a){var u=this._cipher,f=u.blockSize,c=i.slice(a,a+f);n.call(this,i,a,f,u),this._prevBlock=c}});function n(i,a,u,f){var c,h=this._iv;h?(c=h.slice(0),this._iv=void 0):c=this._prevBlock,f.encryptBlock(c,0);for(var d=0;d<u;d++)i[a+d]^=c[d]}return r}(),t.mode.CFB})}(Au)),Au.exports}var Fu={exports:{}},gh;function YD(){return gh||(gh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Yt())})(ye,function(t){return t.mode.CTR=function(){var r=t.lib.BlockCipherMode.extend(),n=r.Encryptor=r.extend({processBlock:function(i,a){var u=this._cipher,f=u.blockSize,c=this._iv,h=this._counter;c&&(h=this._counter=c.slice(0),this._iv=void 0);var d=h.slice(0);u.encryptBlock(d,0),h[f-1]=h[f-1]+1|0;for(var p=0;p<f;p++)i[a+p]^=d[p]}});return r.Decryptor=n,r}(),t.mode.CTR})}(Fu)),Fu.exports}var Bu={exports:{}},mh;function KD(){return mh||(mh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Yt())})(ye,function(t){/** @preserve
72
72
  * Counter block mode compatible with Dr Brian Gladman fileenc.c
73
73
  * derived from CryptoJS.mode.CTR
74
74
  * Jan Hruby jhruby.web@gmail.com
75
- */return t.mode.CTRGladman=function(){var r=t.lib.BlockCipherMode.extend();function n(u){if((u>>24&255)===255){var f=u>>16&255,c=u>>8&255,h=u&255;f===255?(f=0,c===255?(c=0,h===255?h=0:++h):++c):++f,u=0,u+=f<<16,u+=c<<8,u+=h}else u+=1<<24;return u}function i(u){return(u[0]=n(u[0]))===0&&(u[1]=n(u[1])),u}var a=r.Encryptor=r.extend({processBlock:function(u,f){var c=this._cipher,h=c.blockSize,d=this._iv,p=this._counter;d&&(p=this._counter=d.slice(0),this._iv=void 0),i(p);var v=p.slice(0);c.encryptBlock(v,0);for(var x=0;x<h;x++)u[f+x]^=v[x]}});return r.Decryptor=a,r}(),t.mode.CTRGladman})}(Bu)),Bu.exports}var Mu={exports:{}},xh;function ZD(){return xh||(xh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Yt())})(ye,function(t){return t.mode.OFB=function(){var r=t.lib.BlockCipherMode.extend(),n=r.Encryptor=r.extend({processBlock:function(i,a){var u=this._cipher,f=u.blockSize,c=this._iv,h=this._keystream;c&&(h=this._keystream=c.slice(0),this._iv=void 0),u.encryptBlock(h,0);for(var d=0;d<f;d++)i[a+d]^=h[d]}});return r.Decryptor=n,r}(),t.mode.OFB})}(Mu)),Mu.exports}var Nu={exports:{}},yh;function VD(){return yh||(yh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Yt())})(ye,function(t){return t.mode.ECB=function(){var r=t.lib.BlockCipherMode.extend();return r.Encryptor=r.extend({processBlock:function(n,i){this._cipher.encryptBlock(n,i)}}),r.Decryptor=r.extend({processBlock:function(n,i){this._cipher.decryptBlock(n,i)}}),r}(),t.mode.ECB})}(Nu)),Nu.exports}var Su={exports:{}},Dh;function GD(){return Dh||(Dh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Yt())})(ye,function(t){return t.pad.AnsiX923={pad:function(r,n){var i=r.sigBytes,a=n*4,u=a-i%a,f=i+u-1;r.clamp(),r.words[f>>>2]|=u<<24-f%4*8,r.sigBytes+=u},unpad:function(r){var n=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=n}},t.pad.Ansix923})}(Su)),Su.exports}var Ou={exports:{}},wh;function XD(){return wh||(wh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Yt())})(ye,function(t){return t.pad.Iso10126={pad:function(r,n){var i=n*4,a=i-r.sigBytes%i;r.concat(t.lib.WordArray.random(a-1)).concat(t.lib.WordArray.create([a<<24],1))},unpad:function(r){var n=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=n}},t.pad.Iso10126})}(Ou)),Ou.exports}var Iu={exports:{}},Eh;function QD(){return Eh||(Eh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Yt())})(ye,function(t){return t.pad.Iso97971={pad:function(r,n){r.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(r,n)},unpad:function(r){t.pad.ZeroPadding.unpad(r),r.sigBytes--}},t.pad.Iso97971})}(Iu)),Iu.exports}var Tu={exports:{}},bh;function JD(){return bh||(bh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Yt())})(ye,function(t){return t.pad.ZeroPadding={pad:function(r,n){var i=n*4;r.clamp(),r.sigBytes+=i-(r.sigBytes%i||i)},unpad:function(r){for(var n=r.words,i=r.sigBytes-1,i=r.sigBytes-1;i>=0;i--)if(n[i>>>2]>>>24-i%4*8&255){r.sigBytes=i+1;break}}},t.pad.ZeroPadding})}(Tu)),Tu.exports}var $u={exports:{}},Ah;function ew(){return Ah||(Ah=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Yt())})(ye,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})}($u)),$u.exports}var Lu={exports:{}},Ch;function tw(){return Ch||(Ch=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Yt())})(ye,function(t){return function(r){var n=t,i=n.lib,a=i.CipherParams,u=n.enc,f=u.Hex,c=n.format;c.Hex={stringify:function(h){return h.ciphertext.toString(f)},parse:function(h){var d=f.parse(h);return a.create({ciphertext:d})}}}(),t.format.Hex})}(Lu)),Lu.exports}var Ru={exports:{}},Fh;function rw(){return Fh||(Fh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),oi(),ai(),zn(),Yt())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.BlockCipher,a=r.algo,u=[],f=[],c=[],h=[],d=[],p=[],v=[],x=[],_=[],y=[];(function(){for(var D=[],A=0;A<256;A++)A<128?D[A]=A<<1:D[A]=A<<1^283;for(var E=0,F=0,A=0;A<256;A++){var B=F^F<<1^F<<2^F<<3^F<<4;B=B>>>8^B&255^99,u[E]=B,f[B]=E;var M=D[E],O=D[M],C=D[O],N=D[B]*257^B*16843008;c[E]=N<<24|N>>>8,h[E]=N<<16|N>>>16,d[E]=N<<8|N>>>24,p[E]=N;var N=C*16843009^O*65537^M*257^E*16843008;v[B]=N<<24|N>>>8,x[B]=N<<16|N>>>16,_[B]=N<<8|N>>>24,y[B]=N,E?(E=M^D[D[D[C^M]]],F^=D[D[F]]):E=F=1}})();var m=[0,1,2,4,8,16,32,64,128,27,54],w=a.AES=i.extend({_doReset:function(){var D;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var A=this._keyPriorReset=this._key,E=A.words,F=A.sigBytes/4,B=this._nRounds=F+6,M=(B+1)*4,O=this._keySchedule=[],C=0;C<M;C++)C<F?O[C]=E[C]:(D=O[C-1],C%F?F>6&&C%F==4&&(D=u[D>>>24]<<24|u[D>>>16&255]<<16|u[D>>>8&255]<<8|u[D&255]):(D=D<<8|D>>>24,D=u[D>>>24]<<24|u[D>>>16&255]<<16|u[D>>>8&255]<<8|u[D&255],D^=m[C/F|0]<<24),O[C]=O[C-F]^D);for(var N=this._invKeySchedule=[],I=0;I<M;I++){var C=M-I;if(I%4)var D=O[C];else var D=O[C-4];I<4||C<=4?N[I]=D:N[I]=v[u[D>>>24]]^x[u[D>>>16&255]]^_[u[D>>>8&255]]^y[u[D&255]]}}},encryptBlock:function(D,A){this._doCryptBlock(D,A,this._keySchedule,c,h,d,p,u)},decryptBlock:function(D,A){var E=D[A+1];D[A+1]=D[A+3],D[A+3]=E,this._doCryptBlock(D,A,this._invKeySchedule,v,x,_,y,f);var E=D[A+1];D[A+1]=D[A+3],D[A+3]=E},_doCryptBlock:function(D,A,E,F,B,M,O,C){for(var N=this._nRounds,I=D[A]^E[0],L=D[A+1]^E[1],k=D[A+2]^E[2],z=D[A+3]^E[3],R=4,V=1;V<N;V++){var H=F[I>>>24]^B[L>>>16&255]^M[k>>>8&255]^O[z&255]^E[R++],ee=F[L>>>24]^B[k>>>16&255]^M[z>>>8&255]^O[I&255]^E[R++],te=F[k>>>24]^B[z>>>16&255]^M[I>>>8&255]^O[L&255]^E[R++],j=F[z>>>24]^B[I>>>16&255]^M[L>>>8&255]^O[k&255]^E[R++];I=H,L=ee,k=te,z=j}var H=(C[I>>>24]<<24|C[L>>>16&255]<<16|C[k>>>8&255]<<8|C[z&255])^E[R++],ee=(C[L>>>24]<<24|C[k>>>16&255]<<16|C[z>>>8&255]<<8|C[I&255])^E[R++],te=(C[k>>>24]<<24|C[z>>>16&255]<<16|C[I>>>8&255]<<8|C[L&255])^E[R++],j=(C[z>>>24]<<24|C[I>>>16&255]<<16|C[L>>>8&255]<<8|C[k&255])^E[R++];D[A]=H,D[A+1]=ee,D[A+2]=te,D[A+3]=j},keySize:256/32});r.AES=i._createHelper(w)}(),t.AES})}(Ru)),Ru.exports}var Pu={exports:{}},Bh;function nw(){return Bh||(Bh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),oi(),ai(),zn(),Yt())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.WordArray,a=n.BlockCipher,u=r.algo,f=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],c=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],h=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],d=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],p=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],v=u.DES=a.extend({_doReset:function(){for(var m=this._key,w=m.words,D=[],A=0;A<56;A++){var E=f[A]-1;D[A]=w[E>>>5]>>>31-E%32&1}for(var F=this._subKeys=[],B=0;B<16;B++){for(var M=F[B]=[],O=h[B],A=0;A<24;A++)M[A/6|0]|=D[(c[A]-1+O)%28]<<31-A%6,M[4+(A/6|0)]|=D[28+(c[A+24]-1+O)%28]<<31-A%6;M[0]=M[0]<<1|M[0]>>>31;for(var A=1;A<7;A++)M[A]=M[A]>>>(A-1)*4+3;M[7]=M[7]<<5|M[7]>>>27}for(var C=this._invSubKeys=[],A=0;A<16;A++)C[A]=F[15-A]},encryptBlock:function(m,w){this._doCryptBlock(m,w,this._subKeys)},decryptBlock:function(m,w){this._doCryptBlock(m,w,this._invSubKeys)},_doCryptBlock:function(m,w,D){this._lBlock=m[w],this._rBlock=m[w+1],x.call(this,4,252645135),x.call(this,16,65535),_.call(this,2,858993459),_.call(this,8,16711935),x.call(this,1,1431655765);for(var A=0;A<16;A++){for(var E=D[A],F=this._lBlock,B=this._rBlock,M=0,O=0;O<8;O++)M|=d[O][((B^E[O])&p[O])>>>0];this._lBlock=B,this._rBlock=F^M}var C=this._lBlock;this._lBlock=this._rBlock,this._rBlock=C,x.call(this,1,1431655765),_.call(this,8,16711935),_.call(this,2,858993459),x.call(this,16,65535),x.call(this,4,252645135),m[w]=this._lBlock,m[w+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function x(m,w){var D=(this._lBlock>>>m^this._rBlock)&w;this._rBlock^=D,this._lBlock^=D<<m}function _(m,w){var D=(this._rBlock>>>m^this._lBlock)&w;this._lBlock^=D,this._rBlock^=D<<m}r.DES=a._createHelper(v);var y=u.TripleDES=a.extend({_doReset:function(){var m=this._key,w=m.words;if(w.length!==2&&w.length!==4&&w.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var D=w.slice(0,2),A=w.length<4?w.slice(0,2):w.slice(2,4),E=w.length<6?w.slice(0,2):w.slice(4,6);this._des1=v.createEncryptor(i.create(D)),this._des2=v.createEncryptor(i.create(A)),this._des3=v.createEncryptor(i.create(E))},encryptBlock:function(m,w){this._des1.encryptBlock(m,w),this._des2.decryptBlock(m,w),this._des3.encryptBlock(m,w)},decryptBlock:function(m,w){this._des3.decryptBlock(m,w),this._des2.encryptBlock(m,w),this._des1.decryptBlock(m,w)},keySize:192/32,ivSize:64/32,blockSize:64/32});r.TripleDES=a._createHelper(y)}(),t.TripleDES})}(Pu)),Pu.exports}var ku={exports:{}},Mh;function iw(){return Mh||(Mh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),oi(),ai(),zn(),Yt())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.StreamCipher,a=r.algo,u=a.RC4=i.extend({_doReset:function(){for(var h=this._key,d=h.words,p=h.sigBytes,v=this._S=[],x=0;x<256;x++)v[x]=x;for(var x=0,_=0;x<256;x++){var y=x%p,m=d[y>>>2]>>>24-y%4*8&255;_=(_+v[x]+m)%256;var w=v[x];v[x]=v[_],v[_]=w}this._i=this._j=0},_doProcessBlock:function(h,d){h[d]^=f.call(this)},keySize:256/32,ivSize:0});function f(){for(var h=this._S,d=this._i,p=this._j,v=0,x=0;x<4;x++){d=(d+1)%256,p=(p+h[d])%256;var _=h[d];h[d]=h[p],h[p]=_,v|=h[(h[d]+h[p])%256]<<24-x*8}return this._i=d,this._j=p,v}r.RC4=i._createHelper(u);var c=a.RC4Drop=u.extend({cfg:u.cfg.extend({drop:192}),_doReset:function(){u._doReset.call(this);for(var h=this.cfg.drop;h>0;h--)f.call(this)}});r.RC4Drop=i._createHelper(c)}(),t.RC4})}(ku)),ku.exports}var zu={exports:{}},Nh;function sw(){return Nh||(Nh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),oi(),ai(),zn(),Yt())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.StreamCipher,a=r.algo,u=[],f=[],c=[],h=a.Rabbit=i.extend({_doReset:function(){for(var p=this._key.words,v=this.cfg.iv,x=0;x<4;x++)p[x]=(p[x]<<8|p[x]>>>24)&16711935|(p[x]<<24|p[x]>>>8)&4278255360;var _=this._X=[p[0],p[3]<<16|p[2]>>>16,p[1],p[0]<<16|p[3]>>>16,p[2],p[1]<<16|p[0]>>>16,p[3],p[2]<<16|p[1]>>>16],y=this._C=[p[2]<<16|p[2]>>>16,p[0]&4294901760|p[1]&65535,p[3]<<16|p[3]>>>16,p[1]&4294901760|p[2]&65535,p[0]<<16|p[0]>>>16,p[2]&4294901760|p[3]&65535,p[1]<<16|p[1]>>>16,p[3]&4294901760|p[0]&65535];this._b=0;for(var x=0;x<4;x++)d.call(this);for(var x=0;x<8;x++)y[x]^=_[x+4&7];if(v){var m=v.words,w=m[0],D=m[1],A=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,E=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,F=A>>>16|E&4294901760,B=E<<16|A&65535;y[0]^=A,y[1]^=F,y[2]^=E,y[3]^=B,y[4]^=A,y[5]^=F,y[6]^=E,y[7]^=B;for(var x=0;x<4;x++)d.call(this)}},_doProcessBlock:function(p,v){var x=this._X;d.call(this),u[0]=x[0]^x[5]>>>16^x[3]<<16,u[1]=x[2]^x[7]>>>16^x[5]<<16,u[2]=x[4]^x[1]>>>16^x[7]<<16,u[3]=x[6]^x[3]>>>16^x[1]<<16;for(var _=0;_<4;_++)u[_]=(u[_]<<8|u[_]>>>24)&16711935|(u[_]<<24|u[_]>>>8)&4278255360,p[v+_]^=u[_]},blockSize:128/32,ivSize:64/32});function d(){for(var p=this._X,v=this._C,x=0;x<8;x++)f[x]=v[x];v[0]=v[0]+1295307597+this._b|0,v[1]=v[1]+3545052371+(v[0]>>>0<f[0]>>>0?1:0)|0,v[2]=v[2]+886263092+(v[1]>>>0<f[1]>>>0?1:0)|0,v[3]=v[3]+1295307597+(v[2]>>>0<f[2]>>>0?1:0)|0,v[4]=v[4]+3545052371+(v[3]>>>0<f[3]>>>0?1:0)|0,v[5]=v[5]+886263092+(v[4]>>>0<f[4]>>>0?1:0)|0,v[6]=v[6]+1295307597+(v[5]>>>0<f[5]>>>0?1:0)|0,v[7]=v[7]+3545052371+(v[6]>>>0<f[6]>>>0?1:0)|0,this._b=v[7]>>>0<f[7]>>>0?1:0;for(var x=0;x<8;x++){var _=p[x]+v[x],y=_&65535,m=_>>>16,w=((y*y>>>17)+y*m>>>15)+m*m,D=((_&4294901760)*_|0)+((_&65535)*_|0);c[x]=w^D}p[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,p[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,p[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,p[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,p[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,p[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,p[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,p[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}r.Rabbit=i._createHelper(h)}(),t.Rabbit})}(zu)),zu.exports}var qu={exports:{}},Sh;function ow(){return Sh||(Sh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),oi(),ai(),zn(),Yt())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.StreamCipher,a=r.algo,u=[],f=[],c=[],h=a.RabbitLegacy=i.extend({_doReset:function(){var p=this._key.words,v=this.cfg.iv,x=this._X=[p[0],p[3]<<16|p[2]>>>16,p[1],p[0]<<16|p[3]>>>16,p[2],p[1]<<16|p[0]>>>16,p[3],p[2]<<16|p[1]>>>16],_=this._C=[p[2]<<16|p[2]>>>16,p[0]&4294901760|p[1]&65535,p[3]<<16|p[3]>>>16,p[1]&4294901760|p[2]&65535,p[0]<<16|p[0]>>>16,p[2]&4294901760|p[3]&65535,p[1]<<16|p[1]>>>16,p[3]&4294901760|p[0]&65535];this._b=0;for(var y=0;y<4;y++)d.call(this);for(var y=0;y<8;y++)_[y]^=x[y+4&7];if(v){var m=v.words,w=m[0],D=m[1],A=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,E=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,F=A>>>16|E&4294901760,B=E<<16|A&65535;_[0]^=A,_[1]^=F,_[2]^=E,_[3]^=B,_[4]^=A,_[5]^=F,_[6]^=E,_[7]^=B;for(var y=0;y<4;y++)d.call(this)}},_doProcessBlock:function(p,v){var x=this._X;d.call(this),u[0]=x[0]^x[5]>>>16^x[3]<<16,u[1]=x[2]^x[7]>>>16^x[5]<<16,u[2]=x[4]^x[1]>>>16^x[7]<<16,u[3]=x[6]^x[3]>>>16^x[1]<<16;for(var _=0;_<4;_++)u[_]=(u[_]<<8|u[_]>>>24)&16711935|(u[_]<<24|u[_]>>>8)&4278255360,p[v+_]^=u[_]},blockSize:128/32,ivSize:64/32});function d(){for(var p=this._X,v=this._C,x=0;x<8;x++)f[x]=v[x];v[0]=v[0]+1295307597+this._b|0,v[1]=v[1]+3545052371+(v[0]>>>0<f[0]>>>0?1:0)|0,v[2]=v[2]+886263092+(v[1]>>>0<f[1]>>>0?1:0)|0,v[3]=v[3]+1295307597+(v[2]>>>0<f[2]>>>0?1:0)|0,v[4]=v[4]+3545052371+(v[3]>>>0<f[3]>>>0?1:0)|0,v[5]=v[5]+886263092+(v[4]>>>0<f[4]>>>0?1:0)|0,v[6]=v[6]+1295307597+(v[5]>>>0<f[5]>>>0?1:0)|0,v[7]=v[7]+3545052371+(v[6]>>>0<f[6]>>>0?1:0)|0,this._b=v[7]>>>0<f[7]>>>0?1:0;for(var x=0;x<8;x++){var _=p[x]+v[x],y=_&65535,m=_>>>16,w=((y*y>>>17)+y*m>>>15)+m*m,D=((_&4294901760)*_|0)+((_&65535)*_|0);c[x]=w^D}p[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,p[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,p[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,p[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,p[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,p[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,p[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,p[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}r.RabbitLegacy=i._createHelper(h)}(),t.RabbitLegacy})}(qu)),qu.exports}var Uu={exports:{}},Oh;function aw(){return Oh||(Oh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),oi(),ai(),zn(),Yt())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.BlockCipher,a=r.algo;const u=16,f=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],c=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var h={pbox:[],sbox:[]};function d(y,m){let w=m>>24&255,D=m>>16&255,A=m>>8&255,E=m&255,F=y.sbox[0][w]+y.sbox[1][D];return F=F^y.sbox[2][A],F=F+y.sbox[3][E],F}function p(y,m,w){let D=m,A=w,E;for(let F=0;F<u;++F)D=D^y.pbox[F],A=d(y,D)^A,E=D,D=A,A=E;return E=D,D=A,A=E,A=A^y.pbox[u],D=D^y.pbox[u+1],{left:D,right:A}}function v(y,m,w){let D=m,A=w,E;for(let F=u+1;F>1;--F)D=D^y.pbox[F],A=d(y,D)^A,E=D,D=A,A=E;return E=D,D=A,A=E,A=A^y.pbox[1],D=D^y.pbox[0],{left:D,right:A}}function x(y,m,w){for(let B=0;B<4;B++){y.sbox[B]=[];for(let M=0;M<256;M++)y.sbox[B][M]=c[B][M]}let D=0;for(let B=0;B<u+2;B++)y.pbox[B]=f[B]^m[D],D++,D>=w&&(D=0);let A=0,E=0,F=0;for(let B=0;B<u+2;B+=2)F=p(y,A,E),A=F.left,E=F.right,y.pbox[B]=A,y.pbox[B+1]=E;for(let B=0;B<4;B++)for(let M=0;M<256;M+=2)F=p(y,A,E),A=F.left,E=F.right,y.sbox[B][M]=A,y.sbox[B][M+1]=E;return!0}var _=a.Blowfish=i.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var y=this._keyPriorReset=this._key,m=y.words,w=y.sigBytes/4;x(h,m,w)}},encryptBlock:function(y,m){var w=p(h,y[m],y[m+1]);y[m]=w.left,y[m+1]=w.right},decryptBlock:function(y,m){var w=v(h,y[m],y[m+1]);y[m]=w.left,y[m+1]=w.right},blockSize:64/32,keySize:128/32,ivSize:64/32});r.Blowfish=i._createHelper(_)}(),t.Blowfish})}(Uu)),Uu.exports}(function(s,e){(function(t,r,n){s.exports=r(Ve(),Mo(),RD(),PD(),oi(),kD(),ai(),ih(),_u(),zD(),uh(),qD(),UD(),WD(),wu(),HD(),zn(),Yt(),jD(),YD(),KD(),ZD(),VD(),GD(),XD(),QD(),JD(),ew(),tw(),rw(),nw(),iw(),sw(),ow(),aw())})(ye,function(t){return t})})(Vf);var No=Vf.exports;class uw{constructor(e,t){U(this,"_variables");U(this,"_scriptId");this._variables=e,this._scriptId=t}security(e,t){var A;const r=self.workerStorage.get(`request_${this._scriptId}`);let{expression:n,paramsExpr:i=[],symbol:a,timeframe:u}=e;const f=self.workerStorage.get(`request_${this._scriptId}_data`),c=`${a}--${u}`;let h;if(f!=null&&f.has(c)?h=(A=f.get(c))==null?void 0:A[this._variables.bar_index]:f==null||f.set(c,null),r!=null&&r.has(t)){const E=r.get(t);return this._runScripts(E,t,!0,i,h)}let d=[],p=1;n=No.AES.decrypt(n,"1234").toString(No.enc.Utf8);const v=JSON.parse(n),x=v.pop();let _=(x==null?void 0:x.depends)||[];if(!_.length)return this._runScripts((x==null?void 0:x.code)||"",t,!0,i);let y=[],m=[];if(this._getDependCodes(_,v,d,y,m),m.length){const E=i.length;let F=[];for(let B=E-1;B>=0;B--){const M=i[B];let O=JSON.parse(No.AES.decrypt(M,"1234").toString(No.enc.Utf8));const C=[];p!==0&&F.unshift("{"),p++,O=O.map(I=>{const{scope:L,code:k,varNames:z,dependSelf:R}=I;return L===2&&!C.includes(z)&&!R&&(I.code=`let ${k}`),z&&C.push(...z.split(", ")),I});let N=m.map(I=>({...I,isArg:!1,isPreArg:!0}));m=[],this._getDependCodes(N,O,F,y,m),d=F.concat(d),F=[]}}for(d.push(`return ${x==null?void 0:x.code}`);p>1;)d.push("}"),p--;d=y.concat(d);const w=d.join(`
76
- `),D=this._runScripts(w,t,!0,i,h);return r==null||r.set(t,w),D}_getDependCodes(e,t,r,n,i){for(const a of e){if(!a.isArg){const u=t.filter(c=>{var h;return(h=c==null?void 0:c.depends)==null?void 0:h.some(d=>d.name===a.name&&d.scope===a.scope&&d.isAgainAssign)});for(const c of u){const{code:h,depends:d}=c;r.includes(h)||(r.unshift(h),d!=null&&d.length&&this._getDependCodes(d,t,r,n,i))}const f=t.find(c=>{var h;return((h=c.varNames)==null?void 0:h.split(", ").includes(a.name))&&(!a.isPreArg||a.isPreArg&&c.methodName===a.functionName)||c.funcName===a.name});if(f){const{code:c,depends:h}=f,d=r.findIndex(p=>p===c);d!==-1&&r.splice(d,1),r.unshift(c),h!=null&&h.length&&this._getDependCodes(h,t,r,n,i);continue}}i.some(u=>u.name===a.name)||i.push(a)}}_runScripts(e,t,r,n,i){const a=`${this._scriptId}_${t}`;let{builtInGather:u,buildinConstants:f,buildInFunctions:c,tradingvueFunc:h}=self.workerStorage.get(a)||{};return r&&(u=new Ih(a),f=new Wf,c=new Zf(this._variables.mintick||1e-4,u,this._scriptId),h=new Function("$_var","$_const","$_func","$paramsExpr","$posStr",e),self.workerStorage.set(a,{builtInGather:u,buildinConstants:f,buildInFunctions:c,tradingvueFunc:h})),h(u,f,c,n||[],t)}}let lw=class{constructor(){}prefix(e){var r;const{symbol:t}=e;return((r=t==null?void 0:t.split("."))==null?void 0:r[0])||""}ticker(e){var r;const{symbol:t}=e;return((r=t==null?void 0:t.split("."))==null?void 0:r[1])||""}};class cw{constructor(e){U(this,"_logs");U(this,"_variables");U(this,"_intlFormat");this._variables=e,this._logs=[],this._intlFormat=new Intl.NumberFormat("en-US")}get logs(){return this._logs}clearLogs(){this._logs=[]}info(e,t,r){this._addLog(e,t,"info",r)}error(e,t,r){this._addLog(e,t,"error",r)}warning(e,t,r){this._addLog(e,t,"warning",r)}_addLog(e,t,r,n){if(typeof t=="string"&&(n=t),n.startsWith("export"))return;const{message:i,formatString:a}=e,{time:u,bar_index:f}=this._variables;let c=i;a&&Array.isArray(t)&&t.length&&(c=a.replace(/{(\d+)}/g,(h,d)=>{let p=t[d];return typeof p=="number"&&(p=this._intlFormat.format(parseFloat(p.toFixed(3)))),p!==void 0?p:h})),c&&this._logs.push({message:`[${ot(u).format()}]: ${c}`,time:u,barIndex:f,type:r})}}class fw{constructor(e){U(this,"_errorListener");this._errorListener=e}error({message:e},t){t.startsWith("export")||this._errorListener.addError(e,t,Ze.Error)}}class hw{constructor(){U(this,"_errors");this._errors=new Map}clear(){this._errors.clear()}get errors(){return Yr.flatMap([...this._errors.values()])}addError(e,t,r,n=0){const[i,a]=t.split("_").slice(-2),u=this._errors.get(t),f={message:e,endLineNumber:Number(i),startColumn:Number(a)+1,endColumn:Number(a)+n+1,startLineNumber:Number(i),type:r};u?u.push(f):this._errors.set(t,[f])}}class dw{constructor(){U(this,"_isMarketOpen");U(this,"_currentBarIndex");U(this,"_totalBarIndex");U(this,"_isRealTimeBar");U(this,"_preBarIndex");this._currentBarIndex=0,this._totalBarIndex=0,this._isRealTimeBar=!1,this._preBarIndex=0,this._isMarketOpen=!0}update(e,t,r,n){this._preBarIndex=this._currentBarIndex,this._currentBarIndex=e,this._totalBarIndex=t,this._isRealTimeBar=r,this._isMarketOpen=n}get isnew(){return!this._isRealTimeBar||this._preBarIndex!==this._currentBarIndex}get islast(){return this._currentBarIndex===this._totalBarIndex}get isfirst(){return this._currentBarIndex===0}get ishistory(){return!this._isRealTimeBar}get isrealtime(){return this._isRealTimeBar}get isconfirmed(){return!this._isRealTimeBar}get islastconfirmedhistory(){return this._isMarketOpen?this._currentBarIndex===this._totalBarIndex-1:this._currentBarIndex===this._totalBarIndex}}class pw{constructor(e){U(this,"_variables");this._variables=e}get isfirstbar(){return this._variables.timeframe.isdwm?!0:this._variables.time===this._variables.time_tradingday}get isfirstbar_regular(){return this._variables.timeframe.isdwm?!0:this._variables.time===this._variables.time_tradingday}get islastbar(){if(this._variables.timeframe.isdwm)return!0;const e=pn(this._variables.timeframe.period);return this._variables.time+e===this._variables.time_tradingday+24*60*60*1e3}get islastbar_regular(){if(this._variables.timeframe.isdwm)return!0;const e=pn(this._variables.timeframe.period);return this._variables.time+e===this._variables.time_tradingday+24*60*60*1e3}get ismarket(){return!0}get ispostmarket(){return!1}get ispremarket(){return!1}}class _w{constructor(e){U(this,"_orders");U(this,"_historyOrders");U(this,"_options");U(this,"_max_contracts_held_all",0);U(this,"_max_contracts_held_long",0);U(this,"_max_contracts_held_short",0);U(this,"_max_drawdown",0);U(this,"_max_runup",0);U(this,"_max_runup_percent",0);U(this,"_max_drawdown_percent",0);U(this,"_variables");U(this,"_netprofit",0);U(this,"_eventrades",0);U(this,"_avg_trade_percent");U(this,"_closedtrades",0);U(this,"_losstrades",0);U(this,"_grossloss",0);U(this,"_grossloss_percent",0);U(this,"_grossprofit",0);U(this,"_grossprofit_percent",0);U(this,"_wintrades",0);U(this,"_opentrades_capital_held",0);U(this,"_position_avg_price",0);U(this,"_position_size",0);this._orders=[],this._historyOrders=[],this._variables=e}update(){this._calcMaxDrawdownAndMaxRunup()}_calcMaxDrawdownAndMaxRunup(){let e=0,t=0;const{high:r,low:n}=this._variables;for(const c of this._orders){const{in_price:h,qty:d=0,commission:p=0,original_qty:v=0,direction:x}=c,_=x===mt.long?1:-1,y=(r-h)*d,m=(n-h)*d,w=_===1?y:-m,D=_===1?-m:y;e+=D+p*d/v,t+=w+p*d/v}const[i,a]=this._historyOrders.reduce((c,h)=>{let[d,p]=c;const{profit:v=0,commission:x=0}=h;return d+=v,p+=v-x,[d,p]},[0,0]);e-=i,t+=a;const u=e/(this.initial_capital+this.netprofit)*100;this._max_drawdown<e&&(this._max_drawdown=e),u>this._max_drawdown_percent&&(this._max_drawdown_percent=u);const f=t/(this.initial_capital+this.netprofit)*100;t>this._max_runup&&(this._max_runup=t),f>this._max_runup_percent&&(this._max_runup_percent=f)}updateOrders(e){this._orders=e,this._calcMaxContracts()}_calcMaxContracts(){const e=this._orders.length;if(!e)return;const[t,r,n,i,a,u]=this._orders.reduce(([f,c,h,d,p,v],x)=>{const{direction:_,qty:y=0,in_price:m}=x;return _===mt.long?(f+=y,c+=y,v+=y):(f+=y,h+=y,v-=y),d+=y*m,p+=m,[f,c,h,d,p,v]},[0,0,0,0,0,0]);this._position_size=u,this._position_avg_price=a/e,this._opentrades_capital_held=i,this._max_contracts_held_all=Math.max(t,this._max_contracts_held_all),this._max_contracts_held_long=Math.max(r,this._max_contracts_held_long),this._max_contracts_held_short=Math.max(n,this._max_contracts_held_short)}updateHistoryOrders(e){this._historyOrders=e;const t=this._historyOrders.length;this._closedtrades=t;const[r,n,i,a,u,f]=this._historyOrders.reduce((c,h)=>{let[d,p,v,x,_,y]=c;const{profit:m=0,profit_percent:w=0}=h;return d+=m,p+=w,m<0?(v+=m,x+=w):(_+=m,y+=w),[d,p,v,x,_,y]},[0,0,0,0,0,0]);this._avg_trade_percent=t?n/t:void 0,this._netprofit=r,this._grossloss=i,this._grossloss_percent=a,this._grossprofit=u,this._grossprofit_percent=f,this._eventrades=this._historyOrders.filter(c=>c.profit===0).length,this._losstrades=this._historyOrders.filter(c=>(c.profit||0)<0).length,this._wintrades=this._historyOrders.filter(c=>(c.profit||0)>0).length}updateStrategyOptions(e){this._options=e}get long(){return"long"}get short(){return"short"}get account_currency(){return"USD"}get closedtrades(){return this._closedtrades}get opentrades(){return{opentrades:this._orders.length,capital_held:this._opentrades_capital_held}}get avg_losing_trade(){const e=this.losstrades;return e?Math.abs(this.grossloss/e):void 0}get avg_losing_trade_percent(){const e=this.losstrades;return e?Math.abs(this.grossloss_percent/e):void 0}get avg_trade(){if(this.closedtrades)return Math.abs(this.netprofit/this.closedtrades)}get equity(){return this.initial_capital+this.netprofit+this.openprofit}get netprofit(){return this._netprofit}get eventrades(){return this._eventrades}get openprofit(){return this._orders.reduce((e,t)=>{const{profit:r=0}=t;return e+r},0)}get avg_trade_percent(){return this._avg_trade_percent}get avg_winning_trade(){const e=this.wintrades;return e?Math.abs(this.grossprofit/e):void 0}get avg_winning_trade_percent(){const e=this.wintrades;return e?Math.abs(this.grossprofit_percent/e):void 0}get initial_capital(){var e;return((e=this._options)==null?void 0:e.initial_capital)||0}get losstrades(){return this._losstrades}get grossloss(){return this._grossloss}get grossloss_percent(){return this._grossloss_percent}get grossprofit(){return this._grossprofit}get grossprofit_percent(){return this._grossprofit_percent}get wintrades(){return this._wintrades}get margin_liquidation_price(){if(!this._options)return;const{initial_capital:e,margin_long:t=0,margin_short:r=0,commission_type:n,commission_value:i=0}=this._options,a=this._orders[0].direction===mt.long?1:-1,u=(a===1?t:r)/100;if(u<=0)return;const{close:f}=this._variables,[c,h]=this._orders.reduce((d,p)=>{let[v,x]=d;const{in_price:_,qty:y=0,original_qty:m=0}=p,w=_*y;if(v+=w,i){let D=0;switch(n){case Ir.percent:D=(w+y*f)*i/100;break;case Ir.cashPerContract:D=y*i*2;break;case Ir.cashPerOrder:D=y/m*i+i;break}x+=D}return[v,x]},[0,0]);return(c-(e+this.netprofit-h))*a/this.position_size/(1-a*u)}get max_contracts_held_all(){return this._max_contracts_held_all}get max_contracts_held_long(){return this._max_contracts_held_long}get max_contracts_held_short(){return this._max_contracts_held_short}get max_drawdown(){return this._max_drawdown}get max_runup(){return this._max_runup}get max_runup_percent(){return this._max_runup_percent}get max_drawdown_percent(){return this._max_drawdown_percent}get netprofit_percent(){return this.netprofit/this.initial_capital*100}get openprofit_percent(){return this.openprofit/(this.initial_capital+this.netprofit)*100}get position_avg_price(){return this._position_avg_price}get position_entry_name(){if(this._orders.length)return this._orders[0].id}get position_size(){return this._position_size}}class vw{constructor(e){U(this,"_preAccdist");U(this,"_preNvi");U(this,"_prePvi");U(this,"_preObv");U(this,"_prePvt");U(this,"_preWad");U(this,"_preVwap");U(this,"_preValue");U(this,"_currentData");U(this,"_preData");U(this,"_id");this._preAccdist=0,this._preNvi=0,this._prePvi=0,this._preObv=0,this._prePvt=0,this._preWad=0,this._preVwap={},this._preValue={},this._currentData={},this._preData={},this._id=e}update(e){this._preValue={},e.barIndex!==this._currentData.barIndex&&(this._preData={...this._currentData}),this._currentData={...e}}get isRealTime(){return this._preData.barIndex===this._currentData.barIndex}get accdist(){if(this._preValue.accdist)return this._preValue.accdist;const{close:e,low:t,high:r,volume:n}=this._currentData;if(r===t)return this._preAccdist;const i=(e-t-(r-e))/(r-t)*n+this._preAccdist;return!this.isRealTime&&(this._preAccdist=i),this._preValue.accdist=i,i}get iii(){if(this._preValue.iii)return this._preValue.iii;const{close:e,low:t,high:r,volume:n}=this._currentData,i=(2*e-r-t)/((r-t)*n);return this._preValue.iii=i,i}get nvi(){return this._preValue.nvi?this._preValue.nvi:this._getNvi()}get wvad(){if(this._preValue.wvad)return this._preValue.wvad;const{close:e,low:t,high:r,volume:n,open:i}=this._currentData,a=(e-i)/(r-t)*n;return this._preValue.wvad=a,a}get obv(){if(this._preValue.obv)return this._preValue.obv;const{close:e,volume:t}=this._currentData,{close:r}=this._preData;if(r===void 0){this._preObv=0;return}const n=Math.sign(e-r)*t+this._preObv;return!this.isRealTime&&(this._preObv=n),this._preValue.obv=n,n}get pvi(){return this._preValue.pvi?this._preValue.pvi:this._getPvi()}get tr(){if(this._preValue.tr)return this._preValue.tr;const{low:e,high:t}=this._currentData,{close:r}=this._preData;if(r===void 0)return;const n=Math.max(t-e,Math.abs(t-r),Math.abs(e-r));return this._preValue.tr=n,n}get pvt(){if(this._preValue.pvt)return this._preValue.pvt;const{close:e,volume:t}=this._currentData,{close:r}=this._preData;if(r===void 0){this._prePvt=0;return}const n=(e-r)/r*t+this._prePvt;return!this.isRealTime&&(this._prePvt=n),this._preValue.pvt=n,n}get wad(){if(this._preValue.wad)return this._preValue.wad;const{close:e,high:t,low:r}=this._currentData,{close:n}=this._preData;if(n===void 0)return this._preWad=0,0;const i=Math.max(t,n),a=Math.min(r,n),u=e-n,c=(u>0?e-a:u<0?e-i:0)+this._preWad;return!this.isRealTime&&(this._preWad=c),this._preValue.wad=c,c}get vwap(){var h,d;if(this._preValue.vwap)return this._preValue.vwap;const{hlc3:e,volume:t}=this._currentData;let{sum:r=0,sumV:n=0,isReset:i}=this._preVwap;if(((d=(h=self.workerStorage)==null?void 0:h.get(this._id))==null?void 0:d.buildInFunctions.timeframe.change({timeframe:"1D"},"vwap_buildin"))&&(i=!0,r=n=0),!i)return;const u=e*t+r,f=t+n;!this.isRealTime&&(this._preVwap={sum:u,sumV:f,isReset:i});const c=u/f;return this._preValue.vwap=c,c}_getNvi(){const e=this._preNvi||1,{close:t=0,volume:r=0}=this._preData,{close:n,volume:i}=this._currentData;let a=1;const u=e||1;return n&&t?a=i<r?u+(n-t)/t*u:u:a=u,!this.isRealTime&&(this._preNvi=a),this._preValue.nvi=a,a}_getPvi(){const e=this._prePvi||1,{close:t=0,volume:r=0}=this._preData,{close:n,volume:i}=this._currentData;let a=1;const u=e||1;return n&&t?a=i>r?u+(n-t)/t*u:u:a=u,!this.isRealTime&&(this._prePvi=a),this._preValue.pvi=a,a}}class gw{constructor(){U(this,"_period");U(this,"_multiplier");U(this,"_unit");this._period="1",this._multiplier=1,this._unit="m"}update(e){if(!e)return;this._period=e;const[t,r]=ks(e);this._multiplier=t,this._unit=r}get isdaily(){return this._unit==="d"}get isdwm(){return["d","w","M"].includes(this._unit)}get isintraday(){return["s","m","h"].includes(this._unit)}get isminutes(){return this._unit==="m"}get ismonthly(){return this._unit==="M"}get isseconds(){return this._unit==="s"}get isweekly(){return this._unit==="w"}get multiplier(){return this._multiplier}get period(){return this._period}}class mw{constructor(e){U(this,"_variables");this._variables=e}get bg_color(){}get fg_color(){}get is_heikinashi(){return!1}get is_kagi(){return!1}get is_linebreak(){return!1}get is_pnf(){return!1}get is_range(){return!1}get is_renko(){return!1}get is_standard(){return!1}get left_visible_bar_time(){return this._variables.time}get right_visible_bar_time(){return this._variables.time}}class xw{constructor(e){U(this,"_variables");this._variables=e}get basecurrency(){return""}get country(){}get currency(){return"CNY"}get description(){return""}get employees(){return 100}get expiration_date(){}get industry(){}get minmove(){}get mintick(){}get pointvalue(){}get prefix(){}get pricescale(){}get recommendations_buy(){}get recommendations_buy_strong(){}get recommendations_date(){}get recommendations_hold(){}get recommendations_sell(){}get recommendations_sell_strong(){}get recommendations_total(){}get root(){return""}get sector(){}get session(){return yi.regular}get shareholders(){}get shares_outstanding_float(){}get shares_outstanding_total(){}get target_price_average(){}get target_price_date(){}get target_price_estimates(){}get target_price_high(){}get target_price_low(){}get target_price_median(){}get ticker(){}get tickerid(){}get timezone(){}get type(){}get volumetype(){return"n/a"}}class yw{constructor(e){U(this,"_variables");this._variables=e}get future_amount(){}get future_ex_date(){}get future_pay_date(){}}class Dw{constructor(e){U(this,"_variables");this._variables=e}get future_eps(){}get future_period_end_time(){}get future_revenue(){}get future_time(){}}ot.extend(v1),ot.extend(Dl),ot.extend(p1);class Ih{constructor(e){U(this,"_cacheData");U(this,"_barIndex");U(this,"_isRealTimeBar");U(this,"_barstate");U(this,"_priceVariables");U(this,"_lastBarIndex");U(this,"_currentBarTime");U(this,"_lastBarTime");U(this,"_period");U(this,"_offsetTime");U(this,"_timeframe");U(this,"_ta");U(this,"_polyline");U(this,"_label");U(this,"_line");U(this,"_linefill");U(this,"_box");U(this,"_table");U(this,"_strategy");U(this,"_session");U(this,"syminfo");U(this,"chart");U(this,"earnings");U(this,"dividends");U(this,"_timeTradingday");U(this,"_mintick");this._cacheData={varData:{},varNewData:{},varipData:{}},this._barIndex=0,this._lastBarIndex=0,this._currentBarTime=0,this._lastBarTime=0,this._offsetTime=0,this._period="",this._isRealTimeBar=!1,this._barstate=new dw,this._timeframe=new gw,this._priceVariables={close:0,open:0,low:0,high:0,volume:0},this._ta=new vw(e),this._polyline=new Li,this._label=new Li,this._line=new Li,this._linefill=new Li,this._box=new Li,this._table=new Li(1),this._strategy=new _w(this),this._session=new pw(this),this.syminfo=new xw(this),this.chart=new mw(this),this.earnings=new Dw(this),this.dividends=new yw(this)}get table(){return this._table}get box(){return this._box}get linefill(){return this._linefill}get line(){return this._line}get polyline(){return this._polyline}get label(){return this._label}get ta(){return this._ta}get strategy(){return this._strategy}get session(){return this._session}get na(){}get last_bar_index(){return this._lastBarIndex}get bar_index(){return this._barIndex}get barstate(){return this._barstate}get close(){return this._priceVariables.close}get low(){return this._priceVariables.low}get open(){return this._priceVariables.open}get high(){return this._priceVariables.high}get volume(){return this._priceVariables.volume}get ohlc4(){const{close:e,open:t,high:r,low:n}=this._priceVariables;return(e+t+r+n)/4}get hl2(){const{high:e,low:t}=this._priceVariables;return(e+t)/2}get hlc3(){const{close:e,high:t,low:r}=this._priceVariables;return(e+t+r)/3}get hlcc4(){const{close:e,high:t,low:r}=this._priceVariables;return(e*2+t+r)/4}get hour(){return ot(this._currentBarTime).subtract(this._offsetTime,"hour").hour()}get minute(){return ot(this._currentBarTime).minute()}get second(){return ot(this._currentBarTime).second()}get month(){return ot(this._currentBarTime).month()+1}get year(){return ot(this._currentBarTime).year()}get dayofweek(){return ot(this._currentBarTime).day()+1}get dayofmonth(){return ot(this._currentBarTime).date()}get weekofyear(){return ot(this._currentBarTime).week()}get last_bar_time(){return this._lastBarTime}get time(){return this._currentBarTime}get time_close(){const[e,t]=ks(this._period);return this._isRealTimeBar?void 0:ot(this._currentBarTime).add(e,t).valueOf()}get timenow(){return Date.now()}get time_tradingday(){return this._timeTradingday||this.getTimeTradingday(this._currentBarTime,this._period)}get timeframe(){return this._timeframe}get mintick(){return this._mintick}updateMaxLength(e){const{max_lines_count:t,max_labels_count:r,max_boxes_count:n,max_polylines_count:i}=e;n&&this._box.setMaxLen(n),r&&this._label.setMaxLen(r),t&&this._line.setMaxLen(t),i&&this._polyline.setMaxLen(i)}getTimeTradingday(e,t){const[r,n]=ks(t),i=ot(e);return["M","w","y","d"].includes(n)?i.valueOf():(i.subtract(this._offsetTime,"h"),i.startOf("d").add(this._offsetTime,"h").valueOf())}updateOptions(e){const{interval:t="1D",offsetTime:r=5,mintick:n}=e;this._period=t,this._mintick=n,this._offsetTime=r,this._timeframe.update(t)}updateData(e){const{barIndex:t,c:r,o:n,h:i,l:a,volume:u,time:f,lastBarIndex:c,lastBarTime:h,complete:d,time_tradingday:p}=e;this._priceVariables={close:Number(r),open:Number(n),high:Number(i),low:Number(a),volume:Number(u)},this._isRealTimeBar=d,t>this._barIndex&&this._isRealTimeBar&&(this._cacheData.varData=this._cacheData.varNewData,this._cacheData.varNewData={}),this._timeTradingday=p,this._currentBarTime=f*1e3,this._lastBarIndex=c,this._barIndex=t,this._lastBarTime=h*1e3,this._barstate.update(t,c,d,!1),this.ta.update({...this._priceVariables,hlc3:this.hlc3,barIndex:t})}getCacheData(e,t,r){const n=this.setCacheData(e,r);return n[n.length-1-t]}setCacheData(e,t){let r=this._cacheData[e]||{barIndex:-1,data:[]};return r.barIndex>this._barIndex||(r.barIndex===this._barIndex?r.data[r.data.length-1]=t:r.data.push(t),r.barIndex=this._barIndex,this._cacheData[e]=r),r.data}getTypeInstance(e,t){return new c1(e,t)}getVarValue(e,t,r){const n=`${e}_${t}`,i=r==="var"?this._cacheData.varData[n]:this._cacheData.varipData[n];if(i)return i}setVarValue(e,t,r,n){const i=`${e}_${t}`;let a;switch(typeof r=="object"&&r&&(n="var",a=r.varipKeys),n){case"var":if(this._isRealTimeBar){const u=Yr.cloneDeep(r);if(this._cacheData.varNewData[i]=u,a&&a.length)for(const f of a)this._cacheData.varData[i][f]=u[f]}else this._cacheData.varData[i]=r;break;case"varip":this._cacheData.varipData[i]=r;break}return r}add(e,t){return Array.isArray(e)&&Array.isArray(t)?Yr.uniq([...e,...t]):typeof e=="number"||typeof t=="number"?Number(e)+Number(t):e+t}sub(e,t){return Array.isArray(e)&&Array.isArray(t)?e.filter(r=>!t.includes(r)):Number(e)-Number(t)}againAssignParse(e,t){var n;if(t)return;const r=(n=e==null?void 0:e.constructor)==null?void 0:n.name;if(r)switch(r){case ps.name:case Hf.name:case vs.name:case su.name:case _s.name:case Bo.name:e==null||e.delete();break}}}class Li{constructor(e=50){U(this,"_all");U(this,"_allInstance");U(this,"_pseudoArrayAll");U(this,"_maxLength");this._all=new Map,this._allInstance=new Map,this._pseudoArrayAll=new it,this._maxLength=e}setMaxLen(e){this._maxLength=e}get data(){return[...this._all.values()]}get all(){return this._pseudoArrayAll._value=[...this._allInstance.values()],this._pseudoArrayAll}add(e,t,r){if(this._all.set(e,t),this._allInstance.set(e,r),this._all.size>this._maxLength){const n=this._all.keys().next().value;n&&this.delete(n)}}getValOfBarIndex(e){let t=[];const r=[...this._all.keys()];for(const n of e){const i=r.filter(a=>a.endsWith(`_${n}`));for(const a of i){const u=this._all.get(a);u&&t.push(u)}}return t.length?t:void 0}get(e){return this._all.get(e)}getInstance(e){return this._allInstance.get(e)}delete(e){this._all.delete(e),this._allInstance.delete(e)}}/**
75
+ */return t.mode.CTRGladman=function(){var r=t.lib.BlockCipherMode.extend();function n(u){if((u>>24&255)===255){var f=u>>16&255,c=u>>8&255,h=u&255;f===255?(f=0,c===255?(c=0,h===255?h=0:++h):++c):++f,u=0,u+=f<<16,u+=c<<8,u+=h}else u+=1<<24;return u}function i(u){return(u[0]=n(u[0]))===0&&(u[1]=n(u[1])),u}var a=r.Encryptor=r.extend({processBlock:function(u,f){var c=this._cipher,h=c.blockSize,d=this._iv,p=this._counter;d&&(p=this._counter=d.slice(0),this._iv=void 0),i(p);var v=p.slice(0);c.encryptBlock(v,0);for(var x=0;x<h;x++)u[f+x]^=v[x]}});return r.Decryptor=a,r}(),t.mode.CTRGladman})}(Bu)),Bu.exports}var Mu={exports:{}},xh;function ZD(){return xh||(xh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Yt())})(ye,function(t){return t.mode.OFB=function(){var r=t.lib.BlockCipherMode.extend(),n=r.Encryptor=r.extend({processBlock:function(i,a){var u=this._cipher,f=u.blockSize,c=this._iv,h=this._keystream;c&&(h=this._keystream=c.slice(0),this._iv=void 0),u.encryptBlock(h,0);for(var d=0;d<f;d++)i[a+d]^=h[d]}});return r.Decryptor=n,r}(),t.mode.OFB})}(Mu)),Mu.exports}var Nu={exports:{}},yh;function VD(){return yh||(yh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Yt())})(ye,function(t){return t.mode.ECB=function(){var r=t.lib.BlockCipherMode.extend();return r.Encryptor=r.extend({processBlock:function(n,i){this._cipher.encryptBlock(n,i)}}),r.Decryptor=r.extend({processBlock:function(n,i){this._cipher.decryptBlock(n,i)}}),r}(),t.mode.ECB})}(Nu)),Nu.exports}var Su={exports:{}},Dh;function GD(){return Dh||(Dh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Yt())})(ye,function(t){return t.pad.AnsiX923={pad:function(r,n){var i=r.sigBytes,a=n*4,u=a-i%a,f=i+u-1;r.clamp(),r.words[f>>>2]|=u<<24-f%4*8,r.sigBytes+=u},unpad:function(r){var n=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=n}},t.pad.Ansix923})}(Su)),Su.exports}var Ou={exports:{}},wh;function XD(){return wh||(wh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Yt())})(ye,function(t){return t.pad.Iso10126={pad:function(r,n){var i=n*4,a=i-r.sigBytes%i;r.concat(t.lib.WordArray.random(a-1)).concat(t.lib.WordArray.create([a<<24],1))},unpad:function(r){var n=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=n}},t.pad.Iso10126})}(Ou)),Ou.exports}var Iu={exports:{}},bh;function QD(){return bh||(bh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Yt())})(ye,function(t){return t.pad.Iso97971={pad:function(r,n){r.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(r,n)},unpad:function(r){t.pad.ZeroPadding.unpad(r),r.sigBytes--}},t.pad.Iso97971})}(Iu)),Iu.exports}var Tu={exports:{}},Eh;function JD(){return Eh||(Eh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Yt())})(ye,function(t){return t.pad.ZeroPadding={pad:function(r,n){var i=n*4;r.clamp(),r.sigBytes+=i-(r.sigBytes%i||i)},unpad:function(r){for(var n=r.words,i=r.sigBytes-1,i=r.sigBytes-1;i>=0;i--)if(n[i>>>2]>>>24-i%4*8&255){r.sigBytes=i+1;break}}},t.pad.ZeroPadding})}(Tu)),Tu.exports}var $u={exports:{}},Ch;function ew(){return Ch||(Ch=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Yt())})(ye,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})}($u)),$u.exports}var Lu={exports:{}},Ah;function tw(){return Ah||(Ah=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),Yt())})(ye,function(t){return function(r){var n=t,i=n.lib,a=i.CipherParams,u=n.enc,f=u.Hex,c=n.format;c.Hex={stringify:function(h){return h.ciphertext.toString(f)},parse:function(h){var d=f.parse(h);return a.create({ciphertext:d})}}}(),t.format.Hex})}(Lu)),Lu.exports}var Ru={exports:{}},Fh;function rw(){return Fh||(Fh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),oi(),ai(),zn(),Yt())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.BlockCipher,a=r.algo,u=[],f=[],c=[],h=[],d=[],p=[],v=[],x=[],_=[],y=[];(function(){for(var D=[],C=0;C<256;C++)C<128?D[C]=C<<1:D[C]=C<<1^283;for(var b=0,F=0,C=0;C<256;C++){var B=F^F<<1^F<<2^F<<3^F<<4;B=B>>>8^B&255^99,u[b]=B,f[B]=b;var M=D[b],O=D[M],A=D[O],N=D[B]*257^B*16843008;c[b]=N<<24|N>>>8,h[b]=N<<16|N>>>16,d[b]=N<<8|N>>>24,p[b]=N;var N=A*16843009^O*65537^M*257^b*16843008;v[B]=N<<24|N>>>8,x[B]=N<<16|N>>>16,_[B]=N<<8|N>>>24,y[B]=N,b?(b=M^D[D[D[A^M]]],F^=D[D[F]]):b=F=1}})();var m=[0,1,2,4,8,16,32,64,128,27,54],w=a.AES=i.extend({_doReset:function(){var D;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var C=this._keyPriorReset=this._key,b=C.words,F=C.sigBytes/4,B=this._nRounds=F+6,M=(B+1)*4,O=this._keySchedule=[],A=0;A<M;A++)A<F?O[A]=b[A]:(D=O[A-1],A%F?F>6&&A%F==4&&(D=u[D>>>24]<<24|u[D>>>16&255]<<16|u[D>>>8&255]<<8|u[D&255]):(D=D<<8|D>>>24,D=u[D>>>24]<<24|u[D>>>16&255]<<16|u[D>>>8&255]<<8|u[D&255],D^=m[A/F|0]<<24),O[A]=O[A-F]^D);for(var N=this._invKeySchedule=[],I=0;I<M;I++){var A=M-I;if(I%4)var D=O[A];else var D=O[A-4];I<4||A<=4?N[I]=D:N[I]=v[u[D>>>24]]^x[u[D>>>16&255]]^_[u[D>>>8&255]]^y[u[D&255]]}}},encryptBlock:function(D,C){this._doCryptBlock(D,C,this._keySchedule,c,h,d,p,u)},decryptBlock:function(D,C){var b=D[C+1];D[C+1]=D[C+3],D[C+3]=b,this._doCryptBlock(D,C,this._invKeySchedule,v,x,_,y,f);var b=D[C+1];D[C+1]=D[C+3],D[C+3]=b},_doCryptBlock:function(D,C,b,F,B,M,O,A){for(var N=this._nRounds,I=D[C]^b[0],L=D[C+1]^b[1],k=D[C+2]^b[2],z=D[C+3]^b[3],R=4,V=1;V<N;V++){var H=F[I>>>24]^B[L>>>16&255]^M[k>>>8&255]^O[z&255]^b[R++],ee=F[L>>>24]^B[k>>>16&255]^M[z>>>8&255]^O[I&255]^b[R++],te=F[k>>>24]^B[z>>>16&255]^M[I>>>8&255]^O[L&255]^b[R++],j=F[z>>>24]^B[I>>>16&255]^M[L>>>8&255]^O[k&255]^b[R++];I=H,L=ee,k=te,z=j}var H=(A[I>>>24]<<24|A[L>>>16&255]<<16|A[k>>>8&255]<<8|A[z&255])^b[R++],ee=(A[L>>>24]<<24|A[k>>>16&255]<<16|A[z>>>8&255]<<8|A[I&255])^b[R++],te=(A[k>>>24]<<24|A[z>>>16&255]<<16|A[I>>>8&255]<<8|A[L&255])^b[R++],j=(A[z>>>24]<<24|A[I>>>16&255]<<16|A[L>>>8&255]<<8|A[k&255])^b[R++];D[C]=H,D[C+1]=ee,D[C+2]=te,D[C+3]=j},keySize:256/32});r.AES=i._createHelper(w)}(),t.AES})}(Ru)),Ru.exports}var Pu={exports:{}},Bh;function nw(){return Bh||(Bh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),oi(),ai(),zn(),Yt())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.WordArray,a=n.BlockCipher,u=r.algo,f=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],c=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],h=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],d=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],p=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],v=u.DES=a.extend({_doReset:function(){for(var m=this._key,w=m.words,D=[],C=0;C<56;C++){var b=f[C]-1;D[C]=w[b>>>5]>>>31-b%32&1}for(var F=this._subKeys=[],B=0;B<16;B++){for(var M=F[B]=[],O=h[B],C=0;C<24;C++)M[C/6|0]|=D[(c[C]-1+O)%28]<<31-C%6,M[4+(C/6|0)]|=D[28+(c[C+24]-1+O)%28]<<31-C%6;M[0]=M[0]<<1|M[0]>>>31;for(var C=1;C<7;C++)M[C]=M[C]>>>(C-1)*4+3;M[7]=M[7]<<5|M[7]>>>27}for(var A=this._invSubKeys=[],C=0;C<16;C++)A[C]=F[15-C]},encryptBlock:function(m,w){this._doCryptBlock(m,w,this._subKeys)},decryptBlock:function(m,w){this._doCryptBlock(m,w,this._invSubKeys)},_doCryptBlock:function(m,w,D){this._lBlock=m[w],this._rBlock=m[w+1],x.call(this,4,252645135),x.call(this,16,65535),_.call(this,2,858993459),_.call(this,8,16711935),x.call(this,1,1431655765);for(var C=0;C<16;C++){for(var b=D[C],F=this._lBlock,B=this._rBlock,M=0,O=0;O<8;O++)M|=d[O][((B^b[O])&p[O])>>>0];this._lBlock=B,this._rBlock=F^M}var A=this._lBlock;this._lBlock=this._rBlock,this._rBlock=A,x.call(this,1,1431655765),_.call(this,8,16711935),_.call(this,2,858993459),x.call(this,16,65535),x.call(this,4,252645135),m[w]=this._lBlock,m[w+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function x(m,w){var D=(this._lBlock>>>m^this._rBlock)&w;this._rBlock^=D,this._lBlock^=D<<m}function _(m,w){var D=(this._rBlock>>>m^this._lBlock)&w;this._lBlock^=D,this._rBlock^=D<<m}r.DES=a._createHelper(v);var y=u.TripleDES=a.extend({_doReset:function(){var m=this._key,w=m.words;if(w.length!==2&&w.length!==4&&w.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var D=w.slice(0,2),C=w.length<4?w.slice(0,2):w.slice(2,4),b=w.length<6?w.slice(0,2):w.slice(4,6);this._des1=v.createEncryptor(i.create(D)),this._des2=v.createEncryptor(i.create(C)),this._des3=v.createEncryptor(i.create(b))},encryptBlock:function(m,w){this._des1.encryptBlock(m,w),this._des2.decryptBlock(m,w),this._des3.encryptBlock(m,w)},decryptBlock:function(m,w){this._des3.decryptBlock(m,w),this._des2.encryptBlock(m,w),this._des1.decryptBlock(m,w)},keySize:192/32,ivSize:64/32,blockSize:64/32});r.TripleDES=a._createHelper(y)}(),t.TripleDES})}(Pu)),Pu.exports}var ku={exports:{}},Mh;function iw(){return Mh||(Mh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),oi(),ai(),zn(),Yt())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.StreamCipher,a=r.algo,u=a.RC4=i.extend({_doReset:function(){for(var h=this._key,d=h.words,p=h.sigBytes,v=this._S=[],x=0;x<256;x++)v[x]=x;for(var x=0,_=0;x<256;x++){var y=x%p,m=d[y>>>2]>>>24-y%4*8&255;_=(_+v[x]+m)%256;var w=v[x];v[x]=v[_],v[_]=w}this._i=this._j=0},_doProcessBlock:function(h,d){h[d]^=f.call(this)},keySize:256/32,ivSize:0});function f(){for(var h=this._S,d=this._i,p=this._j,v=0,x=0;x<4;x++){d=(d+1)%256,p=(p+h[d])%256;var _=h[d];h[d]=h[p],h[p]=_,v|=h[(h[d]+h[p])%256]<<24-x*8}return this._i=d,this._j=p,v}r.RC4=i._createHelper(u);var c=a.RC4Drop=u.extend({cfg:u.cfg.extend({drop:192}),_doReset:function(){u._doReset.call(this);for(var h=this.cfg.drop;h>0;h--)f.call(this)}});r.RC4Drop=i._createHelper(c)}(),t.RC4})}(ku)),ku.exports}var zu={exports:{}},Nh;function sw(){return Nh||(Nh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),oi(),ai(),zn(),Yt())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.StreamCipher,a=r.algo,u=[],f=[],c=[],h=a.Rabbit=i.extend({_doReset:function(){for(var p=this._key.words,v=this.cfg.iv,x=0;x<4;x++)p[x]=(p[x]<<8|p[x]>>>24)&16711935|(p[x]<<24|p[x]>>>8)&4278255360;var _=this._X=[p[0],p[3]<<16|p[2]>>>16,p[1],p[0]<<16|p[3]>>>16,p[2],p[1]<<16|p[0]>>>16,p[3],p[2]<<16|p[1]>>>16],y=this._C=[p[2]<<16|p[2]>>>16,p[0]&4294901760|p[1]&65535,p[3]<<16|p[3]>>>16,p[1]&4294901760|p[2]&65535,p[0]<<16|p[0]>>>16,p[2]&4294901760|p[3]&65535,p[1]<<16|p[1]>>>16,p[3]&4294901760|p[0]&65535];this._b=0;for(var x=0;x<4;x++)d.call(this);for(var x=0;x<8;x++)y[x]^=_[x+4&7];if(v){var m=v.words,w=m[0],D=m[1],C=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,b=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,F=C>>>16|b&4294901760,B=b<<16|C&65535;y[0]^=C,y[1]^=F,y[2]^=b,y[3]^=B,y[4]^=C,y[5]^=F,y[6]^=b,y[7]^=B;for(var x=0;x<4;x++)d.call(this)}},_doProcessBlock:function(p,v){var x=this._X;d.call(this),u[0]=x[0]^x[5]>>>16^x[3]<<16,u[1]=x[2]^x[7]>>>16^x[5]<<16,u[2]=x[4]^x[1]>>>16^x[7]<<16,u[3]=x[6]^x[3]>>>16^x[1]<<16;for(var _=0;_<4;_++)u[_]=(u[_]<<8|u[_]>>>24)&16711935|(u[_]<<24|u[_]>>>8)&4278255360,p[v+_]^=u[_]},blockSize:128/32,ivSize:64/32});function d(){for(var p=this._X,v=this._C,x=0;x<8;x++)f[x]=v[x];v[0]=v[0]+1295307597+this._b|0,v[1]=v[1]+3545052371+(v[0]>>>0<f[0]>>>0?1:0)|0,v[2]=v[2]+886263092+(v[1]>>>0<f[1]>>>0?1:0)|0,v[3]=v[3]+1295307597+(v[2]>>>0<f[2]>>>0?1:0)|0,v[4]=v[4]+3545052371+(v[3]>>>0<f[3]>>>0?1:0)|0,v[5]=v[5]+886263092+(v[4]>>>0<f[4]>>>0?1:0)|0,v[6]=v[6]+1295307597+(v[5]>>>0<f[5]>>>0?1:0)|0,v[7]=v[7]+3545052371+(v[6]>>>0<f[6]>>>0?1:0)|0,this._b=v[7]>>>0<f[7]>>>0?1:0;for(var x=0;x<8;x++){var _=p[x]+v[x],y=_&65535,m=_>>>16,w=((y*y>>>17)+y*m>>>15)+m*m,D=((_&4294901760)*_|0)+((_&65535)*_|0);c[x]=w^D}p[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,p[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,p[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,p[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,p[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,p[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,p[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,p[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}r.Rabbit=i._createHelper(h)}(),t.Rabbit})}(zu)),zu.exports}var qu={exports:{}},Sh;function ow(){return Sh||(Sh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),oi(),ai(),zn(),Yt())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.StreamCipher,a=r.algo,u=[],f=[],c=[],h=a.RabbitLegacy=i.extend({_doReset:function(){var p=this._key.words,v=this.cfg.iv,x=this._X=[p[0],p[3]<<16|p[2]>>>16,p[1],p[0]<<16|p[3]>>>16,p[2],p[1]<<16|p[0]>>>16,p[3],p[2]<<16|p[1]>>>16],_=this._C=[p[2]<<16|p[2]>>>16,p[0]&4294901760|p[1]&65535,p[3]<<16|p[3]>>>16,p[1]&4294901760|p[2]&65535,p[0]<<16|p[0]>>>16,p[2]&4294901760|p[3]&65535,p[1]<<16|p[1]>>>16,p[3]&4294901760|p[0]&65535];this._b=0;for(var y=0;y<4;y++)d.call(this);for(var y=0;y<8;y++)_[y]^=x[y+4&7];if(v){var m=v.words,w=m[0],D=m[1],C=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,b=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,F=C>>>16|b&4294901760,B=b<<16|C&65535;_[0]^=C,_[1]^=F,_[2]^=b,_[3]^=B,_[4]^=C,_[5]^=F,_[6]^=b,_[7]^=B;for(var y=0;y<4;y++)d.call(this)}},_doProcessBlock:function(p,v){var x=this._X;d.call(this),u[0]=x[0]^x[5]>>>16^x[3]<<16,u[1]=x[2]^x[7]>>>16^x[5]<<16,u[2]=x[4]^x[1]>>>16^x[7]<<16,u[3]=x[6]^x[3]>>>16^x[1]<<16;for(var _=0;_<4;_++)u[_]=(u[_]<<8|u[_]>>>24)&16711935|(u[_]<<24|u[_]>>>8)&4278255360,p[v+_]^=u[_]},blockSize:128/32,ivSize:64/32});function d(){for(var p=this._X,v=this._C,x=0;x<8;x++)f[x]=v[x];v[0]=v[0]+1295307597+this._b|0,v[1]=v[1]+3545052371+(v[0]>>>0<f[0]>>>0?1:0)|0,v[2]=v[2]+886263092+(v[1]>>>0<f[1]>>>0?1:0)|0,v[3]=v[3]+1295307597+(v[2]>>>0<f[2]>>>0?1:0)|0,v[4]=v[4]+3545052371+(v[3]>>>0<f[3]>>>0?1:0)|0,v[5]=v[5]+886263092+(v[4]>>>0<f[4]>>>0?1:0)|0,v[6]=v[6]+1295307597+(v[5]>>>0<f[5]>>>0?1:0)|0,v[7]=v[7]+3545052371+(v[6]>>>0<f[6]>>>0?1:0)|0,this._b=v[7]>>>0<f[7]>>>0?1:0;for(var x=0;x<8;x++){var _=p[x]+v[x],y=_&65535,m=_>>>16,w=((y*y>>>17)+y*m>>>15)+m*m,D=((_&4294901760)*_|0)+((_&65535)*_|0);c[x]=w^D}p[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,p[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,p[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,p[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,p[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,p[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,p[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,p[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}r.RabbitLegacy=i._createHelper(h)}(),t.RabbitLegacy})}(qu)),qu.exports}var Uu={exports:{}},Oh;function aw(){return Oh||(Oh=1,function(s,e){(function(t,r,n){s.exports=r(Ve(),oi(),ai(),zn(),Yt())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.BlockCipher,a=r.algo;const u=16,f=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],c=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var h={pbox:[],sbox:[]};function d(y,m){let w=m>>24&255,D=m>>16&255,C=m>>8&255,b=m&255,F=y.sbox[0][w]+y.sbox[1][D];return F=F^y.sbox[2][C],F=F+y.sbox[3][b],F}function p(y,m,w){let D=m,C=w,b;for(let F=0;F<u;++F)D=D^y.pbox[F],C=d(y,D)^C,b=D,D=C,C=b;return b=D,D=C,C=b,C=C^y.pbox[u],D=D^y.pbox[u+1],{left:D,right:C}}function v(y,m,w){let D=m,C=w,b;for(let F=u+1;F>1;--F)D=D^y.pbox[F],C=d(y,D)^C,b=D,D=C,C=b;return b=D,D=C,C=b,C=C^y.pbox[1],D=D^y.pbox[0],{left:D,right:C}}function x(y,m,w){for(let B=0;B<4;B++){y.sbox[B]=[];for(let M=0;M<256;M++)y.sbox[B][M]=c[B][M]}let D=0;for(let B=0;B<u+2;B++)y.pbox[B]=f[B]^m[D],D++,D>=w&&(D=0);let C=0,b=0,F=0;for(let B=0;B<u+2;B+=2)F=p(y,C,b),C=F.left,b=F.right,y.pbox[B]=C,y.pbox[B+1]=b;for(let B=0;B<4;B++)for(let M=0;M<256;M+=2)F=p(y,C,b),C=F.left,b=F.right,y.sbox[B][M]=C,y.sbox[B][M+1]=b;return!0}var _=a.Blowfish=i.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var y=this._keyPriorReset=this._key,m=y.words,w=y.sigBytes/4;x(h,m,w)}},encryptBlock:function(y,m){var w=p(h,y[m],y[m+1]);y[m]=w.left,y[m+1]=w.right},decryptBlock:function(y,m){var w=v(h,y[m],y[m+1]);y[m]=w.left,y[m+1]=w.right},blockSize:64/32,keySize:128/32,ivSize:64/32});r.Blowfish=i._createHelper(_)}(),t.Blowfish})}(Uu)),Uu.exports}(function(s,e){(function(t,r,n){s.exports=r(Ve(),Mo(),RD(),PD(),oi(),kD(),ai(),ih(),_u(),zD(),uh(),qD(),UD(),WD(),wu(),HD(),zn(),Yt(),jD(),YD(),KD(),ZD(),VD(),GD(),XD(),QD(),JD(),ew(),tw(),rw(),nw(),iw(),sw(),ow(),aw())})(ye,function(t){return t})})(Vf);var No=Vf.exports;class uw{constructor(e,t){q(this,"_variables");q(this,"_scriptId");this._variables=e,this._scriptId=t}security(e,t){var C;const r=self.workerStorage.get(`request_${this._scriptId}`);let{expression:n,paramsExpr:i=[],symbol:a,timeframe:u}=e;const f=self.workerStorage.get(`request_${this._scriptId}_data`),c=`${a}--${u}`;let h;if(f!=null&&f.has(c)?h=(C=f.get(c))==null?void 0:C[this._variables.bar_index]:f==null||f.set(c,null),r!=null&&r.has(t)){const b=r.get(t);return this._runScripts(b,t,!0,i,h)}let d=[],p=1;n=No.AES.decrypt(n,"1234").toString(No.enc.Utf8);const v=JSON.parse(n),x=v.pop();let _=(x==null?void 0:x.depends)||[];if(!_.length)return this._runScripts((x==null?void 0:x.code)||"",t,!0,i);let y=[],m=[];if(this._getDependCodes(_,v,d,y,m),m.length){const b=i.length;let F=[];for(let B=b-1;B>=0;B--){const M=i[B];let O=JSON.parse(No.AES.decrypt(M,"1234").toString(No.enc.Utf8));const A=[];p!==0&&F.unshift("{"),p++,O=O.map(I=>{const{scope:L,code:k,varNames:z,dependSelf:R}=I;return L===2&&!A.includes(z)&&!R&&(I.code=`let ${k}`),z&&A.push(...z.split(", ")),I});let N=m.map(I=>({...I,isArg:!1,isPreArg:!0}));m=[],this._getDependCodes(N,O,F,y,m),d=F.concat(d),F=[]}}for(d.push(`return ${x==null?void 0:x.code}`);p>1;)d.push("}"),p--;d=y.concat(d);const w=d.join(`
76
+ `),D=this._runScripts(w,t,!0,i,h);return r==null||r.set(t,w),D}_getDependCodes(e,t,r,n,i){for(const a of e){if(!a.isArg){const u=t.filter(c=>{var h;return(h=c==null?void 0:c.depends)==null?void 0:h.some(d=>d.name===a.name&&d.scope===a.scope&&d.isAgainAssign)});for(const c of u){const{code:h,depends:d}=c;r.includes(h)||(r.unshift(h),d!=null&&d.length&&this._getDependCodes(d,t,r,n,i))}const f=t.find(c=>{var h;return((h=c.varNames)==null?void 0:h.split(", ").includes(a.name))&&(!a.isPreArg||a.isPreArg&&c.methodName===a.functionName)||c.funcName===a.name});if(f){const{code:c,depends:h}=f,d=r.findIndex(p=>p===c);d!==-1&&r.splice(d,1),r.unshift(c),h!=null&&h.length&&this._getDependCodes(h,t,r,n,i);continue}}i.some(u=>u.name===a.name)||i.push(a)}}_runScripts(e,t,r,n,i){const a=`${this._scriptId}_${t}`;let{builtInGather:u,buildinConstants:f,buildInFunctions:c,tradingvueFunc:h}=self.workerStorage.get(a)||{};return r&&(u=new Ih(a),f=new Wf,c=new Zf(this._variables.mintick||1e-4,u,this._scriptId),h=new Function("$_var","$_const","$_func","$paramsExpr","$posStr",e),self.workerStorage.set(a,{builtInGather:u,buildinConstants:f,buildInFunctions:c,tradingvueFunc:h})),h(u,f,c,n||[],t)}}let lw=class{constructor(){}prefix(e){var r;const{symbol:t}=e;return((r=t==null?void 0:t.split("."))==null?void 0:r[0])||""}ticker(e){var r;const{symbol:t}=e;return((r=t==null?void 0:t.split("."))==null?void 0:r[1])||""}};class cw{constructor(e){q(this,"_logs");q(this,"_variables");q(this,"_intlFormat");this._variables=e,this._logs=[],this._intlFormat=new Intl.NumberFormat("en-US")}get logs(){return this._logs}clearLogs(){this._logs=[]}info(e,t,r){this._addLog(e,t,"info",r)}error(e,t,r){this._addLog(e,t,"error",r)}warning(e,t,r){this._addLog(e,t,"warning",r)}_addLog(e,t,r,n){if(typeof t=="string"&&(n=t),n.startsWith("export"))return;const{message:i,formatString:a}=e,{time:u,bar_index:f}=this._variables;let c=i;a&&Array.isArray(t)&&t.length&&(c=a.replace(/{(\d+)}/g,(h,d)=>{let p=t[d];return typeof p=="number"&&(p=this._intlFormat.format(parseFloat(p.toFixed(3)))),p!==void 0?p:h})),c&&this._logs.push({message:`[${ot(u).format()}]: ${c}`,time:u,barIndex:f,type:r})}}class fw{constructor(e){q(this,"_errorListener");this._errorListener=e}error({message:e},t){t.startsWith("export")||this._errorListener.addError(e,t,Ze.Error)}}class hw{constructor(){q(this,"_errors");this._errors=new Map}clear(){this._errors.clear()}get errors(){return Yr.flatMap([...this._errors.values()])}addError(e,t,r,n=0){const[i,a]=t.split("_").slice(-2),u=this._errors.get(t),f={message:e,endLineNumber:Number(i),startColumn:Number(a)+1,endColumn:Number(a)+n+1,startLineNumber:Number(i),type:r};u?u.push(f):this._errors.set(t,[f])}}class dw{constructor(){q(this,"_isMarketOpen");q(this,"_currentBarIndex");q(this,"_totalBarIndex");q(this,"_isRealTimeBar");q(this,"_preBarIndex");this._currentBarIndex=0,this._totalBarIndex=0,this._isRealTimeBar=!1,this._preBarIndex=0,this._isMarketOpen=!0}update(e,t,r,n){this._preBarIndex=this._currentBarIndex,this._currentBarIndex=e,this._totalBarIndex=t,this._isRealTimeBar=r,this._isMarketOpen=n}get isnew(){return!this._isRealTimeBar||this._preBarIndex!==this._currentBarIndex}get islast(){return this._currentBarIndex===this._totalBarIndex}get isfirst(){return this._currentBarIndex===0}get ishistory(){return!this._isRealTimeBar}get isrealtime(){return this._isRealTimeBar}get isconfirmed(){return!this._isRealTimeBar}get islastconfirmedhistory(){return this._isMarketOpen?this._currentBarIndex===this._totalBarIndex-1:this._currentBarIndex===this._totalBarIndex}}class pw{constructor(e){q(this,"_variables");this._variables=e}get isfirstbar(){return this._variables.timeframe.isdwm?!0:this._variables.time===this._variables.time_tradingday}get isfirstbar_regular(){return this._variables.timeframe.isdwm?!0:this._variables.time===this._variables.time_tradingday}get islastbar(){if(this._variables.timeframe.isdwm)return!0;const e=pn(this._variables.timeframe.period);return this._variables.time+e===this._variables.time_tradingday+24*60*60*1e3}get islastbar_regular(){if(this._variables.timeframe.isdwm)return!0;const e=pn(this._variables.timeframe.period);return this._variables.time+e===this._variables.time_tradingday+24*60*60*1e3}get ismarket(){return!0}get ispostmarket(){return!1}get ispremarket(){return!1}}class _w{constructor(e){q(this,"_orders");q(this,"_historyOrders");q(this,"_options");q(this,"_max_contracts_held_all",0);q(this,"_max_contracts_held_long",0);q(this,"_max_contracts_held_short",0);q(this,"_max_drawdown",0);q(this,"_max_runup",0);q(this,"_max_runup_percent",0);q(this,"_max_drawdown_percent",0);q(this,"_variables");q(this,"_netprofit",0);q(this,"_eventrades",0);q(this,"_avg_trade_percent");q(this,"_closedtrades",0);q(this,"_losstrades",0);q(this,"_grossloss",0);q(this,"_grossloss_percent",0);q(this,"_grossprofit",0);q(this,"_grossprofit_percent",0);q(this,"_wintrades",0);q(this,"_opentrades_capital_held",0);q(this,"_position_avg_price",0);q(this,"_position_size",0);this._orders=[],this._historyOrders=[],this._variables=e}update(){this._calcMaxDrawdownAndMaxRunup()}_calcMaxDrawdownAndMaxRunup(){let e=0,t=0;const{high:r,low:n}=this._variables;for(const c of this._orders){const{in_price:h,qty:d=0,commission:p=0,original_qty:v=0,direction:x}=c,_=x===mt.long?1:-1,y=(r-h)*d,m=(n-h)*d,w=_===1?y:-m,D=_===1?-m:y;e+=D+p*d/v,t+=w+p*d/v}const[i,a]=this._historyOrders.reduce((c,h)=>{let[d,p]=c;const{profit:v=0,commission:x=0}=h;return d+=v,p+=v-x,[d,p]},[0,0]);e-=i,t+=a;const u=e/(this.initial_capital+this.netprofit)*100;this._max_drawdown<e&&(this._max_drawdown=e),u>this._max_drawdown_percent&&(this._max_drawdown_percent=u);const f=t/(this.initial_capital+this.netprofit)*100;t>this._max_runup&&(this._max_runup=t),f>this._max_runup_percent&&(this._max_runup_percent=f)}updateOrders(e){this._orders=e,this._calcMaxContracts()}_calcMaxContracts(){const e=this._orders.length;if(!e)return;const[t,r,n,i,a,u]=this._orders.reduce(([f,c,h,d,p,v],x)=>{const{direction:_,qty:y=0,in_price:m}=x;return _===mt.long?(f+=y,c+=y,v+=y):(f+=y,h+=y,v-=y),d+=y*m,p+=m,[f,c,h,d,p,v]},[0,0,0,0,0,0]);this._position_size=u,this._position_avg_price=a/e,this._opentrades_capital_held=i,this._max_contracts_held_all=Math.max(t,this._max_contracts_held_all),this._max_contracts_held_long=Math.max(r,this._max_contracts_held_long),this._max_contracts_held_short=Math.max(n,this._max_contracts_held_short)}updateHistoryOrders(e){this._historyOrders=e;const t=this._historyOrders.length;this._closedtrades=t;const[r,n,i,a,u,f]=this._historyOrders.reduce((c,h)=>{let[d,p,v,x,_,y]=c;const{profit:m=0,profit_percent:w=0}=h;return d+=m,p+=w,m<0?(v+=m,x+=w):(_+=m,y+=w),[d,p,v,x,_,y]},[0,0,0,0,0,0]);this._avg_trade_percent=t?n/t:void 0,this._netprofit=r,this._grossloss=i,this._grossloss_percent=a,this._grossprofit=u,this._grossprofit_percent=f,this._eventrades=this._historyOrders.filter(c=>c.profit===0).length,this._losstrades=this._historyOrders.filter(c=>(c.profit||0)<0).length,this._wintrades=this._historyOrders.filter(c=>(c.profit||0)>0).length}updateStrategyOptions(e){this._options=e}get long(){return"long"}get short(){return"short"}get account_currency(){return"USD"}get closedtrades(){return this._closedtrades}get opentrades(){return{opentrades:this._orders.length,capital_held:this._opentrades_capital_held}}get avg_losing_trade(){const e=this.losstrades;return e?Math.abs(this.grossloss/e):void 0}get avg_losing_trade_percent(){const e=this.losstrades;return e?Math.abs(this.grossloss_percent/e):void 0}get avg_trade(){if(this.closedtrades)return Math.abs(this.netprofit/this.closedtrades)}get equity(){return this.initial_capital+this.netprofit+this.openprofit}get netprofit(){return this._netprofit}get eventrades(){return this._eventrades}get openprofit(){return this._orders.reduce((e,t)=>{const{profit:r=0}=t;return e+r},0)}get avg_trade_percent(){return this._avg_trade_percent}get avg_winning_trade(){const e=this.wintrades;return e?Math.abs(this.grossprofit/e):void 0}get avg_winning_trade_percent(){const e=this.wintrades;return e?Math.abs(this.grossprofit_percent/e):void 0}get initial_capital(){var e;return((e=this._options)==null?void 0:e.initial_capital)||0}get losstrades(){return this._losstrades}get grossloss(){return this._grossloss}get grossloss_percent(){return this._grossloss_percent}get grossprofit(){return this._grossprofit}get grossprofit_percent(){return this._grossprofit_percent}get wintrades(){return this._wintrades}get margin_liquidation_price(){if(!this._options)return;const{initial_capital:e,margin_long:t=0,margin_short:r=0,commission_type:n,commission_value:i=0}=this._options,a=this._orders[0].direction===mt.long?1:-1,u=(a===1?t:r)/100;if(u<=0)return;const{close:f}=this._variables,[c,h]=this._orders.reduce((d,p)=>{let[v,x]=d;const{in_price:_,qty:y=0,original_qty:m=0}=p,w=_*y;if(v+=w,i){let D=0;switch(n){case Ir.percent:D=(w+y*f)*i/100;break;case Ir.cashPerContract:D=y*i*2;break;case Ir.cashPerOrder:D=y/m*i+i;break}x+=D}return[v,x]},[0,0]);return(c-(e+this.netprofit-h))*a/this.position_size/(1-a*u)}get max_contracts_held_all(){return this._max_contracts_held_all}get max_contracts_held_long(){return this._max_contracts_held_long}get max_contracts_held_short(){return this._max_contracts_held_short}get max_drawdown(){return this._max_drawdown}get max_runup(){return this._max_runup}get max_runup_percent(){return this._max_runup_percent}get max_drawdown_percent(){return this._max_drawdown_percent}get netprofit_percent(){return this.netprofit/this.initial_capital*100}get openprofit_percent(){return this.openprofit/(this.initial_capital+this.netprofit)*100}get position_avg_price(){return this._position_avg_price}get position_entry_name(){if(this._orders.length)return this._orders[0].id}get position_size(){return this._position_size}}class vw{constructor(e){q(this,"_preAccdist");q(this,"_preNvi");q(this,"_prePvi");q(this,"_preObv");q(this,"_prePvt");q(this,"_preWad");q(this,"_preVwap");q(this,"_preValue");q(this,"_currentData");q(this,"_preData");q(this,"_id");this._preAccdist=0,this._preNvi=0,this._prePvi=0,this._preObv=0,this._prePvt=0,this._preWad=0,this._preVwap={},this._preValue={},this._currentData={},this._preData={},this._id=e}update(e){this._preValue={},e.barIndex!==this._currentData.barIndex&&(this._preData={...this._currentData}),this._currentData={...e}}get isRealTime(){return this._preData.barIndex===this._currentData.barIndex}get accdist(){if(this._preValue.accdist)return this._preValue.accdist;const{close:e,low:t,high:r,volume:n}=this._currentData;if(r===t)return this._preAccdist;const i=(e-t-(r-e))/(r-t)*n+this._preAccdist;return!this.isRealTime&&(this._preAccdist=i),this._preValue.accdist=i,i}get iii(){if(this._preValue.iii)return this._preValue.iii;const{close:e,low:t,high:r,volume:n}=this._currentData,i=(2*e-r-t)/((r-t)*n);return this._preValue.iii=i,i}get nvi(){return this._preValue.nvi?this._preValue.nvi:this._getNvi()}get wvad(){if(this._preValue.wvad)return this._preValue.wvad;const{close:e,low:t,high:r,volume:n,open:i}=this._currentData,a=(e-i)/(r-t)*n;return this._preValue.wvad=a,a}get obv(){if(this._preValue.obv)return this._preValue.obv;const{close:e,volume:t}=this._currentData,{close:r}=this._preData;if(r===void 0){this._preObv=0;return}const n=Math.sign(e-r)*t+this._preObv;return!this.isRealTime&&(this._preObv=n),this._preValue.obv=n,n}get pvi(){return this._preValue.pvi?this._preValue.pvi:this._getPvi()}get tr(){if(this._preValue.tr)return this._preValue.tr;const{low:e,high:t}=this._currentData,{close:r}=this._preData;if(r===void 0)return;const n=Math.max(t-e,Math.abs(t-r),Math.abs(e-r));return this._preValue.tr=n,n}get pvt(){if(this._preValue.pvt)return this._preValue.pvt;const{close:e,volume:t}=this._currentData,{close:r}=this._preData;if(r===void 0){this._prePvt=0;return}const n=(e-r)/r*t+this._prePvt;return!this.isRealTime&&(this._prePvt=n),this._preValue.pvt=n,n}get wad(){if(this._preValue.wad)return this._preValue.wad;const{close:e,high:t,low:r}=this._currentData,{close:n}=this._preData;if(n===void 0)return this._preWad=0,0;const i=Math.max(t,n),a=Math.min(r,n),u=e-n,c=(u>0?e-a:u<0?e-i:0)+this._preWad;return!this.isRealTime&&(this._preWad=c),this._preValue.wad=c,c}get vwap(){var h,d;if(this._preValue.vwap)return this._preValue.vwap;const{hlc3:e,volume:t}=this._currentData;let{sum:r=0,sumV:n=0,isReset:i}=this._preVwap;if(((d=(h=self.workerStorage)==null?void 0:h.get(this._id))==null?void 0:d.buildInFunctions.timeframe.change({timeframe:"1D"},"vwap_buildin"))&&(i=!0,r=n=0),!i)return;const u=e*t+r,f=t+n;!this.isRealTime&&(this._preVwap={sum:u,sumV:f,isReset:i});const c=u/f;return this._preValue.vwap=c,c}_getNvi(){const e=this._preNvi||1,{close:t=0,volume:r=0}=this._preData,{close:n,volume:i}=this._currentData;let a=1;const u=e||1;return n&&t?a=i<r?u+(n-t)/t*u:u:a=u,!this.isRealTime&&(this._preNvi=a),this._preValue.nvi=a,a}_getPvi(){const e=this._prePvi||1,{close:t=0,volume:r=0}=this._preData,{close:n,volume:i}=this._currentData;let a=1;const u=e||1;return n&&t?a=i>r?u+(n-t)/t*u:u:a=u,!this.isRealTime&&(this._prePvi=a),this._preValue.pvi=a,a}}class gw{constructor(){q(this,"_period");q(this,"_multiplier");q(this,"_unit");this._period="1",this._multiplier=1,this._unit="m"}update(e){if(!e)return;this._period=e;const[t,r]=ks(e);this._multiplier=t,this._unit=r}get isdaily(){return this._unit==="d"}get isdwm(){return["d","w","M"].includes(this._unit)}get isintraday(){return["s","m","h"].includes(this._unit)}get isminutes(){return this._unit==="m"}get ismonthly(){return this._unit==="M"}get isseconds(){return this._unit==="s"}get isweekly(){return this._unit==="w"}get multiplier(){return this._multiplier}get period(){return this._period}}class mw{constructor(e){q(this,"_variables");q(this,"_bgColor");q(this,"_fgColor");q(this,"isUseBgColor",!1);this._variables=e}updateOptions(e){e!=null&&e.bg_color&&(this._bgColor=e.bg_color,this._fgColor=this._contrastColor(e.bg_color))}get bg_color(){return this.isUseBgColor=!0,this._bgColor}get fg_color(){return this.isUseBgColor=!0,this._fgColor}get is_heikinashi(){return!1}get is_kagi(){return!1}get is_linebreak(){return!1}get is_pnf(){return!1}get is_range(){return!1}get is_renko(){return!1}get is_standard(){return!0}get left_visible_bar_time(){return this._variables.time}get right_visible_bar_time(){return this._variables.time}_parseColor(e){let t,r,n,i;if(e.startsWith("#")){t=parseInt(e.substring(1,3),16),r=parseInt(e.substring(3,5),16),n=parseInt(e.substring(5,7),16);const a=e.substring(7);a?i=parseInt(a,16)/255:i=1}else{const a=this._parserRgbColor(e);t=a[0]||0,r=a[1]||0,n=a[2]||0,i=a[3]||1}return{r:t,g:r,b:n,a:i}}_parserRgbColor(e){var t;return((t=e.match(/\d+/g))==null?void 0:t.map(Number))||[]}_contrastColor(e){const{r:t,g:r,b:n}=this._parseColor(e);return(299*t+587*r+114*n)/1e3>128?"#000000":"#ffffff"}}class xw{constructor(e){q(this,"_variables");this._variables=e}get basecurrency(){return""}get country(){}get currency(){return"CNY"}get description(){return""}get employees(){return 100}get expiration_date(){}get industry(){}get minmove(){}get mintick(){}get pointvalue(){}get prefix(){}get pricescale(){}get recommendations_buy(){}get recommendations_buy_strong(){}get recommendations_date(){}get recommendations_hold(){}get recommendations_sell(){}get recommendations_sell_strong(){}get recommendations_total(){}get root(){return""}get sector(){}get session(){return yi.regular}get shareholders(){}get shares_outstanding_float(){}get shares_outstanding_total(){}get target_price_average(){}get target_price_date(){}get target_price_estimates(){}get target_price_high(){}get target_price_low(){}get target_price_median(){}get ticker(){}get tickerid(){}get timezone(){}get type(){}get volumetype(){return"n/a"}}class yw{constructor(e){q(this,"_variables");this._variables=e}get future_amount(){}get future_ex_date(){}get future_pay_date(){}}class Dw{constructor(e){q(this,"_variables");this._variables=e}get future_eps(){}get future_period_end_time(){}get future_revenue(){}get future_time(){}}ot.extend(v1),ot.extend(Dl),ot.extend(p1);class Ih{constructor(e){q(this,"_cacheData");q(this,"_barIndex");q(this,"_isRealTimeBar");q(this,"_barstate");q(this,"_priceVariables");q(this,"_lastBarIndex");q(this,"_currentBarTime");q(this,"_lastBarTime");q(this,"_period");q(this,"_offsetTime");q(this,"_timeframe");q(this,"_ta");q(this,"_polyline");q(this,"_label");q(this,"_line");q(this,"_linefill");q(this,"_box");q(this,"_table");q(this,"_strategy");q(this,"_session");q(this,"syminfo");q(this,"chart");q(this,"earnings");q(this,"dividends");q(this,"_timeTradingday");q(this,"_mintick");this._cacheData={varData:{},varNewData:{},varipData:{}},this._barIndex=0,this._lastBarIndex=0,this._currentBarTime=0,this._lastBarTime=0,this._offsetTime=0,this._period="",this._isRealTimeBar=!1,this._barstate=new dw,this._timeframe=new gw,this._priceVariables={close:0,open:0,low:0,high:0,volume:0},this._ta=new vw(e),this._polyline=new Li,this._label=new Li,this._line=new Li,this._linefill=new Li,this._box=new Li,this._table=new Li(1),this._strategy=new _w(this),this._session=new pw(this),this.syminfo=new xw(this),this.chart=new mw(this),this.earnings=new Dw(this),this.dividends=new yw(this)}get table(){return this._table}get box(){return this._box}get linefill(){return this._linefill}get line(){return this._line}get polyline(){return this._polyline}get label(){return this._label}get ta(){return this._ta}get strategy(){return this._strategy}get session(){return this._session}get na(){}get last_bar_index(){return this._lastBarIndex}get bar_index(){return this._barIndex}get barstate(){return this._barstate}get close(){return this._priceVariables.close}get low(){return this._priceVariables.low}get open(){return this._priceVariables.open}get high(){return this._priceVariables.high}get volume(){return this._priceVariables.volume}get ohlc4(){const{close:e,open:t,high:r,low:n}=this._priceVariables;return(e+t+r+n)/4}get hl2(){const{high:e,low:t}=this._priceVariables;return(e+t)/2}get hlc3(){const{close:e,high:t,low:r}=this._priceVariables;return(e+t+r)/3}get hlcc4(){const{close:e,high:t,low:r}=this._priceVariables;return(e*2+t+r)/4}get hour(){return ot(this._currentBarTime).subtract(this._offsetTime,"hour").hour()}get minute(){return ot(this._currentBarTime).minute()}get second(){return ot(this._currentBarTime).second()}get month(){return ot(this._currentBarTime).month()+1}get year(){return ot(this._currentBarTime).year()}get dayofweek(){return ot(this._currentBarTime).day()+1}get dayofmonth(){return ot(this._currentBarTime).date()}get weekofyear(){return ot(this._currentBarTime).week()}get last_bar_time(){return this._lastBarTime}get time(){return this._currentBarTime}get time_close(){const[e,t]=ks(this._period);return this._isRealTimeBar?void 0:ot(this._currentBarTime).add(e,t).valueOf()}get timenow(){return Date.now()}get time_tradingday(){return this._timeTradingday||this.getTimeTradingday(this._currentBarTime,this._period)}get timeframe(){return this._timeframe}get mintick(){return this._mintick}updateMaxLength(e){const{max_lines_count:t,max_labels_count:r,max_boxes_count:n,max_polylines_count:i}=e;n&&this._box.setMaxLen(n),r&&this._label.setMaxLen(r),t&&this._line.setMaxLen(t),i&&this._polyline.setMaxLen(i)}getTimeTradingday(e,t){const[r,n]=ks(t),i=ot(e);return["M","w","y","d"].includes(n)?i.valueOf():(i.subtract(this._offsetTime,"h"),i.startOf("d").add(this._offsetTime,"h").valueOf())}updateOptions(e){const{interval:t="1D",offsetTime:r=5,mintick:n,chart:i}=e;this._period=t,this._mintick=n,this._offsetTime=r,this._timeframe.update(t),this.chart.updateOptions(i)}updateData(e){const{barIndex:t,c:r,o:n,h:i,l:a,volume:u,time:f,lastBarIndex:c,lastBarTime:h,complete:d,time_tradingday:p}=e;this._priceVariables={close:Number(r),open:Number(n),high:Number(i),low:Number(a),volume:Number(u)},this._isRealTimeBar=d,t>this._barIndex&&this._isRealTimeBar&&(this._cacheData.varData=this._cacheData.varNewData,this._cacheData.varNewData={}),this._timeTradingday=p,this._currentBarTime=f*1e3,this._lastBarIndex=c,this._barIndex=t,this._lastBarTime=h*1e3,this._barstate.update(t,c,d,!1),this.ta.update({...this._priceVariables,hlc3:this.hlc3,barIndex:t})}getCacheData(e,t,r){const n=this.setCacheData(e,r);return n[n.length-1-t]}setCacheData(e,t){let r=this._cacheData[e]||{barIndex:-1,data:[]};return r.barIndex>this._barIndex||(r.barIndex===this._barIndex?r.data[r.data.length-1]=t:r.data.push(t),r.barIndex=this._barIndex,this._cacheData[e]=r),r.data}getTypeInstance(e,t){return new c1(e,t)}getVarValue(e,t,r){const n=`${e}_${t}`,i=r==="var"?this._cacheData.varData[n]:this._cacheData.varipData[n];if(i)return i}setVarValue(e,t,r,n){const i=`${e}_${t}`;let a;switch(typeof r=="object"&&r&&(n="var",a=r.varipKeys),n){case"var":if(this._isRealTimeBar){const u=Yr.cloneDeep(r);if(this._cacheData.varNewData[i]=u,a&&a.length)for(const f of a)this._cacheData.varData[i][f]=u[f]}else this._cacheData.varData[i]=r;break;case"varip":this._cacheData.varipData[i]=r;break}return r}add(e,t){return Array.isArray(e)&&Array.isArray(t)?Yr.uniq([...e,...t]):typeof e=="number"||typeof t=="number"?Number(e)+Number(t):e+t}sub(e,t){return Array.isArray(e)&&Array.isArray(t)?e.filter(r=>!t.includes(r)):Number(e)-Number(t)}againAssignParse(e,t){var n;if(t)return;const r=(n=e==null?void 0:e.constructor)==null?void 0:n.name;if(r)switch(r){case ps.name:case Hf.name:case vs.name:case su.name:case _s.name:case Bo.name:e==null||e.delete();break}}}class Li{constructor(e=50){q(this,"_all");q(this,"_allInstance");q(this,"_pseudoArrayAll");q(this,"_maxLength");this._all=new Map,this._allInstance=new Map,this._pseudoArrayAll=new it,this._maxLength=e}setMaxLen(e){this._maxLength=e}get data(){return[...this._all.values()]}get all(){return this._pseudoArrayAll._value=[...this._allInstance.values()],this._pseudoArrayAll}add(e,t,r){if(this._all.set(e,t),this._allInstance.set(e,r),this._all.size>this._maxLength){const n=this._all.keys().next().value;n&&this.delete(n)}}getValOfBarIndex(e){let t=[];const r=[...this._all.keys()];for(const n of e){const i=r.filter(a=>a.endsWith(`_${n}`));for(const a of i){const u=this._all.get(a);u&&t.push(u)}}return t.length?t:void 0}get(e){return this._all.get(e)}getInstance(e){return this._allInstance.get(e)}delete(e){this._all.delete(e),this._allInstance.delete(e)}}/**
77
77
  * @license
78
78
  * Copyright 2019 Google LLC
79
79
  * SPDX-License-Identifier: Apache-2.0
80
- */const Th=Symbol("Comlink.proxy"),ww=Symbol("Comlink.endpoint"),Ew=Symbol("Comlink.releaseProxy"),Wu=Symbol("Comlink.finalizer"),So=Symbol("Comlink.thrown"),$h=s=>typeof s=="object"&&s!==null||typeof s=="function",bw={canHandle:s=>$h(s)&&s[Th],serialize(s){const{port1:e,port2:t}=new MessageChannel;return Hu(s,e),[t,[t]]},deserialize(s){return s.start(),Bw(s)}},Aw={canHandle:s=>$h(s)&&So in s,serialize({value:s}){let e;return s instanceof Error?e={isError:!0,value:{message:s.message,name:s.name,stack:s.stack}}:e={isError:!1,value:s},[e,[]]},deserialize(s){throw s.isError?Object.assign(new Error(s.value.message),s.value):s.value}},Lh=new Map([["proxy",bw],["throw",Aw]]);function Cw(s,e){for(const t of s)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return!0;return!1}function Hu(s,e=globalThis,t=["*"]){e.addEventListener("message",function r(n){if(!n||!n.data)return;if(!Cw(t,n.origin)){console.warn(`Invalid origin '${n.origin}' for comlink proxy`);return}const{id:i,type:a,path:u}=Object.assign({path:[]},n.data),f=(n.data.argumentList||[]).map(ui);let c;try{const h=u.slice(0,-1).reduce((p,v)=>p[v],s),d=u.reduce((p,v)=>p[v],s);switch(a){case"GET":c=d;break;case"SET":h[u.slice(-1)[0]]=ui(n.data.value),c=!0;break;case"APPLY":c=d.apply(h,f);break;case"CONSTRUCT":{const p=new d(...f);c=Iw(p)}break;case"ENDPOINT":{const{port1:p,port2:v}=new MessageChannel;Hu(s,v),c=Ow(p,[p])}break;case"RELEASE":c=void 0;break;default:return}}catch(h){c={value:h,[So]:0}}Promise.resolve(c).catch(h=>({value:h,[So]:0})).then(h=>{const[d,p]=$o(h);e.postMessage(Object.assign(Object.assign({},d),{id:i}),p),a==="RELEASE"&&(e.removeEventListener("message",r),Rh(e),Wu in s&&typeof s[Wu]=="function"&&s[Wu]())}).catch(h=>{const[d,p]=$o({value:new TypeError("Unserializable return value"),[So]:0});e.postMessage(Object.assign(Object.assign({},d),{id:i}),p)})}),e.start&&e.start()}function Fw(s){return s.constructor.name==="MessagePort"}function Rh(s){Fw(s)&&s.close()}function Bw(s,e){return ju(s,[],e)}function Oo(s){if(s)throw new Error("Proxy has been released and is not useable")}function Ph(s){return Ri(s,{type:"RELEASE"}).then(()=>{Rh(s)})}const Io=new WeakMap,To="FinalizationRegistry"in globalThis&&new FinalizationRegistry(s=>{const e=(Io.get(s)||0)-1;Io.set(s,e),e===0&&Ph(s)});function Mw(s,e){const t=(Io.get(e)||0)+1;Io.set(e,t),To&&To.register(s,e,s)}function Nw(s){To&&To.unregister(s)}function ju(s,e=[],t=function(){}){let r=!1;const n=new Proxy(t,{get(i,a){if(Oo(r),a===Ew)return()=>{Nw(n),Ph(s),r=!0};if(a==="then"){if(e.length===0)return{then:()=>n};const u=Ri(s,{type:"GET",path:e.map(f=>f.toString())}).then(ui);return u.then.bind(u)}return ju(s,[...e,a])},set(i,a,u){Oo(r);const[f,c]=$o(u);return Ri(s,{type:"SET",path:[...e,a].map(h=>h.toString()),value:f},c).then(ui)},apply(i,a,u){Oo(r);const f=e[e.length-1];if(f===ww)return Ri(s,{type:"ENDPOINT"}).then(ui);if(f==="bind")return ju(s,e.slice(0,-1));const[c,h]=kh(u);return Ri(s,{type:"APPLY",path:e.map(d=>d.toString()),argumentList:c},h).then(ui)},construct(i,a){Oo(r);const[u,f]=kh(a);return Ri(s,{type:"CONSTRUCT",path:e.map(c=>c.toString()),argumentList:u},f).then(ui)}});return Mw(n,s),n}function Sw(s){return Array.prototype.concat.apply([],s)}function kh(s){const e=s.map($o);return[e.map(t=>t[0]),Sw(e.map(t=>t[1]))]}const zh=new WeakMap;function Ow(s,e){return zh.set(s,e),s}function Iw(s){return Object.assign(s,{[Th]:!0})}function $o(s){for(const[e,t]of Lh)if(t.canHandle(s)){const[r,n]=t.serialize(s);return[{type:"HANDLER",name:e,value:r},n]}return[{type:"RAW",value:s},zh.get(s)||[]]}function ui(s){switch(s.type){case"HANDLER":return Lh.get(s.name).deserialize(s.value);case"RAW":return s.value}}function Ri(s,e,t){return new Promise(r=>{const n=Tw();s.addEventListener("message",function i(a){!a.data||!a.data.id||a.data.id!==n||(s.removeEventListener("message",i),r(a.data))}),s.start&&s.start(),s.postMessage(Object.assign({id:n},e),t)})}function Tw(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}class $w{constructor(){U(this,"_cache");this._cache=new Map}set(e,t){this._cache.set(e,t)}setValue(e,t,r){const n=this._cache.get(e)||{};n[t]=r,this._cache.set(e,n)}updateValue(e,t,r){const n=this._cache.get(e)||{};this._cache.set(e,Object.assign(n[t]||{},r))}get(e){return this._cache.get(e)}has(e){return this._cache.has(e)}deleteStartwidthKey(e){for(const t of this._cache.keys())t.startsWith(e)&&this._cache.delete(t)}delete(e){this._cache.delete(e)}clear(){this._cache.clear()}}function Lw(s,e,t){const{data:r,isPreParser:n,id:i="default",syminfo:a,interval:u,inputs:f}=e;self.workerStorage||(self.workerStorage=new $w);let{builtInGather:c,buildinConstants:h,buildInFunctions:d,tradingvueFunc:p}=self.workerStorage.get(i)||{},v=[];if(t&&(c=new Ih(i),h=new Wf,d=new Zf((a==null?void 0:a.mintick)||1e-4,c,i),p=new Function("$_var","$_const","$_func",s),self.workerStorage.set(i,{builtInGather:c,buildinConstants:h,buildInFunctions:d,tradingvueFunc:p}),self.workerStorage.set(`request_${i}`,new Map),self.workerStorage.set(`request_${i}_data`,new Map)),n)p(c,h,d);else if(r&&r.length){const _=r.length-1;c.updateOptions({interval:u,mintick:(a==null?void 0:a.mintick)||1e-4}),d.updateOptions({inputs:f});for(const[y,m]of r.entries()){const{barindex:w}=m;!t&&(w||w===0)&&(v.push(w),c.clearDrawCache(w)),c.updateData(Object.assign(m,{barIndex:w||y,lastBarIndex:r[_].bar_index||_,lastBarTime:r[_].time})),d.update({barIndex:w||y}),p(c,h,d),d.endExecution();const D=d.errors;if(D.length&&D.some(A=>A.type===Ze.Error))return{status:1,errors:D}}}const x=d.errors;return x.length&&x.some(_=>_.type===Ze.Error)?{status:1,errors:x}:{status:0,options:{...d.options(v),id:i}}}function Rw(s){self==null||self.workerStorage.deleteStartwidthKey(s),self==null||self.workerStorage.delete(`inputs_${s}`)}Hu({runScript:Lw,removeScript:Rw})})();
80
+ */const Th=Symbol("Comlink.proxy"),ww=Symbol("Comlink.endpoint"),bw=Symbol("Comlink.releaseProxy"),Wu=Symbol("Comlink.finalizer"),So=Symbol("Comlink.thrown"),$h=s=>typeof s=="object"&&s!==null||typeof s=="function",Ew={canHandle:s=>$h(s)&&s[Th],serialize(s){const{port1:e,port2:t}=new MessageChannel;return Hu(s,e),[t,[t]]},deserialize(s){return s.start(),Bw(s)}},Cw={canHandle:s=>$h(s)&&So in s,serialize({value:s}){let e;return s instanceof Error?e={isError:!0,value:{message:s.message,name:s.name,stack:s.stack}}:e={isError:!1,value:s},[e,[]]},deserialize(s){throw s.isError?Object.assign(new Error(s.value.message),s.value):s.value}},Lh=new Map([["proxy",Ew],["throw",Cw]]);function Aw(s,e){for(const t of s)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return!0;return!1}function Hu(s,e=globalThis,t=["*"]){e.addEventListener("message",function r(n){if(!n||!n.data)return;if(!Aw(t,n.origin)){console.warn(`Invalid origin '${n.origin}' for comlink proxy`);return}const{id:i,type:a,path:u}=Object.assign({path:[]},n.data),f=(n.data.argumentList||[]).map(ui);let c;try{const h=u.slice(0,-1).reduce((p,v)=>p[v],s),d=u.reduce((p,v)=>p[v],s);switch(a){case"GET":c=d;break;case"SET":h[u.slice(-1)[0]]=ui(n.data.value),c=!0;break;case"APPLY":c=d.apply(h,f);break;case"CONSTRUCT":{const p=new d(...f);c=Iw(p)}break;case"ENDPOINT":{const{port1:p,port2:v}=new MessageChannel;Hu(s,v),c=Ow(p,[p])}break;case"RELEASE":c=void 0;break;default:return}}catch(h){c={value:h,[So]:0}}Promise.resolve(c).catch(h=>({value:h,[So]:0})).then(h=>{const[d,p]=$o(h);e.postMessage(Object.assign(Object.assign({},d),{id:i}),p),a==="RELEASE"&&(e.removeEventListener("message",r),Rh(e),Wu in s&&typeof s[Wu]=="function"&&s[Wu]())}).catch(h=>{const[d,p]=$o({value:new TypeError("Unserializable return value"),[So]:0});e.postMessage(Object.assign(Object.assign({},d),{id:i}),p)})}),e.start&&e.start()}function Fw(s){return s.constructor.name==="MessagePort"}function Rh(s){Fw(s)&&s.close()}function Bw(s,e){return ju(s,[],e)}function Oo(s){if(s)throw new Error("Proxy has been released and is not useable")}function Ph(s){return Ri(s,{type:"RELEASE"}).then(()=>{Rh(s)})}const Io=new WeakMap,To="FinalizationRegistry"in globalThis&&new FinalizationRegistry(s=>{const e=(Io.get(s)||0)-1;Io.set(s,e),e===0&&Ph(s)});function Mw(s,e){const t=(Io.get(e)||0)+1;Io.set(e,t),To&&To.register(s,e,s)}function Nw(s){To&&To.unregister(s)}function ju(s,e=[],t=function(){}){let r=!1;const n=new Proxy(t,{get(i,a){if(Oo(r),a===bw)return()=>{Nw(n),Ph(s),r=!0};if(a==="then"){if(e.length===0)return{then:()=>n};const u=Ri(s,{type:"GET",path:e.map(f=>f.toString())}).then(ui);return u.then.bind(u)}return ju(s,[...e,a])},set(i,a,u){Oo(r);const[f,c]=$o(u);return Ri(s,{type:"SET",path:[...e,a].map(h=>h.toString()),value:f},c).then(ui)},apply(i,a,u){Oo(r);const f=e[e.length-1];if(f===ww)return Ri(s,{type:"ENDPOINT"}).then(ui);if(f==="bind")return ju(s,e.slice(0,-1));const[c,h]=kh(u);return Ri(s,{type:"APPLY",path:e.map(d=>d.toString()),argumentList:c},h).then(ui)},construct(i,a){Oo(r);const[u,f]=kh(a);return Ri(s,{type:"CONSTRUCT",path:e.map(c=>c.toString()),argumentList:u},f).then(ui)}});return Mw(n,s),n}function Sw(s){return Array.prototype.concat.apply([],s)}function kh(s){const e=s.map($o);return[e.map(t=>t[0]),Sw(e.map(t=>t[1]))]}const zh=new WeakMap;function Ow(s,e){return zh.set(s,e),s}function Iw(s){return Object.assign(s,{[Th]:!0})}function $o(s){for(const[e,t]of Lh)if(t.canHandle(s)){const[r,n]=t.serialize(s);return[{type:"HANDLER",name:e,value:r},n]}return[{type:"RAW",value:s},zh.get(s)||[]]}function ui(s){switch(s.type){case"HANDLER":return Lh.get(s.name).deserialize(s.value);case"RAW":return s.value}}function Ri(s,e,t){return new Promise(r=>{const n=Tw();s.addEventListener("message",function i(a){!a.data||!a.data.id||a.data.id!==n||(s.removeEventListener("message",i),r(a.data))}),s.start&&s.start(),s.postMessage(Object.assign({id:n},e),t)})}function Tw(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}class $w{constructor(){q(this,"_cache");this._cache=new Map}set(e,t){this._cache.set(e,t)}setValue(e,t,r){const n=this._cache.get(e)||{};n[t]=r,this._cache.set(e,n)}updateValue(e,t,r){const n=this._cache.get(e)||{};this._cache.set(e,Object.assign(n[t]||{},r))}get(e){return this._cache.get(e)}has(e){return this._cache.has(e)}deleteStartwidthKey(e){for(const t of this._cache.keys())t.startsWith(e)&&this._cache.delete(t)}delete(e){this._cache.delete(e)}clear(){this._cache.clear()}}function Lw(s,e,t){const{data:r,isPreParser:n,id:i="default",syminfo:a,interval:u,inputs:f,chart:c}=e;self.workerStorage||(self.workerStorage=new $w);let{builtInGather:h,buildinConstants:d,buildInFunctions:p,tradingvueFunc:v}=self.workerStorage.get(i)||{},x=[];if(t&&(h=new Ih(i),d=new Wf,p=new Zf((a==null?void 0:a.mintick)||1e-4,h,i),v=new Function("$_var","$_const","$_func",s),self.workerStorage.set(i,{builtInGather:h,buildinConstants:d,buildInFunctions:p,tradingvueFunc:v}),self.workerStorage.set(`request_${i}`,new Map),self.workerStorage.set(`request_${i}_data`,new Map)),n)v(h,d,p);else if(r&&r.length){const y=r.length-1;h.updateOptions({interval:u,mintick:(a==null?void 0:a.mintick)||1e-4,chart:c}),p.updateOptions({inputs:f});for(const[m,w]of r.entries()){const{barindex:D}=w;!t&&(D||D===0)&&(x.push(D),h.clearDrawCache(D)),h.updateData(Object.assign(w,{barIndex:D||m,lastBarIndex:r[y].bar_index||y,lastBarTime:r[y].time})),p.update({barIndex:D||m}),v(h,d,p),p.endExecution();const C=p.errors;if(C.length&&C.some(b=>b.type===Ze.Error))return{status:1,errors:C}}}const _=p.errors;return _.length&&_.some(y=>y.type===Ze.Error)?{status:1,errors:_}:{status:0,options:{...p.options(x),id:i}}}function Rw(s){self==null||self.workerStorage.deleteStartwidthKey(s),self==null||self.workerStorage.delete(`inputs_${s}`)}Hu({runScript:Lw,removeScript:Rw})})();