-
Notifications
You must be signed in to change notification settings - Fork 0
/
markedit-mte.js
79 lines (71 loc) · 194 KB
/
markedit-mte.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
"use strict";const jg=require("@codemirror/view"),em=require("@codemirror/state"),Yu=require("markedit-api");var Vt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function tm(l){if(l.__esModule)return l;var d=l.default;if(typeof d=="function"){var o=function p(){return this instanceof p?Reflect.construct(d,arguments,this.constructor):d.apply(this,arguments)};o.prototype=d.prototype}else o={};return Object.defineProperty(o,"__esModule",{value:!0}),Object.keys(l).forEach(function(p){var T=Object.getOwnPropertyDescriptor(l,p);Object.defineProperty(o,p,T.get?T:{enumerable:!0,get:function(){return l[p]}})}),o}var Le={},Ar={};Object.defineProperty(Ar,"__esModule",{value:!0});Ar.Point=void 0;class nm{constructor(d,o){this.row=d,this.column=o}equals(d){return this.row===d.row&&this.column===d.column}}Ar.Point=nm;var Er={};Object.defineProperty(Er,"__esModule",{value:!0});Er.Range=void 0;let rm=class{constructor(d,o){this.start=d,this.end=o}};Er.Range=rm;var br={};Object.defineProperty(br,"__esModule",{value:!0});br.Focus=void 0;class ri{constructor(d,o,p){this.row=d,this.column=o,this.offset=p}posEquals(d){return this.row===d.row&&this.column===d.column}setRow(d){return new ri(d,this.column,this.offset)}setColumn(d){return new ri(this.row,d,this.offset)}setOffset(d){return new ri(this.row,this.column,d)}}br.Focus=ri;var Bt={};Object.defineProperty(Bt,"__esModule",{value:!0});Bt.HeaderAlignment=Bt.DefaultAlignment=Bt.Alignment=void 0;var Aa;(function(l){l.NONE="none",l.LEFT="left",l.RIGHT="right",l.CENTER="center"})(Aa||(Bt.Alignment=Aa={}));var Ea;(function(l){l.LEFT="left",l.RIGHT="right",l.CENTER="center"})(Ea||(Bt.DefaultAlignment=Ea={}));var ba;(function(l){l.FOLLOW="follow",l.LEFT="left",l.RIGHT="right",l.CENTER="center"})(ba||(Bt.HeaderAlignment=ba={}));var yn={};Object.defineProperty(yn,"__esModule",{value:!0});yn.TableCell=void 0;const Xi=Bt;class im{constructor(d){this.rawContent=d,this.content=d.trim(),this.paddingLeft=this.content===""?this.rawContent===""?0:1:this.rawContent.length-this.rawContent.trimLeft().length,this.paddingRight=this.rawContent.length-this.content.length-this.paddingLeft}toText(){return this.rawContent}isDelimiter(){return/^\s*:?-+:?\s*$/.test(this.rawContent)}getAlignment(){if(this.isDelimiter())return this.content[0]===":"?this.content[this.content.length-1]===":"?Xi.Alignment.CENTER:Xi.Alignment.LEFT:this.content[this.content.length-1]===":"?Xi.Alignment.RIGHT:Xi.Alignment.NONE}computeContentOffset(d){return this.content===""||d<this.paddingLeft?0:d<this.paddingLeft+this.content.length?d-this.paddingLeft:this.content.length}computeRawOffset(d){return d+this.paddingLeft}}yn.TableCell=im;var Yn={};Object.defineProperty(Yn,"__esModule",{value:!0});Yn.TableRow=void 0;const om=yn;class Ju{constructor(d,o,p){this._cells=d.slice(),this.marginLeft=o,this.marginRight=p}getWidth(){return this._cells.length}getCells(){return this._cells.slice()}getCellAt(d){return this._cells[d]}setCellAt(d,o){const p=this.getCells();return p[d]=new om.TableCell(o),new Ju(p,this.marginLeft,this.marginRight)}toText(){if(this._cells.length===0)return this.marginLeft;const d=this._cells.map(o=>o.toText()).join("|");return`${this.marginLeft}|${d}|${this.marginRight}`}isDelimiter(){return this._cells.every(d=>d.isDelimiter())}}Yn.TableRow=Ju;var Jn={},Hu={},qt={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.Err=l.Ok=l.err=l.ok=void 0;const d=x=>new p(x);l.ok=d;const o=x=>new T(x);l.err=o;class p{constructor(k){this.value=k,this.match=(B,X)=>B(this.value)}isOk(){return!0}isErr(){return!this.isOk()}map(k){return(0,l.ok)(k(this.value))}mapErr(k){return(0,l.ok)(this.value)}andThen(k){return k(this.value)}unwrapOr(k){return this.value}_unsafeUnwrap(){return this.value}_unsafeUnwrapErr(){throw new Error("Called `_unsafeUnwrapErr` on an Ok")}}l.Ok=p;class T{constructor(k){this.error=k,this.match=(B,X)=>X(this.error)}isOk(){return!1}isErr(){return!this.isOk()}map(k){return(0,l.err)(this.error)}mapErr(k){return(0,l.err)(k(this.error))}andThen(k){return(0,l.err)(this.error)}unwrapOr(k){return k}_unsafeUnwrap(){throw new Error("Called `_unsafeUnwrap` on an Err")}_unsafeUnwrapErr(){return this.error}}l.Err=T})(qt);var jr={},Mt={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.prettyPrintAST=l.checkChildLength=l.checkType=l.errRelativeReferenceIndex=l.errIndex0=void 0,l.errIndex0=new Error("Index 0 used to create a reference"),l.errRelativeReferenceIndex=new Error("Can not use relative reference where absolute reference is required");const d=(T,...x)=>{if(!(x.indexOf(T.type)>=0))return new Error(`Formula element '${T.text}' is a ${T.type} but expected one of ${x} in this position.`)};l.checkType=d;const o=(T,x)=>{if(T.children.length!==x)return new Error(`Formula element '${T.text}' was expected to have ${x} elements, but had ${T.children.length}`)};l.checkChildLength=o;const p=(T,x=0)=>{console.log(" ".repeat(x)+`|-${T.type}${T.children.length===0?"="+T.text:""}`),T.children&&T.children.forEach(k=>{(0,l.prettyPrintAST)(k,x+1)})};l.prettyPrintAST=p})(Mt);var Ln={},Pa={exports:{}};(function(l){(function(d){/*!
* decimal.js v10.4.3
* An arbitrary-precision Decimal type for JavaScript.
* https://github.com/MikeMcl/decimal.js
* Copyright (c) 2022 Michael Mclaughlin <[email protected]>
* MIT Licence
*/var o=9e15,p=1e9,T="0123456789abcdef",x="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",k="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",B={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-o,maxE:o,crypto:!1},X,Z,$,G,U=!0,Y="[DecimalError] ",ne=Y+"Invalid argument: ",oe=Y+"Precision limit exceeded",M=Y+"crypto unavailable",b="[object Decimal]",S=Math.floor,w=Math.pow,R=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,D=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,A=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,E=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,O=1e7,y=7,z=9007199254740991,te=x.length-1,re=k.length-1,I={toStringTag:b};I.absoluteValue=I.abs=function(){var i=new this.constructor(this);return i.s<0&&(i.s=1),ie(i)},I.ceil=function(){return ie(new this.constructor(this),this.e+1,2)},I.clampedTo=I.clamp=function(i,u){var s,a=this,c=a.constructor;if(i=new c(i),u=new c(u),!i.s||!u.s)return new c(NaN);if(i.gt(u))throw Error(ne+u);return s=a.cmp(i),s<0?i:a.cmp(u)>0?u:new c(a)},I.comparedTo=I.cmp=function(i){var u,s,a,c,h=this,v=h.d,C=(i=new h.constructor(i)).d,W=h.s,L=i.s;if(!v||!C)return!W||!L?NaN:W!==L?W:v===C?0:!v^W<0?1:-1;if(!v[0]||!C[0])return v[0]?W:C[0]?-L:0;if(W!==L)return W;if(h.e!==i.e)return h.e>i.e^W<0?1:-1;for(a=v.length,c=C.length,u=0,s=a<c?a:c;u<s;++u)if(v[u]!==C[u])return v[u]>C[u]^W<0?1:-1;return a===c?0:a>c^W<0?1:-1},I.cosine=I.cos=function(){var i,u,s=this,a=s.constructor;return s.d?s.d[0]?(i=a.precision,u=a.rounding,a.precision=i+Math.max(s.e,s.sd())+y,a.rounding=1,s=Ce(a,Tr(a,s)),a.precision=i,a.rounding=u,ie(G==2||G==3?s.neg():s,i,u,!0)):new a(1):new a(NaN)},I.cubeRoot=I.cbrt=function(){var i,u,s,a,c,h,v,C,W,L,H=this,V=H.constructor;if(!H.isFinite()||H.isZero())return new V(H);for(U=!1,h=H.s*w(H.s*H,1/3),!h||Math.abs(h)==1/0?(s=ce(H.d),i=H.e,(h=(i-s.length+1)%3)&&(s+=h==1||h==-2?"0":"00"),h=w(s,1/3),i=S((i+1)/3)-(i%3==(i<0?-1:2)),h==1/0?s="5e"+i:(s=h.toExponential(),s=s.slice(0,s.indexOf("e")+1)+i),a=new V(s),a.s=H.s):a=new V(h.toString()),v=(i=V.precision)+3;;)if(C=a,W=C.times(C).times(C),L=W.plus(H),a=ve(L.plus(H).times(C),L.plus(W),v+2,1),ce(C.d).slice(0,v)===(s=ce(a.d)).slice(0,v))if(s=s.slice(v-3,v+1),s=="9999"||!c&&s=="4999"){if(!c&&(ie(C,i+1,0),C.times(C).times(C).eq(H))){a=C;break}v+=4,c=1}else{(!+s||!+s.slice(1)&&s.charAt(0)=="5")&&(ie(a,i+1,1),u=!a.times(a).times(a).eq(H));break}return U=!0,ie(a,i,V.rounding,u)},I.decimalPlaces=I.dp=function(){var i,u=this.d,s=NaN;if(u){if(i=u.length-1,s=(i-S(this.e/y))*y,i=u[i],i)for(;i%10==0;i/=10)s--;s<0&&(s=0)}return s},I.dividedBy=I.div=function(i){return ve(this,new this.constructor(i))},I.dividedToIntegerBy=I.divToInt=function(i){var u=this,s=u.constructor;return ie(ve(u,new s(i),0,1,1),s.precision,s.rounding)},I.equals=I.eq=function(i){return this.cmp(i)===0},I.floor=function(){return ie(new this.constructor(this),this.e+1,3)},I.greaterThan=I.gt=function(i){return this.cmp(i)>0},I.greaterThanOrEqualTo=I.gte=function(i){var u=this.cmp(i);return u==1||u===0},I.hyperbolicCosine=I.cosh=function(){var i,u,s,a,c,h=this,v=h.constructor,C=new v(1);if(!h.isFinite())return new v(h.s?1/0:NaN);if(h.isZero())return C;s=v.precision,a=v.rounding,v.precision=s+Math.max(h.e,h.sd())+4,v.rounding=1,c=h.d.length,c<32?(i=Math.ceil(c/3),u=(1/st(4,i)).toString()):(i=16,u="2.3283064365386962890625e-10"),h=fn(v,1,h.times(u),new v(1),!0);for(var W,L=i,H=new v(8);L--;)W=h.times(h),h=C.minus(W.times(H.minus(W.times(H))));return ie(h,v.precision=s,v.rounding=a,!0)},I.hyperbolicSine=I.sinh=function(){var i,u,s,a,c=this,h=c.constructor;if(!c.isFinite()||c.isZero())return new h(c);if(u=h.precision,s=h.rounding,h.precision=u+Math.max(c.e,c.sd())+4,h.rounding=1,a=c.d.length,a<3)c=fn(h,2,c,c,!0);else{i=1.4*Math.sqrt(a),i=i>16?16:i|0,c=c.times(1/st(5,i)),c=fn(h,2,c,c,!0);for(var v,C=new h(5),W=new h(16),L=new h(20);i--;)v=c.times(c),c=c.times(C.plus(v.times(W.times(v).plus(L))))}return h.precision=u,h.rounding=s,ie(c,u,s,!0)},I.hyperbolicTangent=I.tanh=function(){var i,u,s=this,a=s.constructor;return s.isFinite()?s.isZero()?new a(s):(i=a.precision,u=a.rounding,a.precision=i+7,a.rounding=1,ve(s.sinh(),s.cosh(),a.precision=i,a.rounding=u)):new a(s.s)},I.inverseCosine=I.acos=function(){var i,u=this,s=u.constructor,a=u.abs().cmp(1),c=s.precision,h=s.rounding;return a!==-1?a===0?u.isNeg()?gt(s,c,h):new s(0):new s(NaN):u.isZero()?gt(s,c+4,h).times(.5):(s.precision=c+6,s.rounding=1,u=u.asin(),i=gt(s,c+4,h).times(.5),s.precision=c,s.rounding=h,i.minus(u))},I.inverseHyperbolicCosine=I.acosh=function(){var i,u,s=this,a=s.constructor;return s.lte(1)?new a(s.eq(1)?0:NaN):s.isFinite()?(i=a.precision,u=a.rounding,a.precision=i+Math.max(Math.abs(s.e),s.sd())+4,a.rounding=1,U=!1,s=s.times(s).minus(1).sqrt().plus(s),U=!0,a.precision=i,a.rounding=u,s.ln()):new a(s)},I.inverseHyperbolicSine=I.asinh=function(){var i,u,s=this,a=s.constructor;return!s.isFinite()||s.isZero()?new a(s):(i=a.precision,u=a.rounding,a.precision=i+2*Math.max(Math.abs(s.e),s.sd())+6,a.rounding=1,U=!1,s=s.times(s).plus(1).sqrt().plus(s),U=!0,a.precision=i,a.rounding=u,s.ln())},I.inverseHyperbolicTangent=I.atanh=function(){var i,u,s,a,c=this,h=c.constructor;return c.isFinite()?c.e>=0?new h(c.abs().eq(1)?c.s/0:c.isZero()?c:NaN):(i=h.precision,u=h.rounding,a=c.sd(),Math.max(a,i)<2*-c.e-1?ie(new h(c),i,u,!0):(h.precision=s=a-c.e,c=ve(c.plus(1),new h(1).minus(c),s+i,1),h.precision=i+4,h.rounding=1,c=c.ln(),h.precision=i,h.rounding=u,c.times(.5))):new h(NaN)},I.inverseSine=I.asin=function(){var i,u,s,a,c=this,h=c.constructor;return c.isZero()?new h(c):(u=c.abs().cmp(1),s=h.precision,a=h.rounding,u!==-1?u===0?(i=gt(h,s+4,a).times(.5),i.s=c.s,i):new h(NaN):(h.precision=s+6,h.rounding=1,c=c.div(new h(1).minus(c.times(c)).sqrt().plus(1)).atan(),h.precision=s,h.rounding=a,c.times(2)))},I.inverseTangent=I.atan=function(){var i,u,s,a,c,h,v,C,W,L=this,H=L.constructor,V=H.precision,j=H.rounding;if(L.isFinite()){if(L.isZero())return new H(L);if(L.abs().eq(1)&&V+4<=re)return v=gt(H,V+4,j).times(.25),v.s=L.s,v}else{if(!L.s)return new H(NaN);if(V+4<=re)return v=gt(H,V+4,j).times(.5),v.s=L.s,v}for(H.precision=C=V+10,H.rounding=1,s=Math.min(28,C/y+2|0),i=s;i;--i)L=L.div(L.times(L).plus(1).sqrt().plus(1));for(U=!1,u=Math.ceil(C/y),a=1,W=L.times(L),v=new H(L),c=L;i!==-1;)if(c=c.times(W),h=v.minus(c.div(a+=2)),c=c.times(W),v=h.plus(c.div(a+=2)),v.d[u]!==void 0)for(i=u;v.d[i]===h.d[i]&&i--;);return s&&(v=v.times(2<<s-1)),U=!0,ie(v,H.precision=V,H.rounding=j,!0)},I.isFinite=function(){return!!this.d},I.isInteger=I.isInt=function(){return!!this.d&&S(this.e/y)>this.d.length-2},I.isNaN=function(){return!this.s},I.isNegative=I.isNeg=function(){return this.s<0},I.isPositive=I.isPos=function(){return this.s>0},I.isZero=function(){return!!this.d&&this.d[0]===0},I.lessThan=I.lt=function(i){return this.cmp(i)<0},I.lessThanOrEqualTo=I.lte=function(i){return this.cmp(i)<1},I.logarithm=I.log=function(i){var u,s,a,c,h,v,C,W,L=this,H=L.constructor,V=H.precision,j=H.rounding,fe=5;if(i==null)i=new H(10),u=!0;else{if(i=new H(i),s=i.d,i.s<0||!s||!s[0]||i.eq(1))return new H(NaN);u=i.eq(10)}if(s=L.d,L.s<0||!s||!s[0]||L.eq(1))return new H(s&&!s[0]?-1/0:L.s!=1?NaN:s?0:1/0);if(u)if(s.length>1)h=!0;else{for(c=s[0];c%10===0;)c/=10;h=c!==1}if(U=!1,C=V+fe,v=pt(L,C),a=u?ut(H,C+10):pt(i,C),W=ve(v,a,C,1),Oe(W.d,c=V,j))do if(C+=10,v=pt(L,C),a=u?ut(H,C+10):pt(i,C),W=ve(v,a,C,1),!h){+ce(W.d).slice(c+1,c+15)+1==1e14&&(W=ie(W,V+1,0));break}while(Oe(W.d,c+=10,j));return U=!0,ie(W,V,j)},I.minus=I.sub=function(i){var u,s,a,c,h,v,C,W,L,H,V,j,fe=this,Te=fe.constructor;if(i=new Te(i),!fe.d||!i.d)return!fe.s||!i.s?i=new Te(NaN):fe.d?i.s=-i.s:i=new Te(i.d||fe.s!==i.s?fe:NaN),i;if(fe.s!=i.s)return i.s=-i.s,fe.plus(i);if(L=fe.d,j=i.d,C=Te.precision,W=Te.rounding,!L[0]||!j[0]){if(j[0])i.s=-i.s;else if(L[0])i=new Te(fe);else return new Te(W===3?-0:0);return U?ie(i,C,W):i}if(s=S(i.e/y),H=S(fe.e/y),L=L.slice(),h=H-s,h){for(V=h<0,V?(u=L,h=-h,v=j.length):(u=j,s=H,v=L.length),a=Math.max(Math.ceil(C/y),v)+2,h>a&&(h=a,u.length=1),u.reverse(),a=h;a--;)u.push(0);u.reverse()}else{for(a=L.length,v=j.length,V=a<v,V&&(v=a),a=0;a<v;a++)if(L[a]!=j[a]){V=L[a]<j[a];break}h=0}for(V&&(u=L,L=j,j=u,i.s=-i.s),v=L.length,a=j.length-v;a>0;--a)L[v++]=0;for(a=j.length;a>h;){if(L[--a]<j[a]){for(c=a;c&&L[--c]===0;)L[c]=O-1;--L[c],L[a]+=O}L[a]-=j[a]}for(;L[--v]===0;)L.pop();for(;L[0]===0;L.shift())--s;return L[0]?(i.d=L,i.e=Pe(L,s),U?ie(i,C,W):i):new Te(W===3?-0:0)},I.modulo=I.mod=function(i){var u,s=this,a=s.constructor;return i=new a(i),!s.d||!i.s||i.d&&!i.d[0]?new a(NaN):!i.d||s.d&&!s.d[0]?ie(new a(s),a.precision,a.rounding):(U=!1,a.modulo==9?(u=ve(s,i.abs(),0,3,1),u.s*=i.s):u=ve(s,i,0,a.modulo,1),u=u.times(i),U=!0,s.minus(u))},I.naturalExponential=I.exp=function(){return Cr(this)},I.naturalLogarithm=I.ln=function(){return pt(this)},I.negated=I.neg=function(){var i=new this.constructor(this);return i.s=-i.s,ie(i)},I.plus=I.add=function(i){var u,s,a,c,h,v,C,W,L,H,V=this,j=V.constructor;if(i=new j(i),!V.d||!i.d)return!V.s||!i.s?i=new j(NaN):V.d||(i=new j(i.d||V.s===i.s?V:NaN)),i;if(V.s!=i.s)return i.s=-i.s,V.minus(i);if(L=V.d,H=i.d,C=j.precision,W=j.rounding,!L[0]||!H[0])return H[0]||(i=new j(V)),U?ie(i,C,W):i;if(h=S(V.e/y),a=S(i.e/y),L=L.slice(),c=h-a,c){for(c<0?(s=L,c=-c,v=H.length):(s=H,a=h,v=L.length),h=Math.ceil(C/y),v=h>v?h+1:v+1,c>v&&(c=v,s.length=1),s.reverse();c--;)s.push(0);s.reverse()}for(v=L.length,c=H.length,v-c<0&&(c=v,s=H,H=L,L=s),u=0;c;)u=(L[--c]=L[c]+H[c]+u)/O|0,L[c]%=O;for(u&&(L.unshift(u),++a),v=L.length;L[--v]==0;)L.pop();return i.d=L,i.e=Pe(L,a),U?ie(i,C,W):i},I.precision=I.sd=function(i){var u,s=this;if(i!==void 0&&i!==!!i&&i!==1&&i!==0)throw Error(ne+i);return s.d?(u=Yt(s.d),i&&s.e+1>u&&(u=s.e+1)):u=NaN,u},I.round=function(){var i=this,u=i.constructor;return ie(new u(i),i.e+1,u.rounding)},I.sine=I.sin=function(){var i,u,s=this,a=s.constructor;return s.isFinite()?s.isZero()?new a(s):(i=a.precision,u=a.rounding,a.precision=i+Math.max(s.e,s.sd())+y,a.rounding=1,s=Sn(a,Tr(a,s)),a.precision=i,a.rounding=u,ie(G>2?s.neg():s,i,u,!0)):new a(NaN)},I.squareRoot=I.sqrt=function(){var i,u,s,a,c,h,v=this,C=v.d,W=v.e,L=v.s,H=v.constructor;if(L!==1||!C||!C[0])return new H(!L||L<0&&(!C||C[0])?NaN:C?v:1/0);for(U=!1,L=Math.sqrt(+v),L==0||L==1/0?(u=ce(C),(u.length+W)%2==0&&(u+="0"),L=Math.sqrt(u),W=S((W+1)/2)-(W<0||W%2),L==1/0?u="5e"+W:(u=L.toExponential(),u=u.slice(0,u.indexOf("e")+1)+W),a=new H(u)):a=new H(L.toString()),s=(W=H.precision)+3;;)if(h=a,a=h.plus(ve(v,h,s+2,1)).times(.5),ce(h.d).slice(0,s)===(u=ce(a.d)).slice(0,s))if(u=u.slice(s-3,s+1),u=="9999"||!c&&u=="4999"){if(!c&&(ie(h,W+1,0),h.times(h).eq(v))){a=h;break}s+=4,c=1}else{(!+u||!+u.slice(1)&&u.charAt(0)=="5")&&(ie(a,W+1,1),i=!a.times(a).eq(v));break}return U=!0,ie(a,W,H.rounding,i)},I.tangent=I.tan=function(){var i,u,s=this,a=s.constructor;return s.isFinite()?s.isZero()?new a(s):(i=a.precision,u=a.rounding,a.precision=i+10,a.rounding=1,s=s.sin(),s.s=1,s=ve(s,new a(1).minus(s.times(s)).sqrt(),i+10,0),a.precision=i,a.rounding=u,ie(G==2||G==4?s.neg():s,i,u,!0)):new a(NaN)},I.times=I.mul=function(i){var u,s,a,c,h,v,C,W,L,H=this,V=H.constructor,j=H.d,fe=(i=new V(i)).d;if(i.s*=H.s,!j||!j[0]||!fe||!fe[0])return new V(!i.s||j&&!j[0]&&!fe||fe&&!fe[0]&&!j?NaN:!j||!fe?i.s/0:i.s*0);for(s=S(H.e/y)+S(i.e/y),W=j.length,L=fe.length,W<L&&(h=j,j=fe,fe=h,v=W,W=L,L=v),h=[],v=W+L,a=v;a--;)h.push(0);for(a=L;--a>=0;){for(u=0,c=W+a;c>a;)C=h[c]+fe[a]*j[c-a-1]+u,h[c--]=C%O|0,u=C/O|0;h[c]=(h[c]+u)%O|0}for(;!h[--v];)h.pop();return u?++s:h.shift(),i.d=h,i.e=Pe(h,s),U?ie(i,V.precision,V.rounding):i},I.toBinary=function(i,u){return Nr(this,2,i,u)},I.toDecimalPlaces=I.toDP=function(i,u){var s=this,a=s.constructor;return s=new a(s),i===void 0?s:(le(i,0,p),u===void 0?u=a.rounding:le(u,0,8),ie(s,i+s.e+1,u))},I.toExponential=function(i,u){var s,a=this,c=a.constructor;return i===void 0?s=Se(a,!0):(le(i,0,p),u===void 0?u=c.rounding:le(u,0,8),a=ie(new c(a),i+1,u),s=Se(a,!0,i+1)),a.isNeg()&&!a.isZero()?"-"+s:s},I.toFixed=function(i,u){var s,a,c=this,h=c.constructor;return i===void 0?s=Se(c):(le(i,0,p),u===void 0?u=h.rounding:le(u,0,8),a=ie(new h(c),i+c.e+1,u),s=Se(a,!1,i+a.e+1)),c.isNeg()&&!c.isZero()?"-"+s:s},I.toFraction=function(i){var u,s,a,c,h,v,C,W,L,H,V,j,fe=this,Te=fe.d,pe=fe.constructor;if(!Te)return new pe(fe);if(L=s=new pe(1),a=W=new pe(0),u=new pe(a),h=u.e=Yt(Te)-fe.e-1,v=h%y,u.d[0]=w(10,v<0?y+v:v),i==null)i=h>0?u:L;else{if(C=new pe(i),!C.isInt()||C.lt(L))throw Error(ne+C);i=C.gt(u)?h>0?u:L:C}for(U=!1,C=new pe(ce(Te)),H=pe.precision,pe.precision=h=Te.length*y*2;V=ve(C,u,0,1,1),c=s.plus(V.times(a)),c.cmp(i)!=1;)s=a,a=c,c=L,L=W.plus(V.times(c)),W=c,c=u,u=C.minus(V.times(c)),C=c;return c=ve(i.minus(s),a,0,1,1),W=W.plus(c.times(L)),s=s.plus(c.times(a)),W.s=L.s=fe.s,j=ve(L,a,h,1).minus(fe).abs().cmp(ve(W,s,h,1).minus(fe).abs())<1?[L,a]:[W,s],pe.precision=H,U=!0,j},I.toHexadecimal=I.toHex=function(i,u){return Nr(this,16,i,u)},I.toNearest=function(i,u){var s=this,a=s.constructor;if(s=new a(s),i==null){if(!s.d)return s;i=new a(1),u=a.rounding}else{if(i=new a(i),u===void 0?u=a.rounding:le(u,0,8),!s.d)return i.s?s:i;if(!i.d)return i.s&&(i.s=s.s),i}return i.d[0]?(U=!1,s=ve(s,i,0,u,1).times(i),U=!0,ie(s)):(i.s=s.s,s=i),s},I.toNumber=function(){return+this},I.toOctal=function(i,u){return Nr(this,8,i,u)},I.toPower=I.pow=function(i){var u,s,a,c,h,v,C=this,W=C.constructor,L=+(i=new W(i));if(!C.d||!i.d||!C.d[0]||!i.d[0])return new W(w(+C,L));if(C=new W(C),C.eq(1))return C;if(a=W.precision,h=W.rounding,i.eq(1))return ie(C,a,h);if(u=S(i.e/y),u>=i.d.length-1&&(s=L<0?-L:L)<=z)return c=ai(W,C,s,a),i.s<0?new W(1).div(c):ie(c,a,h);if(v=C.s,v<0){if(u<i.d.length-1)return new W(NaN);if(i.d[u]&1||(v=1),C.e==0&&C.d[0]==1&&C.d.length==1)return C.s=v,C}return s=w(+C,L),u=s==0||!isFinite(s)?S(L*(Math.log("0."+ce(C.d))/Math.LN10+C.e+1)):new W(s+"").e,u>W.maxE+1||u<W.minE-1?new W(u>0?v/0:0):(U=!1,W.rounding=C.s=1,s=Math.min(12,(u+"").length),c=Cr(i.times(pt(C,a+s)),a),c.d&&(c=ie(c,a+5,1),Oe(c.d,a,h)&&(u=a+10,c=ie(Cr(i.times(pt(C,u+s)),u),u+5,1),+ce(c.d).slice(a+1,a+15)+1==1e14&&(c=ie(c,a+1,0)))),c.s=v,U=!0,W.rounding=h,ie(c,a,h))},I.toPrecision=function(i,u){var s,a=this,c=a.constructor;return i===void 0?s=Se(a,a.e<=c.toExpNeg||a.e>=c.toExpPos):(le(i,1,p),u===void 0?u=c.rounding:le(u,0,8),a=ie(new c(a),i,u),s=Se(a,i<=a.e||a.e<=c.toExpNeg,i)),a.isNeg()&&!a.isZero()?"-"+s:s},I.toSignificantDigits=I.toSD=function(i,u){var s=this,a=s.constructor;return i===void 0?(i=a.precision,u=a.rounding):(le(i,1,p),u===void 0?u=a.rounding:le(u,0,8)),ie(new a(s),i,u)},I.toString=function(){var i=this,u=i.constructor,s=Se(i,i.e<=u.toExpNeg||i.e>=u.toExpPos);return i.isNeg()&&!i.isZero()?"-"+s:s},I.truncated=I.trunc=function(){return ie(new this.constructor(this),this.e+1,1)},I.valueOf=I.toJSON=function(){var i=this,u=i.constructor,s=Se(i,i.e<=u.toExpNeg||i.e>=u.toExpPos);return i.isNeg()?"-"+s:s};function ce(i){var u,s,a,c=i.length-1,h="",v=i[0];if(c>0){for(h+=v,u=1;u<c;u++)a=i[u]+"",s=y-a.length,s&&(h+=mt(s)),h+=a;v=i[u],a=v+"",s=y-a.length,s&&(h+=mt(s))}else if(v===0)return"0";for(;v%10===0;)v/=10;return h+v}function le(i,u,s){if(i!==~~i||i<u||i>s)throw Error(ne+i)}function Oe(i,u,s,a){var c,h,v,C;for(h=i[0];h>=10;h/=10)--u;return--u<0?(u+=y,c=0):(c=Math.ceil((u+1)/y),u%=y),h=w(10,y-u),C=i[c]%h|0,a==null?u<3?(u==0?C=C/100|0:u==1&&(C=C/10|0),v=s<4&&C==99999||s>3&&C==49999||C==5e4||C==0):v=(s<4&&C+1==h||s>3&&C+1==h/2)&&(i[c+1]/h/100|0)==w(10,u-2)-1||(C==h/2||C==0)&&(i[c+1]/h/100|0)==0:u<4?(u==0?C=C/1e3|0:u==1?C=C/100|0:u==2&&(C=C/10|0),v=(a||s<4)&&C==9999||!a&&s>3&&C==4999):v=((a||s<4)&&C+1==h||!a&&s>3&&C+1==h/2)&&(i[c+1]/h/1e3|0)==w(10,u-3)-1,v}function me(i,u,s){for(var a,c=[0],h,v=0,C=i.length;v<C;){for(h=c.length;h--;)c[h]*=u;for(c[0]+=T.indexOf(i.charAt(v++)),a=0;a<c.length;a++)c[a]>s-1&&(c[a+1]===void 0&&(c[a+1]=0),c[a+1]+=c[a]/s|0,c[a]%=s)}return c.reverse()}function Ce(i,u){var s,a,c;if(u.isZero())return u;a=u.d.length,a<32?(s=Math.ceil(a/3),c=(1/st(4,s)).toString()):(s=16,c="2.3283064365386962890625e-10"),i.precision+=s,u=fn(i,1,u.times(c),new i(1));for(var h=s;h--;){var v=u.times(u);u=v.times(v).minus(v).times(8).plus(1)}return i.precision-=s,u}var ve=function(){function i(a,c,h){var v,C=0,W=a.length;for(a=a.slice();W--;)v=a[W]*c+C,a[W]=v%h|0,C=v/h|0;return C&&a.unshift(C),a}function u(a,c,h,v){var C,W;if(h!=v)W=h>v?1:-1;else for(C=W=0;C<h;C++)if(a[C]!=c[C]){W=a[C]>c[C]?1:-1;break}return W}function s(a,c,h,v){for(var C=0;h--;)a[h]-=C,C=a[h]<c[h]?1:0,a[h]=C*v+a[h]-c[h];for(;!a[0]&&a.length>1;)a.shift()}return function(a,c,h,v,C,W){var L,H,V,j,fe,Te,pe,Xe,ke,vt,Ie,Ke,In,yt,Fn,er,dn,gn,lt,tr,Dn=a.constructor,nr=a.s==c.s?1:-1,ze=a.d,De=c.d;if(!ze||!ze[0]||!De||!De[0])return new Dn(!a.s||!c.s||(ze?De&&ze[0]==De[0]:!De)?NaN:ze&&ze[0]==0||!De?nr*0:nr/0);for(W?(fe=1,H=a.e-c.e):(W=O,fe=y,H=S(a.e/fe)-S(c.e/fe)),lt=De.length,dn=ze.length,ke=new Dn(nr),vt=ke.d=[],V=0;De[V]==(ze[V]||0);V++);if(De[V]>(ze[V]||0)&&H--,h==null?(yt=h=Dn.precision,v=Dn.rounding):C?yt=h+(a.e-c.e)+1:yt=h,yt<0)vt.push(1),Te=!0;else{if(yt=yt/fe+2|0,V=0,lt==1){for(j=0,De=De[0],yt++;(V<dn||j)&&yt--;V++)Fn=j*W+(ze[V]||0),vt[V]=Fn/De|0,j=Fn%De|0;Te=j||V<dn}else{for(j=W/(De[0]+1)|0,j>1&&(De=i(De,j,W),ze=i(ze,j,W),lt=De.length,dn=ze.length),er=lt,Ie=ze.slice(0,lt),Ke=Ie.length;Ke<lt;)Ie[Ke++]=0;tr=De.slice(),tr.unshift(0),gn=De[0],De[1]>=W/2&&++gn;do j=0,L=u(De,Ie,lt,Ke),L<0?(In=Ie[0],lt!=Ke&&(In=In*W+(Ie[1]||0)),j=In/gn|0,j>1?(j>=W&&(j=W-1),pe=i(De,j,W),Xe=pe.length,Ke=Ie.length,L=u(pe,Ie,Xe,Ke),L==1&&(j--,s(pe,lt<Xe?tr:De,Xe,W))):(j==0&&(L=j=1),pe=De.slice()),Xe=pe.length,Xe<Ke&&pe.unshift(0),s(Ie,pe,Ke,W),L==-1&&(Ke=Ie.length,L=u(De,Ie,lt,Ke),L<1&&(j++,s(Ie,lt<Ke?tr:De,Ke,W))),Ke=Ie.length):L===0&&(j++,Ie=[0]),vt[V++]=j,L&&Ie[0]?Ie[Ke++]=ze[er]||0:(Ie=[ze[er]],Ke=1);while((er++<dn||Ie[0]!==void 0)&&yt--);Te=Ie[0]!==void 0}vt[0]||vt.shift()}if(fe==1)ke.e=H,Z=Te;else{for(V=1,j=vt[0];j>=10;j/=10)V++;ke.e=V+H*fe-1,ie(ke,C?h+ke.e+1:h,v,Te)}return ke}}();function ie(i,u,s,a){var c,h,v,C,W,L,H,V,j,fe=i.constructor;e:if(u!=null){if(V=i.d,!V)return i;for(c=1,C=V[0];C>=10;C/=10)c++;if(h=u-c,h<0)h+=y,v=u,H=V[j=0],W=H/w(10,c-v-1)%10|0;else if(j=Math.ceil((h+1)/y),C=V.length,j>=C)if(a){for(;C++<=j;)V.push(0);H=W=0,c=1,h%=y,v=h-y+1}else break e;else{for(H=C=V[j],c=1;C>=10;C/=10)c++;h%=y,v=h-y+c,W=v<0?0:H/w(10,c-v-1)%10|0}if(a=a||u<0||V[j+1]!==void 0||(v<0?H:H%w(10,c-v-1)),L=s<4?(W||a)&&(s==0||s==(i.s<0?3:2)):W>5||W==5&&(s==4||a||s==6&&(h>0?v>0?H/w(10,c-v):0:V[j-1])%10&1||s==(i.s<0?8:7)),u<1||!V[0])return V.length=0,L?(u-=i.e+1,V[0]=w(10,(y-u%y)%y),i.e=-u||0):V[0]=i.e=0,i;if(h==0?(V.length=j,C=1,j--):(V.length=j+1,C=w(10,y-h),V[j]=v>0?(H/w(10,c-v)%w(10,v)|0)*C:0),L)for(;;)if(j==0){for(h=1,v=V[0];v>=10;v/=10)h++;for(v=V[0]+=C,C=1;v>=10;v/=10)C++;h!=C&&(i.e++,V[0]==O&&(V[0]=1));break}else{if(V[j]+=C,V[j]!=O)break;V[j--]=0,C=1}for(h=V.length;V[--h]===0;)V.pop()}return U&&(i.e>fe.maxE?(i.d=null,i.e=NaN):i.e<fe.minE&&(i.e=0,i.d=[0])),i}function Se(i,u,s){if(!i.isFinite())return On(i);var a,c=i.e,h=ce(i.d),v=h.length;return u?(s&&(a=s-v)>0?h=h.charAt(0)+"."+h.slice(1)+mt(a):v>1&&(h=h.charAt(0)+"."+h.slice(1)),h=h+(i.e<0?"e":"e+")+i.e):c<0?(h="0."+mt(-c-1)+h,s&&(a=s-v)>0&&(h+=mt(a))):c>=v?(h+=mt(c+1-v),s&&(a=s-c-1)>0&&(h=h+"."+mt(a))):((a=c+1)<v&&(h=h.slice(0,a)+"."+h.slice(a)),s&&(a=s-v)>0&&(c+1===v&&(h+="."),h+=mt(a))),h}function Pe(i,u){var s=i[0];for(u*=y;s>=10;s/=10)u++;return u}function ut(i,u,s){if(u>te)throw U=!0,s&&(i.precision=s),Error(oe);return ie(new i(x),u,1,!0)}function gt(i,u,s){if(u>re)throw Error(oe);return ie(new i(k),u,s,!0)}function Yt(i){var u=i.length-1,s=u*y+1;if(u=i[u],u){for(;u%10==0;u/=10)s--;for(u=i[0];u>=10;u/=10)s++}return s}function mt(i){for(var u="";i--;)u+="0";return u}function ai(i,u,s,a){var c,h=new i(1),v=Math.ceil(a/y+4);for(U=!1;;){if(s%2&&(h=h.times(u),cn(h.d,v)&&(c=!0)),s=S(s/2),s===0){s=h.d.length-1,c&&h.d[s]===0&&++h.d[s];break}u=u.times(u),cn(u.d,v)}return U=!0,h}function ln(i){return i.d[i.d.length-1]&1}function an(i,u,s){for(var a,c=new i(u[0]),h=0;++h<u.length;)if(a=new i(u[h]),a.s)c[s](a)&&(c=a);else{c=a;break}return c}function Cr(i,u){var s,a,c,h,v,C,W,L=0,H=0,V=0,j=i.constructor,fe=j.rounding,Te=j.precision;if(!i.d||!i.d[0]||i.e>17)return new j(i.d?i.d[0]?i.s<0?0:1/0:1:i.s?i.s<0?0:i:NaN);for(u==null?(U=!1,W=Te):W=u,C=new j(.03125);i.e>-2;)i=i.times(C),V+=5;for(a=Math.log(w(2,V))/Math.LN10*2+5|0,W+=a,s=h=v=new j(1),j.precision=W;;){if(h=ie(h.times(i),W,1),s=s.times(++H),C=v.plus(ve(h,s,W,1)),ce(C.d).slice(0,W)===ce(v.d).slice(0,W)){for(c=V;c--;)v=ie(v.times(v),W,1);if(u==null)if(L<3&&Oe(v.d,W-a,fe,L))j.precision=W+=10,s=h=C=new j(1),H=0,L++;else return ie(v,j.precision=Te,fe,U=!0);else return j.precision=Te,v}v=C}}function pt(i,u){var s,a,c,h,v,C,W,L,H,V,j,fe=1,Te=10,pe=i,Xe=pe.d,ke=pe.constructor,vt=ke.rounding,Ie=ke.precision;if(pe.s<0||!Xe||!Xe[0]||!pe.e&&Xe[0]==1&&Xe.length==1)return new ke(Xe&&!Xe[0]?-1/0:pe.s!=1?NaN:Xe?0:pe);if(u==null?(U=!1,H=Ie):H=u,ke.precision=H+=Te,s=ce(Xe),a=s.charAt(0),Math.abs(h=pe.e)<15e14){for(;a<7&&a!=1||a==1&&s.charAt(1)>3;)pe=pe.times(i),s=ce(pe.d),a=s.charAt(0),fe++;h=pe.e,a>1?(pe=new ke("0."+s),h++):pe=new ke(a+"."+s.slice(1))}else return L=ut(ke,H+2,Ie).times(h+""),pe=pt(new ke(a+"."+s.slice(1)),H-Te).plus(L),ke.precision=Ie,u==null?ie(pe,Ie,vt,U=!0):pe;for(V=pe,W=v=pe=ve(pe.minus(1),pe.plus(1),H,1),j=ie(pe.times(pe),H,1),c=3;;){if(v=ie(v.times(j),H,1),L=W.plus(ve(v,new ke(c),H,1)),ce(L.d).slice(0,H)===ce(W.d).slice(0,H))if(W=W.times(2),h!==0&&(W=W.plus(ut(ke,H+2,Ie).times(h+""))),W=ve(W,new ke(fe),H,1),u==null)if(Oe(W.d,H-Te,vt,C))ke.precision=H+=Te,L=v=pe=ve(V.minus(1),V.plus(1),H,1),j=ie(pe.times(pe),H,1),c=C=1;else return ie(W,ke.precision=Ie,vt,U=!0);else return ke.precision=Ie,W;W=L,c+=2}}function On(i){return String(i.s*i.s/0)}function Xn(i,u){var s,a,c;for((s=u.indexOf("."))>-1&&(u=u.replace(".","")),(a=u.search(/e/i))>0?(s<0&&(s=a),s+=+u.slice(a+1),u=u.substring(0,a)):s<0&&(s=u.length),a=0;u.charCodeAt(a)===48;a++);for(c=u.length;u.charCodeAt(c-1)===48;--c);if(u=u.slice(a,c),u){if(c-=a,i.e=s=s-a-1,i.d=[],a=(s+1)%y,s<0&&(a+=y),a<c){for(a&&i.d.push(+u.slice(0,a)),c-=y;a<c;)i.d.push(+u.slice(a,a+=y));u=u.slice(a),a=y-u.length}else a-=c;for(;a--;)u+="0";i.d.push(+u),U&&(i.e>i.constructor.maxE?(i.d=null,i.e=NaN):i.e<i.constructor.minE&&(i.e=0,i.d=[0]))}else i.e=0,i.d=[0];return i}function wt(i,u){var s,a,c,h,v,C,W,L,H;if(u.indexOf("_")>-1){if(u=u.replace(/(\d)_(?=\d)/g,"$1"),E.test(u))return Xn(i,u)}else if(u==="Infinity"||u==="NaN")return+u||(i.s=NaN),i.e=NaN,i.d=null,i;if(D.test(u))s=16,u=u.toLowerCase();else if(R.test(u))s=2;else if(A.test(u))s=8;else throw Error(ne+u);for(h=u.search(/p/i),h>0?(W=+u.slice(h+1),u=u.substring(2,h)):u=u.slice(2),h=u.indexOf("."),v=h>=0,a=i.constructor,v&&(u=u.replace(".",""),C=u.length,h=C-h,c=ai(a,new a(s),h,h*2)),L=me(u,s,O),H=L.length-1,h=H;L[h]===0;--h)L.pop();return h<0?new a(i.s*0):(i.e=Pe(L,H),i.d=L,U=!1,v&&(i=ve(i,c,C*4)),W&&(i=i.times(Math.abs(W)<54?w(2,W):X.pow(2,W))),U=!0,i)}function Sn(i,u){var s,a=u.d.length;if(a<3)return u.isZero()?u:fn(i,2,u,u);s=1.4*Math.sqrt(a),s=s>16?16:s|0,u=u.times(1/st(5,s)),u=fn(i,2,u,u);for(var c,h=new i(5),v=new i(16),C=new i(20);s--;)c=u.times(u),u=u.times(h.plus(c.times(v.times(c).minus(C))));return u}function fn(i,u,s,a,c){var h,v,C,W,L=i.precision,H=Math.ceil(L/y);for(U=!1,W=s.times(s),C=new i(a);;){if(v=ve(C.times(W),new i(u++*u++),L,1),C=c?a.plus(v):a.minus(v),a=ve(v.times(W),new i(u++*u++),L,1),v=C.plus(a),v.d[H]!==void 0){for(h=H;v.d[h]===C.d[h]&&h--;);if(h==-1)break}h=C,C=a,a=v,v=h}return U=!0,v.d.length=H+1,v}function st(i,u){for(var s=i;--u;)s*=i;return s}function Tr(i,u){var s,a=u.s<0,c=gt(i,i.precision,1),h=c.times(.5);if(u=u.abs(),u.lte(h))return G=a?4:1,u;if(s=u.divToInt(c),s.isZero())G=a?3:2;else{if(u=u.minus(s.times(c)),u.lte(h))return G=ln(s)?a?2:3:a?4:1,u;G=ln(s)?a?1:4:a?3:2}return u.minus(c).abs()}function Nr(i,u,s,a){var c,h,v,C,W,L,H,V,j,fe=i.constructor,Te=s!==void 0;if(Te?(le(s,1,p),a===void 0?a=fe.rounding:le(a,0,8)):(s=fe.precision,a=fe.rounding),!i.isFinite())H=On(i);else{for(H=Se(i),v=H.indexOf("."),Te?(c=2,u==16?s=s*4-3:u==8&&(s=s*3-2)):c=u,v>=0&&(H=H.replace(".",""),j=new fe(1),j.e=H.length-v,j.d=me(Se(j),10,c),j.e=j.d.length),V=me(H,10,c),h=W=V.length;V[--W]==0;)V.pop();if(!V[0])H=Te?"0p+0":"0";else{if(v<0?h--:(i=new fe(i),i.d=V,i.e=h,i=ve(i,j,s,a,0,c),V=i.d,h=i.e,L=Z),v=V[s],C=c/2,L=L||V[s+1]!==void 0,L=a<4?(v!==void 0||L)&&(a===0||a===(i.s<0?3:2)):v>C||v===C&&(a===4||L||a===6&&V[s-1]&1||a===(i.s<0?8:7)),V.length=s,L)for(;++V[--s]>c-1;)V[s]=0,s||(++h,V.unshift(1));for(W=V.length;!V[W-1];--W);for(v=0,H="";v<W;v++)H+=T.charAt(V[v]);if(Te){if(W>1)if(u==16||u==8){for(v=u==16?4:3,--W;W%v;W++)H+="0";for(V=me(H,c,u),W=V.length;!V[W-1];--W);for(v=1,H="1.";v<W;v++)H+=T.charAt(V[v])}else H=H.charAt(0)+"."+H.slice(1);H=H+(h<0?"p":"p+")+h}else if(h<0){for(;++h;)H="0"+H;H="0."+H}else if(++h>W)for(h-=W;h--;)H+="0";else h<W&&(H=H.slice(0,h)+"."+H.slice(h))}H=(u==16?"0x":u==2?"0b":u==8?"0o":"")+H}return i.s<0?"-"+H:H}function cn(i,u){if(i.length>u)return i.length=u,!0}function _t(i){return new this(i).abs()}function xn(i){return new this(i).acos()}function Qn(i){return new this(i).acosh()}function fo(i,u){return new this(i).plus(u)}function Pn(i){return new this(i).asin()}function co(i){return new this(i).asinh()}function Wn(i){return new this(i).atan()}function hn(i){return new this(i).atanh()}function yr(i,u){i=new this(i),u=new this(u);var s,a=this.precision,c=this.rounding,h=a+4;return!i.s||!u.s?s=new this(NaN):!i.d&&!u.d?(s=gt(this,h,1).times(u.s>0?.25:.75),s.s=i.s):!u.d||i.isZero()?(s=u.s<0?gt(this,a,c):new this(0),s.s=i.s):!i.d||u.isZero()?(s=gt(this,h,1).times(.5),s.s=i.s):u.s<0?(this.precision=h,this.rounding=1,s=this.atan(ve(i,u,h,1)),u=gt(this,h,1),this.precision=a,this.rounding=c,s=i.s<0?s.minus(u):s.plus(u)):s=this.atan(ve(i,u,h,1)),s}function Lr(i){return new this(i).cbrt()}function Or(i){return ie(i=new this(i),i.e+1,2)}function Sr(i,u,s){return new this(i).clamp(u,s)}function xr(i){if(!i||typeof i!="object")throw Error(Y+"Object expected");var u,s,a,c=i.defaults===!0,h=["precision",1,p,"rounding",0,8,"toExpNeg",-o,0,"toExpPos",0,o,"maxE",0,o,"minE",-o,0,"modulo",0,9];for(u=0;u<h.length;u+=3)if(s=h[u],c&&(this[s]=B[s]),(a=i[s])!==void 0)if(S(a)===a&&a>=h[u+1]&&a<=h[u+2])this[s]=a;else throw Error(ne+s+": "+a);if(s="crypto",c&&(this[s]=B[s]),(a=i[s])!==void 0)if(a===!0||a===!1||a===0||a===1)if(a)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[s]=!0;else throw Error(M);else this[s]=!1;else throw Error(ne+s+": "+a);return this}function Pr(i){return new this(i).cos()}function Wr(i){return new this(i).cosh()}function jn(i){var u,s,a;function c(h){var v,C,W,L=this;if(!(L instanceof c))return new c(h);if(L.constructor=c,Fr(h)){L.s=h.s,U?!h.d||h.e>c.maxE?(L.e=NaN,L.d=null):h.e<c.minE?(L.e=0,L.d=[0]):(L.e=h.e,L.d=h.d.slice()):(L.e=h.e,L.d=h.d?h.d.slice():h.d);return}if(W=typeof h,W==="number"){if(h===0){L.s=1/h<0?-1:1,L.e=0,L.d=[0];return}if(h<0?(h=-h,L.s=-1):L.s=1,h===~~h&&h<1e7){for(v=0,C=h;C>=10;C/=10)v++;U?v>c.maxE?(L.e=NaN,L.d=null):v<c.minE?(L.e=0,L.d=[0]):(L.e=v,L.d=[h]):(L.e=v,L.d=[h]);return}else if(h*0!==0){h||(L.s=NaN),L.e=NaN,L.d=null;return}return Xn(L,h.toString())}else if(W!=="string")throw Error(ne+h);return(C=h.charCodeAt(0))===45?(h=h.slice(1),L.s=-1):(C===43&&(h=h.slice(1)),L.s=1),E.test(h)?Xn(L,h):wt(L,h)}if(c.prototype=I,c.ROUND_UP=0,c.ROUND_DOWN=1,c.ROUND_CEIL=2,c.ROUND_FLOOR=3,c.ROUND_HALF_UP=4,c.ROUND_HALF_DOWN=5,c.ROUND_HALF_EVEN=6,c.ROUND_HALF_CEIL=7,c.ROUND_HALF_FLOOR=8,c.EUCLID=9,c.config=c.set=xr,c.clone=jn,c.isDecimal=Fr,c.abs=_t,c.acos=xn,c.acosh=Qn,c.add=fo,c.asin=Pn,c.asinh=co,c.atan=Wn,c.atanh=hn,c.atan2=yr,c.cbrt=Lr,c.ceil=Or,c.clamp=Sr,c.cos=Pr,c.cosh=Wr,c.div=Ir,c.exp=ho,c.floor=go,c.hypot=mo,c.ln=fi,c.log=po,c.log10=_o,c.log2=wo,c.max=vo,c.min=ci,c.mod=Ao,c.mul=Eo,c.pow=bo,c.random=Dr,c.round=Ro,c.sign=Mr,c.sin=Co,c.sinh=To,c.sqrt=No,c.sub=yo,c.sum=Lo,c.tan=Oo,c.tanh=So,c.trunc=xo,i===void 0&&(i={}),i&&i.defaults!==!0)for(a=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],u=0;u<a.length;)i.hasOwnProperty(s=a[u++])||(i[s]=this[s]);return c.config(i),c}function Ir(i,u){return new this(i).div(u)}function ho(i){return new this(i).exp()}function go(i){return ie(i=new this(i),i.e+1,3)}function mo(){var i,u,s=new this(0);for(U=!1,i=0;i<arguments.length;)if(u=new this(arguments[i++]),u.d)s.d&&(s=s.plus(u.times(u)));else{if(u.s)return U=!0,new this(1/0);s=u}return U=!0,s.sqrt()}function Fr(i){return i instanceof X||i&&i.toStringTag===b||!1}function fi(i){return new this(i).ln()}function po(i,u){return new this(i).log(u)}function wo(i){return new this(i).log(2)}function _o(i){return new this(i).log(10)}function vo(){return an(this,arguments,"lt")}function ci(){return an(this,arguments,"gt")}function Ao(i,u){return new this(i).mod(u)}function Eo(i,u){return new this(i).mul(u)}function bo(i,u){return new this(i).pow(u)}function Dr(i){var u,s,a,c,h=0,v=new this(1),C=[];if(i===void 0?i=this.precision:le(i,1,p),a=Math.ceil(i/y),this.crypto)if(crypto.getRandomValues)for(u=crypto.getRandomValues(new Uint32Array(a));h<a;)c=u[h],c>=429e7?u[h]=crypto.getRandomValues(new Uint32Array(1))[0]:C[h++]=c%1e7;else if(crypto.randomBytes){for(u=crypto.randomBytes(a*=4);h<a;)c=u[h]+(u[h+1]<<8)+(u[h+2]<<16)+((u[h+3]&127)<<24),c>=214e7?crypto.randomBytes(4).copy(u,h):(C.push(c%1e7),h+=4);h=a/4}else throw Error(M);else for(;h<a;)C[h++]=Math.random()*1e7|0;for(a=C[--h],i%=y,a&&i&&(c=w(10,y-i),C[h]=(a/c|0)*c);C[h]===0;h--)C.pop();if(h<0)s=0,C=[0];else{for(s=-1;C[0]===0;s-=y)C.shift();for(a=1,c=C[0];c>=10;c/=10)a++;a<y&&(s-=y-a)}return v.e=s,v.d=C,v}function Ro(i){return ie(i=new this(i),i.e+1,this.rounding)}function Mr(i){return i=new this(i),i.d?i.d[0]?i.s:0*i.s:i.s||NaN}function Co(i){return new this(i).sin()}function To(i){return new this(i).sinh()}function No(i){return new this(i).sqrt()}function yo(i,u){return new this(i).sub(u)}function Lo(){var i=0,u=arguments,s=new this(u[i]);for(U=!1;s.s&&++i<u.length;)s=s.plus(u[i]);return U=!0,ie(s,this.precision,this.rounding)}function Oo(i){return new this(i).tan()}function So(i){return new this(i).tanh()}function xo(i){return ie(i=new this(i),i.e+1,1)}X=jn(B),X.prototype.constructor=X,X.default=X.Decimal=X,x=new X(x),k=new X(k),l.exports?(typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"&&(I[Symbol.for("nodejs.util.inspect.custom")]=I.toString,I[Symbol.toStringTag]="Decimal"),l.exports=X):(d||(d=typeof self<"u"&&self&&self.self==self?self:window),$=d.Decimal,X.noConflict=function(){return d.Decimal=$,X},d.Decimal=X)})(Vt)})(Pa);var Wa=Pa.exports,ro={exports:{}};/**
* @license
* Lodash <https://lodash.com/>
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/ro.exports;(function(l,d){(function(){var o,p="4.17.21",T=200,x="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",k="Expected a function",B="Invalid `variable` option passed into `_.template`",X="__lodash_hash_undefined__",Z=500,$="__lodash_placeholder__",G=1,U=2,Y=4,ne=1,oe=2,M=1,b=2,S=4,w=8,R=16,D=32,A=64,E=128,O=256,y=512,z=30,te="...",re=800,I=16,ce=1,le=2,Oe=3,me=1/0,Ce=9007199254740991,ve=17976931348623157e292,ie=NaN,Se=4294967295,Pe=Se-1,ut=Se>>>1,gt=[["ary",E],["bind",M],["bindKey",b],["curry",w],["curryRight",R],["flip",y],["partial",D],["partialRight",A],["rearg",O]],Yt="[object Arguments]",mt="[object Array]",ai="[object AsyncFunction]",ln="[object Boolean]",an="[object Date]",Cr="[object DOMException]",pt="[object Error]",On="[object Function]",Xn="[object GeneratorFunction]",wt="[object Map]",Sn="[object Number]",fn="[object Null]",st="[object Object]",Tr="[object Promise]",Nr="[object Proxy]",cn="[object RegExp]",_t="[object Set]",xn="[object String]",Qn="[object Symbol]",fo="[object Undefined]",Pn="[object WeakMap]",co="[object WeakSet]",Wn="[object ArrayBuffer]",hn="[object DataView]",yr="[object Float32Array]",Lr="[object Float64Array]",Or="[object Int8Array]",Sr="[object Int16Array]",xr="[object Int32Array]",Pr="[object Uint8Array]",Wr="[object Uint8ClampedArray]",jn="[object Uint16Array]",Ir="[object Uint32Array]",ho=/\b__p \+= '';/g,go=/\b(__p \+=) '' \+/g,mo=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Fr=/&(?:amp|lt|gt|quot|#39);/g,fi=/[&<>"']/g,po=RegExp(Fr.source),wo=RegExp(fi.source),_o=/<%-([\s\S]+?)%>/g,vo=/<%([\s\S]+?)%>/g,ci=/<%=([\s\S]+?)%>/g,Ao=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Eo=/^\w*$/,bo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Dr=/[\\^$.*+?()[\]{}|]/g,Ro=RegExp(Dr.source),Mr=/^\s+/,Co=/\s/,To=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,No=/\{\n\/\* \[wrapped with (.+)\] \*/,yo=/,? & /,Lo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Oo=/[()=,{}\[\]\/\s]/,So=/\\(\\)?/g,xo=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,i=/\w*$/,u=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,a=/^\[object .+?Constructor\]$/,c=/^0o[0-7]+$/i,h=/^(?:0|[1-9]\d*)$/,v=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,C=/($^)/,W=/['\n\r\u2028\u2029\\]/g,L="\\ud800-\\udfff",H="\\u0300-\\u036f",V="\\ufe20-\\ufe2f",j="\\u20d0-\\u20ff",fe=H+V+j,Te="\\u2700-\\u27bf",pe="a-z\\xdf-\\xf6\\xf8-\\xff",Xe="\\xac\\xb1\\xd7\\xf7",ke="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",vt="\\u2000-\\u206f",Ie=" \\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",Ke="A-Z\\xc0-\\xd6\\xd8-\\xde",In="\\ufe0e\\ufe0f",yt=Xe+ke+vt+Ie,Fn="['’]",er="["+L+"]",dn="["+yt+"]",gn="["+fe+"]",lt="\\d+",tr="["+Te+"]",Dn="["+pe+"]",nr="[^"+L+yt+lt+Te+pe+Ke+"]",ze="\\ud83c[\\udffb-\\udfff]",De="(?:"+gn+"|"+ze+")",os="[^"+L+"]",Po="(?:\\ud83c[\\udde6-\\uddff]){2}",Wo="[\\ud800-\\udbff][\\udc00-\\udfff]",rr="["+Ke+"]",us="\\u200d",ss="(?:"+Dn+"|"+nr+")",tf="(?:"+rr+"|"+nr+")",ls="(?:"+Fn+"(?:d|ll|m|re|s|t|ve))?",as="(?:"+Fn+"(?:D|LL|M|RE|S|T|VE))?",fs=De+"?",cs="["+In+"]?",nf="(?:"+us+"(?:"+[os,Po,Wo].join("|")+")"+cs+fs+")*",rf="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",of="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",hs=cs+fs+nf,uf="(?:"+[tr,Po,Wo].join("|")+")"+hs,sf="(?:"+[os+gn+"?",gn,Po,Wo,er].join("|")+")",lf=RegExp(Fn,"g"),af=RegExp(gn,"g"),Io=RegExp(ze+"(?="+ze+")|"+sf+hs,"g"),ff=RegExp([rr+"?"+Dn+"+"+ls+"(?="+[dn,rr,"$"].join("|")+")",tf+"+"+as+"(?="+[dn,rr+ss,"$"].join("|")+")",rr+"?"+ss+"+"+ls,rr+"+"+as,of,rf,lt,uf].join("|"),"g"),cf=RegExp("["+us+L+fe+In+"]"),hf=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,df=["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"],gf=-1,He={};He[yr]=He[Lr]=He[Or]=He[Sr]=He[xr]=He[Pr]=He[Wr]=He[jn]=He[Ir]=!0,He[Yt]=He[mt]=He[Wn]=He[ln]=He[hn]=He[an]=He[pt]=He[On]=He[wt]=He[Sn]=He[st]=He[cn]=He[_t]=He[xn]=He[Pn]=!1;var Ue={};Ue[Yt]=Ue[mt]=Ue[Wn]=Ue[hn]=Ue[ln]=Ue[an]=Ue[yr]=Ue[Lr]=Ue[Or]=Ue[Sr]=Ue[xr]=Ue[wt]=Ue[Sn]=Ue[st]=Ue[cn]=Ue[_t]=Ue[xn]=Ue[Qn]=Ue[Pr]=Ue[Wr]=Ue[jn]=Ue[Ir]=!0,Ue[pt]=Ue[On]=Ue[Pn]=!1;var mf={À:"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"},pf={"&":"&","<":"<",">":">",'"':""","'":"'"},wf={"&":"&","<":"<",">":">",""":'"',"'":"'"},_f={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},vf=parseFloat,Af=parseInt,ds=typeof Vt=="object"&&Vt&&Vt.Object===Object&&Vt,Ef=typeof self=="object"&&self&&self.Object===Object&&self,Qe=ds||Ef||Function("return this")(),Fo=d&&!d.nodeType&&d,Mn=Fo&&!0&&l&&!l.nodeType&&l,gs=Mn&&Mn.exports===Fo,Do=gs&&ds.process,Lt=function(){try{var P=Mn&&Mn.require&&Mn.require("util").types;return P||Do&&Do.binding&&Do.binding("util")}catch{}}(),ms=Lt&&Lt.isArrayBuffer,ps=Lt&&Lt.isDate,ws=Lt&&Lt.isMap,_s=Lt&&Lt.isRegExp,vs=Lt&&Lt.isSet,As=Lt&&Lt.isTypedArray;function At(P,K,q){switch(q.length){case 0:return P.call(K);case 1:return P.call(K,q[0]);case 2:return P.call(K,q[0],q[1]);case 3:return P.call(K,q[0],q[1],q[2])}return P.apply(K,q)}function bf(P,K,q,se){for(var we=-1,xe=P==null?0:P.length;++we<xe;){var Ve=P[we];K(se,Ve,q(Ve),P)}return se}function Ot(P,K){for(var q=-1,se=P==null?0:P.length;++q<se&&K(P[q],q,P)!==!1;);return P}function Rf(P,K){for(var q=P==null?0:P.length;q--&&K(P[q],q,P)!==!1;);return P}function Es(P,K){for(var q=-1,se=P==null?0:P.length;++q<se;)if(!K(P[q],q,P))return!1;return!0}function mn(P,K){for(var q=-1,se=P==null?0:P.length,we=0,xe=[];++q<se;){var Ve=P[q];K(Ve,q,P)&&(xe[we++]=Ve)}return xe}function hi(P,K){var q=P==null?0:P.length;return!!q&&ir(P,K,0)>-1}function Mo(P,K,q){for(var se=-1,we=P==null?0:P.length;++se<we;)if(q(K,P[se]))return!0;return!1}function $e(P,K){for(var q=-1,se=P==null?0:P.length,we=Array(se);++q<se;)we[q]=K(P[q],q,P);return we}function pn(P,K){for(var q=-1,se=K.length,we=P.length;++q<se;)P[we+q]=K[q];return P}function Uo(P,K,q,se){var we=-1,xe=P==null?0:P.length;for(se&&xe&&(q=P[++we]);++we<xe;)q=K(q,P[we],we,P);return q}function Cf(P,K,q,se){var we=P==null?0:P.length;for(se&&we&&(q=P[--we]);we--;)q=K(q,P[we],we,P);return q}function ko(P,K){for(var q=-1,se=P==null?0:P.length;++q<se;)if(K(P[q],q,P))return!0;return!1}var Tf=Ho("length");function Nf(P){return P.split("")}function yf(P){return P.match(Lo)||[]}function bs(P,K,q){var se;return q(P,function(we,xe,Ve){if(K(we,xe,Ve))return se=xe,!1}),se}function di(P,K,q,se){for(var we=P.length,xe=q+(se?1:-1);se?xe--:++xe<we;)if(K(P[xe],xe,P))return xe;return-1}function ir(P,K,q){return K===K?kf(P,K,q):di(P,Rs,q)}function Lf(P,K,q,se){for(var we=q-1,xe=P.length;++we<xe;)if(se(P[we],K))return we;return-1}function Rs(P){return P!==P}function Cs(P,K){var q=P==null?0:P.length;return q?Bo(P,K)/q:ie}function Ho(P){return function(K){return K==null?o:K[P]}}function $o(P){return function(K){return P==null?o:P[K]}}function Ts(P,K,q,se,we){return we(P,function(xe,Ve,Me){q=se?(se=!1,xe):K(q,xe,Ve,Me)}),q}function Of(P,K){var q=P.length;for(P.sort(K);q--;)P[q]=P[q].value;return P}function Bo(P,K){for(var q,se=-1,we=P.length;++se<we;){var xe=K(P[se]);xe!==o&&(q=q===o?xe:q+xe)}return q}function qo(P,K){for(var q=-1,se=Array(P);++q<P;)se[q]=K(q);return se}function Sf(P,K){return $e(K,function(q){return[q,P[q]]})}function Ns(P){return P&&P.slice(0,Ss(P)+1).replace(Mr,"")}function Et(P){return function(K){return P(K)}}function Go(P,K){return $e(K,function(q){return P[q]})}function Ur(P,K){return P.has(K)}function ys(P,K){for(var q=-1,se=P.length;++q<se&&ir(K,P[q],0)>-1;);return q}function Ls(P,K){for(var q=P.length;q--&&ir(K,P[q],0)>-1;);return q}function xf(P,K){for(var q=P.length,se=0;q--;)P[q]===K&&++se;return se}var Pf=$o(mf),Wf=$o(pf);function If(P){return"\\"+_f[P]}function Ff(P,K){return P==null?o:P[K]}function or(P){return cf.test(P)}function Df(P){return hf.test(P)}function Mf(P){for(var K,q=[];!(K=P.next()).done;)q.push(K.value);return q}function Zo(P){var K=-1,q=Array(P.size);return P.forEach(function(se,we){q[++K]=[we,se]}),q}function Os(P,K){return function(q){return P(K(q))}}function wn(P,K){for(var q=-1,se=P.length,we=0,xe=[];++q<se;){var Ve=P[q];(Ve===K||Ve===$)&&(P[q]=$,xe[we++]=q)}return xe}function gi(P){var K=-1,q=Array(P.size);return P.forEach(function(se){q[++K]=se}),q}function Uf(P){var K=-1,q=Array(P.size);return P.forEach(function(se){q[++K]=[se,se]}),q}function kf(P,K,q){for(var se=q-1,we=P.length;++se<we;)if(P[se]===K)return se;return-1}function Hf(P,K,q){for(var se=q+1;se--;)if(P[se]===K)return se;return se}function ur(P){return or(P)?Bf(P):Tf(P)}function Ut(P){return or(P)?qf(P):Nf(P)}function Ss(P){for(var K=P.length;K--&&Co.test(P.charAt(K)););return K}var $f=$o(wf);function Bf(P){for(var K=Io.lastIndex=0;Io.test(P);)++K;return K}function qf(P){return P.match(Io)||[]}function Gf(P){return P.match(ff)||[]}var Zf=function P(K){K=K==null?Qe:sr.defaults(Qe.Object(),K,sr.pick(Qe,df));var q=K.Array,se=K.Date,we=K.Error,xe=K.Function,Ve=K.Math,Me=K.Object,zo=K.RegExp,zf=K.String,St=K.TypeError,mi=q.prototype,Kf=xe.prototype,lr=Me.prototype,pi=K["__core-js_shared__"],wi=Kf.toString,Fe=lr.hasOwnProperty,Vf=0,xs=function(){var e=/[^.]+$/.exec(pi&&pi.keys&&pi.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),_i=lr.toString,Yf=wi.call(Me),Jf=Qe._,Xf=zo("^"+wi.call(Fe).replace(Dr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),vi=gs?K.Buffer:o,_n=K.Symbol,Ai=K.Uint8Array,Ps=vi?vi.allocUnsafe:o,Ei=Os(Me.getPrototypeOf,Me),Ws=Me.create,Is=lr.propertyIsEnumerable,bi=mi.splice,Fs=_n?_n.isConcatSpreadable:o,kr=_n?_n.iterator:o,Un=_n?_n.toStringTag:o,Ri=function(){try{var e=qn(Me,"defineProperty");return e({},"",{}),e}catch{}}(),Qf=K.clearTimeout!==Qe.clearTimeout&&K.clearTimeout,jf=se&&se.now!==Qe.Date.now&&se.now,ec=K.setTimeout!==Qe.setTimeout&&K.setTimeout,Ci=Ve.ceil,Ti=Ve.floor,Ko=Me.getOwnPropertySymbols,tc=vi?vi.isBuffer:o,Ds=K.isFinite,nc=mi.join,rc=Os(Me.keys,Me),Ye=Ve.max,et=Ve.min,ic=se.now,oc=K.parseInt,Ms=Ve.random,uc=mi.reverse,Vo=qn(K,"DataView"),Hr=qn(K,"Map"),Yo=qn(K,"Promise"),ar=qn(K,"Set"),$r=qn(K,"WeakMap"),Br=qn(Me,"create"),Ni=$r&&new $r,fr={},sc=Gn(Vo),lc=Gn(Hr),ac=Gn(Yo),fc=Gn(ar),cc=Gn($r),yi=_n?_n.prototype:o,qr=yi?yi.valueOf:o,Us=yi?yi.toString:o;function g(e){if(qe(e)&&!_e(e)&&!(e instanceof Ne)){if(e instanceof xt)return e;if(Fe.call(e,"__wrapped__"))return kl(e)}return new xt(e)}var cr=function(){function e(){}return function(t){if(!Be(t))return{};if(Ws)return Ws(t);e.prototype=t;var n=new e;return e.prototype=o,n}}();function Li(){}function xt(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=o}g.templateSettings={escape:_o,evaluate:vo,interpolate:ci,variable:"",imports:{_:g}},g.prototype=Li.prototype,g.prototype.constructor=g,xt.prototype=cr(Li.prototype),xt.prototype.constructor=xt;function Ne(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Se,this.__views__=[]}function hc(){var e=new Ne(this.__wrapped__);return e.__actions__=at(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=at(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=at(this.__views__),e}function dc(){if(this.__filtered__){var e=new Ne(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function gc(){var e=this.__wrapped__.value(),t=this.__dir__,n=_e(e),r=t<0,f=n?e.length:0,m=Nh(0,f,this.__views__),_=m.start,N=m.end,F=N-_,J=r?N:_-1,Q=this.__iteratees__,ee=Q.length,ue=0,ae=et(F,this.__takeCount__);if(!n||!r&&f==F&&ae==F)return ll(e,this.__actions__);var de=[];e:for(;F--&&ue<ae;){J+=t;for(var Ee=-1,ge=e[J];++Ee<ee;){var Re=Q[Ee],ye=Re.iteratee,Ct=Re.type,ot=ye(ge);if(Ct==le)ge=ot;else if(!ot){if(Ct==ce)continue e;break e}}de[ue++]=ge}return de}Ne.prototype=cr(Li.prototype),Ne.prototype.constructor=Ne;function kn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function mc(){this.__data__=Br?Br(null):{},this.size=0}function pc(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function wc(e){var t=this.__data__;if(Br){var n=t[e];return n===X?o:n}return Fe.call(t,e)?t[e]:o}function _c(e){var t=this.__data__;return Br?t[e]!==o:Fe.call(t,e)}function vc(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Br&&t===o?X:t,this}kn.prototype.clear=mc,kn.prototype.delete=pc,kn.prototype.get=wc,kn.prototype.has=_c,kn.prototype.set=vc;function Jt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ac(){this.__data__=[],this.size=0}function Ec(e){var t=this.__data__,n=Oi(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():bi.call(t,n,1),--this.size,!0}function bc(e){var t=this.__data__,n=Oi(t,e);return n<0?o:t[n][1]}function Rc(e){return Oi(this.__data__,e)>-1}function Cc(e,t){var n=this.__data__,r=Oi(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}Jt.prototype.clear=Ac,Jt.prototype.delete=Ec,Jt.prototype.get=bc,Jt.prototype.has=Rc,Jt.prototype.set=Cc;function Xt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Tc(){this.size=0,this.__data__={hash:new kn,map:new(Hr||Jt),string:new kn}}function Nc(e){var t=$i(this,e).delete(e);return this.size-=t?1:0,t}function yc(e){return $i(this,e).get(e)}function Lc(e){return $i(this,e).has(e)}function Oc(e,t){var n=$i(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}Xt.prototype.clear=Tc,Xt.prototype.delete=Nc,Xt.prototype.get=yc,Xt.prototype.has=Lc,Xt.prototype.set=Oc;function Hn(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Xt;++t<n;)this.add(e[t])}function Sc(e){return this.__data__.set(e,X),this}function xc(e){return this.__data__.has(e)}Hn.prototype.add=Hn.prototype.push=Sc,Hn.prototype.has=xc;function kt(e){var t=this.__data__=new Jt(e);this.size=t.size}function Pc(){this.__data__=new Jt,this.size=0}function Wc(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Ic(e){return this.__data__.get(e)}function Fc(e){return this.__data__.has(e)}function Dc(e,t){var n=this.__data__;if(n instanceof Jt){var r=n.__data__;if(!Hr||r.length<T-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Xt(r)}return n.set(e,t),this.size=n.size,this}kt.prototype.clear=Pc,kt.prototype.delete=Wc,kt.prototype.get=Ic,kt.prototype.has=Fc,kt.prototype.set=Dc;function ks(e,t){var n=_e(e),r=!n&&Zn(e),f=!n&&!r&&Rn(e),m=!n&&!r&&!f&&mr(e),_=n||r||f||m,N=_?qo(e.length,zf):[],F=N.length;for(var J in e)(t||Fe.call(e,J))&&!(_&&(J=="length"||f&&(J=="offset"||J=="parent")||m&&(J=="buffer"||J=="byteLength"||J=="byteOffset")||tn(J,F)))&&N.push(J);return N}function Hs(e){var t=e.length;return t?e[uu(0,t-1)]:o}function Mc(e,t){return Bi(at(e),$n(t,0,e.length))}function Uc(e){return Bi(at(e))}function Jo(e,t,n){(n!==o&&!Ht(e[t],n)||n===o&&!(t in e))&&Qt(e,t,n)}function Gr(e,t,n){var r=e[t];(!(Fe.call(e,t)&&Ht(r,n))||n===o&&!(t in e))&&Qt(e,t,n)}function Oi(e,t){for(var n=e.length;n--;)if(Ht(e[n][0],t))return n;return-1}function kc(e,t,n,r){return vn(e,function(f,m,_){t(r,f,n(f),_)}),r}function $s(e,t){return e&&Zt(t,Je(t),e)}function Hc(e,t){return e&&Zt(t,ct(t),e)}function Qt(e,t,n){t=="__proto__"&&Ri?Ri(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Xo(e,t){for(var n=-1,r=t.length,f=q(r),m=e==null;++n<r;)f[n]=m?o:xu(e,t[n]);return f}function $n(e,t,n){return e===e&&(n!==o&&(e=e<=n?e:n),t!==o&&(e=e>=t?e:t)),e}function Pt(e,t,n,r,f,m){var _,N=t&G,F=t&U,J=t&Y;if(n&&(_=f?n(e,r,f,m):n(e)),_!==o)return _;if(!Be(e))return e;var Q=_e(e);if(Q){if(_=Lh(e),!N)return at(e,_)}else{var ee=tt(e),ue=ee==On||ee==Xn;if(Rn(e))return cl(e,N);if(ee==st||ee==Yt||ue&&!f){if(_=F||ue?{}:Sl(e),!N)return F?wh(e,Hc(_,e)):ph(e,$s(_,e))}else{if(!Ue[ee])return f?e:{};_=Oh(e,ee,N)}}m||(m=new kt);var ae=m.get(e);if(ae)return ae;m.set(e,_),oa(e)?e.forEach(function(ge){_.add(Pt(ge,t,n,ge,e,m))}):ra(e)&&e.forEach(function(ge,Re){_.set(Re,Pt(ge,t,n,Re,e,m))});var de=J?F?wu:pu:F?ct:Je,Ee=Q?o:de(e);return Ot(Ee||e,function(ge,Re){Ee&&(Re=ge,ge=e[Re]),Gr(_,Re,Pt(ge,t,n,Re,e,m))}),_}function $c(e){var t=Je(e);return function(n){return Bs(n,e,t)}}function Bs(e,t,n){var r=n.length;if(e==null)return!r;for(e=Me(e);r--;){var f=n[r],m=t[f],_=e[f];if(_===o&&!(f in e)||!m(_))return!1}return!0}function qs(e,t,n){if(typeof e!="function")throw new St(k);return Xr(function(){e.apply(o,n)},t)}function Zr(e,t,n,r){var f=-1,m=hi,_=!0,N=e.length,F=[],J=t.length;if(!N)return F;n&&(t=$e(t,Et(n))),r?(m=Mo,_=!1):t.length>=T&&(m=Ur,_=!1,t=new Hn(t));e:for(;++f<N;){var Q=e[f],ee=n==null?Q:n(Q);if(Q=r||Q!==0?Q:0,_&&ee===ee){for(var ue=J;ue--;)if(t[ue]===ee)continue e;F.push(Q)}else m(t,ee,r)||F.push(Q)}return F}var vn=pl(Gt),Gs=pl(jo,!0);function Bc(e,t){var n=!0;return vn(e,function(r,f,m){return n=!!t(r,f,m),n}),n}function Si(e,t,n){for(var r=-1,f=e.length;++r<f;){var m=e[r],_=t(m);if(_!=null&&(N===o?_===_&&!Rt(_):n(_,N)))var N=_,F=m}return F}function qc(e,t,n,r){var f=e.length;for(n=Ae(n),n<0&&(n=-n>f?0:f+n),r=r===o||r>f?f:Ae(r),r<0&&(r+=f),r=n>r?0:sa(r);n<r;)e[n++]=t;return e}function Zs(e,t){var n=[];return vn(e,function(r,f,m){t(r,f,m)&&n.push(r)}),n}function je(e,t,n,r,f){var m=-1,_=e.length;for(n||(n=xh),f||(f=[]);++m<_;){var N=e[m];t>0&&n(N)?t>1?je(N,t-1,n,r,f):pn(f,N):r||(f[f.length]=N)}return f}var Qo=wl(),zs=wl(!0);function Gt(e,t){return e&&Qo(e,t,Je)}function jo(e,t){return e&&zs(e,t,Je)}function xi(e,t){return mn(t,function(n){return nn(e[n])})}function Bn(e,t){t=En(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[zt(t[n++])];return n&&n==r?e:o}function Ks(e,t,n){var r=t(e);return _e(e)?r:pn(r,n(e))}function rt(e){return e==null?e===o?fo:fn:Un&&Un in Me(e)?Th(e):Uh(e)}function eu(e,t){return e>t}function Gc(e,t){return e!=null&&Fe.call(e,t)}function Zc(e,t){return e!=null&&t in Me(e)}function zc(e,t,n){return e>=et(t,n)&&e<Ye(t,n)}function tu(e,t,n){for(var r=n?Mo:hi,f=e[0].length,m=e.length,_=m,N=q(m),F=1/0,J=[];_--;){var Q=e[_];_&&t&&(Q=$e(Q,Et(t))),F=et(Q.length,F),N[_]=!n&&(t||f>=120&&Q.length>=120)?new Hn(_&&Q):o}Q=e[0];var ee=-1,ue=N[0];e:for(;++ee<f&&J.length<F;){var ae=Q[ee],de=t?t(ae):ae;if(ae=n||ae!==0?ae:0,!(ue?Ur(ue,de):r(J,de,n))){for(_=m;--_;){var Ee=N[_];if(!(Ee?Ur(Ee,de):r(e[_],de,n)))continue e}ue&&ue.push(de),J.push(ae)}}return J}function Kc(e,t,n,r){return Gt(e,function(f,m,_){t(r,n(f),m,_)}),r}function zr(e,t,n){t=En(t,e),e=Il(e,t);var r=e==null?e:e[zt(It(t))];return r==null?o:At(r,e,n)}function Vs(e){return qe(e)&&rt(e)==Yt}function Vc(e){return qe(e)&&rt(e)==Wn}function Yc(e){return qe(e)&&rt(e)==an}function Kr(e,t,n,r,f){return e===t?!0:e==null||t==null||!qe(e)&&!qe(t)?e!==e&&t!==t:Jc(e,t,n,r,Kr,f)}function Jc(e,t,n,r,f,m){var _=_e(e),N=_e(t),F=_?mt:tt(e),J=N?mt:tt(t);F=F==Yt?st:F,J=J==Yt?st:J;var Q=F==st,ee=J==st,ue=F==J;if(ue&&Rn(e)){if(!Rn(t))return!1;_=!0,Q=!1}if(ue&&!Q)return m||(m=new kt),_||mr(e)?yl(e,t,n,r,f,m):Rh(e,t,F,n,r,f,m);if(!(n&ne)){var ae=Q&&Fe.call(e,"__wrapped__"),de=ee&&Fe.call(t,"__wrapped__");if(ae||de){var Ee=ae?e.value():e,ge=de?t.value():t;return m||(m=new kt),f(Ee,ge,n,r,m)}}return ue?(m||(m=new kt),Ch(e,t,n,r,f,m)):!1}function Xc(e){return qe(e)&&tt(e)==wt}function nu(e,t,n,r){var f=n.length,m=f,_=!r;if(e==null)return!m;for(e=Me(e);f--;){var N=n[f];if(_&&N[2]?N[1]!==e[N[0]]:!(N[0]in e))return!1}for(;++f<m;){N=n[f];var F=N[0],J=e[F],Q=N[1];if(_&&N[2]){if(J===o&&!(F in e))return!1}else{var ee=new kt;if(r)var ue=r(J,Q,F,e,t,ee);if(!(ue===o?Kr(Q,J,ne|oe,r,ee):ue))return!1}}return!0}function Ys(e){if(!Be(e)||Wh(e))return!1;var t=nn(e)?Xf:a;return t.test(Gn(e))}function Qc(e){return qe(e)&&rt(e)==cn}function jc(e){return qe(e)&&tt(e)==_t}function eh(e){return qe(e)&&Vi(e.length)&&!!He[rt(e)]}function Js(e){return typeof e=="function"?e:e==null?ht:typeof e=="object"?_e(e)?js(e[0],e[1]):Qs(e):_a(e)}function ru(e){if(!Jr(e))return rc(e);var t=[];for(var n in Me(e))Fe.call(e,n)&&n!="constructor"&&t.push(n);return t}function th(e){if(!Be(e))return Mh(e);var t=Jr(e),n=[];for(var r in e)r=="constructor"&&(t||!Fe.call(e,r))||n.push(r);return n}function iu(e,t){return e<t}function Xs(e,t){var n=-1,r=ft(e)?q(e.length):[];return vn(e,function(f,m,_){r[++n]=t(f,m,_)}),r}function Qs(e){var t=vu(e);return t.length==1&&t[0][2]?Pl(t[0][0],t[0][1]):function(n){return n===e||nu(n,e,t)}}function js(e,t){return Eu(e)&&xl(t)?Pl(zt(e),t):function(n){var r=xu(n,e);return r===o&&r===t?Pu(n,e):Kr(t,r,ne|oe)}}function Pi(e,t,n,r,f){e!==t&&Qo(t,function(m,_){if(f||(f=new kt),Be(m))nh(e,t,_,n,Pi,r,f);else{var N=r?r(Ru(e,_),m,_+"",e,t,f):o;N===o&&(N=m),Jo(e,_,N)}},ct)}function nh(e,t,n,r,f,m,_){var N=Ru(e,n),F=Ru(t,n),J=_.get(F);if(J){Jo(e,n,J);return}var Q=m?m(N,F,n+"",e,t,_):o,ee=Q===o;if(ee){var ue=_e(F),ae=!ue&&Rn(F),de=!ue&&!ae&&mr(F);Q=F,ue||ae||de?_e(N)?Q=N:Ge(N)?Q=at(N):ae?(ee=!1,Q=cl(F,!0)):de?(ee=!1,Q=hl(F,!0)):Q=[]:Qr(F)||Zn(F)?(Q=N,Zn(N)?Q=la(N):(!Be(N)||nn(N))&&(Q=Sl(F))):ee=!1}ee&&(_.set(F,Q),f(Q,F,r,m,_),_.delete(F)),Jo(e,n,Q)}function el(e,t){var n=e.length;if(n)return t+=t<0?n:0,tn(t,n)?e[t]:o}function tl(e,t,n){t.length?t=$e(t,function(m){return _e(m)?function(_){return Bn(_,m.length===1?m[0]:m)}:m}):t=[ht];var r=-1;t=$e(t,Et(he()));var f=Xs(e,function(m,_,N){var F=$e(t,function(J){return J(m)});return{criteria:F,index:++r,value:m}});return Of(f,function(m,_){return mh(m,_,n)})}function rh(e,t){return nl(e,t,function(n,r){return Pu(e,r)})}function nl(e,t,n){for(var r=-1,f=t.length,m={};++r<f;){var _=t[r],N=Bn(e,_);n(N,_)&&Vr(m,En(_,e),N)}return m}function ih(e){return function(t){return Bn(t,e)}}function ou(e,t,n,r){var f=r?Lf:ir,m=-1,_=t.length,N=e;for(e===t&&(t=at(t)),n&&(N=$e(e,Et(n)));++m<_;)for(var F=0,J=t[m],Q=n?n(J):J;(F=f(N,Q,F,r))>-1;)N!==e&&bi.call(N,F,1),bi.call(e,F,1);return e}function rl(e,t){for(var n=e?t.length:0,r=n-1;n--;){var f=t[n];if(n==r||f!==m){var m=f;tn(f)?bi.call(e,f,1):au(e,f)}}return e}function uu(e,t){return e+Ti(Ms()*(t-e+1))}function oh(e,t,n,r){for(var f=-1,m=Ye(Ci((t-e)/(n||1)),0),_=q(m);m--;)_[r?m:++f]=e,e+=n;return _}function su(e,t){var n="";if(!e||t<1||t>Ce)return n;do t%2&&(n+=e),t=Ti(t/2),t&&(e+=e);while(t);return n}function be(e,t){return Cu(Wl(e,t,ht),e+"")}function uh(e){return Hs(pr(e))}function sh(e,t){var n=pr(e);return Bi(n,$n(t,0,n.length))}function Vr(e,t,n,r){if(!Be(e))return e;t=En(t,e);for(var f=-1,m=t.length,_=m-1,N=e;N!=null&&++f<m;){var F=zt(t[f]),J=n;if(F==="__proto__"||F==="constructor"||F==="prototype")return e;if(f!=_){var Q=N[F];J=r?r(Q,F,N):o,J===o&&(J=Be(Q)?Q:tn(t[f+1])?[]:{})}Gr(N,F,J),N=N[F]}return e}var il=Ni?function(e,t){return Ni.set(e,t),e}:ht,lh=Ri?function(e,t){return Ri(e,"toString",{configurable:!0,enumerable:!1,value:Iu(t),writable:!0})}:ht;function ah(e){return Bi(pr(e))}function Wt(e,t,n){var r=-1,f=e.length;t<0&&(t=-t>f?0:f+t),n=n>f?f:n,n<0&&(n+=f),f=t>n?0:n-t>>>0,t>>>=0;for(var m=q(f);++r<f;)m[r]=e[r+t];return m}function fh(e,t){var n;return vn(e,function(r,f,m){return n=t(r,f,m),!n}),!!n}function Wi(e,t,n){var r=0,f=e==null?r:e.length;if(typeof t=="number"&&t===t&&f<=ut){for(;r<f;){var m=r+f>>>1,_=e[m];_!==null&&!Rt(_)&&(n?_<=t:_<t)?r=m+1:f=m}return f}return lu(e,t,ht,n)}function lu(e,t,n,r){var f=0,m=e==null?0:e.length;if(m===0)return 0;t=n(t);for(var _=t!==t,N=t===null,F=Rt(t),J=t===o;f<m;){var Q=Ti((f+m)/2),ee=n(e[Q]),ue=ee!==o,ae=ee===null,de=ee===ee,Ee=Rt(ee);if(_)var ge=r||de;else J?ge=de&&(r||ue):N?ge=de&&ue&&(r||!ae):F?ge=de&&ue&&!ae&&(r||!Ee):ae||Ee?ge=!1:ge=r?ee<=t:ee<t;ge?f=Q+1:m=Q}return et(m,Pe)}function ol(e,t){for(var n=-1,r=e.length,f=0,m=[];++n<r;){var _=e[n],N=t?t(_):_;if(!n||!Ht(N,F)){var F=N;m[f++]=_===0?0:_}}return m}function ul(e){return typeof e=="number"?e:Rt(e)?ie:+e}function bt(e){if(typeof e=="string")return e;if(_e(e))return $e(e,bt)+"";if(Rt(e))return Us?Us.call(e):"";var t=e+"";return t=="0"&&1/e==-me?"-0":t}function An(e,t,n){var r=-1,f=hi,m=e.length,_=!0,N=[],F=N;if(n)_=!1,f=Mo;else if(m>=T){var J=t?null:Eh(e);if(J)return gi(J);_=!1,f=Ur,F=new Hn}else F=t?[]:N;e:for(;++r<m;){var Q=e[r],ee=t?t(Q):Q;if(Q=n||Q!==0?Q:0,_&&ee===ee){for(var ue=F.length;ue--;)if(F[ue]===ee)continue e;t&&F.push(ee),N.push(Q)}else f(F,ee,n)||(F!==N&&F.push(ee),N.push(Q))}return N}function au(e,t){return t=En(t,e),e=Il(e,t),e==null||delete e[zt(It(t))]}function sl(e,t,n,r){return Vr(e,t,n(Bn(e,t)),r)}function Ii(e,t,n,r){for(var f=e.length,m=r?f:-1;(r?m--:++m<f)&&t(e[m],m,e););return n?Wt(e,r?0:m,r?m+1:f):Wt(e,r?m+1:0,r?f:m)}function ll(e,t){var n=e;return n instanceof Ne&&(n=n.value()),Uo(t,function(r,f){return f.func.apply(f.thisArg,pn([r],f.args))},n)}function fu(e,t,n){var r=e.length;if(r<2)return r?An(e[0]):[];for(var f=-1,m=q(r);++f<r;)for(var _=e[f],N=-1;++N<r;)N!=f&&(m[f]=Zr(m[f]||_,e[N],t,n));return An(je(m,1),t,n)}function al(e,t,n){for(var r=-1,f=e.length,m=t.length,_={};++r<f;){var N=r<m?t[r]:o;n(_,e[r],N)}return _}function cu(e){return Ge(e)?e:[]}function hu(e){return typeof e=="function"?e:ht}function En(e,t){return _e(e)?e:Eu(e,t)?[e]:Ul(We(e))}var ch=be;function bn(e,t,n){var r=e.length;return n=n===o?r:n,!t&&n>=r?e:Wt(e,t,n)}var fl=Qf||function(e){return Qe.clearTimeout(e)};function cl(e,t){if(t)return e.slice();var n=e.length,r=Ps?Ps(n):new e.constructor(n);return e.copy(r),r}function du(e){var t=new e.constructor(e.byteLength);return new Ai(t).set(new Ai(e)),t}function hh(e,t){var n=t?du(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function dh(e){var t=new e.constructor(e.source,i.exec(e));return t.lastIndex=e.lastIndex,t}function gh(e){return qr?Me(qr.call(e)):{}}function hl(e,t){var n=t?du(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function dl(e,t){if(e!==t){var n=e!==o,r=e===null,f=e===e,m=Rt(e),_=t!==o,N=t===null,F=t===t,J=Rt(t);if(!N&&!J&&!m&&e>t||m&&_&&F&&!N&&!J||r&&_&&F||!n&&F||!f)return 1;if(!r&&!m&&!J&&e<t||J&&n&&f&&!r&&!m||N&&n&&f||!_&&f||!F)return-1}return 0}function mh(e,t,n){for(var r=-1,f=e.criteria,m=t.criteria,_=f.length,N=n.length;++r<_;){var F=dl(f[r],m[r]);if(F){if(r>=N)return F;var J=n[r];return F*(J=="desc"?-1:1)}}return e.index-t.index}function gl(e,t,n,r){for(var f=-1,m=e.length,_=n.length,N=-1,F=t.length,J=Ye(m-_,0),Q=q(F+J),ee=!r;++N<F;)Q[N]=t[N];for(;++f<_;)(ee||f<m)&&(Q[n[f]]=e[f]);for(;J--;)Q[N++]=e[f++];return Q}function ml(e,t,n,r){for(var f=-1,m=e.length,_=-1,N=n.length,F=-1,J=t.length,Q=Ye(m-N,0),ee=q(Q+J),ue=!r;++f<Q;)ee[f]=e[f];for(var ae=f;++F<J;)ee[ae+F]=t[F];for(;++_<N;)(ue||f<m)&&(ee[ae+n[_]]=e[f++]);return ee}function at(e,t){var n=-1,r=e.length;for(t||(t=q(r));++n<r;)t[n]=e[n];return t}function Zt(e,t,n,r){var f=!n;n||(n={});for(var m=-1,_=t.length;++m<_;){var N=t[m],F=r?r(n[N],e[N],N,n,e):o;F===o&&(F=e[N]),f?Qt(n,N,F):Gr(n,N,F)}return n}function ph(e,t){return Zt(e,Au(e),t)}function wh(e,t){return Zt(e,Ll(e),t)}function Fi(e,t){return function(n,r){var f=_e(n)?bf:kc,m=t?t():{};return f(n,e,he(r,2),m)}}function hr(e){return be(function(t,n){var r=-1,f=n.length,m=f>1?n[f-1]:o,_=f>2?n[2]:o;for(m=e.length>3&&typeof m=="function"?(f--,m):o,_&&it(n[0],n[1],_)&&(m=f<3?o:m,f=1),t=Me(t);++r<f;){var N=n[r];N&&e(t,N,r,m)}return t})}function pl(e,t){return function(n,r){if(n==null)return n;if(!ft(n))return e(n,r);for(var f=n.length,m=t?f:-1,_=Me(n);(t?m--:++m<f)&&r(_[m],m,_)!==!1;);return n}}function wl(e){return function(t,n,r){for(var f=-1,m=Me(t),_=r(t),N=_.length;N--;){var F=_[e?N:++f];if(n(m[F],F,m)===!1)break}return t}}function _h(e,t,n){var r=t&M,f=Yr(e);function m(){var _=this&&this!==Qe&&this instanceof m?f:e;return _.apply(r?n:this,arguments)}return m}function _l(e){return function(t){t=We(t);var n=or(t)?Ut(t):o,r=n?n[0]:t.charAt(0),f=n?bn(n,1).join(""):t.slice(1);return r[e]()+f}}function dr(e){return function(t){return Uo(pa(ma(t).replace(lf,"")),e,"")}}function Yr(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=cr(e.prototype),r=e.apply(n,t);return Be(r)?r:n}}function vh(e,t,n){var r=Yr(e);function f(){for(var m=arguments.length,_=q(m),N=m,F=gr(f);N--;)_[N]=arguments[N];var J=m<3&&_[0]!==F&&_[m-1]!==F?[]:wn(_,F);if(m-=J.length,m<n)return Rl(e,t,Di,f.placeholder,o,_,J,o,o,n-m);var Q=this&&this!==Qe&&this instanceof f?r:e;return At(Q,this,_)}return f}function vl(e){return function(t,n,r){var f=Me(t);if(!ft(t)){var m=he(n,3);t=Je(t),n=function(N){return m(f[N],N,f)}}var _=e(t,n,r);return _>-1?f[m?t[_]:_]:o}}function Al(e){return en(function(t){var n=t.length,r=n,f=xt.prototype.thru;for(e&&t.reverse();r--;){var m=t[r];if(typeof m!="function")throw new St(k);if(f&&!_&&Hi(m)=="wrapper")var _=new xt([],!0)}for(r=_?r:n;++r<n;){m=t[r];var N=Hi(m),F=N=="wrapper"?_u(m):o;F&&bu(F[0])&&F[1]==(E|w|D|O)&&!F[4].length&&F[9]==1?_=_[Hi(F[0])].apply(_,F[3]):_=m.length==1&&bu(m)?_[N]():_.thru(m)}return function(){var J=arguments,Q=J[0];if(_&&J.length==1&&_e(Q))return _.plant(Q).value();for(var ee=0,ue=n?t[ee].apply(this,J):Q;++ee<n;)ue=t[ee].call(this,ue);return ue}})}function Di(e,t,n,r,f,m,_,N,F,J){var Q=t&E,ee=t&M,ue=t&b,ae=t&(w|R),de=t&y,Ee=ue?o:Yr(e);function ge(){for(var Re=arguments.length,ye=q(Re),Ct=Re;Ct--;)ye[Ct]=arguments[Ct];if(ae)var ot=gr(ge),Tt=xf(ye,ot);if(r&&(ye=gl(ye,r,f,ae)),m&&(ye=ml(ye,m,_,ae)),Re-=Tt,ae&&Re<J){var Ze=wn(ye,ot);return Rl(e,t,Di,ge.placeholder,n,ye,Ze,N,F,J-Re)}var $t=ee?n:this,on=ue?$t[e]:e;return Re=ye.length,N?ye=kh(ye,N):de&&Re>1&&ye.reverse(),Q&&F<Re&&(ye.length=F),this&&this!==Qe&&this instanceof ge&&(on=Ee||Yr(on)),on.apply($t,ye)}return ge}function El(e,t){return function(n,r){return Kc(n,e,t(r),{})}}function Mi(e,t){return function(n,r){var f;if(n===o&&r===o)return t;if(n!==o&&(f=n),r!==o){if(f===o)return r;typeof n=="string"||typeof r=="string"?(n=bt(n),r=bt(r)):(n=ul(n),r=ul(r)),f=e(n,r)}return f}}function gu(e){return en(function(t){return t=$e(t,Et(he())),be(function(n){var r=this;return e(t,function(f){return At(f,r,n)})})})}function Ui(e,t){t=t===o?" ":bt(t);var n=t.length;if(n<2)return n?su(t,e):t;var r=su(t,Ci(e/ur(t)));return or(t)?bn(Ut(r),0,e).join(""):r.slice(0,e)}function Ah(e,t,n,r){var f=t&M,m=Yr(e);function _(){for(var N=-1,F=arguments.length,J=-1,Q=r.length,ee=q(Q+F),ue=this&&this!==Qe&&this instanceof _?m:e;++J<Q;)ee[J]=r[J];for(;F--;)ee[J++]=arguments[++N];return At(ue,f?n:this,ee)}return _}function bl(e){return function(t,n,r){return r&&typeof r!="number"&&it(t,n,r)&&(n=r=o),t=rn(t),n===o?(n=t,t=0):n=rn(n),r=r===o?t<n?1:-1:rn(r),oh(t,n,r,e)}}function ki(e){return function(t,n){return typeof t=="string"&&typeof n=="string"||(t=Ft(t),n=Ft(n)),e(t,n)}}function Rl(e,t,n,r,f,m,_,N,F,J){var Q=t&w,ee=Q?_:o,ue=Q?o:_,ae=Q?m:o,de=Q?o:m;t|=Q?D:A,t&=~(Q?A:D),t&S||(t&=~(M|b));var Ee=[e,t,f,ae,ee,de,ue,N,F,J],ge=n.apply(o,Ee);return bu(e)&&Fl(ge,Ee),ge.placeholder=r,Dl(ge,e,t)}function mu(e){var t=Ve[e];return function(n,r){if(n=Ft(n),r=r==null?0:et(Ae(r),292),r&&Ds(n)){var f=(We(n)+"e").split("e"),m=t(f[0]+"e"+(+f[1]+r));return f=(We(m)+"e").split("e"),+(f[0]+"e"+(+f[1]-r))}return t(n)}}var Eh=ar&&1/gi(new ar([,-0]))[1]==me?function(e){return new ar(e)}:Mu;function Cl(e){return function(t){var n=tt(t);return n==wt?Zo(t):n==_t?Uf(t):Sf(t,e(t))}}function jt(e,t,n,r,f,m,_,N){var F=t&b;if(!F&&typeof e!="function")throw new St(k);var J=r?r.length:0;if(J||(t&=~(D|A),r=f=o),_=_===o?_:Ye(Ae(_),0),N=N===o?N:Ae(N),J-=f?f.length:0,t&A){var Q=r,ee=f;r=f=o}var ue=F?o:_u(e),ae=[e,t,n,r,f,Q,ee,m,_,N];if(ue&&Dh(ae,ue),e=ae[0],t=ae[1],n=ae[2],r=ae[3],f=ae[4],N=ae[9]=ae[9]===o?F?0:e.length:Ye(ae[9]-J,0),!N&&t&(w|R)&&(t&=~(w|R)),!t||t==M)var de=_h(e,t,n);else t==w||t==R?de=vh(e,t,N):(t==D||t==(M|D))&&!f.length?de=Ah(e,t,n,r):de=Di.apply(o,ae);var Ee=ue?il:Fl;return Dl(Ee(de,ae),e,t)}function Tl(e,t,n,r){return e===o||Ht(e,lr[n])&&!Fe.call(r,n)?t:e}function Nl(e,t,n,r,f,m){return Be(e)&&Be(t)&&(m.set(t,e),Pi(e,t,o,Nl,m),m.delete(t)),e}function bh(e){return Qr(e)?o:e}function yl(e,t,n,r,f,m){var _=n&ne,N=e.length,F=t.length;if(N!=F&&!(_&&F>N))return!1;var J=m.get(e),Q=m.get(t);if(J&&Q)return J==t&&Q==e;var ee=-1,ue=!0,ae=n&oe?new Hn:o;for(m.set(e,t),m.set(t,e);++ee<N;){var de=e[ee],Ee=t[ee];if(r)var ge=_?r(Ee,de,ee,t,e,m):r(de,Ee,ee,e,t,m);if(ge!==o){if(ge)continue;ue=!1;break}if(ae){if(!ko(t,function(Re,ye){if(!Ur(ae,ye)&&(de===Re||f(de,Re,n,r,m)))return ae.push(ye)})){ue=!1;break}}else if(!(de===Ee||f(de,Ee,n,r,m))){ue=!1;break}}return m.delete(e),m.delete(t),ue}function Rh(e,t,n,r,f,m,_){switch(n){case hn:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Wn:return!(e.byteLength!=t.byteLength||!m(new Ai(e),new Ai(t)));case ln:case an:case Sn:return Ht(+e,+t);case pt:return e.name==t.name&&e.message==t.message;case cn:case xn:return e==t+"";case wt:var N=Zo;case _t:var F=r≠if(N||(N=gi),e.size!=t.size&&!F)return!1;var J=_.get(e);if(J)return J==t;r|=oe,_.set(e,t);var Q=yl(N(e),N(t),r,f,m,_);return _.delete(e),Q;case Qn:if(qr)return qr.call(e)==qr.call(t)}return!1}function Ch(e,t,n,r,f,m){var _=n&ne,N=pu(e),F=N.length,J=pu(t),Q=J.length;if(F!=Q&&!_)return!1;for(var ee=F;ee--;){var ue=N[ee];if(!(_?ue in t:Fe.call(t,ue)))return!1}var ae=m.get(e),de=m.get(t);if(ae&&de)return ae==t&&de==e;var Ee=!0;m.set(e,t),m.set(t,e);for(var ge=_;++ee<F;){ue=N[ee];var Re=e[ue],ye=t[ue];if(r)var Ct=_?r(ye,Re,ue,t,e,m):r(Re,ye,ue,e,t,m);if(!(Ct===o?Re===ye||f(Re,ye,n,r,m):Ct)){Ee=!1;break}ge||(ge=ue=="constructor")}if(Ee&&!ge){var ot=e.constructor,Tt=t.constructor;ot!=Tt&&"constructor"in e&&"constructor"in t&&!(typeof ot=="function"&&ot instanceof ot&&typeof Tt=="function"&&Tt instanceof Tt)&&(Ee=!1)}return m.delete(e),m.delete(t),Ee}function en(e){return Cu(Wl(e,o,Bl),e+"")}function pu(e){return Ks(e,Je,Au)}function wu(e){return Ks(e,ct,Ll)}var _u=Ni?function(e){return Ni.get(e)}:Mu;function Hi(e){for(var t=e.name+"",n=fr[t],r=Fe.call(fr,t)?n.length:0;r--;){var f=n[r],m=f.func;if(m==null||m==e)return f.name}return t}function gr(e){var t=Fe.call(g,"placeholder")?g:e;return t.placeholder}function he(){var e=g.iteratee||Fu;return e=e===Fu?Js:e,arguments.length?e(arguments[0],arguments[1]):e}function $i(e,t){var n=e.__data__;return Ph(t)?n[typeof t=="string"?"string":"hash"]:n.map}function vu(e){for(var t=Je(e),n=t.length;n--;){var r=t[n],f=e[r];t[n]=[r,f,xl(f)]}return t}function qn(e,t){var n=Ff(e,t);return Ys(n)?n:o}function Th(e){var t=Fe.call(e,Un),n=e[Un];try{e[Un]=o;var r=!0}catch{}var f=_i.call(e);return r&&(t?e[Un]=n:delete e[Un]),f}var Au=Ko?function(e){return e==null?[]:(e=Me(e),mn(Ko(e),function(t){return Is.call(e,t)}))}:Uu,Ll=Ko?function(e){for(var t=[];e;)pn(t,Au(e)),e=Ei(e);return t}:Uu,tt=rt;(Vo&&tt(new Vo(new ArrayBuffer(1)))!=hn||Hr&&tt(new Hr)!=wt||Yo&&tt(Yo.resolve())!=Tr||ar&&tt(new ar)!=_t||$r&&tt(new $r)!=Pn)&&(tt=function(e){var t=rt(e),n=t==st?e.constructor:o,r=n?Gn(n):"";if(r)switch(r){case sc:return hn;case lc:return wt;case ac:return Tr;case fc:return _t;case cc:return Pn}return t});function Nh(e,t,n){for(var r=-1,f=n.length;++r<f;){var m=n[r],_=m.size;switch(m.type){case"drop":e+=_;break;case"dropRight":t-=_;break;case"take":t=et(t,e+_);break;case"takeRight":e=Ye(e,t-_);break}}return{start:e,end:t}}function yh(e){var t=e.match(No);return t?t[1].split(yo):[]}function Ol(e,t,n){t=En(t,e);for(var r=-1,f=t.length,m=!1;++r<f;){var _=zt(t[r]);if(!(m=e!=null&&n(e,_)))break;e=e[_]}return m||++r!=f?m:(f=e==null?0:e.length,!!f&&Vi(f)&&tn(_,f)&&(_e(e)||Zn(e)))}function Lh(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&Fe.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function Sl(e){return typeof e.constructor=="function"&&!Jr(e)?cr(Ei(e)):{}}function Oh(e,t,n){var r=e.constructor;switch(t){case Wn:return du(e);case ln:case an:return new r(+e);case hn:return hh(e,n);case yr:case Lr:case Or:case Sr:case xr:case Pr:case Wr:case jn:case Ir:return hl(e,n);case wt:return new r;case Sn:case xn:return new r(e);case cn:return dh(e);case _t:return new r;case Qn:return gh(e)}}function Sh(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(To,`{
/* [wrapped with `+t+`] */
`)}function xh(e){return _e(e)||Zn(e)||!!(Fs&&e&&e[Fs])}function tn(e,t){var n=typeof e;return t=t??Ce,!!t&&(n=="number"||n!="symbol"&&h.test(e))&&e>-1&&e%1==0&&e<t}function it(e,t,n){if(!Be(n))return!1;var r=typeof t;return(r=="number"?ft(n)&&tn(t,n.length):r=="string"&&t in n)?Ht(n[t],e):!1}function Eu(e,t){if(_e(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Rt(e)?!0:Eo.test(e)||!Ao.test(e)||t!=null&&e in Me(t)}function Ph(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function bu(e){var t=Hi(e),n=g[t];if(typeof n!="function"||!(t in Ne.prototype))return!1;if(e===n)return!0;var r=_u(n);return!!r&&e===r[0]}function Wh(e){return!!xs&&xs in e}var Ih=pi?nn:ku;function Jr(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||lr;return e===n}function xl(e){return e===e&&!Be(e)}function Pl(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==o||e in Me(n))}}function Fh(e){var t=zi(e,function(r){return n.size===Z&&n.clear(),r}),n=t.cache;return t}function Dh(e,t){var n=e[1],r=t[1],f=n|r,m=f<(M|b|E),_=r==E&&n==w||r==E&&n==O&&e[7].length<=t[8]||r==(E|O)&&t[7].length<=t[8]&&n==w;if(!(m||_))return e;r&M&&(e[2]=t[2],f|=n&M?0:S);var N=t[3];if(N){var F=e[3];e[3]=F?gl(F,N,t[4]):N,e[4]=F?wn(e[3],$):t[4]}return N=t[5],N&&(F=e[5],e[5]=F?ml(F,N,t[6]):N,e[6]=F?wn(e[5],$):t[6]),N=t[7],N&&(e[7]=N),r&E&&(e[8]=e[8]==null?t[8]:et(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=f,e}function Mh(e){var t=[];if(e!=null)for(var n in Me(e))t.push(n);return t}function Uh(e){return _i.call(e)}function Wl(e,t,n){return t=Ye(t===o?e.length-1:t,0),function(){for(var r=arguments,f=-1,m=Ye(r.length-t,0),_=q(m);++f<m;)_[f]=r[t+f];f=-1;for(var N=q(t+1);++f<t;)N[f]=r[f];return N[t]=n(_),At(e,this,N)}}function Il(e,t){return t.length<2?e:Bn(e,Wt(t,0,-1))}function kh(e,t){for(var n=e.length,r=et(t.length,n),f=at(e);r--;){var m=t[r];e[r]=tn(m,n)?f[m]:o}return e}function Ru(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var Fl=Ml(il),Xr=ec||function(e,t){return Qe.setTimeout(e,t)},Cu=Ml(lh);function Dl(e,t,n){var r=t+"";return Cu(e,Sh(r,Hh(yh(r),n)))}function Ml(e){var t=0,n=0;return function(){var r=ic(),f=I-(r-n);if(n=r,f>0){if(++t>=re)return arguments[0]}else t=0;return e.apply(o,arguments)}}function Bi(e,t){var n=-1,r=e.length,f=r-1;for(t=t===o?r:t;++n<t;){var m=uu(n,f),_=e[m];e[m]=e[n],e[n]=_}return e.length=t,e}var Ul=Fh(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(bo,function(n,r,f,m){t.push(f?m.replace(So,"$1"):r||n)}),t});function zt(e){if(typeof e=="string"||Rt(e))return e;var t=e+"";return t=="0"&&1/e==-me?"-0":t}function Gn(e){if(e!=null){try{return wi.call(e)}catch{}try{return e+""}catch{}}return""}function Hh(e,t){return Ot(gt,function(n){var r="_."+n[0];t&n[1]&&!hi(e,r)&&e.push(r)}),e.sort()}function kl(e){if(e instanceof Ne)return e.clone();var t=new xt(e.__wrapped__,e.__chain__);return t.__actions__=at(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function $h(e,t,n){(n?it(e,t,n):t===o)?t=1:t=Ye(Ae(t),0);var r=e==null?0:e.length;if(!r||t<1)return[];for(var f=0,m=0,_=q(Ci(r/t));f<r;)_[m++]=Wt(e,f,f+=t);return _}function Bh(e){for(var t=-1,n=e==null?0:e.length,r=0,f=[];++t<n;){var m=e[t];m&&(f[r++]=m)}return f}function qh(){var e=arguments.length;if(!e)return[];for(var t=q(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return pn(_e(n)?at(n):[n],je(t,1))}var Gh=be(function(e,t){return Ge(e)?Zr(e,je(t,1,Ge,!0)):[]}),Zh=be(function(e,t){var n=It(t);return Ge(n)&&(n=o),Ge(e)?Zr(e,je(t,1,Ge,!0),he(n,2)):[]}),zh=be(function(e,t){var n=It(t);return Ge(n)&&(n=o),Ge(e)?Zr(e,je(t,1,Ge,!0),o,n):[]});function Kh(e,t,n){var r=e==null?0:e.length;return r?(t=n||t===o?1:Ae(t),Wt(e,t<0?0:t,r)):[]}function Vh(e,t,n){var r=e==null?0:e.length;return r?(t=n||t===o?1:Ae(t),t=r-t,Wt(e,0,t<0?0:t)):[]}function Yh(e,t){return e&&e.length?Ii(e,he(t,3),!0,!0):[]}function Jh(e,t){return e&&e.length?Ii(e,he(t,3),!0):[]}function Xh(e,t,n,r){var f=e==null?0:e.length;return f?(n&&typeof n!="number"&&it(e,t,n)&&(n=0,r=f),qc(e,t,n,r)):[]}function Hl(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var f=n==null?0:Ae(n);return f<0&&(f=Ye(r+f,0)),di(e,he(t,3),f)}function $l(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var f=r-1;return n!==o&&(f=Ae(n),f=n<0?Ye(r+f,0):et(f,r-1)),di(e,he(t,3),f,!0)}function Bl(e){var t=e==null?0:e.length;return t?je(e,1):[]}function Qh(e){var t=e==null?0:e.length;return t?je(e,me):[]}function jh(e,t){var n=e==null?0:e.length;return n?(t=t===o?1:Ae(t),je(e,t)):[]}function e0(e){for(var t=-1,n=e==null?0:e.length,r={};++t<n;){var f=e[t];r[f[0]]=f[1]}return r}function ql(e){return e&&e.length?e[0]:o}function t0(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var f=n==null?0:Ae(n);return f<0&&(f=Ye(r+f,0)),ir(e,t,f)}function n0(e){var t=e==null?0:e.length;return t?Wt(e,0,-1):[]}var r0=be(function(e){var t=$e(e,cu);return t.length&&t[0]===e[0]?tu(t):[]}),i0=be(function(e){var t=It(e),n=$e(e,cu);return t===It(n)?t=o:n.pop(),n.length&&n[0]===e[0]?tu(n,he(t,2)):[]}),o0=be(function(e){var t=It(e),n=$e(e,cu);return t=typeof t=="function"?t:o,t&&n.pop(),n.length&&n[0]===e[0]?tu(n,o,t):[]});function u0(e,t){return e==null?"":nc.call(e,t)}function It(e){var t=e==null?0:e.length;return t?e[t-1]:o}function s0(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var f=r;return n!==o&&(f=Ae(n),f=f<0?Ye(r+f,0):et(f,r-1)),t===t?Hf(e,t,f):di(e,Rs,f,!0)}function l0(e,t){return e&&e.length?el(e,Ae(t)):o}var a0=be(Gl);function Gl(e,t){return e&&e.length&&t&&t.length?ou(e,t):e}function f0(e,t,n){return e&&e.length&&t&&t.length?ou(e,t,he(n,2)):e}function c0(e,t,n){return e&&e.length&&t&&t.length?ou(e,t,o,n):e}var h0=en(function(e,t){var n=e==null?0:e.length,r=Xo(e,t);return rl(e,$e(t,function(f){return tn(f,n)?+f:f}).sort(dl)),r});function d0(e,t){var n=[];if(!(e&&e.length))return n;var r=-1,f=[],m=e.length;for(t=he(t,3);++r<m;){var _=e[r];t(_,r,e)&&(n.push(_),f.push(r))}return rl(e,f),n}function Tu(e){return e==null?e:uc.call(e)}function g0(e,t,n){var r=e==null?0:e.length;return r?(n&&typeof n!="number"&&it(e,t,n)?(t=0,n=r):(t=t==null?0:Ae(t),n=n===o?r:Ae(n)),Wt(e,t,n)):[]}function m0(e,t){return Wi(e,t)}function p0(e,t,n){return lu(e,t,he(n,2))}function w0(e,t){var n=e==null?0:e.length;if(n){var r=Wi(e,t);if(r<n&&Ht(e[r],t))return r}return-1}function _0(e,t){return Wi(e,t,!0)}function v0(e,t,n){return lu(e,t,he(n,2),!0)}function A0(e,t){var n=e==null?0:e.length;if(n){var r=Wi(e,t,!0)-1;if(Ht(e[r],t))return r}return-1}function E0(e){return e&&e.length?ol(e):[]}function b0(e,t){return e&&e.length?ol(e,he(t,2)):[]}function R0(e){var t=e==null?0:e.length;return t?Wt(e,1,t):[]}function C0(e,t,n){return e&&e.length?(t=n||t===o?1:Ae(t),Wt(e,0,t<0?0:t)):[]}function T0(e,t,n){var r=e==null?0:e.length;return r?(t=n||t===o?1:Ae(t),t=r-t,Wt(e,t<0?0:t,r)):[]}function N0(e,t){return e&&e.length?Ii(e,he(t,3),!1,!0):[]}function y0(e,t){return e&&e.length?Ii(e,he(t,3)):[]}var L0=be(function(e){return An(je(e,1,Ge,!0))}),O0=be(function(e){var t=It(e);return Ge(t)&&(t=o),An(je(e,1,Ge,!0),he(t,2))}),S0=be(function(e){var t=It(e);return t=typeof t=="function"?t:o,An(je(e,1,Ge,!0),o,t)});function x0(e){return e&&e.length?An(e):[]}function P0(e,t){return e&&e.length?An(e,he(t,2)):[]}function W0(e,t){return t=typeof t=="function"?t:o,e&&e.length?An(e,o,t):[]}function Nu(e){if(!(e&&e.length))return[];var t=0;return e=mn(e,function(n){if(Ge(n))return t=Ye(n.length,t),!0}),qo(t,function(n){return $e(e,Ho(n))})}function Zl(e,t){if(!(e&&e.length))return[];var n=Nu(e);return t==null?n:$e(n,function(r){return At(t,o,r)})}var I0=be(function(e,t){return Ge(e)?Zr(e,t):[]}),F0=be(function(e){return fu(mn(e,Ge))}),D0=be(function(e){var t=It(e);return Ge(t)&&(t=o),fu(mn(e,Ge),he(t,2))}),M0=be(function(e){var t=It(e);return t=typeof t=="function"?t:o,fu(mn(e,Ge),o,t)}),U0=be(Nu);function k0(e,t){return al(e||[],t||[],Gr)}function H0(e,t){return al(e||[],t||[],Vr)}var $0=be(function(e){var t=e.length,n=t>1?e[t-1]:o;return n=typeof n=="function"?(e.pop(),n):o,Zl(e,n)});function zl(e){var t=g(e);return t.__chain__=!0,t}function B0(e,t){return t(e),e}function qi(e,t){return t(e)}var q0=en(function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,f=function(m){return Xo(m,e)};return t>1||this.__actions__.length||!(r instanceof Ne)||!tn(n)?this.thru(f):(r=r.slice(n,+n+(t?1:0)),r.__actions__.push({func:qi,args:[f],thisArg:o}),new xt(r,this.__chain__).thru(function(m){return t&&!m.length&&m.push(o),m}))});function G0(){return zl(this)}function Z0(){return new xt(this.value(),this.__chain__)}function z0(){this.__values__===o&&(this.__values__=ua(this.value()));var e=this.__index__>=this.__values__.length,t=e?o:this.__values__[this.__index__++];return{done:e,value:t}}function K0(){return this}function V0(e){for(var t,n=this;n instanceof Li;){var r=kl(n);r.__index__=0,r.__values__=o,t?f.__wrapped__=r:t=r;var f=r;n=n.__wrapped__}return f.__wrapped__=e,t}function Y0(){var e=this.__wrapped__;if(e instanceof Ne){var t=e;return this.__actions__.length&&(t=new Ne(this)),t=t.reverse(),t.__actions__.push({func:qi,args:[Tu],thisArg:o}),new xt(t,this.__chain__)}return this.thru(Tu)}function J0(){return ll(this.__wrapped__,this.__actions__)}var X0=Fi(function(e,t,n){Fe.call(e,n)?++e[n]:Qt(e,n,1)});function Q0(e,t,n){var r=_e(e)?Es:Bc;return n&&it(e,t,n)&&(t=o),r(e,he(t,3))}function j0(e,t){var n=_e(e)?mn:Zs;return n(e,he(t,3))}var e1=vl(Hl),t1=vl($l);function n1(e,t){return je(Gi(e,t),1)}function r1(e,t){return je(Gi(e,t),me)}function i1(e,t,n){return n=n===o?1:Ae(n),je(Gi(e,t),n)}function Kl(e,t){var n=_e(e)?Ot:vn;return n(e,he(t,3))}function Vl(e,t){var n=_e(e)?Rf:Gs;return n(e,he(t,3))}var o1=Fi(function(e,t,n){Fe.call(e,n)?e[n].push(t):Qt(e,n,[t])});function u1(e,t,n,r){e=ft(e)?e:pr(e),n=n&&!r?Ae(n):0;var f=e.length;return n<0&&(n=Ye(f+n,0)),Yi(e)?n<=f&&e.indexOf(t,n)>-1:!!f&&ir(e,t,n)>-1}var s1=be(function(e,t,n){var r=-1,f=typeof t=="function",m=ft(e)?q(e.length):[];return vn(e,function(_){m[++r]=f?At(t,_,n):zr(_,t,n)}),m}),l1=Fi(function(e,t,n){Qt(e,n,t)});function Gi(e,t){var n=_e(e)?$e:Xs;return n(e,he(t,3))}function a1(e,t,n,r){return e==null?[]:(_e(t)||(t=t==null?[]:[t]),n=r?o:n,_e(n)||(n=n==null?[]:[n]),tl(e,t,n))}var f1=Fi(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});function c1(e,t,n){var r=_e(e)?Uo:Ts,f=arguments.length<3;return r(e,he(t,4),n,f,vn)}function h1(e,t,n){var r=_e(e)?Cf:Ts,f=arguments.length<3;return r(e,he(t,4),n,f,Gs)}function d1(e,t){var n=_e(e)?mn:Zs;return n(e,Ki(he(t,3)))}function g1(e){var t=_e(e)?Hs:uh;return t(e)}function m1(e,t,n){(n?it(e,t,n):t===o)?t=1:t=Ae(t);var r=_e(e)?Mc:sh;return r(e,t)}function p1(e){var t=_e(e)?Uc:ah;return t(e)}function w1(e){if(e==null)return 0;if(ft(e))return Yi(e)?ur(e):e.length;var t=tt(e);return t==wt||t==_t?e.size:ru(e).length}function _1(e,t,n){var r=_e(e)?ko:fh;return n&&it(e,t,n)&&(t=o),r(e,he(t,3))}var v1=be(function(e,t){if(e==null)return[];var n=t.length;return n>1&&it(e,t[0],t[1])?t=[]:n>2&&it(t[0],t[1],t[2])&&(t=[t[0]]),tl(e,je(t,1),[])}),Zi=jf||function(){return Qe.Date.now()};function A1(e,t){if(typeof t!="function")throw new St(k);return e=Ae(e),function(){if(--e<1)return t.apply(this,arguments)}}function Yl(e,t,n){return t=n?o:t,t=e&&t==null?e.length:t,jt(e,E,o,o,o,o,t)}function Jl(e,t){var n;if(typeof t!="function")throw new St(k);return e=Ae(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=o),n}}var yu=be(function(e,t,n){var r=M;if(n.length){var f=wn(n,gr(yu));r|=D}return jt(e,r,t,n,f)}),Xl=be(function(e,t,n){var r=M|b;if(n.length){var f=wn(n,gr(Xl));r|=D}return jt(t,r,e,n,f)});function Ql(e,t,n){t=n?o:t;var r=jt(e,w,o,o,o,o,o,t);return r.placeholder=Ql.placeholder,r}function jl(e,t,n){t=n?o:t;var r=jt(e,R,o,o,o,o,o,t);return r.placeholder=jl.placeholder,r}function ea(e,t,n){var r,f,m,_,N,F,J=0,Q=!1,ee=!1,ue=!0;if(typeof e!="function")throw new St(k);t=Ft(t)||0,Be(n)&&(Q=!!n.leading,ee="maxWait"in n,m=ee?Ye(Ft(n.maxWait)||0,t):m,ue="trailing"in n?!!n.trailing:ue);function ae(Ze){var $t=r,on=f;return r=f=o,J=Ze,_=e.apply(on,$t),_}function de(Ze){return J=Ze,N=Xr(Re,t),Q?ae(Ze):_}function Ee(Ze){var $t=Ze-F,on=Ze-J,va=t-$t;return ee?et(va,m-on):va}function ge(Ze){var $t=Ze-F,on=Ze-J;return F===o||$t>=t||$t<0||ee&&on>=m}function Re(){var Ze=Zi();if(ge(Ze))return ye(Ze);N=Xr(Re,Ee(Ze))}function ye(Ze){return N=o,ue&&r?ae(Ze):(r=f=o,_)}function Ct(){N!==o&&fl(N),J=0,r=F=f=N=o}function ot(){return N===o?_:ye(Zi())}function Tt(){var Ze=Zi(),$t=ge(Ze);if(r=arguments,f=this,F=Ze,$t){if(N===o)return de(F);if(ee)return fl(N),N=Xr(Re,t),ae(F)}return N===o&&(N=Xr(Re,t)),_}return Tt.cancel=Ct,Tt.flush=ot,Tt}var E1=be(function(e,t){return qs(e,1,t)}),b1=be(function(e,t,n){return qs(e,Ft(t)||0,n)});function R1(e){return jt(e,y)}function zi(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new St(k);var n=function(){var r=arguments,f=t?t.apply(this,r):r[0],m=n.cache;if(m.has(f))return m.get(f);var _=e.apply(this,r);return n.cache=m.set(f,_)||m,_};return n.cache=new(zi.Cache||Xt),n}zi.Cache=Xt;function Ki(e){if(typeof e!="function")throw new St(k);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function C1(e){return Jl(2,e)}var T1=ch(function(e,t){t=t.length==1&&_e(t[0])?$e(t[0],Et(he())):$e(je(t,1),Et(he()));var n=t.length;return be(function(r){for(var f=-1,m=et(r.length,n);++f<m;)r[f]=t[f].call(this,r[f]);return At(e,this,r)})}),Lu=be(function(e,t){var n=wn(t,gr(Lu));return jt(e,D,o,t,n)}),ta=be(function(e,t){var n=wn(t,gr(ta));return jt(e,A,o,t,n)}),N1=en(function(e,t){return jt(e,O,o,o,o,t)});function y1(e,t){if(typeof e!="function")throw new St(k);return t=t===o?t:Ae(t),be(e,t)}function L1(e,t){if(typeof e!="function")throw new St(k);return t=t==null?0:Ye(Ae(t),0),be(function(n){var r=n[t],f=bn(n,0,t);return r&&pn(f,r),At(e,this,f)})}function O1(e,t,n){var r=!0,f=!0;if(typeof e!="function")throw new St(k);return Be(n)&&(r="leading"in n?!!n.leading:r,f="trailing"in n?!!n.trailing:f),ea(e,t,{leading:r,maxWait:t,trailing:f})}function S1(e){return Yl(e,1)}function x1(e,t){return Lu(hu(t),e)}function P1(){if(!arguments.length)return[];var e=arguments[0];return _e(e)?e:[e]}function W1(e){return Pt(e,Y)}function I1(e,t){return t=typeof t=="function"?t:o,Pt(e,Y,t)}function F1(e){return Pt(e,G|Y)}function D1(e,t){return t=typeof t=="function"?t:o,Pt(e,G|Y,t)}function M1(e,t){return t==null||Bs(e,t,Je(t))}function Ht(e,t){return e===t||e!==e&&t!==t}var U1=ki(eu),k1=ki(function(e,t){return e>=t}),Zn=Vs(function(){return arguments}())?Vs:function(e){return qe(e)&&Fe.call(e,"callee")&&!Is.call(e,"callee")},_e=q.isArray,H1=ms?Et(ms):Vc;function ft(e){return e!=null&&Vi(e.length)&&!nn(e)}function Ge(e){return qe(e)&&ft(e)}function $1(e){return e===!0||e===!1||qe(e)&&rt(e)==ln}var Rn=tc||ku,B1=ps?Et(ps):Yc;function q1(e){return qe(e)&&e.nodeType===1&&!Qr(e)}function G1(e){if(e==null)return!0;if(ft(e)&&(_e(e)||typeof e=="string"||typeof e.splice=="function"||Rn(e)||mr(e)||Zn(e)))return!e.length;var t=tt(e);if(t==wt||t==_t)return!e.size;if(Jr(e))return!ru(e).length;for(var n in e)if(Fe.call(e,n))return!1;return!0}function Z1(e,t){return Kr(e,t)}function z1(e,t,n){n=typeof n=="function"?n:o;var r=n?n(e,t):o;return r===o?Kr(e,t,o,n):!!r}function Ou(e){if(!qe(e))return!1;var t=rt(e);return t==pt||t==Cr||typeof e.message=="string"&&typeof e.name=="string"&&!Qr(e)}function K1(e){return typeof e=="number"&&Ds(e)}function nn(e){if(!Be(e))return!1;var t=rt(e);return t==On||t==Xn||t==ai||t==Nr}function na(e){return typeof e=="number"&&e==Ae(e)}function Vi(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Ce}function Be(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function qe(e){return e!=null&&typeof e=="object"}var ra=ws?Et(ws):Xc;function V1(e,t){return e===t||nu(e,t,vu(t))}function Y1(e,t,n){return n=typeof n=="function"?n:o,nu(e,t,vu(t),n)}function J1(e){return ia(e)&&e!=+e}function X1(e){if(Ih(e))throw new we(x);return Ys(e)}function Q1(e){return e===null}function j1(e){return e==null}function ia(e){return typeof e=="number"||qe(e)&&rt(e)==Sn}function Qr(e){if(!qe(e)||rt(e)!=st)return!1;var t=Ei(e);if(t===null)return!0;var n=Fe.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&wi.call(n)==Yf}var Su=_s?Et(_s):Qc;function ed(e){return na(e)&&e>=-Ce&&e<=Ce}var oa=vs?Et(vs):jc;function Yi(e){return typeof e=="string"||!_e(e)&&qe(e)&&rt(e)==xn}function Rt(e){return typeof e=="symbol"||qe(e)&&rt(e)==Qn}var mr=As?Et(As):eh;function td(e){return e===o}function nd(e){return qe(e)&&tt(e)==Pn}function rd(e){return qe(e)&&rt(e)==co}var id=ki(iu),od=ki(function(e,t){return e<=t});function ua(e){if(!e)return[];if(ft(e))return Yi(e)?Ut(e):at(e);if(kr&&e[kr])return Mf(e[kr]());var t=tt(e),n=t==wt?Zo:t==_t?gi:pr;return n(e)}function rn(e){if(!e)return e===0?e:0;if(e=Ft(e),e===me||e===-me){var t=e<0?-1:1;return t*ve}return e===e?e:0}function Ae(e){var t=rn(e),n=t%1;return t===t?n?t-n:t:0}function sa(e){return e?$n(Ae(e),0,Se):0}function Ft(e){if(typeof e=="number")return e;if(Rt(e))return ie;if(Be(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Be(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Ns(e);var n=s.test(e);return n||c.test(e)?Af(e.slice(2),n?2:8):u.test(e)?ie:+e}function la(e){return Zt(e,ct(e))}function ud(e){return e?$n(Ae(e),-Ce,Ce):e===0?e:0}function We(e){return e==null?"":bt(e)}var sd=hr(function(e,t){if(Jr(t)||ft(t)){Zt(t,Je(t),e);return}for(var n in t)Fe.call(t,n)&&Gr(e,n,t[n])}),aa=hr(function(e,t){Zt(t,ct(t),e)}),Ji=hr(function(e,t,n,r){Zt(t,ct(t),e,r)}),ld=hr(function(e,t,n,r){Zt(t,Je(t),e,r)}),ad=en(Xo);function fd(e,t){var n=cr(e);return t==null?n:$s(n,t)}var cd=be(function(e,t){e=Me(e);var n=-1,r=t.length,f=r>2?t[2]:o;for(f&&it(t[0],t[1],f)&&(r=1);++n<r;)for(var m=t[n],_=ct(m),N=-1,F=_.length;++N<F;){var J=_[N],Q=e[J];(Q===o||Ht(Q,lr[J])&&!Fe.call(e,J))&&(e[J]=m[J])}return e}),hd=be(function(e){return e.push(o,Nl),At(fa,o,e)});function dd(e,t){return bs(e,he(t,3),Gt)}function gd(e,t){return bs(e,he(t,3),jo)}function md(e,t){return e==null?e:Qo(e,he(t,3),ct)}function pd(e,t){return e==null?e:zs(e,he(t,3),ct)}function wd(e,t){return e&&Gt(e,he(t,3))}function _d(e,t){return e&&jo(e,he(t,3))}function vd(e){return e==null?[]:xi(e,Je(e))}function Ad(e){return e==null?[]:xi(e,ct(e))}function xu(e,t,n){var r=e==null?o:Bn(e,t);return r===o?n:r}function Ed(e,t){return e!=null&&Ol(e,t,Gc)}function Pu(e,t){return e!=null&&Ol(e,t,Zc)}var bd=El(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=_i.call(t)),e[t]=n},Iu(ht)),Rd=El(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=_i.call(t)),Fe.call(e,t)?e[t].push(n):e[t]=[n]},he),Cd=be(zr);function Je(e){return ft(e)?ks(e):ru(e)}function ct(e){return ft(e)?ks(e,!0):th(e)}function Td(e,t){var n={};return t=he(t,3),Gt(e,function(r,f,m){Qt(n,t(r,f,m),r)}),n}function Nd(e,t){var n={};return t=he(t,3),Gt(e,function(r,f,m){Qt(n,f,t(r,f,m))}),n}var yd=hr(function(e,t,n){Pi(e,t,n)}),fa=hr(function(e,t,n,r){Pi(e,t,n,r)}),Ld=en(function(e,t){var n={};if(e==null)return n;var r=!1;t=$e(t,function(m){return m=En(m,e),r||(r=m.length>1),m}),Zt(e,wu(e),n),r&&(n=Pt(n,G|U|Y,bh));for(var f=t.length;f--;)au(n,t[f]);return n});function Od(e,t){return ca(e,Ki(he(t)))}var Sd=en(function(e,t){return e==null?{}:rh(e,t)});function ca(e,t){if(e==null)return{};var n=$e(wu(e),function(r){return[r]});return t=he(t),nl(e,n,function(r,f){return t(r,f[0])})}function xd(e,t,n){t=En(t,e);var r=-1,f=t.length;for(f||(f=1,e=o);++r<f;){var m=e==null?o:e[zt(t[r])];m===o&&(r=f,m=n),e=nn(m)?m.call(e):m}return e}function Pd(e,t,n){return e==null?e:Vr(e,t,n)}function Wd(e,t,n,r){return r=typeof r=="function"?r:o,e==null?e:Vr(e,t,n,r)}var ha=Cl(Je),da=Cl(ct);function Id(e,t,n){var r=_e(e),f=r||Rn(e)||mr(e);if(t=he(t,4),n==null){var m=e&&e.constructor;f?n=r?new m:[]:Be(e)?n=nn(m)?cr(Ei(e)):{}:n={}}return(f?Ot:Gt)(e,function(_,N,F){return t(n,_,N,F)}),n}function Fd(e,t){return e==null?!0:au(e,t)}function Dd(e,t,n){return e==null?e:sl(e,t,hu(n))}function Md(e,t,n,r){return r=typeof r=="function"?r:o,e==null?e:sl(e,t,hu(n),r)}function pr(e){return e==null?[]:Go(e,Je(e))}function Ud(e){return e==null?[]:Go(e,ct(e))}function kd(e,t,n){return n===o&&(n=t,t=o),n!==o&&(n=Ft(n),n=n===n?n:0),t!==o&&(t=Ft(t),t=t===t?t:0),$n(Ft(e),t,n)}function Hd(e,t,n){return t=rn(t),n===o?(n=t,t=0):n=rn(n),e=Ft(e),zc(e,t,n)}function $d(e,t,n){if(n&&typeof n!="boolean"&&it(e,t,n)&&(t=n=o),n===o&&(typeof t=="boolean"?(n=t,t=o):typeof e=="boolean"&&(n=e,e=o)),e===o&&t===o?(e=0,t=1):(e=rn(e),t===o?(t=e,e=0):t=rn(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var f=Ms();return et(e+f*(t-e+vf("1e-"+((f+"").length-1))),t)}return uu(e,t)}var Bd=dr(function(e,t,n){return t=t.toLowerCase(),e+(n?ga(t):t)});function ga(e){return Wu(We(e).toLowerCase())}function ma(e){return e=We(e),e&&e.replace(v,Pf).replace(af,"")}function qd(e,t,n){e=We(e),t=bt(t);var r=e.length;n=n===o?r:$n(Ae(n),0,r);var f=n;return n-=t.length,n>=0&&e.slice(n,f)==t}function Gd(e){return e=We(e),e&&wo.test(e)?e.replace(fi,Wf):e}function Zd(e){return e=We(e),e&&Ro.test(e)?e.replace(Dr,"\\$&"):e}var zd=dr(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Kd=dr(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Vd=_l("toLowerCase");function Yd(e,t,n){e=We(e),t=Ae(t);var r=t?ur(e):0;if(!t||r>=t)return e;var f=(t-r)/2;return Ui(Ti(f),n)+e+Ui(Ci(f),n)}function Jd(e,t,n){e=We(e),t=Ae(t);var r=t?ur(e):0;return t&&r<t?e+Ui(t-r,n):e}function Xd(e,t,n){e=We(e),t=Ae(t);var r=t?ur(e):0;return t&&r<t?Ui(t-r,n)+e:e}function Qd(e,t,n){return n||t==null?t=0:t&&(t=+t),oc(We(e).replace(Mr,""),t||0)}function jd(e,t,n){return(n?it(e,t,n):t===o)?t=1:t=Ae(t),su(We(e),t)}function eg(){var e=arguments,t=We(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var tg=dr(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});function ng(e,t,n){return n&&typeof n!="number"&&it(e,t,n)&&(t=n=o),n=n===o?Se:n>>>0,n?(e=We(e),e&&(typeof t=="string"||t!=null&&!Su(t))&&(t=bt(t),!t&&or(e))?bn(Ut(e),0,n):e.split(t,n)):[]}var rg=dr(function(e,t,n){return e+(n?" ":"")+Wu(t)});function ig(e,t,n){return e=We(e),n=n==null?0:$n(Ae(n),0,e.length),t=bt(t),e.slice(n,n+t.length)==t}function og(e,t,n){var r=g.templateSettings;n&&it(e,t,n)&&(t=o),e=We(e),t=Ji({},t,r,Tl);var f=Ji({},t.imports,r.imports,Tl),m=Je(f),_=Go(f,m),N,F,J=0,Q=t.interpolate||C,ee="__p += '",ue=zo((t.escape||C).source+"|"+Q.source+"|"+(Q===ci?xo:C).source+"|"+(t.evaluate||C).source+"|$","g"),ae="//# sourceURL="+(Fe.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++gf+"]")+`
`;e.replace(ue,function(ge,Re,ye,Ct,ot,Tt){return ye||(ye=Ct),ee+=e.slice(J,Tt).replace(W,If),Re&&(N=!0,ee+=`' +
__e(`+Re+`) +
'`),ot&&(F=!0,ee+=`';
`+ot+`;
__p += '`),ye&&(ee+=`' +
((__t = (`+ye+`)) == null ? '' : __t) +
'`),J=Tt+ge.length,ge}),ee+=`';
`;var de=Fe.call(t,"variable")&&t.variable;if(!de)ee=`with (obj) {
`+ee+`
}
`;else if(Oo.test(de))throw new we(B);ee=(F?ee.replace(ho,""):ee).replace(go,"$1").replace(mo,"$1;"),ee="function("+(de||"obj")+`) {
`+(de?"":`obj || (obj = {});
`)+"var __t, __p = ''"+(N?", __e = _.escape":"")+(F?`, __j = Array.prototype.join;
function print() { __p += __j.call(arguments, '') }
`:`;
`)+ee+`return __p
}`;var Ee=wa(function(){return xe(m,ae+"return "+ee).apply(o,_)});if(Ee.source=ee,Ou(Ee))throw Ee;return Ee}function ug(e){return We(e).toLowerCase()}function sg(e){return We(e).toUpperCase()}function lg(e,t,n){if(e=We(e),e&&(n||t===o))return Ns(e);if(!e||!(t=bt(t)))return e;var r=Ut(e),f=Ut(t),m=ys(r,f),_=Ls(r,f)+1;return bn(r,m,_).join("")}function ag(e,t,n){if(e=We(e),e&&(n||t===o))return e.slice(0,Ss(e)+1);if(!e||!(t=bt(t)))return e;var r=Ut(e),f=Ls(r,Ut(t))+1;return bn(r,0,f).join("")}function fg(e,t,n){if(e=We(e),e&&(n||t===o))return e.replace(Mr,"");if(!e||!(t=bt(t)))return e;var r=Ut(e),f=ys(r,Ut(t));return bn(r,f).join("")}function cg(e,t){var n=z,r=te;if(Be(t)){var f="separator"in t?t.separator:f;n="length"in t?Ae(t.length):n,r="omission"in t?bt(t.omission):r}e=We(e);var m=e.length;if(or(e)){var _=Ut(e);m=_.length}if(n>=m)return e;var N=n-ur(r);if(N<1)return r;var F=_?bn(_,0,N).join(""):e.slice(0,N);if(f===o)return F+r;if(_&&(N+=F.length-N),Su(f)){if(e.slice(N).search(f)){var J,Q=F;for(f.global||(f=zo(f.source,We(i.exec(f))+"g")),f.lastIndex=0;J=f.exec(Q);)var ee=J.index;F=F.slice(0,ee===o?N:ee)}}else if(e.indexOf(bt(f),N)!=N){var ue=F.lastIndexOf(f);ue>-1&&(F=F.slice(0,ue))}return F+r}function hg(e){return e=We(e),e&&po.test(e)?e.replace(Fr,$f):e}var dg=dr(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Wu=_l("toUpperCase");function pa(e,t,n){return e=We(e),t=n?o:t,t===o?Df(e)?Gf(e):yf(e):e.match(t)||[]}var wa=be(function(e,t){try{return At(e,o,t)}catch(n){return Ou(n)?n:new we(n)}}),gg=en(function(e,t){return Ot(t,function(n){n=zt(n),Qt(e,n,yu(e[n],e))}),e});function mg(e){var t=e==null?0:e.length,n=he();return e=t?$e(e,function(r){if(typeof r[1]!="function")throw new St(k);return[n(r[0]),r[1]]}):[],be(function(r){for(var f=-1;++f<t;){var m=e[f];if(At(m[0],this,r))return At(m[1],this,r)}})}function pg(e){return $c(Pt(e,G))}function Iu(e){return function(){return e}}function wg(e,t){return e==null||e!==e?t:e}var _g=Al(),vg=Al(!0);function ht(e){return e}function Fu(e){return Js(typeof e=="function"?e:Pt(e,G))}function Ag(e){return Qs(Pt(e,G))}function Eg(e,t){return js(e,Pt(t,G))}var bg=be(function(e,t){return function(n){return zr(n,e,t)}}),Rg=be(function(e,t){return function(n){return zr(e,n,t)}});function Du(e,t,n){var r=Je(t),f=xi(t,r);n==null&&!(Be(t)&&(f.length||!r.length))&&(n=t,t=e,e=this,f=xi(t,Je(t)));var m=!(Be(n)&&"chain"in n)||!!n.chain,_=nn(e);return Ot(f,function(N){var F=t[N];e[N]=F,_&&(e.prototype[N]=function(){var J=this.__chain__;if(m||J){var Q=e(this.__wrapped__),ee=Q.__actions__=at(this.__actions__);return ee.push({func:F,args:arguments,thisArg:e}),Q.__chain__=J,Q}return F.apply(e,pn([this.value()],arguments))})}),e}function Cg(){return Qe._===this&&(Qe._=Jf),this}function Mu(){}function Tg(e){return e=Ae(e),be(function(t){return el(t,e)})}var Ng=gu($e),yg=gu(Es),Lg=gu(ko);function _a(e){return Eu(e)?Ho(zt(e)):ih(e)}function Og(e){return function(t){return e==null?o:Bn(e,t)}}var Sg=bl(),xg=bl(!0);function Uu(){return[]}function ku(){return!1}function Pg(){return{}}function Wg(){return""}function Ig(){return!0}function Fg(e,t){if(e=Ae(e),e<1||e>Ce)return[];var n=Se,r=et(e,Se);t=he(t),e-=Se;for(var f=qo(r,t);++n<e;)t(n);return f}function Dg(e){return _e(e)?$e(e,zt):Rt(e)?[e]:at(Ul(We(e)))}function Mg(e){var t=++Vf;return We(e)+t}var Ug=Mi(function(e,t){return e+t},0),kg=mu("ceil"),Hg=Mi(function(e,t){return e/t},1),$g=mu("floor");function Bg(e){return e&&e.length?Si(e,ht,eu):o}function qg(e,t){return e&&e.length?Si(e,he(t,2),eu):o}function Gg(e){return Cs(e,ht)}function Zg(e,t){return Cs(e,he(t,2))}function zg(e){return e&&e.length?Si(e,ht,iu):o}function Kg(e,t){return e&&e.length?Si(e,he(t,2),iu):o}var Vg=Mi(function(e,t){return e*t},1),Yg=mu("round"),Jg=Mi(function(e,t){return e-t},0);function Xg(e){return e&&e.length?Bo(e,ht):0}function Qg(e,t){return e&&e.length?Bo(e,he(t,2)):0}return g.after=A1,g.ary=Yl,g.assign=sd,g.assignIn=aa,g.assignInWith=Ji,g.assignWith=ld,g.at=ad,g.before=Jl,g.bind=yu,g.bindAll=gg,g.bindKey=Xl,g.castArray=P1,g.chain=zl,g.chunk=$h,g.compact=Bh,g.concat=qh,g.cond=mg,g.conforms=pg,g.constant=Iu,g.countBy=X0,g.create=fd,g.curry=Ql,g.curryRight=jl,g.debounce=ea,g.defaults=cd,g.defaultsDeep=hd,g.defer=E1,g.delay=b1,g.difference=Gh,g.differenceBy=Zh,g.differenceWith=zh,g.drop=Kh,g.dropRight=Vh,g.dropRightWhile=Yh,g.dropWhile=Jh,g.fill=Xh,g.filter=j0,g.flatMap=n1,g.flatMapDeep=r1,g.flatMapDepth=i1,g.flatten=Bl,g.flattenDeep=Qh,g.flattenDepth=jh,g.flip=R1,g.flow=_g,g.flowRight=vg,g.fromPairs=e0,g.functions=vd,g.functionsIn=Ad,g.groupBy=o1,g.initial=n0,g.intersection=r0,g.intersectionBy=i0,g.intersectionWith=o0,g.invert=bd,g.invertBy=Rd,g.invokeMap=s1,g.iteratee=Fu,g.keyBy=l1,g.keys=Je,g.keysIn=ct,g.map=Gi,g.mapKeys=Td,g.mapValues=Nd,g.matches=Ag,g.matchesProperty=Eg,g.memoize=zi,g.merge=yd,g.mergeWith=fa,g.method=bg,g.methodOf=Rg,g.mixin=Du,g.negate=Ki,g.nthArg=Tg,g.omit=Ld,g.omitBy=Od,g.once=C1,g.orderBy=a1,g.over=Ng,g.overArgs=T1,g.overEvery=yg,g.overSome=Lg,g.partial=Lu,g.partialRight=ta,g.partition=f1,g.pick=Sd,g.pickBy=ca,g.property=_a,g.propertyOf=Og,g.pull=a0,g.pullAll=Gl,g.pullAllBy=f0,g.pullAllWith=c0,g.pullAt=h0,g.range=Sg,g.rangeRight=xg,g.rearg=N1,g.reject=d1,g.remove=d0,g.rest=y1,g.reverse=Tu,g.sampleSize=m1,g.set=Pd,g.setWith=Wd,g.shuffle=p1,g.slice=g0,g.sortBy=v1,g.sortedUniq=E0,g.sortedUniqBy=b0,g.split=ng,g.spread=L1,g.tail=R0,g.take=C0,g.takeRight=T0,g.takeRightWhile=N0,g.takeWhile=y0,g.tap=B0,g.throttle=O1,g.thru=qi,g.toArray=ua,g.toPairs=ha,g.toPairsIn=da,g.toPath=Dg,g.toPlainObject=la,g.transform=Id,g.unary=S1,g.union=L0,g.unionBy=O0,g.unionWith=S0,g.uniq=x0,g.uniqBy=P0,g.uniqWith=W0,g.unset=Fd,g.unzip=Nu,g.unzipWith=Zl,g.update=Dd,g.updateWith=Md,g.values=pr,g.valuesIn=Ud,g.without=I0,g.words=pa,g.wrap=x1,g.xor=F0,g.xorBy=D0,g.xorWith=M0,g.zip=U0,g.zipObject=k0,g.zipObjectDeep=H0,g.zipWith=$0,g.entries=ha,g.entriesIn=da,g.extend=aa,g.extendWith=Ji,Du(g,g),g.add=Ug,g.attempt=wa,g.camelCase=Bd,g.capitalize=ga,g.ceil=kg,g.clamp=kd,g.clone=W1,g.cloneDeep=F1,g.cloneDeepWith=D1,g.cloneWith=I1,g.conformsTo=M1,g.deburr=ma,g.defaultTo=wg,g.divide=Hg,g.endsWith=qd,g.eq=Ht,g.escape=Gd,g.escapeRegExp=Zd,g.every=Q0,g.find=e1,g.findIndex=Hl,g.findKey=dd,g.findLast=t1,g.findLastIndex=$l,g.findLastKey=gd,g.floor=$g,g.forEach=Kl,g.forEachRight=Vl,g.forIn=md,g.forInRight=pd,g.forOwn=wd,g.forOwnRight=_d,g.get=xu,g.gt=U1,g.gte=k1,g.has=Ed,g.hasIn=Pu,g.head=ql,g.identity=ht,g.includes=u1,g.indexOf=t0,g.inRange=Hd,g.invoke=Cd,g.isArguments=Zn,g.isArray=_e,g.isArrayBuffer=H1,g.isArrayLike=ft,g.isArrayLikeObject=Ge,g.isBoolean=$1,g.isBuffer=Rn,g.isDate=B1,g.isElement=q1,g.isEmpty=G1,g.isEqual=Z1,g.isEqualWith=z1,g.isError=Ou,g.isFinite=K1,g.isFunction=nn,g.isInteger=na,g.isLength=Vi,g.isMap=ra,g.isMatch=V1,g.isMatchWith=Y1,g.isNaN=J1,g.isNative=X1,g.isNil=j1,g.isNull=Q1,g.isNumber=ia,g.isObject=Be,g.isObjectLike=qe,g.isPlainObject=Qr,g.isRegExp=Su,g.isSafeInteger=ed,g.isSet=oa,g.isString=Yi,g.isSymbol=Rt,g.isTypedArray=mr,g.isUndefined=td,g.isWeakMap=nd,g.isWeakSet=rd,g.join=u0,g.kebabCase=zd,g.last=It,g.lastIndexOf=s0,g.lowerCase=Kd,g.lowerFirst=Vd,g.lt=id,g.lte=od,g.max=Bg,g.maxBy=qg,g.mean=Gg,g.meanBy=Zg,g.min=zg,g.minBy=Kg,g.stubArray=Uu,g.stubFalse=ku,g.stubObject=Pg,g.stubString=Wg,g.stubTrue=Ig,g.multiply=Vg,g.nth=l0,g.noConflict=Cg,g.noop=Mu,g.now=Zi,g.pad=Yd,g.padEnd=Jd,g.padStart=Xd,g.parseInt=Qd,g.random=$d,g.reduce=c1,g.reduceRight=h1,g.repeat=jd,g.replace=eg,g.result=xd,g.round=Yg,g.runInContext=P,g.sample=g1,g.size=w1,g.snakeCase=tg,g.some=_1,g.sortedIndex=m0,g.sortedIndexBy=p0,g.sortedIndexOf=w0,g.sortedLastIndex=_0,g.sortedLastIndexBy=v0,g.sortedLastIndexOf=A0,g.startCase=rg,g.startsWith=ig,g.subtract=Jg,g.sum=Xg,g.sumBy=Qg,g.template=og,g.times=Fg,g.toFinite=rn,g.toInteger=Ae,g.toLength=sa,g.toLower=ug,g.toNumber=Ft,g.toSafeInteger=ud,g.toString=We,g.toUpper=sg,g.trim=lg,g.trimEnd=ag,g.trimStart=fg,g.truncate=cg,g.unescape=hg,g.uniqueId=Mg,g.upperCase=dg,g.upperFirst=Wu,g.each=Kl,g.eachRight=Vl,g.first=ql,Du(g,function(){var e={};return Gt(g,function(t,n){Fe.call(g.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),g.VERSION=p,Ot(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){g[e].placeholder=g}),Ot(["drop","take"],function(e,t){Ne.prototype[e]=function(n){n=n===o?1:Ye(Ae(n),0);var r=this.__filtered__&&!t?new Ne(this):this.clone();return r.__filtered__?r.__takeCount__=et(n,r.__takeCount__):r.__views__.push({size:et(n,Se),type:e+(r.__dir__<0?"Right":"")}),r},Ne.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Ot(["filter","map","takeWhile"],function(e,t){var n=t+1,r=n==ce||n==Oe;Ne.prototype[e]=function(f){var m=this.clone();return m.__iteratees__.push({iteratee:he(f,3),type:n}),m.__filtered__=m.__filtered__||r,m}}),Ot(["head","last"],function(e,t){var n="take"+(t?"Right":"");Ne.prototype[e]=function(){return this[n](1).value()[0]}}),Ot(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");Ne.prototype[e]=function(){return this.__filtered__?new Ne(this):this[n](1)}}),Ne.prototype.compact=function(){return this.filter(ht)},Ne.prototype.find=function(e){return this.filter(e).head()},Ne.prototype.findLast=function(e){return this.reverse().find(e)},Ne.prototype.invokeMap=be(function(e,t){return typeof e=="function"?new Ne(this):this.map(function(n){return zr(n,e,t)})}),Ne.prototype.reject=function(e){return this.filter(Ki(he(e)))},Ne.prototype.slice=function(e,t){e=Ae(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Ne(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==o&&(t=Ae(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},Ne.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Ne.prototype.toArray=function(){return this.take(Se)},Gt(Ne.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),f=g[r?"take"+(t=="last"?"Right":""):t],m=r||/^find/.test(t);f&&(g.prototype[t]=function(){var _=this.__wrapped__,N=r?[1]:arguments,F=_ instanceof Ne,J=N[0],Q=F||_e(_),ee=function(Re){var ye=f.apply(g,pn([Re],N));return r&&ue?ye[0]:ye};Q&&n&&typeof J=="function"&&J.length!=1&&(F=Q=!1);var ue=this.__chain__,ae=!!this.__actions__.length,de=m&&!ue,Ee=F&&!ae;if(!m&&Q){_=Ee?_:new Ne(this);var ge=e.apply(_,N);return ge.__actions__.push({func:qi,args:[ee],thisArg:o}),new xt(ge,ue)}return de&&Ee?e.apply(this,N):(ge=this.thru(ee),de?r?ge.value()[0]:ge.value():ge)})}),Ot(["pop","push","shift","sort","splice","unshift"],function(e){var t=mi[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);g.prototype[e]=function(){var f=arguments;if(r&&!this.__chain__){var m=this.value();return t.apply(_e(m)?m:[],f)}return this[n](function(_){return t.apply(_e(_)?_:[],f)})}}),Gt(Ne.prototype,function(e,t){var n=g[t];if(n){var r=n.name+"";Fe.call(fr,r)||(fr[r]=[]),fr[r].push({name:t,func:n})}}),fr[Di(o,b).name]=[{name:"wrapper",func:o}],Ne.prototype.clone=hc,Ne.prototype.reverse=dc,Ne.prototype.value=gc,g.prototype.at=q0,g.prototype.chain=G0,g.prototype.commit=Z0,g.prototype.next=z0,g.prototype.plant=V0,g.prototype.reverse=Y0,g.prototype.toJSON=g.prototype.valueOf=g.prototype.value=J0,g.prototype.first=g.prototype.head,kr&&(g.prototype[kr]=K0),g},sr=Zf();Mn?((Mn.exports=sr)._=sr,Fo._=sr):Qe._=sr}).call(Vt)})(ro,ro.exports);var ui=ro.exports;(function(l){var d=Vt&&Vt.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(l,"__esModule",{value:!0}),l.Value=l.Arity=l.FloatOrMilliseconds=void 0;const o=d(Wa),p=ui,T=new RegExp("[1-9][0-9]{3}-[01][0-9]-[0-3][0-9][T ][0-2][0-9]:[0-5][0-9]"),x=new RegExp("^-?[0-9]+:[0-5][0-9]"),k=Z=>{const $=Z.trim();if($==="")return new o.default(0);if(T.test($))return new o.default(new Date($).valueOf());if(x.test($)){const U=$.charAt(0)=="-",Y=$.slice(U?1:0),ne=parseInt(Y.slice(0,-3))*60+parseInt(Y.slice(-2));return new o.default((U?-1:1)*ne*6e4)}const G=new o.default($);return G.isNaN()?new o.default(0):G};l.FloatOrMilliseconds=k;class B{constructor($,G){this.isRow=()=>this.rows>1&&this.cols===1,this.isColumn=()=>this.rows===1&&this.cols>1,this.isCell=()=>this.rows===1&&this.cols===1,this.rows=$,this.cols=G}}l.Arity=B;class X{constructor($){this.get=(G,U)=>this.val[G][U],this.getAsNumber=(G,U)=>{const Y=this.get(G,U);return(0,l.FloatOrMilliseconds)(Y)},this.getArity=()=>{const G=this.val.reduce((U,Y)=>Math.max(U,Y.length),0);return new B(this.val.length,G)},this.toString=()=>this.getArity().isCell()?this.get(0,0):`[${(0,p.flatten)(this.val).map(G=>G.trim()).filter(G=>G!=="").join(", ")}]`,this.val=$}}l.Value=X})(Ln);var Ra;function um(){if(Ra)return jr;Ra=1,Object.defineProperty(jr,"__esModule",{value:!0}),jr.AlgebraicOperation=void 0;const l=qt,d=Mt,o=so(),p=Ln,T=ui;class x{constructor(B,X){this.getValue=(U,Y)=>{switch(this.operator){case"+":return this.add(U,Y);case"-":return this.subtract(U,Y);case"*":return this.multiply(U,Y);case"/":return this.divide(U,Y);default:return(0,l.err)(Error("Invalid algbraic operator: "+this.operator))}},this.withCellAndRange=(U,Y,ne,oe,M)=>{const b=this.leftSource.getValue(U,Y);if(b.isErr())return(0,l.err)(b.error);const S=this.rightSource.getValue(U,Y);if(S.isErr())return(0,l.err)(S.error);const w=b.value.getArity(),R=S.value.getArity();if(!R.isCell()&&!w.isCell())return(0,l.err)(Error(`At least one operand in algebraic "${ne}" must be a single cell.`));if(!R.isCell()&&!oe)return(0,l.err)(Error(`Right operand in algebraic "${ne}" must be a single cell.`));if(R.isCell()){const E=S.value.getAsNumber(0,0),O=(0,T.map)(b.value.val,y=>(0,T.map)(y,z=>{const te=(0,p.FloatOrMilliseconds)(z);return M(te,E).toString()}));return(0,l.ok)(new p.Value(O))}const D=b.value.getAsNumber(0,0),A=(0,T.map)(S.value.val,E=>(0,T.map)(E,O=>{const y=(0,p.FloatOrMilliseconds)(O);return M(D,y).toString()}));return(0,l.ok)(new p.Value(A))},this.add=(U,Y)=>this.withCellAndRange(U,Y,"add",!0,(ne,oe)=>ne.plus(oe)),this.subtract=(U,Y)=>this.withCellAndRange(U,Y,"subtract",!0,(ne,oe)=>ne.minus(oe)),this.multiply=(U,Y)=>this.withCellAndRange(U,Y,"multiply",!0,(ne,oe)=>ne.times(oe)),this.divide=(U,Y)=>this.withCellAndRange(U,Y,"divide",!1,(ne,oe)=>ne.dividedBy(oe));const Z=(0,d.checkType)(B,"algebraic_operation");if(Z)throw Z;const $=(0,d.checkChildLength)(B,3);if($)throw $;const G=(0,d.checkType)(B.children[1],"algebraic_operator");if(G)throw G;this.operator=B.children[1].text;try{this.leftSource=new o.Source(B.children[0],X),this.rightSource=new o.Source(B.children[2],X)}catch(U){throw U}}}return jr.AlgebraicOperation=x,jr}var ei={},Ca;function sm(){if(Ca)return ei;Ca=1,Object.defineProperty(ei,"__esModule",{value:!0}),ei.ConditionalFunctionCall=void 0;const l=qt,d=Mt,o=so();class p{constructor(k,B){this.getValue=($,G)=>this.predicate.eval($,G).andThen(U=>U?this.leftSource.getValue($,G):this.rightSource.getValue($,G));const X=(0,d.checkType)(k,"conditional_function_call");if(X)throw X;const Z=(0,d.checkChildLength)(k,3);if(Z)throw Z;try{this.predicate=new T(k.children[0],B),this.leftSource=new o.Source(k.children[1],B),this.rightSource=new o.Source(k.children[2],B)}catch($){throw $}}}ei.ConditionalFunctionCall=p;class T{constructor(k,B){this.eval=(G,U)=>{const Y=this.leftSource.getValue(G,U);if(Y.isErr())return(0,l.err)(Y.error);const ne=this.rightSource.getValue(G,U);if(ne.isErr())return(0,l.err)(ne.error);const oe=Y.value.getArity(),M=ne.value.getArity();if(!oe.isCell())return(0,l.err)(Error("Can only use comparison operator on a single cell. Left side is not a cell."));if(!M.isCell())return(0,l.err)(Error("Can only use comparison operator on a single cell. Right side is not a cell."));const b=Y.value.getAsNumber(0,0),S=ne.value.getAsNumber(0,0);switch(this.operator){case">":return(0,l.ok)(b.greaterThan(S));case">=":return(0,l.ok)(b.greaterThanOrEqualTo(S));case"<":return(0,l.ok)(b.lessThan(S));case"<=":return(0,l.ok)(b.lessThanOrEqualTo(S));case"==":return(0,l.ok)(b.equals(S));case"!=":return(0,l.ok)(!b.equals(S));default:return(0,l.err)(Error("Invalid conditional operator: "+this.operator))}};const X=(0,d.checkType)(k,"predicate");if(X)throw X;const Z=(0,d.checkChildLength)(k,3);if(Z)throw Z;const $=(0,d.checkType)(k.children[1],"conditional_operator");if($)throw $;this.operator=k.children[1].text;try{this.leftSource=new o.Source(k.children[0],B),this.rightSource=new o.Source(k.children[2],B)}catch(G){throw G}}}return ei}var io={};Object.defineProperty(io,"__esModule",{value:!0});io.Constant=void 0;const lm=qt,am=Mt,fm=Ln;class cm{constructor(d,o){const p=(0,am.checkType)(d,"real","float");if(p)throw p;const T=d.text[0]==="-"?-1:1;d.type==="real"?this.value=T*parseInt(d.children[0].text):this.value=T*parseFloat(d.children[0].text+"."+d.children[1].text)}getValue(d,o){return(0,lm.ok)(new fm.Value([[this.value.toString()]]))}}io.Constant=cm;var Dt={},un={};Object.defineProperty(un,"__esModule",{value:!0});un.AbsoluteColumn=un.Column=un.newColumn=void 0;const Tn=qt,ii=Mt,hm=Ln,dm=(l,d)=>{try{switch(l.type){case"relative_column":return(0,Tn.ok)(new gm(l,d));case"absolute_column":return(0,Tn.ok)(new Ia(l,d));default:return(0,Tn.err)(new Error(`Formula element '${l.text}' is a ${l.type} but expected an relatve_column or absolute_column in this position.`))}}catch(o){return(0,Tn.err)(o)}};un.newColumn=dm;class Xu{constructor(){this.getValue=(d,o)=>{var p;const T=((p=d.getCellAt(o.row,this.getIndex(o)))===null||p===void 0?void 0:p.toText())||"";return(0,Tn.ok)(new hm.Value([[T]]))}}}un.Column=Xu;class gm extends Xu{constructor(d,o){super(),this.getIndex=k=>k.column+this.offset,this.getAbsoluteIndex=()=>(0,Tn.err)(ii.errRelativeReferenceIndex);const p=(0,ii.checkType)(d,"relative_column");if(p)throw p;const T=(0,ii.checkChildLength)(d,1);if(T)throw T;const x=d.text[1]==="-"?-1:1;this.offset=x*parseInt(d.children[0].text)}}class Ia extends Xu{constructor(d,o){super(),this.getIndex=x=>this.index,this.getAbsoluteIndex=()=>(0,Tn.ok)(this.index);let p=-1,T="";switch(d.children.length){case 0:T=d.text[1];break;case 1:const x=(0,ii.checkType)(d.children[0],"int");if(x)throw(0,Tn.err)(x);p=parseInt(d.children[0].text);break;default:throw new Error(`Formula element '${d.text}' is a ${d.type} but expected a 'absolute_column' in this position.`)}switch(T){case"":break;case"<":p=1;break;case">":p=o.getWidth();break;default:throw new Error(`Invalid column symbol '${T}'`)}if(p===0)throw ii.errIndex0;this.index=p-1}}un.AbsoluteColumn=Ia;var si={},li={},sn={};Object.defineProperty(sn,"__esModule",{value:!0});sn.AbsoluteRow=sn.Row=sn.newRow=void 0;const Nn=qt,oi=Mt,mm=Ln,pm=(l,d)=>{try{switch(l.type){case"relative_row":return(0,Nn.ok)(new wm(l,d));case"absolute_row":return(0,Nn.ok)(new Fa(l,d));default:return(0,Nn.err)(new Error(`Formula element '${l.text}' is a ${l.type} but expected an relatve_row or absolute_row in this position.`))}}catch(o){return(0,Nn.err)(o)}};sn.newRow=pm;class Qu{constructor(){this.getValue=(d,o)=>{var p;const T=((p=d.getCellAt(this.getIndex(o),o.column))===null||p===void 0?void 0:p.toText())||"";return(0,Nn.ok)(new mm.Value([[T]]))}}}sn.Row=Qu;class wm extends Qu{constructor(d,o){super(),this.getIndex=k=>k.row+this.offset,this.getAbsoluteIndex=()=>(0,Nn.err)(oi.errRelativeReferenceIndex);const p=(0,oi.checkType)(d,"relative_row");if(p)throw p;const T=(0,oi.checkChildLength)(d,1);if(T)throw T;const x=d.text[1]==="-"?-1:1;this.offset=x*parseInt(d.children[0].text)}}class Fa extends Qu{constructor(d,o){super(),this.getIndex=x=>this.index,this.getAbsoluteIndex=()=>(0,Nn.ok)(this.index);let p=-1,T="";switch(d.children.length){case 0:T=d.text[1];break;case 1:const x=(0,oi.checkType)(d.children[0],"int");if(x)throw(0,Nn.err)(x);p=parseInt(d.children[0].text);break;default:throw new Error(`Formula element '${d.text}' is a ${d.type} but expected a 'absolute_row' in this position.`)}switch(T){case"":break;case"<":p=1;break;case">":p=o.getHeight()-1;break;case"I":p=2;break;default:throw new Error(`Invalid row symbol '${T}'`)}if(p===0)throw oi.errIndex0;p===1?this.index=0:this.index=p}}sn.AbsoluteRow=Fa;Object.defineProperty(li,"__esModule",{value:!0});li.Reference=void 0;const _m=qt,$u=Mt,vm=un,Am=Ln,Em=sn;class bm{constructor(d,o){this.getValue=(T,x)=>{var k;const B={row:this.row?this.row.getIndex(x):x.row,column:this.column?this.column.getIndex(x):x.column},X=((k=T.getCellAt(B.row,B.column))===null||k===void 0?void 0:k.toText())||"";return(0,_m.ok)(new Am.Value([[X]]))};const p=(0,$u.checkType)(d,"source_reference","absolute_reference","relative_reference");if(p)throw p;for(let T=0;T<d.children.length;T++){const x=d.children[T];switch(x.type){case"relative_row":case"absolute_row":if(this.row!==void 0)throw Error("Reference may only have at most 1 row, more than 1 provided");const k=(0,Em.newRow)(x,o);if(k.isErr()){if(k.error===$u.errIndex0)break;throw k.error}this.row=k.value;break;case"relative_column":case"absolute_column":if(this.column!==void 0)throw Error("Reference may only have at most 1 column, more than 1 provided");const B=(0,vm.newColumn)(x,o);if(B.isErr()){if(B.error===$u.errIndex0)break;throw B.error}this.column=B.value;break}}}}li.Reference=bm;Object.defineProperty(si,"__esModule",{value:!0});si.Range=void 0;const Qi=qt,wr=Mt,Ta=li,Rm=Ln,zn=ui;class Cm{constructor(d,o){this.getValue=(Z,$)=>{const G=this.startColumn?this.startColumn.getIndex($):$.column,U=this.endColumn?this.endColumn.getIndex($):G,Y=this.startRow?this.startRow.getIndex($):$.row,ne=this.endRow?this.endRow.getIndex($):$.row;return(0,Qi.ok)(new Rm.Value((0,zn.map)((0,zn.range)(Y,ne+1),oe=>(0,zn.map)((0,zn.range)(G,U+1),M=>{var b;return((b=Z.getCellAt(oe,M))===null||b===void 0?void 0:b.toText())||""}))))},this.asCells=()=>{if(!this.startColumn||!this.startRow||!this.endRow)return(0,Qi.err)(new Error("A range used as a desintation must define rows and cells"));let Z=this.endColumn;Z||(Z=this.startColumn);const $=this.startRow.getAbsoluteIndex(),G=this.endRow.getAbsoluteIndex(),U=this.startColumn.getAbsoluteIndex(),Y=Z.getAbsoluteIndex();if($.isErr()||G.isErr()||U.isErr()||Y.isErr())return(0,Qi.err)(new Error("A relative range can not be used in a formula destination"));const ne=Math.min($.value,G.value),oe=Math.max($.value,G.value),M=Math.min(U.value,Y.value),b=Math.max(U.value,Y.value);return(0,Qi.ok)((0,zn.flatMap)((0,zn.range)(ne,oe+1),S=>(0,zn.range)(M,b+1).map(w=>({row:S,column:w}))))};let p=(0,wr.checkType)(d,"range");if(p)throw p;let T=(0,wr.checkChildLength)(d,2);if(T)throw T;const x=d.children[0],k=d.children[1];if(p=(0,wr.checkType)(x,"source_reference"),p||(p=(0,wr.checkType)(k,"source_reference"),p))throw p;if(T=(0,wr.checkChildLength)(x,1),T||(T=(0,wr.checkChildLength)(k,1),T))throw T;const B=new Ta.Reference(x.children[0],o),X=new Ta.Reference(k.children[0],o);if(B.row&&!X.row||X.row&&!B.row)throw new Error("Range must use references of the same kind");if(!B.row&&!B.column)throw console.log(B),new Error("Range must have a row or a column defined");B.row&&(this.startRow=B.row),B.column&&(this.startColumn=B.column),X.row&&(this.endRow=X.row),X.column?this.endColumn=X.column:this.endColumn=B.column}}si.Range=Cm;Object.defineProperty(Dt,"__esModule",{value:!0});Dt.RangeDestination=Dt.CellDestination=Dt.ColumnDestination=Dt.RowDestination=Dt.newDestination=void 0;const Nt=qt,dt=Mt,Da=un,Tm=si,Ma=sn,Ua=ui,Nm=(l,d,o)=>{const p=(0,dt.checkType)(l,"destination");if(p)return(0,Nt.err)(p);const T=(0,dt.checkChildLength)(l,1);if(T)return(0,Nt.err)(T);const x=l.children[0];if(x.type==="range")return(0,Nt.ok)(new Ba(x,d,o));try{switch(x.children.length){case 2:return(0,Nt.ok)(new $a(x,d,o));case 1:const k=x.children[0];if(k.type==="absolute_row")return(0,Nt.ok)(new ka(x,d,o));if(k.type==="absolute_column")return(0,Nt.ok)(new Ha(x,d,o));default:return(0,Nt.err)(new Error("Unexpected destination type "+x.type))}}catch(k){return k===dt.errIndex0?(0,Nt.err)(new Error("Index 0 may not be used in a destination")):(0,Nt.err)(k)}};Dt.newDestination=Nm;class ka{constructor(d,o,p){this.merge=(B,X)=>{const Z=(0,Ua.range)(0,X.getWidth()).map($=>({row:this.row.index,column:$}));return oo(B,X,Z,this.formatter)},this.formatter=p;const T=(0,dt.checkType)(d,"absolute_reference");if(T)throw T;const x=(0,dt.checkChildLength)(d,1);if(x)throw x;const k=d.children[0];try{this.row=new Ma.AbsoluteRow(k,o)}catch(B){throw B}}}Dt.RowDestination=ka;class Ha{constructor(d,o,p){this.merge=(B,X)=>{const Z=(0,Ua.range)(2,X.getHeight()).map($=>({row:$,column:this.column.index}));return oo(B,X,Z,this.formatter)},this.formatter=p;const T=(0,dt.checkType)(d,"absolute_reference");if(T)throw T;const x=(0,dt.checkChildLength)(d,1);if(x)throw x;const k=d.children[0];try{this.column=new Da.AbsoluteColumn(k,o)}catch(B){throw B}}}Dt.ColumnDestination=Ha;class $a{constructor(d,o,p){this.merge=(X,Z)=>{const $={row:this.row.index,column:this.column.index};return oo(X,Z,[$],this.formatter)},this.formatter=p;const T=(0,dt.checkType)(d,"absolute_reference");if(T)throw T;const x=(0,dt.checkChildLength)(d,2);if(x)throw x;const k=d.children[0],B=d.children[1];try{this.row=new Ma.AbsoluteRow(k,o),this.column=new Da.AbsoluteColumn(B,o)}catch(X){throw X}}}Dt.CellDestination=$a;class Ba{constructor(d,o,p){this.merge=(k,B)=>this.range.asCells().andThen(X=>oo(k,B,X,this.formatter)),this.formatter=p;const T=(0,dt.checkType)(d,"range");if(T)throw T;const x=(0,dt.checkChildLength)(d,2);if(x)throw x;d.children.forEach(k=>{let B=(0,dt.checkType)(k,"source_reference");if(B)throw B;const X=(0,dt.checkChildLength)(k,1);if(X)throw X;if(B=(0,dt.checkType)(k.children[0],"absolute_reference"),B)throw B}),this.range=new Tm.Range(d,o)}}Dt.RangeDestination=Ba;const oo=(l,d,o,p)=>o.reduce((T,x)=>T.andThen(k=>l.getValue(k,x).andThen(B=>(0,Nt.ok)(B.toString())).andThen(B=>(0,Nt.ok)(B.trim()===""?"0":B)).andThen(B=>(0,Nt.ok)(k.setCellAt(x.row,x.column,p.format(B))))),(0,Nt.ok)(d));var vr={};Object.defineProperty(vr,"__esModule",{value:!0});vr.DisplayDirective=vr.DefaultFormatter=void 0;const Kn=Mt;class ym{constructor(){this.format=d=>typeof d=="string"?d:d.toString()}}vr.DefaultFormatter=ym;class Lm{constructor(d){this.format=B=>{const X=typeof B=="string"?parseFloat(B):B;if(this.displayAsDatetime){const Z=new Date(X),$=M=>`0${M}`.slice(-2),G=Z.getFullYear(),U=$(Z.getMonth()+1),Y=$(Z.getDate()),ne=$(Z.getHours()),oe=$(Z.getMinutes());return`${G}-${U}-${Y} ${ne}:${oe}`}if(this.displayAsHourMinute){let Z=X<0?"-":"";const $=Math.floor(Math.abs(X)/6e4),G=ne=>`0${ne}`.slice(-2),U=G(Math.floor($/60)),Y=G($%60);return`${Z}${U}:${Y}`}return X.toFixed(this.decimalLength)};let o=(0,Kn.checkType)(d,"display_directive");if(o)throw o;let p=(0,Kn.checkChildLength)(d,1);if(p)throw p;const T=d.children[0];if(o=(0,Kn.checkType)(T,"display_directive_option"),o)throw o;if(p=(0,Kn.checkChildLength)(T,1),p)throw p;const x=T.children[0];if(o=(0,Kn.checkType)(x,"formatting_directive","datetime_directive","hourminute_directive"),o)throw o;if(this.displayAsDatetime=x.type==="datetime_directive",this.displayAsHourMinute=x.type==="hourminute_directive",this.displayAsDatetime||this.displayAsHourMinute){this.decimalLength=-1;return}if(p=(0,Kn.checkChildLength)(x,1),p)throw p;const k=x.children[0];if(o=(0,Kn.checkType)(k,"int"),o)throw o;this.decimalLength=parseInt(k.text)}}vr.DisplayDirective=Lm;var ti={},Na;function Om(){if(Na)return ti;Na=1;var l=Vt&&Vt.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(ti,"__esModule",{value:!0}),ti.SingleParamFunctionCall=void 0;const d=qt,o=Mt,p=so(),T=Ln,x=l(Wa);class k{constructor($,G){this.getValue=(M,b)=>this.param.getValue(M,b).andThen(S=>(0,d.ok)(this.op(S)));const U=(0,o.checkType)($,"single_param_function_call");if(U)throw U;const Y=(0,o.checkChildLength)($,2);if(Y)throw Y;const ne=(0,o.checkType)($.children[0],"single_param_function");if(ne)throw ne;const oe=$.children[0].text;switch(oe){case"sum":this.op=B;break;case"mean":this.op=X;break;default:throw Error("Unknown single param function call: "+oe)}this.param=new p.Source($.children[1],G)}}ti.SingleParamFunctionCall=k;const B=Z=>{const $=Z.val.reduce((G,U)=>U.reduce((Y,ne)=>(0,T.FloatOrMilliseconds)(ne).add(Y),G),new x.default(0));return new T.Value([[$.toString()]])},X=Z=>{const{total:$,count:G}=Z.val.reduce(({total:U,count:Y},ne)=>ne.reduce(({total:oe,count:M},b)=>({total:oe+ +b,count:M+1}),{total:U,count:Y}),{total:0,count:0});return new T.Value([[($/G).toString()]])};return ti}var qa={},nt={},Rr={};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.TokenError=void 0;class Sm extends Error{constructor(d,o){if(super(d),this.message=d,this.token=o,o&&o.errors)o.errors.push(this);else throw this}inspect(){return"SyntaxError: "+this.message}}Rr.TokenError=Sm;Object.defineProperty(nt,"__esModule",{value:!0});nt.Parser=nt.findRuleByName=nt.parseRuleName=nt.escapeRegExp=nt.readToken=void 0;const ya=/^[A-Z0-9_]+$/,La=/(\?|\+|\*)$/,Oa=/^(@|&|!)/,ji="WS",eo=Rr;function Gu(l,d){let o=d.exec(l);return o&&o.index==0?o[0].length==0&&d.source.length>0?null:{type:null,text:o[0],rest:l.substr(o[0].length),start:0,end:o[0].length-1,fullText:o[0],errors:[],children:[],parent:null}:null}nt.readToken=Gu;function Ga(l){return l.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}nt.escapeRegExp=Ga;function Za(l){l.rest="",l.children&&l.children.forEach(d=>Za(d))}function za(l,d){l.start+=d,l.end+=d,l.children&&l.children.forEach(o=>za(o,l.start))}function Ka(l,d){d.errors&&d.errors.length&&d.errors.forEach(o=>l.push(o)),d.children&&d.children.forEach(o=>Ka(l,o))}function Vn(l){let d=La.exec(l),o=Oa.exec(l),p=d&&d[0]||"",T=o&&o[0]||"",x={raw:l,name:l.replace(La,"").replace(Oa,""),isOptional:p=="?"||p=="*",allowRepetition:p=="+"||p=="*",atLeastOne:p=="+",lookupPositive:T=="&",lookupNegative:T=="!",pinned:T=="@",lookup:!1,isLiteral:!1};return x.isLiteral=x.name[0]=="'"||x.name[0]=='"',x.lookup=x.lookupNegative||x.lookupPositive,x}nt.parseRuleName=Vn;function Va(l,d){let o=Vn(l);return d.cachedRules[o.name]||null}nt.findRuleByName=Va;function Zu(l,d){if(l.children){let o=l.children.filter(p=>p.type&&d.test(p.type));for(let p=0;p<o.length;p++){let T=l.children.indexOf(o[p]);T!=-1&&l.children.splice(T,1)}l.children.forEach(p=>Zu(p,d))}}const xm=["EOF"];class Ya{constructor(d,o){this.grammarRules=d,this.options=o,this.cachedRules={},this.debug=o?o.debug===!0:!1;let p=[],T=[];if(d.forEach(x=>{let k=Vn(x.name);if(k.name in this.cachedRules){p.push("Duplicated rule "+k.name);return}else this.cachedRules[k.name]=x;if(!x.bnf||!x.bnf.length){let B="Missing rule content, rule: "+x.name;p.indexOf(B)==-1&&p.push(B)}else x.bnf.forEach(B=>{if(typeof B[0]=="string"&&Vn(B[0]).name==x.name){let Z="Left recursion is not allowed, rule: "+x.name;p.indexOf(Z)==-1&&p.push(Z)}B.forEach(X=>{if(typeof X=="string"){let Z=Vn(X);!Z.isLiteral&&T.indexOf(Z.name)==-1&&xm.indexOf(Z.name)==-1&&T.push(Z.name)}})});ji==x.name&&(x.implicitWs=!1),x.implicitWs&&T.indexOf(ji)==-1&&T.push(ji),x.recover&&T.indexOf(x.recover)==-1&&T.push(x.recover)}),T.forEach(x=>{x in this.cachedRules||p.push("Missing rule "+x)}),p.length)throw new Error(p.join(`
`))}getAST(d,o){o||(o=this.grammarRules.filter(T=>!T.fragment&&T.name.indexOf("%")!=0)[0].name);let p=this.parse(d,o);if(p){Ka(p.errors,p),za(p,0),Zu(p,/^%/),(!this.options||!this.options.keepUpperRules)&&Zu(p,ya);let T=p.rest;T&&new eo.TokenError(`Unexpected end of input:
`+T,p),Za(p),p.rest=T}return p}emitSource(){return"CANNOT EMIT SOURCE FROM BASE Parser"}parse(d,o,p=0){let T=null,x=Vn(o),k,B=this.debug&&!ya.test(x.name);B&&console.log(new Array(p).join("│ ")+"Trying to get "+o+" from "+JSON.stringify(d.split(`
`)[0]));let X=x.name,Z=Va(x.name,this);if(x.name=="EOF"){if(d.length)return null;if(d.length==0)return{type:"EOF",text:"",rest:"",start:0,end:0,fullText:"",errors:[],children:[],parent:null}}try{if(!Z&&x.isLiteral){let $=x.name.trim();if($.startsWith('"')?$=JSON.parse($):$.startsWith("'")&&($=$.replace(/^'(.+)'$/,"$1").replace(/\\'/g,"'")),$==="")return{type:"%%EMPTY%%",text:"",rest:d,start:0,end:0,fullText:"",errors:[],children:[],parent:null};k=new RegExp(Ga($)),X=null}}catch($){return $ instanceof ReferenceError&&console.error($),null}if(k){let $=Gu(d,k);if($)return $.type=X,$}else{let $=Z.bnf;$ instanceof Array&&$.forEach(G=>{if(T)return;let U=null,Y={type:x.name,text:"",children:[],end:0,errors:[],fullText:"",parent:null,start:0,rest:d};Z.fragment&&(Y.fragment=!0);let ne=d,oe=0,M=G.length>0,b=!1;for(let S=0;S<G.length;S++)if(typeof G[S]=="string"){let w=Vn(G[S]);M=M&&w.isOptional;let R,D=!1;do{if(R=null,Z.implicitWs&&(R=this.parse(ne,w.name,p+1),!R)){let A;do if(A=this.parse(ne,ji,p+1),A)Y.text=Y.text+A.text,Y.end=Y.text.length,A.parent=Y,Y.children.push(A),ne=ne.substr(A.text.length),oe+=A.text.length;else break;while(A&&A.text.length)}if(R=R||this.parse(ne,w.name,p+1),w.lookupNegative){if(R)return;break}if(w.lookupPositive&&!R)return;if(!R&&(w.isOptional||w.atLeastOne&&D))break;if(R&&Z.pinned==S+1&&(U=R,B&&console.log(new Array(p+1).join("│ ")+"└─ "+R.type+" PINNED")),R||(R=this.parseRecovery(Z,ne,p+1)),!R)if(U)T=Y,R={type:"SyntaxError",text:ne,children:[],end:ne.length,errors:[],fullText:"",parent:null,start:0,rest:""},ne.length?new eo.TokenError(`Unexpected end of input. Expecting ${w.name} Got: ${ne}`,R):new eo.TokenError(`Unexpected end of input. Missing ${w.name}`,R),B&&console.log(new Array(p+1).join("│ ")+"└─ "+R.type+" "+JSON.stringify(R.text));else return;if(D=!0,b=!0,R.type=="%%EMPTY%%")break;R.start+=oe,R.end+=oe,!w.lookupPositive&&R.type&&(R.fragment?R.children&&R.children.forEach(A=>{A.start+=oe,A.end+=oe,A.parent=Y,Y.children.push(A)}):(R.parent=Y,Y.children.push(R))),w.lookup&&(R.lookup=!0),B&&console.log(new Array(p+1).join("│ ")+"└─ "+R.type+" "+JSON.stringify(R.text)),!w.lookup&&!R.lookup&&(Y.text=Y.text+R.text,Y.end=Y.text.length,ne=ne.substr(R.text.length),oe+=R.text.length),Y.rest=ne}while(R&&w.allowRepetition&&ne.length&&!R.lookup)}else{let w=Gu(ne,G[S]);if(!w)return;B&&console.log(new Array(p+1).join("│ ")+"└> "+JSON.stringify(w.text)+G[S].source),b=!0,w.start+=oe,w.end+=oe,Y.text=Y.text+w.text,Y.end=Y.text.length,ne=ne.substr(w.text.length),oe+=w.text.length,Y.rest=ne}b&&(T=Y,B&&console.log(new Array(p).join("│ ")+"├<─┴< PUSHING "+T.type+" "+JSON.stringify(T.text)))}),T&&Z.simplifyWhenOneChildren&&T.children.length==1&&(T=T.children[0])}return T||B&&console.log(o+" NOT RESOLVED FROM "+d),T}parseRecovery(d,o,p){if(d.recover&&o.length){let T=this.debug;T&&console.log(new Array(p+1).join("│ ")+"Trying to recover until token "+d.recover+" from "+JSON.stringify(o.split(`
`)[0]+o.split(`
`)[1]));let x={type:"SyntaxError",text:"",children:[],end:0,errors:[],fullText:"",parent:null,start:0,rest:""},k;do if(k=this.parse(o,d.recover,p+1),k){new eo.TokenError('Unexpected input: "'+x.text+`" Expecting: ${d.name}`,x);break}else x.text=x.text+o[0],x.end=x.text.length,o=o.substr(1);while(!k&&o.length>0);if(x.text.length>0&&k)return T&&console.log(new Array(p+1).join("│ ")+"Recovered text: "+JSON.stringify(x.text)),x}return null}}nt.Parser=Ya;nt.default=Ya;var Ja={},ju={},uo={};Object.defineProperty(uo,"__esModule",{value:!0});uo.findChildrenByType=void 0;function Pm(l,d){return l.children?l.children.filter(o=>o.type==d):[]}uo.findChildrenByType=Pm;Object.defineProperty(ju,"__esModule",{value:!0});const Cn=uo,Bu=nt;var zu;(function(l){l.RULES=[{name:"syntax",bnf:[["RULE_EOL*","rule+"]]},{name:"rule",bnf:[['" "*','"<"',"rule-name",'">"','" "*','"::="',"firstExpression","otherExpression*",'" "*',"RULE_EOL+",'" "*']]},{name:"firstExpression",bnf:[['" "*',"list"]]},{name:"otherExpression",bnf:[['" "*','"|"','" "*',"list"]]},{name:"RULE_EOL",bnf:[['"\\r"'],['"\\n"']]},{name:"list",bnf:[["term",'" "*',"list"],["term"]]},{name:"term",bnf:[["literal"],['"<"',"rule-name",'">"']]},{name:"literal",bnf:[[`'"'`,"RULE_CHARACTER1*",`'"'`],[`"'"`,"RULE_CHARACTER2*",`"'"`]]},{name:"RULE_CHARACTER",bnf:[['" "'],["RULE_LETTER"],["RULE_DIGIT"],["RULE_SYMBOL"]]},{name:"RULE_LETTER",bnf:[['"A"'],['"B"'],['"C"'],['"D"'],['"E"'],['"F"'],['"G"'],['"H"'],['"I"'],['"J"'],['"K"'],['"L"'],['"M"'],['"N"'],['"O"'],['"P"'],['"Q"'],['"R"'],['"S"'],['"T"'],['"U"'],['"V"'],['"W"'],['"X"'],['"Y"'],['"Z"'],['"a"'],['"b"'],['"c"'],['"d"'],['"e"'],['"f"'],['"g"'],['"h"'],['"i"'],['"j"'],['"k"'],['"l"'],['"m"'],['"n"'],['"o"'],['"p"'],['"q"'],['"r"'],['"s"'],['"t"'],['"u"'],['"v"'],['"w"'],['"x"'],['"y"'],['"z"']]},{name:"RULE_DIGIT",bnf:[['"0"'],['"1"'],['"2"'],['"3"'],['"4"'],['"5"'],['"6"'],['"7"'],['"8"'],['"9"']]},{name:"RULE_SYMBOL",bnf:[['"-"'],['"_"'],['"!"'],['"#"'],['"$"'],['"%"'],['"&"'],['"("'],['")"'],['"*"'],['"+"'],['","'],['"-"'],['"."'],['"/"'],['":"'],['";"'],['"<"'],['"="'],['">"'],['"?"'],['"@"'],['"["'],['"\\"'],['"]"'],['"^"'],['"_"'],['"`"'],['"{"'],['"|"'],['"}"'],['"~"']]},{name:"RULE_CHARACTER1",bnf:[["RULE_CHARACTER"],[`"'"`]]},{name:"RULE_CHARACTER2",bnf:[["RULE_CHARACTER"],[`'"'`]]},{name:"rule-name",bnf:[["RULE_LETTER","RULE_CHAR*"]]},{name:"RULE_CHAR",bnf:[["RULE_LETTER"],["RULE_DIGIT"],['"_"'],['"-"']]}],l.defaultParser=new Bu.Parser(l.RULES,{debug:!1});function d(x){let k=Cn.findChildrenByType(x,"term").map(B=>Cn.findChildrenByType(B,"literal").concat(Cn.findChildrenByType(B,"rule-name"))[0].text);return Cn.findChildrenByType(x,"list").forEach(B=>{k=k.concat(d(B))}),k}function o(x,k=l.defaultParser){let B=k.getAST(x);if(!B)throw new Error("Could not parse "+x);if(B.errors&&B.errors.length)throw B.errors[0];let Z=Cn.findChildrenByType(B,"rule").map($=>{let G=Cn.findChildrenByType($,"rule-name")[0].text,U=Cn.findChildrenByType($,"firstExpression").concat(Cn.findChildrenByType($,"otherExpression")),Y=[];return U.forEach(ne=>{Y.push(d(ne))}),{name:G,bnf:Y}});return Z.some($=>$.name=="EOL")||Z.push({name:"EOL",bnf:[['"\\r\\n"','"\\r"','"\\n"']]}),Z}l.getRules=o;function p(x,k=l.defaultParser){return o(x.join(""),k)}l.Transform=p;class T extends Bu.Parser{constructor(k,B){const X=B&&B.debugRulesParser===!0?new Bu.Parser(l.RULES,{debug:!0}):l.defaultParser;super(o(k,X),B),this.source=k}emitSource(){return this.source}}l.Parser=T})(zu||(zu={}));ju.default=zu;var es={};Object.defineProperty(es,"__esModule",{value:!0});const ni=nt;var Ku;(function(l){l.RULES=[{name:"Grammar",bnf:[["RULE_S*","%Atomic*","EOF"]]},{name:"%Atomic",bnf:[["Production","RULE_S*"]],fragment:!0},{name:"Production",bnf:[["NCName","RULE_S*",'"::="',"RULE_WHITESPACE*","Choice","RULE_WHITESPACE*","RULE_EOL+","RULE_S*"]]},{name:"NCName",bnf:[[/[a-zA-Z][a-zA-Z_0-9]*/]]},{name:"Choice",bnf:[["SequenceOrDifference","%_Choice_1*"]],fragment:!0},{name:"%_Choice_1",bnf:[["RULE_WHITESPACE*",'"|"',"RULE_WHITESPACE*","SequenceOrDifference"]],fragment:!0},{name:"SequenceOrDifference",bnf:[["Item","RULE_WHITESPACE*","%_Item_1?"]]},{name:"%_Item_1",bnf:[["Minus","Item"],["Item*"]],fragment:!0},{name:"Minus",bnf:[['"-"']]},{name:"Item",bnf:[["RULE_WHITESPACE*","%Primary","PrimaryDecoration?"]],fragment:!0},{name:"PrimaryDecoration",bnf:[['"?"'],['"*"'],['"+"']]},{name:"DecorationName",bnf:[['"ebnf://"',/[^\x5D#]+/]]},{name:"%Primary",bnf:[["NCName"],["StringLiteral"],["CharCode"],["CharClass"],["SubItem"]],fragment:!0},{name:"SubItem",bnf:[['"("',"RULE_WHITESPACE*","Choice","RULE_WHITESPACE*",'")"']]},{name:"StringLiteral",bnf:[[`'"'`,/[^"]*/,`'"'`],[`"'"`,/[^']*/,`"'"`]],pinned:1},{name:"CharCode",bnf:[['"#x"',/[0-9a-zA-Z]+/]]},{name:"CharClass",bnf:[["'['","'^'?","%RULE_CharClass_1+",'"]"']]},{name:"%RULE_CharClass_1",bnf:[["CharCodeRange"],["CharRange"],["CharCode"],["RULE_Char"]],fragment:!0},{name:"RULE_Char",bnf:[[/\x09/],[/\x0A/],[/\x0D/],[/[\x20-\x5c]/],[/[\x5e-\uD7FF]/],[/[\uE000-\uFFFD]/]]},{name:"CharRange",bnf:[["RULE_Char",'"-"',"RULE_Char"]]},{name:"CharCodeRange",bnf:[["CharCode",'"-"',"CharCode"]]},{name:"RULE_WHITESPACE",bnf:[["%RULE_WHITESPACE_CHAR*"],["Comment","RULE_WHITESPACE*"]]},{name:"RULE_S",bnf:[["RULE_WHITESPACE","RULE_S*"],["RULE_EOL","RULE_S*"]]},{name:"%RULE_WHITESPACE_CHAR",bnf:[[/\x09/],[/\x20/]],fragment:!0},{name:"Comment",bnf:[['"/*"',"%RULE_Comment_Body*",'"*/"']]},{name:"%RULE_Comment_Body",bnf:[['!"*/"',/[^*]/]],fragment:!0},{name:"RULE_EOL",bnf:[[/\x0D/,/\x0A/],[/\x0A/],[/\x0D/]]},{name:"Link",bnf:[["'['","Url","']'"]]},{name:"Url",bnf:[[/[^\x5D:/?#]/,'"://"',/[^\x5D#]+/,"%Url1?"]]},{name:"%Url1",bnf:[['"#"',"NCName"]],fragment:!0}],l.defaultParser=new ni.Parser(l.RULES,{debug:!1});const d=/^(!|&)/,o=/(\?|\+|\*)$/,p=/^%/;function T(b,S){if(typeof b=="string"){if(d.test(b))return"";if(p.test(b)){let R=o.exec(b),D=R?R[0]+" ":"";return x(b,S)?B(b,S)+D:"("+B(b,S)+")"+D}return b}else return b.source.replace(/\\(?:x|u)([a-zA-Z0-9]+)/g,"#x$1").replace(/\[\\(?:x|u)([a-zA-Z0-9]+)-\\(?:x|u)([a-zA-Z0-9]+)\]/g,"[#x$1-#x$2]")}function x(b,S){let w=ni.findRuleByName(b,S);return w&&w.bnf.length==1&&w.bnf[0].length==1&&(w.bnf[0][0]instanceof RegExp||w.bnf[0][0][0]=='"'||w.bnf[0][0][0]=="'")}function k(b,S){return b.map(w=>T(w,S)).join(" ")}function B(b,S){let w=ni.findRuleByName(b,S);return w?w.bnf.map(R=>k(R,S)).join(" | "):"RULE_NOT_FOUND {"+b+"}"}function X(b){let S=[];return b.grammarRules.forEach(w=>{if(!/^%/.test(w.name)){let R=w.recover?" /* { recoverUntil="+w.recover+" } */":"";S.push(w.name+" ::= "+B(w.name,b)+R)}}),S.join(`
`)}l.emit=X;let Z=0;function $(b,S){throw console.log("reberia restar "+S+" a "+b),new Error("Difference not supported yet")}function G(b){return new RegExp(b.replace(/#x([a-zA-Z0-9]{4})/g,"\\u$1").replace(/#x([a-zA-Z0-9]{3})/g,"\\u0$1").replace(/#x([a-zA-Z0-9]{2})/g,"\\x$1").replace(/#x([a-zA-Z0-9]{1})/g,"\\x0$1"))}function U(b,S,w){let R=null,D=[];return S.children.forEach((A,E)=>{A.type=="Minus"&&$(R,A);let O=S.children[E+1];O=O&&O.type=="PrimaryDecoration"&&O.text||"";let y="";switch(A.type){case"SubItem":let z="%"+(w+Z++);Y(b,A,z),D.push(y+z+O);break;case"NCName":case"StringLiteral":D.push(y+A.text+O);break;case"CharCode":case"CharClass":if(O||y){let te={name:"%"+(w+Z++),bnf:[[G(A.text)]]};b.push(te),D.push(y+te.name+O)}else D.push(G(A.text));break;case"PrimaryDecoration":break;default:throw new Error(" HOW SHOULD I PARSE THIS? "+A.type+" -> "+JSON.stringify(A.text))}R=A}),D}function Y(b,S,w){let R=S.children.filter(E=>E.type=="SequenceOrDifference").map(E=>U(b,E,w)),D={name:w,bnf:R},A=null;R.forEach(E=>{A=A||E.recover,delete E.recover}),w.indexOf("%")==0&&(D.fragment=!0),A&&(D.recover=A),b.push(D)}function ne(b,S=l.defaultParser){let w=S.getAST(b);if(!w)throw new Error("Could not parse "+b);if(w.errors&&w.errors.length)throw w.errors[0];let R=[];return w.children.filter(D=>D.type=="Production").map(D=>{let A=D.children.filter(E=>E.type=="NCName")[0].text;Y(R,D,A)}),R}l.getRules=ne;function oe(b,S=l.defaultParser){return ne(b.join(""),S)}l.Transform=oe;class M extends ni.Parser{constructor(S,w){const R=w&&w.debugRulesParser===!0?new ni.Parser(l.RULES,{debug:!0}):l.defaultParser;super(ne(S,R),w)}emitSource(){return X(this)}}l.Parser=M})(Ku||(Ku={}));es.default=Ku;var ts={};Object.defineProperty(ts,"__esModule",{value:!0});const to=Rr,_r=nt;var Vu;(function(l){l.RULES=[{name:"Grammar",bnf:[["RULE_S*","Attributes?","RULE_S*","%Atomic*","EOF"]]},{name:"%Atomic",bnf:[["Production","RULE_S*"]],fragment:!0},{name:"Production",bnf:[["NCName","RULE_S*",'"::="',"RULE_WHITESPACE*","%Choice","RULE_WHITESPACE*","Attributes?","RULE_EOL+","RULE_S*"]]},{name:"NCName",bnf:[[/[a-zA-Z][a-zA-Z_0-9]*/]]},{name:"Attributes",bnf:[['"{"',"Attribute","%Attributes*","RULE_S*",'"}"']]},{name:"%Attributes",bnf:[["RULE_S*",'","',"Attribute"]],fragment:!0},{name:"Attribute",bnf:[["RULE_S*","NCName","RULE_WHITESPACE*",'"="',"RULE_WHITESPACE*","AttributeValue"]]},{name:"AttributeValue",bnf:[["NCName"],[/[1-9][0-9]*/]]},{name:"%Choice",bnf:[["SequenceOrDifference","%_Choice_1*"]],fragment:!0},{name:"%_Choice_1",bnf:[["RULE_S*",'"|"',"RULE_S*","SequenceOrDifference"]],fragment:!0},{name:"SequenceOrDifference",bnf:[["%Item","RULE_WHITESPACE*","%_Item_1?"]]},{name:"%_Item_1",bnf:[["Minus","%Item"],["%Item*"]],fragment:!0},{name:"Minus",bnf:[['"-"']]},{name:"%Item",bnf:[["RULE_WHITESPACE*","PrimaryPreDecoration?","%Primary","PrimaryDecoration?"]],fragment:!0},{name:"PrimaryDecoration",bnf:[['"?"'],['"*"'],['"+"']]},{name:"PrimaryPreDecoration",bnf:[['"&"'],['"!"'],['"~"']]},{name:"%Primary",bnf:[["NCName"],["StringLiteral"],["CharCode"],["CharClass"],["SubItem"]],fragment:!0},{name:"SubItem",bnf:[['"("',"RULE_S*","%Choice","RULE_S*",'")"']]},{name:"StringLiteral",bnf:[[`'"'`,/[^"]*/,`'"'`],[`"'"`,/[^']*/,`"'"`]]},{name:"CharCode",bnf:[['"#x"',/[0-9a-zA-Z]+/]]},{name:"CharClass",bnf:[["'['","'^'?","%RULE_CharClass_1+",'"]"']]},{name:"%RULE_CharClass_1",bnf:[["CharCodeRange"],["CharRange"],["CharCode"],["RULE_Char"]],fragment:!0},{name:"RULE_Char",bnf:[[/\x09/],[/\x0A/],[/\x0D/],[/[\x20-\x5c]/],[/[\x5e-\uD7FF]/],[/[\uE000-\uFFFD]/]]},{name:"CharRange",bnf:[["RULE_Char",'"-"',"RULE_Char"]]},{name:"CharCodeRange",bnf:[["CharCode",'"-"',"CharCode"]]},{name:"RULE_WHITESPACE",bnf:[["%RULE_WHITESPACE_CHAR*"],["Comment","RULE_WHITESPACE*"]]},{name:"RULE_S",bnf:[["RULE_WHITESPACE","RULE_S*"],["RULE_EOL","RULE_S*"]]},{name:"%RULE_WHITESPACE_CHAR",bnf:[[/\x09/],[/\x20/]],fragment:!0},{name:"Comment",bnf:[['"/*"',"%RULE_Comment_Body*",'"*/"']]},{name:"%RULE_Comment_Body",bnf:[[/[^*]/],['"*"+',/[^/]*/]],fragment:!0},{name:"RULE_EOL",bnf:[[/\x0D/,/\x0A/],[/\x0A/],[/\x0D/]]},{name:"Link",bnf:[["'['","Url","']'"]]},{name:"Url",bnf:[[/[^\x5D:/?#]/,'"://"',/[^\x5D#]+/,"%Url1?"]]},{name:"%Url1",bnf:[['"#"',"NCName"]],fragment:!0}],l.defaultParser=new _r.Parser(l.RULES,{debug:!1});const d=/^(!|&)/,o=/(\?|\+|\*)$/,p=/^%/;function T(b,S){if(typeof b=="string"){let w=o.exec(b),R=d.exec(b),D=R?R[0]:"",A=w?w[0]+" ":"";return p.test(b)?x(b,S)?D+B(b,S)+A:D+"("+B(b,S)+")"+A:b.replace(d,D)}else return b.source.replace(/\\(?:x|u)([a-zA-Z0-9]+)/g,"#x$1").replace(/\[\\(?:x|u)([a-zA-Z0-9]+)-\\(?:x|u)([a-zA-Z0-9]+)\]/g,"[#x$1-#x$2]")}function x(b,S){let w=_r.findRuleByName(b,S);return w&&w.bnf.length==1&&w.bnf[0].length==1&&(w.bnf[0][0]instanceof RegExp||w.bnf[0][0][0]=='"'||w.bnf[0][0][0]=="'")}function k(b,S){return b.map(w=>T(w,S)).join(" ")}function B(b,S){let w=_r.findRuleByName(b,S);return w?w.bnf.map(R=>k(R,S)).join(" | "):"RULE_NOT_FOUND {"+b+"}"}function X(b){let S=[];return b.grammarRules.forEach(w=>{if(!/^%/.test(w.name)){let R=w.recover?" { recoverUntil="+w.recover+" }":"";S.push(w.name+" ::= "+B(w.name,b)+R)}}),S.join(`
`)}l.emit=X;let Z=0;function $(b,S){throw console.log("reberia restar "+S+" a "+b),new Error("Difference not supported yet")}function G(b){return new RegExp(b.replace(/#x([a-zA-Z0-9]{4})/g,"\\u$1").replace(/#x([a-zA-Z0-9]{3})/g,"\\u0$1").replace(/#x([a-zA-Z0-9]{2})/g,"\\x$1").replace(/#x([a-zA-Z0-9]{1})/g,"\\x0$1"))}function U(b,S,w,R){let D=null,A=[];return S.children.forEach((E,O)=>{E.type=="Minus"&&$(D,E);let y=S.children[O+1];y=y&&y.type=="PrimaryDecoration"&&y.text||"";let z="";D&&D.type=="PrimaryPreDecoration"&&(z=D.text);let te=z=="~"?1:void 0;switch(te&&(z=""),E.type){case"SubItem":let re="%"+(w+Z++);Y(b,E,re,R),A.push(z+re+y);break;case"NCName":A.push(z+E.text+y);break;case"StringLiteral":if(y||z||!/^['"/()a-zA-Z0-9&_.:=,+*\-\^\\]+$/.test(E.text))A.push(z+E.text+y);else for(const I of E.text.slice(1,-1))R&&R.ignoreCase=="true"&&/[a-zA-Z]/.test(I)?A.push(new RegExp("["+I.toUpperCase()+I.toLowerCase()+"]")):A.push(new RegExp(_r.escapeRegExp(I)));break;case"CharCode":case"CharClass":if(y||z){let I={name:"%"+(w+Z++),bnf:[[G(E.text)]],pinned:te};b.push(I),A.push(z+I.name+y)}else A.push(G(E.text));break;case"PrimaryPreDecoration":case"PrimaryDecoration":break;default:throw new Error(" HOW SHOULD I PARSE THIS? "+E.type+" -> "+JSON.stringify(E.text))}D=E}),A}function Y(b,S,w,R=void 0){let D=S.children.filter(y=>y.type=="Attributes")[0],A={};D&&D.children.forEach(y=>{let z=y.children.filter(te=>te.type=="NCName")[0].text;if(z in A)throw new to.TokenError("Duplicated attribute "+z,y);A[z]=y.children.filter(te=>te.type=="AttributeValue")[0].text});let E=S.children.filter(y=>y.type=="SequenceOrDifference").map(y=>U(b,y,w,R||A)),O={name:w,bnf:E};if(w.indexOf("%")==0&&(O.fragment=!0),A.recoverUntil&&(O.recover=A.recoverUntil,O.bnf.length>1))throw new to.TokenError("only one-option productions are suitable for error recovering",S);if("pin"in A){let y=parseInt(A.pin);if(isNaN(y)||(O.pinned=y),O.bnf.length>1)throw new to.TokenError("only one-option productions are suitable for pinning",S)}"ws"in A?O.implicitWs=A.ws!="explicit":O.implicitWs=null,O.fragment=O.fragment||A.fragment=="true",O.simplifyWhenOneChildren=A.simplifyWhenOneChildren=="true",b.push(O)}function ne(b,S=l.defaultParser){let w=S.getAST(b);if(!w)throw new Error("Could not parse "+b);if(w.errors&&w.errors.length)throw w.errors[0];let R=null,D=w.children.filter(O=>O.type=="Attributes")[0],A={};D&&D.children.forEach(O=>{let y=O.children.filter(z=>z.type=="NCName")[0].text;if(y in A)throw new to.TokenError("Duplicated attribute "+y,O);A[y]=O.children.filter(z=>z.type=="AttributeValue")[0].text}),R=A.ws=="implicit";let E=[];return w.children.filter(O=>O.type=="Production").map(O=>{let y=O.children.filter(z=>z.type=="NCName")[0].text;Y(E,O,y)}),E.forEach(O=>{O.implicitWs===null&&(O.implicitWs=R)}),E}l.getRules=ne;function oe(b,S=l.defaultParser){return ne(b.join(""),S)}l.Transform=oe;class M extends _r.Parser{constructor(S,w){const R=w&&w.debugRulesParser===!0?new _r.Parser(l.RULES,{debug:!0}):l.defaultParser;super(ne(S,R),w)}emitSource(){return X(this)}}l.Parser=M})(Vu||(Vu={}));ts.default=Vu;(function(l){Object.defineProperty(l,"__esModule",{value:!0});var d=ju;Object.defineProperty(l,"BNF",{enumerable:!0,get:function(){return d.default}});var o=es;Object.defineProperty(l,"W3C",{enumerable:!0,get:function(){return o.default}});var p=ts;Object.defineProperty(l,"Custom",{enumerable:!0,get:function(){return p.default}})})(Ja);(function(l){Object.defineProperty(l,"__esModule",{value:!0});var d=nt;Object.defineProperty(l,"Parser",{enumerable:!0,get:function(){return d.Parser}});var o=Rr;Object.defineProperty(l,"TokenError",{enumerable:!0,get:function(){return o.TokenError}}),l.Grammars=Ja})(qa);var Sa;function so(){return Sa||(Sa=1,function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.parseFormula=l.parseAndApply=l.Source=l.Formula=void 0;const d=qt,o=um(),p=Mt,T=sm(),x=io,k=Dt,B=vr,X=si,Z=li,$=Om(),G=qa,U=ui,Y=`
tblfm_line ::= "<!-- TBLFM: " formula_list " -->"
formula_list ::= formula ( "::" formula_list )?
formula ::= destination "=" source display_directive?
source ::= range | source_reference | single_param_function_call | conditional_function_call | algebraic_operation | float | real
range ::= source_reference ".." source_reference
source_reference ::= absolute_reference | relative_reference
destination ::= range | absolute_reference
relative_reference ::= (relative_row | absolute_row) (relative_column | absolute_column) | relative_row | relative_column
relative_row ::= "@" ( "-" | "+" ) int
relative_column ::= "$" ( "-" | "+" ) int
absolute_reference ::= absolute_row absolute_column | absolute_row | absolute_column
absolute_row ::= "@" ( "I" | "<" | ">" | int )
absolute_column ::= "$" ( "<" | ">" | int )
single_param_function_call ::= single_param_function "(" source ")"
single_param_function ::= "mean" | "sum"
conditional_function_call ::= "if(" predicate "," " "? source "," " "? source ")"
predicate ::= source_without_range conditional_operator source_without_range
source_without_range ::= source_reference | single_param_function_call | conditional_function_call | algebraic_operation | float | real
conditional_operator ::= ">" | "<" | ">=" | "<=" | "==" | "!="
algebraic_operation ::= "(" source " "? algebraic_operator " "? source ")"
algebraic_operator ::= "+" | "-" | "*" | "/"
display_directive ::= ";" display_directive_option
display_directive_option ::= formatting_directive | datetime_directive | hourminute_directive
formatting_directive ::= "%." int "f"
datetime_directive ::= "dt"
hourminute_directive ::= "hm"
float ::= "-"? int "." int
real ::= "-"? int
int ::= [0-9]+
`;class ne{constructor(R,D){this.merge=O=>this.destination.merge(this.source,O);let A=new B.DefaultFormatter;R.children.length===3&&(A=new B.DisplayDirective(R.children[2]));const E=(0,k.newDestination)(R.children[0],D,A);if(E.isErr())throw E.error;this.destination=E.value,this.source=new oe(R.children[1],D)}}l.Formula=ne;class oe{constructor(R,D){if(this.getValue=(O,y)=>this.locationDescriptor.getValue(O,y),R.type!=="source"&&R.type!=="source_without_range")throw Error("Invalid AST token type of "+R.type);if(R.children.length!==1)throw Error("Unexpected children length in Source");const A=R.children[0],E=M(A,D);if(E.isErr())throw E.error;this.locationDescriptor=E.value}}l.Source=oe;const M=(w,R)=>{try{switch(w.type){case"range":return(0,d.ok)(new X.Range(w,R));case"source_reference":const D=(0,p.checkChildLength)(w,1);return D?(0,d.err)(D):(0,d.ok)(new Z.Reference(w.children[0],R));case"single_param_function_call":return(0,d.ok)(new $.SingleParamFunctionCall(w,R));case"conditional_function_call":return(0,d.ok)(new T.ConditionalFunctionCall(w,R));case"algebraic_operation":return(0,d.ok)(new o.AlgebraicOperation(w,R));case"real":return(0,d.ok)(new x.Constant(w,R));case"float":return(0,d.ok)(new x.Constant(w,R));default:throw Error("Unrecognized valueProvider type "+w.type)}}catch(D){return(0,d.err)(D)}},b=(w,R)=>w.reduce((A,E)=>A.andThen(O=>{const y=(0,l.parseFormula)(E,R);return y.isErr()?y:(0,d.ok)((0,U.concat)(y.value,O))}),(0,d.ok)([])).andThen(A=>A.reduceRight((E,O)=>E.andThen(y=>O.merge(y)),(0,d.ok)(R)));l.parseAndApply=b;const S=(w,R)=>{const A=new G.Grammars.W3C.Parser(Y).getAST(w);if(!A)return(0,d.err)(new Error(`Formula '${w}' could not be parsed`));const E=(0,p.checkType)(A,"tblfm_line");if(E)return(0,d.err)(E);const O=(0,p.checkChildLength)(A,1);if(O)return(0,d.err)(O);let y=A.children[0].children;const z=[];try{do z.push(new ne(y[0],R)),y.length>1&&y[1].type==="formula_list"?y=y[1].children:y=[];while(y.length>0);return(0,d.ok)(z)}catch(te){return(0,d.err)(te)}};l.parseFormula=S}(Hu)),Hu}Object.defineProperty(Jn,"__esModule",{value:!0});Jn.Table=void 0;const Wm=so(),xa=br,no=Ar,Im=Er;class ns{constructor(d){this._rows=d.slice()}getHeight(){return this._rows.length}getWidth(){return this._rows.map(d=>d.getWidth()).reduce((d,o)=>Math.max(d,o),0)}getHeaderWidth(){return this._rows[0].getWidth()}getRows(){return this._rows.slice()}getDelimiterRow(){const d=this._rows[1];if(d!==void 0&&d.isDelimiter())return d}getCellAt(d,o){const p=this._rows[d];if(p!==void 0)return p.getCellAt(o)}getFocusedCell(d){return this.getCellAt(d.row,d.column)}toLines(){return this._rows.map(d=>d.toText())}setCellAt(d,o,p){const T=this.getRows();return T[d]=T[d].setCellAt(o,p),new ns(T)}focusOfPosition(d,o){const p=d.row-o,T=this._rows[p];if(T===void 0)return;if(d.column<T.marginLeft.length+1)return new xa.Focus(p,-1,d.column);const x=T.getCells().map(Z=>Z.rawContent.length);let k=T.marginLeft.length+1,B=0;for(;B<x.length&&!(k+x[B]+1>d.column);B++)k+=x[B]+1;const X=d.column-k;return new xa.Focus(p,B,X)}positionOfFocus(d,o){const p=this._rows[d.row];if(p===void 0)return;const T=d.row+o;if(d.column<0)return new no.Point(T,d.offset);const x=p.getCells().map(X=>X.rawContent.length),k=Math.min(d.column,x.length);let B=p.marginLeft.length+1;for(let X=0;X<k;X++)B+=x[X]+1;return new no.Point(T,B+d.offset)}selectionRangeOfFocus(d,o){const p=this._rows[d.row];if(p===void 0)return;const T=p.getCellAt(d.column);if(T===void 0||T.content==="")return;const x=d.row+o,k=p.getCells().map(X=>X.rawContent.length);let B=p.marginLeft.length+1;for(let X=0;X<d.column;X++)B+=k[X]+1;return B+=T.paddingLeft,new Im.Range(new no.Point(x,B),new no.Point(x,B+T.content.length))}applyFormulas(d){return(0,Wm.parseAndApply)(d,this)}}Jn.Table=ns;var rs={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.readTable=l._marginRegex=l.marginRegexSrc=l._readRow=l._splitCells=void 0;const d=Jn,o=yn,p=Yn,T=Z=>{const $=[];let G="",U=Z;for(;U!=="";)switch(U[0]){case"`":{const Y=U.match(/^`*/);if(Y===null)break;const ne=Y[0];let oe=ne,M=U.substr(ne.length),b=!1;for(;M!=="";)if(M[0]==="`"){const S=M.match(/^`*/);if(S===null)break;const w=S[0];if(oe+=w,M=M.substr(w.length),w.length===ne.length){b=!0;break}}else oe+=M[0],M=M.substr(1);b?(G+=oe,U=M):(G+="`",U=U.substr(1))}break;case"\\":U.length>=2?(G+=U.substr(0,2),U=U.substr(2)):(G+="\\",U=U.substr(1));break;case"[":if(G+="[",U=U.substr(1),/\[[^\\|\]]+\|[^|\]]+]]/.test(U)){const Y=U.indexOf("|");G+=U.slice(0,Y),G+="\\|",U=U.substr(Y+1)}break;case"|":$.push(G),G="",U=U.substr(1);break;default:G+=U[0],U=U.substr(1)}return $.push(G),$};l._splitCells=T;const x=(Z,$=/^\s*$/)=>{let G=(0,l._splitCells)(Z),U;G.length>0&&$.test(G[0])?(U=G[0],G=G.slice(1)):U="";let Y;return G.length>1&&/^\s*$/.test(G[G.length-1])?(Y=G[G.length-1],G=G.slice(0,G.length-1)):Y="",new p.TableRow(G.map(ne=>new o.TableCell(ne)),U,Y)};l._readRow=x;const k=Z=>{let $="";return Z.forEach(G=>{G!=="|"&&G!=="\\"&&G!=="`"&&($+=`\\u{${G.codePointAt(0).toString(16)}}`)}),`[\\s${$}]*`};l.marginRegexSrc=k;const B=Z=>new RegExp(`^${(0,l.marginRegexSrc)(Z)}$`,"u");l._marginRegex=B;const X=(Z,$)=>{const G=(0,l._marginRegex)($.leftMarginChars);return new d.Table(Z.map(U=>(0,l._readRow)(U,G)))};l.readTable=X})(rs);var lo={},qu=[[0,31,"N"],[32,126,"Na"],[127,160,"N"],[161,161,"A"],[162,163,"Na"],[164,164,"A"],[165,166,"Na"],[167,168,"A"],[169,169,"N"],[170,170,"A"],[171,171,"N"],[172,172,"Na"],[173,174,"A"],[175,175,"Na"],[176,180,"A"],[181,181,"N"],[182,186,"A"],[187,187,"N"],[188,191,"A"],[192,197,"N"],[198,198,"A"],[199,207,"N"],[208,208,"A"],[209,214,"N"],[215,216,"A"],[217,221,"N"],[222,225,"A"],[226,229,"N"],[230,230,"A"],[231,231,"N"],[232,234,"A"],[235,235,"N"],[236,237,"A"],[238,239,"N"],[240,240,"A"],[241,241,"N"],[242,243,"A"],[244,246,"N"],[247,250,"A"],[251,251,"N"],[252,252,"A"],[253,253,"N"],[254,254,"A"],[255,256,"N"],[257,257,"A"],[258,272,"N"],[273,273,"A"],[274,274,"N"],[275,275,"A"],[276,282,"N"],[283,283,"A"],[284,293,"N"],[294,295,"A"],[296,298,"N"],[299,299,"A"],[300,304,"N"],[305,307,"A"],[308,311,"N"],[312,312,"A"],[313,318,"N"],[319,322,"A"],[323,323,"N"],[324,324,"A"],[325,327,"N"],[328,331,"A"],[332,332,"N"],[333,333,"A"],[334,337,"N"],[338,339,"A"],[340,357,"N"],[358,359,"A"],[360,362,"N"],[363,363,"A"],[364,461,"N"],[462,462,"A"],[463,463,"N"],[464,464,"A"],[465,465,"N"],[466,466,"A"],[467,467,"N"],[468,468,"A"],[469,469,"N"],[470,470,"A"],[471,471,"N"],[472,472,"A"],[473,473,"N"],[474,474,"A"],[475,475,"N"],[476,476,"A"],[477,592,"N"],[593,593,"A"],[594,608,"N"],[609,609,"A"],[610,707,"N"],[708,708,"A"],[709,710,"N"],[711,711,"A"],[712,712,"N"],[713,715,"A"],[716,716,"N"],[717,717,"A"],[718,719,"N"],[720,720,"A"],[721,727,"N"],[728,731,"A"],[732,732,"N"],[733,733,"A"],[734,734,"N"],[735,735,"A"],[736,767,"N"],[768,879,"A"],[880,912,"N"],[913,929,"A"],[930,930,"N"],[931,937,"A"],[938,944,"N"],[945,961,"A"],[962,962,"N"],[963,969,"A"],[970,1024,"N"],[1025,1025,"A"],[1026,1039,"N"],[1040,1103,"A"],[1104,1104,"N"],[1105,1105,"A"],[1106,4351,"N"],[4352,4447,"W"],[4448,8207,"N"],[8208,8208,"A"],[8209,8210,"N"],[8211,8214,"A"],[8215,8215,"N"],[8216,8217,"A"],[8218,8219,"N"],[8220,8221,"A"],[8222,8223,"N"],[8224,8226,"A"],[8227,8227,"N"],[8228,8231,"A"],[8232,8239,"N"],[8240,8240,"A"],[8241,8241,"N"],[8242,8243,"A"],[8244,8244,"N"],[8245,8245,"A"],[8246,8250,"N"],[8251,8251,"A"],[8252,8253,"N"],[8254,8254,"A"],[8255,8307,"N"],[8308,8308,"A"],[8309,8318,"N"],[8319,8319,"A"],[8320,8320,"N"],[8321,8324,"A"],[8325,8360,"N"],[8361,8361,"H"],[8362,8363,"N"],[8364,8364,"A"],[8365,8450,"N"],[8451,8451,"A"],[8452,8452,"N"],[8453,8453,"A"],[8454,8456,"N"],[8457,8457,"A"],[8458,8466,"N"],[8467,8467,"A"],[8468,8469,"N"],[8470,8470,"A"],[8471,8480,"N"],[8481,8482,"A"],[8483,8485,"N"],[8486,8486,"A"],[8487,8490,"N"],[8491,8491,"A"],[8492,8530,"N"],[8531,8532,"A"],[8533,8538,"N"],[8539,8542,"A"],[8543,8543,"N"],[8544,8555,"A"],[8556,8559,"N"],[8560,8569,"A"],[8570,8584,"N"],[8585,8585,"A"],[8586,8591,"N"],[8592,8601,"A"],[8602,8631,"N"],[8632,8633,"A"],[8634,8657,"N"],[8658,8658,"A"],[8659,8659,"N"],[8660,8660,"A"],[8661,8678,"N"],[8679,8679,"A"],[8680,8703,"N"],[8704,8704,"A"],[8705,8705,"N"],[8706,8707,"A"],[8708,8710,"N"],[8711,8712,"A"],[8713,8714,"N"],[8715,8715,"A"],[8716,8718,"N"],[8719,8719,"A"],[8720,8720,"N"],[8721,8721,"A"],[8722,8724,"N"],[8725,8725,"A"],[8726,8729,"N"],[8730,8730,"A"],[8731,8732,"N"],[8733,8736,"A"],[8737,8738,"N"],[8739,8739,"A"],[8740,8740,"N"],[8741,8741,"A"],[8742,8742,"N"],[8743,8748,"A"],[8749,8749,"N"],[8750,8750,"A"],[8751,8755,"N"],[8756,8759,"A"],[8760,8763,"N"],[8764,8765,"A"],[8766,8775,"N"],[8776,8776,"A"],[8777,8779,"N"],[8780,8780,"A"],[8781,8785,"N"],[8786,8786,"A"],[8787,8799,"N"],[8800,8801,"A"],[8802,8803,"N"],[8804,8807,"A"],[8808,8809,"N"],[8810,8811,"A"],[8812,8813,"N"],[8814,8815,"A"],[8816,8833,"N"],[8834,8835,"A"],[8836,8837,"N"],[8838,8839,"A"],[8840,8852,"N"],[8853,8853,"A"],[8854,8856,"N"],[8857,8857,"A"],[8858,8868,"N"],[8869,8869,"A"],[8870,8894,"N"],[8895,8895,"A"],[8896,8977,"N"],[8978,8978,"A"],[8979,8985,"N"],[8986,8987,"W"],[8988,9e3,"N"],[9001,9002,"W"],[9003,9192,"N"],[9193,9196,"W"],[9197,9199,"N"],[9200,9200,"W"],[9201,9202,"N"],[9203,9203,"W"],[9204,9311,"N"],[9312,9449,"A"],[9450,9450,"N"],[9451,9547,"A"],[9548,9551,"N"],[9552,9587,"A"],[9588,9599,"N"],[9600,9615,"A"],[9616,9617,"N"],[9618,9621,"A"],[9622,9631,"N"],[9632,9633,"A"],[9634,9634,"N"],[9635,9641,"A"],[9642,9649,"N"],[9650,9651,"A"],[9652,9653,"N"],[9654,9655,"A"],[9656,9659,"N"],[9660,9661,"A"],[9662,9663,"N"],[9664,9665,"A"],[9666,9669,"N"],[9670,9672,"A"],[9673,9674,"N"],[9675,9675,"A"],[9676,9677,"N"],[9678,9681,"A"],[9682,9697,"N"],[9698,9701,"A"],[9702,9710,"N"],[9711,9711,"A"],[9712,9724,"N"],[9725,9726,"W"],[9727,9732,"N"],[9733,9734,"A"],[9735,9736,"N"],[9737,9737,"A"],[9738,9741,"N"],[9742,9743,"A"],[9744,9747,"N"],[9748,9749,"W"],[9750,9755,"N"],[9756,9756,"A"],[9757,9757,"N"],[9758,9758,"A"],[9759,9791,"N"],[9792,9792,"A"],[9793,9793,"N"],[9794,9794,"A"],[9795,9799,"N"],[9800,9811,"W"],[9812,9823,"N"],[9824,9825,"A"],[9826,9826,"N"],[9827,9829,"A"],[9830,9830,"N"],[9831,9834,"A"],[9835,9835,"N"],[9836,9837,"A"],[9838,9838,"N"],[9839,9839,"A"],[9840,9854,"N"],[9855,9855,"W"],[9856,9874,"N"],[9875,9875,"W"],[9876,9885,"N"],[9886,9887,"A"],[9888,9888,"N"],[9889,9889,"W"],[9890,9897,"N"],[9898,9899,"W"],[9900,9916,"N"],[9917,9918,"W"],[9919,9919,"A"],[9920,9923,"N"],[9924,9925,"W"],[9926,9933,"A"],[9934,9934,"W"],[9935,9939,"A"],[9940,9940,"W"],[9941,9953,"A"],[9954,9954,"N"],[9955,9955,"A"],[9956,9959,"N"],[9960,9961,"A"],[9962,9962,"W"],[9963,9969,"A"],[9970,9971,"W"],[9972,9972,"A"],[9973,9973,"W"],[9974,9977,"A"],[9978,9978,"W"],[9979,9980,"A"],[9981,9981,"W"],[9982,9983,"A"],[9984,9988,"N"],[9989,9989,"W"],[9990,9993,"N"],[9994,9995,"W"],[9996,10023,"N"],[10024,10024,"W"],[10025,10044,"N"],[10045,10045,"A"],[10046,10059,"N"],[10060,10060,"W"],[10061,10061,"N"],[10062,10062,"W"],[10063,10066,"N"],[10067,10069,"W"],[10070,10070,"N"],[10071,10071,"W"],[10072,10101,"N"],[10102,10111,"A"],[10112,10132,"N"],[10133,10135,"W"],[10136,10159,"N"],[10160,10160,"W"],[10161,10174,"N"],[10175,10175,"W"],[10176,10213,"N"],[10214,10221,"Na"],[10222,10628,"N"],[10629,10630,"Na"],[10631,11034,"N"],[11035,11036,"W"],[11037,11087,"N"],[11088,11088,"W"],[11089,11092,"N"],[11093,11093,"W"],[11094,11097,"A"],[11098,11903,"N"],[11904,11929,"W"],[11930,11930,"N"],[11931,12019,"W"],[12020,12031,"N"],[12032,12245,"W"],[12246,12271,"N"],[12272,12283,"W"],[12284,12287,"N"],[12288,12288,"F"],[12289,12350,"W"],[12351,12352,"N"],[12353,12438,"W"],[12439,12440,"N"],[12441,12543,"W"],[12544,12548,"N"],[12549,12591,"W"],[12592,12592,"N"],[12593,12686,"W"],[12687,12687,"N"],[12688,12771,"W"],[12772,12783,"N"],[12784,12830,"W"],[12831,12831,"N"],[12832,12871,"W"],[12872,12879,"A"],[12880,19903,"W"],[19904,19967,"N"],[19968,42124,"W"],[42125,42127,"N"],[42128,42182,"W"],[42183,43359,"N"],[43360,43388,"W"],[43389,44031,"N"],[44032,55203,"W"],[55204,57343,"N"],[57344,63743,"A"],[63744,64255,"W"],[64256,65023,"N"],[65024,65039,"A"],[65040,65049,"W"],[65050,65071,"N"],[65072,65106,"W"],[65107,65107,"N"],[65108,65126,"W"],[65127,65127,"N"],[65128,65131,"W"],[65132,65280,"N"],[65281,65376,"F"],[65377,65470,"H"],[65471,65473,"N"],[65474,65479,"H"],[65480,65481,"N"],[65482,65487,"H"],[65488,65489,"N"],[65490,65495,"H"],[65496,65497,"N"],[65498,65500,"H"],[65501,65503,"N"],[65504,65510,"F"],[65511,65511,"N"],[65512,65518,"H"],[65519,65532,"N"],[65533,65533,"A"],[65534,94175,"N"],[94176,94180,"W"],[94181,94191,"N"],[94192,94193,"W"],[94194,94207,"N"],[94208,100343,"W"],[100344,100351,"N"],[100352,101589,"W"],[101590,101631,"N"],[101632,101640,"W"],[101641,110591,"N"],[110592,110878,"W"],[110879,110927,"N"],[110928,110930,"W"],[110931,110947,"N"],[110948,110951,"W"],[110952,110959,"N"],[110960,111355,"W"],[111356,126979,"N"],[126980,126980,"W"],[126981,127182,"N"],[127183,127183,"W"],[127184,127231,"N"],[127232,127242,"A"],[127243,127247,"N"],[127248,127277,"A"],[127278,127279,"N"],[127280,127337,"A"],[127338,127343,"N"],[127344,127373,"A"],[127374,127374,"W"],[127375,127376,"A"],[127377,127386,"W"],[127387,127404,"A"],[127405,127487,"N"],[127488,127490,"W"],[127491,127503,"N"],[127504,127547,"W"],[127548,127551,"N"],[127552,127560,"W"],[127561,127567,"N"],[127568,127569,"W"],[127570,127583,"N"],[127584,127589,"W"],[127590,127743,"N"],[127744,127776,"W"],[127777,127788,"N"],[127789,127797,"W"],[127798,127798,"N"],[127799,127868,"W"],[127869,127869,"N"],[127870,127891,"W"],[127892,127903,"N"],[127904,127946,"W"],[127947,127950,"N"],[127951,127955,"W"],[127956,127967,"N"],[127968,127984,"W"],[127985,127987,"N"],[127988,127988,"W"],[127989,127991,"N"],[127992,128062,"W"],[128063,128063,"N"],[128064,128064,"W"],[128065,128065,"N"],[128066,128252,"W"],[128253,128254,"N"],[128255,128317,"W"],[128318,128330,"N"],[128331,128334,"W"],[128335,128335,"N"],[128336,128359,"W"],[128360,128377,"N"],[128378,128378,"W"],[128379,128404,"N"],[128405,128406,"W"],[128407,128419,"N"],[128420,128420,"W"],[128421,128506,"N"],[128507,128591,"W"],[128592,128639,"N"],[128640,128709,"W"],[128710,128715,"N"],[128716,128716,"W"],[128717,128719,"N"],[128720,128722,"W"],[128723,128724,"N"],[128725,128727,"W"],[128728,128746,"N"],[128747,128748,"W"],[128749,128755,"N"],[128756,128764,"W"],[128765,128991,"N"],[128992,129003,"W"],[129004,129291,"N"],[129292,129338,"W"],[129339,129339,"N"],[129340,129349,"W"],[129350,129350,"N"],[129351,129400,"W"],[129401,129401,"N"],[129402,129483,"W"],[129484,129484,"N"],[129485,129535,"W"],[129536,129647,"N"],[129648,129652,"W"],[129653,129655,"N"],[129656,129658,"W"],[129659,129663,"N"],[129664,129670,"W"],[129671,129679,"N"],[129680,129704,"W"],[129705,129711,"N"],[129712,129718,"W"],[129719,129727,"N"],[129728,129730,"W"],[129731,129743,"N"],[129744,129750,"W"],[129751,131071,"N"],[131072,196605,"W"],[196606,196607,"N"],[196608,262141,"W"],[262142,917759,"N"],[917760,917999,"A"],[918e3,983039,"N"],[983040,1048573,"A"],[1048574,1048575,"N"],[1048576,1114109,"A"],[1114110,1114111,"N"]],Fm="13.0.0";function Dm(l){for(var d=0,o=qu.length-1;d!==o;){var p=d+(o-d>>1),T=qu[p],x=T[0],k=T[1],B=T[2];if(l<x)o=p-1;else if(l>k)d=p+1;else return B}return qu[d][2]}function Xa(l,d){d===void 0&&(d=0);var o=l.codePointAt(d);if(o!==void 0)return Dm(o)}var Mm={N:1,Na:1,W:2,F:2,H:1,A:1};function Um(l,d){for(var o=0,p=0,T=l;p<T.length;p++){var x=T[p],k=Xa(x);o+=d&&d[k]||Mm[k]}return o}const km=Object.freeze(Object.defineProperty({__proto__:null,computeWidth:Um,eawVersion:Fm,getEAW:Xa},Symbol.toStringTag,{value:"Module"})),Hm=tm(km);(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.moveColumn=l.deleteColumn=l.insertColumn=l.moveRow=l.deleteRow=l.insertRow=l.alterAlignment=l.formatTable=l.FormatType=l._weakFormatTable=l._formatTable=l._padText=l._alignText=l._computeTextWidth=l.completeTable=l._extendArray=l._delimiterText=void 0;const d=Bt,o=Jn,p=yn,T=Yn,x=Hm,k=(E,O)=>{const y="-".repeat(O);switch(E){case d.Alignment.NONE:return` ${y} `;case d.Alignment.LEFT:return`:${y} `;case d.Alignment.RIGHT:return` ${y}:`;case d.Alignment.CENTER:return`:${y}:`;default:throw new Error("Unknown alignment: "+E)}};l._delimiterText=k;const B=(E,O,y)=>{const z=E.slice();for(let te=E.length;te<O;te++)z.push(y(te,E));return z};l._extendArray=B;const X=(E,O)=>{const y=E.getHeight(),z=E.getWidth();if(y===0)throw new Error("Empty table");const te=E.getRows(),re=[],I=te[0],ce=I.getCells();re.push(new T.TableRow((0,l._extendArray)(ce,z,Oe=>new p.TableCell(Oe===ce.length?I.marginRight:"")),I.marginLeft,ce.length<z?"":I.marginRight));const le=E.getDelimiterRow();if(le!==void 0){const Oe=le.getCells();re.push(new T.TableRow((0,l._extendArray)(Oe,z,me=>new p.TableCell((0,l._delimiterText)(d.Alignment.NONE,me===Oe.length?Math.max(O.minDelimiterWidth,le.marginRight.length-2):O.minDelimiterWidth))),le.marginLeft,Oe.length<z?"":le.marginRight))}else re.push(new T.TableRow((0,l._extendArray)([],z,()=>new p.TableCell((0,l._delimiterText)(d.Alignment.NONE,O.minDelimiterWidth))),"",""));for(let Oe=le!==void 0?2:1;Oe<y;Oe++){const me=te[Oe],Ce=me.getCells();re.push(new T.TableRow((0,l._extendArray)(Ce,z,ve=>new p.TableCell(ve===Ce.length?me.marginRight:"")),me.marginLeft,Ce.length<z?"":me.marginRight))}return{table:new o.Table(re),delimiterInserted:le===void 0}};l.completeTable=X;const Z=(E,O)=>{const y=O.normalize?E.normalize("NFC"):E;let z=0;for(const te of y){if(O.wideChars.has(te)){z+=2;continue}if(O.narrowChars.has(te)){z+=1;continue}switch((0,x.getEAW)(te)){case"F":case"W":z+=2;break;case"A":z+=O.ambiguousAsWide?2:1;break;default:z+=1}}return z};l._computeTextWidth=Z;const $=(E,O,y,z)=>{const te=O-(0,l._computeTextWidth)(E,z);if(te<0)return E;switch(y){case d.Alignment.NONE:throw new Error("Unexpected default alignment");case d.Alignment.LEFT:return E+" ".repeat(te);case d.Alignment.RIGHT:return" ".repeat(te)+E;case d.Alignment.CENTER:return" ".repeat(Math.floor(te/2))+E+" ".repeat(Math.ceil(te/2));default:throw new Error("Unknown alignment: "+y)}};l._alignText=$;const G=E=>` ${E} `;l._padText=G;const U=(E,O)=>{const y=E.getHeight(),z=E.getWidth();if(y===0)return{table:E,marginLeft:""};const te=E.getRows()[0].marginLeft;if(z===0){const me=new Array(y).fill(new T.TableRow([],te,""));return{table:new o.Table(me),marginLeft:te}}const re=E.getDelimiterRow(),I=new Array(z).fill(0);if(re!==void 0){const me=re.getWidth();for(let Ce=0;Ce<me;Ce++)I[Ce]=O.minDelimiterWidth}for(let me=0;me<y;me++){if(re!==void 0&&me===1)continue;const Ce=E.getRows()[me],ve=Ce.getWidth();for(let ie=0;ie<ve;ie++)I[ie]=Math.max(I[ie],(0,l._computeTextWidth)(Ce.getCellAt(ie).content,O.textWidthOptions))}const ce=re!==void 0?(0,l._extendArray)(re.getCells().map(me=>me.getAlignment()),z,()=>O.defaultAlignment):new Array(z).fill(O.defaultAlignment),le=[],Oe=E.getRows()[0];le.push(new T.TableRow(Oe.getCells().map((me,Ce)=>new p.TableCell((0,l._padText)((0,l._alignText)(me.content,I[Ce],O.headerAlignment===d.HeaderAlignment.FOLLOW?ce[Ce]===d.Alignment.NONE?O.defaultAlignment:ce[Ce]:O.headerAlignment,O.textWidthOptions)))),te,"")),re!==void 0&&le.push(new T.TableRow(re.getCells().map((me,Ce)=>new p.TableCell((0,l._delimiterText)(ce[Ce],I[Ce]))),te,""));for(let me=re!==void 0?2:1;me<y;me++){const Ce=E.getRows()[me];le.push(new T.TableRow(Ce.getCells().map((ve,ie)=>new p.TableCell((0,l._padText)((0,l._alignText)(ve.content,I[ie],ce[ie]===d.Alignment.NONE?O.defaultAlignment:ce[ie],O.textWidthOptions)))),te,""))}return{table:new o.Table(le),marginLeft:te}};l._formatTable=U;const Y=(E,O)=>{const y=E.getHeight(),z=E.getWidth();if(y===0)return{table:E,marginLeft:""};const te=E.getRows()[0].marginLeft;if(z===0){const le=new Array(y).fill(new T.TableRow([],te,""));return{table:new o.Table(le),marginLeft:te}}const re=E.getDelimiterRow(),I=[],ce=E.getRows()[0];I.push(new T.TableRow(ce.getCells().map(le=>new p.TableCell((0,l._padText)(le.content))),te,"")),re!==void 0&&I.push(new T.TableRow(re.getCells().map(le=>new p.TableCell((0,l._delimiterText)(le.getAlignment(),O.minDelimiterWidth))),te,""));for(let le=re!==void 0?2:1;le<y;le++){const Oe=E.getRows()[le];I.push(new T.TableRow(Oe.getCells().map(me=>new p.TableCell((0,l._padText)(me.content))),te,""))}return{table:new o.Table(I),marginLeft:te}};l._weakFormatTable=Y;var ne;(function(E){E.NORMAL="normal",E.WEAK="weak"})(ne||(l.FormatType=ne={}));const oe=(E,O)=>{switch(O.formatType){case ne.NORMAL:return(0,l._formatTable)(E,O);case ne.WEAK:return(0,l._weakFormatTable)(E,O);default:throw new Error("Unknown format type: "+O.formatType)}};l.formatTable=oe;const M=(E,O,y,z)=>{if(E.getHeight()<1)return E;const te=E.getRows()[1];if(O<0||te.getWidth()-1<O)return E;const re=te.getCells();re[O]=new p.TableCell((0,l._delimiterText)(y,z.minDelimiterWidth));const I=E.getRows();return I[1]=new T.TableRow(re,te.marginLeft,te.marginRight),new o.Table(I)};l.alterAlignment=M;const b=(E,O,y)=>{const z=E.getRows();return z.splice(Math.max(O,2),0,y),new o.Table(z)};l.insertRow=b;const S=(E,O)=>{if(O===1)return E;const y=E.getRows();if(O===0){const z=y[0];y[0]=new T.TableRow(new Array(z.getWidth()).fill(new p.TableCell("")),z.marginLeft,z.marginRight)}else y.splice(O,1);return new o.Table(y)};l.deleteRow=S;const w=(E,O,y)=>{if(O<=1||y<=1||O===y)return E;const z=E.getRows(),te=z[O];return z.splice(O,1),z.splice(y,0,te),new o.Table(z)};l.moveRow=w;const R=(E,O,y,z)=>{const te=E.getRows();for(let re=0;re<te.length;re++){const I=te[re],ce=te[re].getCells(),le=re===1?new p.TableCell((0,l._delimiterText)(d.Alignment.NONE,z.minDelimiterWidth)):y[re>1?re-1:re];ce.splice(O,0,le),te[re]=new T.TableRow(ce,I.marginLeft,I.marginRight)}return new o.Table(te)};l.insertColumn=R;const D=(E,O,y)=>{const z=E.getRows();for(let te=0;te<z.length;te++){const re=z[te];let I=re.getCells();I.length<=1?I=[new p.TableCell(te===1?(0,l._delimiterText)(d.Alignment.NONE,y.minDelimiterWidth):"")]:I.splice(O,1),z[te]=new T.TableRow(I,re.marginLeft,re.marginRight)}return new o.Table(z)};l.deleteColumn=D;const A=(E,O,y)=>{if(O===y)return E;const z=E.getRows();for(let te=0;te<z.length;te++){const re=z[te],I=re.getCells(),ce=I[O];I.splice(O,1),I.splice(y,0,ce),z[te]=new T.TableRow(I,re.marginLeft,re.marginRight)}return new o.Table(z)};l.moveColumn=A})(lo);var is={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.shortestEditScript=l.applyEditScript=l._applyCommand=l.Delete=l.Insert=void 0;class d{constructor($,G){this.row=$,this.line=G}}l.Insert=d;class o{constructor($){this.row=$}}l.Delete=o;const p=(Z,$,G)=>{if($ instanceof d)Z.insertLine(G+$.row,$.line);else if($ instanceof o)Z.deleteLine(G+$.row);else throw new Error("Unknown command")};l._applyCommand=p;const T=(Z,$,G)=>{for(const U of $)(0,l._applyCommand)(Z,U,G)};l.applyEditScript=T;class x{get car(){throw new Error("Not implemented")}get cdr(){throw new Error("Not implemented")}isEmpty(){throw new Error("Not implemented")}unshift($){return new B($,this)}toArray(){const $=[];let G=this;for(;!G.isEmpty();)$.push(G.car),G=G.cdr;return $}}class k extends x{constructor(){super()}get car(){throw new Error("Empty list")}get cdr(){throw new Error("Empty list")}isEmpty(){return!0}}class B extends x{constructor($,G){super(),this._car=$,this._cdr=G}get car(){return this._car}get cdr(){return this._cdr}isEmpty(){return!1}}const X=(Z,$,G=-1)=>{const U=Z.length,Y=$.length,ne=G>=0?Math.min(G,U+Y):U+Y,oe=new Array(Math.min(ne,U)+Math.min(ne,Y)+1),M=Math.min(ne,U);for(let b=0;b<=ne;b++){const S=b<=U?-b:b-2*U,w=b<=Y?b:-b+2*Y;for(let R=S;R<=w;R+=2){let D,A;if(b===0)D=0,A=new k;else if(R===-b)D=oe[M+R+1].i+1,A=oe[M+R+1].script.unshift(new o(D+R));else if(R===b)D=oe[M+R-1].i,A=oe[M+R-1].script.unshift(new d(D+R-1,$[D+R-1]));else{const E=oe[M+R+1].i+1,O=oe[M+R-1].i;E>O?(D=E,A=oe[M+R+1].script.unshift(new o(D+R))):(D=O,A=oe[M+R-1].script.unshift(new d(D+R-1,$[D+R-1])))}for(;D<U&&D+R<Y&&Z[D]===$[D+R];)D+=1;if(R===Y-U&&D===U)return A.toArray().reverse();oe[M+R]={i:D,script:A}}}};l.shortestEditScript=X})(is);var ao={};Object.defineProperty(ao,"__esModule",{value:!0});ao.ITextEditor=void 0;class $m{getCursorPosition(){throw new Error("Not implemented: getCursorPosition")}setCursorPosition(d){throw new Error("Not implemented: setCursorPosition")}setSelectionRange(d){throw new Error("Not implemented: setSelectionRange")}getLastRow(){throw new Error("Not implemented: getLastRow")}acceptsTableEdit(d){throw new Error("Not implemented: acceptsTableEdit")}getLine(d){throw new Error("Not implemented: getLine")}insertLine(d,o){throw new Error("Not implemented: insertLine")}deleteLine(d){throw new Error("Not implemented: deleteLine")}replaceLines(d,o,p){throw new Error("Not implemented: replaceLines")}transact(d){throw new Error("Not implemented: transact")}}ao.ITextEditor=$m;var Qa={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.defaultOptions=l.optionsWithDefaults=void 0;const d=Bt,o=lo,p={normalize:!0,wideChars:new Set,narrowChars:new Set,ambiguousAsWide:!1},T={leftMarginChars:new Set,formatType:o.FormatType.NORMAL,minDelimiterWidth:3,defaultAlignment:d.DefaultAlignment.LEFT,headerAlignment:d.HeaderAlignment.FOLLOW,smartCursor:!1},x=k=>Object.assign(Object.assign(Object.assign({},T),k),{textWidthOptions:k.textWidthOptions?Object.assign(Object.assign({},p),k.textWidthOptions):p});l.optionsWithDefaults=x,l.defaultOptions=(0,l.optionsWithDefaults)({})})(Qa);var ja={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.TableEditor=l._computeNewOffset=l._createIsTableFormulaRegex=l._createIsTableRowRegex=l.SortOrder=void 0;const d=is,o=br,p=lo,T=rs,x=Ar,k=Er,B=Jn,X=yn,Z=Yn;var $;(function(oe){oe.Ascending="ascending",oe.Descending="descending"})($||(l.SortOrder=$={}));const G=oe=>new RegExp(`^${(0,T.marginRegexSrc)(oe)}\\|`,"u");l._createIsTableRowRegex=G;const U=oe=>new RegExp(`^${(0,T.marginRegexSrc)(oe)}<!-- ?.+-->$`,"u");l._createIsTableFormulaRegex=U;const Y=(oe,M,b,S)=>{if(S){const D=b.table.getFocusedCell(oe);return D!==void 0?D.computeRawOffset(0):oe.column<0?b.marginLeft.length:0}const w=M.getFocusedCell(oe),R=b.table.getFocusedCell(oe);if(w!==void 0&&R!==void 0){const D=Math.min(w.computeContentOffset(oe.offset),R.content.length);return R.computeRawOffset(D)}return oe.column<0?b.marginLeft.length:0};l._computeNewOffset=Y;class ne{constructor(M){this._textEditor=M,this._scActive=!1}resetSmartCursor(){this._scActive=!1}cursorIsInTable(M){const b=(0,l._createIsTableRowRegex)(M.leftMarginChars),S=this._textEditor.getCursorPosition();return this._textEditor.acceptsTableEdit(S.row)&&b.test(this._textEditor.getLine(S.row))}cursorIsInTableFormula(M){const b=(0,l._createIsTableFormulaRegex)(M.leftMarginChars),S=this._textEditor.getCursorPosition();return this._textEditor.acceptsTableEdit(S.row)&&b.test(this._textEditor.getLine(S.row))}_findTable(M){const b=(0,l._createIsTableRowRegex)(M.leftMarginChars),S=(0,l._createIsTableFormulaRegex)(M.leftMarginChars);let w=this._textEditor.getCursorPosition();const R=this._textEditor.getLastRow(),D=[],A=[];let E=w.row,O=w.row;{let re=this._textEditor.getLine(w.row);for(;S.test(re)&&w.row>=0;)w=new x.Point(w.row-1,w.column),O--,re=this._textEditor.getLine(w.row)}{const re=this._textEditor.getLine(w.row);if(!this._textEditor.acceptsTableEdit(w.row)||!b.test(re))return;D.push(re)}for(let re=w.row-1;re>=0;re--){const I=this._textEditor.getLine(re);if(!this._textEditor.acceptsTableEdit(re)||!b.test(I))break;D.unshift(I),E=re}for(let re=w.row+1;re<=R;re++){const I=this._textEditor.getLine(re);if(!this._textEditor.acceptsTableEdit(re)||!b.test(I))break;D.push(I),O=re}for(let re=O+1;re<=R;re++){const I=this._textEditor.getLine(re);if(!this._textEditor.acceptsTableEdit(re)||!S.test(I))break;A.push(I)}const y=new k.Range(new x.Point(E,0),new x.Point(O,D[D.length-1].length)),z=(0,T.readTable)(D,M),te=z.focusOfPosition(w,E);if(te!==void 0)return{range:y,lines:D,formulaLines:A,table:z,focus:te}}_withTable(M,b){const S=this._findTable(M);if(S!==void 0)return b(S)}_updateLines(M,b,S,w=void 0){if(w!==void 0){const R=(0,d.shortestEditScript)(w,S,3);if(R!==void 0){(0,d.applyEditScript)(this._textEditor,R,M);return}}this._textEditor.replaceLines(M,b,S)}_moveToFocus(M,b,S){const w=b.positionOfFocus(S,M);w!==void 0&&this._textEditor.setCursorPosition(w)}_selectFocus(M,b,S){const w=b.selectionRangeOfFocus(S,M);w!==void 0?this._textEditor.setSelectionRange(w):this._moveToFocus(M,b,S)}format(M){this.withCompletedTable(M,({range:b,lines:S,table:w,focus:R})=>{const D=R;this._textEditor.transact(()=>{this._updateLines(b.start.row,b.end.row+1,w.toLines(),S),this._moveToFocus(b.start.row,w,D)})})}escape(M){this._withTable(M,({range:b,lines:S,table:w,focus:R})=>{const D=(0,p.completeTable)(w,M),A=(0,p.formatTable)(D.table,M),E=b.end.row+(D.delimiterInserted?2:1);this._textEditor.transact(()=>{this._updateLines(b.start.row,b.end.row+1,A.table.toLines(),S);let O;if(E>this._textEditor.getLastRow())this._textEditor.insertLine(E,""),O=new x.Point(E,0);else{const y=new RegExp(`^${(0,T.marginRegexSrc)(M.leftMarginChars)}`,"u"),z=this._textEditor.getLine(E),te=y.exec(z)[0];O=new x.Point(E,te.length)}this._textEditor.setCursorPosition(O)}),this.resetSmartCursor()})}alignColumn(M,b){this.withCompletedTable(b,({range:S,lines:w,table:R,focus:D})=>{let A=D,E=R;0<=A.column&&A.column<=E.getHeaderWidth()-1&&(E=(0,p.alterAlignment)(R,A.column,M,b));const O=(0,p.formatTable)(E,b);A=A.setOffset((0,l._computeNewOffset)(A,R,O,!1)),this._textEditor.transact(()=>{this._updateLines(S.start.row,S.end.row+1,O.table.toLines(),w),this._moveToFocus(S.start.row,O.table,A)})})}selectCell(M){this.withCompletedTable(M,({range:b,lines:S,table:w,focus:R})=>{const D=R;this._textEditor.transact(()=>{this._updateLines(b.start.row,b.end.row+1,w.toLines(),S),this._selectFocus(b.start.row,w,D)})})}moveFocus(M,b,S){this.withCompletedTable(S,({range:w,lines:R,table:D,focus:A})=>{let E=A;const O=E;if(M!==0){const te=D.getHeight(),re=E.row<1&&E.row+M>=1?1:E.row>1&&E.row+M<=1?-1:0;E=E.setRow(Math.min(Math.max(E.row+M+re,0),te<=2?0:te-1))}if(b!==0){const te=D.getHeaderWidth();!(E.column<0&&b<0)&&!(E.column>te-1&&b>0)&&(E=E.setColumn(Math.min(Math.max(E.column+b,0),te-1)))}const y=!E.posEquals(O),z=(0,p.formatTable)(D,S);E=E.setOffset((0,l._computeNewOffset)(E,D,z,y)),this._textEditor.transact(()=>{this._updateLines(w.start.row,w.end.row+1,z.table.toLines(),R),y?this._selectFocus(w.start.row,z.table,E):this._moveToFocus(w.start.row,z.table,E)}),y&&this.resetSmartCursor()})}nextCell(M){this._withTable(M,({range:b,lines:S,table:w,focus:R})=>{const D=this._scTablePos!==void 0&&!b.start.equals(this._scTablePos)||this._scLastFocus!==void 0&&!R.posEquals(this._scLastFocus);this._scActive&&D&&this.resetSmartCursor();let A=R;const E=(0,p.completeTable)(w,M);E.delimiterInserted&&A.row>0&&(A=A.setRow(A.row+1));const O=A;let y=E.table;if(A.row===1){if(A=A.setRow(2),M.smartCursor?(A.column<0||y.getHeaderWidth()-1<A.column)&&(A=A.setColumn(0)):A=A.setColumn(0),A.row>y.getHeight()-1){const re=new Array(y.getHeaderWidth()).fill(new X.TableCell(""));y=(0,p.insertRow)(y,y.getHeight(),new Z.TableRow(re,"",""))}}else{if(A.column>y.getHeaderWidth()-1){const re=new Array(y.getHeight()-1).fill(new X.TableCell(""));y=(0,p.insertColumn)(y,y.getHeaderWidth(),re,M)}A=A.setColumn(A.column+1)}const z=(0,p.formatTable)(y,M);A=A.setOffset((0,l._computeNewOffset)(A,y,z,!0));const te=z.table.toLines();A.column>z.table.getHeaderWidth()-1&&(te[A.row]+=" ",A=A.setOffset(1)),this._textEditor.transact(()=>{this._updateLines(b.start.row,b.end.row+1,te,S),this._selectFocus(b.start.row,z.table,A)}),M.smartCursor&&(this._scActive||(this._scActive=!0,this._scTablePos=b.start,O.column<0||z.table.getHeaderWidth()-1<O.column?this._scStartFocus=new o.Focus(O.row,0,0):this._scStartFocus=O),this._scLastFocus=A)})}previousCell(M){this.withCompletedTable(M,({range:b,lines:S,table:w,focus:R})=>{let D=R;const A=D;D.row===0?D.column>0&&(D=D.setColumn(D.column-1)):D.row===1?D=new o.Focus(0,w.getHeaderWidth()-1,D.offset):D.column>0?D=D.setColumn(D.column-1):D=new o.Focus(D.row===2?0:D.row-1,w.getHeaderWidth()-1,D.offset);const E=!D.posEquals(A),O=(0,p.formatTable)(w,M);D=D.setOffset((0,l._computeNewOffset)(D,w,O,E)),this._textEditor.transact(()=>{this._updateLines(b.start.row,b.end.row+1,O.table.toLines(),S),E?this._selectFocus(b.start.row,O.table,D):this._moveToFocus(b.start.row,O.table,D)}),E&&this.resetSmartCursor()})}nextRow(M){this._withTable(M,({range:b,lines:S,table:w,focus:R})=>{const D=this._scTablePos!==void 0&&!b.start.equals(this._scTablePos)||this._scLastFocus!==void 0&&!R.posEquals(this._scLastFocus);this._scActive&&D&&this.resetSmartCursor();let A=R;const E=(0,p.completeTable)(w,M);E.delimiterInserted&&A.row>0&&(A=A.setRow(A.row+1));const O=A;let y=E.table;if(A.row===0?A=A.setRow(2):A=A.setRow(A.row+1),M.smartCursor?this._scActive&&this._scStartFocus!==void 0?A=A.setColumn(this._scStartFocus.column):(A.column<0||y.getHeaderWidth()-1<A.column)&&(A=A.setColumn(0)):A=A.setColumn(0),A.row>y.getHeight()-1){const te=new Array(y.getHeaderWidth()).fill(new X.TableCell(""));y=(0,p.insertRow)(y,y.getHeight(),new Z.TableRow(te,"",""))}const z=(0,p.formatTable)(y,M);A=A.setOffset((0,l._computeNewOffset)(A,y,z,!0)),this._textEditor.transact(()=>{this._updateLines(b.start.row,b.end.row+1,z.table.toLines(),S),this._selectFocus(b.start.row,z.table,A)}),M.smartCursor&&(this._scActive||(this._scActive=!0,this._scTablePos=b.start,O.column<0||z.table.getHeaderWidth()-1<O.column?this._scStartFocus=new o.Focus(O.row,0,0):this._scStartFocus=O),this._scLastFocus=A)})}insertRow(M){this.withCompletedTable(M,({range:b,lines:S,formulaLines:w,table:R,focus:D})=>{let A=D;A.row<=1&&(A=A.setRow(2)),A=A.setColumn(0);const E=new Array(R.getHeaderWidth()).fill(new X.TableCell("")),O=(0,p.insertRow)(R,A.row,new Z.TableRow(E,"",""));this.formatAndApply(M,b,S,w,O,A)})}deleteRow(M){this.withCompletedTable(M,({range:b,lines:S,formulaLines:w,table:R,focus:D})=>{let A=D,E=R,O=!1;A.row!==1&&(E=(0,p.deleteRow)(E,A.row),O=!0,A.row>E.getHeight()-1&&(A=A.setRow(A.row===2?0:A.row-1))),this.formatAndApply(M,b,S,w,E,A,O)})}moveRow(M,b){this.withCompletedTable(b,({range:S,lines:w,formulaLines:R,table:D,focus:A})=>{let E=A,O=D;if(E.row>1){const y=Math.min(Math.max(E.row+M,2),O.getHeight()-1);O=(0,p.moveRow)(O,E.row,y),E=E.setRow(y)}this.formatAndApply(b,S,w,R,O,E)})}evaluateFormulas(M){return this.withCompletedTable(M,({range:b,lines:S,formulaLines:w,table:R,focus:D})=>{const A=R.applyFormulas(w);if(A.isErr())return A.error;this.formatAndApply(M,b,S,w,A.value,D,!1)})}transpose(M){this.withCompletedTable(M,({range:b,lines:S,formulaLines:w,table:R,focus:D})=>{var A,E,O,y,z,te,re,I;const ce=R.getWidth(),le=R.getHeight(),Oe=new Array(ce+1);for(let ie=0;ie<ce+1;++ie)if(ie===0){const Se=new Array(le-1);for(let Pe=0;Pe<le;++Pe)if(Pe===0){const ut=(E=(A=R.getCellAt(Pe,ie))===null||A===void 0?void 0:A.content)!==null&&E!==void 0?E:"";Se[Pe]=new X.TableCell(ut)}else{if(Pe===1)continue;if(Pe>1){const ut=(y=(O=R.getCellAt(Pe,ie))===null||O===void 0?void 0:O.content)!==null&&y!==void 0?y:"";Se[Pe-1]=new X.TableCell(ut)}}Oe[ie]=new Z.TableRow(Se,"","")}else if(ie===1){const Se=new Array(le-1);for(let Pe=0;Pe<le-1;++Pe)Se[Pe]=new X.TableCell(" --- ");Oe[ie]=new Z.TableRow(Se,"","");continue}else if(ie>1){const Se=new Array(le-1);for(let Pe=0;Pe<le;++Pe)if(Pe===0){const ut=(te=(z=R.getCellAt(Pe,ie-1))===null||z===void 0?void 0:z.content)!==null&&te!==void 0?te:"";Se[Pe]=new X.TableCell(ut)}else{if(Pe===1)continue;if(Pe>1){const ut=(I=(re=R.getCellAt(Pe,ie-1))===null||re===void 0?void 0:re.content)!==null&&I!==void 0?I:"";Se[Pe-1]=new X.TableCell(ut)}}Oe[ie]=new Z.TableRow(Se,"","")}const me=new B.Table(Oe),{table:Ce,focus:ve}=this.formatAndApply(M,b,S,w,me,D,!0);this._moveToFocus(b.start.row,Ce,ve)})}sortRows(M,b){this.withCompletedTable(b,({range:S,lines:w,formulaLines:R,table:D,focus:A})=>{const E=D.getRows().slice(2),O=ce=>/^\s*[-+]?((\d+(\.\d+)?)|(\d+\.)|(\.\d+))([eE][-+]?\d+)?\s*$/.test(ce),y=E.map(ce=>{var le;return(le=ce.getCellAt(A.column))===null||le===void 0?void 0:le.content}).some(ce=>ce!==void 0&&ce!==""&&!O(ce));E.sort((ce,le)=>{const Oe=ce.getCellAt(A.column),me=le.getCellAt(A.column);if(Oe===void 0||Oe.content==="")return me===void 0||me.content===""?0:-1;if(me===void 0||me.content==="")return 1;const Ce=y?Oe.content.replace(/[*~_$]/g,""):parseFloat(Oe.content),ve=y?me.content.replace(/[*~_$]/g,""):parseFloat(me.content);return Ce===ve?0:Ce===void 0?-1:ve===void 0?1:Ce<ve?-1:1}),M===$.Descending&&E.reverse();const z=D.getRows().slice(0,2).concat(E),te=new B.Table(z),{table:re,focus:I}=this.formatAndApply(b,S,w,R,te,A,!0);this._moveToFocus(S.start.row,re,I)})}insertColumn(M){this.withCompletedTable(M,({range:b,lines:S,formulaLines:w,table:R,focus:D})=>{let A=D;A.row===1&&(A=A.setRow(0)),A.column<0&&(A=A.setColumn(0));const E=new Array(R.getHeight()-1).fill(new X.TableCell("")),O=(0,p.insertColumn)(R,A.column,E,M);this.formatAndApply(M,b,S,w,O,A)})}deleteColumn(M){this.withCompletedTable(M,({range:b,lines:S,formulaLines:w,table:R,focus:D})=>{let A=D;A.row===1&&(A=A.setRow(0));let E=R,O=!1;0<=A.column&&A.column<=E.getHeaderWidth()-1&&(E=(0,p.deleteColumn)(R,A.column,M),O=!0,A.column>E.getHeaderWidth()-1&&(A=A.setColumn(E.getHeaderWidth()-1))),this.formatAndApply(M,b,S,w,E,A,O)})}moveColumn(M,b){this.withCompletedTable(b,({range:S,lines:w,formulaLines:R,table:D,focus:A})=>{let E=A,O=D;if(0<=E.column&&E.column<=O.getHeaderWidth()-1){const y=Math.min(Math.max(E.column+M,0),O.getHeaderWidth()-1);O=(0,p.moveColumn)(O,E.column,y),E=E.setColumn(y)}this.formatAndApply(b,S,w,R,O,E)})}formatAll(M){this._textEditor.transact(()=>{const b=(0,l._createIsTableRowRegex)(M.leftMarginChars);let S=this._textEditor.getCursorPosition(),w=[],R,D=this._textEditor.getLastRow();for(let A=0;A<=D;A++){const E=this._textEditor.getLine(A);if(this._textEditor.acceptsTableEdit(A)&&b.test(E))w.push(E),R===void 0&&(R=A);else if(R!==void 0){const O=A-1,y=new k.Range(new x.Point(R,0),new x.Point(O,w[w.length-1].length)),z=(0,T.readTable)(w,M),te=z.focusOfPosition(S,R);let re;if(te!==void 0){let I=te;const ce=(0,p.completeTable)(z,M);ce.delimiterInserted&&I.row>0&&(I=I.setRow(I.row+1));const le=(0,p.formatTable)(ce.table,M);I=I.setOffset((0,l._computeNewOffset)(I,ce.table,le,!1));const Oe=le.table.toLines();this._updateLines(y.start.row,y.end.row+1,Oe,w),re=Oe.length-w.length,S=le.table.positionOfFocus(I,R)}else{const I=(0,p.completeTable)(z,M),le=(0,p.formatTable)(I.table,M).table.toLines();this._updateLines(y.start.row,y.end.row+1,le,w),re=le.length-w.length,S.row>O&&(S=new x.Point(S.row+re,S.column))}w=[],R=void 0,D+=re,A+=re}}if(R!==void 0){const A=D,E=new k.Range(new x.Point(R,0),new x.Point(A,w[w.length-1].length)),O=(0,T.readTable)(w,M);let z=O.focusOfPosition(S,R);const te=(0,p.completeTable)(O,M);te.delimiterInserted&&z.row>0&&(z=z.setRow(z.row+1));const re=(0,p.formatTable)(te.table,M);z=z.setOffset((0,l._computeNewOffset)(z,te.table,re,!1));const I=re.table.toLines();this._updateLines(E.start.row,E.end.row+1,I,w),S=re.table.positionOfFocus(z,R)}this._textEditor.setCursorPosition(S)})}exportTable(M,b){return this.withCompletedTable(b,({range:S,lines:w,formulaLines:R,table:D,focus:A})=>{const E=D.getRows();return E.length>0&&!M&&E.splice(0,2),E.map(O=>O.getCells().map(y=>y.content))})}exportCSV(M,b){const S=this.exportTable(M,b);return S?S.map(w=>w.join(" ")).join(`
`):void 0}withCompletedTable(M,b){return this._withTable(M,S=>{let w=S.focus;const R=(0,p.completeTable)(S.table,M);R.delimiterInserted&&w.row>0&&(w=w.setRow(w.row+1));const D=(0,p.formatTable)(R.table,M);return w=w.setOffset((0,l._computeNewOffset)(w,R.table,D,!1)),S.table=D.table,S.focus=w,b(S)})}formatAndApply(M,b,S,w,R,D,A=!1){const E=(0,p.formatTable)(R,M);return D=D.setOffset((0,l._computeNewOffset)(D,R,E,A)),this._textEditor.transact(()=>{this._updateLines(b.start.row,b.end.row+1,E.table.toLines(),S),A?this._selectFocus(b.start.row,E.table,D):this._moveToFocus(b.start.row,E.table,D)}),this.resetSmartCursor(),{range:b,lines:S,formulaLines:w,table:E.table,focus:D}}}l.TableEditor=ne})(ja);(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.SortOrder=l.TableEditor=l.optionsWithDefaults=l.defaultOptions=l.ITextEditor=l.shortestEditScript=l.applyEditScript=l.Delete=l.Insert=l.moveColumn=l.deleteColumn=l.insertColumn=l.moveRow=l.deleteRow=l.insertRow=l.alterAlignment=l.formatTable=l.completeTable=l.FormatType=l.readTable=l.Table=l.TableRow=l.TableCell=l.HeaderAlignment=l.DefaultAlignment=l.Alignment=l.Focus=l.Range=l.Point=void 0;var d=Ar;Object.defineProperty(l,"Point",{enumerable:!0,get:function(){return d.Point}});var o=Er;Object.defineProperty(l,"Range",{enumerable:!0,get:function(){return o.Range}});var p=br;Object.defineProperty(l,"Focus",{enumerable:!0,get:function(){return p.Focus}});var T=Bt;Object.defineProperty(l,"Alignment",{enumerable:!0,get:function(){return T.Alignment}}),Object.defineProperty(l,"DefaultAlignment",{enumerable:!0,get:function(){return T.DefaultAlignment}}),Object.defineProperty(l,"HeaderAlignment",{enumerable:!0,get:function(){return T.HeaderAlignment}});var x=yn;Object.defineProperty(l,"TableCell",{enumerable:!0,get:function(){return x.TableCell}});var k=Yn;Object.defineProperty(l,"TableRow",{enumerable:!0,get:function(){return k.TableRow}});var B=Jn;Object.defineProperty(l,"Table",{enumerable:!0,get:function(){return B.Table}});var X=rs;Object.defineProperty(l,"readTable",{enumerable:!0,get:function(){return X.readTable}});var Z=lo;Object.defineProperty(l,"FormatType",{enumerable:!0,get:function(){return Z.FormatType}}),Object.defineProperty(l,"completeTable",{enumerable:!0,get:function(){return Z.completeTable}}),Object.defineProperty(l,"formatTable",{enumerable:!0,get:function(){return Z.formatTable}}),Object.defineProperty(l,"alterAlignment",{enumerable:!0,get:function(){return Z.alterAlignment}}),Object.defineProperty(l,"insertRow",{enumerable:!0,get:function(){return Z.insertRow}}),Object.defineProperty(l,"deleteRow",{enumerable:!0,get:function(){return Z.deleteRow}}),Object.defineProperty(l,"moveRow",{enumerable:!0,get:function(){return Z.moveRow}}),Object.defineProperty(l,"insertColumn",{enumerable:!0,get:function(){return Z.insertColumn}}),Object.defineProperty(l,"deleteColumn",{enumerable:!0,get:function(){return Z.deleteColumn}}),Object.defineProperty(l,"moveColumn",{enumerable:!0,get:function(){return Z.moveColumn}});var $=is;Object.defineProperty(l,"Insert",{enumerable:!0,get:function(){return $.Insert}}),Object.defineProperty(l,"Delete",{enumerable:!0,get:function(){return $.Delete}}),Object.defineProperty(l,"applyEditScript",{enumerable:!0,get:function(){return $.applyEditScript}}),Object.defineProperty(l,"shortestEditScript",{enumerable:!0,get:function(){return $.shortestEditScript}});var G=ao;Object.defineProperty(l,"ITextEditor",{enumerable:!0,get:function(){return G.ITextEditor}});var U=Qa;Object.defineProperty(l,"defaultOptions",{enumerable:!0,get:function(){return U.defaultOptions}}),Object.defineProperty(l,"optionsWithDefaults",{enumerable:!0,get:function(){return U.optionsWithDefaults}});var Y=ja;Object.defineProperty(l,"TableEditor",{enumerable:!0,get:function(){return Y.TableEditor}}),Object.defineProperty(l,"SortOrder",{enumerable:!0,get:function(){return Y.SortOrder}})})(Le);class Bm extends Le.ITextEditor{constructor(d){super(),this.editor=d}getCursorPosition(){const d=this.editor.getSelections();return d.length>0?this.pointFromOffset(d[0].to):new Le.Point(0,0)}setCursorPosition(d){this.setSelectionRange(new Le.Range(d,d))}setSelectionRange(d){const o=this.offsetFromPoint(d.start),p=this.offsetFromPoint(d.end);this.editor.setSelections([{from:o,to:p}])}getLastRow(){return this.editor.getLineCount()-1}acceptsTableEdit(d){const o=this.editor.getLineRange(d),p=this.editor.getNodeName(o.to);return!["FencedCode","BlockMath"].includes(p)}getLine(d){const{from:o,to:p}=this.editor.getLineRange(d);return this.editor.getText({from:o,to:p})}insertLine(d,o){const p=d>this.getLastRow()?this.lineBreak+o:o+this.lineBreak,T=this.editor.getLineRange(d).from;this.editor.setText(p,{from:T,to:T})}deleteLine(d){const{from:o,to:p}=this.editor.getLineRange(d),T=d===this.getLastRow()?0:1;this.editor.setText("",{from:o,to:p+T})}replaceLines(d,o,p){const T=this.editor.getLineRange(d).from,x=this.editor.getLineRange(o-1).to;this.editor.setText(p.join(this.lineBreak),{from:T,to:x})}transact(d){d()}get lineBreak(){return this.editor.getLineBreak()}pointFromOffset(d){const o=this.editor.getLineNumber(d),p=d-this.editor.getLineRange(o).from;return new Le.Point(o,p)}offsetFromPoint(d){return this.editor.getLineRange(d.row).from+d.column}}const qm=l=>Gm(l).map(([d,o])=>({key:d,preventDefault:!1,run:()=>l.cursorIsInTable(Le.defaultOptions)?(o(),!0):!1})),Gm=l=>Object.entries({"Shift-Cmd-f":()=>l.format(Le.defaultOptions),"Alt-Shift-Cmd-f":()=>l.formatAll(Le.defaultOptions),Tab:()=>l.nextCell(Le.defaultOptions),"Shift-Tab":()=>l.previousCell(Le.defaultOptions),Enter:()=>l.nextRow(Le.defaultOptions),"Cmd-Enter":()=>l.escape(Le.defaultOptions),"Shift-Cmd-ArrowLeft":()=>l.alignColumn(Le.Alignment.LEFT,Le.defaultOptions),"Shift-Cmd-ArrowRight":()=>l.alignColumn(Le.Alignment.RIGHT,Le.defaultOptions),"Shift-Cmd-ArrowUp":()=>l.alignColumn(Le.Alignment.CENTER,Le.defaultOptions),"Shift-Cmd-ArrowDown":()=>l.alignColumn(Le.Alignment.NONE,Le.defaultOptions),"Cmd-ArrowLeft":()=>l.moveFocus(0,-1,Le.defaultOptions),"Cmd-ArrowRight":()=>l.moveFocus(0,1,Le.defaultOptions),"Cmd-ArrowUp":()=>l.moveFocus(-1,0,Le.defaultOptions),"Cmd-ArrowDown":()=>l.moveFocus(1,0,Le.defaultOptions),"Alt-Shift-Cmd-ArrowLeft":()=>l.moveColumn(-1,Le.defaultOptions),"Alt-Shift-Cmd-ArrowRight":()=>l.moveColumn(1,Le.defaultOptions),"Alt-Shift-Cmd-ArrowUp":()=>l.moveRow(-1,Le.defaultOptions),"Alt-Shift-Cmd-ArrowDown":()=>l.moveRow(1,Le.defaultOptions),"Cmd-k":()=>{Kt.pendingInsert=!0,Kt.pendingDelete=!1},"Cmd-l":()=>{Kt.pendingDelete=!0,Kt.pendingInsert=!1},"Cmd-i":()=>{Kt.pendingInsert&&l.insertRow(Le.defaultOptions),Kt.pendingDelete&&l.deleteRow(Le.defaultOptions)},"Cmd-j":()=>{Kt.pendingInsert&&l.insertColumn(Le.defaultOptions),Kt.pendingDelete&&l.deleteColumn(Le.defaultOptions)}});document.addEventListener("keydown",l=>{const d=l.metaKey&&!(l.ctrlKey||l.altKey||l.shiftKey);(!d||l.key!=="k")&&(Kt.pendingInsert=!1),(!d||l.key!=="l")&&(Kt.pendingDelete=!1)});const Kt={pendingInsert:!1,pendingDelete:!1};function Zm(l){return{title:"Table Editor",children:[{title:"Format",key:"f",modifiers:["Shift","Command"],action:()=>l.format(Le.defaultOptions)},{title:"Format All",key:"f",modifiers:["Option","Shift","Command"],action:()=>l.formatAll(Le.defaultOptions)},{separator:!0},{title:"Home Page",action:()=>open("https://github.com/MarkEdit-app/MarkEdit-mte","_blank")}]}}const zm=new Bm(Yu.MarkEdit.editorAPI),ef=new Le.TableEditor(zm),Km=jg.keymap.of(qm(ef));Yu.MarkEdit.addExtension(em.Prec.highest(Km));Yu.MarkEdit.addMainMenuItem(Zm(ef));