(()=>{var e,t={1987:(e,t,n)=>{"use strict";var r={};n.r(r),n.d(r,{Adder:()=>Na,Delaunay:()=>nm,FormatSpecifier:()=>Ov,InternMap:()=>La,InternSet:()=>Ha,Node:()=>ZS,Path:()=>vp,Voronoi:()=>Ug,ZoomTransform:()=>tz,active:()=>Sf,arc:()=>WP,area:()=>FP,areaRadial:()=>nA,ascending:()=>ua,autoType:()=>Qm,axisBottom:()=>Tc,axisLeft:()=>Rc,axisRight:()=>_c,axisTop:()=>Cc,bin:()=>wl,bisect:()=>Oa,bisectCenter:()=>ya,bisectLeft:()=>va,bisectRight:()=>ba,bisector:()=>fa,blob:()=>kb,blur:()=>wa,blur2:()=>xa,blurImage:()=>Sa,brush:()=>Kf,brushSelection:()=>qf,brushX:()=>Uf,brushY:()=>Gf,buffer:()=>_b,chord:()=>cp,chordDirected:()=>up,chordTranspose:()=>hp,cluster:()=>DS,color:()=>yu,contourDensity:()=>Tg,contours:()=>yg,count:()=>Ra,create:()=>fP,creator:()=>zh,cross:()=>Aa,csv:()=>Pb,csvFormat:()=>xm,csvFormatBody:()=>Sm,csvFormatRow:()=>Cm,csvFormatRows:()=>km,csvFormatValue:()=>_m,csvParse:()=>Om,csvParseRows:()=>wm,cubehelix:()=>cg,cumsum:()=>$a,curveBasis:()=>XA,curveBasisClosed:()=>YA,curveBasisOpen:()=>UA,curveBumpX:()=>sA,curveBumpY:()=>aA,curveBundle:()=>KA,curveCardinal:()=>t$,curveCardinalClosed:()=>r$,curveCardinalOpen:()=>o$,curveCatmullRom:()=>l$,curveCatmullRomClosed:()=>h$,curveCatmullRomOpen:()=>d$,curveLinear:()=>BP,curveLinearClosed:()=>p$,curveMonotoneX:()=>x$,curveMonotoneY:()=>S$,curveNatural:()=>_$,curveStep:()=>R$,curveStepAfter:()=>M$,curveStepBefore:()=>E$,descending:()=>da,deviation:()=>Qa,difference:()=>oc,disjoint:()=>sc,dispatch:()=>zc,drag:()=>cm,dragDisable:()=>Jh,dragEnable:()=>eu,dsv:()=>Mb,dsvFormat:()=>vm,easeBack:()=>vb,easeBackIn:()=>mb,easeBackInOut:()=>vb,easeBackOut:()=>bb,easeBounce:()=>fb,easeBounceIn:()=>db,easeBounceInOut:()=>pb,easeBounceOut:()=>fb,easeCircle:()=>tb,easeCircleIn:()=>Jm,easeCircleInOut:()=>tb,easeCircleOut:()=>eb,easeCubic:()=>yf,easeCubicIn:()=>bf,easeCubicInOut:()=>yf,easeCubicOut:()=>vf,easeElastic:()=>wb,easeElasticIn:()=>Ob,easeElasticInOut:()=>xb,easeElasticOut:()=>wb,easeExp:()=>Km,easeExpIn:()=>Um,easeExpInOut:()=>Km,easeExpOut:()=>Gm,easeLinear:()=>Nm,easePoly:()=>Bm,easePolyIn:()=>Hm,easePolyInOut:()=>Bm,easePolyOut:()=>Vm,easeQuad:()=>Lm,easeQuadIn:()=>Dm,easeQuadInOut:()=>Lm,easeQuadOut:()=>Wm,easeSin:()=>Ym,easeSinIn:()=>Xm,easeSinInOut:()=>Ym,easeSinOut:()=>Fm,every:()=>Jl,extent:()=>Ia,fcumsum:()=>Wa,filter:()=>tc,flatGroup:()=>Ua,flatRollup:()=>Ga,forceCenter:()=>Lb,forceCollide:()=>Jb,forceLink:()=>nv,forceManyBody:()=>uv,forceRadial:()=>dv,forceSimulation:()=>hv,forceX:()=>fv,forceY:()=>pv,format:()=>Cv,formatDefaultLocale:()=>Mv,formatLocale:()=>Ev,formatPrefix:()=>_v,formatSpecifier:()=>yv,fsum:()=>Da,geoAlbers:()=>Jx,geoAlbersUsa:()=>eS,geoArea:()=>zy,geoAzimuthalEqualArea:()=>iS,geoAzimuthalEqualAreaRaw:()=>rS,geoAzimuthalEquidistant:()=>sS,geoAzimuthalEquidistantRaw:()=>oS,geoBounds:()=>gO,geoCentroid:()=>TO,geoCircle:()=>DO,geoClipAntimeridian:()=>qO,geoClipCircle:()=>UO,geoClipExtent:()=>iw,geoClipRectangle:()=>rw,geoConicConformal:()=>dS,geoConicConformalRaw:()=>uS,geoConicEqualArea:()=>Kx,geoConicEqualAreaRaw:()=>Gx,geoConicEquidistant:()=>mS,geoConicEquidistantRaw:()=>gS,geoContains:()=>ww,geoDistance:()=>dw,geoEqualEarth:()=>SS,geoEqualEarthRaw:()=>xS,geoEquirectangular:()=>pS,geoEquirectangularRaw:()=>fS,geoGnomonic:()=>CS,geoGnomonicRaw:()=>kS,geoGraticule:()=>kw,geoGraticule10:()=>Cw,geoIdentity:()=>_S,geoInterpolate:()=>_w,geoLength:()=>cw,geoMercator:()=>lS,geoMercatorRaw:()=>aS,geoNaturalEarth1:()=>RS,geoNaturalEarth1Raw:()=>TS,geoOrthographic:()=>MS,geoOrthographicRaw:()=>ES,geoPath:()=>zx,geoProjection:()=>Yx,geoProjectionMutator:()=>qx,geoRotation:()=>QO,geoStereographic:()=>AS,geoStereographicRaw:()=>PS,geoStream:()=>hy,geoTransform:()=>Qx,geoTransverseMercator:()=>zS,geoTransverseMercatorRaw:()=>$S,gray:()=>Bp,greatest:()=>Rl,greatestIndex:()=>Zl,group:()=>Fa,groupSort:()=>ll,groups:()=>Ya,hcl:()=>Kp,hierarchy:()=>LS,histogram:()=>wl,hsl:()=>Au,html:()=>Db,image:()=>$b,index:()=>el,indexes:()=>tl,interpolate:()=>id,interpolateArray:()=>Uu,interpolateBasis:()=>Du,interpolateBasisClosed:()=>Wu,interpolateBlues:()=>LM,interpolateBrBG:()=>KE,interpolateBuGn:()=>mM,interpolateBuPu:()=>vM,interpolateCividis:()=>GM,interpolateCool:()=>eP,interpolateCubehelix:()=>oC,interpolateCubehelixDefault:()=>KM,interpolateCubehelixLong:()=>sC,interpolateDate:()=>Ku,interpolateDiscrete:()=>Xk,interpolateGnBu:()=>OM,interpolateGreens:()=>VM,interpolateGreys:()=>jM,interpolateHcl:()=>nC,interpolateHclLong:()=>rC,interpolateHsl:()=>Kk,interpolateHslLong:()=>Jk,interpolateHue:()=>Fk,interpolateInferno:()=>uP,interpolateLab:()=>eC,interpolateMagma:()=>hP,interpolateNumber:()=>Ju,interpolateNumberArray:()=>Yu,interpolateObject:()=>ed,interpolateOrRd:()=>xM,interpolateOranges:()=>UM,interpolatePRGn:()=>eM,interpolatePiYG:()=>nM,interpolatePlasma:()=>dP,interpolatePuBu:()=>_M,interpolatePuBuGn:()=>kM,interpolatePuOr:()=>iM,interpolatePuRd:()=>RM,interpolatePurples:()=>XM,interpolateRainbow:()=>nP,interpolateRdBu:()=>sM,interpolateRdGy:()=>lM,interpolateRdPu:()=>MM,interpolateRdYlBu:()=>hM,interpolateRdYlGn:()=>dM,interpolateReds:()=>YM,interpolateRgb:()=>ju,interpolateRgbBasis:()=>Xu,interpolateRgbBasisClosed:()=>Fu,interpolateRound:()=>Yk,interpolateSinebow:()=>sP,interpolateSpectral:()=>pM,interpolateString:()=>rd,interpolateTransformCss:()=>Zd,interpolateTransformSvg:()=>Xd,interpolateTurbo:()=>aP,interpolateViridis:()=>cP,interpolateWarm:()=>JM,interpolateYlGn:()=>zM,interpolateYlGnBu:()=>AM,interpolateYlOrBr:()=>IM,interpolateYlOrRd:()=>DM,interpolateZoom:()=>Uk,interrupt:()=>Wd,intersection:()=>ac,interval:()=>K$,isoFormat:()=>q$,isoParse:()=>G$,json:()=>Qb,lab:()=>jp,lch:()=>Gp,least:()=>Bl,leastIndex:()=>jl,line:()=>XP,lineRadial:()=>tA,link:()=>uA,linkHorizontal:()=>dA,linkRadial:()=>pA,linkVertical:()=>fA,local:()=>gP,map:()=>nc,matcher:()=>Lc,max:()=>xl,maxIndex:()=>Sl,mean:()=>zl,median:()=>Ql,medianIndex:()=>Il,merge:()=>Nl,min:()=>kl,minIndex:()=>Cl,mode:()=>Dl,namespace:()=>th,namespaces:()=>eh,nice:()=>yl,now:()=>vd,pack:()=>mk,packEnclose:()=>ek,packSiblings:()=>pk,pairs:()=>Wl,partition:()=>xk,path:()=>yp,pathRound:()=>Op,permute:()=>il,pie:()=>UP,piecewise:()=>aC,pointRadial:()=>rA,pointer:()=>sd,pointers:()=>bP,polygonArea:()=>cC,polygonCentroid:()=>hC,polygonContains:()=>gC,polygonHull:()=>pC,polygonLength:()=>mC,precisionFixed:()=>Pv,precisionPrefix:()=>Av,precisionRound:()=>$v,quadtree:()=>Zb,quantile:()=>El,quantileIndex:()=>Pl,quantileSorted:()=>Ml,quantize:()=>lC,quickselect:()=>_l,radialArea:()=>nA,radialLine:()=>tA,randomBates:()=>SC,randomBernoulli:()=>_C,randomBeta:()=>EC,randomBinomial:()=>MC,randomCauchy:()=>AC,randomExponential:()=>kC,randomGamma:()=>RC,randomGeometric:()=>TC,randomInt:()=>yC,randomIrwinHall:()=>xC,randomLcg:()=>DC,randomLogNormal:()=>wC,randomLogistic:()=>$C,randomNormal:()=>OC,randomPareto:()=>CC,randomPoisson:()=>zC,randomUniform:()=>vC,randomWeibull:()=>PC,range:()=>Hl,rank:()=>Vl,reduce:()=>rc,reverse:()=>ic,rgb:()=>Su,ribbon:()=>Pp,ribbonArrow:()=>Ap,rollup:()=>Ka,rollups:()=>Ja,scaleBand:()=>BC,scaleDiverging:()=>$E,scaleDivergingLog:()=>zE,scaleDivergingPow:()=>IE,scaleDivergingSqrt:()=>NE,scaleDivergingSymlog:()=>QE,scaleIdentity:()=>i_,scaleImplicit:()=>HC,scaleLinear:()=>r_,scaleLog:()=>f_,scaleOrdinal:()=>VC,scalePoint:()=>ZC,scalePow:()=>x_,scaleQuantile:()=>T_,scaleQuantize:()=>R_,scaleRadial:()=>C_,scaleSequential:()=>_E,scaleSequentialLog:()=>TE,scaleSequentialPow:()=>EE,scaleSequentialQuantile:()=>PE,scaleSequentialSqrt:()=>ME,scaleSequentialSymlog:()=>RE,scaleSqrt:()=>S_,scaleSymlog:()=>b_,scaleThreshold:()=>E_,scaleTime:()=>xE,scaleUtc:()=>SE,scan:()=>Xl,schemeAccent:()=>LE,schemeBlues:()=>WM,schemeBrBG:()=>GE,schemeBuGn:()=>gM,schemeBuPu:()=>bM,schemeCategory10:()=>WE,schemeDark2:()=>HE,schemeGnBu:()=>yM,schemeGreens:()=>HM,schemeGreys:()=>BM,schemeObservable10:()=>VE,schemeOrRd:()=>wM,schemeOranges:()=>qM,schemePRGn:()=>JE,schemePaired:()=>BE,schemePastel1:()=>jE,schemePastel2:()=>ZE,schemePiYG:()=>tM,schemePuBu:()=>CM,schemePuBuGn:()=>SM,schemePuOr:()=>rM,schemePuRd:()=>TM,schemePurples:()=>ZM,schemeRdBu:()=>oM,schemeRdGy:()=>aM,schemeRdPu:()=>EM,schemeRdYlBu:()=>cM,schemeRdYlGn:()=>uM,schemeReds:()=>FM,schemeSet1:()=>XE,schemeSet2:()=>FE,schemeSet3:()=>YE,schemeSpectral:()=>fM,schemeTableau10:()=>qE,schemeYlGn:()=>$M,schemeYlGnBu:()=>PM,schemeYlOrBr:()=>QM,schemeYlOrRd:()=>NM,select:()=>Yh,selectAll:()=>vP,selection:()=>Fh,selector:()=>Ic,selectorAll:()=>Wc,shuffle:()=>Fl,shuffler:()=>Yl,some:()=>ec,sort:()=>ol,stack:()=>Q$,stackOffsetDiverging:()=>N$,stackOffsetExpand:()=>I$,stackOffsetNone:()=>P$,stackOffsetSilhouette:()=>D$,stackOffsetWiggle:()=>W$,stackOrderAppearance:()=>L$,stackOrderAscending:()=>V$,stackOrderDescending:()=>j$,stackOrderInsideOut:()=>Z$,stackOrderNone:()=>A$,stackOrderReverse:()=>X$,stratify:()=>Rk,style:()=>dh,subset:()=>uc,sum:()=>ql,superset:()=>cc,svg:()=>Wb,symbol:()=>VA,symbolAsterisk:()=>mA,symbolCircle:()=>bA,symbolCross:()=>vA,symbolDiamond:()=>wA,symbolDiamond2:()=>xA,symbolPlus:()=>SA,symbolSquare:()=>kA,symbolSquare2:()=>CA,symbolStar:()=>EA,symbolTimes:()=>WA,symbolTriangle:()=>PA,symbolTriangle2:()=>$A,symbolWye:()=>DA,symbolX:()=>WA,symbols:()=>LA,symbolsFill:()=>LA,symbolsStroke:()=>HA,text:()=>Rb,thresholdFreedmanDiaconis:()=>Al,thresholdScott:()=>$l,thresholdSturges:()=>Ol,tickFormat:()=>t_,tickIncrement:()=>bl,tickStep:()=>vl,ticks:()=>ml,timeDay:()=>G_,timeDays:()=>K_,timeFormat:()=>GT,timeFormatDefaultLocale:()=>vE,timeFormatLocale:()=>qT,timeFriday:()=>cT,timeFridays:()=>mT,timeHour:()=>F_,timeHours:()=>Y_,timeInterval:()=>D_,timeMillisecond:()=>W_,timeMilliseconds:()=>L_,timeMinute:()=>B_,timeMinutes:()=>j_,timeMonday:()=>oT,timeMondays:()=>dT,timeMonth:()=>$T,timeMonths:()=>zT,timeParse:()=>KT,timeSaturday:()=>hT,timeSaturdays:()=>bT,timeSecond:()=>H_,timeSeconds:()=>V_,timeSunday:()=>iT,timeSundays:()=>uT,timeThursday:()=>lT,timeThursdays:()=>gT,timeTickInterval:()=>ZT,timeTicks:()=>jT,timeTuesday:()=>sT,timeTuesdays:()=>fT,timeWednesday:()=>aT,timeWednesdays:()=>pT,timeWeek:()=>iT,timeWeeks:()=>uT,timeYear:()=>NT,timeYears:()=>DT,timeout:()=>_d,timer:()=>wd,timerFlush:()=>xd,transition:()=>pf,transpose:()=>Ul,tree:()=>Nk,treemap:()=>Vk,treemapBinary:()=>Bk,treemapDice:()=>wk,treemapResquarify:()=>Zk,treemapSlice:()=>Dk,treemapSliceDice:()=>jk,treemapSquarify:()=>Hk,tsv:()=>Ab,tsvFormat:()=>Mm,tsvFormatBody:()=>Pm,tsvFormatRow:()=>$m,tsvFormatRows:()=>Am,tsvFormatValue:()=>zm,tsvParse:()=>Rm,tsvParseRows:()=>Em,union:()=>dc,unixDay:()=>tT,unixDays:()=>nT,utcDay:()=>J_,utcDays:()=>eT,utcFormat:()=>JT,utcFriday:()=>kT,utcFridays:()=>PT,utcHour:()=>q_,utcHours:()=>U_,utcMillisecond:()=>W_,utcMilliseconds:()=>L_,utcMinute:()=>Z_,utcMinutes:()=>X_,utcMonday:()=>OT,utcMondays:()=>TT,utcMonth:()=>QT,utcMonths:()=>IT,utcParse:()=>eR,utcSaturday:()=>CT,utcSaturdays:()=>AT,utcSecond:()=>H_,utcSeconds:()=>V_,utcSunday:()=>yT,utcSundays:()=>_T,utcThursday:()=>ST,utcThursdays:()=>MT,utcTickInterval:()=>BT,utcTicks:()=>VT,utcTuesday:()=>wT,utcTuesdays:()=>RT,utcWednesday:()=>xT,utcWednesdays:()=>ET,utcWeek:()=>yT,utcWeeks:()=>_T,utcYear:()=>WT,utcYears:()=>LT,variance:()=>za,window:()=>lh,xml:()=>Nb,zip:()=>Kl,zoom:()=>dz,zoomIdentity:()=>nz,zoomTransform:()=>rz});var i={};n.r(i),n.d(i,{bbox:()=>gz,feature:()=>mz,merge:()=>xz,mergeArcs:()=>Sz,mesh:()=>Oz,meshArcs:()=>wz,neighbors:()=>Cz,quantize:()=>Tz,transform:()=>pz,untransform:()=>_z});var o={};n.r(o),n.d(o,{CONTEXTMENU_ITEMS_ADD_COMMENT:()=>n5,CONTEXTMENU_ITEMS_ALIGNMENT:()=>s5,CONTEXTMENU_ITEMS_ALIGNMENT_BOTTOM:()=>f5,CONTEXTMENU_ITEMS_ALIGNMENT_CENTER:()=>l5,CONTEXTMENU_ITEMS_ALIGNMENT_JUSTIFY:()=>h5,CONTEXTMENU_ITEMS_ALIGNMENT_LEFT:()=>a5,CONTEXTMENU_ITEMS_ALIGNMENT_MIDDLE:()=>d5,CONTEXTMENU_ITEMS_ALIGNMENT_RIGHT:()=>c5,CONTEXTMENU_ITEMS_ALIGNMENT_TOP:()=>u5,CONTEXTMENU_ITEMS_BORDERS:()=>p5,CONTEXTMENU_ITEMS_BORDERS_BOTTOM:()=>b5,CONTEXTMENU_ITEMS_BORDERS_LEFT:()=>v5,CONTEXTMENU_ITEMS_BORDERS_RIGHT:()=>m5,CONTEXTMENU_ITEMS_BORDERS_TOP:()=>g5,CONTEXTMENU_ITEMS_CLEAR_COLUMN:()=>X2,CONTEXTMENU_ITEMS_COPY:()=>F2,CONTEXTMENU_ITEMS_COPY_COLUMN_HEADERS_ONLY:()=>U2,CONTEXTMENU_ITEMS_COPY_WITH_COLUMN_GROUP_HEADERS:()=>q2,CONTEXTMENU_ITEMS_COPY_WITH_COLUMN_HEADERS:()=>Y2,CONTEXTMENU_ITEMS_CUT:()=>G2,CONTEXTMENU_ITEMS_EDIT_COMMENT:()=>r5,CONTEXTMENU_ITEMS_FREEZE_COLUMN:()=>K2,CONTEXTMENU_ITEMS_HIDE_COLUMN:()=>x5,CONTEXTMENU_ITEMS_HIDE_ROW:()=>k5,CONTEXTMENU_ITEMS_INSERT_LEFT:()=>W2,CONTEXTMENU_ITEMS_INSERT_RIGHT:()=>L2,CONTEXTMENU_ITEMS_MERGE_CELLS:()=>e5,CONTEXTMENU_ITEMS_NESTED_ROWS_DETACH_CHILD:()=>w5,CONTEXTMENU_ITEMS_NESTED_ROWS_INSERT_CHILD:()=>O5,CONTEXTMENU_ITEMS_NO_ITEMS:()=>I2,CONTEXTMENU_ITEMS_READ_ONLY:()=>Z2,CONTEXTMENU_ITEMS_READ_ONLY_COMMENT:()=>o5,CONTEXTMENU_ITEMS_REDO:()=>j2,CONTEXTMENU_ITEMS_REMOVE_BORDERS:()=>y5,CONTEXTMENU_ITEMS_REMOVE_COLUMN:()=>V2,CONTEXTMENU_ITEMS_REMOVE_COMMENT:()=>i5,CONTEXTMENU_ITEMS_REMOVE_ROW:()=>H2,CONTEXTMENU_ITEMS_ROW_ABOVE:()=>N2,CONTEXTMENU_ITEMS_ROW_BELOW:()=>D2,CONTEXTMENU_ITEMS_SHOW_COLUMN:()=>S5,CONTEXTMENU_ITEMS_SHOW_ROW:()=>C5,CONTEXTMENU_ITEMS_UNDO:()=>B2,CONTEXTMENU_ITEMS_UNFREEZE_COLUMN:()=>J2,CONTEXTMENU_ITEMS_UNMERGE_CELLS:()=>t5,CONTEXT_MENU_ITEMS_NAMESPACE:()=>Q2,FILTERS_BUTTONS_CANCEL:()=>r3,FILTERS_BUTTONS_CLEAR:()=>t3,FILTERS_BUTTONS_OK:()=>n3,FILTERS_BUTTONS_PLACEHOLDER_SEARCH:()=>i3,FILTERS_BUTTONS_PLACEHOLDER_SECOND_VALUE:()=>s3,FILTERS_BUTTONS_PLACEHOLDER_VALUE:()=>o3,FILTERS_BUTTONS_SELECT_ALL:()=>e3,FILTERS_CONDITIONS_AFTER:()=>j5,FILTERS_CONDITIONS_BEFORE:()=>Z5,FILTERS_CONDITIONS_BEGINS_WITH:()=>$5,FILTERS_CONDITIONS_BETWEEN:()=>V5,FILTERS_CONDITIONS_BY_VALUE:()=>N5,FILTERS_CONDITIONS_CONTAINS:()=>Q5,FILTERS_CONDITIONS_EMPTY:()=>E5,FILTERS_CONDITIONS_ENDS_WITH:()=>z5,FILTERS_CONDITIONS_EQUAL:()=>P5,FILTERS_CONDITIONS_GREATER_THAN:()=>D5,FILTERS_CONDITIONS_GREATER_THAN_OR_EQUAL:()=>W5,FILTERS_CONDITIONS_LESS_THAN:()=>L5,FILTERS_CONDITIONS_LESS_THAN_OR_EQUAL:()=>H5,FILTERS_CONDITIONS_NAMESPACE:()=>T5,FILTERS_CONDITIONS_NONE:()=>R5,FILTERS_CONDITIONS_NOT_BETWEEN:()=>B5,FILTERS_CONDITIONS_NOT_CONTAIN:()=>I5,FILTERS_CONDITIONS_NOT_EMPTY:()=>M5,FILTERS_CONDITIONS_NOT_EQUAL:()=>A5,FILTERS_CONDITIONS_TODAY:()=>X5,FILTERS_CONDITIONS_TOMORROW:()=>F5,FILTERS_CONDITIONS_YESTERDAY:()=>Y5,FILTERS_DIVS_FILTER_BY_CONDITION:()=>q5,FILTERS_DIVS_FILTER_BY_VALUE:()=>U5,FILTERS_LABELS_CONJUNCTION:()=>G5,FILTERS_LABELS_DISJUNCTION:()=>K5,FILTERS_NAMESPACE:()=>_5,FILTERS_VALUES_BLANK_CELLS:()=>J5});const s=window.wp.element,a=window.wp.i18n;var l=n(4848),c=n(1609),h=function(){function e(e){var t=this;this._insertTag=function(e){var n;n=0===t.tags.length?t.insertionPoint?t.insertionPoint.nextSibling:t.prepend?t.container.firstChild:t.before:t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(e,n),t.tags.push(e)},this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(e){e.forEach(this._insertTag)},t.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)==0&&this._insertTag(function(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}(this));var t=this.tags[this.tags.length-1];if(this.isSpeedy){var n=function(e){if(e.sheet)return e.sheet;for(var t=0;t0?b(T,--C):0,S--,10===_&&(S=1,x--),_}function P(){return _=C2||Q(_)>3?"":" "}function L(e,t){for(;--t&&P()&&!(_<48||_>102||_>57&&_<65||_>70&&_<97););return z(e,$()+(t<6&&32==A()&&32==P()))}function H(e){for(;P();)switch(_){case e:return C;case 34:case 39:34!==e&&39!==e&&H(_);break;case 40:41===e&&H(e);break;case 92:P()}return C}function V(e,t){for(;P()&&e+_!==57&&(e+_!==84||47!==A()););return"/*"+z(t,C-1)+"*"+d(47===e?e:P())}function B(e){for(;!Q(A());)P();return z(e,C)}var j="-ms-",Z="-moz-",X="-webkit-",F="comm",Y="rule",q="decl",U="@keyframes";function G(e,t){for(var n="",r=O(e),i=0;i0&&y(E)-u&&w(p>32?re(E+";",r,n,u-1):re(g(E," ","")+";",r,n,u-2),l);break;case 59:E+=";";default:if(w(R=te(E,t,n,c,h,i,a,C,_=[],T=[],u),o),123===k)if(0===h)ee(E,t,R,R,_,o,u,a,T);else switch(99===f&&110===b(E,3)?100:f){case 100:case 108:case 109:case 115:ee(e,R,R,r&&w(te(e,R,R,0,0,i,a,C,i,_=[],u),T),i,T,u,a,r?_:T);break;default:ee(E,R,R,R,[""],T,0,a,T)}}c=h=p=0,O=S=1,C=E="",u=s;break;case 58:u=1+y(E),p=v;default:if(O<1)if(123==k)--O;else if(125==k&&0==O++&&125==M())continue;switch(E+=d(k),k*O){case 38:S=h>0?1:(E+="\f",-1);break;case 44:a[c++]=(y(E)-1)*S,S=1;break;case 64:45===A()&&(E+=D(P())),f=A(),h=u=y(C=E+=B($())),k++;break;case 45:45===v&&2==y(E)&&(O=0)}}return o}function te(e,t,n,r,i,o,s,a,l,c,h){for(var d=i-1,f=0===i?o:[""],m=O(f),b=0,y=0,w=0;b0?f[x]+" "+S:g(S,/&\f/g,f[x])))&&(l[w++]=k);return R(e,t,n,0===i?Y:a,l,c,h)}function ne(e,t,n){return R(e,t,n,F,d(_),v(e,2,-2),0)}function re(e,t,n,r){return R(e,t,n,q,v(e,0,r),v(e,r+1,-1),r)}var ie=function(e,t,n){for(var r=0,i=0;r=i,i=A(),38===r&&12===i&&(t[n]=1),!Q(i);)P();return z(e,C)},oe=new WeakMap,se=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||oe.get(n))&&!r){oe.set(e,!0);for(var i=[],o=function(e,t){return N(function(e,t){var n=-1,r=44;do{switch(Q(r)){case 0:38===r&&12===A()&&(t[n]=1),e[n]+=ie(C-1,t,n);break;case 2:e[n]+=D(r);break;case 4:if(44===r){e[++n]=58===A()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=d(r)}}while(r=P());return e}(I(e),t))}(t,i),s=n.props,a=0,l=0;a6)switch(b(e,t+1)){case 109:if(45!==b(e,t+4))break;case 102:return g(e,/(.+:)(.+)-([^]+)/,"$1"+X+"$2-$3$1"+Z+(108==b(e,t+3)?"$3":"$2-$3"))+e;case 115:return~m(e,"stretch")?le(g(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==b(e,t+1))break;case 6444:switch(b(e,y(e)-3-(~m(e,"!important")&&10))){case 107:return g(e,":",":"+X)+e;case 101:return g(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+X+(45===b(e,14)?"inline-":"")+"box$3$1"+X+"$2$3$1"+j+"$2box$3")+e}break;case 5936:switch(b(e,t+11)){case 114:return X+e+j+g(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return X+e+j+g(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return X+e+j+g(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return X+e+j+e+e}return e}var ce=[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case q:e.return=le(e.value,e.length);break;case U:return G([E(e,{value:g(e.value,"@","@"+X)})],r);case Y:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=/(::plac\w+|:read-\w+)/.exec(e))?e[0]:e}(t)){case":read-only":case":read-write":return G([E(e,{props:[g(t,/:(read-\w+)/,":-moz-$1")]})],r);case"::placeholder":return G([E(e,{props:[g(t,/:(plac\w+)/,":"+X+"input-$1")]}),E(e,{props:[g(t,/:(plac\w+)/,":-moz-$1")]}),E(e,{props:[g(t,/:(plac\w+)/,j+"input-$1")]})],r)}return""}))}}],he=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var r,i,o=e.stylisPlugins||ce,s={},a=[];r=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n=4;++r,i-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(i){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(i)+l;return{name:c,styles:i,next:Ce}}var Re,Ee,Me=!!c.useInsertionEffect&&c.useInsertionEffect,Pe=Me||function(e){return e()},Ae=Me||c.useLayoutEffect,$e=c.createContext("undefined"!=typeof HTMLElement?he({key:"css"}):null),ze=($e.Provider,function(e){return(0,c.forwardRef)((function(t,n){var r=(0,c.useContext)($e);return e(t,r,n)}))}),Qe=c.createContext({}),Ie={}.hasOwnProperty,Ne="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",De=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;return de(t,n,r),Pe((function(){return fe(t,n,r)})),null},We=ze((function(e,t,n){var r=e.css;"string"==typeof r&&void 0!==t.registered[r]&&(r=t.registered[r]);var i=e[Ne],o=[r],s="";"string"==typeof e.className?s=ue(t.registered,o,e.className):null!=e.className&&(s=e.className+" ");var a=Te(o,void 0,c.useContext(Qe));s+=t.key+"-"+a.name;var l={};for(var h in e)Ie.call(e,h)&&"css"!==h&&h!==Ne&&(l[h]=e[h]);return l.className=s,n&&(l.ref=n),c.createElement(c.Fragment,null,c.createElement(De,{cache:t,serialized:a,isStringTag:"string"==typeof i}),c.createElement(i,l))})),Le=We,He=(n(4146),function(e,t){var n=arguments;if(null==t||!Ie.call(t,"css"))return c.createElement.apply(void 0,n);var r=n.length,i=new Array(r);i[0]=Le,i[1]=function(e,t){var n={};for(var r in t)Ie.call(t,r)&&(n[r]=t[r]);return n[Ne]=e,n}(e,t);for(var o=2;o"});function Xe(e){const{value:t,children:n}=e;return(0,l.jsxs)(je,{value:t,children:[!t._config.disableLayers&&(0,l.jsx)(Ve,{styles:t.layers.atRule}),(0,l.jsx)(Ve,{styles:t._global}),n]})}const Fe=e=>(t,n)=>{const r=n.utils.colorMix(t);if(r.invalid)return{[e]:t};const i="--mix-"+e;return{[i]:r.value,[e]:`var(${i}, ${r.color})`}};function Ye(){const e=e=>e;return new Proxy(e,{get:()=>e})}const qe=Ye(),Ue=Ye(),Ge=/[^a-zA-Z0-9_\u0081-\uffff-]/g;function Ke(e){return`${e}`.replace(Ge,(e=>`\\${e}`))}const Je=/[A-Z]/g;function et(e,t={}){const{fallback:n="",prefix:r=""}=t,i=function(e){return e.replace(Je,(e=>`-${e.toLowerCase()}`))}(["-",r,Ke(e)].filter(Boolean).join("-"));return{var:i,ref:`var(${i}${n?`, ${n}`:""})`}}const tt=(e,t)=>null!=t?`${e}(${t})`:t,nt=e=>{if((e=>/^var\(--.+\)$/.test(e))(e)||null==e)return e;const t="string"==typeof e&&!e.endsWith("deg");return"number"==typeof e||t?`${e}deg`:e},rt=e=>({values:["outside","inside","mixed","none"],transform(t,{token:n}){const r=n("colors.colorPalette.focusRing");return{inside:{"--focus-ring-color":r,[e]:{outlineOffset:"0px",outlineWidth:"var(--focus-ring-width, 1px)",outlineColor:"var(--focus-ring-color)",outlineStyle:"var(--focus-ring-style, solid)",borderColor:"var(--focus-ring-color)"}},outside:{"--focus-ring-color":r,[e]:{outlineWidth:"var(--focus-ring-width, 2px)",outlineOffset:"var(--focus-ring-offset, 2px)",outlineStyle:"var(--focus-ring-style, solid)",outlineColor:"var(--focus-ring-color)"}},mixed:{"--focus-ring-color":r,[e]:{outlineWidth:"var(--focus-ring-width, 3px)",outlineStyle:"var(--focus-ring-style, solid)",outlineColor:"color-mix(in srgb, var(--focus-ring-color), transparent 60%)",borderColor:"var(--focus-ring-color)"}},none:{"--focus-ring-color":r,[e]:{outline:"none"}}}[t]??{}}}),it=Fe("borderColor"),ot=e=>({transition:e,transitionTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)",transitionDuration:"150ms"}),st=et("bg-currentcolor"),at=e=>e===st.ref||"currentBg"===e,lt=e=>({...e("colors"),currentBg:st}),ct={conditions:{hover:["@media (hover: hover)","&:is(:hover, [data-hover]):not(:disabled, [data-disabled])"],active:"&:is(:active, [data-active]):not(:disabled, [data-disabled], [data-state=open])",focus:"&:is(:focus, [data-focus])",focusWithin:"&:is(:focus-within, [data-focus-within])",focusVisible:"&:is(:focus-visible, [data-focus-visible])",disabled:"&:is(:disabled, [disabled], [data-disabled], [aria-disabled=true])",visited:"&:visited",target:"&:target",readOnly:"&:is([data-readonly], [aria-readonly=true], [readonly])",readWrite:"&:read-write",empty:"&:is(:empty, [data-empty])",checked:"&:is(:checked, [data-checked], [aria-checked=true], [data-state=checked])",enabled:"&:enabled",expanded:"&:is([aria-expanded=true], [data-expanded], [data-state=expanded])",highlighted:"&[data-highlighted]",complete:"&[data-complete]",incomplete:"&[data-incomplete]",dragging:"&[data-dragging]",before:"&::before",after:"&::after",firstLetter:"&::first-letter",firstLine:"&::first-line",marker:"&::marker",selection:"&::selection",file:"&::file-selector-button",backdrop:"&::backdrop",first:"&:first-of-type",last:"&:last-of-type",notFirst:"&:not(:first-of-type)",notLast:"&:not(:last-of-type)",only:"&:only-child",even:"&:nth-of-type(even)",odd:"&:nth-of-type(odd)",peerFocus:".peer:is(:focus, [data-focus]) ~ &",peerHover:".peer:is(:hover, [data-hover]):not(:disabled, [data-disabled]) ~ &",peerActive:".peer:is(:active, [data-active]):not(:disabled, [data-disabled]) ~ &",peerFocusWithin:".peer:focus-within ~ &",peerFocusVisible:".peer:is(:focus-visible, [data-focus-visible]) ~ &",peerDisabled:".peer:is(:disabled, [disabled], [data-disabled]) ~ &",peerChecked:".peer:is(:checked, [data-checked], [aria-checked=true], [data-state=checked]) ~ &",peerInvalid:".peer:is(:invalid, [data-invalid], [aria-invalid=true]) ~ &",peerExpanded:".peer:is([aria-expanded=true], [data-expanded], [data-state=expanded]) ~ &",peerPlaceholderShown:".peer:placeholder-shown ~ &",groupFocus:".group:is(:focus, [data-focus]) &",groupHover:".group:is(:hover, [data-hover]):not(:disabled, [data-disabled]) &",groupActive:".group:is(:active, [data-active]):not(:disabled, [data-disabled]) &",groupFocusWithin:".group:focus-within &",groupFocusVisible:".group:is(:focus-visible, [data-focus-visible]) &",groupDisabled:".group:is(:disabled, [disabled], [data-disabled]) &",groupChecked:".group:is(:checked, [data-checked], [aria-checked=true], [data-state=checked]) &",groupExpanded:".group:is([aria-expanded=true], [data-expanded], [data-state=expanded]) &",groupInvalid:".group:invalid &",indeterminate:"&:is(:indeterminate, [data-indeterminate], [aria-checked=mixed], [data-state=indeterminate])",required:"&:is([data-required], [aria-required=true])",valid:"&:is([data-valid], [data-state=valid])",invalid:"&:is([data-invalid], [aria-invalid=true], [data-state=invalid])",autofill:"&:autofill",inRange:"&:is(:in-range, [data-in-range])",outOfRange:"&:is(:out-of-range, [data-outside-range])",placeholder:"&::placeholder, &[data-placeholder]",placeholderShown:"&:is(:placeholder-shown, [data-placeholder-shown])",pressed:"&:is([aria-pressed=true], [data-pressed])",selected:"&:is([aria-selected=true], [data-selected])",grabbed:"&:is([aria-grabbed=true], [data-grabbed])",underValue:"&[data-state=under-value]",overValue:"&[data-state=over-value]",atValue:"&[data-state=at-value]",default:"&:default",optional:"&:optional",open:"&:is([open], [data-open], [data-state=open])",closed:"&:is([closed], [data-closed], [data-state=closed])",fullscreen:"&:is(:fullscreen, [data-fullscreen])",loading:"&:is([data-loading], [aria-busy=true])",hidden:"&:is([hidden], [data-hidden])",current:"&[data-current]",currentPage:"&[aria-current=page]",currentStep:"&[aria-current=step]",today:"&[data-today]",unavailable:"&[data-unavailable]",rangeStart:"&[data-range-start]",rangeEnd:"&[data-range-end]",now:"&[data-now]",topmost:"&[data-topmost]",motionReduce:"@media (prefers-reduced-motion: reduce)",motionSafe:"@media (prefers-reduced-motion: no-preference)",print:"@media print",landscape:"@media (orientation: landscape)",portrait:"@media (orientation: portrait)",dark:".dark &, .dark .chakra-theme:not(.light) &",light:":root &, .light &",osDark:"@media (prefers-color-scheme: dark)",osLight:"@media (prefers-color-scheme: light)",highContrast:"@media (forced-colors: active)",lessContrast:"@media (prefers-contrast: less)",moreContrast:"@media (prefers-contrast: more)",ltr:"[dir=ltr] &",rtl:"[dir=rtl] &",scrollbar:"&::-webkit-scrollbar",scrollbarThumb:"&::-webkit-scrollbar-thumb",scrollbarTrack:"&::-webkit-scrollbar-track",horizontal:"&[data-orientation=horizontal]",vertical:"&[data-orientation=vertical]",icon:"& :where(svg)",starting:"@starting-style"},utilities:{background:{values:lt,shorthand:["bg"],transform(e,t){if(at(t.raw))return{background:st.ref};const n=Fe("background")(e,t);return{...n,[st.var]:n?.background}}},backgroundColor:{values:lt,shorthand:["bgColor"],transform(e,t){if(at(t.raw))return{backgroundColor:st.ref};const n=Fe("backgroundColor")(e,t);return{...n,[st.var]:n?.backgroundColor}}},backgroundSize:{shorthand:["bgSize"]},backgroundPosition:{shorthand:["bgPos"]},backgroundRepeat:{shorthand:["bgRepeat"]},backgroundAttachment:{shorthand:["bgAttachment"]},backgroundClip:{shorthand:["bgClip"],values:["text"],transform:e=>"text"===e?{color:"transparent",backgroundClip:"text"}:{backgroundClip:e}},backgroundGradient:{shorthand:["bgGradient"],values:e=>({...e("gradients"),"to-t":"linear-gradient(to top, var(--gradient))","to-tr":"linear-gradient(to top right, var(--gradient))","to-r":"linear-gradient(to right, var(--gradient))","to-br":"linear-gradient(to bottom right, var(--gradient))","to-b":"linear-gradient(to bottom, var(--gradient))","to-bl":"linear-gradient(to bottom left, var(--gradient))","to-l":"linear-gradient(to left, var(--gradient))","to-tl":"linear-gradient(to top left, var(--gradient))"}),transform:e=>({"--gradient-stops":"var(--gradient-from), var(--gradient-to)","--gradient":"var(--gradient-via-stops, var(--gradient-stops))",backgroundImage:e})},gradientFrom:{values:lt,transform:Fe("--gradient-from")},gradientTo:{values:lt,transform:Fe("--gradient-to")},gradientVia:{values:lt,transform:(e,t)=>({...Fe("--gradient-via")(e,t),"--gradient-via-stops":"var(--gradient-from), var(--gradient-via), var(--gradient-to)"})},backgroundImage:{values:e=>({...e("gradients"),...e("assets")}),shorthand:["bgImg","bgImage"]},border:{values:"borders"},borderTop:{values:"borders"},borderLeft:{values:"borders"},borderBlockStart:{values:"borders"},borderRight:{values:"borders"},borderBottom:{values:"borders"},borderBlockEnd:{values:"borders"},borderInlineStart:{values:"borders",shorthand:["borderStart"]},borderInlineEnd:{values:"borders",shorthand:["borderEnd"]},borderInline:{values:"borders",shorthand:["borderX"]},borderBlock:{values:"borders",shorthand:["borderY"]},borderColor:{values:lt,transform:Fe("borderColor")},borderTopColor:{values:lt,transform:Fe("borderTopColor")},borderBlockStartColor:{values:lt,transform:Fe("borderBlockStartColor")},borderBottomColor:{values:lt,transform:Fe("borderBottomColor")},borderBlockEndColor:{values:lt,transform:Fe("borderBlockEndColor")},borderLeftColor:{values:lt,transform:Fe("borderLeftColor")},borderInlineStartColor:{values:lt,shorthand:["borderStartColor"],transform:Fe("borderInlineStartColor")},borderRightColor:{values:lt,transform:Fe("borderRightColor")},borderInlineEndColor:{values:lt,shorthand:["borderEndColor"],transform:Fe("borderInlineEndColor")},borderStyle:{values:"borderStyles"},borderTopStyle:{values:"borderStyles"},borderBlockStartStyle:{values:"borderStyles"},borderBottomStyle:{values:"borderStyles"},borderBlockEndStyle:{values:"borderStyles"},borderInlineStartStyle:{values:"borderStyles",shorthand:["borderStartStyle"]},borderInlineEndStyle:{values:"borderStyles",shorthand:["borderEndStyle"]},borderLeftStyle:{values:"borderStyles"},borderRightStyle:{values:"borderStyles"},borderRadius:{values:"radii",shorthand:["rounded"]},borderTopLeftRadius:{values:"radii",shorthand:["roundedTopLeft"]},borderStartStartRadius:{values:"radii",shorthand:["roundedStartStart","borderTopStartRadius"]},borderEndStartRadius:{values:"radii",shorthand:["roundedEndStart","borderBottomStartRadius"]},borderTopRightRadius:{values:"radii",shorthand:["roundedTopRight"]},borderStartEndRadius:{values:"radii",shorthand:["roundedStartEnd","borderTopEndRadius"]},borderEndEndRadius:{values:"radii",shorthand:["roundedEndEnd","borderBottomEndRadius"]},borderBottomLeftRadius:{values:"radii",shorthand:["roundedBottomLeft"]},borderBottomRightRadius:{values:"radii",shorthand:["roundedBottomRight"]},borderInlineStartRadius:{values:"radii",property:"borderRadius",shorthand:["roundedStart","borderStartRadius"],transform:e=>({borderStartStartRadius:e,borderEndStartRadius:e})},borderInlineEndRadius:{values:"radii",property:"borderRadius",shorthand:["roundedEnd","borderEndRadius"],transform:e=>({borderStartEndRadius:e,borderEndEndRadius:e})},borderTopRadius:{values:"radii",property:"borderRadius",shorthand:["roundedTop"],transform:e=>({borderTopLeftRadius:e,borderTopRightRadius:e})},borderBottomRadius:{values:"radii",property:"borderRadius",shorthand:["roundedBottom"],transform:e=>({borderBottomLeftRadius:e,borderBottomRightRadius:e})},borderLeftRadius:{values:"radii",property:"borderRadius",shorthand:["roundedLeft"],transform:e=>({borderTopLeftRadius:e,borderBottomLeftRadius:e})},borderRightRadius:{values:"radii",property:"borderRadius",shorthand:["roundedRight"],transform:e=>({borderTopRightRadius:e,borderBottomRightRadius:e})},borderWidth:{values:"borderWidths"},borderBlockStartWidth:{values:"borderWidths"},borderTopWidth:{values:"borderWidths"},borderBottomWidth:{values:"borderWidths"},borderBlockEndWidth:{values:"borderWidths"},borderRightWidth:{values:"borderWidths"},borderInlineWidth:{values:"borderWidths",shorthand:["borderXWidth"]},borderInlineStartWidth:{values:"borderWidths",shorthand:["borderStartWidth"]},borderInlineEndWidth:{values:"borderWidths",shorthand:["borderEndWidth"]},borderLeftWidth:{values:"borderWidths"},borderBlockWidth:{values:"borderWidths",shorthand:["borderYWidth"]},color:{values:lt,transform:Fe("color")},fill:{values:lt,transform:Fe("fill")},stroke:{values:lt,transform:Fe("stroke")},accentColor:{values:lt,transform:Fe("accentColor")},divideX:{values:{type:"string"},transform:e=>({"& > :not(style, [hidden]) ~ :not(style, [hidden])":{borderInlineStartWidth:e,borderInlineEndWidth:"0px"}})},divideY:{values:{type:"string"},transform:e=>({"& > :not(style, [hidden]) ~ :not(style, [hidden])":{borderTopWidth:e,borderBottomWidth:"0px"}})},divideColor:{values:lt,transform:(e,t)=>({"& > :not(style, [hidden]) ~ :not(style, [hidden])":it(e,t)})},divideStyle:{property:"borderStyle",transform:e=>({"& > :not(style, [hidden]) ~ :not(style, [hidden])":{borderStyle:e}})},boxShadow:{values:"shadows",shorthand:["shadow"]},boxShadowColor:{values:lt,transform:Fe("--shadow-color"),shorthand:["shadowColor"]},mixBlendMode:{shorthand:["blendMode"]},backgroundBlendMode:{shorthand:["bgBlendMode"]},opacity:{values:"opacity"},filter:{transform:e=>"auto"!==e?{filter:e}:{filter:"var(--blur) var(--brightness) var(--contrast) var(--grayscale) var(--hue-rotate) var(--invert) var(--saturate) var(--sepia) var(--drop-shadow)"}},blur:{values:"blurs",transform:e=>({"--blur":tt("blur",e)})},brightness:{transform:e=>({"--brightness":tt("brightness",e)})},contrast:{transform:e=>({"--contrast":tt("contrast",e)})},grayscale:{transform:e=>({"--grayscale":tt("grayscale",e)})},hueRotate:{transform:e=>({"--hue-rotate":tt("hue-rotate",nt(e))})},invert:{transform:e=>({"--invert":tt("invert",e)})},saturate:{transform:e=>({"--saturate":tt("saturate",e)})},sepia:{transform:e=>({"--sepia":tt("sepia",e)})},dropShadow:{transform:e=>({"--drop-shadow":tt("drop-shadow",e)})},backdropFilter:{transform:e=>"auto"!==e?{backdropFilter:e}:{backdropFilter:"var(--backdrop-blur) var(--backdrop-brightness) var(--backdrop-contrast) var(--backdrop-grayscale) var(--backdrop-hue-rotate) var(--backdrop-invert) var(--backdrop-opacity) var(--backdrop-saturate) var(--backdrop-sepia)"}},backdropBlur:{values:"blurs",transform:e=>({"--backdrop-blur":tt("blur",e)})},backdropBrightness:{transform:e=>({"--backdrop-brightness":tt("brightness",e)})},backdropContrast:{transform:e=>({"--backdrop-contrast":tt("contrast",e)})},backdropGrayscale:{transform:e=>({"--backdrop-grayscale":tt("grayscale",e)})},backdropHueRotate:{transform:e=>({"--backdrop-hue-rotate":tt("hue-rotate",nt(e))})},backdropInvert:{transform:e=>({"--backdrop-invert":tt("invert",e)})},backdropOpacity:{transform:e=>({"--backdrop-opacity":tt("opacity",e)})},backdropSaturate:{transform:e=>({"--backdrop-saturate":tt("saturate",e)})},backdropSepia:{transform:e=>({"--backdrop-sepia":tt("sepia",e)})},flexBasis:{values:"sizes"},gap:{values:"spacing"},rowGap:{values:"spacing",shorthand:["gapY"]},columnGap:{values:"spacing",shorthand:["gapX"]},flexDirection:{shorthand:["flexDir"]},gridGap:{values:"spacing"},gridColumnGap:{values:"spacing"},gridRowGap:{values:"spacing"},outlineColor:{values:lt,transform:Fe("outlineColor")},focusRing:rt("&:is(:focus, [data-focus])"),focusVisibleRing:rt("&:is(:focus-visible, [data-focus-visible])"),focusRingColor:{values:lt,transform:Fe("--focus-ring-color")},focusRingOffset:{values:"spacing",transform:e=>({"--focus-ring-offset":e})},focusRingWidth:{values:"borderWidths",property:"outlineWidth",transform:e=>({"--focus-ring-width":e})},focusRingStyle:{values:"borderStyles",property:"outlineStyle",transform:e=>({"--focus-ring-style":e})},aspectRatio:{values:"aspectRatios"},width:{values:"sizes",shorthand:["w"]},inlineSize:{values:"sizes"},height:{values:"sizes",shorthand:["h"]},blockSize:{values:"sizes"},boxSize:{values:"sizes",property:"width",transform:e=>({width:e,height:e})},minWidth:{values:"sizes",shorthand:["minW"]},minInlineSize:{values:"sizes"},minHeight:{values:"sizes",shorthand:["minH"]},minBlockSize:{values:"sizes"},maxWidth:{values:"sizes",shorthand:["maxW"]},maxInlineSize:{values:"sizes"},maxHeight:{values:"sizes",shorthand:["maxH"]},maxBlockSize:{values:"sizes"},hideFrom:{values:"breakpoints",transform:(e,{raw:t,token:n})=>({[n.raw(`breakpoints.${t}`)?`@breakpoint ${t}`:`@media screen and (min-width: ${e})`]:{display:"none"}})},hideBelow:{values:"breakpoints",transform:(e,{raw:t,token:n})=>({[n.raw(`breakpoints.${t}`)?`@breakpoint ${t}Down`:`@media screen and (max-width: ${e})`]:{display:"none"}})},overscrollBehavior:{shorthand:["overscroll"]},overscrollBehaviorX:{shorthand:["overscrollX"]},overscrollBehaviorY:{shorthand:["overscrollY"]},scrollbar:{values:["visible","hidden"],transform(e){switch(e){case"visible":return{msOverflowStyle:"auto",scrollbarWidth:"auto","&::-webkit-scrollbar":{display:"block"}};case"hidden":return{msOverflowStyle:"none",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}};default:return{}}}},scrollbarColor:{values:lt,transform:Fe("scrollbarColor")},scrollbarGutter:{values:"spacing"},scrollbarWidth:{values:"sizes"},scrollMargin:{values:"spacing"},scrollMarginTop:{values:"spacing"},scrollMarginBottom:{values:"spacing"},scrollMarginLeft:{values:"spacing"},scrollMarginRight:{values:"spacing"},scrollMarginX:{values:"spacing",transform:e=>({scrollMarginLeft:e,scrollMarginRight:e})},scrollMarginY:{values:"spacing",transform:e=>({scrollMarginTop:e,scrollMarginBottom:e})},scrollPadding:{values:"spacing"},scrollPaddingTop:{values:"spacing"},scrollPaddingBottom:{values:"spacing"},scrollPaddingLeft:{values:"spacing"},scrollPaddingRight:{values:"spacing"},scrollPaddingInline:{values:"spacing",shorthand:["scrollPaddingX"]},scrollPaddingBlock:{values:"spacing",shorthand:["scrollPaddingY"]},scrollSnapType:{values:{none:"none",x:"x var(--scroll-snap-strictness)",y:"y var(--scroll-snap-strictness)",both:"both var(--scroll-snap-strictness)"}},scrollSnapStrictness:{values:["mandatory","proximity"],transform:e=>({"--scroll-snap-strictness":e})},scrollSnapMargin:{values:"spacing"},scrollSnapMarginTop:{values:"spacing"},scrollSnapMarginBottom:{values:"spacing"},scrollSnapMarginLeft:{values:"spacing"},scrollSnapMarginRight:{values:"spacing"},listStylePosition:{shorthand:["listStylePos"]},listStyleImage:{values:"assets",shorthand:["listStyleImg"]},position:{shorthand:["pos"]},zIndex:{values:"zIndex"},inset:{values:"spacing"},insetInline:{values:"spacing",shorthand:["insetX"]},insetBlock:{values:"spacing",shorthand:["insetY"]},top:{values:"spacing"},insetBlockStart:{values:"spacing"},bottom:{values:"spacing"},insetBlockEnd:{values:"spacing"},left:{values:"spacing"},right:{values:"spacing"},insetInlineStart:{values:"spacing",shorthand:["insetStart"]},insetInlineEnd:{values:"spacing",shorthand:["insetEnd"]},ring:{transform:e=>({"--ring-offset-shadow":"var(--ring-inset) 0 0 0 var(--ring-offset-width) var(--ring-offset-color)","--ring-shadow":"var(--ring-inset) 0 0 0 calc(var(--ring-width) + var(--ring-offset-width)) var(--ring-color)","--ring-width":e,boxShadow:"var(--ring-offset-shadow), var(--ring-shadow), var(--shadow, 0 0 #0000)"})},ringColor:{values:lt,transform:Fe("--ring-color")},ringOffset:{transform:e=>({"--ring-offset-width":e})},ringOffsetColor:{values:lt,transform:Fe("--ring-offset-color")},ringInset:{transform:e=>({"--ring-inset":e})},margin:{values:"spacing",shorthand:["m"]},marginTop:{values:"spacing",shorthand:["mt"]},marginBlockStart:{values:"spacing"},marginRight:{values:"spacing",shorthand:["mr"]},marginBottom:{values:"spacing",shorthand:["mb"]},marginBlockEnd:{values:"spacing"},marginLeft:{values:"spacing",shorthand:["ml"]},marginInlineStart:{values:"spacing",shorthand:["ms","marginStart"]},marginInlineEnd:{values:"spacing",shorthand:["me","marginEnd"]},marginInline:{values:"spacing",shorthand:["mx","marginX"]},marginBlock:{values:"spacing",shorthand:["my","marginY"]},padding:{values:"spacing",shorthand:["p"]},paddingTop:{values:"spacing",shorthand:["pt"]},paddingRight:{values:"spacing",shorthand:["pr"]},paddingBottom:{values:"spacing",shorthand:["pb"]},paddingBlockStart:{values:"spacing"},paddingBlockEnd:{values:"spacing"},paddingLeft:{values:"spacing",shorthand:["pl"]},paddingInlineStart:{values:"spacing",shorthand:["ps","paddingStart"]},paddingInlineEnd:{values:"spacing",shorthand:["pe","paddingEnd"]},paddingInline:{values:"spacing",shorthand:["px","paddingX"]},paddingBlock:{values:"spacing",shorthand:["py","paddingY"]},textDecoration:{shorthand:["textDecor"]},textDecorationColor:{values:lt,transform:Fe("textDecorationColor")},textShadow:{values:"shadows"},transform:{transform:e=>{let t=e;return"auto"===e&&(t="translateX(var(--translate-x, 0)) translateY(var(--translate-y, 0)) rotate(var(--rotate, 0)) scaleX(var(--scale-x, 1)) scaleY(var(--scale-y, 1)) skewX(var(--skew-x, 0)) skewY(var(--skew-y, 0))"),"auto-gpu"===e&&(t="translate3d(var(--translate-x, 0), var(--translate-y, 0), 0) rotate(var(--rotate, 0)) scaleX(var(--scale-x, 1)) scaleY(var(--scale-y, 1)) skewX(var(--skew-x, 0)) skewY(var(--skew-y, 0))"),{transform:t}}},skewX:{transform:e=>({"--skew-x":nt(e)})},skewY:{transform:e=>({"--skew-y":nt(e)})},scaleX:{transform:e=>({"--scale-x":e})},scaleY:{transform:e=>({"--scale-y":e})},scale:{transform:e=>"auto"!==e?{scale:e}:{scale:"var(--scale-x, 1) var(--scale-y, 1)"}},spaceXReverse:{values:{type:"boolean"},transform:e=>({"& > :not(style, [hidden]) ~ :not(style, [hidden])":{"--space-x-reverse":e?"1":void 0}})},spaceX:{property:"marginInlineStart",values:"spacing",transform:e=>({"& > :not(style, [hidden]) ~ :not(style, [hidden])":{"--space-x-reverse":"0",marginInlineStart:`calc(${e} * calc(1 - var(--space-x-reverse)))`,marginInlineEnd:`calc(${e} * var(--space-x-reverse))`}})},spaceYReverse:{values:{type:"boolean"},transform:e=>({"& > :not(style, [hidden]) ~ :not(style, [hidden])":{"--space-y-reverse":e?"1":void 0}})},spaceY:{property:"marginTop",values:"spacing",transform:e=>({"& > :not(style, [hidden]) ~ :not(style, [hidden])":{"--space-y-reverse":"0",marginTop:`calc(${e} * calc(1 - var(--space-y-reverse)))`,marginBottom:`calc(${e} * var(--space-y-reverse))`}})},rotate:{transform:e=>"auto"!==e?{rotate:nt(e)}:{rotate:"var(--rotate-x, 0) var(--rotate-y, 0) var(--rotate-z, 0)"}},rotateX:{transform:e=>({"--rotate-x":nt(e)})},rotateY:{transform:e=>({"--rotate-y":nt(e)})},translate:{transform:e=>"auto"!==e?{translate:e}:{translate:"var(--translate-x) var(--translate-y)"}},translateX:{values:"spacing",transform:e=>({"--translate-x":e})},translateY:{values:"spacing",transform:e=>({"--translate-y":e})},transition:{values:["all","common","colors","opacity","position","backgrounds","size","shadow","transform"],transform(e){switch(e){case"all":return ot("all");case"position":return ot("left, right, top, bottom, inset-inline, inset-block");case"colors":return ot("color, background-color, border-color, text-decoration-color, fill, stroke");case"opacity":return ot("opacity");case"shadow":return ot("box-shadow");case"transform":return ot("transform");case"size":return ot("width, height");case"backgrounds":return ot("background, background-color, background-image, background-position");case"common":return ot("color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter");default:return{transition:e}}}},transitionDuration:{values:"durations"},transitionProperty:{values:{common:"background-color, border-color, color, fill, stroke, opacity, box-shadow, translate, transform",colors:"background-color, border-color, color, fill, stroke",size:"width, height",position:"left, right, top, bottom, inset-inline, inset-block",background:"background, background-color, background-image, background-position"}},transitionTimingFunction:{values:"easings"},animation:{values:"animations"},animationDuration:{values:"durations"},animationDelay:{values:"durations"},animationTimingFunction:{values:"easings"},fontFamily:{values:"fonts"},fontSize:{values:"fontSizes"},fontWeight:{values:"fontWeights"},lineHeight:{values:"lineHeights"},letterSpacing:{values:"letterSpacings"},textIndent:{values:"spacing"},truncate:{values:{type:"boolean"},transform:e=>!0===e?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:{}},lineClamp:{transform:e=>"none"===e?{WebkitLineClamp:"unset"}:{overflow:"hidden",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical",textWrap:"wrap"}},borderSpacing:{values:e=>({...e("spacing"),auto:"var(--border-spacing-x, 0) var(--border-spacing-y, 0)"})},borderSpacingX:{values:"spacing",transform:e=>({"--border-spacing-x":e})},borderSpacingY:{values:"spacing",transform:e=>({"--border-spacing-y":e})},srOnly:{values:{type:"boolean"},transform:e=>ht[e]||{}},debug:{values:{type:"boolean"},transform:e=>e?{outline:"1px solid blue !important","& > *":{outline:"1px solid red !important"}}:{}},caretColor:{values:lt,transform:Fe("caretColor")},cursor:{values:"cursor"}}},ht={true:{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},false:{position:"static",width:"auto",height:"auto",padding:"0",margin:"0",overflow:"visible",clip:"auto",whiteSpace:"normal"}};function ut(e){if(null===e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map((e=>ut(e)));const t=Object.create(Object.getPrototypeOf(e));for(const n of Object.keys(e))t[n]=ut(e[n]);return t}const dt=e=>null!=e&&"object"==typeof e&&!Array.isArray(e),ft=e=>"string"==typeof e,pt=e=>"function"==typeof e;function gt(e,t){if(null==t)return e;for(const n of Object.keys(t))if(void 0!==t[n]&&"__proto__"!==n)if(!dt(e[n])&&dt(t[n]))Object.assign(e,{[n]:t[n]});else if(e[n]&&dt(t[n]))gt(e[n],t[n]);else if(Array.isArray(t[n])&&Array.isArray(e[n])){let r=0;for(;rnull!=e;function vt(e,t,n={}){const{stop:r,getKey:i}=n;return function e(n,o=[]){if(dt(n)||Array.isArray(n)){const s={};for(const[a,l]of Object.entries(n)){const c=i?.(a,l)??a,h=[...o,c];if(r?.(n,h))return t(n,o);const u=e(l,h);bt(u)&&(s[c]=u)}return s}return t(n,o)}(e)}function yt(e,t){return Array.isArray(e)?e.map((e=>bt(e)?t(e):e)):dt(e)?vt(e,(e=>t(e))):bt(e)?t(e):e}const Ot=["value","type","description"],wt=(...e)=>{const t=mt({},...e.map(ut));return t.theme?.tokens&&vt(t.theme.tokens,(e=>{const t=Object.keys(e).filter((e=>!Ot.includes(e))),n=t.length>0,r=Ot.some((t=>null!=e[t]));return n&&r&&(e.DEFAULT||(e.DEFAULT={}),Ot.forEach((t=>{var n;null!=e[t]&&((n=e.DEFAULT)[t]||(n[t]=e[t]),delete e[t])}))),e}),{stop:e=>(e=>e&&"object"==typeof e&&!Array.isArray(e))(e)&&Object.keys(e).some((e=>Ot.includes(e)||e!==e.toLowerCase()&&e!==e.toUpperCase()))}),t};var xt="".split(","),St="WebkitAppearance,WebkitBorderBefore,WebkitBorderBeforeColor,WebkitBorderBeforeStyle,WebkitBorderBeforeWidth,WebkitBoxReflect,WebkitLineClamp,WebkitMask,WebkitMaskAttachment,WebkitMaskClip,WebkitMaskComposite,WebkitMaskImage,WebkitMaskOrigin,WebkitMaskPosition,WebkitMaskPositionX,WebkitMaskPositionY,WebkitMaskRepeat,WebkitMaskRepeatX,WebkitMaskRepeatY,WebkitMaskSize,WebkitOverflowScrolling,WebkitTapHighlightColor,WebkitTextFillColor,WebkitTextStroke,WebkitTextStrokeColor,WebkitTextStrokeWidth,WebkitTouchCallout,WebkitUserModify,WebkitUserSelect,accentColor,alignContent,alignItems,alignSelf,alignTracks,all,anchorName,anchorScope,animation,animationComposition,animationDelay,animationDirection,animationDuration,animationFillMode,animationIterationCount,animationName,animationPlayState,animationRange,animationRangeEnd,animationRangeStart,animationTimeline,animationTimingFunction,appearance,aspectRatio,backdropFilter,backfaceVisibility,background,backgroundAttachment,backgroundBlendMode,backgroundClip,backgroundColor,backgroundImage,backgroundOrigin,backgroundPosition,backgroundPositionX,backgroundPositionY,backgroundRepeat,backgroundSize,blockSize,border,borderBlock,borderBlockColor,borderBlockEnd,borderBlockEndColor,borderBlockEndStyle,borderBlockEndWidth,borderBlockStart,borderBlockStartColor,borderBlockStartStyle,borderBlockStartWidth,borderBlockStyle,borderBlockWidth,borderBottom,borderBottomColor,borderBottomLeftRadius,borderBottomRightRadius,borderBottomStyle,borderBottomWidth,borderCollapse,borderColor,borderEndEndRadius,borderEndStartRadius,borderImage,borderImageOutset,borderImageRepeat,borderImageSlice,borderImageSource,borderImageWidth,borderInline,borderInlineColor,borderInlineEnd,borderInlineEndColor,borderInlineEndStyle,borderInlineEndWidth,borderInlineStart,borderInlineStartColor,borderInlineStartStyle,borderInlineStartWidth,borderInlineStyle,borderInlineWidth,borderLeft,borderLeftColor,borderLeftStyle,borderLeftWidth,borderRadius,borderRight,borderRightColor,borderRightStyle,borderRightWidth,borderSpacing,borderStartEndRadius,borderStartStartRadius,borderStyle,borderTop,borderTopColor,borderTopLeftRadius,borderTopRightRadius,borderTopStyle,borderTopWidth,borderWidth,bottom,boxAlign,boxDecorationBreak,boxDirection,boxFlex,boxFlexGroup,boxLines,boxOrdinalGroup,boxOrient,boxPack,boxShadow,boxSizing,breakAfter,breakBefore,breakInside,captionSide,caret,caretColor,caretShape,clear,clip,clipPath,clipRule,color,colorInterpolationFilters,colorScheme,columnCount,columnFill,columnGap,columnRule,columnRuleColor,columnRuleStyle,columnRuleWidth,columnSpan,columnWidth,columns,contain,containIntrinsicBlockSize,containIntrinsicHeight,containIntrinsicInlineSize,containIntrinsicSize,containIntrinsicWidth,container,containerName,containerType,content,contentVisibility,cornerShape,counterIncrement,counterReset,counterSet,cursor,cx,cy,d,direction,display,dominantBaseline,emptyCells,fieldSizing,fill,fillOpacity,fillRule,filter,flex,flexBasis,flexDirection,flexFlow,flexGrow,flexShrink,flexWrap,float,floodColor,floodOpacity,font,fontFamily,fontFeatureSettings,fontKerning,fontLanguageOverride,fontOpticalSizing,fontPalette,fontSize,fontSizeAdjust,fontSmooth,fontStretch,fontStyle,fontSynthesis,fontSynthesisPosition,fontSynthesisSmallCaps,fontSynthesisStyle,fontSynthesisWeight,fontVariant,fontVariantAlternates,fontVariantCaps,fontVariantEastAsian,fontVariantEmoji,fontVariantLigatures,fontVariantNumeric,fontVariantPosition,fontVariationSettings,fontWeight,forcedColorAdjust,gap,grid,gridArea,gridAutoColumns,gridAutoFlow,gridAutoRows,gridColumn,gridColumnEnd,gridColumnGap,gridColumnStart,gridGap,gridRow,gridRowEnd,gridRowGap,gridRowStart,gridTemplate,gridTemplateAreas,gridTemplateColumns,gridTemplateRows,hangingPunctuation,height,hyphenateCharacter,hyphenateLimitChars,hyphens,imageOrientation,imageRendering,imageResolution,imeMode,initialLetter,initialLetterAlign,inlineSize,inset,insetBlock,insetBlockEnd,insetBlockStart,insetInline,insetInlineEnd,insetInlineStart,interpolateSize,isolation,justifyContent,justifyItems,justifySelf,justifyTracks,left,letterSpacing,lightingColor,lineBreak,lineClamp,lineHeight,lineHeightStep,listStyle,listStyleImage,listStylePosition,listStyleType,margin,marginBlock,marginBlockEnd,marginBlockStart,marginBottom,marginInline,marginInlineEnd,marginInlineStart,marginLeft,marginRight,marginTop,marginTrim,marker,markerEnd,markerMid,markerStart,mask,maskBorder,maskBorderMode,maskBorderOutset,maskBorderRepeat,maskBorderSlice,maskBorderSource,maskBorderWidth,maskClip,maskComposite,maskImage,maskMode,maskOrigin,maskPosition,maskRepeat,maskSize,maskType,masonryAutoFlow,mathDepth,mathShift,mathStyle,maxBlockSize,maxHeight,maxInlineSize,maxLines,maxWidth,minBlockSize,minHeight,minInlineSize,minWidth,mixBlendMode,objectFit,objectPosition,offset,offsetAnchor,offsetDistance,offsetPath,offsetPosition,offsetRotate,opacity,order,orphans,outline,outlineColor,outlineOffset,outlineStyle,outlineWidth,overflow,overflowAnchor,overflowBlock,overflowClipBox,overflowClipMargin,overflowInline,overflowWrap,overflowX,overflowY,overlay,overscrollBehavior,overscrollBehaviorBlock,overscrollBehaviorInline,overscrollBehaviorX,overscrollBehaviorY,padding,paddingBlock,paddingBlockEnd,paddingBlockStart,paddingBottom,paddingInline,paddingInlineEnd,paddingInlineStart,paddingLeft,paddingRight,paddingTop,page,pageBreakAfter,pageBreakBefore,pageBreakInside,paintOrder,perspective,perspectiveOrigin,placeContent,placeItems,placeSelf,pointerEvents,position,positionAnchor,positionArea,positionTry,positionTryFallbacks,positionTryOrder,positionVisibility,printColorAdjust,quotes,r,resize,right,rotate,rowGap,rubyAlign,rubyMerge,rubyPosition,rx,ry,scale,scrollBehavior,scrollMargin,scrollMarginBlock,scrollMarginBlockEnd,scrollMarginBlockStart,scrollMarginBottom,scrollMarginInline,scrollMarginInlineEnd,scrollMarginInlineStart,scrollMarginLeft,scrollMarginRight,scrollMarginTop,scrollPadding,scrollPaddingBlock,scrollPaddingBlockEnd,scrollPaddingBlockStart,scrollPaddingBottom,scrollPaddingInline,scrollPaddingInlineEnd,scrollPaddingInlineStart,scrollPaddingLeft,scrollPaddingRight,scrollPaddingTop,scrollSnapAlign,scrollSnapCoordinate,scrollSnapDestination,scrollSnapPointsX,scrollSnapPointsY,scrollSnapStop,scrollSnapType,scrollSnapTypeX,scrollSnapTypeY,scrollTimeline,scrollTimelineAxis,scrollTimelineName,scrollbarColor,scrollbarGutter,scrollbarWidth,shapeImageThreshold,shapeMargin,shapeOutside,shapeRendering,stopColor,stopOpacity,stroke,strokeDasharray,strokeDashoffset,strokeLinecap,strokeLinejoin,strokeMiterlimit,strokeOpacity,strokeWidth,tabSize,tableLayout,textAlign,textAlignLast,textAnchor,textBox,textBoxEdge,textBoxTrim,textCombineUpright,textDecoration,textDecorationColor,textDecorationLine,textDecorationSkip,textDecorationSkipInk,textDecorationStyle,textDecorationThickness,textEmphasis,textEmphasisColor,textEmphasisPosition,textEmphasisStyle,textIndent,textJustify,textOrientation,textOverflow,textRendering,textShadow,textSizeAdjust,textSpacingTrim,textTransform,textUnderlineOffset,textUnderlinePosition,textWrap,textWrapMode,textWrapStyle,timelineScope,top,touchAction,transform,transformBox,transformOrigin,transformStyle,transition,transitionBehavior,transitionDelay,transitionDuration,transitionProperty,transitionTimingFunction,translate,unicodeBidi,userSelect,vectorEffect,verticalAlign,viewTimeline,viewTimelineAxis,viewTimelineInset,viewTimelineName,viewTransitionName,visibility,whiteSpace,whiteSpaceCollapse,widows,width,willChange,wordBreak,wordSpacing,wordWrap,writingMode,x,y,zIndex,zoom,alignmentBaseline,baselineShift,colorInterpolation,colorRendering,glyphOrientationVertical".split(",").concat(xt),kt=new Map(St.map((e=>[e,!0])));function Ct(e){const t=Object.create(null);return n=>(void 0===t[n]&&(t[n]=e(n)),t[n])}var _t=/&|@/,Tt=Ct((e=>kt.has(e)||e.startsWith("--")||_t.test(e)));function Rt(e){const t=Object.assign({},e);for(let e in t)void 0===t[e]&&delete t[e];return t}function Et(e,t){const n={};for(const r in e){const i=t(r,e[r]);n[i[0]]=i[1]}return n}function Mt(e,t){const n={};return vt(e,((e,t)=>{e&&(n[t.join(".")]=e.value)}),{stop:t}),n}var Pt=Object.defineProperty,At=(e,t,n)=>((e,t,n)=>t in e?Pt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);function $t(e){if(null===e)return"null";if(void 0===e)return"undefined";const t=typeof e;return"string"===t?`s:${e}`:"number"===t?`n:${e}`:"boolean"===t?`b:${e}`:"function"===t?`f:${e.name||"anonymous"}`:Array.isArray(e)?`a:[${e.map($t).join(",")}]`:"object"===t?`o:{${Object.keys(e).sort().map((t=>`${t}:${$t(e[t])}`)).join(",")}}`:String(e)}class zt{constructor(e=500){At(this,"cache",new Map),At(this,"maxSize"),this.maxSize=e}get(e){const t=this.cache.get(e);return void 0!==t&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){const e=this.cache.keys().next().value;void 0!==e&&this.cache.delete(e)}this.cache.set(e,t)}clear(){this.cache.clear()}}const Qt=e=>{const t=new zt;return function(...n){const r=1===n.length?$t(n[0]):n.map($t).join("|");let i=t.get(r);return void 0===i&&(i=e.apply(this,n),t.set(r,i)),i}},It=(e,t)=>((e,t)=>{const n={},r={},i=Object.keys(e);for(const o of i)t(o)?r[o]=e[o]:n[o]=e[o];return[r,n]})(e,pt(t)?t:e=>t.includes(e)),Nt=(...e)=>{const t=e.reduce(((e,t)=>(null!=t&&t.forEach((t=>e.add(t))),e)),new Set([]));return Array.from(t)},Dt=16,Wt="px",Lt="em",Ht="rem";function Vt(e=""){const t=new RegExp(String.raw`-?\d+(?:\.\d+|\d*)`),n=new RegExp(`${Wt}|${Lt}|${Ht}`),r=e.match(new RegExp(`${t.source}(${n.source})`));return r?.[1]}function Bt(e=""){if("number"==typeof e)return`${e}px`;const t=Vt(e);return t?t===Wt?e:t===Lt||t===Ht?`${parseFloat(e)*Dt}${Wt}`:void 0:e}function jt(e=""){const t=Vt(e);return t?t===Ht?e:t===Lt?`${parseFloat(e)}${Ht}`:t===Wt?`${parseFloat(e)/Dt}${Ht}`:void 0:e}function Zt(e){return jt(parseFloat(Bt(e)??"")-.04+"px")}function Xt({min:e,max:t}){return null==e&&null==t?"":["@media screen",e&&`(min-width: ${e})`,t&&`(max-width: ${t})`].filter(Boolean).join(" and ")}const Ft=/^@|&|&$/,Yt=Object.freeze(Object.create(null)),qt=Object.freeze([]);function Ut(){return Object.create(null)}const Gt=e=>({minMax:new RegExp(`(!?\\(\\s*min(-device-)?-${e})(.|\n)+\\(\\s*max(-device)?-${e}`,"i"),min:new RegExp(`\\(\\s*min(-device)?-${e}`,"i"),maxMin:new RegExp(`(!?\\(\\s*max(-device)?-${e})(.|\n)+\\(\\s*min(-device)?-${e}`,"i"),max:new RegExp(`\\(\\s*max(-device)?-${e}`,"i")}),Kt=Gt("width"),Jt=Gt("height"),en=e=>({isMin:fn(e.minMax,e.maxMin,e.min),isMax:fn(e.maxMin,e.minMax,e.max)}),{isMin:tn,isMax:nn}=en(Kt),{isMin:rn,isMax:on}=en(Jt),sn=/print/i,an=/^print$/i,ln=/(-?\d*\.?\d+)(ch|em|ex|px|rem)/,cn=/(\d)/,hn=Number.MAX_VALUE,un={ch:8.8984375,em:16,rem:16,ex:8.296875,px:1};function dn(e){const t=ln.exec(e)||(tn(e)||rn(e)?cn.exec(e):null);if(!t)return hn;if("0"===t[0])return 0;const n=parseFloat(t[1]),r=t[2];return n*(un[r]||1)}function fn(e,t,n){return r=>e.test(r)||!t.test(r)&&n.test(r)}const pn=Qt(((e,t)=>{const n=function(e,t){const n=sn.test(e),r=an.test(e),i=sn.test(t),o=an.test(t);return n&&i?!r&&o?1:r&&!o?-1:e.localeCompare(t):n?1:i?-1:null}(e,t);if(null!==n)return n;const r=tn(e)||rn(e),i=nn(e)||on(e),o=tn(t)||rn(t),s=nn(t)||on(t);if(r&&s)return-1;if(i&&o)return 1;const a=dn(e),l=dn(t);return a===hn&&l===hn?e.localeCompare(t):a===hn?1:l===hn?-1:a!==l?a>l?i?-1:1:i?1:-1:e.localeCompare(t)}));function gn(e){return e.sort((([e],[t])=>pn(e,t)))}function mn(e){const t=[],n=[],r={};for(const[i,o]of Object.entries(e))i.startsWith("@media")?t.push([i,o]):i.startsWith("@container")?n.push([i,o]):dt(o)?r[i]=mn(o):r[i]=o;const i=gn(t),o=gn(n);return{...r,...Object.fromEntries(i),...Object.fromEntries(o)}}const bn=/\s*!(important)?/i,vn=Qt((e=>!!ft(e)&&bn.test(e))),yn=Qt((e=>ft(e)?e.replace(bn,"").trim():e));function On(e){const{transform:t,conditions:n,normalize:r}=e,i=(o=e,Qt((function(...e){return mt({},...function(e){const t=function(...e){return e.filter((e=>{if(!dt(e))return!1;const t=Rt(e);return Object.keys(t).length>0}))}(...e);return 1===t.length?t:t.map((e=>o.normalize(e)))}(e))})));var o;return Qt((function(...e){const o=i(...e),s=r(o),a=Ut();return vt(s,((e,r)=>{if(null==e)return;const[i,...o]=n.sort(r).map(n.resolve),s=vn(e);s&&(e=yn(e));let l=t(i,e)??Yt;l=vt(l,(e=>ft(e)&&s?`${e} !important`:e),{getKey:e=>n.expandAtRule(e)}),function(e,t,n){let r=e;for(const e of t)e&&(r[e]||(r[e]=Ut()),r=r[e]);mt(r,n)}(a,o.flat(),l)})),mn(a)}))}const wn=(...e)=>{const t=[];for(let n=0;n({base:Yt,variants:Yt,defaultVariants:Yt,compoundVariants:[],...e});const kn={reset:"reset",base:"base",tokens:"tokens",recipes:"recipes"},Cn={reset:0,base:1,tokens:2,recipes:3},Tn=(e,t)=>e.filter((e=>e.css[t])).map((e=>({...e,css:e.css[t]}))),Rn=/([\0-\x1f\x7f]|^-?\d)|^-$|^-|[^\x80-\uFFFF\w-]/g,En=function(e,t){return t?"\0"===e?"�":"-"===e&&1===e.length?"\\-":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16):"\\"+e},Mn=e=>(e+"").replace(Rn,En),Pn=(e,t)=>{let n="",r=0,i="char",o="",s="";const a=[];for(;r{let t=0;const n=["("];for(;t{e instanceof Map?t[n]=Object.fromEntries(e):t[n]=e})),t}const zn=/({([^}]*)})/g,Qn=/[{}]/g,In=/\w+\.\w+/,Nn=e=>{if(!ft(e))return[];const t=e.match(zn);return t?t.map((e=>e.replace(Qn,"").trim())):[]};function Dn(e){if(!e.extensions?.references)return e.extensions?.cssVar?.ref??e.value;const t=e.extensions.references??{};let n=e.value;const r=Object.keys(t);for(let e=0;et.map(Ln).join(` ${e} `).replace(Wn,""),Vn=(...e)=>`calc(${Hn("+",...e)})`,Bn=(...e)=>`calc(${Hn("-",...e)})`,jn=(...e)=>`calc(${Hn("*",...e)})`,Zn=(...e)=>`calc(${Hn("/",...e)})`,Xn=e=>{const t=Ln(e);return null==t||Number.isNaN(parseFloat(t))?jn(t,-1):String(t).startsWith("-")?String(t).slice(1):`-${t}`},Fn=Object.assign((e=>({add:(...t)=>Fn(Vn(e,...t)),subtract:(...t)=>Fn(Bn(e,...t)),multiply:(...t)=>Fn(jn(e,...t)),divide:(...t)=>Fn(Zn(e,...t)),negate:()=>Fn(Xn(e)),toString:()=>e.toString()})),{add:Vn,subtract:Bn,multiply:jn,divide:Zn,negate:Xn}),Yn={enforce:"pre",transform(e){const{prefix:t,allTokens:n,formatCssVar:r,formatTokenName:i,registerToken:o}=e;n.filter((({extensions:e})=>"spacing"===e.category)).forEach((e=>{const n=e.path.slice(),s=r(n,t);if(ft(e.value)&&"0rem"===e.value)return;const a=[...e.path],l=a[a.length-1];null!=l&&(a[a.length-1]=`-${l}`);const c={...e,value:Fn.negate(s.ref),name:i(a),path:a,extensions:{...e.extensions,negative:!0,prop:`-${e.extensions.prop}`,originalPath:n}};o(c)}))}},qn=new Set(["spacing","sizes","borderWidths","fontSizes","radii"]),Un={enforce:"post",transform(e){const t=e.allTokens.filter((e=>qn.has(e.extensions.category)&&!e.extensions.negative));t.forEach((e=>{Object.assign(e.extensions,{pixelValue:Bt(e.value)})}))}},Gn={enforce:"post",transform(e){const{allTokens:t,registerToken:n,formatTokenName:r}=e,i=t.filter((({extensions:e})=>"colors"===e.category)),o=new Map,s=new Map;i.forEach((e=>{const{colorPalette:t}=e.extensions;t&&(t.keys.forEach((e=>{o.set(r(e),e)})),t.roots.forEach((n=>{const i=r(n),a=s.get(i)||[];if(a.push(e),s.set(i,a),e.extensions.default&&1===n.length){const e=t.keys[0]?.filter(Boolean);if(!e.length)return;const i=n.concat(e);o.set(r(i),[])}})))})),o.forEach((e=>{const t=["colors","colorPalette",...e].filter(Boolean),i=r(t),o=r(t.slice(1));n({name:i,value:i,originalValue:i,path:t,extensions:{condition:"base",originalPath:t,category:"colors",prop:o,virtual:!0}},"pre")}))}},Kn={enforce:"post",transform(e){e.allTokens=e.allTokens.filter((e=>""!==e.value))}},Jn=[Yn,Gn,Un,Kn],er={type:"extensions",enforce:"pre",name:"tokens/css-var",transform(e,t){const{prefix:n,formatCssVar:r}=t,{negative:i,originalPath:o}=e.extensions;return{cssVar:r((i?o:e.path).filter(Boolean),n)}}},tr={enforce:"post",type:"value",name:"tokens/conditionals",transform(e,t){const{prefix:n,formatCssVar:r}=t,i=Nn(e.value);return i.length?(i.forEach((t=>{const i=r(t.split("."),n);e.value=e.value.replace(`{${i.ref}}`,i)})),e.value):e.value}},nr={type:"extensions",enforce:"pre",name:"tokens/colors/colorPalette",match:e=>"colors"===e.extensions.category&&!e.extensions.virtual,transform(e,t){let n=e.path.slice();if(n.pop(),n.shift(),0===n.length){const t=[...e.path];t.shift(),n=t}if(0===n.length)return{};const r=n.reduce(((e,t,n,r)=>{const i=r.slice(0,n+1);return e.push(i),e}),[]),i=n[0],o=t.formatTokenName(n),s=e.path.slice(e.path.indexOf(i)+1).reduce(((e,t,n,r)=>(e.push(r.slice(n)),e)),[]);return 0===s.length&&s.push([""]),{colorPalette:{value:o,roots:r,keys:s}}}},rr=[er,tr,nr],ir=e=>dt(e)&&Object.prototype.hasOwnProperty.call(e,"value");function or(e){const{prefix:t="",tokens:n={},semanticTokens:r={},breakpoints:i={}}=e,o=e=>e.join("."),s=[],a=new Map,l=new Map,c=new Map,h=new Map,u=new Map,d=new Map,f=new Map,p=new Map,g=[];function m(e,t){s.push(e),a.set(e.name,e),t&&p.forEach((n=>{n.enforce===t&&C(n,e)}))}const b=function(e){return e?{breakpoints:yt(e,(e=>({value:e}))),sizes:Et(e,((e,t)=>[`breakpoint-${e}`,{value:t}]))}:{breakpoints:{},sizes:{}}}(i),v=Rt({...n,breakpoints:b.breakpoints,sizes:{...n.sizes,...b.sizes}});function y(e){return a.get(e)}let O={};const w=Qt(((e,t)=>u.get(e)??t)),x=Qt((e=>O[e]||null)),S=Qt((e=>Pn(e,(e=>{if(!e)return;if(e.includes("/")){const t=((e,t)=>{if(!e||"string"!=typeof e)return{invalid:!0,value:e};const[n,r]=e.split("/");if(!n||!r)return{invalid:!0,value:n};const i=w(n),o=y(`opacity.${r}`)?.value;if(!o&&isNaN(Number(r)))return{invalid:!0,value:n};const s=i??n;return{invalid:!1,color:s,value:`color-mix(in srgb, ${s} ${o?100*Number(o)+"%":`${r}%`}, transparent)`}})(e);if(t.invalid)throw new Error("Invalid color mix at "+e+": "+t.value);return t.value}return w(e)||(In.test(e)?Mn(e):e)})))),k={prefix:t,allTokens:s,tokenMap:a,registerToken:m,getByName:y,formatTokenName:o,formatCssVar:(e,t)=>et(e.join("-"),{prefix:t}),flatMap:u,cssVarMap:c,categoryMap:f,colorPaletteMap:h,getVar:w,getCategoryValues:x,expandReferenceInValue:S};function C(e,t){if(t.extensions.references)return;if(pt(e.match)&&!e.match(t))return;const n=(r=t,e.transform(r,k));var r;switch(!0){case"extensions"===e.type:Object.assign(t.extensions,n);break;case"value"===e.type:t.value=n;break;default:t[e.type]=n}}function _(e){g.forEach((t=>{t.enforce===e&&t.transform(k)}))}function T(e){p.forEach((t=>{t.enforce===e&&s.forEach((e=>{C(t,e)}))}))}return vt(v,((e,t)=>{const n=t.includes("DEFAULT"),r=(t=sr(t))[0],i=o(t),s=ft(e)?{value:e}:e,a={value:s.value,originalValue:s.value,name:i,path:t,extensions:{condition:"base",originalPath:t,category:r,prop:o(t.slice(1))}};n&&(a.extensions.default=!0),m(a)}),{stop:ir}),vt(r,((e,t)=>{const n=t.includes("DEFAULT"),r=(t=ar(sr(t)))[0],i=o(t),s=ft(e.value)?{value:{base:e.value}}:e,a={value:s.value.base||"",originalValue:s.value.base||"",name:i,path:t,extensions:{originalPath:t,category:r,conditions:s.value,condition:"base",prop:o(t.slice(1))}};n&&(a.extensions.default=!0),m(a)}),{stop:ir}),function(...e){e.forEach((e=>{p.set(e.name,e)}))}(...rr),function(...e){g.push(...e)}(...Jn),_("pre"),T("pre"),s.forEach((e=>{const t=function(e){if(!e.extensions.conditions)return;const{conditions:t}=e.extensions,n=[];return vt(t,((t,r)=>{const i=ar(r);if(!i.length)return;const o={...e,value:t,extensions:{...e.extensions,condition:i.join(":")}};n.push(o)})),n}(e);t&&0!==t.length&&t.forEach((e=>{m(e)}))})),s.forEach((e=>{if(!(e=>zn.test(e))(e.value))return;const t=function(e){const t=Nn(e),n=[];for(let e=0;e(e[t.name]=t,e)),{})})),s.forEach((e=>{Dn(e)})),_("post"),T("post"),s.forEach((e=>{!function(e){const{condition:t}=e.extensions;t&&(l.has(t)||l.set(t,new Set),l.get(t).add(e))}(e),function(e){const{category:t,prop:n}=e.extensions;t&&(f.has(t)||f.set(t,new Map),f.get(t).set(n,e))}(e),function(e){const{condition:t,negative:n,virtual:r,cssVar:i}=e.extensions;!n&&!r&&t&&i&&(c.has(t)||c.set(t,new Map),c.get(t).set(i.var,e.value))}(e),function(e){const{category:t,prop:n,cssVar:r,negative:i}=e.extensions;if(!t)return;d.has(t)||d.set(t,new Map);const o=i?e.extensions.conditions?e.originalValue:e.value:r.ref;d.get(t).set(n,o),u.set([t,n].join("."),o)}(e),function(e){const{colorPalette:t,virtual:n,default:r}=e.extensions;t&&!n&&t.roots.forEach((n=>{const i=o(n);h.has(i)||h.set(i,new Map);const s=function(e,t){const n=e.findIndex(((n,r)=>t.every(((t,n)=>e[r+n]===t))));return-1===n||(e.splice(n,t.length),e.splice(n,0,"colorPalette")),e}([...e.path],[...n]),a=y(o(s));if(!a||!a.extensions.cssVar)return;const{var:l}=a.extensions.cssVar;if(h.get(i).set(l,e.extensions.cssVar.ref),r&&1===n.length){const r=y(o(["colors","colorPalette"]));if(!r)return;const i=y(o(e.path));if(!i)return;const s=t.keys[0]?.filter(Boolean);if(!s.length)return;const a=o(n.concat(s));h.has(a)||h.set(a,new Map),h.get(a).set(r.extensions.cssVar.var,i.extensions.cssVar.ref)}}))}(e)})),O=$n(d),k}function sr(e){return"DEFAULT"===e[0]?e:e.filter((e=>"DEFAULT"!==e))}function ar(e){return e.filter((e=>"base"!==e))}var lr;function cr(e){const t=function(e){return Et(e,((e,t)=>[e,t]))}(e.config),n=e.tokens,r=new Map,i=new Map;function o(e,n){t[e]=n,s(e,n)}const s=(e,t)=>{const n=c(t);n&&(i.set(e,n),l(e,t))},a=new Map,l=(e,t)=>{if(!t)return;const n=c(t,(e=>`type:Tokens["${e}"]`));if("object"==typeof n&&n.type)return void a.set(e,new Set([`type:${n.type}`]));if(n){const t=new Set(Object.keys(n));a.set(e,t)}const r=a.get(e)??new Set;t.property&&a.set(e,r.add(`CssProperties["${t.property}"]`))},c=(e,t)=>{const{values:r}=e,i=e=>{const n=t?.(e);return n?{[n]:n}:void 0};if(ft(r))return i?.(r)??n.getCategoryValues(r)??Yt;if(Array.isArray(r)){const e={};for(let t=0;t({[e]:e.startsWith("--")?n.getVar(t,t):t}))),u=Object.assign(n.getVar,{raw:e=>n.getByName(e)}),d=Qt(((e,r)=>{const o=p(e);ft(r)&&!r.includes("_EMO_")&&(r=n.expandReferenceInValue(r));const s=t[o];if(!s)return h(o,r);const a=i.get(o)?.[r];return s.transform?s.transform(a??r,{raw:r,token:u,utils:{colorMix:e=>((e,t)=>{if(!e||"string"!=typeof e)return{invalid:!0,value:e};const[n,r]=e.split("/");if(!n||!r||"currentBg"===n)return{invalid:!0,value:n};const i=t(`colors.${n}`),o=t.raw(`opacity.${r}`)?.value;if(!o&&isNaN(Number(r)))return{invalid:!0,value:n};const s=i??n;return{invalid:!1,color:s,value:`color-mix(in srgb, ${s} ${o?100*Number(o)+"%":`${r}%`}, transparent)`}})(e,u)}}):h(e,a??r)}));(()=>{for(const[e,n]of Object.entries(t)){const{shorthand:t}=n??{};t&&(Array.isArray(t)?t:[t]).forEach((t=>r.set(t,e)))}})(),(()=>{const e=$n(n.colorPaletteMap);o("colorPalette",{values:Object.keys(e),transform:Qt((t=>e[t]))})})(),(()=>{for(const[e,n]of Object.entries(t))n&&s(e,n)})(),(()=>{for(const[e,n]of Object.entries(t))n&&l(e,n)})();const f=r.size>0,p=Qt((e=>r.get(e)??e)),g={keys:()=>[...Array.from(r.keys()),...Object.keys(t)],hasShorthand:f,transform:d,shorthands:r,resolveShorthand:p,register:o,getTypes:()=>{const e=new Map;for(const[t,n]of a.entries()){if(0===n.size){e.set(t,["string"]);continue}const r=Array.from(n).map((e=>e.startsWith("CssProperties")?e:e.startsWith("type:")?e.replace("type:",""):JSON.stringify(e)));e.set(t,r)}return e},addPropertyType:(e,t)=>{const n=a.get(e)??new Set;a.set(e,new Set([...n,...t]))}};return g}lr=["aspectRatios","zIndex","opacity","colors","fonts","fontSizes","fontWeights","lineHeights","letterSpacings","sizes","shadows","spacing","radii","cursor","borders","borderWidths","borderStyles","durations","easings","animations","blurs","gradients","breakpoints","assets"],Array.from(new Set(lr));const hr=e=>dt(e)&&"value"in e,ur=e=>({list:()=>Object.keys(Mt(e,hr)),search(e){return this.list().filter((t=>t.includes(e)))}}),dr=(e,t,n)=>({categoryKeys:t,list(t){const r=e.categoryMap.get(t),i=r?[...r.entries()]:[],o=[];for(let e=0;ee.includes(t)))}}),fr=e=>({list:()=>Object.keys(e),search(e){return this.list().filter((t=>t.includes(e)))}}),pr="var(--chakra-empty, )",gr={"*":{fontFeatureSettings:'"cv11"',"--ring-inset":pr,"--ring-offset-width":"0px","--ring-offset-color":"#fff","--ring-color":"rgba(66, 153, 225, 0.6)","--ring-offset-shadow":"0 0 #0000","--ring-shadow":"0 0 #0000",...Object.fromEntries(["brightness","contrast","grayscale","hue-rotate","invert","saturate","sepia","drop-shadow"].map((e=>[`--${e}`,pr]))),...Object.fromEntries(["blur","brightness","contrast","grayscale","hue-rotate","invert","opacity","saturate","sepia"].map((e=>[`--backdrop-${e}`,pr]))),"--global-font-mono":"fonts.mono","--global-font-body":"fonts.body","--global-color-border":"colors.border"},html:{color:"fg",bg:"bg",lineHeight:"1.5",colorPalette:"gray"},"*::placeholder, *[data-placeholder]":{color:"fg.muted/80"},"*::selection":{bg:"colorPalette.emphasized/80"}},mr={className:"chakra-badge",base:{display:"inline-flex",alignItems:"center",borderRadius:"l2",gap:"1",fontWeight:"medium",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap",userSelect:"none"},variants:{variant:{solid:{bg:"colorPalette.solid",color:"colorPalette.contrast"},subtle:{bg:"colorPalette.subtle",color:"colorPalette.fg"},outline:{color:"colorPalette.fg","--outline-shadow-legacy":"colors.colorPalette.muted","--outline-shadow":"colors.colorPalette.border",shadow:"inset 0 0 0px 1px var(--shadow-color)",shadowColor:"var(--outline-shadow, var(--outline-shadow-legacy))"},surface:{bg:"colorPalette.subtle",color:"colorPalette.fg",shadow:"inset 0 0 0px 1px var(--shadow-color)",shadowColor:"colorPalette.muted"},plain:{color:"colorPalette.fg"}},size:{xs:{textStyle:"2xs",px:"1",minH:"4"},sm:{textStyle:"xs",px:"1.5",minH:"5"},md:{textStyle:"sm",px:"2",minH:"6"},lg:{textStyle:"sm",px:"2.5",minH:"7"}}},defaultVariants:{variant:"subtle",size:"sm"}},br={className:"chakra-checkmark",base:{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:"0",color:"white",borderWidth:"1px",borderColor:"transparent",borderRadius:"l1",cursor:"checkbox",focusVisibleRing:"outside",_icon:{boxSize:"full"},_invalid:{colorPalette:"red",borderColor:"border.error"},_disabled:{opacity:"0.5",cursor:"disabled"}},variants:{size:{xs:{boxSize:"3"},sm:{boxSize:"4"},md:{boxSize:"5",p:"0.5"},lg:{boxSize:"6",p:"0.5"}},variant:{solid:{borderColor:"border.emphasized","&:is([data-state=checked], [data-state=indeterminate])":{bg:"colorPalette.solid",color:"colorPalette.contrast",borderColor:"colorPalette.solid"}},outline:{borderColor:"border","&:is([data-state=checked], [data-state=indeterminate])":{color:"colorPalette.fg",borderColor:"colorPalette.solid"}},subtle:{bg:"colorPalette.muted",borderColor:"colorPalette.muted","&:is([data-state=checked], [data-state=indeterminate])":{color:"colorPalette.fg"}},plain:{"&:is([data-state=checked], [data-state=indeterminate])":{color:"colorPalette.fg"}},inverted:{borderColor:"border",color:"colorPalette.fg","&:is([data-state=checked], [data-state=indeterminate])":{borderColor:"colorPalette.solid"}}},filled:{true:{bg:"bg"}}},defaultVariants:{variant:"solid",size:"md"}},{variants:vr,defaultVariants:yr}=mr,Or={className:"color-swatch",base:{boxSize:"var(--swatch-size)",shadow:"inset 0 0 0 1px rgba(0, 0, 0, 0.1)","--checker-size":"8px","--checker-bg":"colors.bg","--checker-fg":"colors.bg.emphasized",background:"linear-gradient(var(--color), var(--color)), repeating-conic-gradient(var(--checker-fg) 0%, var(--checker-fg) 25%, var(--checker-bg) 0%, var(--checker-bg) 50%) 0% 50% / var(--checker-size) var(--checker-size) !important",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:"0"},variants:{size:{"2xs":{"--swatch-size":"sizes.3.5"},xs:{"--swatch-size":"sizes.4"},sm:{"--swatch-size":"sizes.4.5"},md:{"--swatch-size":"sizes.5"},lg:{"--swatch-size":"sizes.6"},xl:{"--swatch-size":"sizes.7"},"2xl":{"--swatch-size":"sizes.8"},inherit:{"--swatch-size":"inherit"},full:{"--swatch-size":"100%"}},shape:{square:{borderRadius:"none"},circle:{borderRadius:"full"},rounded:{borderRadius:"l1"}}},defaultVariants:{size:"md",shape:"rounded"}},wr={className:"chakra-input",base:{width:"100%",minWidth:"0",outline:"0",position:"relative",appearance:"none",textAlign:"start",borderRadius:"l2",_disabled:{layerStyle:"disabled"},height:"var(--input-height)",minW:"var(--input-height)","--focus-color":"colors.colorPalette.focusRing","--error-color":"colors.border.error",_invalid:{focusRingColor:"var(--error-color)",borderColor:"var(--error-color)"}},variants:{size:{"2xs":{textStyle:"xs",px:"2","--input-height":"sizes.7"},xs:{textStyle:"xs",px:"2","--input-height":"sizes.8"},sm:{textStyle:"sm",px:"2.5","--input-height":"sizes.9"},md:{textStyle:"sm",px:"3","--input-height":"sizes.10"},lg:{textStyle:"md",px:"4","--input-height":"sizes.11"},xl:{textStyle:"md",px:"4.5","--input-height":"sizes.12"},"2xl":{textStyle:"lg",px:"5","--input-height":"sizes.16"}},variant:{outline:{bg:"transparent",borderWidth:"1px",borderColor:"border",focusVisibleRing:"inside",focusRingColor:"var(--focus-color)"},subtle:{borderWidth:"1px",borderColor:"transparent",bg:"bg.muted",focusVisibleRing:"inside",focusRingColor:"var(--focus-color)"},flushed:{bg:"transparent",borderBottomWidth:"1px",borderBottomColor:"border",borderRadius:"0",px:"0",_focusVisible:{borderColor:"var(--focus-color)",boxShadow:"0px 1px 0px 0px var(--focus-color)",_invalid:{borderColor:"var(--error-color)",boxShadow:"0px 1px 0px 0px var(--error-color)"}}}}},defaultVariants:{size:"md",variant:"outline"}},xr={className:"chakra-radiomark",base:{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,verticalAlign:"top",color:"white",borderWidth:"1px",borderColor:"transparent",borderRadius:"full",cursor:"radio",_focusVisible:{outline:"2px solid",outlineColor:"colorPalette.focusRing",outlineOffset:"2px"},_invalid:{colorPalette:"red",borderColor:"red.500"},_disabled:{opacity:"0.5",cursor:"disabled"},"& .dot":{height:"100%",width:"100%",borderRadius:"full",bg:"currentColor",scale:"0.4"}},variants:{variant:{solid:{borderWidth:"1px",borderColor:"border.emphasized",_checked:{bg:"colorPalette.solid",color:"colorPalette.contrast",borderColor:"colorPalette.solid"}},subtle:{borderWidth:"1px",bg:"colorPalette.muted",borderColor:"colorPalette.muted",color:"transparent",_checked:{color:"colorPalette.fg"}},outline:{borderWidth:"1px",borderColor:"inherit",_checked:{color:"colorPalette.fg",borderColor:"colorPalette.solid"},"& .dot":{scale:"0.6"}},inverted:{bg:"bg",borderWidth:"1px",borderColor:"inherit",_checked:{color:"colorPalette.solid",borderColor:"currentcolor"}}},size:{xs:{boxSize:"3"},sm:{boxSize:"4"},md:{boxSize:"5"},lg:{boxSize:"6"}},filled:{true:{bg:"bg"}}},defaultVariants:{variant:"solid",size:"md"}},Sr={badge:mr,button:{className:"chakra-button",base:{display:"inline-flex",appearance:"none",alignItems:"center",justifyContent:"center",userSelect:"none",position:"relative",borderRadius:"l2",whiteSpace:"nowrap",verticalAlign:"middle",borderWidth:"1px",borderColor:"transparent",cursor:"button",flexShrink:"0",outline:"0",lineHeight:"1.2",isolation:"isolate",fontWeight:"medium",transitionProperty:"common",transitionDuration:"moderate",focusVisibleRing:"outside",_disabled:{layerStyle:"disabled"},_icon:{flexShrink:"0"}},variants:{size:{"2xs":{h:"6",minW:"6",textStyle:"xs",px:"2",gap:"1",_icon:{width:"3.5",height:"3.5"}},xs:{h:"8",minW:"8",textStyle:"xs",px:"2.5",gap:"1",_icon:{width:"4",height:"4"}},sm:{h:"9",minW:"9",px:"3.5",textStyle:"sm",gap:"2",_icon:{width:"4",height:"4"}},md:{h:"10",minW:"10",textStyle:"sm",px:"4",gap:"2",_icon:{width:"5",height:"5"}},lg:{h:"11",minW:"11",textStyle:"md",px:"5",gap:"3",_icon:{width:"5",height:"5"}},xl:{h:"12",minW:"12",textStyle:"md",px:"5",gap:"2.5",_icon:{width:"5",height:"5"}},"2xl":{h:"16",minW:"16",textStyle:"lg",px:"7",gap:"3",_icon:{width:"6",height:"6"}}},variant:{solid:{bg:"colorPalette.solid",color:"colorPalette.contrast",borderColor:"transparent",_hover:{bg:"colorPalette.solid/90"},_expanded:{bg:"colorPalette.solid/90"}},subtle:{bg:"colorPalette.subtle",color:"colorPalette.fg",borderColor:"transparent",_hover:{bg:"colorPalette.muted"},_expanded:{bg:"colorPalette.muted"}},surface:{bg:"colorPalette.subtle",color:"colorPalette.fg",shadow:"0 0 0px 1px var(--shadow-color)",shadowColor:"colorPalette.muted",_hover:{bg:"colorPalette.muted"},_expanded:{bg:"colorPalette.muted"}},outline:{borderWidth:"1px","--outline-color-legacy":"colors.colorPalette.muted","--outline-color":"colors.colorPalette.border",borderColor:"var(--outline-color, var(--outline-color-legacy))",color:"colorPalette.fg",_hover:{bg:"colorPalette.subtle"},_expanded:{bg:"colorPalette.subtle"}},ghost:{bg:"transparent",color:"colorPalette.fg",_hover:{bg:"colorPalette.subtle"},_expanded:{bg:"colorPalette.subtle"}},plain:{color:"colorPalette.fg"}}},defaultVariants:{size:"md",variant:"solid"}},code:{className:"chakra-code",base:{fontFamily:"mono",alignItems:"center",display:"inline-flex",borderRadius:"l2"},variants:vr,defaultVariants:yr},container:{className:"chakra-container",base:{position:"relative",maxWidth:"8xl",w:"100%",mx:"auto",px:{base:"4",md:"6",lg:"8"}},variants:{centerContent:{true:{display:"flex",flexDirection:"column",alignItems:"center"}},fluid:{true:{maxWidth:"full"}}}},heading:{className:"chakra-heading",base:{fontFamily:"heading",fontWeight:"semibold"},variants:{size:{xs:{textStyle:"xs"},sm:{textStyle:"sm"},md:{textStyle:"md"},lg:{textStyle:"lg"},xl:{textStyle:"xl"},"2xl":{textStyle:"2xl"},"3xl":{textStyle:"3xl"},"4xl":{textStyle:"4xl"},"5xl":{textStyle:"5xl"},"6xl":{textStyle:"6xl"},"7xl":{textStyle:"7xl"}}},defaultVariants:{size:"xl"}},input:wr,inputAddon:{className:"chakra-input-addon",base:{flex:"0 0 auto",width:"auto",display:"flex",alignItems:"center",whiteSpace:"nowrap",alignSelf:"stretch",borderRadius:"l2"},variants:{size:wr.variants.size,variant:{outline:{borderWidth:"1px",borderColor:"border",bg:"bg.muted"},subtle:{borderWidth:"1px",borderColor:"transparent",bg:"bg.emphasized"},flushed:{borderBottom:"1px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent"}}},defaultVariants:{size:"md",variant:"outline"}},kbd:{className:"chakra-kbd",base:{display:"inline-flex",alignItems:"center",fontWeight:"medium",fontFamily:"mono",flexShrink:"0",whiteSpace:"nowrap",wordSpacing:"-0.5em",userSelect:"none",px:"1",borderRadius:"l2"},variants:{variant:{raised:{bg:"colorPalette.subtle",color:"colorPalette.fg",borderWidth:"1px",borderBottomWidth:"2px",borderColor:"colorPalette.muted"},outline:{borderWidth:"1px",color:"colorPalette.fg"},subtle:{bg:"colorPalette.muted",color:"colorPalette.fg"},plain:{color:"colorPalette.fg"}},size:{sm:{textStyle:"xs",height:"4.5"},md:{textStyle:"sm",height:"5"},lg:{textStyle:"md",height:"6"}}},defaultVariants:{size:"md",variant:"raised"}},link:{className:"chakra-link",base:{display:"inline-flex",alignItems:"center",outline:"none",gap:"1.5",cursor:"pointer",borderRadius:"l1",focusRing:"outside"},variants:{variant:{underline:{color:"colorPalette.fg",textDecoration:"underline",textUnderlineOffset:"3px",textDecorationColor:"currentColor/20"},plain:{color:"colorPalette.fg",_hover:{textDecoration:"underline",textUnderlineOffset:"3px",textDecorationColor:"currentColor/20"}}}},defaultVariants:{variant:"plain"}},mark:{className:"chakra-mark",base:{bg:"transparent",color:"inherit",whiteSpace:"nowrap"},variants:{variant:{subtle:{bg:"colorPalette.subtle",color:"inherit"},solid:{bg:"colorPalette.solid",color:"colorPalette.contrast"},text:{fontWeight:"medium"},plain:{}}}},separator:{className:"chakra-separator",base:{display:"block",borderColor:"border"},variants:{variant:{solid:{borderStyle:"solid"},dashed:{borderStyle:"dashed"},dotted:{borderStyle:"dotted"}},orientation:{vertical:{borderInlineStartWidth:"var(--separator-thickness)"},horizontal:{borderTopWidth:"var(--separator-thickness)"}},size:{xs:{"--separator-thickness":"0.5px"},sm:{"--separator-thickness":"1px"},md:{"--separator-thickness":"2px"},lg:{"--separator-thickness":"3px"}}},defaultVariants:{size:"sm",variant:"solid",orientation:"horizontal"}},skeleton:{className:"chakra-skeleton",base:{},variants:{loading:{true:{borderRadius:"l2",boxShadow:"none",backgroundClip:"padding-box",cursor:"default",color:"transparent",pointerEvents:"none",userSelect:"none",flexShrink:"0","&::before, &::after, *":{visibility:"hidden"}},false:{background:"unset",animation:"fade-in var(--fade-duration, 0.1s) ease-out !important"}},variant:{pulse:{background:"bg.emphasized",animation:"pulse",animationDuration:"var(--duration, 1.2s)"},shine:{"--animate-from":"200%","--animate-to":"-200%","--start-color":"colors.bg.muted","--end-color":"colors.bg.emphasized",backgroundImage:"linear-gradient(270deg,var(--start-color),var(--end-color),var(--end-color),var(--start-color))",backgroundSize:"400% 100%",animation:"bg-position var(--duration, 5s) ease-in-out infinite"},none:{animation:"none"}}},defaultVariants:{variant:"pulse",loading:!0}},skipNavLink:{className:"chakra-skip-nav",base:{display:"inline-flex",bg:"bg.panel",padding:"2.5",borderRadius:"l2",fontWeight:"semibold",focusVisibleRing:"outside",textStyle:"sm",userSelect:"none",border:"0",height:"1px",width:"1px",margin:"-1px",outline:"0",overflow:"hidden",position:"absolute",clip:"rect(0 0 0 0)",_focusVisible:{clip:"auto",width:"auto",height:"auto",position:"fixed",top:"6",insetStart:"6"}}},spinner:{className:"chakra-spinner",base:{display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderWidth:"2px",borderRadius:"full",width:"var(--spinner-size)",height:"var(--spinner-size)",animation:"spin",animationDuration:"slowest","--spinner-track-color":"transparent",borderBottomColor:"var(--spinner-track-color)",borderInlineStartColor:"var(--spinner-track-color)"},variants:{size:{inherit:{"--spinner-size":"1em"},xs:{"--spinner-size":"sizes.3"},sm:{"--spinner-size":"sizes.4"},md:{"--spinner-size":"sizes.5"},lg:{"--spinner-size":"sizes.8"},xl:{"--spinner-size":"sizes.10"}}},defaultVariants:{size:"md"}},textarea:{className:"chakra-textarea",base:{width:"100%",minWidth:"0",outline:"0",position:"relative",appearance:"none",textAlign:"start",borderRadius:"l2",_disabled:{layerStyle:"disabled"},"--focus-color":"colors.colorPalette.focusRing","--error-color":"colors.border.error",_invalid:{focusRingColor:"var(--error-color)",borderColor:"var(--error-color)"}},variants:{size:{xs:{textStyle:"xs",px:"2",py:"1.5",scrollPaddingBottom:"1.5"},sm:{textStyle:"sm",px:"2.5",py:"2",scrollPaddingBottom:"2"},md:{textStyle:"sm",px:"3",py:"2",scrollPaddingBottom:"2"},lg:{textStyle:"md",px:"4",py:"3",scrollPaddingBottom:"3"},xl:{textStyle:"md",px:"4.5",py:"3.5",scrollPaddingBottom:"3.5"}},variant:{outline:{bg:"transparent",borderWidth:"1px",borderColor:"border",focusVisibleRing:"inside"},subtle:{borderWidth:"1px",borderColor:"transparent",bg:"bg.muted",focusVisibleRing:"inside"},flushed:{bg:"transparent",borderBottomWidth:"1px",borderBottomColor:"border",borderRadius:"0",px:"0",_focusVisible:{borderColor:"var(--focus-color)",boxShadow:"0px 1px 0px 0px var(--focus-color)"}}}},defaultVariants:{size:"md",variant:"outline"}},icon:{className:"chakra-icon",base:{display:"inline-block",lineHeight:"1em",flexShrink:"0",color:"currentcolor",verticalAlign:"middle"},variants:{size:{inherit:{},xs:{boxSize:"3"},sm:{boxSize:"4"},md:{boxSize:"5"},lg:{boxSize:"6"},xl:{boxSize:"7"},"2xl":{boxSize:"8"}}},defaultVariants:{size:"inherit"}},checkmark:br,radiomark:xr,colorSwatch:Or},kr=Ue.colors({bg:{DEFAULT:{value:{_light:"{colors.white}",_dark:"{colors.black}"}},subtle:{value:{_light:"{colors.gray.50}",_dark:"{colors.gray.950}"}},muted:{value:{_light:"{colors.gray.100}",_dark:"{colors.gray.900}"}},emphasized:{value:{_light:"{colors.gray.200}",_dark:"{colors.gray.800}"}},inverted:{value:{_light:"{colors.black}",_dark:"{colors.white}"}},panel:{value:{_light:"{colors.white}",_dark:"{colors.gray.950}"}},error:{value:{_light:"{colors.red.50}",_dark:"{colors.red.950}"}},warning:{value:{_light:"{colors.orange.50}",_dark:"{colors.orange.950}"}},success:{value:{_light:"{colors.green.50}",_dark:"{colors.green.950}"}},info:{value:{_light:"{colors.blue.50}",_dark:"{colors.blue.950}"}}},fg:{DEFAULT:{value:{_light:"{colors.black}",_dark:"{colors.gray.50}"}},muted:{value:{_light:"{colors.gray.600}",_dark:"{colors.gray.400}"}},subtle:{value:{_light:"{colors.gray.400}",_dark:"{colors.gray.500}"}},inverted:{value:{_light:"{colors.gray.50}",_dark:"{colors.black}"}},error:{value:{_light:"{colors.red.500}",_dark:"{colors.red.400}"}},warning:{value:{_light:"{colors.orange.600}",_dark:"{colors.orange.300}"}},success:{value:{_light:"{colors.green.600}",_dark:"{colors.green.300}"}},info:{value:{_light:"{colors.blue.600}",_dark:"{colors.blue.300}"}}},border:{DEFAULT:{value:{_light:"{colors.gray.200}",_dark:"{colors.gray.800}"}},muted:{value:{_light:"{colors.gray.100}",_dark:"{colors.gray.900}"}},subtle:{value:{_light:"{colors.gray.50}",_dark:"{colors.gray.950}"}},emphasized:{value:{_light:"{colors.gray.300}",_dark:"{colors.gray.700}"}},inverted:{value:{_light:"{colors.gray.800}",_dark:"{colors.gray.200}"}},error:{value:{_light:"{colors.red.500}",_dark:"{colors.red.400}"}},warning:{value:{_light:"{colors.orange.500}",_dark:"{colors.orange.400}"}},success:{value:{_light:"{colors.green.500}",_dark:"{colors.green.400}"}},info:{value:{_light:"{colors.blue.500}",_dark:"{colors.blue.400}"}}},gray:{contrast:{value:{_light:"{colors.white}",_dark:"{colors.black}"}},fg:{value:{_light:"{colors.gray.800}",_dark:"{colors.gray.200}"}},subtle:{value:{_light:"{colors.gray.100}",_dark:"{colors.gray.900}"}},muted:{value:{_light:"{colors.gray.200}",_dark:"{colors.gray.800}"}},emphasized:{value:{_light:"{colors.gray.300}",_dark:"{colors.gray.700}"}},solid:{value:{_light:"{colors.gray.900}",_dark:"{colors.white}"}},focusRing:{value:{_light:"{colors.gray.400}",_dark:"{colors.gray.400}"}},border:{value:{_light:"{colors.gray.200}",_dark:"{colors.gray.800}"}}},red:{contrast:{value:{_light:"white",_dark:"white"}},fg:{value:{_light:"{colors.red.700}",_dark:"{colors.red.300}"}},subtle:{value:{_light:"{colors.red.100}",_dark:"{colors.red.900}"}},muted:{value:{_light:"{colors.red.200}",_dark:"{colors.red.800}"}},emphasized:{value:{_light:"{colors.red.300}",_dark:"{colors.red.700}"}},solid:{value:{_light:"{colors.red.600}",_dark:"{colors.red.600}"}},focusRing:{value:{_light:"{colors.red.500}",_dark:"{colors.red.500}"}},border:{value:{_light:"{colors.red.500}",_dark:"{colors.red.400}"}}},orange:{contrast:{value:{_light:"white",_dark:"black"}},fg:{value:{_light:"{colors.orange.700}",_dark:"{colors.orange.300}"}},subtle:{value:{_light:"{colors.orange.100}",_dark:"{colors.orange.900}"}},muted:{value:{_light:"{colors.orange.200}",_dark:"{colors.orange.800}"}},emphasized:{value:{_light:"{colors.orange.300}",_dark:"{colors.orange.700}"}},solid:{value:{_light:"{colors.orange.600}",_dark:"{colors.orange.500}"}},focusRing:{value:{_light:"{colors.orange.500}",_dark:"{colors.orange.500}"}},border:{value:{_light:"{colors.orange.500}",_dark:"{colors.orange.400}"}}},green:{contrast:{value:{_light:"white",_dark:"white"}},fg:{value:{_light:"{colors.green.700}",_dark:"{colors.green.300}"}},subtle:{value:{_light:"{colors.green.100}",_dark:"{colors.green.900}"}},muted:{value:{_light:"{colors.green.200}",_dark:"{colors.green.800}"}},emphasized:{value:{_light:"{colors.green.300}",_dark:"{colors.green.700}"}},solid:{value:{_light:"{colors.green.600}",_dark:"{colors.green.600}"}},focusRing:{value:{_light:"{colors.green.500}",_dark:"{colors.green.500}"}},border:{value:{_light:"{colors.green.500}",_dark:"{colors.green.400}"}}},blue:{contrast:{value:{_light:"white",_dark:"white"}},fg:{value:{_light:"{colors.blue.700}",_dark:"{colors.blue.300}"}},subtle:{value:{_light:"{colors.blue.100}",_dark:"{colors.blue.900}"}},muted:{value:{_light:"{colors.blue.200}",_dark:"{colors.blue.800}"}},emphasized:{value:{_light:"{colors.blue.300}",_dark:"{colors.blue.700}"}},solid:{value:{_light:"{colors.blue.600}",_dark:"{colors.blue.600}"}},focusRing:{value:{_light:"{colors.blue.500}",_dark:"{colors.blue.500}"}},border:{value:{_light:"{colors.blue.500}",_dark:"{colors.blue.400}"}}},yellow:{contrast:{value:{_light:"black",_dark:"black"}},fg:{value:{_light:"{colors.yellow.800}",_dark:"{colors.yellow.300}"}},subtle:{value:{_light:"{colors.yellow.100}",_dark:"{colors.yellow.900}"}},muted:{value:{_light:"{colors.yellow.200}",_dark:"{colors.yellow.800}"}},emphasized:{value:{_light:"{colors.yellow.300}",_dark:"{colors.yellow.700}"}},solid:{value:{_light:"{colors.yellow.300}",_dark:"{colors.yellow.300}"}},focusRing:{value:{_light:"{colors.yellow.500}",_dark:"{colors.yellow.500}"}},border:{value:{_light:"{colors.yellow.500}",_dark:"{colors.yellow.500}"}}},teal:{contrast:{value:{_light:"white",_dark:"white"}},fg:{value:{_light:"{colors.teal.700}",_dark:"{colors.teal.300}"}},subtle:{value:{_light:"{colors.teal.100}",_dark:"{colors.teal.900}"}},muted:{value:{_light:"{colors.teal.200}",_dark:"{colors.teal.800}"}},emphasized:{value:{_light:"{colors.teal.300}",_dark:"{colors.teal.700}"}},solid:{value:{_light:"{colors.teal.600}",_dark:"{colors.teal.600}"}},focusRing:{value:{_light:"{colors.teal.500}",_dark:"{colors.teal.500}"}},border:{value:{_light:"{colors.teal.500}",_dark:"{colors.teal.400}"}}},purple:{contrast:{value:{_light:"white",_dark:"white"}},fg:{value:{_light:"{colors.purple.700}",_dark:"{colors.purple.300}"}},subtle:{value:{_light:"{colors.purple.100}",_dark:"{colors.purple.900}"}},muted:{value:{_light:"{colors.purple.200}",_dark:"{colors.purple.800}"}},emphasized:{value:{_light:"{colors.purple.300}",_dark:"{colors.purple.700}"}},solid:{value:{_light:"{colors.purple.600}",_dark:"{colors.purple.600}"}},focusRing:{value:{_light:"{colors.purple.500}",_dark:"{colors.purple.500}"}},border:{value:{_light:"{colors.purple.500}",_dark:"{colors.purple.400}"}}},pink:{contrast:{value:{_light:"white",_dark:"white"}},fg:{value:{_light:"{colors.pink.700}",_dark:"{colors.pink.300}"}},subtle:{value:{_light:"{colors.pink.100}",_dark:"{colors.pink.900}"}},muted:{value:{_light:"{colors.pink.200}",_dark:"{colors.pink.800}"}},emphasized:{value:{_light:"{colors.pink.300}",_dark:"{colors.pink.700}"}},solid:{value:{_light:"{colors.pink.600}",_dark:"{colors.pink.600}"}},focusRing:{value:{_light:"{colors.pink.500}",_dark:"{colors.pink.500}"}},border:{value:{_light:"{colors.pink.500}",_dark:"{colors.pink.400}"}}},cyan:{contrast:{value:{_light:"white",_dark:"white"}},fg:{value:{_light:"{colors.cyan.700}",_dark:"{colors.cyan.300}"}},subtle:{value:{_light:"{colors.cyan.100}",_dark:"{colors.cyan.900}"}},muted:{value:{_light:"{colors.cyan.200}",_dark:"{colors.cyan.800}"}},emphasized:{value:{_light:"{colors.cyan.300}",_dark:"{colors.cyan.700}"}},solid:{value:{_light:"{colors.cyan.600}",_dark:"{colors.cyan.600}"}},focusRing:{value:{_light:"{colors.cyan.500}",_dark:"{colors.cyan.500}"}},border:{value:{_light:"{colors.cyan.500}",_dark:"{colors.cyan.400}"}}}}),Cr=Ue.radii({l1:{value:"{radii.xs}"},l2:{value:"{radii.sm}"},l3:{value:"{radii.md}"}}),_r=Ue.shadows({xs:{value:{_light:"0px 1px 2px {colors.gray.900/10}, 0px 0px 1px {colors.gray.900/20}",_dark:"0px 1px 1px {black/64}, 0px 0px 1px inset {colors.gray.300/20}"}},sm:{value:{_light:"0px 2px 4px {colors.gray.900/10}, 0px 0px 1px {colors.gray.900/30}",_dark:"0px 2px 4px {black/64}, 0px 0px 1px inset {colors.gray.300/30}"}},md:{value:{_light:"0px 4px 8px {colors.gray.900/10}, 0px 0px 1px {colors.gray.900/30}",_dark:"0px 4px 8px {black/64}, 0px 0px 1px inset {colors.gray.300/30}"}},lg:{value:{_light:"0px 8px 16px {colors.gray.900/10}, 0px 0px 1px {colors.gray.900/30}",_dark:"0px 8px 16px {black/64}, 0px 0px 1px inset {colors.gray.300/30}"}},xl:{value:{_light:"0px 16px 24px {colors.gray.900/10}, 0px 0px 1px {colors.gray.900/30}",_dark:"0px 16px 24px {black/64}, 0px 0px 1px inset {colors.gray.300/30}"}},"2xl":{value:{_light:"0px 24px 40px {colors.gray.900/16}, 0px 0px 1px {colors.gray.900/30}",_dark:"0px 24px 40px {black/64}, 0px 0px 1px inset {colors.gray.300/30}"}},inner:{value:{_light:"inset 0 2px 4px 0 {black/5}",_dark:"inset 0 2px 4px 0 black"}},inset:{value:{_light:"inset 0 0 0 1px {black/5}",_dark:"inset 0 0 0 1px {colors.gray.300/5}"}}});var Tr=(e,t=[])=>({parts:(...n)=>{if(Er(t))return Tr(e,n);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...n)=>Tr(e,[...t,...n]),omit:(...n)=>Tr(e,t.filter((e=>!n.includes(e)))),rename:e=>Tr(e,t),keys:()=>t,build:()=>[...new Set(t)].reduce(((t,n)=>Object.assign(t,{[n]:{selector:[`&[data-scope="${Rr(e)}"][data-part="${Rr(n)}"]`,`& [data-scope="${Rr(e)}"][data-part="${Rr(n)}"]`].join(", "),attrs:{"data-scope":Rr(e),"data-part":Rr(n)}}})),{})}),Rr=e=>e.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),Er=e=>0===e.length,Mr=Tr("combobox").parts("root","clearTrigger","content","control","input","item","itemGroup","itemGroupLabel","itemIndicator","itemText","label","list","positioner","trigger");Mr.build();const Pr=Mr.extendWith("empty");var Ar=Tr("accordion").parts("root","item","itemTrigger","itemContent","itemIndicator"),$r=(Ar.build(),Tr("clipboard").parts("root","control","trigger","indicator","input","label")),zr=($r.build(),Tr("color-picker",["root","label","control","trigger","positioner","content","area","areaThumb","valueText","areaBackground","channelSlider","channelSliderLabel","channelSliderTrack","channelSliderThumb","channelSliderValueText","channelInput","transparencyGrid","swatchGroup","swatchTrigger","swatchIndicator","swatch","eyeDropperTrigger","formatTrigger","formatSelect"]));zr.build();const Qr=zr.extendWith("view");var Ir=Tr("date-picker").parts("clearTrigger","content","control","input","label","monthSelect","nextTrigger","positioner","presetTrigger","prevTrigger","rangeText","root","table","tableBody","tableCell","tableCellTrigger","tableHead","tableHeader","tableRow","trigger","view","viewControl","viewTrigger","yearSelect");Ir.build();const Nr=Ir.extendWith("view","valueText");var Dr=Tr("dialog").parts("trigger","backdrop","positioner","content","title","description","closeTrigger"),Wr=(Dr.build(),Tr("editable").parts("root","area","label","preview","input","editTrigger","submitTrigger","cancelTrigger","control"));Wr.build();const Lr=Tr("field").parts("root","errorText","helperText","input","label","select","textarea","requiredIndicator"),Hr=(Lr.build(),Tr("fieldset").parts("root","errorText","helperText","legend"));Hr.build();var Vr=Tr("file-upload").parts("root","dropzone","item","itemDeleteTrigger","itemGroup","itemName","itemPreview","itemPreviewImage","itemSizeText","label","trigger","clearTrigger"),Br=(Vr.build(),Tr("listbox").parts("label","input","item","itemText","itemIndicator","itemGroup","itemGroupLabel","content","root","valueText"));Br.build();const jr=Br.extendWith("empty");var Zr=Tr("menu").parts("arrow","arrowTip","content","contextTrigger","indicator","item","itemGroup","itemGroupLabel","itemIndicator","itemText","positioner","separator","trigger","triggerItem"),Xr=(Zr.build(),Tr("popover").parts("arrow","arrowTip","anchor","trigger","indicator","positioner","content","title","description","closeTrigger")),Fr=(Xr.build(),Tr("radio-group").parts("root","label","item","itemText","itemControl","indicator")),Yr=(Fr.build(),Tr("rating-group").parts("root","label","item","control")),qr=(Yr.build(),Tr("select").parts("label","positioner","trigger","indicator","clearTrigger","item","itemText","itemIndicator","itemGroup","itemGroupLabel","list","content","root","control","valueText")),Ur=(qr.build(),Tr("slider").parts("root","label","thumb","valueText","track","range","control","markerGroup","marker","draggingIndicator")),Gr=(Ur.build(),Tr("splitter").parts("root","panel","resizeTrigger","resizeTriggerIndicator")),Kr=(Gr.build(),Tr("switch").parts("root","label","control","thumb"));Kr.build();const Jr=Ar.extendWith("itemBody"),ei=Tr("action-bar").parts("positioner","content","separator","selectionTrigger","closeTrigger"),ti=Tr("alert").parts("title","description","root","indicator","content"),ni=Tr("breadcrumb").parts("link","currentLink","item","list","root","ellipsis","separator"),ri=Tr("blockquote").parts("root","icon","content","caption"),ii=Tr("card").parts("root","header","body","footer","title","description"),oi=Tr("checkbox-card",["root","control","label","description","addon","indicator","content"]),si=Tr("data-list").parts("root","item","itemLabel","itemValue"),ai=Nr.extendWith("indicatorGroup"),li=Dr.extendWith("header","body","footer","backdrop"),ci=Dr.extendWith("header","body","footer","backdrop"),hi=Wr.extendWith("textarea"),ui=Tr("empty-state",["root","content","indicator","title","description"]),di=Lr.extendWith("requiredIndicator"),fi=Hr.extendWith("content"),pi=Vr.extendWith("itemContent","dropzoneContent","fileText"),gi=Tr("list").parts("root","item","indicator"),mi=Zr.extendWith("itemCommand"),bi=Tr("select").parts("root","field","indicator"),vi=Xr.extendWith("header","body","footer"),yi=Fr.extendWith("itemAddon","itemIndicator"),Oi=yi.extendWith("itemContent","itemDescription"),wi=Yr.extendWith("itemIndicator"),xi=qr.extendWith("indicatorGroup"),Si=Pr.extendWith("indicatorGroup","empty"),ki=Ur.extendWith("markerIndicator","markerLabel"),Ci=Tr("stat").parts("root","label","helpText","valueText","valueUnit","indicator"),_i=Tr("status").parts("root","indicator"),Ti=Tr("steps",["root","list","item","trigger","indicator","separator","content","title","description","nextTrigger","prevTrigger","progress"]),Ri=Kr.extendWith("indicator"),Ei=Tr("table").parts("root","header","body","row","columnHeader","cell","footer","caption"),Mi=Tr("toast").parts("root","title","description","indicator","closeTrigger","actionTrigger"),Pi=Tr("tabs").parts("root","trigger","list","content","contentGroup","indicator"),Ai=Tr("tag").parts("root","label","closeTrigger","startElement","endElement"),$i=Tr("timeline").parts("root","item","content","separator","indicator","connector","title","description"),zi=Qr.extendWith("channelText"),Qi=Tr("code-block",["root","content","title","header","footer","control","overlay","code","codeText","copyTrigger","copyIndicator","collapseTrigger","collapseIndicator","collapseText"]),Ii=Gr.extendWith("resizeTriggerSeparator","resizeTriggerIndicator"),Ni=($r.extendWith("valueText"),jr),Di={className:"chakra-accordion",slots:Jr.keys(),base:{root:{width:"full","--accordion-radius":"radii.l2"},item:{overflowAnchor:"none"},itemTrigger:{display:"flex",alignItems:"center",textAlign:"start",width:"full",outline:"0",gap:"3",fontWeight:"medium",borderRadius:"var(--accordion-radius)",_focusVisible:{outline:"2px solid",outlineColor:"colorPalette.focusRing"},_disabled:{layerStyle:"disabled"}},itemBody:{pt:"var(--accordion-padding-y)",pb:"calc(var(--accordion-padding-y) * 2)"},itemContent:{overflow:"hidden",borderRadius:"var(--accordion-radius)",_open:{animationName:"expand-height, fade-in",animationDuration:"moderate"},_closed:{animationName:"collapse-height, fade-out",animationDuration:"moderate"}},itemIndicator:{transition:"rotate 0.2s",transformOrigin:"center",color:"fg.subtle",_open:{rotate:"180deg"},_icon:{width:"1.2em",height:"1.2em"}}},variants:{variant:{outline:{item:{borderBottomWidth:"1px"}},subtle:{itemTrigger:{px:"var(--accordion-padding-x)"},itemContent:{px:"var(--accordion-padding-x)"},item:{borderRadius:"var(--accordion-radius)",_open:{bg:"colorPalette.subtle"}}},enclosed:{root:{borderWidth:"1px",borderRadius:"var(--accordion-radius)",divideY:"1px",overflow:"hidden"},itemTrigger:{px:"var(--accordion-padding-x)"},itemContent:{px:"var(--accordion-padding-x)"},item:{_open:{bg:"bg.subtle"}}},plain:{}},size:{sm:{root:{"--accordion-padding-x":"spacing.3","--accordion-padding-y":"spacing.2"},itemTrigger:{textStyle:"sm",py:"var(--accordion-padding-y)"}},md:{root:{"--accordion-padding-x":"spacing.4","--accordion-padding-y":"spacing.2"},itemTrigger:{textStyle:"md",py:"var(--accordion-padding-y)"}},lg:{root:{"--accordion-padding-x":"spacing.4.5","--accordion-padding-y":"spacing.2.5"},itemTrigger:{textStyle:"lg",py:"var(--accordion-padding-y)"}}}},defaultVariants:{size:"md",variant:"outline"}},Wi={className:"chakra-action-bar",slots:ei.keys(),base:{positioner:{position:"fixed",display:"flex",pointerEvents:"none",insetInline:"0","--action-bar-offset":"spacing.4"},content:{bg:"bg.panel",shadow:"md",display:"flex",alignItems:"center",gap:"3",borderRadius:"l3",py:"2.5",px:"3",pointerEvents:"auto",translate:"calc(-1 * var(--scrollbar-width) / 2) 0px",_open:{animationName:"slide-from-bottom, fade-in",animationDuration:"moderate"},_closed:{animationName:"slide-to-bottom, fade-out",animationDuration:"faster"}},separator:{width:"1px",height:"5",bg:"border"},selectionTrigger:{display:"inline-flex",alignItems:"center",gap:"2",alignSelf:"stretch",textStyle:"sm",px:"4",py:"1",borderRadius:"l2",borderWidth:"1px",borderStyle:"dashed"}},variants:{placement:{bottom:{positioner:{bottom:"calc(env(safe-area-inset-bottom) + var(--action-bar-offset))",justifyContent:"center"}},"bottom-start":{positioner:{bottom:"calc(env(safe-area-inset-bottom) + var(--action-bar-offset))",justifyContent:"flex-start",ps:"var(--action-bar-offset)"}},"bottom-end":{positioner:{bottom:"calc(env(safe-area-inset-bottom) + var(--action-bar-offset))",justifyContent:"flex-end",pe:"var(--action-bar-offset)"}}}},defaultVariants:{placement:"bottom"}},Li={slots:ti.keys(),className:"chakra-alert",base:{root:{width:"full",display:"flex",alignItems:"flex-start",position:"relative",borderRadius:"l3"},title:{fontWeight:"medium"},description:{display:"inline"},indicator:{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:"0",width:"1em",height:"1em",_icon:{boxSize:"full"}},content:{display:"flex",flex:"1",gap:"1"}},variants:{status:{info:{root:{colorPalette:"blue"}},warning:{root:{colorPalette:"orange"}},success:{root:{colorPalette:"green"}},error:{root:{colorPalette:"red"}},neutral:{root:{colorPalette:"gray"}}},inline:{true:{content:{display:"inline-flex",flexDirection:"row",alignItems:"center"}},false:{content:{display:"flex",flexDirection:"column"}}},variant:{subtle:{root:{bg:"colorPalette.subtle",color:"colorPalette.fg"}},surface:{root:{bg:"colorPalette.subtle",color:"colorPalette.fg",shadow:"inset 0 0 0px 1px var(--shadow-color)",shadowColor:"colorPalette.muted"},indicator:{color:"colorPalette.fg"}},outline:{root:{color:"colorPalette.fg",shadow:"inset 0 0 0px 1px var(--shadow-color)","--outline-shadow-legacy":"colors.colorPalette.muted","--outline-shadow":"colors.colorPalette.border",shadowColor:"var(--outline-shadow, var(--outline-shadow-legacy))"},indicator:{color:"colorPalette.fg"}},solid:{root:{bg:"colorPalette.solid",color:"colorPalette.contrast"},indicator:{color:"colorPalette.contrast"}}},size:{sm:{root:{gap:"2",px:"3",py:"3",textStyle:"xs"},indicator:{textStyle:"lg"}},md:{root:{gap:"3",px:"4",py:"4",textStyle:"sm"},indicator:{textStyle:"xl"}},lg:{root:{gap:"3",px:"4",py:"4",textStyle:"md"},indicator:{textStyle:"2xl"}}}},defaultVariants:{status:"info",variant:"subtle",size:"md",inline:!1}};var Hi=Tr("avatar").parts("root","image","fallback");Hi.build();const Vi={slots:Hi.keys(),className:"chakra-avatar",base:{root:{display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:"medium",position:"relative",verticalAlign:"top",flexShrink:"0",userSelect:"none",width:"var(--avatar-size)",height:"var(--avatar-size)",fontSize:"var(--avatar-font-size)",borderRadius:"var(--avatar-radius)","&[data-group-item]":{borderWidth:"2px",borderColor:"bg"}},image:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"var(--avatar-radius)"},fallback:{lineHeight:"1",textTransform:"uppercase",fontWeight:"medium",fontSize:"var(--avatar-font-size)",borderRadius:"var(--avatar-radius)"}},variants:{size:{full:{root:{"--avatar-size":"100%","--avatar-font-size":"100%"}},"2xs":{root:{"--avatar-font-size":"fontSizes.2xs","--avatar-size":"sizes.6"}},xs:{root:{"--avatar-font-size":"fontSizes.xs","--avatar-size":"sizes.8"}},sm:{root:{"--avatar-font-size":"fontSizes.sm","--avatar-size":"sizes.9"}},md:{root:{"--avatar-font-size":"fontSizes.md","--avatar-size":"sizes.10"}},lg:{root:{"--avatar-font-size":"fontSizes.md","--avatar-size":"sizes.11"}},xl:{root:{"--avatar-font-size":"fontSizes.lg","--avatar-size":"sizes.12"}},"2xl":{root:{"--avatar-font-size":"fontSizes.xl","--avatar-size":"sizes.16"}}},variant:{solid:{root:{bg:"colorPalette.solid",color:"colorPalette.contrast"}},subtle:{root:{bg:"colorPalette.muted",color:"colorPalette.fg"}},outline:{root:{color:"colorPalette.fg",borderWidth:"1px","--outline-shadow-legacy":"colors.colorPalette.muted","--outline-shadow":"colors.colorPalette.border",borderColor:"var(--outline-shadow, var(--outline-shadow-legacy))"}}},shape:{square:{},rounded:{root:{"--avatar-radius":"radii.l3"}},full:{root:{"--avatar-radius":"radii.full"}}},borderless:{true:{root:{"&[data-group-item]":{borderWidth:"0px"}}}}},defaultVariants:{size:"md",shape:"full",variant:"subtle"}},Bi={className:"chakra-blockquote",slots:ri.keys(),base:{root:{position:"relative",display:"flex",flexDirection:"column",gap:"2"},caption:{textStyle:"sm",color:"fg.muted"},icon:{boxSize:"5"}},variants:{justify:{start:{root:{alignItems:"flex-start",textAlign:"start"}},center:{root:{alignItems:"center",textAlign:"center"}},end:{root:{alignItems:"flex-end",textAlign:"end"}}},variant:{subtle:{root:{paddingX:"5",borderStartWidth:"4px",borderStartColor:"colorPalette.muted"},icon:{color:"colorPalette.fg"}},solid:{root:{paddingX:"5",borderStartWidth:"4px",borderStartColor:"colorPalette.solid"},icon:{color:"colorPalette.solid"}},plain:{root:{paddingX:"5"},icon:{color:"colorPalette.solid"}}}},defaultVariants:{variant:"subtle",justify:"start"}},ji={className:"chakra-breadcrumb",slots:ni.keys(),base:{list:{display:"flex",alignItems:"center",wordBreak:"break-word",color:"fg.muted",listStyle:"none"},link:{outline:"0",textDecoration:"none",borderRadius:"l1",focusRing:"outside",display:"inline-flex",alignItems:"center",gap:"2"},item:{display:"inline-flex",alignItems:"center"},separator:{color:"fg.muted",opacity:"0.8",_icon:{boxSize:"1em"},_rtl:{rotate:"180deg"}},ellipsis:{display:"inline-flex",alignItems:"center",justifyContent:"center",_icon:{boxSize:"1em"}}},variants:{variant:{underline:{link:{color:"colorPalette.fg",textDecoration:"underline",textUnderlineOffset:"0.2em",textDecorationColor:"colorPalette.muted"},currentLink:{color:"colorPalette.fg"}},plain:{link:{color:"fg.muted",_hover:{color:"fg"}},currentLink:{color:"fg"}}},size:{sm:{list:{gap:"1",textStyle:"xs"}},md:{list:{gap:"1.5",textStyle:"sm"}},lg:{list:{gap:"2",textStyle:"md"}}}},defaultVariants:{variant:"plain",size:"md"}},Zi={className:"chakra-card",slots:ii.keys(),base:{root:{display:"flex",flexDirection:"column",position:"relative",minWidth:"0",wordWrap:"break-word",borderRadius:"l3",color:"fg",textAlign:"start"},title:{fontWeight:"semibold"},description:{color:"fg.muted",fontSize:"sm"},header:{paddingInline:"var(--card-padding)",paddingTop:"var(--card-padding)",display:"flex",flexDirection:"column",gap:"1.5"},body:{padding:"var(--card-padding)",flex:"1",display:"flex",flexDirection:"column"},footer:{display:"flex",alignItems:"center",gap:"2",paddingInline:"var(--card-padding)",paddingBottom:"var(--card-padding)"}},variants:{size:{sm:{root:{"--card-padding":"spacing.4"},title:{textStyle:"md"}},md:{root:{"--card-padding":"spacing.6"},title:{textStyle:"lg"}},lg:{root:{"--card-padding":"spacing.7"},title:{textStyle:"xl"}}},variant:{elevated:{root:{bg:"bg.panel",boxShadow:"md"}},outline:{root:{bg:"bg.panel",borderWidth:"1px",borderColor:"border"}},subtle:{root:{bg:"bg.muted"}}}},defaultVariants:{variant:"outline",size:"md"}};var Xi=Tr("carousel").parts("root","itemGroup","item","control","nextTrigger","prevTrigger","indicatorGroup","indicator","autoplayTrigger","progressText");Xi.build();const Fi={className:"carousel",slots:Xi.extendWith("progressText","autoplayIndicator").keys(),base:{root:{position:"relative",display:"flex",gap:"2",_horizontal:{flexDirection:"column"},_vertical:{flexDirection:"row"}},item:{_horizontal:{width:"100%"},_vertical:{height:"100%"}},control:{display:"flex",alignItems:"center",_horizontal:{flexDirection:"row",width:"100%"},_vertical:{flexDirection:"column",height:"100%"}},indicatorGroup:{display:"flex",justifyContent:"center",gap:"3",_horizontal:{flexDirection:"row"},_vertical:{flexDirection:"column"}},indicator:{width:"2.5",height:"2.5",borderRadius:"full",bg:"colorPalette.subtle",cursor:"button",_current:{bg:"colorPalette.solid"}}},defaultVariants:{}};var Yi=Tr("checkbox").parts("root","label","control","indicator");Yi.build();const qi={slots:Yi.extendWith("group").keys(),className:"chakra-checkbox",base:{root:{display:"inline-flex",gap:"2",alignItems:"center",verticalAlign:"top",position:"relative"},control:br.base,label:{fontWeight:"medium",userSelect:"none",_disabled:{opacity:"0.5"}}},variants:{size:{xs:{root:{gap:"1.5"},label:{textStyle:"xs"},control:br.variants?.size?.xs},sm:{root:{gap:"2"},label:{textStyle:"sm"},control:br.variants?.size?.sm},md:{root:{gap:"2.5"},label:{textStyle:"sm"},control:br.variants?.size?.md},lg:{root:{gap:"3"},label:{textStyle:"md"},control:br.variants?.size?.lg}},variant:{outline:{control:br.variants?.variant?.outline},solid:{control:br.variants?.variant?.solid},subtle:{control:br.variants?.variant?.subtle}}},defaultVariants:{variant:"solid",size:"md"}},Ui={slots:oi.keys(),className:"chakra-checkbox-card",base:{root:{display:"flex",flexDirection:"column",userSelect:"none",position:"relative",borderRadius:"l2",flex:"1",focusVisibleRing:"outside",_disabled:{opacity:"0.8"},_invalid:{outline:"2px solid",outlineColor:"border.error"}},control:{display:"inline-flex",flex:"1",position:"relative",borderRadius:"inherit",justifyContent:"var(--checkbox-card-justify)",alignItems:"var(--checkbox-card-align)"},label:{fontWeight:"medium",display:"flex",alignItems:"center",gap:"2",flex:"1",_disabled:{opacity:"0.5"}},description:{opacity:"0.64",textStyle:"sm",_disabled:{opacity:"0.5"}},addon:{_disabled:{opacity:"0.5"}},indicator:br.base,content:{display:"flex",flexDirection:"column",flex:"1",gap:"1",justifyContent:"var(--checkbox-card-justify)",alignItems:"var(--checkbox-card-align)"}},variants:{size:{sm:{root:{textStyle:"sm"},control:{padding:"3",gap:"1.5"},addon:{px:"3",py:"1.5",borderTopWidth:"1px"},indicator:br.variants?.size.sm},md:{root:{textStyle:"sm"},control:{padding:"4",gap:"2.5"},addon:{px:"4",py:"2",borderTopWidth:"1px"},indicator:br.variants?.size.md},lg:{root:{textStyle:"md"},control:{padding:"4",gap:"3.5"},addon:{px:"4",py:"2",borderTopWidth:"1px"},indicator:br.variants?.size.lg}},variant:{surface:{root:{borderWidth:"1px",borderColor:"border",_checked:{bg:"colorPalette.subtle",color:"colorPalette.fg",borderColor:"colorPalette.muted"},_disabled:{bg:"bg.muted"}},indicator:br.variants?.variant.solid},subtle:{root:{bg:"bg.muted"},control:{_checked:{bg:"colorPalette.muted",color:"colorPalette.fg"}},indicator:br.variants?.variant.plain},outline:{root:{borderWidth:"1px",borderColor:"border",_checked:{boxShadow:"0 0 0 1px var(--shadow-color)",boxShadowColor:"colorPalette.solid",borderColor:"colorPalette.solid"}},indicator:br.variants?.variant.solid},solid:{root:{borderWidth:"1px",_checked:{bg:"colorPalette.solid",color:"colorPalette.contrast",borderColor:"colorPalette.solid"}},indicator:br.variants?.variant.inverted}},justify:{start:{root:{"--checkbox-card-justify":"flex-start"}},end:{root:{"--checkbox-card-justify":"flex-end"}},center:{root:{"--checkbox-card-justify":"center"}}},align:{start:{root:{"--checkbox-card-align":"flex-start"},content:{textAlign:"start"}},end:{root:{"--checkbox-card-align":"flex-end"},content:{textAlign:"end"}},center:{root:{"--checkbox-card-align":"center"},content:{textAlign:"center"}}},orientation:{vertical:{control:{flexDirection:"column"}},horizontal:{control:{flexDirection:"row"}}}},defaultVariants:{size:"md",variant:"outline",align:"start",orientation:"horizontal"}},Gi={slots:Qi.keys(),className:"code-block",base:{root:{colorPalette:"gray",rounded:"var(--code-block-radius)",overflow:"hidden",bg:"bg",color:"fg",borderWidth:"1px","--code-block-max-height":"320px","--code-block-bg":"colors.bg","--code-block-fg":"colors.fg","--code-block-obscured-opacity":"0.5","--code-block-obscured-blur":"1px","--code-block-line-number-width":"sizes.3","--code-block-line-number-margin":"spacing.4","--code-block-highlight-bg":"{colors.teal.focusRing/20}","--code-block-highlight-border":"colors.teal.focusRing","--code-block-highlight-added-bg":"{colors.green.focusRing/20}","--code-block-highlight-added-border":"colors.green.focusRing","--code-block-highlight-removed-bg":"{colors.red.focusRing/20}","--code-block-highlight-removed-border":"colors.red.focusRing"},header:{display:"flex",alignItems:"center",gap:"2",position:"relative",px:"var(--code-block-padding)",minH:"var(--code-block-header-height)",mb:"calc(var(--code-block-padding) / 2 * -1)"},title:{display:"inline-flex",alignItems:"center",gap:"1.5",flex:"1",color:"fg.muted"},control:{gap:"1.5",display:"inline-flex",alignItems:"center"},footer:{display:"flex",alignItems:"center",justifyContent:"center",gap:"2",px:"var(--code-block-padding)",minH:"var(--code-block-header-height)"},content:{position:"relative",colorScheme:"dark",borderBottomRadius:"var(--code-block-radius)",maxHeight:"var(--code-block-max-height)","& ::selection":{bg:"blue.500/40"},_expanded:{maxHeight:"unset"}},overlay:{"--bg":"{colors.black/50}",display:"flex",alignItems:"flex-end",justifyContent:"center",padding:"4",bgImage:"linear-gradient(0deg,var(--bg) 25%,transparent 100%)",color:"white",minH:"5rem",pos:"absolute",bottom:"0",insetInline:"0",zIndex:"1",fontWeight:"medium",_expanded:{display:"none"}},code:{fontFamily:"mono",lineHeight:"tall",whiteSpace:"pre",counterReset:"line 0",overflowX:"auto",overflowY:"hidden"},codeText:{px:"var(--code-block-padding)",py:"var(--code-block-padding)",position:"relative",display:"block",width:"100%","&[data-has-focused]":{"& [data-line]:not([data-focused])":{transitionProperty:"opacity, filter",transitionDuration:"moderate",transitionTimingFunction:"ease-in-out",opacity:"var(--code-block-obscured-opacity)",filter:"blur(var(--code-block-obscured-blur))"},"&:hover":{"--code-block-obscured-opacity":"1","--code-block-obscured-blur":"0px"}},"&[data-has-line-numbers][data-plaintext]":{paddingInlineStart:"calc(var(--code-block-line-number-width) + var(--code-block-line-number-margin) + var(--code-block-padding))"},"& [data-line]":{position:"relative",paddingInlineEnd:"var(--code-block-padding)","--highlight-bg":"var(--code-block-highlight-bg)","--highlight-border":"var(--code-block-highlight-border)","&[data-highlight], &[data-diff]":{display:"inline-block",width:"full","&:after":{content:"''",display:"block",position:"absolute",top:"0",insetStart:"calc(var(--code-block-padding) * -1)",insetEnd:"0px",width:"calc(100% + var(--code-block-padding) * 2)",height:"100%",bg:"var(--highlight-bg)",borderStartWidth:"2px",borderStartColor:"var(--highlight-border)"}},"&[data-diff='added']":{"--highlight-bg":"var(--code-block-highlight-added-bg)","--highlight-border":"var(--code-block-highlight-added-border)"},"&[data-diff='removed']":{"--highlight-bg":"var(--code-block-highlight-removed-bg)","--highlight-border":"var(--code-block-highlight-removed-border)"}},"&[data-word-wrap]":{"&[data-plaintext], & [data-line]":{whiteSpace:"pre-wrap",wordBreak:"break-all"}},"&[data-has-line-numbers]":{"--content":"counter(line)","& [data-line]:before":{content:"var(--content)",counterIncrement:"line",width:"var(--code-block-line-number-width)",marginRight:"var(--code-block-line-number-margin)",display:"inline-block",textAlign:"end",userSelect:"none",whiteSpace:"nowrap",opacity:.4},"& [data-diff='added']:before":{content:"'+'"},"& [data-diff='removed']:before":{content:"'-'"}}}},variants:{size:{sm:{root:{"--code-block-padding":"spacing.4","--code-block-radius":"radii.md","--code-block-header-height":"sizes.8"},title:{textStyle:"xs"},code:{fontSize:"xs"}},md:{root:{"--code-block-padding":"spacing.4","--code-block-radius":"radii.lg","--code-block-header-height":"sizes.10"},title:{textStyle:"xs"},code:{fontSize:"sm"}},lg:{root:{"--code-block-padding":"spacing.5","--code-block-radius":"radii.xl","--code-block-header-height":"sizes.12"},title:{textStyle:"sm"},code:{fontSize:"sm"}}}},defaultVariants:{size:"md"}};var Ki=Tr("collapsible").parts("root","trigger","content","indicator");Ki.build();const Ji={slots:Ki.keys(),className:"chakra-collapsible",base:{content:{overflow:"hidden",_open:{animationName:"expand-height, fade-in",animationDuration:"moderate","&[data-has-collapsed-size]":{animationName:"expand-height"}},_closed:{animationName:"collapse-height, fade-out",animationDuration:"moderate","&[data-has-collapsed-size]":{animationName:"collapse-height"}}}}},eo={className:"colorPicker",slots:zi.keys(),base:{root:{display:"flex",flexDirection:"column",gap:"1.5"},label:{color:"fg",fontWeight:"medium",textStyle:"sm",_disabled:{opacity:"0.5"}},valueText:{textAlign:"start"},control:{display:"flex",alignItems:"center",flexDirection:"row",gap:"2",position:"relative"},swatchTrigger:{display:"flex",alignItems:"center",justifyContent:"center"},trigger:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"row",flexShrink:"0",gap:"2",textStyle:"sm",minH:"var(--input-height)",minW:"var(--input-height)",px:"1",rounded:"l2",_disabled:{opacity:"0.5"},"--focus-color":"colors.colorPalette.focusRing","&:focus-visible":{borderColor:"var(--focus-color)",outline:"1px solid var(--focus-color)"},"&[data-fit-content]":{"--input-height":"unset",px:"0",border:"0"}},content:{display:"flex",flexDirection:"column",bg:"bg.panel",borderRadius:"l3",boxShadow:"lg",width:"64",p:"4",gap:"3","--color-picker-z-index":"zIndex.popover",zIndex:"calc(var(--color-picker-z-index) + var(--layer-index, 0))",_open:{animationStyle:"slide-fade-in",animationDuration:"fast"},_closed:{animationStyle:"slide-fade-out",animationDuration:"faster"}},area:{height:"180px",borderRadius:"l2",overflow:"hidden"},areaThumb:{borderRadius:"full",height:"var(--thumb-size)",width:"var(--thumb-size)",borderWidth:"2px",borderColor:"white",shadow:"sm",focusVisibleRing:"mixed",focusRingColor:"white"},areaBackground:{height:"full"},channelSlider:{borderRadius:"l2",flex:"1"},channelSliderTrack:{height:"var(--slider-height)",borderRadius:"inherit",boxShadow:"inset 0 0 0 1px rgba(0,0,0,0.1)"},channelText:{textStyle:"xs",color:"fg.muted",fontWeight:"medium",textTransform:"capitalize"},swatchGroup:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"2"},swatch:{...Or.base,borderRadius:"l1"},swatchIndicator:{color:"white",rounded:"full"},channelSliderThumb:{borderRadius:"full",height:"var(--thumb-size)",width:"var(--thumb-size)",borderWidth:"2px",borderColor:"white",shadow:"sm",transform:"translate(-50%, -50%)",focusVisibleRing:"outside",focusRingOffset:"1px"},channelInput:{...wr.base,"&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:0}},formatSelect:{textStyle:"xs",textTransform:"uppercase",borderWidth:"1px",minH:"6",focusRing:"inside",rounded:"l2"},transparencyGrid:{borderRadius:"l2"},view:{display:"flex",flexDirection:"column",gap:"2"}},variants:{size:{"2xs":{channelInput:wr.variants?.size?.["2xs"],swatch:{"--swatch-size":"sizes.4.5"},trigger:{"--input-height":"sizes.7"},area:{"--thumb-size":"sizes.3"},channelSlider:{"--slider-height":"sizes.3","--thumb-size":"sizes.3"}},xs:{channelInput:wr.variants?.size?.xs,swatch:{"--swatch-size":"sizes.5"},trigger:{"--input-height":"sizes.8"},area:{"--thumb-size":"sizes.3.5"},channelSlider:{"--slider-height":"sizes.3.5","--thumb-size":"sizes.3.5"}},sm:{channelInput:wr.variants?.size?.sm,swatch:{"--swatch-size":"sizes.6"},trigger:{"--input-height":"sizes.9"},area:{"--thumb-size":"sizes.3.5"},channelSlider:{"--slider-height":"sizes.3.5","--thumb-size":"sizes.3.5"}},md:{channelInput:wr.variants?.size?.md,swatch:{"--swatch-size":"sizes.7"},trigger:{"--input-height":"sizes.10"},area:{"--thumb-size":"sizes.3.5"},channelSlider:{"--slider-height":"sizes.3.5","--thumb-size":"sizes.3.5"}},lg:{channelInput:wr.variants?.size?.lg,swatch:{"--swatch-size":"sizes.7"},trigger:{"--input-height":"sizes.11"},area:{"--thumb-size":"sizes.3.5"},channelSlider:{"--slider-height":"sizes.3.5","--thumb-size":"sizes.3.5"}},xl:{channelInput:wr.variants?.size?.xl,swatch:{"--swatch-size":"sizes.8"},trigger:{"--input-height":"sizes.12"},area:{"--thumb-size":"sizes.3.5"},channelSlider:{"--slider-height":"sizes.3.5","--thumb-size":"sizes.3.5"}},"2xl":{channelInput:wr.variants?.size?.["2xl"],swatch:{"--swatch-size":"sizes.10"},trigger:{"--input-height":"sizes.16"},area:{"--thumb-size":"sizes.3.5"},channelSlider:{"--slider-height":"sizes.3.5","--thumb-size":"sizes.3.5"}}},variant:{outline:{channelInput:wr.variants?.variant?.outline,trigger:{borderWidth:"1px"}},subtle:{channelInput:wr.variants?.variant?.subtle,trigger:{borderWidth:"1px",borderColor:"transparent",bg:"bg.muted"}}}},defaultVariants:{size:"md",variant:"outline"}},to={className:"chakra-combobox",slots:Si.keys(),base:{root:{display:"flex",flexDirection:"column",gap:"1.5",width:"full"},label:{fontWeight:"medium",userSelect:"none",textStyle:"sm",_disabled:{layerStyle:"disabled"}},control:{pos:"relative","--padding-factor":"1","--combobox-input-padding-end":"var(--combobox-input-padding-x)","&:has([data-part=trigger]), &:has([data-part=clear-trigger])":{"--combobox-input-padding-end":"calc(var(--combobox-input-height) * var(--padding-factor))"},"&:has([data-part=trigger]):has([data-part=clear-trigger]:not([hidden]))":{"--padding-factor":"1.5"}},input:{display:"flex",alignItems:"center",justifyContent:"space-between",background:"bg.panel",width:"full",minH:"var(--combobox-input-height)",ps:"var(--combobox-input-padding-x)",pe:"var(--combobox-input-padding-end)","--input-height":"var(--combobox-input-height)",borderRadius:"l2",outline:0,userSelect:"none",textAlign:"start",_placeholderShown:{color:"fg.muted"},_disabled:{layerStyle:"disabled"},"--focus-color":"colors.colorPalette.focusRing","--error-color":"colors.border.error",_invalid:{focusRingColor:"var(--error-color)",borderColor:"var(--error-color)"}},trigger:{display:"inline-flex",alignItems:"center",justifyContent:"center","--input-height":"var(--combobox-input-height)"},clearTrigger:{color:"fg.muted",pointerEvents:"auto",focusVisibleRing:"inside",focusRingWidth:"2px",rounded:"l1"},indicatorGroup:{display:"flex",alignItems:"center",justifyContent:"center",gap:"1",pos:"absolute",insetEnd:"0",top:"0",bottom:"0",px:"var(--combobox-input-padding-x)",_icon:{boxSize:"var(--combobox-indicator-size)"},"[data-disabled] &":{opacity:.5}},content:{background:"bg.panel",display:"flex",flexDirection:"column","--combobox-z-index":"zIndex.popover",zIndex:"calc(var(--combobox-z-index) + var(--layer-index, 0))",borderRadius:"l2",outline:0,maxH:"96",overflowY:"auto",boxShadow:"md",_open:{animationStyle:"slide-fade-in",animationDuration:"fast"},_closed:{animationStyle:"slide-fade-out",animationDuration:"0s"},"&[data-empty]:not(:has([data-scope=combobox][data-part=empty]))":{opacity:0}},item:{position:"relative",userSelect:"none",display:"flex",alignItems:"center",gap:"2",py:"var(--combobox-item-padding-y)",px:"var(--combobox-item-padding-x)",cursor:"option",justifyContent:"space-between",flex:"1",textAlign:"start",borderRadius:"l1",_highlighted:{bg:"bg.emphasized/60"},_disabled:{pointerEvents:"none",opacity:"0.5"},_icon:{boxSize:"var(--combobox-indicator-size)"}},empty:{py:"var(--combobox-item-padding-y)",px:"var(--combobox-item-padding-x)"},itemText:{flex:"1"},itemGroup:{pb:"var(--combobox-item-padding-y)",_last:{pb:"0"}},itemGroupLabel:{fontWeight:"medium",py:"var(--combobox-item-padding-y)",px:"var(--combobox-item-padding-x)"}},variants:{variant:{outline:{input:{bg:"transparent",borderWidth:"1px",borderColor:"border",focusVisibleRing:"inside"}},subtle:{input:{borderWidth:"1px",borderColor:"transparent",bg:"bg.muted",focusVisibleRing:"inside"}},flushed:{input:{bg:"transparent",borderBottomWidth:"1px",borderBottomColor:"border",borderRadius:"0",px:"0",_focusVisible:{borderColor:"var(--focus-color)",boxShadow:"0px 1px 0px 0px var(--focus-color)"}},indicatorGroup:{px:"0"}}},size:{xs:{root:{"--combobox-input-height":"sizes.8","--combobox-input-padding-x":"spacing.2","--combobox-indicator-size":"sizes.3.5"},input:{textStyle:"xs"},content:{"--combobox-item-padding-x":"spacing.1.5","--combobox-item-padding-y":"spacing.1","--combobox-indicator-size":"sizes.3.5",p:"1",textStyle:"xs"},trigger:{textStyle:"xs",gap:"1"}},sm:{root:{"--combobox-input-height":"sizes.9","--combobox-input-padding-x":"spacing.2.5","--combobox-indicator-size":"sizes.4"},input:{textStyle:"sm"},content:{"--combobox-item-padding-x":"spacing.2","--combobox-item-padding-y":"spacing.1.5","--combobox-indicator-size":"sizes.4",p:"1",textStyle:"sm"},trigger:{textStyle:"sm",gap:"1"}},md:{root:{"--combobox-input-height":"sizes.10","--combobox-input-padding-x":"spacing.3","--combobox-indicator-size":"sizes.4"},input:{textStyle:"sm"},content:{"--combobox-item-padding-x":"spacing.2","--combobox-item-padding-y":"spacing.1.5","--combobox-indicator-size":"sizes.4",p:"1",textStyle:"sm"},itemIndicator:{display:"flex",alignItems:"center",justifyContent:"center"},trigger:{textStyle:"sm",gap:"2"}},lg:{root:{"--combobox-input-height":"sizes.12","--combobox-input-padding-x":"spacing.4","--combobox-indicator-size":"sizes.5"},input:{textStyle:"md"},content:{"--combobox-item-padding-y":"spacing.2","--combobox-item-padding-x":"spacing.3","--combobox-indicator-size":"sizes.5",p:"1.5",textStyle:"md"},trigger:{textStyle:"md",py:"3",gap:"2"}}}},defaultVariants:{size:"md",variant:"outline"}},no={slots:si.keys(),className:"chakra-data-list",base:{itemLabel:{display:"flex",alignItems:"center",gap:"1"},itemValue:{display:"flex",minWidth:"0",flex:"1"}},variants:{orientation:{horizontal:{root:{display:"flex",flexDirection:"column"},item:{display:"inline-flex",alignItems:"center",gap:"4"},itemLabel:{minWidth:"120px"}},vertical:{root:{display:"flex",flexDirection:"column"},item:{display:"flex",flexDirection:"column",gap:"1"}}},size:{sm:{root:{gap:"3"},item:{textStyle:"xs"}},md:{root:{gap:"4"},item:{textStyle:"sm"}},lg:{root:{gap:"5"},item:{textStyle:"md"}}},variant:{subtle:{itemLabel:{color:"fg.muted"}},bold:{itemLabel:{fontWeight:"medium"},itemValue:{color:"fg.muted"}}}},defaultVariants:{size:"md",orientation:"vertical",variant:"subtle"}},ro={display:"inline-flex",alignItems:"center",justifyContent:"center",boxSize:"var(--datepicker-nav-trigger-size)",borderRadius:"l2",color:"fg",focusVisibleRing:"inside",focusRingWidth:"2px",_hover:{bg:"colorPalette.subtle"},_focusVisible:{boxShadow:"0 0 0 2px var(--colors-color-palette-focus-ring)"},_disabled:{opacity:.5},_icon:{boxSize:"4"}},io={height:"var(--datepicker-select-height)",ps:"2",pe:"8",textStyle:"sm",borderWidth:"1px",borderRadius:"l2",outline:"none",focusVisibleRing:"inside",appearance:"none",fieldSizing:"content",backgroundImage:"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E\")",backgroundRepeat:"no-repeat",backgroundPosition:"right 0.375rem center",backgroundSize:"1.25em"},oo={className:"date-picker",slots:ai.keys(),base:{root:{display:"flex",flexDirection:"column",gap:"1.5",width:"full","--datepicker-indicators-offset":"sizes.3",_disabled:{opacity:.5}},label:{textStyle:"sm",fontWeight:"medium"},indicatorGroup:{position:"absolute",insetEnd:"var(--datepicker-indicators-offset)",top:"50%",transform:"translateY(-50%)",display:"flex",alignItems:"center",justifyContent:"center",gap:"1"},control:{display:"flex",alignItems:"center",gap:"2",width:"full",position:"relative"},input:{flex:"1",minWidth:"0",height:"var(--datepicker-input-height)","--input-height":"var(--datepicker-input-height)",px:"var(--datepicker-input-px)",textStyle:"sm",bg:"transparent",borderRadius:"l2",outline:"0",appearance:"none",color:"fg","--focus-color":"colors.colorPalette.focusRing","--error-color":"colors.border.error",_placeholder:{color:"fg.muted"},_invalid:{focusRingColor:"var(--error-color)",borderColor:"var(--error-color)"}},trigger:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"6",height:"6",borderRadius:"l1",color:"fg.muted",outline:"none",_hover:{color:"fg"},focusVisibleRing:"inside",focusRingWidth:"2px",_icon:{boxSize:"4"}},content:{display:"flex",flexDirection:"column",gap:"3",p:"3",minW:"18rem",bg:"bg.panel",borderRadius:"l2",boxShadow:"lg",color:"fg",maxHeight:"var(--available-height)","--date-picker-z-index":"zIndex.popover",zIndex:"calc(var(--date-picker-z-index) + var(--layer-index, 0))",outline:"none",_open:{animationStyle:"scale-fade-in",animationDuration:"fast"},_closed:{animationStyle:"scale-fade-out",animationDuration:"faster"}},view:{display:"flex",flexDirection:"column",gap:"3"},viewControl:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"2",height:"var(--datepicker-nav-trigger-size)"},viewTrigger:{display:"inline-flex",flex:"1",alignItems:"center",justifyContent:"center",gap:"1",py:"1.5",px:"2",textStyle:"sm",fontWeight:"semibold",borderRadius:"l2",focusVisibleRing:"inside",focusRingWidth:"2px",_hover:{bg:"colorPalette.subtle"}},prevTrigger:ro,nextTrigger:ro,rangeText:{textStyle:"sm",fontWeight:"semibold"},table:{borderCollapse:"separate",borderSpacing:"0"},tableHeader:{width:"var(--table-cell-size)",py:"2",textStyle:"xs",fontWeight:"medium",color:"fg.muted",textAlign:"center",textTransform:"uppercase","&[data-type='week-number']":{color:"fg.subtle"}},tableCell:{py:"0.5","&[data-type='week-number']":{color:"fg.subtle"}},tableCellTrigger:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:"var(--table-cell-size)",minHeight:"var(--table-cell-size)",textStyle:"sm",borderRadius:"l2",focusVisibleRing:"inside",focusRingWidth:"2px",focusRingOffset:"0px",cursor:"default",position:"relative",_hover:{bg:"colorPalette.subtle"},"[data-view=month] &, [data-view=year] &":{width:"calc(var(--table-cell-size) * 1.75)"},_today:{color:"colorPalette.fg",fontWeight:"semibold",textDecoration:"underline",textUnderlineOffset:"3px",textDecorationThickness:"2px"},_selected:{bg:"colorPalette.solid",color:"colorPalette.contrast",_hover:{bg:"colorPalette.solid"}},"&[data-in-range]":{bg:"colorPalette.subtle",color:"colorPalette.fg",borderRadius:"0",_hover:{bg:"colorPalette.subtle"}},"&[data-range-start]":{bg:"colorPalette.solid",color:"colorPalette.contrast",borderRadius:"0",borderStartRadius:"l2",_hover:{bg:"colorPalette.solid"}},"&[data-range-end]":{bg:"colorPalette.solid",color:"colorPalette.contrast",borderRadius:"0",borderEndRadius:"l2",_hover:{bg:"colorPalette.solid"}},"&[data-range-start][data-range-end]":{borderRadius:"l2"},"&[data-selected][data-in-range]":{bg:"colorPalette.solid",color:"colorPalette.contrast",borderRadius:"l2",_hover:{bg:"colorPalette.solid"}},_disabled:{opacity:.4}},monthSelect:io,yearSelect:io,clearTrigger:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"6",height:"6",flexShrink:0,textStyle:"xs",borderRadius:"l2",color:"fg.muted",_hover:{color:"fg"},focusVisibleRing:"inside",_icon:{width:"4",height:"4"}}},variants:{size:{xs:{root:{"--datepicker-input-height":"sizes.8","--datepicker-input-px":"sizes.2","--datepicker-indicators-offset":"sizes.2"},view:{"--table-cell-size":"sizes.8","--datepicker-nav-trigger-size":"sizes.7","--datepicker-select-height":"sizes.8"}},sm:{root:{"--datepicker-input-height":"sizes.9","--datepicker-input-px":"sizes.2.5","--datepicker-indicators-offset":"sizes.2.5"},view:{"--table-cell-size":"sizes.9","--datepicker-nav-trigger-size":"sizes.8","--datepicker-select-height":"sizes.9"}},md:{root:{"--datepicker-input-height":"sizes.10","--datepicker-input-px":"sizes.3"},view:{"--table-cell-size":"sizes.10","--datepicker-nav-trigger-size":"sizes.8","--datepicker-select-height":"sizes.10"}},lg:{root:{"--datepicker-input-height":"sizes.11","--datepicker-input-px":"sizes.4"},view:{"--table-cell-size":"sizes.10","--datepicker-nav-trigger-size":"sizes.9","--datepicker-select-height":"sizes.10"}},xl:{root:{"--datepicker-input-height":"sizes.12","--datepicker-input-px":"sizes.4.5"},view:{"--table-cell-size":"sizes.10","--datepicker-nav-trigger-size":"sizes.9","--datepicker-select-height":"sizes.10"}}},hideOutsideDays:{true:{tableCellTrigger:{"&[data-outside-range]":{visibility:"hidden"}}}},variant:{outline:{input:{bg:"transparent",borderWidth:"1px",borderColor:"border",focusVisibleRing:"inside",focusRingColor:"var(--focus-color)"}},subtle:{input:{borderWidth:"1px",borderColor:"transparent",bg:"bg.muted",focusVisibleRing:"inside",focusRingColor:"var(--focus-color)"}},flushed:{input:{bg:"transparent",borderBottomWidth:"1px",borderBottomColor:"border",borderRadius:"0",px:"0",_focusVisible:{borderColor:"var(--focus-color)",boxShadow:"0px 1px 0px 0px var(--focus-color)",_invalid:{borderColor:"var(--error-color)",boxShadow:"0px 1px 0px 0px var(--error-color)"}}},indicatorGroup:{insetEnd:"0"}}}},defaultVariants:{size:"md",variant:"outline"}},so={slots:li.keys(),className:"chakra-dialog",base:{backdrop:{bg:"blackAlpha.500",pos:"fixed",left:0,top:0,w:"100dvw",h:"100dvh",zIndex:"var(--z-index)",_open:{animationName:"fade-in",animationDuration:"slow"},_closed:{animationName:"fade-out",animationDuration:"moderate"}},positioner:{display:"flex",width:"100dvw",height:"100dvh",position:"fixed",left:0,top:0,"--dialog-z-index":"zIndex.popover",zIndex:"calc(var(--dialog-z-index) + var(--layer-index, 0))",justifyContent:"center",overscrollBehaviorY:"none"},content:{display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,borderRadius:"l3",textStyle:"sm",my:"var(--dialog-margin, var(--dialog-base-margin))","--dialog-z-index":"zIndex.popover",zIndex:"calc(var(--dialog-z-index) + var(--layer-index, 0))",bg:"bg.panel",boxShadow:"lg",_open:{animationDuration:"moderate"},_closed:{animationDuration:"faster"}},header:{display:"flex",gap:"2",flex:0,px:"6",pt:"6",pb:"4"},body:{flex:"1",px:"6",pt:"2",pb:"6"},footer:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"3",px:"6",pt:"2",pb:"4"},title:{textStyle:"lg",fontWeight:"semibold"},description:{color:"fg.muted"},closeTrigger:{pos:"absolute",top:"2",insetEnd:"2"}},variants:{placement:{center:{positioner:{alignItems:"center"},content:{"--dialog-base-margin":"auto",mx:"auto"}},top:{positioner:{alignItems:"flex-start"},content:{"--dialog-base-margin":"spacing.16",mx:"auto"}},bottom:{positioner:{alignItems:"flex-end"},content:{"--dialog-base-margin":"spacing.16",mx:"auto"}}},scrollBehavior:{inside:{positioner:{overflow:"hidden"},content:{maxH:"calc(100% - 7.5rem)"},body:{overflow:"auto"}},outside:{positioner:{overflow:"auto",pointerEvents:"auto"}}},size:{xs:{content:{maxW:"sm"}},sm:{content:{maxW:"md"}},md:{content:{maxW:"lg"}},lg:{content:{maxW:"2xl"}},xl:{content:{maxW:"4xl"}},cover:{positioner:{padding:"10"},content:{width:"100%",height:"100%","--dialog-margin":"0"}},full:{content:{maxW:"100dvw",minH:"100dvh","--dialog-margin":"0",borderRadius:"0"}}},motionPreset:{scale:{content:{_open:{animationName:"scale-in, fade-in"},_closed:{animationName:"scale-out, fade-out"}}},"slide-in-bottom":{content:{_open:{animationName:"slide-from-bottom, fade-in"},_closed:{animationName:"slide-to-bottom, fade-out"}}},"slide-in-top":{content:{_open:{animationName:"slide-from-top, fade-in"},_closed:{animationName:"slide-to-top, fade-out"}}},"slide-in-left":{content:{_open:{animationName:"slide-from-left, fade-in"},_closed:{animationName:"slide-to-left, fade-out"}}},"slide-in-right":{content:{_open:{animationName:"slide-from-right, fade-in"},_closed:{animationName:"slide-to-right, fade-out"}}},none:{}}},defaultVariants:{size:"md",scrollBehavior:"outside",placement:"top",motionPreset:"scale"}},ao={slots:ci.keys(),className:"chakra-drawer",base:{backdrop:{bg:"blackAlpha.500",pos:"fixed",insetInlineStart:0,top:0,w:"100vw",h:"100dvh",zIndex:"var(--z-index)",_open:{animationName:"fade-in",animationDuration:"slow"},_closed:{animationName:"fade-out",animationDuration:"moderate"}},positioner:{display:"flex",width:"100vw",height:"100dvh",position:"fixed",insetInlineStart:0,top:0,"--drawer-z-index":"zIndex.popover",zIndex:"calc(var(--drawer-z-index) + var(--layer-index, 0))",overscrollBehaviorY:"none"},content:{display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,"--drawer-z-index":"zIndex.popover",zIndex:"calc(var(--drawer-z-index) + var(--layer-index, 0))",textStyle:"sm",maxH:"100dvh",color:"inherit",bg:"bg.panel",boxShadow:"lg",_open:{animationDuration:"slowest",animationTimingFunction:"ease-in-smooth"},_closed:{animationDuration:"slower",animationTimingFunction:"ease-in-smooth"}},header:{display:"flex",alignItems:"center",gap:"2",flex:0,px:"6",pt:"6",pb:"4"},body:{px:"6",py:"2",flex:"1",overflow:"auto"},footer:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"3",px:"6",pt:"2",pb:"4"},title:{flex:"1",textStyle:"lg",fontWeight:"semibold"},description:{color:"fg.muted"},closeTrigger:{pos:"absolute",top:"3",insetEnd:"2"}},variants:{size:{xs:{content:{maxW:"xs"}},sm:{content:{maxW:"md"}},md:{content:{maxW:"lg"}},lg:{content:{maxW:"2xl"}},xl:{content:{maxW:"4xl"}},full:{content:{maxW:"100vw",h:"100dvh"}}},placement:{start:{positioner:{justifyContent:"flex-start",alignItems:"stretch"},content:{_open:{animationName:{base:"slide-from-left-full, fade-in",_rtl:"slide-from-right-full, fade-in"}},_closed:{animationName:{base:"slide-to-left-full, fade-out",_rtl:"slide-to-right-full, fade-out"}}}},end:{positioner:{justifyContent:"flex-end",alignItems:"stretch"},content:{_open:{animationName:{base:"slide-from-right-full, fade-in",_rtl:"slide-from-left-full, fade-in"}},_closed:{animationName:{base:"slide-to-right-full, fade-out",_rtl:"slide-to-left-full, fade-out"}}}},top:{positioner:{justifyContent:"stretch",alignItems:"flex-start"},content:{maxW:"100%",_open:{animationName:"slide-from-top-full, fade-in"},_closed:{animationName:"slide-to-top-full, fade-out"}}},bottom:{positioner:{justifyContent:"stretch",alignItems:"flex-end"},content:{maxW:"100%",_open:{animationName:"slide-from-bottom-full, fade-in"},_closed:{animationName:"slide-to-bottom-full, fade-out"}}}},contained:{true:{positioner:{padding:"4"},content:{borderRadius:"l3"}}}},defaultVariants:{size:"xs",placement:"end"}},lo={fontSize:"inherit",fontWeight:"inherit",textAlign:"inherit",bg:"transparent",borderRadius:"l2"},co={slots:hi.keys(),className:"chakra-editable",base:{root:{display:"inline-flex",alignItems:"center",position:"relative",gap:"1.5",width:"full"},preview:{...lo,py:"1",px:"1",display:"inline-flex",alignItems:"center",transitionProperty:"common",transitionDuration:"moderate",cursor:"text",_hover:{bg:"bg.muted"},_disabled:{userSelect:"none"}},input:{...lo,outline:"0",py:"1",px:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",focusVisibleRing:"inside",focusRingWidth:"2px",_placeholder:{opacity:.6}},control:{display:"inline-flex",alignItems:"center",gap:"1.5"}},variants:{size:{sm:{root:{textStyle:"sm"},preview:{minH:"8"},input:{minH:"8"}},md:{root:{textStyle:"sm"},preview:{minH:"9"},input:{minH:"9"}},lg:{root:{textStyle:"md"},preview:{minH:"10"},input:{minH:"10"}}}},defaultVariants:{size:"md"}},ho={slots:ui.keys(),className:"chakra-empty-state",base:{root:{width:"full"},content:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},indicator:{display:"flex",alignItems:"center",justifyContent:"center",color:"fg.subtle",_icon:{boxSize:"1em"}},title:{fontWeight:"semibold"},description:{textStyle:"sm",color:"fg.muted"}},variants:{size:{sm:{root:{px:"4",py:"6"},title:{textStyle:"md"},content:{gap:"4"},indicator:{textStyle:"2xl"}},md:{root:{px:"8",py:"12"},title:{textStyle:"lg"},content:{gap:"6"},indicator:{textStyle:"4xl"}},lg:{root:{px:"12",py:"16"},title:{textStyle:"xl"},content:{gap:"8"},indicator:{textStyle:"6xl"}}}},defaultVariants:{size:"md"}},uo={className:"chakra-field",slots:di.keys(),base:{requiredIndicator:{color:"fg.error",lineHeight:"1"},root:{display:"flex",width:"100%",position:"relative",gap:"1.5"},label:{display:"flex",alignItems:"center",textAlign:"start",textStyle:"sm",fontWeight:"medium",gap:"1",userSelect:"none",_disabled:{opacity:"0.5"}},errorText:{display:"inline-flex",alignItems:"center",fontWeight:"medium",gap:"1",color:"fg.error",textStyle:"xs"},helperText:{color:"fg.muted",textStyle:"xs"}},variants:{orientation:{vertical:{root:{flexDirection:"column",alignItems:"flex-start"}},horizontal:{root:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},label:{flex:"0 0 var(--field-label-width, 80px)"}}}},defaultVariants:{orientation:"vertical"}},fo={className:"fieldset",slots:fi.keys(),base:{root:{display:"flex",flexDirection:"column",width:"full"},content:{display:"flex",flexDirection:"column",width:"full"},legend:{color:"fg",fontWeight:"medium",_disabled:{opacity:"0.5"}},helperText:{color:"fg.muted",textStyle:"sm"},errorText:{display:"inline-flex",alignItems:"center",color:"fg.error",gap:"2",fontWeight:"medium",textStyle:"sm"}},variants:{size:{sm:{root:{spaceY:"2"},content:{gap:"1.5"},legend:{textStyle:"sm"}},md:{root:{spaceY:"4"},content:{gap:"4"},legend:{textStyle:"sm"}},lg:{root:{spaceY:"6"},content:{gap:"4"},legend:{textStyle:"md"}}}},defaultVariants:{size:"md"}},po={className:"chakra-file-upload",slots:pi.keys(),base:{root:{display:"flex",flexDirection:"column",gap:"4",width:"100%",alignItems:"flex-start"},label:{fontWeight:"medium",textStyle:"sm"},dropzone:{background:"bg",borderRadius:"l3",borderWidth:"2px",borderStyle:"dashed",display:"flex",alignItems:"center",flexDirection:"column",gap:"4",justifyContent:"center",minHeight:"2xs",px:"3",py:"2",transition:"backgrounds",focusVisibleRing:"outside",_hover:{bg:"bg.subtle"},_dragging:{bg:"colorPalette.subtle",borderStyle:"solid",borderColor:"colorPalette.solid"}},dropzoneContent:{display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",gap:"1",textStyle:"sm"},item:{pos:"relative",textStyle:"sm",animationName:"fade-in",animationDuration:"moderate",background:"bg",borderRadius:"l2",borderWidth:"1px",width:"100%",display:"flex",alignItems:"center",gap:"3",p:"4"},itemGroup:{width:"100%",display:"flex",flexDirection:"column",gap:"3",_empty:{display:"none"}},itemName:{color:"fg",fontWeight:"medium",lineClamp:"1"},itemContent:{display:"flex",flexDirection:"column",gap:"0.5",flex:"1"},itemSizeText:{color:"fg.muted",textStyle:"xs"},itemDeleteTrigger:{display:"flex",alignItems:"center",justifyContent:"center",alignSelf:"flex-start",boxSize:"5",p:"2px",color:"fg.muted",cursor:"button"},itemPreview:{color:"fg.muted",_icon:{boxSize:"4.5"}}},defaultVariants:{}};var go=Tr("hoverCard").parts("arrow","arrowTip","trigger","positioner","content");go.build();const mo={className:"chakra-hover-card",slots:go.keys(),base:{content:{position:"relative",display:"flex",flexDirection:"column",textStyle:"sm","--hovercard-bg":"colors.bg.panel",bg:"var(--hovercard-bg)",boxShadow:"lg",maxWidth:"80",borderRadius:"l3","--hover-card-z-index":"zIndex.popover",zIndex:"calc(var(--hover-card-z-index) + var(--layer-index, 0))",transformOrigin:"var(--transform-origin)",outline:"0",_open:{animationStyle:"slide-fade-in",animationDuration:"fast"},_closed:{animationStyle:"slide-fade-out",animationDuration:"faster"}},arrow:{"--arrow-size":"sizes.3","--arrow-background":"var(--hovercard-bg)"},arrowTip:{borderTopWidth:"0.5px",borderLeftWidth:"0.5px"}},variants:{size:{xs:{content:{padding:"3"}},sm:{content:{padding:"4"}},md:{content:{padding:"5"}},lg:{content:{padding:"6"}}}},defaultVariants:{size:"md"}},bo={className:"chakra-list",slots:gi.keys(),base:{root:{display:"flex",flexDirection:"column",gap:"var(--list-gap)","& :where(ul, ol)":{marginTop:"var(--list-gap)"}},item:{whiteSpace:"normal",display:"list-item"},indicator:{marginEnd:"2",minHeight:"1lh",flexShrink:0,display:"inline-block",verticalAlign:"middle"}},variants:{variant:{marker:{root:{listStyle:"revert"},item:{_marker:{color:"fg.subtle"}}},plain:{item:{alignItems:"flex-start",display:"inline-flex"}}},align:{center:{item:{alignItems:"center"}},start:{item:{alignItems:"flex-start"}},end:{item:{alignItems:"flex-end"}}}},defaultVariants:{variant:"marker"}},vo={className:"chakra-listbox",slots:Ni.keys(),base:{root:{display:"flex",flexDirection:"column",gap:"1.5",width:"full"},content:{display:"flex",maxH:"96",p:"1",gap:"1",textStyle:"sm",outline:"none",scrollPadding:"1",_horizontal:{flexDirection:"row",overflowX:"auto"},_vertical:{flexDirection:"column",overflowY:"auto"},"--listbox-item-padding-x":"spacing.2","--listbox-item-padding-y":"spacing.1.5"},item:{position:"relative",userSelect:"none",display:"flex",alignItems:"center",gap:"2",cursor:"pointer",justifyContent:"space-between",flex:"1",textAlign:"start",borderRadius:"l1",py:"var(--listbox-item-padding-y)",px:"var(--listbox-item-padding-x)",_highlighted:{outline:"2px solid",outlineColor:"border.emphasized"},_disabled:{pointerEvents:"none",opacity:"0.5"}},empty:{py:"var(--listbox-item-padding-y)",px:"var(--listbox-item-padding-x)"},itemText:{flex:"1"},itemGroup:{mt:"1.5",_first:{mt:"0"}},itemGroupLabel:{py:"1.5",px:"2",fontWeight:"medium"},label:{fontWeight:"medium",userSelect:"none",textStyle:"sm",_disabled:{layerStyle:"disabled"}},valueText:{lineClamp:"1",maxW:"80%"},itemIndicator:{display:"flex",alignItems:"center",justifyContent:"center",_icon:{boxSize:"4"}}},variants:{variant:{subtle:{content:{bg:"bg.panel",borderWidth:"1px",borderRadius:"l2"},item:{_hover:{bg:"bg.emphasized/60"},_selected:{bg:"bg.muted"}}},solid:{content:{bg:"bg.panel",borderWidth:"1px",borderRadius:"l2"},item:{_selected:{bg:"colorPalette.solid",color:"colorPalette.contrast"}}},plain:{}}},defaultVariants:{variant:"subtle"}};var yo=Tr("marquee").parts("root","viewport","content","edge","item");yo.build();const Oo={className:"chakra-marquee",slots:yo.keys(),base:{root:{position:"relative",width:"100%","--marquee-edge-color":"colors.bg","--marquee-edge-size":"20%","&[data-paused]":{animationPlayState:"paused !important","& *":{animationPlayState:"paused !important"}}},viewport:{overflow:"hidden",display:"flex",width:"100%",height:"100%"},content:{display:"flex",minWidth:"max-content",animationTimingFunction:"linear",animationFillMode:"forwards",animationDuration:"var(--marquee-duration)",animationDelay:"var(--marquee-delay)",animationIterationCount:"var(--marquee-loop-count)",_motionReduce:{animation:"none !important"},"&[data-side='start'], &[data-side='end']":{animationName:"marqueeX"},"&[data-side='top'], &[data-side='bottom']":{animationName:"marqueeY"},"&[data-reverse]":{animationDirection:"reverse"},"&[data-orientation='horizontal']":{flexDirection:"row"},"&[data-orientation='vertical']":{flexDirection:"column"}},edge:{position:"absolute",zIndex:"1",pointerEvents:"none","&[data-side='start']":{width:"var(--marquee-edge-size)",insetY:"0",insetInlineStart:"0",background:"linear-gradient(to right, var(--marquee-edge-color, white), transparent)",_rtl:{background:"linear-gradient(to left, var(--marquee-edge-color, white), transparent)"}},"&[data-side='end']":{width:"var(--marquee-edge-size)",insetY:"0",insetInlineEnd:"0",background:"linear-gradient(to left, var(--marquee-edge-color, white), transparent)",_rtl:{background:"linear-gradient(to right, var(--marquee-edge-color, white), transparent)"}},"&[data-side='top']":{height:"var(--marquee-edge-size)",insetX:"0",top:"0",background:"linear-gradient(to bottom, var(--marquee-edge-color, white), transparent)"},"&[data-side='bottom']":{height:"var(--marquee-edge-size)",insetX:"0",bottom:"0",background:"linear-gradient(to top, var(--marquee-edge-color, white), transparent)"}}}},wo={className:"chakra-menu",slots:mi.keys(),base:{content:{outline:0,"--menu-bg":"colors.bg.panel",bg:"var(--menu-bg)",boxShadow:"lg",color:"fg",maxHeight:"var(--available-height)","--menu-z-index":"zIndex.popover",zIndex:"calc(var(--menu-z-index) + var(--layer-index, 0))",borderRadius:"l2",overflow:"hidden",overflowY:"auto",_open:{animationStyle:"slide-fade-in",animationDuration:"fast"},_closed:{animationStyle:"slide-fade-out",animationDuration:"faster"}},item:{textDecoration:"none",color:"fg",userSelect:"none",borderRadius:"l1",width:"100%",display:"flex",cursor:"menuitem",alignItems:"center",textAlign:"start",position:"relative",flex:"0 0 auto",outline:0,_disabled:{layerStyle:"disabled"},"&[data-type]":{ps:"8"}},itemText:{flex:"1"},itemIndicator:{position:"absolute",insetStart:"2",transform:"translateY(-50%)",top:"50%"},itemGroupLabel:{px:"2",py:"1.5",fontWeight:"semibold",textStyle:"sm"},indicator:{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:"0"},itemCommand:{opacity:"0.6",textStyle:"xs",ms:"auto",ps:"4",letterSpacing:"widest",fontFamily:"inherit"},separator:{height:"1px",bg:"bg.muted",my:"1",mx:"-1"},arrow:{"--arrow-size":"sizes.3","--arrow-background":"var(--menu-bg)"},arrowTip:{borderTopWidth:"1px",borderLeftWidth:"1px"}},variants:{variant:{subtle:{item:{_highlighted:{bg:"bg.emphasized/60"}}},solid:{item:{_highlighted:{bg:"colorPalette.solid",color:"colorPalette.contrast"}}}},size:{sm:{content:{minW:"8rem",padding:"1",scrollPadding:"1"},item:{gap:"1",textStyle:"xs",py:"1",px:"1.5"}},md:{content:{minW:"8rem",padding:"1.5",scrollPadding:"1.5"},item:{gap:"2",textStyle:"sm",py:"1.5",px:"2"}}}},defaultVariants:{size:"md",variant:"subtle"}},xo={className:"chakra-select",slots:xi.keys(),base:{root:{display:"flex",flexDirection:"column",gap:"1.5",width:"full"},trigger:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"full",minH:"var(--select-trigger-height)","--input-height":"var(--select-trigger-height)",px:"var(--select-trigger-padding-x)",borderRadius:"l2",userSelect:"none",textAlign:"start",focusVisibleRing:"inside",_placeholderShown:{color:"fg.muted/80"},_disabled:{layerStyle:"disabled"},_invalid:{borderColor:"border.error"}},indicatorGroup:{display:"flex",alignItems:"center",gap:"1",pos:"absolute",insetEnd:"0",top:"0",bottom:"0",px:"var(--select-trigger-padding-x)",pointerEvents:"none"},indicator:{display:"flex",alignItems:"center",justifyContent:"center",color:{base:"fg.muted",_disabled:"fg.subtle",_invalid:"fg.error"}},content:{background:"bg.panel",display:"flex",flexDirection:"column","--select-z-index":"zIndex.popover",zIndex:"calc(var(--select-z-index) + var(--layer-index, 0))",borderRadius:"l2",outline:0,maxH:"96",overflowY:"auto",boxShadow:"md",_open:{animationStyle:"slide-fade-in",animationDuration:"fast"},_closed:{animationStyle:"slide-fade-out",animationDuration:"fastest"}},item:{position:"relative",userSelect:"none",display:"flex",alignItems:"center",gap:"2",cursor:"option",justifyContent:"space-between",flex:"1",textAlign:"start",borderRadius:"l1",_highlighted:{bg:"bg.emphasized/60"},_disabled:{pointerEvents:"none",opacity:"0.5"},_icon:{width:"4",height:"4"}},control:{pos:"relative"},itemText:{flex:"1"},itemGroup:{_first:{mt:"0"}},itemGroupLabel:{py:"1",fontWeight:"medium"},label:{fontWeight:"medium",userSelect:"none",textStyle:"sm",_disabled:{layerStyle:"disabled"}},valueText:{lineClamp:"1",maxW:"80%"},clearTrigger:{color:"fg.muted",pointerEvents:"auto",focusVisibleRing:"inside",focusRingWidth:"2px",rounded:"l1"}},variants:{variant:{outline:{trigger:{bg:"transparent",borderWidth:"1px",borderColor:"border",_expanded:{borderColor:"border.emphasized"}}},subtle:{trigger:{borderWidth:"1px",borderColor:"transparent",bg:"bg.muted"}},ghost:{trigger:{bg:"transparent",_expanded:{bg:"bg.muted"}}}},size:{xs:{root:{"--select-trigger-height":"sizes.8","--select-trigger-padding-x":"spacing.2"},content:{p:"1",gap:"1",textStyle:"xs"},trigger:{textStyle:"xs",gap:"1"},item:{py:"1",px:"2"},itemGroupLabel:{py:"1",px:"2"},indicator:{_icon:{width:"3.5",height:"3.5"}}},sm:{root:{"--select-trigger-height":"sizes.9","--select-trigger-padding-x":"spacing.2.5"},content:{p:"1",textStyle:"sm"},trigger:{textStyle:"sm",gap:"1"},indicator:{_icon:{width:"4",height:"4"}},item:{py:"1",px:"1.5"},itemGroup:{mt:"1"},itemGroupLabel:{py:"1",px:"1.5"}},md:{root:{"--select-trigger-height":"sizes.10","--select-trigger-padding-x":"spacing.3"},content:{p:"1",textStyle:"sm"},itemGroup:{mt:"1.5"},item:{py:"1.5",px:"2"},itemIndicator:{display:"flex",alignItems:"center",justifyContent:"center"},itemGroupLabel:{py:"1.5",px:"2"},trigger:{textStyle:"sm",gap:"2"},indicator:{_icon:{width:"4",height:"4"}}},lg:{root:{"--select-trigger-height":"sizes.12","--select-trigger-padding-x":"spacing.4"},content:{p:"1.5",textStyle:"md"},itemGroup:{mt:"2"},item:{py:"2",px:"3"},itemGroupLabel:{py:"2",px:"3"},trigger:{textStyle:"md",py:"3",gap:"2"},indicator:{_icon:{width:"5",height:"5"}}}}},defaultVariants:{size:"md",variant:"outline"}},So={className:"chakra-native-select",slots:bi.keys(),base:{root:{height:"fit-content",display:"flex",width:"100%",position:"relative"},field:{width:"100%",minWidth:"0",outline:"0",appearance:"none",borderRadius:"l2","--error-color":"colors.border.error","--input-height":"var(--select-field-height)",height:"var(--select-field-height)",_disabled:{layerStyle:"disabled"},_invalid:{focusRingColor:"var(--error-color)",borderColor:"var(--error-color)"},focusVisibleRing:"inside",lineHeight:"normal","& > option, & > optgroup":{bg:"bg"}},indicator:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)",height:"100%",color:"fg.muted",_disabled:{opacity:"0.5"},_invalid:{color:"fg.error"},_icon:{width:"1em",height:"1em"}}},variants:{variant:{outline:{field:xo.variants?.variant.outline.trigger},subtle:{field:xo.variants?.variant.subtle.trigger},plain:{field:{bg:"transparent",color:"fg",focusRingWidth:"2px"}},ghost:{field:xo.variants?.variant.ghost.trigger}},size:{xs:{root:{"--select-field-height":"sizes.8"},field:{textStyle:"xs",ps:"2",pe:"6"},indicator:{textStyle:"sm",insetEnd:"1.5"}},sm:{root:{"--select-field-height":"sizes.9"},field:{textStyle:"sm",ps:"2.5",pe:"8"},indicator:{textStyle:"md",insetEnd:"2"}},md:{root:{"--select-field-height":"sizes.10"},field:{textStyle:"sm",ps:"3",pe:"8"},indicator:{textStyle:"lg",insetEnd:"2"}},lg:{root:{"--select-field-height":"sizes.11"},field:{textStyle:"md",ps:"4",pe:"8"},indicator:{textStyle:"xl",insetEnd:"3"}},xl:{root:{"--select-field-height":"sizes.12"},field:{textStyle:"md",ps:"4.5",pe:"10"},indicator:{textStyle:"xl",insetEnd:"3"}}}},defaultVariants:xo.defaultVariants};var ko=Tr("numberInput").parts("root","label","input","control","valueText","incrementTrigger","decrementTrigger","scrubber");ko.build();const Co={display:"flex",justifyContent:"center",alignItems:"center",flex:"1",userSelect:"none",cursor:"button",lineHeight:"1",color:"fg.muted","--stepper-base-radius":"radii.l1","--stepper-radius":"calc(var(--stepper-base-radius) + 1px)",_icon:{boxSize:"1em"},_disabled:{opacity:"0.5"},_hover:{bg:"bg.muted"},_active:{bg:"bg.emphasized"}},_o={className:"chakra-number-input",slots:ko.keys(),base:{root:{position:"relative",zIndex:"0",isolation:"isolate"},input:{...wr.base,verticalAlign:"top",pe:"calc(var(--stepper-width) + 0.5rem)"},control:{display:"flex",flexDirection:"column",position:"absolute",top:"0",insetEnd:"0px",margin:"1px",width:"var(--stepper-width)",height:"calc(100% - 2px)",zIndex:"1",borderStartWidth:"1px",divideY:"1px"},incrementTrigger:{...Co,borderTopEndRadius:"var(--stepper-radius)"},decrementTrigger:{...Co,borderBottomEndRadius:"var(--stepper-radius)"},valueText:{fontWeight:"medium",fontFeatureSettings:"pnum",fontVariantNumeric:"proportional-nums"}},variants:{size:{xs:{input:wr.variants.size.xs,control:{fontSize:"2xs","--stepper-width":"sizes.4"}},sm:{input:wr.variants.size.sm,control:{fontSize:"xs","--stepper-width":"sizes.5"}},md:{input:wr.variants.size.md,control:{fontSize:"sm","--stepper-width":"sizes.6"}},lg:{input:wr.variants.size.lg,control:{fontSize:"sm","--stepper-width":"sizes.6"}}},variant:Et(wr.variants.variant,((e,t)=>[e,{input:t}]))},defaultVariants:{size:"md",variant:"outline"}};var To=Tr("pinInput").parts("root","label","input","control");To.build();const{variants:Ro,defaultVariants:Eo}=wr,Mo={className:"chakra-pin-input",slots:To.keys(),base:{input:{...wr.base,textAlign:"center",width:"var(--input-height)"},control:{display:"inline-flex",gap:"2",isolation:"isolate"}},variants:{size:Et(Ro.size,((e,t)=>[e,{input:{...t,px:"1"}}])),variant:Et(Ro.variant,((e,t)=>[e,{input:t}])),attached:{true:{control:{gap:"0",spaceX:"-1px"},input:{_notFirst:{borderStartRadius:"0"},_notLast:{borderEndRadius:"0"},_focusVisible:{zIndex:"1"}}}}},defaultVariants:Eo},Po={className:"chakra-popover",slots:vi.keys(),base:{content:{position:"relative",display:"flex",flexDirection:"column",textStyle:"sm","--popover-bg":"colors.bg.panel",bg:"var(--popover-bg)",boxShadow:"lg","--popover-size":"sizes.xs","--popover-mobile-size":"calc(100dvw - 1rem)",width:{base:"min(var(--popover-mobile-size), var(--popover-size))",sm:"var(--popover-size)"},borderRadius:"l3","--popover-z-index":"zIndex.popover",zIndex:"calc(var(--popover-z-index) + var(--layer-index, 0))",outline:"0",transformOrigin:"var(--transform-origin)",maxHeight:"var(--available-height)",_open:{animationStyle:"scale-fade-in",animationDuration:"fast"},_closed:{animationStyle:"scale-fade-out",animationDuration:"faster"}},header:{paddingInline:"var(--popover-padding)",paddingTop:"var(--popover-padding)"},body:{padding:"var(--popover-padding)",flex:"1"},footer:{display:"flex",alignItems:"center",paddingInline:"var(--popover-padding)",paddingBottom:"var(--popover-padding)"},arrow:{"--arrow-size":"sizes.3","--arrow-background":"var(--popover-bg)"},arrowTip:{borderTopWidth:"1px",borderLeftWidth:"1px"}},variants:{size:{xs:{content:{"--popover-padding":"spacing.3"}},sm:{content:{"--popover-padding":"spacing.4"}},md:{content:{"--popover-padding":"spacing.5"}},lg:{content:{"--popover-padding":"spacing.6"}}}},defaultVariants:{size:"md"}};var Ao=Tr("progress").parts("root","label","track","range","valueText","view","circle","circleTrack","circleRange");Ao.build();const $o={slots:Ao.keys(),className:"chakra-progress",base:{root:{textStyle:"sm",position:"relative"},track:{overflow:"hidden",position:"relative"},range:{display:"flex",alignItems:"center",justifyContent:"center",transitionProperty:"width, height",transitionDuration:"slow",height:"100%",bgColor:"var(--track-color)",_indeterminate:{"--animate-from-x":"-40%","--animate-to-x":"100%",position:"absolute",willChange:"left",minWidth:"50%",animation:"position 1s ease infinite normal none running",backgroundImage:"linear-gradient(to right, transparent 0%, var(--track-color) 50%, transparent 100%)"}},label:{display:"inline-flex",fontWeight:"medium",alignItems:"center",gap:"1"},valueText:{textStyle:"xs",lineHeight:"1",fontWeight:"medium"}},variants:{variant:{outline:{track:{shadow:"inset",bgColor:"bg.muted"},range:{bgColor:"colorPalette.solid"}},subtle:{track:{bgColor:"colorPalette.muted"},range:{bgColor:"colorPalette.solid/72"}}},shape:{square:{},rounded:{track:{borderRadius:"l1"}},full:{track:{borderRadius:"full"}}},striped:{true:{range:{backgroundImage:"linear-gradient(45deg, var(--stripe-color) 25%, transparent 25%, transparent 50%, var(--stripe-color) 50%, var(--stripe-color) 75%, transparent 75%, transparent)",backgroundSize:"var(--stripe-size) var(--stripe-size)","--stripe-size":"1rem","--stripe-color":{_light:"rgba(255, 255, 255, 0.3)",_dark:"rgba(0, 0, 0, 0.3)"}}}},animated:{true:{range:{"--animate-from":"var(--stripe-size)",animation:"bg-position 1s linear infinite"}}},size:{xs:{track:{h:"1.5"}},sm:{track:{h:"2"}},md:{track:{h:"2.5"}},lg:{track:{h:"3"}},xl:{track:{h:"4"}}}},defaultVariants:{variant:"outline",size:"md",shape:"rounded"}},zo={className:"chakra-progress-circle",slots:Ao.keys(),base:{root:{display:"inline-flex",textStyle:"sm",position:"relative"},circle:{_indeterminate:{animation:"spin 2s linear infinite"}},circleTrack:{"--track-color":"colors.colorPalette.muted",stroke:"var(--track-color)"},circleRange:{stroke:"colorPalette.solid",transitionProperty:"stroke-dashoffset, stroke-dasharray",transitionDuration:"0.6s",_indeterminate:{animation:"circular-progress 1.5s linear infinite"}},label:{display:"inline-flex"},valueText:{lineHeight:"1",fontWeight:"medium",letterSpacing:"tight",fontVariantNumeric:"tabular-nums"}},variants:{size:{xs:{circle:{"--size":"24px","--thickness":"4px"},valueText:{textStyle:"2xs"}},sm:{circle:{"--size":"32px","--thickness":"5px"},valueText:{textStyle:"2xs"}},md:{circle:{"--size":"40px","--thickness":"6px"},valueText:{textStyle:"xs"}},lg:{circle:{"--size":"48px","--thickness":"7px"},valueText:{textStyle:"sm"}},xl:{circle:{"--size":"64px","--thickness":"8px"},valueText:{textStyle:"sm"}}}},defaultVariants:{size:"md"}};var Qo=Tr("qr-code").parts("root","frame","pattern","overlay","downloadTrigger");Qo.build();const Io={slots:Qo.keys(),className:"chakra-qr-code",base:{root:{position:"relative",width:"fit-content","--qr-code-overlay-size":"calc(var(--qr-code-size) / 3)"},frame:{width:"var(--qr-code-size)",height:"var(--qr-code-size)",fill:"currentColor"},overlay:{display:"flex",alignItems:"center",justifyContent:"center",width:"var(--qr-code-overlay-size)",height:"var(--qr-code-overlay-size)",padding:"1",bg:"bg",rounded:"l1"}},variants:{size:{"2xs":{root:{"--qr-code-size":"40px"}},xs:{root:{"--qr-code-size":"64px"}},sm:{root:{"--qr-code-size":"80px"}},md:{root:{"--qr-code-size":"120px"}},lg:{root:{"--qr-code-size":"160px"}},xl:{root:{"--qr-code-size":"200px"}},"2xl":{root:{"--qr-code-size":"240px"}},full:{root:{"--qr-code-size":"100%"}}}},defaultVariants:{size:"md"}},No={className:"chakra-radio-card",slots:Oi.keys(),base:{root:{display:"flex",flexDirection:"column",gap:"1.5",isolation:"isolate"},item:{flex:"1",display:"flex",flexDirection:"column",userSelect:"none",position:"relative",borderRadius:"l2",_focus:{bg:"colorPalette.muted/20"},_disabled:{opacity:"0.5"},_checked:{zIndex:"1"}},label:{display:"inline-flex",fontWeight:"medium",textStyle:"sm",_disabled:{opacity:"0.5"}},itemText:{fontWeight:"medium",flex:"1"},itemDescription:{opacity:"0.64",textStyle:"sm"},itemControl:{display:"inline-flex",flex:"1",pos:"relative",rounded:"inherit",justifyContent:"var(--radio-card-justify)",alignItems:"var(--radio-card-align)",_disabled:{bg:"bg.muted"}},itemIndicator:xr.base,itemAddon:{roundedBottom:"inherit",_disabled:{color:"fg.muted"}},itemContent:{display:"flex",flexDirection:"column",flex:"1",gap:"1",justifyContent:"var(--radio-card-justify)",alignItems:"var(--radio-card-align)"}},variants:{size:{sm:{item:{textStyle:"sm"},itemControl:{padding:"3",gap:"1.5"},itemAddon:{px:"3",py:"1.5",borderTopWidth:"1px"},itemIndicator:xr.variants?.size.sm},md:{item:{textStyle:"sm"},itemControl:{padding:"4",gap:"2.5"},itemAddon:{px:"4",py:"2",borderTopWidth:"1px"},itemIndicator:xr.variants?.size.md},lg:{item:{textStyle:"md"},itemControl:{padding:"4",gap:"3.5"},itemAddon:{px:"4",py:"2",borderTopWidth:"1px"},itemIndicator:xr.variants?.size.lg}},variant:{surface:{item:{borderWidth:"1px",_checked:{bg:"colorPalette.subtle",color:"colorPalette.fg",borderColor:"colorPalette.muted"}},itemIndicator:xr.variants?.variant.solid},subtle:{item:{bg:"bg.muted"},itemControl:{_checked:{bg:"colorPalette.muted",color:"colorPalette.fg"}},itemIndicator:xr.variants?.variant.outline},outline:{item:{borderWidth:"1px",_checked:{boxShadow:"0 0 0 1px var(--shadow-color)",boxShadowColor:"colorPalette.solid",borderColor:"colorPalette.solid"}},itemIndicator:xr.variants?.variant.solid},solid:{item:{borderWidth:"1px",_checked:{bg:"colorPalette.solid",color:"colorPalette.contrast",borderColor:"colorPalette.solid"}},itemControl:{_disabled:{bg:"unset"}},itemIndicator:xr.variants?.variant.inverted}},justify:{start:{item:{"--radio-card-justify":"flex-start"}},end:{item:{"--radio-card-justify":"flex-end"}},center:{item:{"--radio-card-justify":"center"}}},align:{start:{item:{"--radio-card-align":"flex-start"},itemControl:{textAlign:"start"}},end:{item:{"--radio-card-align":"flex-end"},itemControl:{textAlign:"end"}},center:{item:{"--radio-card-align":"center"},itemControl:{textAlign:"center"}}},orientation:{vertical:{itemControl:{flexDirection:"column"}},horizontal:{itemControl:{flexDirection:"row"}}}},defaultVariants:{size:"md",variant:"outline",align:"start",orientation:"horizontal"}},Do={className:"chakra-radio-group",slots:yi.keys(),base:{item:{display:"inline-flex",alignItems:"center",position:"relative",fontWeight:"medium",_disabled:{cursor:"disabled"}},itemControl:xr.base,label:{userSelect:"none",textStyle:"sm",_disabled:{opacity:"0.5"}}},variants:{variant:{outline:{itemControl:xr.variants?.variant?.outline},subtle:{itemControl:xr.variants?.variant?.subtle},solid:{itemControl:xr.variants?.variant?.solid}},size:{xs:{item:{textStyle:"xs",gap:"1.5"},itemControl:xr.variants?.size?.xs},sm:{item:{textStyle:"sm",gap:"2"},itemControl:xr.variants?.size?.sm},md:{item:{textStyle:"sm",gap:"2.5"},itemControl:xr.variants?.size?.md},lg:{item:{textStyle:"md",gap:"3"},itemControl:xr.variants?.size?.lg}}},defaultVariants:{size:"md",variant:"solid"}},Wo={className:"chakra-rating-group",slots:wi.keys(),base:{root:{display:"inline-flex"},control:{display:"inline-flex",alignItems:"center"},item:{display:"inline-flex",alignItems:"center",justifyContent:"center",userSelect:"none"},itemIndicator:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"1em",height:"1em",position:"relative","--clip-path":{base:"inset(0 50% 0 0)",_rtl:"inset(0 0 0 50%)"},_icon:{stroke:"currentColor",width:"100%",height:"100%",display:"inline-block",flexShrink:0,position:"absolute",left:0,top:0},"& [data-bg]":{color:"bg.emphasized"},"& [data-fg]":{color:"transparent"},"&[data-highlighted]:not([data-half])":{"& [data-fg]":{color:"colorPalette.solid"}},"&[data-half]":{"& [data-fg]":{color:"colorPalette.solid",clipPath:"var(--clip-path)"}}}},variants:{size:{xs:{item:{textStyle:"sm"}},sm:{item:{textStyle:"md"}},md:{item:{textStyle:"xl"}},lg:{item:{textStyle:"2xl"}}}},defaultVariants:{size:"md"}};var Lo=Tr("scroll-area").parts("root","viewport","content","scrollbar","thumb","corner");Lo.build();const Ho={className:"chakra-scroll-area",slots:Lo.keys(),base:{root:{display:"flex",flexDirection:"column",width:"100%",height:"100%",position:"relative",overflow:"hidden","--scrollbar-margin":"2px","--scrollbar-click-area":"calc(var(--scrollbar-size) + calc(var(--scrollbar-margin) * 2))"},viewport:{display:"flex",flexDirection:"column",height:"100%",width:"100%",borderRadius:"inherit",WebkitOverflowScrolling:"touch",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}},content:{minWidth:"100%"},scrollbar:{display:"flex",userSelect:"none",touchAction:"none",borderRadius:"full",colorPalette:"gray",transition:"opacity 150ms 300ms",position:"relative",margin:"var(--scrollbar-margin)","&:not([data-overflow-x], [data-overflow-y])":{display:"none"},bg:"{colors.colorPalette.solid/10}","--thumb-bg":"{colors.colorPalette.solid/25}","&:is(:hover, :active)":{"--thumb-bg":"{colors.colorPalette.solid/50}"},_before:{content:'""',position:"absolute"},_vertical:{width:"var(--scrollbar-size)",flexDirection:"column","&::before":{width:"var(--scrollbar-click-area)",height:"100%",insetInlineStart:"calc(var(--scrollbar-margin) * -1)"}},_horizontal:{height:"var(--scrollbar-size)",flexDirection:"row","&::before":{height:"var(--scrollbar-click-area)",width:"100%",top:"calc(var(--scrollbar-margin) * -1)"}}},thumb:{borderRadius:"inherit",bg:"var(--thumb-bg)",transition:"backgrounds",_vertical:{width:"full"},_horizontal:{height:"full"}},corner:{bg:"bg.muted",margin:"var(--scrollbar-margin)",opacity:0,transition:"opacity 150ms 300ms","&[data-hover]":{transitionDelay:"0ms",opacity:1}}},variants:{variant:{hover:{scrollbar:{opacity:"0","&[data-hover], &[data-scrolling]":{opacity:"1",transitionDuration:"faster",transitionDelay:"0ms"}}},always:{scrollbar:{opacity:"1"}}},size:{xs:{root:{"--scrollbar-size":"sizes.1"}},sm:{root:{"--scrollbar-size":"sizes.1.5"}},md:{root:{"--scrollbar-size":"sizes.2"}},lg:{root:{"--scrollbar-size":"sizes.3"}}}},defaultVariants:{size:"md",variant:"hover"}},Vo=Fr.rename("segment-group"),Bo=(Vo.build(),{className:"chakra-segment-group",slots:Vo.keys(),base:{root:{"--segment-radius":"radii.l2","--segment-indicator-bg":{_light:"colors.bg",_dark:"colors.bg.emphasized"},"--segment-indicator-shadow":"shadows.sm",borderRadius:"var(--segment-radius)",display:"inline-flex",boxShadow:"inset",minW:"max-content",textAlign:"center",position:"relative",isolation:"isolate",bg:"bg.muted",_vertical:{flexDirection:"column"}},item:{display:"flex",alignItems:"center",justifyContent:"center",userSelect:"none",fontSize:"sm",position:"relative",color:"fg",borderRadius:"var(--segment-radius)",_disabled:{opacity:"0.5"},"&:has(input:focus-visible)":{focusRing:"outside"},_before:{content:'""',position:"absolute",bg:"border",transition:"opacity 0.2s"},_horizontal:{_before:{insetInlineStart:0,insetBlock:"1.5",width:"1px"}},_vertical:{_before:{insetBlockStart:0,insetInline:"1.5",height:"1px"}},"& + &[data-state=checked], &[data-state=checked] + &, &:first-of-type":{_before:{opacity:"0"}},"&[data-state=checked][data-ssr]":{shadow:"sm",bg:"bg",borderRadius:"var(--segment-radius)"}},indicator:{shadow:"var(--segment-indicator-shadow)",pos:"absolute",bg:"var(--segment-indicator-bg)",width:"var(--width)",height:"var(--height)",top:"var(--top)",left:"var(--left)",zIndex:-1,borderRadius:"var(--segment-radius)"}},variants:{size:{xs:{item:{textStyle:"xs",px:"3",gap:"1",height:"6"}},sm:{item:{textStyle:"sm",px:"4",gap:"2",height:"8"}},md:{item:{textStyle:"sm",px:"4",gap:"2",height:"10"}},lg:{item:{textStyle:"md",px:"4.5",gap:"3",height:"11"}}}},defaultVariants:{size:"md"}}),jo={className:"chakra-slider",slots:ki.keys(),base:{root:{display:"flex",flexDirection:"column",gap:"1",textStyle:"sm",position:"relative",isolation:"isolate",touchAction:"none"},label:{fontWeight:"medium",textStyle:"sm"},control:{display:"inline-flex",alignItems:"center",position:"relative"},track:{overflow:"hidden",borderRadius:"full",flex:"1"},range:{width:"inherit",height:"inherit",_disabled:{bg:"border.emphasized!"}},markerGroup:{position:"absolute!",zIndex:"1"},marker:{"--marker-bg":{base:"white",_underValue:"colors.bg"},display:"flex",alignItems:"center",gap:"calc(var(--slider-thumb-size) / 2)",color:"fg.muted",textStyle:"xs"},markerIndicator:{width:"var(--slider-marker-size)",height:"var(--slider-marker-size)",borderRadius:"full",bg:"var(--marker-bg)"},thumb:{width:"var(--slider-thumb-size)",height:"var(--slider-thumb-size)",display:"flex",alignItems:"center",justifyContent:"center",outline:0,zIndex:"2",borderRadius:"full",transition:"shadow",_focusVisible:{ring:"3px",ringColor:"colorPalette.focusRing/50"}}},variants:{size:{sm:{root:{"--slider-thumb-size":"sizes.4","--slider-track-size":"sizes.1.5","--slider-marker-center":"6px","--slider-marker-size":"sizes.1","--slider-marker-inset":"3px"}},md:{root:{"--slider-thumb-size":"sizes.5","--slider-track-size":"sizes.2","--slider-marker-center":"8px","--slider-marker-size":"sizes.1","--slider-marker-inset":"4px"}},lg:{root:{"--slider-thumb-size":"sizes.6","--slider-track-size":"sizes.2.5","--slider-marker-center":"9px","--slider-marker-size":"sizes.1.5","--slider-marker-inset":"5px"}}},variant:{outline:{track:{shadow:"inset",bg:"bg.emphasized/72"},range:{bg:"colorPalette.solid"},thumb:{borderWidth:"2px",borderColor:"colorPalette.solid",bg:"bg",_disabled:{bg:"border.emphasized",borderColor:"border.emphasized"}}},solid:{track:{bg:"colorPalette.subtle",_disabled:{bg:"bg.muted"}},range:{bg:"colorPalette.solid"},thumb:{bg:"colorPalette.solid",_disabled:{bg:"border.emphasized"}}}},orientation:{vertical:{root:{display:"inline-flex"},control:{flexDirection:"column",height:"100%",minWidth:"var(--slider-thumb-size)","&:has(.chakra-slider__markerLabel)":{marginEnd:"4"}},track:{width:"var(--slider-track-size)"},thumb:{left:"50%",translate:"-50% 0"},markerGroup:{insetStart:"var(--slider-marker-center)",insetBlock:"var(--slider-marker-inset)"},marker:{flexDirection:"row"}},horizontal:{control:{flexDirection:"row",width:"100%",minHeight:"var(--slider-thumb-size)","&:has(.chakra-slider__markerLabel)":{marginBottom:"4"}},track:{height:"var(--slider-track-size)"},thumb:{top:"50%",translate:"0 -50%"},markerGroup:{top:"var(--slider-marker-center)",insetInline:"var(--slider-marker-inset)"},marker:{flexDirection:"column"}}}},defaultVariants:{size:"md",variant:"outline",orientation:"horizontal"}},Zo={slots:Ii.keys(),className:"splitter",base:{resizeTrigger:{"--splitter-border-color":"colors.border","--splitter-thumb-color":"colors.bg","--splitter-thumb-size":"sizes.2","--splitter-thumb-inset":"calc(var(--splitter-thumb-size) * -0.5)","--splitter-border-size":"1px","--splitter-handle-size":"sizes.6",outline:"0",display:"grid",placeItems:"center",position:"relative",_focus:{"--splitter-border-color":"colors.border.emphasized","--splitter-thumb-color":"colors.colorPalette.subtle"},_dragging:{"--splitter-thumb-color":"colors.colorPalette.focusRing"},_horizontal:{minWidth:"var(--splitter-thumb-size)",marginInline:"var(--splitter-thumb-inset)"},_vertical:{minHeight:"var(--splitter-thumb-size)",marginBlock:"var(--splitter-thumb-inset)"}},resizeTriggerSeparator:{position:"absolute",bg:"var(--splitter-border-color)","[data-part='resize-trigger'][data-orientation=horizontal] &":{insetInlineEnd:"calc(var(--splitter-thumb-size) * 0.5)",insetBlock:"0",insetInlineStart:"auto",w:"var(--splitter-border-size)"},"[data-part='resize-trigger'][data-orientation=vertical] &":{insetBlockEnd:"calc(var(--splitter-thumb-size) * 0.5)",insetInline:"0",insetBlockStart:"auto",h:"var(--splitter-border-size)"}},resizeTriggerIndicator:{position:"relative",rounded:"full",bg:"var(--splitter-thumb-color)",shadow:"xs",borderWidth:"1px",zIndex:"1","[data-part='resize-trigger'][data-orientation=horizontal] &":{w:"full",h:"var(--splitter-handle-size)"},"[data-part='resize-trigger'][data-orientation=vertical] &":{w:"var(--splitter-handle-size)",h:"full"},"[data-part='resize-trigger'][data-focus]:focus-visible &":{outlineWidth:"2px",outlineColor:"colorPalette.focusRing",outlineStyle:"solid"},"[data-part='resize-trigger'][data-disabled] &":{visibility:"hidden"}}}},Xo={className:"chakra-stat",slots:Ci.keys(),base:{root:{display:"flex",flexDirection:"column",gap:"1",position:"relative",flex:"1"},label:{display:"inline-flex",gap:"1.5",alignItems:"center",color:"fg.muted",textStyle:"sm"},helpText:{color:"fg.muted",textStyle:"xs"},valueUnit:{color:"fg.muted",textStyle:"xs",fontWeight:"initial",letterSpacing:"initial"},valueText:{verticalAlign:"baseline",fontWeight:"semibold",letterSpacing:"tight",fontFeatureSettings:"pnum",fontVariantNumeric:"proportional-nums",display:"inline-flex",gap:"1"},indicator:{display:"inline-flex",alignItems:"center",justifyContent:"center",marginEnd:1,"& :where(svg)":{w:"1em",h:"1em"},"&[data-type=up]":{color:"fg.success"},"&[data-type=down]":{color:"fg.error"}}},variants:{size:{sm:{valueText:{textStyle:"xl"}},md:{valueText:{textStyle:"2xl"}},lg:{valueText:{textStyle:"3xl"}}}},defaultVariants:{size:"md"}},Fo={className:"chakra-status",slots:_i.keys(),base:{root:{display:"inline-flex",alignItems:"center",gap:"2"},indicator:{width:"0.64em",height:"0.64em",flexShrink:0,borderRadius:"full",forcedColorAdjust:"none",bg:"colorPalette.solid"}},variants:{size:{sm:{root:{textStyle:"xs"}},md:{root:{textStyle:"sm"}},lg:{root:{textStyle:"md"}}}},defaultVariants:{size:"md"}},Yo={className:"chakra-steps",slots:Ti.keys(),base:{root:{display:"flex",width:"full"},list:{display:"flex",justifyContent:"space-between","--steps-gutter":"spacing.3","--steps-thickness":"2px"},title:{fontWeight:"medium",color:"fg"},description:{color:"fg.muted"},separator:{bg:"border",flex:"1"},indicator:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:"0",borderRadius:"full",fontWeight:"medium",width:"var(--steps-size)",height:"var(--steps-size)",_icon:{flexShrink:"0",width:"var(--steps-icon-size)",height:"var(--steps-icon-size)"}},item:{position:"relative",display:"flex",gap:"3",flex:"1 0 0","&:last-of-type":{flex:"initial","& [data-part=separator]":{display:"none"}}},trigger:{display:"flex",alignItems:"center",gap:"3",textAlign:"start",focusVisibleRing:"outside",borderRadius:"l2"},content:{focusVisibleRing:"outside"}},variants:{orientation:{vertical:{root:{flexDirection:"row",height:"100%"},list:{flexDirection:"column",alignItems:"flex-start"},separator:{position:"absolute",width:"var(--steps-thickness)",height:"100%",maxHeight:"calc(100% - var(--steps-size) - var(--steps-gutter) * 2)",top:"calc(var(--steps-size) + var(--steps-gutter))",insetStart:"calc(var(--steps-size) / 2 - 1px)"},item:{alignItems:"flex-start"}},horizontal:{root:{flexDirection:"column",width:"100%"},list:{flexDirection:"row",alignItems:"center"},separator:{width:"100%",height:"var(--steps-thickness)",marginX:"var(--steps-gutter)"},item:{alignItems:"center"}}},variant:{solid:{indicator:{_incomplete:{borderWidth:"var(--steps-thickness)"},_current:{bg:"colorPalette.muted",borderWidth:"var(--steps-thickness)",borderColor:"colorPalette.solid",color:"colorPalette.fg"},_complete:{bg:"colorPalette.solid",borderColor:"colorPalette.solid",color:"colorPalette.contrast"}},separator:{_complete:{bg:"colorPalette.solid"}}},subtle:{indicator:{_incomplete:{bg:"bg.muted"},_current:{bg:"colorPalette.muted",color:"colorPalette.fg"},_complete:{bg:"colorPalette.emphasized",color:"colorPalette.fg"}},separator:{_complete:{bg:"colorPalette.emphasized"}}}},size:{xs:{root:{gap:"2.5"},list:{"--steps-size":"sizes.6","--steps-icon-size":"sizes.3.5",textStyle:"xs"},title:{textStyle:"sm"}},sm:{root:{gap:"3"},list:{"--steps-size":"sizes.8","--steps-icon-size":"sizes.4",textStyle:"xs"},title:{textStyle:"sm"}},md:{root:{gap:"4"},list:{"--steps-size":"sizes.10","--steps-icon-size":"sizes.4",textStyle:"sm"},title:{textStyle:"sm"}},lg:{root:{gap:"6"},list:{"--steps-size":"sizes.11","--steps-icon-size":"sizes.5",textStyle:"md"},title:{textStyle:"md"}}}},defaultVariants:{size:"md",variant:"solid",orientation:"horizontal"}},qo={slots:Ri.keys(),className:"chakra-switch",base:{root:{display:"inline-flex",gap:"2.5",alignItems:"center",position:"relative",verticalAlign:"middle","--switch-diff":"calc(var(--switch-width) - var(--switch-height))","--switch-x":{base:"var(--switch-diff)",_rtl:"calc(var(--switch-diff) * -1)"}},label:{lineHeight:"1",userSelect:"none",fontSize:"sm",fontWeight:"medium",_disabled:{opacity:"0.5"}},indicator:{position:"absolute",height:"var(--switch-height)",width:"var(--switch-height)",fontSize:"var(--switch-indicator-font-size)",fontWeight:"medium",flexShrink:0,userSelect:"none",display:"grid",placeContent:"center",transition:"inset-inline-start 0.12s ease",insetInlineStart:"calc(var(--switch-x) - 2px)",_checked:{insetInlineStart:"2px"}},control:{display:"inline-flex",gap:"0.5rem",flexShrink:0,justifyContent:"flex-start",cursor:"switch",borderRadius:"full",position:"relative",width:"var(--switch-width)",height:"var(--switch-height)",transition:"backgrounds",_disabled:{opacity:"0.5",cursor:"not-allowed"},_invalid:{outline:"2px solid",outlineColor:"border.error",outlineOffset:"2px"}},thumb:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transitionProperty:"translate",transitionDuration:"fast",borderRadius:"inherit",_checked:{translate:"var(--switch-x) 0"}}},variants:{variant:{solid:{control:{borderRadius:"full",bg:"bg.emphasized",focusVisibleRing:"outside",_checked:{bg:"colorPalette.solid"}},thumb:{bg:"white",width:"var(--switch-height)",height:"var(--switch-height)",scale:"0.8",boxShadow:"sm",_checked:{bg:"colorPalette.contrast"}}},raised:{control:{borderRadius:"full",height:"calc(var(--switch-height) / 2)",bg:"bg.muted",boxShadow:"inset",_checked:{bg:"colorPalette.solid/60"}},thumb:{width:"var(--switch-height)",height:"var(--switch-height)",position:"relative",top:"calc(var(--switch-height) * -0.25)",bg:"white",boxShadow:"xs",focusVisibleRing:"outside",_checked:{bg:"colorPalette.solid"}}}},size:{xs:{root:{"--switch-width":"sizes.6","--switch-height":"sizes.3","--switch-indicator-font-size":"fontSizes.xs"}},sm:{root:{"--switch-width":"sizes.8","--switch-height":"sizes.4","--switch-indicator-font-size":"fontSizes.xs"}},md:{root:{"--switch-width":"sizes.10","--switch-height":"sizes.5","--switch-indicator-font-size":"fontSizes.sm"}},lg:{root:{"--switch-width":"sizes.12","--switch-height":"sizes.6","--switch-indicator-font-size":"fontSizes.md"}}}},defaultVariants:{variant:"solid",size:"md"}},Uo={className:"chakra-table",slots:Ei.keys(),base:{root:{fontVariantNumeric:"lining-nums tabular-nums",borderCollapse:"collapse",width:"full",textAlign:"start",verticalAlign:"top"},row:{_selected:{bg:"colorPalette.subtle"}},cell:{textAlign:"start",alignItems:"center"},columnHeader:{fontWeight:"medium",textAlign:"start",color:"fg"},caption:{fontWeight:"medium",textStyle:"xs"},footer:{fontWeight:"medium"}},variants:{interactive:{true:{body:{"& tr":{_hover:{bg:"colorPalette.subtle"}}}}},stickyHeader:{true:{header:{"& :where(tr)":{top:"var(--table-sticky-offset, 0)",position:"sticky",zIndex:1}}}},striped:{true:{row:{"&:nth-of-type(odd) td":{bg:"bg.muted"}}}},showColumnBorder:{true:{columnHeader:{"&:not(:last-of-type)":{borderInlineEndWidth:"1px"}},cell:{"&:not(:last-of-type)":{borderInlineEndWidth:"1px"}}}},variant:{line:{columnHeader:{borderBottomWidth:"1px"},cell:{borderBottomWidth:"1px"},row:{bg:"bg"}},outline:{root:{boxShadow:"0 0 0 1px {colors.border}"},columnHeader:{borderBottomWidth:"1px"},header:{bg:"bg.muted"},row:{"&:not(:last-of-type)":{borderBottomWidth:"1px"}},footer:{borderTopWidth:"1px"}}},size:{sm:{root:{textStyle:"sm"},columnHeader:{px:"2",py:"2"},cell:{px:"2",py:"2"}},md:{root:{textStyle:"sm"},columnHeader:{px:"3",py:"3"},cell:{px:"3",py:"3"}},lg:{root:{textStyle:"md"},columnHeader:{px:"4",py:"3"},cell:{px:"4",py:"3"}}}},defaultVariants:{variant:"line",size:"md"}},Go={slots:Pi.keys(),className:"chakra-tabs",base:{root:{"--tabs-trigger-radius":"radii.l2","--tabs-indicator-shadow":"shadows.xs","--tabs-indicator-bg":"colors.bg",position:"relative",_horizontal:{display:"block"},_vertical:{display:"flex"}},list:{display:"inline-flex",position:"relative",isolation:"isolate",minH:"var(--tabs-height)",_horizontal:{flexDirection:"row"},_vertical:{flexDirection:"column"}},trigger:{outline:"0",minW:"var(--tabs-height)",height:"var(--tabs-height)",display:"flex",alignItems:"center",fontWeight:"medium",position:"relative",cursor:"button",gap:"2",_focusVisible:{zIndex:1,outline:"2px solid",outlineColor:"colorPalette.focusRing"},_disabled:{cursor:"not-allowed",opacity:.5}},content:{focusVisibleRing:"inside",_horizontal:{width:"100%",pt:"var(--tabs-content-padding)"},_vertical:{height:"100%",ps:"var(--tabs-content-padding)"}},indicator:{width:"var(--width)",height:"var(--height)",borderRadius:"var(--tabs-trigger-radius)",bg:"var(--tabs-indicator-bg)",shadow:"var(--tabs-indicator-shadow)",zIndex:-1}},variants:{fitted:{true:{list:{display:"flex"},trigger:{flex:1,textAlign:"center",justifyContent:"center"}}},justify:{start:{list:{justifyContent:"flex-start"}},center:{list:{justifyContent:"center"}},end:{list:{justifyContent:"flex-end"}}},size:{sm:{root:{"--tabs-height":"sizes.9","--tabs-content-padding":"spacing.3"},trigger:{py:"1",px:"3",textStyle:"sm"}},md:{root:{"--tabs-height":"sizes.10","--tabs-content-padding":"spacing.4"},trigger:{py:"2",px:"4",textStyle:"sm"}},lg:{root:{"--tabs-height":"sizes.11","--tabs-content-padding":"spacing.4.5"},trigger:{py:"2",px:"4.5",textStyle:"md"}}},variant:{line:{list:{display:"flex",borderColor:"border",_horizontal:{borderBottomWidth:"1px"},_vertical:{borderEndWidth:"1px"}},trigger:{color:"fg.muted",_disabled:{_active:{bg:"initial"}},_selected:{color:"fg",_horizontal:{layerStyle:"indicator.bottom","--indicator-offset-y":"-1px","--indicator-color":"colors.colorPalette.solid"},_vertical:{layerStyle:"indicator.end","--indicator-offset-x":"-1px"}}}},subtle:{trigger:{borderRadius:"var(--tabs-trigger-radius)",color:"fg.muted",_selected:{bg:"colorPalette.subtle",color:"colorPalette.fg"}}},enclosed:{list:{bg:"bg.muted",padding:"1",borderRadius:"l3",minH:"calc(var(--tabs-height) - 4px)"},trigger:{justifyContent:"center",color:"fg.muted",borderRadius:"var(--tabs-trigger-radius)",_selected:{bg:"bg",color:"colorPalette.fg",shadow:"xs"}}},outline:{list:{"--line-thickness":"1px","--line-offset":"calc(var(--line-thickness) * -1)",borderColor:"border",display:"flex",_horizontal:{_before:{content:'""',position:"absolute",bottom:"0px",width:"100%",borderBottomWidth:"var(--line-thickness)",borderBottomColor:"border"}},_vertical:{_before:{content:'""',position:"absolute",insetInline:"var(--line-offset)",height:"calc(100% - calc(var(--line-thickness) * 2))",borderEndWidth:"var(--line-thickness)",borderEndColor:"border"}}},trigger:{color:"fg.muted",borderWidth:"1px",borderColor:"transparent",_selected:{bg:"currentBg",color:"colorPalette.fg"},_horizontal:{borderTopRadius:"var(--tabs-trigger-radius)",marginBottom:"var(--line-offset)",marginEnd:{_notLast:"var(--line-offset)"},_selected:{borderColor:"border",borderBottomColor:"transparent"}},_vertical:{borderStartRadius:"var(--tabs-trigger-radius)",marginEnd:"var(--line-offset)",marginBottom:{_notLast:"var(--line-offset)"},_selected:{borderColor:"border",borderEndColor:"transparent"}}}},plain:{trigger:{color:"fg.muted",_selected:{color:"colorPalette.fg"},borderRadius:"var(--tabs-trigger-radius)","&[data-selected][data-ssr]":{bg:"var(--tabs-indicator-bg)",shadow:"var(--tabs-indicator-shadow)",borderRadius:"var(--tabs-trigger-radius)"}}}}},defaultVariants:{size:"md",variant:"line"}},Ko=mr.variants?.variant,Jo={slots:Ai.keys(),className:"chakra-tag",base:{root:{display:"inline-flex",alignItems:"center",verticalAlign:"top",maxWidth:"100%",userSelect:"none",borderRadius:"l2",focusVisibleRing:"outside"},label:{lineClamp:"1"},closeTrigger:{display:"flex",alignItems:"center",justifyContent:"center",outline:"0",borderRadius:"l1",color:"currentColor",focusVisibleRing:"inside",focusRingWidth:"2px"},startElement:{flexShrink:0,boxSize:"var(--tag-element-size)",ms:"var(--tag-element-offset)","&:has([data-scope=avatar])":{boxSize:"var(--tag-avatar-size)",ms:"calc(var(--tag-element-offset) * 1.5)"},_icon:{boxSize:"100%"}},endElement:{flexShrink:0,boxSize:"var(--tag-element-size)",me:"var(--tag-element-offset)",_icon:{boxSize:"100%"},"&:has(button)":{ms:"calc(var(--tag-element-offset) * -1)"}}},variants:{size:{sm:{root:{px:"1.5",minH:"4.5",gap:"1","--tag-avatar-size":"spacing.3","--tag-element-size":"spacing.3","--tag-element-offset":"-2px"},label:{textStyle:"xs"}},md:{root:{px:"1.5",minH:"5",gap:"1","--tag-avatar-size":"spacing.3.5","--tag-element-size":"spacing.3.5","--tag-element-offset":"-2px"},label:{textStyle:"xs"}},lg:{root:{px:"2",minH:"6",gap:"1.5","--tag-avatar-size":"spacing.4.5","--tag-element-size":"spacing.4","--tag-element-offset":"-3px"},label:{textStyle:"sm"}},xl:{root:{px:"2.5",minH:"8",gap:"1.5","--tag-avatar-size":"spacing.6","--tag-element-size":"spacing.4.5","--tag-element-offset":"-4px"},label:{textStyle:"sm"}}},variant:{subtle:{root:Ko?.subtle},solid:{root:Ko?.solid},outline:{root:Ko?.outline},surface:{root:Ko?.surface}}},defaultVariants:{size:"md",variant:"surface"}};var es=Tr("tagsInput").parts("root","label","control","input","clearTrigger","item","itemPreview","itemInput","itemText","itemDeleteTrigger");es.build();const ts={slots:es.keys(),className:"tags-input",base:{root:{display:"flex",flexDirection:"column",gap:"1.5",width:"full"},label:{fontWeight:"medium",textStyle:"sm",_disabled:{opacity:"0.5"}},control:{"--focus-color":"colors.colorPalette.focusRing","--error-color":"colors.border.error",minH:"var(--tags-input-height)","--input-height":"var(--tags-input-height)",px:"var(--tags-input-px)",py:"var(--tags-input-py)",gap:"var(--tags-input-gap)",display:"flex",flexWrap:"wrap",alignItems:"center",borderRadius:"l2",pos:"relative",transitionProperty:"border-color, box-shadow",transitionDuration:"normal",_disabled:{opacity:"0.5"},_invalid:{borderColor:"var(--error-color)"}},input:{flex:"1",minWidth:"20",outline:"none",bg:"transparent",color:"fg",px:"calc(var(--tags-input-item-px) / 1.25)",height:"var(--tags-input-item-height)",_readOnly:{display:"none"}},item:{maxWidth:"100%",minWidth:"0"},itemText:{lineClamp:"1",minWidth:"0"},itemInput:{outline:"none",bg:"transparent",minWidth:"2ch",color:"inherit",px:"var(--tags-input-item-px)",height:"var(--tags-input-item-height)"},itemPreview:{height:"var(--tags-input-item-height)",userSelect:"none",display:"inline-flex",alignItems:"center",gap:"1",rounded:"l1",px:"var(--tags-input-item-px)",maxWidth:"100%"},itemDeleteTrigger:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",boxSize:"calc(var(--tags-input-item-height) / 1.5)",cursor:{base:"button",_disabled:"initial"},me:"-1",opacity:"0.4",_hover:{opacity:"1"},"[data-highlighted] &":{opacity:"1"},_icon:{boxSize:"80%"}},clearTrigger:{display:"flex",alignItems:"center",justifyContent:"center",boxSize:"calc(var(--tags-input-item-height) / 1.5)",cursor:{base:"button",_disabled:"initial"},color:"fg.muted",focusVisibleRing:"inside",focusRingWidth:"2px",rounded:"l1",_icon:{boxSize:"5"}}},variants:{size:{xs:{root:{"--tags-input-height":"sizes.8","--tags-input-px":"spacing.1.5","--tags-input-py":"spacing.1","--tags-input-gap":"spacing.1","--tags-input-item-height":"sizes.6","--tags-input-item-px":"spacing.2",textStyle:"xs"}},sm:{root:{"--tags-input-height":"sizes.9","--tags-input-px":"spacing.1.5","--tags-input-py":"spacing.1","--tags-input-gap":"spacing.1","--tags-input-item-height":"sizes.6","--tags-input-item-px":"spacing.2",textStyle:"sm"}},md:{root:{"--tags-input-height":"sizes.10","--tags-input-px":"spacing.1.5","--tags-input-py":"spacing.1","--tags-input-gap":"spacing.1","--tags-input-item-height":"sizes.7","--tags-input-item-px":"spacing.2",textStyle:"sm"}},lg:{root:{"--tags-input-height":"sizes.11","--tags-input-px":"spacing.1.5","--tags-input-py":"spacing.1","--tags-input-gap":"spacing.1","--tags-input-item-height":"sizes.8","--tags-input-item-px":"spacing.2",textStyle:"md"}}},variant:{outline:{control:{borderWidth:"1px",bg:"bg",_focus:{outlineWidth:"1px",outlineStyle:"solid",outlineColor:"var(--focus-color)",borderColor:"var(--focus-color)",_invalid:{outlineColor:"var(--error-color)",borderColor:"var(--error-color)"}}},itemPreview:{bg:"colorPalette.subtle",_highlighted:{bg:"colorPalette.muted"}}},subtle:{control:{bg:"bg.muted",borderWidth:"1px",borderColor:"transparent",_focus:{outlineWidth:"1px",outlineStyle:"solid",outlineColor:"var(--focus-color)",borderColor:"var(--focus-color)",_invalid:{outlineColor:"var(--error-color)",borderColor:"var(--error-color)"}}},itemPreview:{bg:"bg",borderWidth:"1px",_highlighted:{bg:"colorPalette.subtle",borderColor:"colorPalette.emphasized"}}},flushed:{control:{borderRadius:"0",px:"0",bg:"transparent",borderBottomWidth:"1px",borderBottomColor:"border",_focus:{borderColor:"var(--focus-color)",boxShadow:"0px 1px 0px 0px var(--focus-color)"}},itemPreview:{bg:"colorPalette.subtle",_highlighted:{bg:"colorPalette.muted"}}}}},defaultVariants:{size:"md",variant:"outline"}},ns={slots:$i.keys(),className:"chakra-timeline",base:{root:{display:"flex",flexDirection:"column",width:"full","--timeline-thickness":"1px","--timeline-gutter":"4px"},item:{"--timeline-content-gap":"spacing.6",display:"flex",position:"relative",alignItems:"flex-start",flexShrink:0,gap:"4",_last:{"--timeline-content-gap":"0"}},separator:{display:"var(--timeline-separator-display)",position:"absolute",borderStartWidth:"var(--timeline-thickness)",ms:"calc(-1 * var(--timeline-thickness) / 2)",insetInlineStart:"calc(var(--timeline-indicator-size) / 2)",insetBlock:"0",borderColor:"border"},indicator:{outline:"2px solid {colors.bg}",position:"relative",flexShrink:"0",boxSize:"var(--timeline-indicator-size)",fontSize:"var(--timeline-font-size)",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"full",fontWeight:"medium"},connector:{alignSelf:"stretch",position:"relative"},content:{pb:"var(--timeline-content-gap)",display:"flex",flexDirection:"column",width:"full",gap:"2"},title:{display:"flex",fontWeight:"medium",flexWrap:"wrap",gap:"1.5",alignItems:"center",mt:"var(--timeline-margin)"},description:{color:"fg.muted",textStyle:"xs"}},variants:{variant:{subtle:{indicator:{bg:"colorPalette.muted"}},solid:{indicator:{bg:"colorPalette.solid",color:"colorPalette.contrast"}},outline:{indicator:{bg:"currentBg",borderWidth:"1px",borderColor:"colorPalette.muted"}},plain:{}},showLastSeparator:{true:{item:{_last:{"--timeline-separator-display":"initial"}}},false:{item:{_last:{"--timeline-separator-display":"none"}}}},size:{sm:{root:{"--timeline-indicator-size":"sizes.4","--timeline-font-size":"fontSizes.2xs"},title:{textStyle:"xs"}},md:{root:{"--timeline-indicator-size":"sizes.5","--timeline-font-size":"fontSizes.xs"},title:{textStyle:"sm"}},lg:{root:{"--timeline-indicator-size":"sizes.6","--timeline-font-size":"fontSizes.xs"},title:{mt:"0.5",textStyle:"sm"}},xl:{root:{"--timeline-indicator-size":"sizes.8","--timeline-font-size":"fontSizes.sm"},title:{mt:"1.5",textStyle:"sm"}}}},defaultVariants:{size:"md",variant:"solid",showLastSeparator:!1}},rs={slots:Mi.keys(),className:"chakra-toast",base:{root:{width:"full",display:"flex",alignItems:"flex-start",position:"relative",gap:"3",py:"4",ps:"4",pe:"6",borderRadius:"l2",translate:"var(--x) var(--y)",scale:"var(--scale)",zIndex:"var(--z-index)",height:"var(--height)",opacity:"var(--opacity)",willChange:"translate, opacity, scale",transition:"translate 400ms, scale 400ms, opacity 400ms, height 400ms, box-shadow 200ms",transitionTimingFunction:"cubic-bezier(0.21, 1.02, 0.73, 1)",_closed:{transition:"translate 400ms, scale 400ms, opacity 200ms",transitionTimingFunction:"cubic-bezier(0.06, 0.71, 0.55, 1)"},bg:"bg.panel",color:"fg",boxShadow:"xl","--toast-trigger-bg":"colors.bg.muted","&[data-type=warning]":{bg:"orange.solid",color:"orange.contrast","--toast-trigger-bg":"{white/10}","--toast-border-color":"{white/40}"},"&[data-type=success]":{bg:"green.solid",color:"green.contrast","--toast-trigger-bg":"{white/10}","--toast-border-color":"{white/40}"},"&[data-type=error]":{bg:"red.solid",color:"red.contrast","--toast-trigger-bg":"{white/10}","--toast-border-color":"{white/40}"}},title:{fontWeight:"medium",textStyle:"sm",marginEnd:"2"},description:{display:"inline",textStyle:"sm",opacity:"0.8"},indicator:{flexShrink:"0",boxSize:"5"},actionTrigger:{textStyle:"sm",fontWeight:"medium",height:"8",px:"3",borderRadius:"l2",alignSelf:"center",borderWidth:"1px",borderColor:"var(--toast-border-color, inherit)",transition:"background 200ms",_hover:{bg:"var(--toast-trigger-bg)"}},closeTrigger:{position:"absolute",top:"1",insetEnd:"1",padding:"1",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"{currentColor/60}",borderRadius:"l2",textStyle:"md",transition:"background 200ms",_icon:{boxSize:"1em"}}}};var is=Tr("tooltip").parts("trigger","arrow","arrowTip","positioner","content");is.build();const os={slots:is.keys(),className:"chakra-tooltip",base:{content:{"--tooltip-bg":"colors.bg.inverted",bg:"var(--tooltip-bg)",color:"fg.inverted",px:"2.5",py:"1",borderRadius:"l2",fontWeight:"medium",textStyle:"xs",boxShadow:"md",maxW:"xs",zIndex:"tooltip",transformOrigin:"var(--transform-origin)",_open:{animationStyle:"scale-fade-in",animationDuration:"fast"},_closed:{animationStyle:"scale-fade-out",animationDuration:"fast"}},arrow:{"--arrow-size":"sizes.2","--arrow-background":"var(--tooltip-bg)"},arrowTip:{borderTopWidth:"1px",borderLeftWidth:"1px",borderColor:"var(--tooltip-bg)"}}};var ss=Tr("tree-view").parts("branch","branchContent","branchControl","branchIndentGuide","branchIndicator","branchText","branchTrigger","item","itemIndicator","itemText","label","nodeCheckbox","nodeRenameInput","root","tree");ss.build();const as={display:"flex",alignItems:"center",gap:"var(--tree-item-gap)",rounded:"l2",userSelect:"none",position:"relative","--tree-depth":"calc(var(--depth) - 1)","--tree-indentation-offset":"calc(var(--tree-indentation) * var(--tree-depth))","--tree-icon-offset":"calc(var(--tree-icon-size) * var(--tree-depth) * 0.5)","--tree-offset":"calc(var(--tree-padding-inline) + var(--tree-indentation-offset) + var(--tree-icon-offset))",ps:"var(--tree-offset)",pe:"var(--tree-padding-inline)",py:"var(--tree-padding-block)",focusVisibleRing:"inside",focusRingColor:"border.emphasized",focusRingWidth:"2px","&:hover, &:focus-visible":{bg:"bg.muted"},_disabled:{layerStyle:"disabled"}},ls={flex:"1"},cs={_selected:{bg:"colorPalette.subtle",color:"colorPalette.fg"}},hs={_selected:{layerStyle:"fill.solid"}},us={accordion:Di,actionBar:Wi,alert:Li,avatar:Vi,blockquote:Bi,breadcrumb:ji,card:Zi,carousel:Fi,checkbox:qi,checkboxCard:Ui,codeBlock:Gi,collapsible:Ji,dataList:no,datePicker:oo,dialog:so,drawer:ao,editable:co,emptyState:ho,field:uo,fieldset:fo,fileUpload:po,hoverCard:mo,list:bo,listbox:vo,menu:wo,nativeSelect:So,numberInput:_o,pinInput:Mo,popover:Po,progress:$o,progressCircle:zo,radioCard:No,radioGroup:Do,ratingGroup:Wo,scrollArea:Ho,segmentGroup:Bo,select:xo,combobox:to,slider:jo,splitter:Zo,stat:Xo,steps:Yo,switch:qo,table:Uo,tabs:Go,tag:Jo,tagsInput:ts,toast:rs,tooltip:os,status:Fo,timeline:ns,colorPicker:eo,qrCode:Io,treeView:{slots:ss.keys(),className:"chakra-tree-view",base:{root:{width:"full",display:"flex",flexDirection:"column",gap:"2"},tree:{display:"flex",flexDirection:"column","--tree-item-gap":"spacing.2",_icon:{boxSize:"var(--tree-icon-size)"}},label:{fontWeight:"medium",textStyle:"sm"},branch:{position:"relative"},branchContent:{position:"relative"},branchIndentGuide:{height:"100%",width:"1px",bg:"border",position:"absolute","--tree-depth":"calc(var(--depth) - 1)","--tree-indentation-offset":"calc(var(--tree-indentation) * var(--tree-depth))","--tree-offset":"calc(var(--tree-padding-inline) + var(--tree-indentation-offset))","--tree-icon-offset":"calc(var(--tree-icon-size) * 0.5 * var(--depth))",insetInlineStart:"calc(var(--tree-offset) + var(--tree-icon-offset))",zIndex:"1"},branchIndicator:{color:"fg.muted",transformOrigin:"center",transitionDuration:"normal",transitionProperty:"transform",transitionTimingFunction:"default",_open:{transform:"rotate(90deg)"}},branchTrigger:{display:"inline-flex",alignItems:"center",justifyContent:"center"},branchControl:as,item:as,itemText:ls,branchText:ls,nodeCheckbox:{display:"inline-flex"}},variants:{size:{md:{tree:{textStyle:"sm","--tree-indentation":"spacing.4","--tree-padding-inline":"spacing.3","--tree-padding-block":"spacing.1.5","--tree-icon-size":"spacing.4"}},sm:{tree:{textStyle:"sm","--tree-indentation":"spacing.4","--tree-padding-inline":"spacing.3","--tree-padding-block":"spacing.1","--tree-icon-size":"spacing.3"}},xs:{tree:{textStyle:"xs","--tree-indentation":"spacing.4","--tree-padding-inline":"spacing.2","--tree-padding-block":"spacing.1","--tree-icon-size":"spacing.3"}}},variant:{subtle:{branchControl:cs,item:cs},solid:{branchControl:hs,item:hs}},animateContent:{true:{branchContent:{_open:{animationName:"expand-height, fade-in",animationDuration:"moderate"},_closed:{animationName:"collapse-height, fade-out",animationDuration:"moderate"}}}}},defaultVariants:{size:"md",variant:"subtle"}},marquee:Oo},ds=qe.animations({spin:{value:"spin 1s linear infinite"},ping:{value:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite"},pulse:{value:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"},bounce:{value:"bounce 1s infinite"}}),fs=qe.aspectRatios({square:{value:"1 / 1"},landscape:{value:"4 / 3"},portrait:{value:"3 / 4"},wide:{value:"16 / 9"},ultrawide:{value:"18 / 5"},golden:{value:"1.618 / 1"}}),ps=qe.blurs({none:{value:" "},sm:{value:"4px"},md:{value:"8px"},lg:{value:"12px"},xl:{value:"16px"},"2xl":{value:"24px"},"3xl":{value:"40px"},"4xl":{value:"64px"}}),gs=qe.borders({xs:{value:"0.5px solid"},sm:{value:"1px solid"},md:{value:"2px solid"},lg:{value:"4px solid"},xl:{value:"8px solid"}}),ms=qe.colors({transparent:{value:"transparent"},current:{value:"currentColor"},black:{value:"#09090B"},white:{value:"#FFFFFF"},whiteAlpha:{50:{value:"rgba(255, 255, 255, 0.04)"},100:{value:"rgba(255, 255, 255, 0.06)"},200:{value:"rgba(255, 255, 255, 0.08)"},300:{value:"rgba(255, 255, 255, 0.16)"},400:{value:"rgba(255, 255, 255, 0.24)"},500:{value:"rgba(255, 255, 255, 0.36)"},600:{value:"rgba(255, 255, 255, 0.48)"},700:{value:"rgba(255, 255, 255, 0.64)"},800:{value:"rgba(255, 255, 255, 0.80)"},900:{value:"rgba(255, 255, 255, 0.92)"},950:{value:"rgba(255, 255, 255, 0.95)"}},blackAlpha:{50:{value:"rgba(0, 0, 0, 0.04)"},100:{value:"rgba(0, 0, 0, 0.06)"},200:{value:"rgba(0, 0, 0, 0.08)"},300:{value:"rgba(0, 0, 0, 0.16)"},400:{value:"rgba(0, 0, 0, 0.24)"},500:{value:"rgba(0, 0, 0, 0.36)"},600:{value:"rgba(0, 0, 0, 0.48)"},700:{value:"rgba(0, 0, 0, 0.64)"},800:{value:"rgba(0, 0, 0, 0.80)"},900:{value:"rgba(0, 0, 0, 0.92)"},950:{value:"rgba(0, 0, 0, 0.95)"}},gray:{50:{value:"#fafafa"},100:{value:"#f4f4f5"},200:{value:"#e4e4e7"},300:{value:"#d4d4d8"},400:{value:"#a1a1aa"},500:{value:"#71717a"},600:{value:"#52525b"},700:{value:"#3f3f46"},800:{value:"#27272a"},900:{value:"#18181b"},950:{value:"#111111"}},red:{50:{value:"#fef2f2"},100:{value:"#fee2e2"},200:{value:"#fecaca"},300:{value:"#fca5a5"},400:{value:"#f87171"},500:{value:"#ef4444"},600:{value:"#dc2626"},700:{value:"#991919"},800:{value:"#511111"},900:{value:"#300c0c"},950:{value:"#1f0808"}},orange:{50:{value:"#fff7ed"},100:{value:"#ffedd5"},200:{value:"#fed7aa"},300:{value:"#fdba74"},400:{value:"#fb923c"},500:{value:"#f97316"},600:{value:"#ea580c"},700:{value:"#92310a"},800:{value:"#6c2710"},900:{value:"#3b1106"},950:{value:"#220a04"}},yellow:{50:{value:"#fefce8"},100:{value:"#fef9c3"},200:{value:"#fef08a"},300:{value:"#fde047"},400:{value:"#facc15"},500:{value:"#eab308"},600:{value:"#ca8a04"},700:{value:"#845209"},800:{value:"#713f12"},900:{value:"#422006"},950:{value:"#281304"}},green:{50:{value:"#f0fdf4"},100:{value:"#dcfce7"},200:{value:"#bbf7d0"},300:{value:"#86efac"},400:{value:"#4ade80"},500:{value:"#22c55e"},600:{value:"#16a34a"},700:{value:"#116932"},800:{value:"#124a28"},900:{value:"#042713"},950:{value:"#03190c"}},teal:{50:{value:"#f0fdfa"},100:{value:"#ccfbf1"},200:{value:"#99f6e4"},300:{value:"#5eead4"},400:{value:"#2dd4bf"},500:{value:"#14b8a6"},600:{value:"#0d9488"},700:{value:"#0c5d56"},800:{value:"#114240"},900:{value:"#032726"},950:{value:"#021716"}},blue:{50:{value:"#eff6ff"},100:{value:"#dbeafe"},200:{value:"#bfdbfe"},300:{value:"#a3cfff"},400:{value:"#60a5fa"},500:{value:"#3b82f6"},600:{value:"#2563eb"},700:{value:"#173da6"},800:{value:"#1a3478"},900:{value:"#14204a"},950:{value:"#0c142e"}},cyan:{50:{value:"#ecfeff"},100:{value:"#cffafe"},200:{value:"#a5f3fc"},300:{value:"#67e8f9"},400:{value:"#22d3ee"},500:{value:"#06b6d4"},600:{value:"#0891b2"},700:{value:"#0c5c72"},800:{value:"#134152"},900:{value:"#072a38"},950:{value:"#051b24"}},purple:{50:{value:"#faf5ff"},100:{value:"#f3e8ff"},200:{value:"#e9d5ff"},300:{value:"#d8b4fe"},400:{value:"#c084fc"},500:{value:"#a855f7"},600:{value:"#9333ea"},700:{value:"#641ba3"},800:{value:"#4a1772"},900:{value:"#2f0553"},950:{value:"#1a032e"}},pink:{50:{value:"#fdf2f8"},100:{value:"#fce7f3"},200:{value:"#fbcfe8"},300:{value:"#f9a8d4"},400:{value:"#f472b6"},500:{value:"#ec4899"},600:{value:"#db2777"},700:{value:"#a41752"},800:{value:"#6d0e34"},900:{value:"#45061f"},950:{value:"#2c0514"}}}),bs=qe.cursor({button:{value:"pointer"},checkbox:{value:"default"},disabled:{value:"not-allowed"},menuitem:{value:"default"},option:{value:"default"},radio:{value:"default"},slider:{value:"default"},switch:{value:"pointer"}}),vs=qe.durations({fastest:{value:"50ms"},faster:{value:"100ms"},fast:{value:"150ms"},moderate:{value:"200ms"},slow:{value:"300ms"},slower:{value:"400ms"},slowest:{value:"500ms"}}),ys=qe.easings({"ease-in":{value:"cubic-bezier(0.42, 0, 1, 1)"},"ease-out":{value:"cubic-bezier(0, 0, 0.58, 1)"},"ease-in-out":{value:"cubic-bezier(0.42, 0, 0.58, 1)"},"ease-in-smooth":{value:"cubic-bezier(0.32, 0.72, 0, 1)"}}),Os=qe.fontSizes({"2xs":{value:"0.625rem"},xs:{value:"0.75rem"},sm:{value:"0.875rem"},md:{value:"1rem"},lg:{value:"1.125rem"},xl:{value:"1.25rem"},"2xl":{value:"1.5rem"},"3xl":{value:"1.875rem"},"4xl":{value:"2.25rem"},"5xl":{value:"3rem"},"6xl":{value:"3.75rem"},"7xl":{value:"4.5rem"},"8xl":{value:"6rem"},"9xl":{value:"8rem"}}),ws=qe.fontWeights({thin:{value:"100"},extralight:{value:"200"},light:{value:"300"},normal:{value:"400"},medium:{value:"500"},semibold:{value:"600"},bold:{value:"700"},extrabold:{value:"800"},black:{value:"900"}}),xs='-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',Ss=qe.fonts({heading:{value:`Inter, ${xs}`},body:{value:`Inter, ${xs}`},mono:{value:'SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace'}}),ks=qe.letterSpacings({tighter:{value:"-0.05em"},tight:{value:"-0.025em"},wide:{value:"0.025em"},wider:{value:"0.05em"},widest:{value:"0.1em"}}),Cs=qe.lineHeights({shorter:{value:1.25},short:{value:1.375},moderate:{value:1.5},tall:{value:1.625},taller:{value:2}}),_s=qe.radii({none:{value:"0"},"2xs":{value:"0.0625rem"},xs:{value:"0.125rem"},sm:{value:"0.25rem"},md:{value:"0.375rem"},lg:{value:"0.5rem"},xl:{value:"0.75rem"},"2xl":{value:"1rem"},"3xl":{value:"1.5rem"},"4xl":{value:"2rem"},full:{value:"9999px"}}),Ts=qe.spacing({.5:{value:"0.125rem"},1:{value:"0.25rem"},1.5:{value:"0.375rem"},2:{value:"0.5rem"},2.5:{value:"0.625rem"},3:{value:"0.75rem"},3.5:{value:"0.875rem"},4:{value:"1rem"},4.5:{value:"1.125rem"},5:{value:"1.25rem"},6:{value:"1.5rem"},7:{value:"1.75rem"},8:{value:"2rem"},9:{value:"2.25rem"},10:{value:"2.5rem"},11:{value:"2.75rem"},12:{value:"3rem"},14:{value:"3.5rem"},16:{value:"4rem"},20:{value:"5rem"},24:{value:"6rem"},28:{value:"7rem"},32:{value:"8rem"},36:{value:"9rem"},40:{value:"10rem"},44:{value:"11rem"},48:{value:"12rem"},52:{value:"13rem"},56:{value:"14rem"},60:{value:"15rem"},64:{value:"16rem"},72:{value:"18rem"},80:{value:"20rem"},96:{value:"24rem"}}),Rs=qe.sizes({"3xs":{value:"14rem"},"2xs":{value:"16rem"},xs:{value:"20rem"},sm:{value:"24rem"},md:{value:"28rem"},lg:{value:"32rem"},xl:{value:"36rem"},"2xl":{value:"42rem"},"3xl":{value:"48rem"},"4xl":{value:"56rem"},"5xl":{value:"64rem"},"6xl":{value:"72rem"},"7xl":{value:"80rem"},"8xl":{value:"90rem"}}),Es=qe.sizes({max:{value:"max-content"},min:{value:"min-content"},fit:{value:"fit-content"},prose:{value:"60ch"},full:{value:"100%"},dvh:{value:"100dvh"},svh:{value:"100svh"},lvh:{value:"100lvh"},dvw:{value:"100dvw"},svw:{value:"100svw"},lvw:{value:"100lvw"},vw:{value:"100vw"},vh:{value:"100vh"}}),Ms=qe.sizes({"1/2":{value:"50%"},"1/3":{value:"33.333333%"},"2/3":{value:"66.666667%"},"1/4":{value:"25%"},"3/4":{value:"75%"},"1/5":{value:"20%"},"2/5":{value:"40%"},"3/5":{value:"60%"},"4/5":{value:"80%"},"1/6":{value:"16.666667%"},"2/6":{value:"33.333333%"},"3/6":{value:"50%"},"4/6":{value:"66.666667%"},"5/6":{value:"83.333333%"},"1/12":{value:"8.333333%"},"2/12":{value:"16.666667%"},"3/12":{value:"25%"},"4/12":{value:"33.333333%"},"5/12":{value:"41.666667%"},"6/12":{value:"50%"},"7/12":{value:"58.333333%"},"8/12":{value:"66.666667%"},"9/12":{value:"75%"},"10/12":{value:"83.333333%"},"11/12":{value:"91.666667%"}}),Ps=qe.sizes({...Rs,...Ts,...Ms,...Es}),As=qe.zIndex({hide:{value:-1},base:{value:0},docked:{value:10},dropdown:{value:1e3},sticky:{value:1100},banner:{value:1200},overlay:{value:1300},modal:{value:1400},popover:{value:1500},skipNav:{value:1600},toast:{value:1700},tooltip:{value:1800},max:{value:2147483647}}),$s=function(...e){const t=wt(...e),{theme:n={},utilities:r={},globalCss:i={},cssVarsRoot:o=":where(:root, :host)",cssVarsPrefix:s="chakra",preflight:a}=t,l=function(e){const t=e.layers??kn,n=Object.values(t).sort(((e,t)=>Cn[e]-Cn[t]));return{names:n,atRule:`@layer ${n.join(", ")};`,wrap:(n,r)=>e.disableLayers?r:{[`@layer ${t[n]}`]:r}}}(t),c=or({breakpoints:n.breakpoints,tokens:n.tokens,semanticTokens:n.semanticTokens,prefix:s}),h=function(e){const t=function(e){return Object.entries(e).sort((([,e],[,t])=>parseInt(e,10){let i=null;return n<=r.length-1&&(i=r[n+1]?.[1]),null!=i&&(i=Zt(i)),[e,{name:e,min:jt(t),max:i}]}))}(e),n=Object.fromEntries(t);function r(e){return n[e]}function i(e){return Xt(r(e))}const o=function(){const e=function(){const e=Object.keys(n),t=function(e){const t=[];return e.forEach(((n,r)=>{let i=r;i++;let o=e[i];for(;o;)t.push([n,o]),i++,o=e[i]})),t}(e),o=e.flatMap((e=>{const t=r(e),n=[`${e}Down`,Xt({max:Zt(t.min)})];return[[e,Xt({min:t.min})],[`${e}Only`,i(e)],n]})).filter((([,e])=>""!==e)).concat(t.map((([e,t])=>{const n=r(e),i=r(t);return[`${e}To${o=t,o.charAt(0).toUpperCase()+o.slice(1)}`,Xt({min:n.min,max:Zt(i.min)})];var o})));return Object.fromEntries(o)}();return Object.fromEntries(Object.entries(e))}();return{values:Object.values(n),only:i,keys:function(){return Nt(["base",...Object.keys(n)])},conditions:o,getCondition:e=>o[e],up:function(e){return Xt({min:r(e).min})},down:function(e){return Xt({max:Zt(r(e).min)})}}}(n.breakpoints??Yt),u=(e=>{const{breakpoints:t,conditions:n={}}=e,r=Et(n,((e,t)=>[`_${e}`,t])),i=Object.assign({},r,t.conditions);function o(){return Object.keys(i)}function s(e){return o().includes(e)||Ft.test(e)||e.startsWith("_")}const a=Qt((e=>e.filter((e=>"base"!==e)).sort(((e,t)=>{const n=s(e),r=s(t);return n&&!r?1:!n&&r?-1:0}))));return{keys:o,sort:a,has:s,resolve:function(e){return Reflect.get(i,e)||e},breakpoints:t.keys(),expandAtRule:function(e){return e.startsWith("@breakpoint")?t.getCondition(e.replace("@breakpoint ","")):e}}})({conditions:t.conditions??Yt,breakpoints:h}),d=cr({config:r,tokens:c});!function(){const{textStyles:e,layerStyles:t,animationStyles:r}=n,i=Rt({textStyle:e,layerStyle:t,animationStyle:r});for(const[e,t]of Object.entries(i)){const n=Mt(t??Yt,hr);d.register(e,{values:Object.keys(n),transform:e=>v(n[e])})}}(),d.addPropertyType("animationName",Object.keys(n.keyframes??Yt));const f=new Set(["css",...d.keys(),...u.keys()]),p=Qt((e=>f.has(e)||Tt(e))),g=e=>{if(Array.isArray(e)){const t=Ut();for(let n=0;nArray.isArray(e),getKey:r?i:void 0})}}({utility:d,normalize:g}),b=function(e){const{conditions:t,isValidProperty:n}=e,r=Qt(((e,r)=>!n(e)||!r.split(",").every((e=>"base"===e||t.has(e)))));return function(e){return vt(e,(e=>e),{getKey:(e,n)=>dt(n)?t.has(e)?e:r(e,Object.keys(n).join(","))?function(e){const t=[];let n=0,r="",i=!1;for(let o=0;o{const t=e.startsWith("&")?e.slice(1):e;return function(e){const t=e.toLowerCase();return t.startsWith(":host-context")||t.startsWith(":host")||t.startsWith("::slotted")}(t)?`${t} &`:`&${t}`})).join(", "):e:e})}}({conditions:u,isValidProperty:p}),v=On({transform:d.transform,conditions:u,normalize:m}),y=function(e){const{css:t,conditions:n,normalize:r,layers:i}=e;return function o(s={}){const a=Sn(s),{base:l,defaultVariants:c,compoundVariants:h}=a,u=Et(a.variants,((e,t)=>[e,Et(t,((e,t)=>[e,r(t)]))])),d=On({conditions:n,normalize:r,transform:(e,t)=>u[e]?.[t]}),f=(e={})=>{const n=r({...c,...Rt(e)});let o={...r(l)};mt(o,d(n));const s=function(e,n){let r=Yt;return e.forEach((e=>{const i=Object.entries(e).every((([e,t])=>"css"===e||(Array.isArray(t)?t:[t]).some((t=>n[e]===t))));i&&(r=t(r,e.css))})),r}(h,n);return i.wrap("recipes",t(o,s))},p=Object.keys(u),g=Et(u,((e,t)=>[e,Object.keys(t)]));return Object.assign((e=>t(f(e))),{className:s.className,__cva__:!0,variantMap:g,variantKeys:p,raw:f,config:s,splitVariantProps:e=>{const t=xn(e,["recipe"]),[n,r]=It(t,p),i=p.includes("colorPalette"),o=p.includes("orientation");return i||(n.colorPalette=e.colorPalette||c.colorPalette),o&&(r.orientation=e.orientation),[n,r]},merge(t){return o(function(e){const{css:t}=e;return function(e,n){const r=Sn(n.config),i=Nt(e.variantKeys,Object.keys(n.variants)),o=t(e.base,r.base),s=Object.fromEntries(i.map((n=>[n,t(e.config.variants[n],r.variants[n])]))),a=mt(e.config.defaultVariants,r.defaultVariants),l=[...e.compoundVariants,...r.compoundVariants];return{className:wn(e.className,n.className),base:o,variants:s,defaultVariants:a,compoundVariants:l}}}(e)(this,t))}})}}({css:v,conditions:u,normalize:m,layers:l}),O=function(e){const{cva:t}=e;return function(e=Yt){const n=Object.entries(((e=Yt)=>{const t=t=>({base:e.base?.[t]??Yt,variants:Ut(),defaultVariants:e.defaultVariants??Yt,compoundVariants:e.compoundVariants?Tn(e.compoundVariants,t):qt}),n=(e.slots??[]).map((e=>[e,t(e)]));for(const[t,r]of Object.entries(e.variants??{}))for(const[e,i]of Object.entries(r))n.forEach((([n,r])=>{var o;(o=r.variants)[t]??(o[t]={}),r.variants[t][e]=i[n]??Yt}));return Object.fromEntries(n)})(e)).map((([e,n])=>[e,t(n)])),r=e.variants??Yt,i=Object.keys(r),o=Et(r,((e,t)=>[e,Object.keys(t)]));let s={};return e.className&&(s=Object.fromEntries(e.slots.map((t=>[t,`${e.className}__${t}`])))),Object.assign((function(e){const t=n.map((([t,n])=>[t,n(e)]));return Object.fromEntries(t)}),{variantMap:o,variantKeys:i,splitVariantProps:function(t){const n=xn(t,["recipe"]),[r,o]=It(n,i),s=i.includes("colorPalette"),a=i.includes("orientation");return s||(r.colorPalette=t.colorPalette||e.defaultVariants?.colorPalette),a&&(o.orientation=t.orientation),[r,o]},classNameMap:s})}}({cva:y});function w(){const e={};for(const[t,n]of c.cssVarMap.entries()){const r=Object.fromEntries(n);if(0===Object.keys(r).length)continue;const i="base"===t?o:u.resolve(t),s=i.startsWith("@");mt(e,v(b({[i]:s?{[o]:r}:r})))}return l.wrap("tokens",e)}function x(){const e=Et(n.keyframes??Yt,((e,t)=>[`@keyframes ${e}`,t])),t=Object.assign({},e,v(b(i)));return l.wrap("base",t)}function S(){const e=function(e){const{preflight:t}=e;if(!t)return{};const{scope:n="",level:r="parent"}=dt(t)?t:{};let i="";n&&"parent"===r?i=`${n} `:n&&"element"===r&&(i=`&${n}`);const o={"*":{margin:"0px",padding:"0px",font:"inherit",wordWrap:"break-word",WebkitTapHighlightColor:"transparent"},"*, *::before, *::after, *::backdrop":{boxSizing:"border-box",borderWidth:"0px",borderStyle:"solid",borderColor:"var(--global-color-border, currentColor)"},hr:{height:"0px",color:"inherit",borderTopWidth:"1px"},body:{minHeight:"100dvh",position:"relative"},img:{borderStyle:"none"},"img, svg, video, canvas, audio, iframe, embed, object":{display:"block",verticalAlign:"middle"},iframe:{border:"none"},"img, video":{maxWidth:"100%",height:"auto"},"p, h1, h2, h3, h4, h5, h6":{overflowWrap:"break-word"},"ol, ul":{listStyle:"none"},"code, kbd, pre, samp":{fontSize:"1em"},"button, [type='button'], [type='reset'], [type='submit']":{WebkitAppearance:"button",backgroundColor:"transparent",backgroundImage:"none"},"button, input, optgroup, select, textarea":{color:"inherit"},"button, select":{textTransform:"none"},table:{textIndent:"0px",borderColor:"inherit",borderCollapse:"collapse"},"*::placeholder":{opacity:"unset",color:"#9ca3af",userSelect:"none"},textarea:{resize:"vertical"},summary:{display:"list-item"},small:{fontSize:"80%"},"sub, sup":{fontSize:"75%",lineHeight:0,position:"relative",verticalAlign:"baseline"},sub:{bottom:"-0.25em"},sup:{top:"-0.5em"},dialog:{padding:"0px"},a:{color:"inherit",textDecoration:"inherit"},"abbr:where([title])":{textDecoration:"underline dotted"},"b, strong":{fontWeight:"bolder"},"code, kbd, samp, pre":{fontSize:"1em","--font-mono-fallback":"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New'",fontFamily:"var(--global-font-mono, var(--font-mono-fallback))"},'input[type="text"], input[type="email"], input[type="search"], input[type="password"]':{WebkitAppearance:"none",MozAppearance:"none"},"input[type='search']":{WebkitAppearance:"textfield",outlineOffset:"-2px"},"::-webkit-search-decoration, ::-webkit-search-cancel-button":{WebkitAppearance:"none"},"::-webkit-file-upload-button":{WebkitAppearance:"button",font:"inherit"},'input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button':{height:"auto"},"input[type='number']":{MozAppearance:"textfield"},":-moz-ui-invalid":{boxShadow:"none"},":-moz-focusring":{outline:"auto"},"[hidden]:where(:not([hidden='until-found']))":{display:"none !important"}},s={[n||"html"]:{lineHeight:1.5,"--font-fallback":"ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",WebkitTextSizeAdjust:"100%",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",textRendering:"optimizeLegibility",touchAction:"manipulation",MozTabSize:"4",tabSize:"4",fontFamily:"var(--global-font-body, var(--font-fallback))"}};if("element"===r){const e=Object.entries(o).reduce(((e,[t,n])=>(e[t]={[i]:n},e)),{});Object.assign(s,e)}else i?s[i]=o:Object.assign(s,o);return s}({preflight:a});return l.wrap("reset",e)}const k=function(e){const t=new Map;return e.allTokens.forEach((e=>{const{cssVar:n,virtual:r,conditions:i}=e.extensions,o=i||r?n.ref:e.value;t.set(e.name,{value:o,variable:n.ref})})),t}(c),C=(e,t)=>k.get(e)?.value||t;function _(e){return Object.hasOwnProperty.call(n.recipes??Yt,e)}function T(e){return Object.hasOwnProperty.call(n.slotRecipes??Yt,e)}C.var=(e,t)=>k.get(e)?.variable||t;const R=[S(),x(),w()],E={layerStyles:ur(n.layerStyles??Yt),textStyles:ur(n.textStyles??Yt),animationStyles:ur(n.animationStyles??Yt),tokens:dr(c,Object.keys(n.tokens??Yt),((e,t)=>!e.extensions.conditions&&!t.includes("colorPalette"))),semanticTokens:dr(c,Object.keys(n.semanticTokens??Yt),(e=>!!e.extensions.conditions)),keyframes:fr(n.keyframes??Yt),breakpoints:fr(n.breakpoints??Yt)};return{$$chakra:!0,_config:t,_global:R,breakpoints:h,tokens:c,conditions:u,utility:d,token:C,properties:f,layers:l,isValidProperty:p,splitCssProps:function(e){return It(e,p)},normalizeValue:g,getTokenCss:w,getGlobalCss:x,getPreflightCss:S,css:v,cva:y,sva:O,getRecipe:function(e,t){return n.recipes?.[e]??t},getSlotRecipe:function(e,t){return n.slotRecipes?.[e]??t},hasRecipe:function(e){return _(e)||T(e)},isRecipe:_,isSlotRecipe:T,query:E}}(wt(ct,{preflight:!0,cssVarsPrefix:"chakra",cssVarsRoot:":where(html, .chakra-theme)",globalCss:gr,theme:{breakpoints:{sm:"480px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},keyframes:{spin:{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}},pulse:{"50%":{opacity:"0.5"}},ping:{"75%, 100%":{transform:"scale(2)",opacity:"0"}},bounce:{"0%, 100%":{transform:"translateY(-25%)",animationTimingFunction:"cubic-bezier(0.8,0,1,1)"},"50%":{transform:"none",animationTimingFunction:"cubic-bezier(0,0,0.2,1)"}},"bg-position":{from:{backgroundPosition:"var(--animate-from, 1rem) 0"},to:{backgroundPosition:"var(--animate-to, 0) 0"}},position:{from:{insetInlineStart:"var(--animate-from-x)",insetBlockStart:"var(--animate-from-y)"},to:{insetInlineStart:"var(--animate-to-x)",insetBlockStart:"var(--animate-to-y)"}},"circular-progress":{"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100%"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260%"}},"expand-height":{from:{height:"var(--collapsed-height, 0)"},to:{height:"var(--height)"}},"collapse-height":{from:{height:"var(--height)"},to:{height:"var(--collapsed-height, 0)"}},"expand-width":{from:{width:"var(--collapsed-width, 0)"},to:{width:"var(--width)"}},"collapse-width":{from:{width:"var(--width)"},to:{width:"var(--collapsed-width, 0)"}},"fade-in":{from:{opacity:0},to:{opacity:1}},"fade-out":{from:{opacity:1},to:{opacity:0}},"slide-from-left-full":{from:{translate:"-100% 0"},to:{translate:"0 0"}},"slide-from-right-full":{from:{translate:"100% 0"},to:{translate:"0 0"}},"slide-from-top-full":{from:{translate:"0 -100%"},to:{translate:"0 0"}},"slide-from-bottom-full":{from:{translate:"0 100%"},to:{translate:"0 0"}},"slide-to-left-full":{from:{translate:"0 0"},to:{translate:"-100% 0"}},"slide-to-right-full":{from:{translate:"0 0"},to:{translate:"100% 0"}},"slide-to-top-full":{from:{translate:"0 0"},to:{translate:"0 -100%"}},"slide-to-bottom-full":{from:{translate:"0 0"},to:{translate:"0 100%"}},"slide-from-top":{"0%":{translate:"0 -0.5rem"},to:{translate:"0"}},"slide-from-bottom":{"0%":{translate:"0 0.5rem"},to:{translate:"0"}},"slide-from-left":{"0%":{translate:"-0.5rem 0"},to:{translate:"0"}},"slide-from-right":{"0%":{translate:"0.5rem 0"},to:{translate:"0"}},"slide-to-top":{"0%":{translate:"0"},to:{translate:"0 -0.5rem"}},"slide-to-bottom":{"0%":{translate:"0"},to:{translate:"0 0.5rem"}},"slide-to-left":{"0%":{translate:"0"},to:{translate:"-0.5rem 0"}},"slide-to-right":{"0%":{translate:"0"},to:{translate:"0.5rem 0"}},"scale-in":{from:{scale:"0.95"},to:{scale:"1"}},"scale-out":{from:{scale:"1"},to:{scale:"0.95"}},marqueeX:{from:{transform:"translateX(0%)"},to:{transform:"translateX(var(--marquee-translate))"}},marqueeY:{from:{transform:"translateY(0%)"},to:{transform:"translateY(var(--marquee-translate))"}}},tokens:{aspectRatios:fs,animations:ds,blurs:ps,borders:gs,colors:ms,durations:vs,easings:ys,fonts:Ss,fontSizes:Os,fontWeights:ws,letterSpacings:ks,lineHeights:Cs,radii:_s,spacing:Ts,sizes:Ps,zIndex:As,cursor:bs},semanticTokens:{colors:kr,shadows:_r,radii:Cr},recipes:Sr,slotRecipes:us,textStyles:{"2xs":{value:{fontSize:"2xs",lineHeight:"0.75rem"}},xs:{value:{fontSize:"xs",lineHeight:"1rem"}},sm:{value:{fontSize:"sm",lineHeight:"1.25rem"}},md:{value:{fontSize:"md",lineHeight:"1.5rem"}},lg:{value:{fontSize:"lg",lineHeight:"1.75rem"}},xl:{value:{fontSize:"xl",lineHeight:"1.875rem"}},"2xl":{value:{fontSize:"2xl",lineHeight:"2rem"}},"3xl":{value:{fontSize:"3xl",lineHeight:"2.375rem"}},"4xl":{value:{fontSize:"4xl",lineHeight:"2.75rem",letterSpacing:"-0.025em"}},"5xl":{value:{fontSize:"5xl",lineHeight:"3.75rem",letterSpacing:"-0.025em"}},"6xl":{value:{fontSize:"6xl",lineHeight:"4.5rem",letterSpacing:"-0.025em"}},"7xl":{value:{fontSize:"7xl",lineHeight:"5.75rem",letterSpacing:"-0.025em"}},none:{value:{}},label:{value:{fontSize:"sm",lineHeight:"1.25rem",fontWeight:"medium"}}},layerStyles:{"fill.muted":{value:{background:"colorPalette.muted",color:"colorPalette.fg"}},"fill.subtle":{value:{background:"colorPalette.subtle",color:"colorPalette.fg"}},"fill.surface":{value:{background:"colorPalette.subtle",color:"colorPalette.fg",boxShadow:"0 0 0px 1px var(--shadow-color)",boxShadowColor:"colorPalette.muted"}},"fill.solid":{value:{background:"colorPalette.solid",color:"colorPalette.contrast"}},"outline.subtle":{value:{color:"colorPalette.fg",boxShadow:"inset 0 0 0px 1px var(--shadow-color)",boxShadowColor:"colorPalette.subtle"}},"outline.solid":{value:{borderWidth:"1px",borderColor:"colorPalette.solid",color:"colorPalette.fg"}},"indicator.bottom":{value:{position:"relative","--indicator-color-fallback":"colors.colorPalette.solid",_before:{content:'""',position:"absolute",bottom:"var(--indicator-offset-y, 0)",insetInline:"var(--indicator-offset-x, 0)",height:"var(--indicator-thickness, 2px)",background:"var(--indicator-color, var(--indicator-color-fallback))"}}},"indicator.top":{value:{position:"relative","--indicator-color-fallback":"colors.colorPalette.solid",_before:{content:'""',position:"absolute",top:"var(--indicator-offset-y, 0)",insetInline:"var(--indicator-offset-x, 0)",height:"var(--indicator-thickness, 2px)",background:"var(--indicator-color, var(--indicator-color-fallback))"}}},"indicator.start":{value:{position:"relative","--indicator-color-fallback":"colors.colorPalette.solid",_before:{content:'""',position:"absolute",insetInlineStart:"var(--indicator-offset-x, 0)",insetBlock:"var(--indicator-offset-y, 0)",width:"var(--indicator-thickness, 2px)",background:"var(--indicator-color, var(--indicator-color-fallback))"}}},"indicator.end":{value:{position:"relative","--indicator-color-fallback":"colors.colorPalette.solid",_before:{content:'""',position:"absolute",insetInlineEnd:"var(--indicator-offset-x, 0)",insetBlock:"var(--indicator-offset-y, 0)",width:"var(--indicator-thickness, 2px)",background:"var(--indicator-color, var(--indicator-color-fallback))"}}},disabled:{value:{opacity:"0.5",cursor:"not-allowed"}},none:{value:{}}},animationStyles:{"slide-fade-in":{value:{transformOrigin:"var(--transform-origin)","&[data-placement^=top]":{animationName:"slide-from-bottom, fade-in"},"&[data-placement^=bottom]":{animationName:"slide-from-top, fade-in"},"&[data-placement^=left]":{animationName:"slide-from-right, fade-in"},"&[data-placement^=right]":{animationName:"slide-from-left, fade-in"}}},"slide-fade-out":{value:{transformOrigin:"var(--transform-origin)","&[data-placement^=top]":{animationName:"slide-to-bottom, fade-out"},"&[data-placement^=bottom]":{animationName:"slide-to-top, fade-out"},"&[data-placement^=left]":{animationName:"slide-to-right, fade-out"},"&[data-placement^=right]":{animationName:"slide-to-left, fade-out"}}},"scale-fade-in":{value:{transformOrigin:"var(--transform-origin)",animationName:"scale-in, fade-in"}},"scale-fade-out":{value:{transformOrigin:"var(--transform-origin)",animationName:"scale-out, fade-out"}}}}})),zs=function({isOpen:e,onClassic:t,onAIBuilder:n,onClose:r}){const[i,o]=(0,s.useState)(!1);return(0,s.useEffect)((()=>{e&&o(!1)}),[e]),e?(0,c.createElement)("div",{className:"viz-chooser-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"viz-chooser-title"},(0,c.createElement)("div",{className:"viz-chooser-modal"},(0,c.createElement)("button",{className:"viz-chooser-close",onClick:r,"aria-label":(0,a.__)("Close","visualizer")},"✕"),(0,c.createElement)("h2",{id:"viz-chooser-title",className:"viz-chooser-title"},(0,a.__)("Create a New Chart","visualizer")),(0,c.createElement)("p",{className:"viz-chooser-subtitle"},(0,a.__)("Choose how you want to build your chart.","visualizer")),(0,c.createElement)("div",{className:"viz-chooser-options"},(0,c.createElement)("button",{className:"viz-chooser-option viz-chooser-option--ai",onClick:()=>n(i)},(0,c.createElement)("span",{className:"viz-chooser-option__badge"},(0,a.__)("New","visualizer")),(0,c.createElement)("span",{className:"viz-chooser-option__icon viz-chooser-option__icon--ai"},(0,c.createElement)("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},(0,c.createElement)("path",{d:"M12 2L14.5 9.5H22L16 14L18.5 21.5L12 17L5.5 21.5L8 14L2 9.5H9.5L12 2Z",fill:"currentColor"}))),(0,c.createElement)("span",{className:"viz-chooser-option__title"},(0,a.__)("AI Chart Builder","visualizer")),(0,c.createElement)("span",{className:"viz-chooser-option__desc"},(0,a.__)("Describe your chart and let AI build it with D3.js.","visualizer"))),(0,c.createElement)("button",{className:"viz-chooser-option",onClick:()=>t(i)},(0,c.createElement)("span",{className:"viz-chooser-option__icon viz-chooser-option__icon--classic"},(0,c.createElement)("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},(0,c.createElement)("rect",{x:"3",y:"14",width:"4",height:"7",rx:"1",fill:"currentColor"}),(0,c.createElement)("rect",{x:"10",y:"9",width:"4",height:"12",rx:"1",fill:"currentColor"}),(0,c.createElement)("rect",{x:"17",y:"4",width:"4",height:"17",rx:"1",fill:"currentColor"}))),(0,c.createElement)("span",{className:"viz-chooser-option__title"},(0,a.__)("Classic Builder","visualizer")),(0,c.createElement)("span",{className:"viz-chooser-option__desc"},(0,a.__)("Step-by-step wizard with all chart types and options.","visualizer")))),(0,c.createElement)("div",{className:"viz-chooser-remember"},(0,c.createElement)("label",{className:"viz-chooser-remember__label"},(0,c.createElement)("input",{type:"checkbox",checked:i,onChange:e=>o(e.target.checked)}),(0,c.createElement)("span",null,(0,a.__)("Don't ask me again","visualizer"))),(0,c.createElement)("p",{className:"viz-chooser-remember__help"},(0,a.__)("We will open your selected builder by default next time.","visualizer"))),(0,c.createElement)("button",{className:"viz-chooser-cancel",onClick:r},(0,a.__)("Cancel","visualizer")))):null};var Qs=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Is=ge((function(e){return Qs.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91}));function Ns(...e){return function(...t){e.forEach((e=>e?.(...t)))}}const Ds=(...e)=>e.map((e=>e?.trim?.())).filter(Boolean).join(" "),Ws=/^on[A-Z]/;function Ls(...e){let t={};for(let n of e){for(let e in t)Ws.test(e)&&"function"==typeof t[e]&&"function"==typeof n[e]?t[e]=Ns(t[e],n[e]):t[e]="className"!==e&&"class"!==e?"style"!==e?void 0!==n[e]?n[e]:t[e]:Object.assign({},t[e]??{},n[e]??{}):Ds(t[e],n[e]);for(let e in n)void 0===t[e]&&(t[e]=n[e])}return t}const Hs=parseInt(c.version.split(".")[0],10)>=19;function Vs(e,t){if(null!=e){if("function"==typeof e)return e(t);try{e.current=t}catch(n){throw new Error(`Cannot assign value '${t}' to ref '${e}'`)}}}const Bs=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function js(e){return"string"==typeof e&&Bs.has(e)}var Zs;const Xs=(Zs=Is).default||Zs,Fs=e=>"theme"!==e;let Ys="undefined"!=typeof document;const qs=({cache:e,serialized:t,isStringTag:n})=>{de(e,t,n);const r=Pe((()=>fe(e,t,n)));if(!Ys&&void 0!==r){let n=t.name,i=t.next;for(;void 0!==i;)n=wn(n,i.name),i=i.next;return(0,l.jsx)("style",{"data-emotion":wn(e.key,n),dangerouslySetInnerHTML:{__html:r},nonce:e.sheet.nonce})}return null},Us={path:["d"],text:["x","y"],circle:["cx","cy","r"],rect:["width","height","x","y","rx","ry"],ellipse:["cx","cy","rx","ry"],g:["transform"],stop:["offset","stopOpacity"]},Gs=((e,t={},n={})=>{if(r=Us,i=e,Object.prototype.hasOwnProperty.call(r,i)){n.forwardProps||(n.forwardProps=[]);const t=Us[e];n.forwardProps=Nt([...n.forwardProps,...t])}var r,i;const o=e.__emotion_real===e,s=o&&e.__emotion_base||e;let a,h;void 0!==n&&(a=n.label,h=n.target);let u=[];const d=ze(((r,i,a)=>{const{cva:d,isValidProperty:f}=Ze(),p=t.__cva__?t:d(t),g=ea(e.__emotion_cva,p);var m;!n.shouldForwardProp&&n.forwardProps&&(n.shouldForwardProp=(m=n.forwardProps,(e,t)=>!!m.includes(e)||!t?.includes(e)&&!f(e)));const b=((e,t,n)=>{let r;if(t){const n=t.shouldForwardProp;r=e.__emotion_forwardProp&&n?t=>e.__emotion_forwardProp(t)&&n(t):n}return"function"!=typeof r&&n&&(r=e.__emotion_forwardProp),r})(e,n,o)||((t,n)=>{const r="string"==typeof e&&e.charCodeAt(0)>96?Xs:Fs,i=!n?.includes(t)&&!f(t);return r(t)&&i}),v=c.useMemo((()=>Object.assign({},n.defaultProps,Rt(r))),[r]),{props:y,styles:O}=function(e,t,n){const{css:r,isValidProperty:i}=Ze(),{children:o,...s}=e,a=(0,c.useMemo)((()=>{const[e,r]=It(s,(e=>n(e,t.variantKeys))),[o,a]=It(r,t.variantKeys),[l,c]=It(a,i);return{forwardedProps:e,variantProps:o,styleProps:l,elementProps:c}}),[t.variantKeys,n,s,i]),{css:l,...h}=a.styleProps,u=(0,c.useMemo)((()=>{const e={...a.variantProps},n=t.variantKeys.includes("colorPalette"),r=t.variantKeys.includes("orientation");return n||(e.colorPalette=s.colorPalette),r||(e.orientation=s.orientation),t(e)}),[t,a.variantProps,s.colorPalette,s.orientation]);return{styles:(0,c.useMemo)((()=>{return r(u,...(e=l,(Array.isArray(e)?e:[e]).filter(Boolean).flat()),h);var e}),[r,u,l,h]),props:{...a.forwardedProps,...a.elementProps,children:o}}}(v,g,b);let w="",x=[O],S=y;if(null==y.theme){S={};for(let e in y)S[e]=y[e];S.theme=c.useContext(Qe)}"string"==typeof y.className?w=ue(i.registered,x,y.className):null!=y.className&&(w=wn(w,y.className));const k=Te(u.concat(x),i.registered,S);k.styles&&(w=wn(w,`${i.key}-${k.name}`)),void 0!==h&&(w=wn(w,h));const C=!b("as");let _=C&&y.as||s,T={};for(let e in y)C&&"as"===e||(js(e)?T[e.replace("html","").toLowerCase()]=y[e]:b(e)&&(T[e]=y[e]));let R=w.trim();R?T.className=R:Reflect.deleteProperty(T,"className"),T.ref=a;const E=n.forwardAsChild||n.forwardProps?.includes("asChild");if(y.asChild&&!E){const e=c.isValidElement(y.children)?c.Children.only(y.children):c.Children.toArray(y.children).find(c.isValidElement);if(!e)throw new Error("[chakra-ui > factory] No valid child found");_=e.type,T.children=null,Reflect.deleteProperty(T,"asChild"),T=Ls(T,e.props),T.ref=function(...e){const t=e.filter((e=>null!=e));if(Hs){const e=new Map;return n=>(t.forEach((t=>{const r=Vs(t,n);r&&e.set(t,r)})),()=>{t.forEach((t=>{const n=e.get(t);n&&"function"==typeof n?n():Vs(t,null)})),e.clear()})}return e=>{t.forEach((t=>{Vs(t,e)}))}}(a,function(e){const t=c.version;return ft(t)?t.startsWith("18.")?e?.ref:e?.props?.ref:e?.ref}(e))}return T.as&&E?(T.as=void 0,(0,l.jsxs)(c.Fragment,{children:[(0,l.jsx)(qs,{cache:i,serialized:k,isStringTag:"string"==typeof _}),(0,l.jsx)(_,{asChild:!0,...T,children:(0,l.jsx)(y.as,{children:T.children})})]})):(0,l.jsxs)(c.Fragment,{children:[(0,l.jsx)(qs,{cache:i,serialized:k,isStringTag:"string"==typeof _}),(0,l.jsx)(_,{...T})]})}));return d.displayName=void 0!==a?a:`chakra(${"string"==typeof s?s:s.displayName||s.name||"Component"})`,d.__emotion_real=d,d.__emotion_base=s,d.__emotion_forwardProp=n.shouldForwardProp,d.__emotion_cva=t,Object.defineProperty(d,"toString",{value:()=>`.${h}`}),d}).bind(),Ks=new Map,Js=new Proxy(Gs,{apply:(e,__,t)=>Gs(...t),get:(e,t)=>(Ks.has(t)||Ks.set(t,Gs(t)),Ks.get(t))}),ea=(e,t)=>e&&!t?e:!e&&t?t:e.merge(t),ta=Js("div");ta.displayName="Box";const na=Object.freeze({});function ra(e){const{key:t,recipe:n}=e,r=(i=t||n.className||"Component").charAt(0).toUpperCase()+i.slice(1);var i;const[o,s]=Be({strict:!1,name:`${r}PropsContext`,providerName:`${r}PropsContext`});function a(e){const{unstyled:r,...i}=e,o=function(e){const{key:t,recipe:n}=e,r=Ze();return(0,c.useMemo)((()=>{const e=n||(null!=t?r.getRecipe(t):{});return r.cva(structuredClone(e))}),[t,n,r])}({key:t,recipe:i.recipe||n}),[s,a]=(0,c.useMemo)((()=>o.splitVariantProps(i)),[o,i]);return{styles:r?na:o(s),className:o.className,props:a}}return{withContext:(e,t)=>{const n=Js(e,{},t),r=(0,c.forwardRef)(((e,t)=>{const r=s(),i=(0,c.useMemo)((()=>Ls(r,e)),[e,r]),{styles:o,className:h,props:u}=a(i);return(0,l.jsx)(n,{...u,ref:t,css:[o,i.css],className:wn(h,i.className)})}));return r.displayName=e.displayName||e.name,r},PropsProvider:o,withPropsProvider:function(){return o},usePropsContext:s,useRecipeResult:a}}Object.freeze({});const{withContext:ia,PropsProvider:oa}=ra({key:"text"}),sa=ia("p");sa.displayName="Text";const aa=(0,c.forwardRef)((function(e,t){const{direction:n,align:r,justify:i,wrap:o,basis:s,grow:a,shrink:c,inline:h,...u}=e;return(0,l.jsx)(Js.div,{ref:t,...u,css:{display:h?"inline-flex":"flex",flexDirection:n,alignItems:r,justifyContent:i,flexWrap:o,flexBasis:s,flexGrow:a,flexShrink:c,...e.css}})}));aa.displayName="Flex";const{withContext:la,PropsProvider:ca}=ra({key:"spinner"}),ha=la("span");function ua(e,t){return null==e||null==t?NaN:et?1:e>=t?0:NaN}function da(e,t){return null==e||null==t?NaN:te?1:t>=e?0:NaN}function fa(e){let t,n,r;function i(e,r,i=0,o=e.length){if(i>>1;n(e[t],r)<0?i=t+1:o=t}while(iua(e(t),n),r=(t,n)=>e(t)-n):(t=e===ua||e===da?e:pa,n=e,r=e),{left:i,center:function(e,t,n=0,o=e.length){const s=i(e,t,n,o-1);return s>n&&r(e[s-1],t)>-r(e[s],t)?s-1:s},right:function(e,r,i=0,o=e.length){if(i>>1;n(e[t],r)<=0?i=t+1:o=t}while(i=0))throw new RangeError("invalid r");let n=e.length;if(!((n=Math.floor(n))>=0))throw new RangeError("invalid length");if(!n||!t)return e;const r=Ta(t),i=e.slice();return r(e,i,0,n,1),r(i,e,0,n,1),r(e,i,0,n,1),e}const xa=ka(Ta),Sa=ka((function(e){const t=Ta(e);return(e,n,r,i,o)=>{t(e,n,0+(r<<=2),0+(i<<=2),o<<=2),t(e,n,r+1,i+1,o),t(e,n,r+2,i+2,o),t(e,n,r+3,i+3,o)}}));function ka(e){return function(t,n,r=n){if(!((n=+n)>=0))throw new RangeError("invalid rx");if(!((r=+r)>=0))throw new RangeError("invalid ry");let{data:i,width:o,height:s}=t;if(!((o=Math.floor(o))>=0))throw new RangeError("invalid width");if(!((s=Math.floor(void 0!==s?s:i.length/o))>=0))throw new RangeError("invalid height");if(!o||!s||!n&&!r)return t;const a=n&&e(n),l=r&&e(r),c=i.slice();return a&&l?(Ca(a,c,i,o,s),Ca(a,i,c,o,s),Ca(a,c,i,o,s),_a(l,i,c,o,s),_a(l,c,i,o,s),_a(l,i,c,o,s)):a?(Ca(a,i,c,o,s),Ca(a,c,i,o,s),Ca(a,i,c,o,s)):l&&(_a(l,i,c,o,s),_a(l,c,i,o,s),_a(l,i,c,o,s)),t}}function Ca(e,t,n,r,i){for(let o=0,s=r*i;o{if(!((o-=s)>=i))return;let a=e*r[i];const l=s*e;for(let e=i,t=i+l;e{if(!((s-=a)>=o))return;let l=t*i[o];const c=a*t,h=c+a;for(let e=o,t=o+c;e=t&&++n;else{let r=-1;for(let i of e)null!=(i=t(i,++r,e))&&(i=+i)>=i&&++n}return n}function Ea(e){return 0|e.length}function Ma(e){return!(e>0)}function Pa(e){return"object"!=typeof e||"length"in e?e:Array.from(e)}function Aa(...e){const t="function"==typeof e[e.length-1]&&function(e){return t=>e(...t)}(e.pop()),n=(e=e.map(Pa)).map(Ea),r=e.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(Ma))return o;for(;;){o.push(i.map(((t,n)=>e[n][t])));let s=r;for(;++i[s]===n[s];){if(0===s)return t?o.map(t):o;i[s--]=0}}}function $a(e,t){var n=0,r=0;return Float64Array.from(e,void 0===t?e=>n+=+e||0:i=>n+=+t(i,r++,e)||0)}function za(e,t){let n,r=0,i=0,o=0;if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(n=t-i,i+=n/++r,o+=n*(t-i));else{let s=-1;for(let a of e)null!=(a=t(a,++s,e))&&(a=+a)>=a&&(n=a-i,i+=n/++r,o+=n*(a-i))}if(r>1)return o/(r-1)}function Qa(e,t){const n=za(e,t);return n?Math.sqrt(n):n}function Ia(e,t){let n,r;if(void 0===t)for(const t of e)null!=t&&(void 0===n?t>=t&&(n=r=t):(n>t&&(n=t),r=o&&(n=r=o):(n>o&&(n=o),r0){for(o=e[--i];i>0&&(t=o,n=e[--i],o=t+n,r=n-(o-t),!r););i>0&&(r<0&&e[i-1]<0||r>0&&e[i-1]>0)&&(n=2*r,t=o+n,n==t-o&&(o=t))}return o}}function Da(e,t){const n=new Na;if(void 0===t)for(let t of e)(t=+t)&&n.add(t);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&n.add(i)}return+n}function Wa(e,t){const n=new Na;let r=-1;return Float64Array.from(e,void 0===t?e=>n.add(+e||0):i=>n.add(+t(i,++r,e)||0))}class La extends Map{constructor(e,t=Za){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(const[t,n]of e)this.set(t,n)}get(e){return super.get(Va(this,e))}has(e){return super.has(Va(this,e))}set(e,t){return super.set(Ba(this,e),t)}delete(e){return super.delete(ja(this,e))}}class Ha extends Set{constructor(e,t=Za){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(const t of e)this.add(t)}has(e){return super.has(Va(this,e))}add(e){return super.add(Ba(this,e))}delete(e){return super.delete(ja(this,e))}}function Va({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function Ba({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function ja({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function Za(e){return null!==e&&"object"==typeof e?e.valueOf():e}function Xa(e){return e}function Fa(e,...t){return rl(e,Xa,Xa,t)}function Ya(e,...t){return rl(e,Array.from,Xa,t)}function qa(e,t){for(let n=1,r=t.length;ne.pop().map((([t,n])=>[...e,t,n]))));return e}function Ua(e,...t){return qa(Ya(e,...t),t)}function Ga(e,t,...n){return qa(Ja(e,t,...n),n)}function Ka(e,t,...n){return rl(e,Xa,t,n)}function Ja(e,t,...n){return rl(e,Array.from,t,n)}function el(e,...t){return rl(e,Xa,nl,t)}function tl(e,...t){return rl(e,Array.from,nl,t)}function nl(e){if(1!==e.length)throw new Error("duplicate key");return e[0]}function rl(e,t,n,r){return function e(i,o){if(o>=r.length)return n(i);const s=new La,a=r[o++];let l=-1;for(const e of i){const t=a(e,++l,i),n=s.get(t);n?n.push(e):s.set(t,[e])}for(const[t,n]of s)s.set(t,e(n,o));return t(s)}(e,0)}function il(e,t){return Array.from(t,(t=>e[t]))}function ol(e,...t){if("function"!=typeof e[Symbol.iterator])throw new TypeError("values is not iterable");e=Array.from(e);let[n]=t;if(n&&2!==n.length||t.length>1){const r=Uint32Array.from(e,((e,t)=>t));return t.length>1?(t=t.map((t=>e.map(t))),r.sort(((e,n)=>{for(const r of t){const t=al(r[e],r[n]);if(t)return t}}))):(n=e.map(n),r.sort(((e,t)=>al(n[e],n[t])))),il(e,r)}return e.sort(sl(n))}function sl(e=ua){if(e===ua)return al;if("function"!=typeof e)throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||0===r?r:(0===e(n,n))-(0===e(t,t))}}function al(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(et?1:0)}function ll(e,t,n){return(2!==t.length?ol(Ka(e,t,n),(([e,t],[n,r])=>ua(t,r)||ua(e,n))):ol(Fa(e,n),(([e,n],[r,i])=>t(n,i)||ua(e,r)))).map((([e])=>e))}var cl=Array.prototype,hl=cl.slice;function ul(e){return()=>e}cl.map;const dl=Math.sqrt(50),fl=Math.sqrt(10),pl=Math.sqrt(2);function gl(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),s=o>=dl?10:o>=fl?5:o>=pl?2:1;let a,l,c;return i<0?(c=Math.pow(10,-i)/s,a=Math.round(e*c),l=Math.round(t*c),a/ct&&--l,c=-c):(c=Math.pow(10,i)*s,a=Math.round(e/c),l=Math.round(t/c),a*ct&&--l),l0))return[];if((e=+e)==(t=+t))return[e];const r=t=i))return[];const a=o-i+1,l=new Array(a);if(r)if(s<0)for(let e=0;e0?(e=Math.floor(e/i)*i,t=Math.ceil(t/i)*i):i<0&&(e=Math.ceil(e*i)/i,t=Math.floor(t*i)/i),r=i}}function Ol(e){return Math.max(1,Math.ceil(Math.log(Ra(e))/Math.LN2)+1)}function wl(){var e=Xa,t=Ia,n=Ol;function r(r){Array.isArray(r)||(r=Array.from(r));var i,o,s,a=r.length,l=new Array(a);for(i=0;i=u)if(e>=u&&t===Ia){const e=bl(h,u,n);isFinite(e)&&(e>0?u=(Math.floor(u/e)+1)*e:e<0&&(u=(Math.ceil(u*-e)+1)/-e))}else d.pop()}for(var f=d.length,p=0,g=f;d[p]<=h;)++p;for(;d[g-1]>u;)--g;(p||g0?d[i-1]:h,m.x1=i0)for(i=0;i=t)&&(n=t);else{let r=-1;for(let i of e)null!=(i=t(i,++r,e))&&(n=i)&&(n=i)}return n}function Sl(e,t){let n,r=-1,i=-1;if(void 0===t)for(const t of e)++i,null!=t&&(n=t)&&(n=t,r=i);else for(let o of e)null!=(o=t(o,++i,e))&&(n=o)&&(n=o,r=i);return r}function kl(e,t){let n;if(void 0===t)for(const t of e)null!=t&&(n>t||void 0===n&&t>=t)&&(n=t);else{let r=-1;for(let i of e)null!=(i=t(i,++r,e))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function Cl(e,t){let n,r=-1,i=-1;if(void 0===t)for(const t of e)++i,null!=t&&(n>t||void 0===n&&t>=t)&&(n=t,r=i);else for(let o of e)null!=(o=t(o,++i,e))&&(n>o||void 0===n&&o>=o)&&(n=o,r=i);return r}function _l(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=void 0===i?al:sl(i);r>n;){if(r-n>600){const o=r-n+1,s=t-n+1,a=Math.log(o),l=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);_l(e,t,Math.max(n,Math.floor(t-s*l/o+c)),Math.min(r,Math.floor(t+(o-s)*l/o+c)),i)}const o=e[t];let s=n,a=r;for(Tl(e,n,t),i(e[r],o)>0&&Tl(e,n,r);s0;)--a}0===i(e[n],o)?Tl(e,n,a):(++a,Tl(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function Tl(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Rl(e,t=ua){let n,r=!1;if(1===t.length){let i;for(const o of e){const e=t(o);(r?ua(e,i)>0:0===ua(e,e))&&(n=o,i=e,r=!0)}}else for(const i of e)(r?t(i,n)>0:0===t(i,i))&&(n=i,r=!0);return n}function El(e,t,n){if(e=Float64Array.from(function*(e,t){if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(yield t);else{let n=-1;for(let r of e)null!=(r=t(r,++n,e))&&(r=+r)>=r&&(yield r)}}(e,n)),(r=e.length)&&!isNaN(t=+t)){if(t<=0||r<2)return kl(e);if(t>=1)return xl(e);var r,i=(r-1)*t,o=Math.floor(i),s=xl(_l(e,o).subarray(0,o+1));return s+(kl(e.subarray(o+1))-s)*(i-o)}}function Ml(e,t,n=ga){if((r=e.length)&&!isNaN(t=+t)){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,o=Math.floor(i),s=+n(e[o],o,e);return s+(+n(e[o+1],o+1,e)-s)*(i-o)}}function Pl(e,t,n=ga){if(!isNaN(t=+t)){if(r=Float64Array.from(e,((t,r)=>ga(n(e[r],r,e)))),t<=0)return Cl(r);if(t>=1)return Sl(r);var r,i=Uint32Array.from(e,((e,t)=>t)),o=r.length-1,s=Math.floor(o*t);return _l(i,s,0,o,((e,t)=>al(r[e],r[t]))),(s=Rl(i.subarray(0,s+1),(e=>r[e])))>=0?s:-1}}function Al(e,t,n){const r=Ra(e),i=El(e,.75)-El(e,.25);return r&&i?Math.ceil((n-t)/(2*i*Math.pow(r,-1/3))):1}function $l(e,t,n){const r=Ra(e),i=Qa(e);return r&&i?Math.ceil((n-t)*Math.cbrt(r)/(3.49*i)):1}function zl(e,t){let n=0,r=0;if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(++n,r+=t);else{let i=-1;for(let o of e)null!=(o=t(o,++i,e))&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n}function Ql(e,t){return El(e,.5,t)}function Il(e,t){return Pl(e,.5,t)}function Nl(e){return Array.from(function*(e){for(const t of e)yield*t}(e))}function Dl(e,t){const n=new La;if(void 0===t)for(let t of e)null!=t&&t>=t&&n.set(t,(n.get(t)||0)+1);else{let r=-1;for(let i of e)null!=(i=t(i,++r,e))&&i>=i&&n.set(i,(n.get(i)||0)+1)}let r,i=0;for(const[e,t]of n)t>i&&(i=t,r=e);return r}function Wl(e,t=Ll){const n=[];let r,i=!1;for(const o of e)i&&n.push(t(r,o)),r=o,i=!0;return n}function Ll(e,t){return[e,t]}function Hl(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((t-e)/n)),o=new Array(i);++rt(n[e],n[r]);let o,s;return e=Uint32Array.from(n,((e,t)=>t)),e.sort(t===ua?(e,t)=>al(n[e],n[t]):sl(i)),e.forEach(((e,t)=>{const n=i(e,void 0===o?e:o);n>=0?((void 0===o||n>0)&&(o=e,s=t),r[e]=s):r[e]=NaN})),r}function Bl(e,t=ua){let n,r=!1;if(1===t.length){let i;for(const o of e){const e=t(o);(r?ua(e,i)<0:0===ua(e,e))&&(n=o,i=e,r=!0)}}else for(const i of e)(r?t(i,n)<0:0===t(i,i))&&(n=i,r=!0);return n}function jl(e,t=ua){if(1===t.length)return Cl(e,t);let n,r=-1,i=-1;for(const o of e)++i,(r<0?0===t(o,o):t(o,n)<0)&&(n=o,r=i);return r}function Zl(e,t=ua){if(1===t.length)return Sl(e,t);let n,r=-1,i=-1;for(const o of e)++i,(r<0?0===t(o,o):t(o,n)>0)&&(n=o,r=i);return r}function Xl(e,t){const n=jl(e,t);return n<0?void 0:n}const Fl=Yl(Math.random);function Yl(e){return function(t,n=0,r=t.length){let i=r-(n=+n);for(;i;){const r=e()*i--|0,o=t[i+n];t[i+n]=t[r+n],t[r+n]=o}return t}}function ql(e,t){let n=0;if(void 0===t)for(let t of e)(t=+t)&&(n+=t);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}function Ul(e){if(!(i=e.length))return[];for(var t=-1,n=kl(e,Gl),r=new Array(n);++tt(n,r,e)))}function rc(e,t,n){if("function"!=typeof t)throw new TypeError("reducer is not a function");const r=e[Symbol.iterator]();let i,o,s=-1;if(arguments.length<3){if(({done:i,value:n}=r.next()),i)return;++s}for(;({done:i,value:o}=r.next()),!i;)n=t(n,o,++s,e);return n}function ic(e){if("function"!=typeof e[Symbol.iterator])throw new TypeError("values is not iterable");return Array.from(e).reverse()}function oc(e,...t){e=new Ha(e);for(const n of t)for(const t of n)e.delete(t);return e}function sc(e,t){const n=t[Symbol.iterator](),r=new Ha;for(const t of e){if(r.has(t))return!1;let e,i;for(;({value:e,done:i}=n.next())&&!i;){if(Object.is(t,e))return!1;r.add(e)}}return!0}function ac(e,...t){e=new Ha(e),t=t.map(lc);e:for(const n of e)for(const r of t)if(!r.has(n)){e.delete(n);continue e}return e}function lc(e){return e instanceof Ha?e:new Ha(e)}function cc(e,t){const n=e[Symbol.iterator](),r=new Set;for(const e of t){const t=hc(e);if(r.has(t))continue;let i,o;for(;({value:i,done:o}=n.next());){if(o)return!1;const e=hc(i);if(r.add(e),Object.is(t,e))break}}return!0}function hc(e){return null!==e&&"object"==typeof e?e.valueOf():e}function uc(e,t){return cc(t,e)}function dc(...e){const t=new Ha;for(const n of e)for(const e of n)t.add(e);return t}function fc(e){return e}var pc=1,gc=2,mc=3,bc=4,vc=1e-6;function yc(e){return"translate("+e+",0)"}function Oc(e){return"translate(0,"+e+")"}function wc(e){return t=>+e(t)}function xc(e,t){return t=Math.max(0,e.bandwidth()-2*t)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function Sc(){return!this.__axis}function kc(e,t){var n=[],r=null,i=null,o=6,s=6,a=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,c=e===pc||e===bc?-1:1,h=e===bc||e===gc?"x":"y",u=e===pc||e===mc?yc:Oc;function d(d){var f=null==r?t.ticks?t.ticks.apply(t,n):t.domain():r,p=null==i?t.tickFormat?t.tickFormat.apply(t,n):fc:i,g=Math.max(o,0)+a,m=t.range(),b=+m[0]+l,v=+m[m.length-1]+l,y=(t.bandwidth?xc:wc)(t.copy(),l),O=d.selection?d.selection():d,w=O.selectAll(".domain").data([null]),x=O.selectAll(".tick").data(f,t).order(),S=x.exit(),k=x.enter().append("g").attr("class","tick"),C=x.select("line"),_=x.select("text");w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),x=x.merge(k),C=C.merge(k.append("line").attr("stroke","currentColor").attr(h+"2",c*o)),_=_.merge(k.append("text").attr("fill","currentColor").attr(h,c*g).attr("dy",e===pc?"0em":e===mc?"0.71em":"0.32em")),d!==O&&(w=w.transition(d),x=x.transition(d),C=C.transition(d),_=_.transition(d),S=S.transition(d).attr("opacity",vc).attr("transform",(function(e){return isFinite(e=y(e))?u(e+l):this.getAttribute("transform")})),k.attr("opacity",vc).attr("transform",(function(e){var t=this.parentNode.__axis;return u((t&&isFinite(t=t(e))?t:y(e))+l)}))),S.remove(),w.attr("d",e===bc||e===gc?s?"M"+c*s+","+b+"H"+l+"V"+v+"H"+c*s:"M"+l+","+b+"V"+v:s?"M"+b+","+c*s+"V"+l+"H"+v+"V"+c*s:"M"+b+","+l+"H"+v),x.attr("opacity",1).attr("transform",(function(e){return u(y(e)+l)})),C.attr(h+"2",c*o),_.attr(h,c*g).text(p),O.filter(Sc).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===gc?"start":e===bc?"end":"middle"),O.each((function(){this.__axis=y}))}return d.scale=function(e){return arguments.length?(t=e,d):t},d.ticks=function(){return n=Array.from(arguments),d},d.tickArguments=function(e){return arguments.length?(n=null==e?[]:Array.from(e),d):n.slice()},d.tickValues=function(e){return arguments.length?(r=null==e?null:Array.from(e),d):r&&r.slice()},d.tickFormat=function(e){return arguments.length?(i=e,d):i},d.tickSize=function(e){return arguments.length?(o=s=+e,d):o},d.tickSizeInner=function(e){return arguments.length?(o=+e,d):o},d.tickSizeOuter=function(e){return arguments.length?(s=+e,d):s},d.tickPadding=function(e){return arguments.length?(a=+e,d):a},d.offset=function(e){return arguments.length?(l=+e,d):l},d}function Cc(e){return kc(pc,e)}function _c(e){return kc(gc,e)}function Tc(e){return kc(mc,e)}function Rc(e){return kc(bc,e)}var Ec={value:()=>{}};function Mc(){for(var e,t=0,n=arguments.length,r={};t=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}}))}(e+"",r),o=-1,s=i.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++o0)for(var n,r,i=new Array(n),o=0;ot?1:e>=t?0:NaN}Fc.prototype={constructor:Fc,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};var Jc="http://www.w3.org/1999/xhtml";const eh={svg:"http://www.w3.org/2000/svg",xhtml:Jc,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function th(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),eh.hasOwnProperty(t)?{space:eh[t],local:e}:e}function nh(e){return function(){this.removeAttribute(e)}}function rh(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ih(e,t){return function(){this.setAttribute(e,t)}}function oh(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function sh(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function ah(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function lh(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ch(e){return function(){this.style.removeProperty(e)}}function hh(e,t,n){return function(){this.style.setProperty(e,t,n)}}function uh(e,t,n){return function(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function dh(e,t){return e.style.getPropertyValue(t)||lh(e).getComputedStyle(e,null).getPropertyValue(t)}function fh(e){return function(){delete this[e]}}function ph(e,t){return function(){this[e]=t}}function gh(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function mh(e){return e.trim().split(/^|\s+/)}function bh(e){return e.classList||new vh(e)}function vh(e){this._node=e,this._names=mh(e.getAttribute("class")||"")}function yh(e,t){for(var n=bh(e),r=-1,i=t.length;++r=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var jh=[null];function Zh(e,t){this._groups=e,this._parents=t}function Xh(){return new Zh([[document.documentElement]],jh)}Zh.prototype=Xh.prototype={constructor:Zh,select:function(e){"function"!=typeof e&&(e=Ic(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=w&&(w=O+1);!(y=b[w])&&++w=0;)(r=i[o])&&(s&&4^r.compareDocumentPosition(s)&&s.parentNode.insertBefore(r,s),s=r);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=Kc);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o1?this.each((null==t?ch:"function"==typeof t?uh:hh)(e,t,null==n?"":n)):dh(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?fh:"function"==typeof t?gh:ph)(e,t)):this.node()[e]},classed:function(e,t){var n=mh(e+"");if(arguments.length<2){for(var r=bh(this.node()),i=-1,o=n.length;++i=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}}))}(e+""),s=o.length;if(!(arguments.length<2)){for(a=t?Lh:Wh,r=0;r>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?wu(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?wu(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=hu.exec(e))?new ku(t[1],t[2],t[3],1):(t=uu.exec(e))?new ku(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=du.exec(e))?wu(t[1],t[2],t[3],t[4]):(t=fu.exec(e))?wu(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=pu.exec(e))?Mu(t[1],t[2]/100,t[3]/100,1):(t=gu.exec(e))?Mu(t[1],t[2]/100,t[3]/100,t[4]):mu.hasOwnProperty(e)?Ou(mu[e]):"transparent"===e?new ku(NaN,NaN,NaN,0):null}function Ou(e){return new ku(e>>16&255,e>>8&255,255&e,1)}function wu(e,t,n,r){return r<=0&&(e=t=n=NaN),new ku(e,t,n,r)}function xu(e){return e instanceof ru||(e=yu(e)),e?new ku((e=e.rgb()).r,e.g,e.b,e.opacity):new ku}function Su(e,t,n,r){return 1===arguments.length?xu(e):new ku(e,t,n,null==r?1:r)}function ku(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Cu(){return`#${Eu(this.r)}${Eu(this.g)}${Eu(this.b)}`}function _u(){const e=Tu(this.opacity);return`${1===e?"rgb(":"rgba("}${Ru(this.r)}, ${Ru(this.g)}, ${Ru(this.b)}${1===e?")":`, ${e})`}`}function Tu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ru(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Eu(e){return((e=Ru(e))<16?"0":"")+e.toString(16)}function Mu(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new $u(e,t,n,r)}function Pu(e){if(e instanceof $u)return new $u(e.h,e.s,e.l,e.opacity);if(e instanceof ru||(e=yu(e)),!e)return new $u;if(e instanceof $u)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,l=(o+i)/2;return a?(s=t===o?(n-r)/a+6*(n0&&l<1?0:s,new $u(s,a,l,e.opacity)}function Au(e,t,n,r){return 1===arguments.length?Pu(e):new $u(e,t,n,null==r?1:r)}function $u(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function zu(e){return(e=(e||0)%360)<0?e+360:e}function Qu(e){return Math.max(0,Math.min(1,e||0))}function Iu(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function Nu(e,t,n,r,i){var o=e*e,s=o*e;return((1-3*e+3*o-s)*t+(4-6*o+3*s)*n+(1+3*e+3*o-3*s)*r+s*i)/6}function Du(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],o=e[r+1],s=r>0?e[r-1]:2*i-o,a=r=240?e-240:e+120,i,r),Iu(e,i,r),Iu(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new $u(zu(this.h),Qu(this.s),Qu(this.l),Tu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Tu(this.opacity);return`${1===e?"hsl(":"hsla("}${zu(this.h)}, ${100*Qu(this.s)}%, ${100*Qu(this.l)}%${1===e?")":`, ${e})`}`}}));const Lu=e=>()=>e;function Hu(e,t){return function(n){return e+n*t}}function Vu(e,t){var n=t-e;return n?Hu(e,n>180||n<-180?n-360*Math.round(n/360):n):Lu(isNaN(e)?t:e)}function Bu(e,t){var n=t-e;return n?Hu(e,n):Lu(isNaN(e)?t:e)}const ju=function e(t){var n=function(e){return 1==(e=+e)?Bu:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):Lu(isNaN(t)?n:t)}}(t);function r(e,t){var r=n((e=Su(e)).r,(t=Su(t)).r),i=n(e.g,t.g),o=n(e.b,t.b),s=Bu(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=o(t),e.opacity=s(t),e+""}}return r.gamma=e,r}(1);function Zu(e){return function(t){var n,r,i=t.length,o=new Array(i),s=new Array(i),a=new Array(i);for(n=0;no&&(i=t.slice(o,i),a[s]?a[s]+=i:a[++s]=i),(n=n[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,l.push({i:s,x:Ju(n,r)})),o=nd.lastIndex;return o=0&&t._call.call(void 0,e),t=t._next;--cd}function Sd(){pd=(fd=md.now())+gd,cd=hd=0;try{xd()}finally{cd=0,function(){for(var e,t,n=ad,r=1/0;n;)n._call?(r>n._time&&(r=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:ad=t);ld=e,Cd(r)}(),pd=0}}function kd(){var e=md.now(),t=e-fd;t>dd&&(gd-=t,fd=e)}function Cd(e){cd||(hd&&(hd=clearTimeout(hd)),e-pd>24?(e<1/0&&(hd=setTimeout(Sd,e-md.now()-gd)),ud&&(ud=clearInterval(ud))):(ud||(fd=md.now(),ud=setInterval(kd,dd)),cd=1,bd(Sd)))}function _d(e,t,n){var r=new Od;return t=null==t?0:+t,r.restart((n=>{r.stop(),e(n+t)}),t,n),r}Od.prototype=wd.prototype={constructor:Od,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?vd():+n)+(null==t?0:+t),this._next||ld===this||(ld?ld._next=this:ad=this,ld=this),this._call=e,this._time=n,Cd()},stop:function(){this._call&&(this._call=null,this._time=1/0,Cd())}};var Td=zc("start","end","cancel","interrupt"),Rd=[],Ed=0,Md=1,Pd=2,Ad=3,$d=5,zd=6;function Qd(e,t,n,r,i,o){var s=e.__transition;if(s){if(n in s)return}else e.__transition={};!function(e,t,n){var r,i=e.__transition;function o(l){var c,h,u,d;if(n.state!==Md)return a();for(c in i)if((d=i[c]).name===n.name){if(d.state===Ad)return _d(o);4===d.state?(d.state=zd,d.timer.stop(),d.on.call("interrupt",e,e.__data__,d.index,d.group),delete i[c]):+cEd)throw new Error("too late; already scheduled");return n}function Nd(e,t){var n=Dd(e,t);if(n.state>Ad)throw new Error("too late; already running");return n}function Dd(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Wd(e,t){var n,r,i,o=e.__transition,s=!0;if(o){for(i in t=null==t?null:t+"",o)(n=o[i]).name===t?(r=n.state>Pd&&n.state<$d,n.state=zd,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete o[i]):s=!1;s&&delete e.__transition}}var Ld,Hd=180/Math.PI,Vd={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Bd(e,t,n,r,i,o){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*r)&&(n-=e*l,r-=t*l),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,l/=a),e*r180?t+=360:t-e>180&&(e+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Ju(e,t)})):t&&n.push(i(n)+"rotate("+t+r)}(o.rotate,s.rotate,a,l),function(e,t,n,o){e!==t?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Ju(e,t)}):t&&n.push(i(n)+"skewX("+t+r)}(o.skewX,s.skewX,a,l),function(e,t,n,r,o,s){if(e!==n||t!==r){var a=o.push(i(o)+"scale(",null,",",null,")");s.push({i:a-4,x:Ju(e,n)},{i:a-2,x:Ju(t,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,s.scaleX,s.scaleY,a,l),o=s=null,function(e){for(var t,n=-1,r=l.length;++n=0&&(e=e.slice(0,t)),!e||"start"===e}))}(t)?Id:Nd;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}(n,e,t))},attr:function(e,t){var n=th(e),r="transform"===n?Xd:Ud;return this.attrTween(e,"function"==typeof t?(n.local?nf:tf)(n,r,qd(this,"attr."+e,t)):null==t?(n.local?Kd:Gd)(n):(n.local?ef:Jd)(n,r,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var r=th(e);return this.tween(n,(r.local?rf:of)(r,t))},style:function(e,t,n){var r="transform"==(e+="")?Zd:Ud;return null==t?this.styleTween(e,function(e,t){var n,r,i;return function(){var o=dh(this,e),s=(this.style.removeProperty(e),dh(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}(e,r)).on("end.style."+e,uf(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var r,i,o;return function(){var s=dh(this,e),a=n(this),l=a+"";return null==a&&(this.style.removeProperty(e),l=a=dh(this,e)),s===l?null:s===r&&l===i?o:(i=l,o=t(r=s,a))}}(e,r,qd(this,"style."+e,t))).each(function(e,t){var n,r,i,o,s="style."+t,a="end."+s;return function(){var l=Nd(this,e),c=l.on,h=null==l.value[s]?o||(o=uf(t)):void 0;c===n&&i===h||(r=(n=c).copy()).on(a,i=h),l.on=r}}(this._id,e)):this.styleTween(e,function(e,t,n){var r,i,o=n+"";return function(){var s=dh(this,e);return s===o?null:s===r?i:i=t(r=s,n)}}(e,r,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw new Error;return this.tween(r,function(e,t,n){var r,i;function o(){var o=t.apply(this,arguments);return o!==i&&(r=(i=o)&&function(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}(e,o,n)),r}return o._value=t,o}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(qd(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&function(e){return function(t){this.textContent=e.call(this,t)}}(r)),t}return r._value=e,r}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r,i=Dd(this.node(),n).tween,o=0,s=i.length;oMd&&n.name===t)return new ff([[e]],xf,t,+r);return null}const kf=e=>()=>e;function Cf(e,{sourceEvent:t,target:n,selection:r,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function _f(e){e.preventDefault(),e.stopImmediatePropagation()}var Tf={name:"drag"},Rf={name:"space"},Ef={name:"handle"},Mf={name:"center"};const{abs:Pf,max:Af,min:$f}=Math;function zf(e){return[+e[0],+e[1]]}function Qf(e){return[zf(e[0]),zf(e[1])]}var If={name:"x",handles:["w","e"].map(jf),input:function(e,t){return null==e?null:[[+e[0],t[0][1]],[+e[1],t[1][1]]]},output:function(e){return e&&[e[0][0],e[1][0]]}},Nf={name:"y",handles:["n","s"].map(jf),input:function(e,t){return null==e?null:[[t[0][0],+e[0]],[t[1][0],+e[1]]]},output:function(e){return e&&[e[0][1],e[1][1]]}},Df={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(jf),input:function(e){return null==e?null:Qf(e)},output:function(e){return e}},Wf={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Lf={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},Hf={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},Vf={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},Bf={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function jf(e){return{type:e}}function Zf(e){return!e.ctrlKey&&!e.button}function Xf(){var e=this.ownerSVGElement||this;return e.hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]}function Ff(){return navigator.maxTouchPoints||"ontouchstart"in this}function Yf(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function qf(e){var t=e.__brush;return t?t.dim.output(t.selection):null}function Uf(){return Jf(If)}function Gf(){return Jf(Nf)}function Kf(){return Jf(Df)}function Jf(e){var t,n=Xf,r=Zf,i=Ff,o=!0,s=zc("start","brush","end"),a=6;function l(t){var n=t.property("__brush",g).selectAll(".overlay").data([jf("overlay")]);n.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Wf.overlay).merge(n).each((function(){var e=Yf(this).extent;Yh(this).attr("x",e[0][0]).attr("y",e[0][1]).attr("width",e[1][0]-e[0][0]).attr("height",e[1][1]-e[0][1])})),t.selectAll(".selection").data([jf("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Wf.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var r=t.selectAll(".handle").data(e.handles,(function(e){return e.type}));r.exit().remove(),r.enter().append("rect").attr("class",(function(e){return"handle handle--"+e.type})).attr("cursor",(function(e){return Wf[e.type]})),t.each(c).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",d).filter(i).on("touchstart.brush",d).on("touchmove.brush",f).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function c(){var e=Yh(this),t=Yf(this).selection;t?(e.selectAll(".selection").style("display",null).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1]),e.selectAll(".handle").style("display",null).attr("x",(function(e){return"e"===e.type[e.type.length-1]?t[1][0]-a/2:t[0][0]-a/2})).attr("y",(function(e){return"s"===e.type[0]?t[1][1]-a/2:t[0][1]-a/2})).attr("width",(function(e){return"n"===e.type||"s"===e.type?t[1][0]-t[0][0]+a:a})).attr("height",(function(e){return"e"===e.type||"w"===e.type?t[1][1]-t[0][1]+a:a}))):e.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function h(e,t,n){var r=e.__brush.emitter;return!r||n&&r.clean?new u(e,t,n):r}function u(e,t,n){this.that=e,this.args=t,this.state=e.__brush,this.active=0,this.clean=n}function d(n){if((!t||n.touches)&&r.apply(this,arguments)){var i,s,a,l,u,d,f,p,g,m,b,v=this,y=n.target.__data__.type,O="selection"===(o&&n.metaKey?y="overlay":y)?Tf:o&&n.altKey?Mf:Ef,w=e===Nf?null:Vf[y],x=e===If?null:Bf[y],S=Yf(v),k=S.extent,C=S.selection,_=k[0][0],T=k[0][1],R=k[1][0],E=k[1][1],M=0,P=0,A=w&&x&&o&&n.shiftKey,$=Array.from(n.touches||[n],(e=>{const t=e.identifier;return(e=sd(e,v)).point0=e.slice(),e.identifier=t,e}));Wd(v);var z=h(v,arguments,!0).beforestart();if("overlay"===y){C&&(g=!0);const t=[$[0],$[1]||$[0]];S.selection=C=[[i=e===Nf?_:$f(t[0][0],t[1][0]),a=e===If?T:$f(t[0][1],t[1][1])],[u=e===Nf?R:Af(t[0][0],t[1][0]),f=e===If?E:Af(t[0][1],t[1][1])]],$.length>1&&W(n)}else i=C[0][0],a=C[0][1],u=C[1][0],f=C[1][1];s=i,l=a,d=u,p=f;var Q=Yh(v).attr("pointer-events","none"),I=Q.selectAll(".overlay").attr("cursor",Wf[y]);if(n.touches)z.moved=D,z.ended=L;else{var N=Yh(n.view).on("mousemove.brush",D,!0).on("mouseup.brush",L,!0);o&&N.on("keydown.brush",(function(e){switch(e.keyCode){case 16:A=w&&x;break;case 18:O===Ef&&(w&&(u=d-M*w,i=s+M*w),x&&(f=p-P*x,a=l+P*x),O=Mf,W(e));break;case 32:O!==Ef&&O!==Mf||(w<0?u=d-M:w>0&&(i=s-M),x<0?f=p-P:x>0&&(a=l-P),O=Rf,I.attr("cursor",Wf.selection),W(e));break;default:return}_f(e)}),!0).on("keyup.brush",(function(e){switch(e.keyCode){case 16:A&&(m=b=A=!1,W(e));break;case 18:O===Mf&&(w<0?u=d:w>0&&(i=s),x<0?f=p:x>0&&(a=l),O=Ef,W(e));break;case 32:O===Rf&&(e.altKey?(w&&(u=d-M*w,i=s+M*w),x&&(f=p-P*x,a=l+P*x),O=Mf):(w<0?u=d:w>0&&(i=s),x<0?f=p:x>0&&(a=l),O=Ef),I.attr("cursor",Wf[y]),W(e));break;default:return}_f(e)}),!0),Jh(n.view)}c.call(v),z.start(n,O.name)}function D(e){for(const t of e.changedTouches||[e])for(const e of $)e.identifier===t.identifier&&(e.cur=sd(t,v));if(A&&!m&&!b&&1===$.length){const e=$[0];Pf(e.cur[0]-e[0])>Pf(e.cur[1]-e[1])?b=!0:m=!0}for(const e of $)e.cur&&(e[0]=e.cur[0],e[1]=e.cur[1]);g=!0,_f(e),W(e)}function W(e){const t=$[0],n=t.point0;var r;switch(M=t[0]-n[0],P=t[1]-n[1],O){case Rf:case Tf:w&&(M=Af(_-i,$f(R-u,M)),s=i+M,d=u+M),x&&(P=Af(T-a,$f(E-f,P)),l=a+P,p=f+P);break;case Ef:$[1]?(w&&(s=Af(_,$f(R,$[0][0])),d=Af(_,$f(R,$[1][0])),w=1),x&&(l=Af(T,$f(E,$[0][1])),p=Af(T,$f(E,$[1][1])),x=1)):(w<0?(M=Af(_-i,$f(R-i,M)),s=i+M,d=u):w>0&&(M=Af(_-u,$f(R-u,M)),s=i,d=u+M),x<0?(P=Af(T-a,$f(E-a,P)),l=a+P,p=f):x>0&&(P=Af(T-f,$f(E-f,P)),l=a,p=f+P));break;case Mf:w&&(s=Af(_,$f(R,i-M*w)),d=Af(_,$f(R,u+M*w))),x&&(l=Af(T,$f(E,a-P*x)),p=Af(T,$f(E,f+P*x)))}de+n))}function cp(){return dp(!1,!1)}function hp(){return dp(!1,!0)}function up(){return dp(!0,!1)}function dp(e,t){var n=0,r=null,i=null,o=null;function s(s){var a,l=s.length,c=new Array(l),h=lp(0,l),u=new Array(l*l),d=new Array(l),f=0;s=Float64Array.from({length:l*l},t?(e,t)=>s[t%l][t/l|0]:(e,t)=>s[t/l|0][t%l]);for(let t=0;tr(c[e],c[t])));for(const n of h){const r=t;if(e){const e=lp(1+~l,l).filter((e=>e<0?s[~e*l+n]:s[n*l+e]));i&&e.sort(((e,t)=>i(e<0?-s[~e*l+n]:s[n*l+e],t<0?-s[~t*l+n]:s[n*l+t])));for(const r of e)r<0?(u[~r*l+n]||(u[~r*l+n]={source:null,target:null})).target={index:n,startAngle:t,endAngle:t+=s[~r*l+n]*f,value:s[~r*l+n]}:(u[n*l+r]||(u[n*l+r]={source:null,target:null})).source={index:n,startAngle:t,endAngle:t+=s[n*l+r]*f,value:s[n*l+r]};d[n]={index:n,startAngle:r,endAngle:t,value:c[n]}}else{const e=lp(0,l).filter((e=>s[n*l+e]||s[e*l+n]));i&&e.sort(((e,t)=>i(s[n*l+e],s[n*l+t])));for(const r of e){let e;if(n=0))throw new Error(`invalid digits: ${e}`);if(t>15)return bp;const n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tgp)if(Math.abs(h*a-l*c)>gp&&i){let d=n-o,f=r-s,p=a*a+l*l,g=d*d+f*f,m=Math.sqrt(p),b=Math.sqrt(u),v=i*Math.tan((fp-Math.acos((p+u-g)/(2*m*b)))/2),y=v/b,O=v/m;Math.abs(y-1)>gp&&this._append`L${e+y*c},${t+y*h}`,this._append`A${i},${i},0,0,${+(h*d>c*f)},${this._x1=e+O*a},${this._y1=t+O*l}`}else this._append`L${this._x1=e},${this._y1=t}`}arc(e,t,n,r,i,o){if(e=+e,t=+t,o=!!o,(n=+n)<0)throw new Error(`negative radius: ${n}`);let s=n*Math.cos(r),a=n*Math.sin(r),l=e+s,c=t+a,h=1^o,u=o?r-i:i-r;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>gp||Math.abs(this._y1-c)>gp)&&this._append`L${l},${c}`,n&&(u<0&&(u=u%pp+pp),u>mp?this._append`A${n},${n},0,1,${h},${e-s},${t-a}A${n},${n},0,1,${h},${this._x1=l},${this._y1=c}`:u>gp&&this._append`A${n},${n},0,${+(u>=fp)},${h},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}}function yp(){return new vp}function Op(e=3){return new vp(+e)}yp.prototype=vp.prototype;var wp=Array.prototype.slice;function xp(e){return function(){return e}}function Sp(e){return e.source}function kp(e){return e.target}function Cp(e){return e.radius}function _p(e){return e.startAngle}function Tp(e){return e.endAngle}function Rp(){return 0}function Ep(){return 10}function Mp(e){var t=Sp,n=kp,r=Cp,i=Cp,o=_p,s=Tp,a=Rp,l=null;function c(){var c,h=t.apply(this,arguments),u=n.apply(this,arguments),d=a.apply(this,arguments)/2,f=wp.call(arguments),p=+r.apply(this,(f[0]=h,f)),g=o.apply(this,f)-ip,m=s.apply(this,f)-ip,b=+i.apply(this,(f[0]=u,f)),v=o.apply(this,f)-ip,y=s.apply(this,f)-ip;if(l||(l=c=yp()),d>ap&&(ep(m-g)>2*d+ap?m>g?(g+=d,m-=d):(g-=d,m+=d):g=m=(g+m)/2,ep(y-v)>2*d+ap?y>v?(v+=d,y-=d):(v-=d,y+=d):v=y=(v+y)/2),l.moveTo(p*tp(g),p*np(g)),l.arc(0,0,p,g,m),g!==v||m!==y)if(e){var O=b-+e.apply(this,arguments),w=(v+y)/2;l.quadraticCurveTo(0,0,O*tp(v),O*np(v)),l.lineTo(b*tp(w),b*np(w)),l.lineTo(O*tp(y),O*np(y))}else l.quadraticCurveTo(0,0,b*tp(v),b*np(v)),l.arc(0,0,b,v,y);if(l.quadraticCurveTo(0,0,p*tp(g),p*np(g)),l.closePath(),c)return l=null,c+""||null}return e&&(c.headRadius=function(t){return arguments.length?(e="function"==typeof t?t:xp(+t),c):e}),c.radius=function(e){return arguments.length?(r=i="function"==typeof e?e:xp(+e),c):r},c.sourceRadius=function(e){return arguments.length?(r="function"==typeof e?e:xp(+e),c):r},c.targetRadius=function(e){return arguments.length?(i="function"==typeof e?e:xp(+e),c):i},c.startAngle=function(e){return arguments.length?(o="function"==typeof e?e:xp(+e),c):o},c.endAngle=function(e){return arguments.length?(s="function"==typeof e?e:xp(+e),c):s},c.padAngle=function(e){return arguments.length?(a="function"==typeof e?e:xp(+e),c):a},c.source=function(e){return arguments.length?(t=e,c):t},c.target=function(e){return arguments.length?(n=e,c):n},c.context=function(e){return arguments.length?(l=null==e?null:e,c):l},c}function Pp(){return Mp()}function Ap(){return Mp(Ep)}const $p=Math.PI/180,zp=180/Math.PI,Qp=.96422,Ip=1,Np=.82521,Dp=4/29,Wp=6/29,Lp=3*Wp*Wp,Hp=Wp*Wp*Wp;function Vp(e){if(e instanceof Zp)return new Zp(e.l,e.a,e.b,e.opacity);if(e instanceof Jp)return eg(e);e instanceof ku||(e=xu(e));var t,n,r=qp(e.r),i=qp(e.g),o=qp(e.b),s=Xp((.2225045*r+.7168786*i+.0606169*o)/Ip);return r===i&&i===o?t=n=s:(t=Xp((.4360747*r+.3850649*i+.1430804*o)/Qp),n=Xp((.0139322*r+.0971045*i+.7141733*o)/Np)),new Zp(116*s-16,500*(t-s),200*(s-n),e.opacity)}function Bp(e,t){return new Zp(e,0,0,null==t?1:t)}function jp(e,t,n,r){return 1===arguments.length?Vp(e):new Zp(e,t,n,null==r?1:r)}function Zp(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}function Xp(e){return e>Hp?Math.pow(e,1/3):e/Lp+Dp}function Fp(e){return e>Wp?e*e*e:Lp*(e-Dp)}function Yp(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function qp(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Up(e){if(e instanceof Jp)return new Jp(e.h,e.c,e.l,e.opacity);if(e instanceof Zp||(e=Vp(e)),0===e.a&&0===e.b)return new Jp(NaN,0()=>e;function pg(e,t){for(var n,r=-1,i=t.length;++rr!=f>r&&n<(d-c)*(r-h)/(f-h)+c&&(i=-i)}return i}function mg(e,t,n){var r;return function(e,t,n){return(t[0]-e[0])*(n[1]-e[1])==(n[0]-e[0])*(t[1]-e[1])}(e,t,n)&&function(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}(e[r=+(e[0]===t[0])],n[r],t[r])}function bg(){}var vg=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function yg(){var e=1,t=1,n=Ol,r=a;function i(e){var t=n(e);if(Array.isArray(t))t=t.slice().sort(dg);else{const n=Ia(e,Og);for(t=ml(...yl(n[0],n[1],t),t);t[t.length-1]>=n[1];)t.pop();for(;t[1]o(e,t)))}function o(n,i){const o=null==i?NaN:+i;if(isNaN(o))throw new Error(`invalid value: ${i}`);var a=[],l=[];return function(n,r,i){var o,a,l,c,h,u,d=new Array,f=new Array;for(o=a=-1,c=wg(n[0],r),vg[c<<1].forEach(p);++o=r,vg[h<<2].forEach(p);++o0?a.push([e]):l.push(e)})),l.forEach((function(e){for(var t,n=0,r=a.length;n0&&o0&&s=0&&o>=0))throw new Error("invalid size");return e=r,t=o,i},i.thresholds=function(e){return arguments.length?(n="function"==typeof e?e:Array.isArray(e)?fg(ug.call(e)):fg(e),i):n},i.smooth=function(e){return arguments.length?(r=e?a:bg,i):r===a},i}function Og(e){return isFinite(e)?e:NaN}function wg(e,t){return null!=e&&+e>=t}function xg(e){return null==e||isNaN(e=+e)?-1/0:e}function Sg(e,t,n,r){const i=r-t,o=n-t,s=isFinite(i)||isFinite(o)?i/o:Math.sign(i)/Math.sign(o);return isNaN(s)?e:e+s-.5}function kg(e){return e[0]}function Cg(e){return e[1]}function _g(){return 1}function Tg(){var e=kg,t=Cg,n=_g,r=960,i=500,o=20,s=2,a=3*o,l=r+2*a>>s,c=i+2*a>>s,h=fg(20);function u(r){var i=new Float32Array(l*c),h=Math.pow(2,-s),u=-1;for(const o of r){var d=(e(o,++u,r)+a)*h,f=(t(o,u,r)+a)*h,p=+n(o,u,r);if(p&&d>=0&&d=0&&fe*r)))(t).map(((e,t)=>(e.value=+n[t],f(e))))}function f(e){return e.coordinates.forEach(p),e}function p(e){e.forEach(g)}function g(e){e.forEach(m)}function m(e){e[0]=e[0]*Math.pow(2,s)-a,e[1]=e[1]*Math.pow(2,s)-a}function b(){return l=r+2*(a=3*o)>>s,c=i+2*a>>s,d}return d.contours=function(e){var t=u(e),n=yg().size([l,c]),r=Math.pow(2,2*s),i=e=>{e=+e;var i=f(n.contour(t,e*r));return i.value=e,i};return Object.defineProperty(i,"max",{get:()=>xl(t)/r}),i},d.x=function(t){return arguments.length?(e="function"==typeof t?t:fg(+t),d):e},d.y=function(e){return arguments.length?(t="function"==typeof e?e:fg(+e),d):t},d.weight=function(e){return arguments.length?(n="function"==typeof e?e:fg(+e),d):n},d.size=function(e){if(!arguments.length)return[r,i];var t=+e[0],n=+e[1];if(!(t>=0&&n>=0))throw new Error("invalid size");return r=t,i=n,b()},d.cellSize=function(e){if(!arguments.length)return 1<=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(e)/Math.LN2),b()},d.thresholds=function(e){return arguments.length?(h="function"==typeof e?e:Array.isArray(e)?fg(ug.call(e)):fg(e),d):h},d.bandwidth=function(e){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((e=+e)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*e*e+1)-1)/2,b()},d}const Rg=134217729;function Eg(e,t,n,r,i){let o,s,a,l,c=t[0],h=r[0],u=0,d=0;h>c==h>-c?(o=c,c=t[++u]):(o=h,h=r[++d]);let f=0;if(uc==h>-c?(s=c+o,a=o-(s-c),c=t[++u]):(s=h+o,a=o-(s-h),h=r[++d]),o=s,0!==a&&(i[f++]=a);uc==h>-c?(s=o+c,l=s-o,a=o-(s-l)+(c-l),c=t[++u]):(s=o+h,l=s-o,a=o-(s-l)+(h-l),h=r[++d]),o=s,0!==a&&(i[f++]=a);for(;u=33306690738754716e-32*c?l:-function(e,t,n,r,i,o,s){let a,l,c,h,u,d,f,p,g,m,b,v,y,O,w,x,S,k;const C=e-i,_=n-i,T=t-o,R=r-o;O=C*R,d=Rg*C,f=d-(d-C),p=C-f,d=Rg*R,g=d-(d-R),m=R-g,w=p*m-(O-f*g-p*g-f*m),x=T*_,d=Rg*T,f=d-(d-T),p=T-f,d=Rg*_,g=d-(d-_),m=_-g,S=p*m-(x-f*g-p*g-f*m),b=w-S,u=w-b,Pg[0]=w-(b+u)+(u-S),v=O+b,u=v-O,y=O-(v-u)+(b-u),b=y-x,u=y-b,Pg[1]=y-(b+u)+(u-x),k=v+b,u=k-v,Pg[2]=v-(k-u)+(b-u),Pg[3]=k;let E=function(e,t){let n=t[0];for(let e=1;e<4;e++)n+=t[e];return n}(0,Pg),M=22204460492503146e-32*s;if(E>=M||-E>=M)return E;if(u=e-C,a=e-(C+u)+(u-i),u=n-_,c=n-(_+u)+(u-i),u=t-T,l=t-(T+u)+(u-o),u=r-R,h=r-(R+u)+(u-o),0===a&&0===l&&0===c&&0===h)return E;if(M=11093356479670487e-47*s+33306690738754706e-32*Math.abs(E),E+=C*h+R*a-(T*c+_*l),E>=M||-E>=M)return E;O=a*R,d=Rg*a,f=d-(d-a),p=a-f,d=Rg*R,g=d-(d-R),m=R-g,w=p*m-(O-f*g-p*g-f*m),x=l*_,d=Rg*l,f=d-(d-l),p=l-f,d=Rg*_,g=d-(d-_),m=_-g,S=p*m-(x-f*g-p*g-f*m),b=w-S,u=w-b,Qg[0]=w-(b+u)+(u-S),v=O+b,u=v-O,y=O-(v-u)+(b-u),b=y-x,u=y-b,Qg[1]=y-(b+u)+(u-x),k=v+b,u=k-v,Qg[2]=v-(k-u)+(b-u),Qg[3]=k;const P=Eg(4,Pg,4,Qg,Ag);O=C*h,d=Rg*C,f=d-(d-C),p=C-f,d=Rg*h,g=d-(d-h),m=h-g,w=p*m-(O-f*g-p*g-f*m),x=T*c,d=Rg*T,f=d-(d-T),p=T-f,d=Rg*c,g=d-(d-c),m=c-g,S=p*m-(x-f*g-p*g-f*m),b=w-S,u=w-b,Qg[0]=w-(b+u)+(u-S),v=O+b,u=v-O,y=O-(v-u)+(b-u),b=y-x,u=y-b,Qg[1]=y-(b+u)+(u-x),k=v+b,u=k-v,Qg[2]=v-(k-u)+(b-u),Qg[3]=k;const A=Eg(P,Ag,4,Qg,$g);O=a*h,d=Rg*a,f=d-(d-a),p=a-f,d=Rg*h,g=d-(d-h),m=h-g,w=p*m-(O-f*g-p*g-f*m),x=l*c,d=Rg*l,f=d-(d-l),p=l-f,d=Rg*c,g=d-(d-c),m=c-g,S=p*m-(x-f*g-p*g-f*m),b=w-S,u=w-b,Qg[0]=w-(b+u)+(u-S),v=O+b,u=v-O,y=O-(v-u)+(b-u),b=y-x,u=y-b,Qg[1]=y-(b+u)+(u-x),k=v+b,u=k-v,Qg[2]=v-(k-u)+(b-u),Qg[3]=k;const $=Eg(A,$g,4,Qg,zg);return zg[$-1]}(e,t,n,r,i,o,c)}Mg(4),Mg(4),Mg(4),Mg(4),Mg(4),Mg(4),Mg(4),Mg(4),Mg(4),Mg(8),Mg(8),Mg(8),Mg(4),Mg(8),Mg(8),Mg(8),Mg(12),Mg(192),Mg(192),Mg(4),Mg(4),Mg(4),Mg(4),Mg(4),Mg(4),Mg(4),Mg(4),Mg(8),Mg(8),Mg(8),Mg(8),Mg(8),Mg(8),Mg(8),Mg(8),Mg(8),Mg(4),Mg(4),Mg(4),Mg(8),Mg(16),Mg(16),Mg(16),Mg(32),Mg(32),Mg(48),Mg(64),Mg(1152),Mg(1152),Mg(4),Mg(4),Mg(4),Mg(4),Mg(4),Mg(4),Mg(4),Mg(4),Mg(4),Mg(4),Mg(24),Mg(24),Mg(24),Mg(24),Mg(24),Mg(24),Mg(24),Mg(24),Mg(24),Mg(24),Mg(1152),Mg(1152),Mg(1152),Mg(1152),Mg(1152),Mg(2304),Mg(2304),Mg(3456),Mg(5760),Mg(8),Mg(8),Mg(8),Mg(16),Mg(24),Mg(48),Mg(48),Mg(96),Mg(192),Mg(384),Mg(384),Mg(384),Mg(768),Mg(96),Mg(96),Mg(96),Mg(1152);const Ng=Math.pow(2,-52),Dg=new Uint32Array(512);class Wg{static from(e,t=Zg,n=Xg){const r=e.length,i=new Float64Array(2*r);for(let o=0;o>1;if(t>0&&"number"!=typeof e[0])throw new Error("Expected coords to contain numbers.");this.coords=e;const n=Math.max(2*t-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.update()}update(){const{coords:e,_hullPrev:t,_hullNext:n,_hullTri:r,_hullHash:i}=this,o=e.length>>1;let s=1/0,a=1/0,l=-1/0,c=-1/0;for(let t=0;tl&&(l=n),r>c&&(c=r),this._ids[t]=t}const h=(s+l)/2,u=(a+c)/2;let d,f,p;for(let t=0,n=1/0;t0&&(f=t,n=r)}let b=e[2*f],v=e[2*f+1],y=1/0;for(let t=0;tr&&(t[n++]=i,r=o)}return this.hull=t.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(Ig(g,m,b,v,O,w)<0){const e=f,t=b,n=v;f=p,b=O,v=w,p=e,O=t,w=n}const x=function(e,t,n,r,i,o){const s=n-e,a=r-t,l=i-e,c=o-t,h=s*s+a*a,u=l*l+c*c,d=.5/(s*c-a*l);return{x:e+(c*h-a*u)*d,y:t+(s*u-l*h)*d}}(g,m,b,v,O,w);this._cx=x.x,this._cy=x.y;for(let t=0;t0&&Math.abs(c-o)<=Ng&&Math.abs(h-s)<=Ng)continue;if(o=c,s=h,l===d||l===f||l===p)continue;let u=0;for(let e=0,t=this._hashKey(c,h);e=0;)if(m=g,m===u){m=-1;break}if(-1===m)continue;let b=this._addTriangle(m,l,n[m],-1,-1,r[m]);r[l]=this._legalize(b+2),r[m]=b,S++;let v=n[m];for(;g=n[v],Ig(c,h,e[2*v],e[2*v+1],e[2*g],e[2*g+1])<0;)b=this._addTriangle(v,l,g,r[l],-1,r[v]),r[l]=this._legalize(b+2),n[v]=v,S--,v=g;if(m===u)for(;g=t[m],Ig(c,h,e[2*g],e[2*g+1],e[2*m],e[2*m+1])<0;)b=this._addTriangle(g,l,m,-1,r[m],r[g]),this._legalize(b+2),r[g]=b,n[m]=m,S--,m=g;this._hullStart=t[l]=m,n[m]=t[v]=l,n[l]=v,i[this._hashKey(c,h)]=l,i[this._hashKey(e[2*m],e[2*m+1])]=m}this.hull=new Uint32Array(S);for(let e=0,t=this._hullStart;e0?3-n:1+n)/4}(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){const{_triangles:t,_halfedges:n,coords:r}=this;let i=0,o=0;for(;;){const s=n[e],a=e-e%3;if(o=a+(e+2)%3,-1===s){if(0===i)break;e=Dg[--i];continue}const l=s-s%3,c=a+(e+1)%3,h=l+(s+2)%3,u=t[o],d=t[e],f=t[c],p=t[h];if(Hg(r[2*u],r[2*u+1],r[2*d],r[2*d+1],r[2*f],r[2*f+1],r[2*p],r[2*p+1])){t[e]=p,t[s]=u;const r=n[h];if(-1===r){let t=this._hullStart;do{if(this._hullTri[t]===h){this._hullTri[t]=e;break}t=this._hullPrev[t]}while(t!==this._hullStart)}this._link(e,r),this._link(s,n[o]),this._link(o,h);const a=l+(s+1)%3;i=n&&t[e[s]]>o;)e[s+1]=e[s--];e[s+1]=r}else{let i=n+1,o=r;jg(e,n+r>>1,i),t[e[n]]>t[e[r]]&&jg(e,n,r),t[e[i]]>t[e[r]]&&jg(e,i,r),t[e[n]]>t[e[i]]&&jg(e,n,i);const s=e[i],a=t[s];for(;;){do{i++}while(t[e[i]]a);if(o=o-n?(Bg(e,t,i,r),Bg(e,t,n,o-1)):(Bg(e,t,n,o-1),Bg(e,t,i,r))}}function jg(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Zg(e){return e[0]}function Xg(e){return e[1]}const Fg=1e-6;class Yg{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){const r=(e=+e)+(n=+n),i=t=+t;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>Fg||Math.abs(this._y1-i)>Fg)&&(this._+="L"+r+","+i),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(e,t,n,r){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}class qg{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}}class Ug{constructor(e,[t,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(t=+t)&&(i=+i)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(2*e.points.length),this.vectors=new Float64Array(2*e.points.length),this.xmax=r,this.xmin=t,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:e,hull:t,triangles:n},vectors:r}=this;let i,o;const s=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let r,a,l=0,c=0,h=n.length;l1;)i-=2;for(let e=2;e0){if(t>=this.ymax)return null;(i=(this.ymax-t)/r)0){if(e>=this.xmax)return null;(i=(this.xmax-e)/n)this.xmax?2:0)|(tthis.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t2&&function(e){const{triangles:t,coords:n}=e;for(let e=0;e1e-10)return!1}return!0}(e)){this.collinear=Int32Array.from({length:t.length/2},((e,t)=>t)).sort(((e,n)=>t[2*e]-t[2*n]||t[2*e+1]-t[2*n+1]));const e=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[t[2*e],t[2*e+1],t[2*n],t[2*n+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let e=0,n=t.length/2;e0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],o[r[0]]=1,2===r.length&&(o[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(e){return new Ug(this,e)}*neighbors(e){const{inedges:t,hull:n,_hullIndex:r,halfedges:i,triangles:o,collinear:s}=this;if(s){const t=s.indexOf(e);return t>0&&(yield s[t-1]),void(t=0&&i!==n&&i!==r;)n=i;return i}_step(e,t,n){const{inedges:r,hull:i,_hullIndex:o,halfedges:s,triangles:a,points:l}=this;if(-1===r[e]||!l.length)return(e+1)%(l.length>>1);let c=e,h=Kg(t-l[2*e],2)+Kg(n-l[2*e+1],2);const u=r[e];let d=u;do{let r=a[d];const u=Kg(t-l[2*r],2)+Kg(n-l[2*r+1],2);if(u()=>e;function im(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:s,y:a,dx:l,dy:c,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:h}})}function om(e){return!e.ctrlKey&&!e.button}function sm(){return this.parentNode}function am(e,t){return null==t?{x:e.x,y:e.y}:t}function lm(){return navigator.maxTouchPoints||"ontouchstart"in this}function cm(){var e,t,n,r,i=om,o=sm,s=am,a=lm,l={},c=zc("start","drag","end"),h=0,u=0;function d(e){e.on("mousedown.drag",f).filter(a).on("touchstart.drag",m).on("touchmove.drag",b,qh).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(s,a){if(!r&&i.call(this,s,a)){var l=y(this,o.call(this,s,a),s,a,"mouse");l&&(Yh(s.view).on("mousemove.drag",p,Uh).on("mouseup.drag",g,Uh),Jh(s.view),Gh(s),n=!1,e=s.clientX,t=s.clientY,l("start",s))}}function p(r){if(Kh(r),!n){var i=r.clientX-e,o=r.clientY-t;n=i*i+o*o>u}l.mouse("drag",r)}function g(e){Yh(e.view).on("mousemove.drag mouseup.drag",null),eu(e.view,n),Kh(e),l.mouse("end",e)}function m(e,t){if(i.call(this,e,t)){var n,r,s=e.changedTouches,a=o.call(this,e,t),l=s.length;for(n=0;n=o?l=!0:(r=e.charCodeAt(s++))===fm?c=!0:r===pm&&(c=!0,e.charCodeAt(s)===fm&&++s),e.slice(i+1,t-1).replace(/""/g,'"')}for(;s9999?"+"+bm(t,6):bm(t,4))+"-"+bm(e.getUTCMonth()+1,2)+"-"+bm(e.getUTCDate(),2)+(o?"T"+bm(n,2)+":"+bm(r,2)+":"+bm(i,2)+"."+bm(o,3)+"Z":i?"T"+bm(n,2)+":"+bm(r,2)+":"+bm(i,2)+"Z":r||n?"T"+bm(n,2)+":"+bm(r,2)+"Z":"")}(e):t.test(e+="")?'"'+e.replace(/"/g,'""')+'"':e}return{parse:function(e,t){var n,i,o=r(e,(function(e,r){if(n)return n(e,r-1);i=e,n=t?function(e,t){var n=gm(e);return function(r,i){return t(n(r),i,e)}}(e,t):gm(e)}));return o.columns=i||[],o},parseRows:r,format:function(t,n){return null==n&&(n=mm(t)),[n.map(s).join(e)].concat(i(t,n)).join("\n")},formatBody:function(e,t){return null==t&&(t=mm(e)),i(e,t).join("\n")},formatRows:function(e){return e.map(o).join("\n")},formatRow:o,formatValue:s}}var ym=vm(","),Om=ym.parse,wm=ym.parseRows,xm=ym.format,Sm=ym.formatBody,km=ym.formatRows,Cm=ym.formatRow,_m=ym.formatValue,Tm=vm("\t"),Rm=Tm.parse,Em=Tm.parseRows,Mm=Tm.format,Pm=Tm.formatBody,Am=Tm.formatRows,$m=Tm.formatRow,zm=Tm.formatValue;function Qm(e){for(var t in e){var n,r,i=e[t].trim();if(i)if("true"===i)i=!0;else if("false"===i)i=!1;else if("NaN"===i)i=NaN;else if(isNaN(n=+i)){if(!(r=i.match(/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/)))continue;Im&&r[4]&&!r[7]&&(i=i.replace(/-/g,"/").replace(/T/," ")),i=new Date(i)}else i=n;else i=null;e[t]=i}return e}const Im=new Date("2019-01-01T00:00").getHours()||new Date("2019-07-01T00:00").getHours(),Nm=e=>+e;function Dm(e){return e*e}function Wm(e){return e*(2-e)}function Lm(e){return((e*=2)<=1?e*e:--e*(2-e)+1)/2}var Hm=function e(t){function n(e){return Math.pow(e,t)}return t=+t,n.exponent=e,n}(3),Vm=function e(t){function n(e){return 1-Math.pow(1-e,t)}return t=+t,n.exponent=e,n}(3),Bm=function e(t){function n(e){return((e*=2)<=1?Math.pow(e,t):2-Math.pow(2-e,t))/2}return t=+t,n.exponent=e,n}(3),jm=Math.PI,Zm=jm/2;function Xm(e){return 1==+e?1:1-Math.cos(e*Zm)}function Fm(e){return Math.sin(e*Zm)}function Ym(e){return(1-Math.cos(jm*e))/2}function qm(e){return 1.0009775171065494*(Math.pow(2,-10*e)-.0009765625)}function Um(e){return qm(1-+e)}function Gm(e){return 1-qm(e)}function Km(e){return((e*=2)<=1?qm(1-e):2-qm(e-1))/2}function Jm(e){return 1-Math.sqrt(1-e*e)}function eb(e){return Math.sqrt(1- --e*e)}function tb(e){return((e*=2)<=1?1-Math.sqrt(1-e*e):Math.sqrt(1-(e-=2)*e)+1)/2}var nb=4/11,rb=6/11,ib=8/11,ob=3/4,sb=9/11,ab=10/11,lb=15/16,cb=21/22,hb=63/64,ub=1/nb/nb;function db(e){return 1-fb(1-e)}function fb(e){return(e=+e)Rb(t,n).then((t=>(new DOMParser).parseFromString(t,e)))}const Nb=Ib("application/xml");var Db=Ib("text/html"),Wb=Ib("image/svg+xml");function Lb(e,t){var n,r=1;function i(){var i,o,s=n.length,a=0,l=0;for(i=0;i=(o=(g+b)/2))?g=o:b=o,(h=n>=(s=(m+v)/2))?m=s:v=s,i=f,!(f=f[u=h<<1|c]))return i[u]=p,e;if(a=+e._x.call(null,f.data),l=+e._y.call(null,f.data),t===a&&n===l)return p.next=f,i?i[u]=p:e._root=p,e;do{i=i?i[u]=new Array(4):e._root=new Array(4),(c=t>=(o=(g+b)/2))?g=o:b=o,(h=n>=(s=(m+v)/2))?m=s:v=s}while((u=h<<1|c)==(d=(l>=s)<<1|a>=o));return i[d]=f,i[u]=p,e}function Vb(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i}function Bb(e){return e[0]}function jb(e){return e[1]}function Zb(e,t,n){var r=new Xb(null==t?Bb:t,null==n?jb:n,NaN,NaN,NaN,NaN);return null==e?r:r.addAll(e)}function Xb(e,t,n,r,i,o){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function Fb(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Yb=Zb.prototype=Xb.prototype;function qb(e){return function(){return e}}function Ub(e){return 1e-6*(e()-.5)}function Gb(e){return e.x+e.vx}function Kb(e){return e.y+e.vy}function Jb(e){var t,n,r,i=1,o=1;function s(){for(var e,s,l,c,h,u,d,f=t.length,p=0;pc+p||oh+p||sl.index){var g=c-a.x-a.vx,m=h-a.y-a.vy,b=g*g+m*m;be.r&&(e.r=e[t].r)}function l(){if(t){var r,i,o=t.length;for(n=new Array(o),r=0;r[a(e,t,r),e])));for(s=0,i=new Array(c);sh&&(h=r),iu&&(u=i));if(l>h||c>u)return this;for(this.cover(l,c).cover(h,u),n=0;ne||e>=i||r>t||t>=o;)switch(a=(td||(o=l.y0)>f||(s=l.x1)=b)<<1|e>=m)&&(l=p[p.length-1],p[p.length-1]=p[p.length-1-c],p[p.length-1-c]=l)}else{var v=e-+this._x.call(null,g.data),y=t-+this._y.call(null,g.data),O=v*v+y*y;if(O=(a=(p+m)/2))?p=a:m=a,(h=s>=(l=(g+b)/2))?g=l:b=l,t=f,!(f=f[u=h<<1|c]))return this;if(!f.length)break;(t[u+1&3]||t[u+2&3]||t[u+3&3])&&(n=t,d=u)}for(;f.data!==e;)if(r=f,!(f=f.next))return this;return(i=f.next)&&delete f.next,r?(i?r.next=i:delete r.next,this):t?(i?t[u]=i:delete t[u],(f=t[0]||t[1]||t[2]||t[3])&&f===(t[3]||t[2]||t[1]||t[0])&&!f.length&&(n?n[d]=f:this._root=f),this):(this._root=i,this)},Yb.removeAll=function(e){for(var t=0,n=e.length;t(e=(rv*e+iv)%ov)/ov}();function u(){d(),c.call("tick",t),n1?(null==n?a.delete(e):a.set(e,p(n)),t):a.get(e)},find:function(t,n,r){var i,o,s,a,l,c=0,h=e.length;for(null==r?r=1/0:r*=r,c=0;c1?(c.on(e,n),t):c.on(e)}}}function uv(){var e,t,n,r,i,o=qb(-30),s=1,a=1/0,l=.81;function c(n){var i,o=e.length,s=Zb(e,sv,av).visitAfter(u);for(r=n,i=0;i=a)){(e.data!==t||e.next)&&(0===u&&(p+=(u=Ub(n))*u),0===d&&(p+=(d=Ub(n))*d),p1?r[0]+r.slice(2):r,+e.slice(n+1)]}function mv(e){return(e=gv(Math.abs(e)))?e[1]:NaN}var bv,vv=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function yv(e){if(!(t=vv.exec(e)))throw new Error("invalid format: "+e);var t;return new Ov({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function Ov(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function wv(e,t){var n=gv(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}yv.prototype=Ov.prototype,Ov.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const xv={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>wv(100*e,t),r:wv,s:function(e,t){var n=gv(e,t);if(!n)return bv=void 0,e.toPrecision(t);var r=n[0],i=n[1],o=i-(bv=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+gv(e,Math.max(0,t+o-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Sv(e){return e}var kv,Cv,_v,Tv=Array.prototype.map,Rv=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ev(e){var t,n,r=void 0===e.grouping||void 0===e.thousands?Sv:(t=Tv.call(e.grouping,Number),n=e.thousands+"",function(e,r){for(var i=e.length,o=[],s=0,a=t[0],l=0;i>0&&a>0&&(l+a+1>r&&(a=Math.max(1,r-l)),o.push(e.substring(i-=a,i+a)),!((l+=a+1)>r));)a=t[s=(s+1)%t.length];return o.reverse().join(n)}),i=void 0===e.currency?"":e.currency[0]+"",o=void 0===e.currency?"":e.currency[1]+"",s=void 0===e.decimal?".":e.decimal+"",a=void 0===e.numerals?Sv:function(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}(Tv.call(e.numerals,String)),l=void 0===e.percent?"%":e.percent+"",c=void 0===e.minus?"−":e.minus+"",h=void 0===e.nan?"NaN":e.nan+"";function u(e,t){var n=(e=yv(e)).fill,u=e.align,d=e.sign,f=e.symbol,p=e.zero,g=e.width,m=e.comma,b=e.precision,v=e.trim,y=e.type;"n"===y?(m=!0,y="g"):xv[y]||(void 0===b&&(b=12),v=!0,y="g"),(p||"0"===n&&"="===u)&&(p=!0,n="0",u="=");var O=(t&&void 0!==t.prefix?t.prefix:"")+("$"===f?i:"#"===f&&/[boxX]/.test(y)?"0"+y.toLowerCase():""),w=("$"===f?o:/[%p]/.test(y)?l:"")+(t&&void 0!==t.suffix?t.suffix:""),x=xv[y],S=/[defgprs%]/.test(y);function k(e){var t,i,o,l=O,f=w;if("c"===y)f=x(e)+f,e="";else{var k=(e=+e)<0||1/e<0;if(e=isNaN(e)?h:x(Math.abs(e),b),v&&(e=function(e){e:for(var t,n=e.length,r=1,i=-1;r0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),k&&0==+e&&"+"!==d&&(k=!1),l=(k?"("===d?d:c:"-"===d||"("===d?"":d)+l,f=("s"!==y||isNaN(e)||void 0===bv?"":Rv[8+bv/3])+f+(k&&"("===d?")":""),S)for(t=-1,i=e.length;++t(o=e.charCodeAt(t))||o>57){f=(46===o?s+e.slice(t+1):e.slice(t))+f,e=e.slice(0,t);break}}m&&!p&&(e=r(e,1/0));var C=l.length+e.length+f.length,_=C>1)+l+e+f+_.slice(C);break;default:e=_+l+e+f}return a(e)}return b=void 0===b?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b)),k.toString=function(){return e+""},k}return{format:u,formatPrefix:function(e,t){var n=3*Math.max(-8,Math.min(8,Math.floor(mv(t)/3))),r=Math.pow(10,-n),i=u(((e=yv(e)).type="f",e),{suffix:Rv[8+n/3]});return function(e){return i(r*e)}}}}function Mv(e){return kv=Ev(e),Cv=kv.format,_v=kv.formatPrefix,kv}function Pv(e){return Math.max(0,-mv(Math.abs(e)))}function Av(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(mv(t)/3)))-mv(Math.abs(e)))}function $v(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,mv(t)-mv(e))+1}Mv({thousands:",",grouping:[3],currency:["$",""]});var zv=1e-6,Qv=1e-12,Iv=Math.PI,Nv=Iv/2,Dv=Iv/4,Wv=2*Iv,Lv=180/Iv,Hv=Iv/180,Vv=Math.abs,Bv=Math.atan,jv=Math.atan2,Zv=Math.cos,Xv=Math.ceil,Fv=Math.exp,Yv=(Math.floor,Math.hypot),qv=Math.log,Uv=Math.pow,Gv=Math.sin,Kv=Math.sign||function(e){return e>0?1:e<0?-1:0},Jv=Math.sqrt,ey=Math.tan;function ty(e){return e>1?0:e<-1?Iv:Math.acos(e)}function ny(e){return e>1?Nv:e<-1?-Nv:Math.asin(e)}function ry(e){return(e=Gv(e/2))*e}function iy(){}function oy(e,t){e&&ay.hasOwnProperty(e.type)&&ay[e.type](e,t)}var sy={Feature:function(e,t){oy(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r=0?1:-1,i=r*n,o=Zv(t=(t*=Hv)/2+Dv),s=Gv(t),a=gy*s,l=py*o+a*Zv(i),c=a*r*Gv(i);Ty.add(jv(c,l)),fy=e,py=o,gy=s}function zy(e){return Ry=new Na,hy(e,Ey),2*Ry}function Qy(e){return[jv(e[1],e[0]),ny(e[2])]}function Iy(e){var t=e[0],n=e[1],r=Zv(n);return[r*Zv(t),r*Gv(t),Gv(n)]}function Ny(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Dy(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Wy(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Ly(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Hy(e){var t=Jv(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var Vy,By,jy,Zy,Xy,Fy,Yy,qy,Uy,Gy,Ky,Jy,eO,tO,nO,rO,iO={point:oO,lineStart:aO,lineEnd:lO,polygonStart:function(){iO.point=cO,iO.lineStart=hO,iO.lineEnd=uO,ky=new Na,Ey.polygonStart()},polygonEnd:function(){Ey.polygonEnd(),iO.point=oO,iO.lineStart=aO,iO.lineEnd=lO,Ty<0?(my=-(vy=180),by=-(yy=90)):ky>zv?yy=90:ky<-zv&&(by=-90),_y[0]=my,_y[1]=vy},sphere:function(){my=-(vy=180),by=-(yy=90)}};function oO(e,t){Cy.push(_y=[my=e,vy=e]),tyy&&(yy=t)}function sO(e,t){var n=Iy([e*Hv,t*Hv]);if(Sy){var r=Dy(Sy,n),i=Dy([r[1],-r[0],0],r);Hy(i),i=Qy(i);var o,s=e-Oy,a=s>0?1:-1,l=i[0]*Lv*a,c=Vv(s)>180;c^(a*Oyyy&&(yy=o):c^(a*Oy<(l=(l+360)%360-180)&&lyy&&(yy=t)),c?edO(my,vy)&&(vy=e):dO(e,vy)>dO(my,vy)&&(my=e):vy>=my?(evy&&(vy=e)):e>Oy?dO(my,e)>dO(my,vy)&&(vy=e):dO(e,vy)>dO(my,vy)&&(my=e)}else Cy.push(_y=[my=e,vy=e]);tyy&&(yy=t),Sy=n,Oy=e}function aO(){iO.point=sO}function lO(){_y[0]=my,_y[1]=vy,iO.point=oO,Sy=null}function cO(e,t){if(Sy){var n=e-Oy;ky.add(Vv(n)>180?n+(n>0?360:-360):n)}else wy=e,xy=t;Ey.point(e,t),sO(e,t)}function hO(){Ey.lineStart()}function uO(){cO(wy,xy),Ey.lineEnd(),Vv(ky)>zv&&(my=-(vy=180)),_y[0]=my,_y[1]=vy,Sy=null}function dO(e,t){return(t-=e)<0?t+360:t}function fO(e,t){return e[0]-t[0]}function pO(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tdO(r[0],r[1])&&(r[1]=i[1]),dO(i[0],r[1])>dO(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(s=-1/0,t=0,r=o[n=o.length-1];t<=n;r=i,++t)i=o[t],(a=dO(r[1],i[0]))>s&&(s=a,my=i[0],vy=r[1])}return Cy=_y=null,my===1/0||by===1/0?[[NaN,NaN],[NaN,NaN]]:[[my,by],[vy,yy]]}var mO={sphere:iy,point:bO,lineStart:yO,lineEnd:xO,polygonStart:function(){mO.lineStart=SO,mO.lineEnd=kO},polygonEnd:function(){mO.lineStart=yO,mO.lineEnd=xO}};function bO(e,t){e*=Hv;var n=Zv(t*=Hv);vO(n*Zv(e),n*Gv(e),Gv(t))}function vO(e,t,n){++Vy,jy+=(e-jy)/Vy,Zy+=(t-Zy)/Vy,Xy+=(n-Xy)/Vy}function yO(){mO.point=OO}function OO(e,t){e*=Hv;var n=Zv(t*=Hv);tO=n*Zv(e),nO=n*Gv(e),rO=Gv(t),mO.point=wO,vO(tO,nO,rO)}function wO(e,t){e*=Hv;var n=Zv(t*=Hv),r=n*Zv(e),i=n*Gv(e),o=Gv(t),s=jv(Jv((s=nO*o-rO*i)*s+(s=rO*r-tO*o)*s+(s=tO*i-nO*r)*s),tO*r+nO*i+rO*o);By+=s,Fy+=s*(tO+(tO=r)),Yy+=s*(nO+(nO=i)),qy+=s*(rO+(rO=o)),vO(tO,nO,rO)}function xO(){mO.point=bO}function SO(){mO.point=CO}function kO(){_O(Jy,eO),mO.point=bO}function CO(e,t){Jy=e,eO=t,e*=Hv,t*=Hv,mO.point=_O;var n=Zv(t);tO=n*Zv(e),nO=n*Gv(e),rO=Gv(t),vO(tO,nO,rO)}function _O(e,t){e*=Hv;var n=Zv(t*=Hv),r=n*Zv(e),i=n*Gv(e),o=Gv(t),s=nO*o-rO*i,a=rO*r-tO*o,l=tO*i-nO*r,c=Yv(s,a,l),h=ny(c),u=c&&-h/c;Uy.add(u*s),Gy.add(u*a),Ky.add(u*l),By+=h,Fy+=h*(tO+(tO=r)),Yy+=h*(nO+(nO=i)),qy+=h*(rO+(rO=o)),vO(tO,nO,rO)}function TO(e){Vy=By=jy=Zy=Xy=Fy=Yy=qy=0,Uy=new Na,Gy=new Na,Ky=new Na,hy(e,mO);var t=+Uy,n=+Gy,r=+Ky,i=Yv(t,n,r);return iIv&&(e-=Math.round(e/Wv)*Wv),[e,t]}function PO(e,t,n){return(e%=Wv)?t||n?EO($O(e),zO(t,n)):$O(e):t||n?zO(t,n):MO}function AO(e){return function(t,n){return Vv(t+=e)>Iv&&(t-=Math.round(t/Wv)*Wv),[t,n]}}function $O(e){var t=AO(e);return t.invert=AO(-e),t}function zO(e,t){var n=Zv(e),r=Gv(e),i=Zv(t),o=Gv(t);function s(e,t){var s=Zv(t),a=Zv(e)*s,l=Gv(e)*s,c=Gv(t),h=c*n+a*r;return[jv(l*i-h*o,a*n-c*r),ny(h*i+l*o)]}return s.invert=function(e,t){var s=Zv(t),a=Zv(e)*s,l=Gv(e)*s,c=Gv(t),h=c*i-l*o;return[jv(l*i+c*o,a*n+h*r),ny(h*n-a*r)]},s}function QO(e){function t(t){return(t=e(t[0]*Hv,t[1]*Hv))[0]*=Lv,t[1]*=Lv,t}return e=PO(e[0]*Hv,e[1]*Hv,e.length>2?e[2]*Hv:0),t.invert=function(t){return(t=e.invert(t[0]*Hv,t[1]*Hv))[0]*=Lv,t[1]*=Lv,t},t}function IO(e,t,n,r,i,o){if(n){var s=Zv(t),a=Gv(t),l=r*n;null==i?(i=t+r*Wv,o=t-l/2):(i=NO(s,i),o=NO(s,o),(r>0?io)&&(i+=r*Wv));for(var c,h=i;r>0?h>o:h1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function LO(e,t){return Vv(e[0]-t[0])=0;--o)i.point((h=c[o])[0],h[1]);else r(d.x,d.p.x,-1,i);d=d.p}c=(d=d.o).z,f=!f}while(!d.v);i.lineEnd()}}}function BO(e){if(t=e.length){for(var t,n,r=0,i=e[0];++r=0?1:-1,_=C*k,T=_>Iv,R=m*x;if(l.add(jv(R*C*Gv(_),b*S+R*Zv(_))),s+=T?k+C*Wv:k,T^p>=n^O>=n){var E=Dy(Iy(f),Iy(y));Hy(E);var M=Dy(o,E);Hy(M);var P=(T^k>=0?-1:1)*ny(M[2]);(r>P||r===P&&(E[0]||E[1]))&&(a+=T^k>=0?1:-1)}}return(s<-zv||s0){for(u||(i.polygonStart(),u=!0),i.lineStart(),e=0;e1&&2&l&&d.push(d.pop().concat(d.shift())),s.push(d.filter(FO))}return d}}function FO(e){return e.length>1}function YO(e,t){return((e=e.x)[0]<0?e[1]-Nv-zv:Nv-e[1])-((t=t.x)[0]<0?t[1]-Nv-zv:Nv-t[1])}MO.invert=MO;const qO=XO((function(){return!0}),(function(e){var t,n=NaN,r=NaN,i=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(o,s){var a=o>0?Iv:-Iv,l=Vv(o-n);Vv(l-Iv)0?Nv:-Nv),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(a,r),e.point(o,r),t=0):i!==a&&l>=Iv&&(Vv(n-i)zv?Bv((Gv(t)*(o=Zv(r))*Gv(n)-Gv(r)*(i=Zv(t))*Gv(e))/(i*o*s)):(t+r)/2}(n,r,o,s),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(a,r),t=0),e.point(n=o,r=s),i=a},lineEnd:function(){e.lineEnd(),n=r=NaN},clean:function(){return 2-t}}}),(function(e,t,n,r){var i;if(null==e)i=n*Nv,r.point(-Iv,i),r.point(0,i),r.point(Iv,i),r.point(Iv,0),r.point(Iv,-i),r.point(0,-i),r.point(-Iv,-i),r.point(-Iv,0),r.point(-Iv,i);else if(Vv(e[0]-t[0])>zv){var o=e[0]0,i=Vv(t)>zv;function o(e,n){return Zv(e)*Zv(n)>t}function s(e,n,r){var i=[1,0,0],o=Dy(Iy(e),Iy(n)),s=Ny(o,o),a=o[0],l=s-a*a;if(!l)return!r&&e;var c=t*s/l,h=-t*a/l,u=Dy(i,o),d=Ly(i,c);Wy(d,Ly(o,h));var f=u,p=Ny(d,f),g=Ny(f,f),m=p*p-g*(Ny(d,d)-1);if(!(m<0)){var b=Jv(m),v=Ly(f,(-p-b)/g);if(Wy(v,d),v=Qy(v),!r)return v;var y,O=e[0],w=n[0],x=e[1],S=n[1];w0^v[1]<(Vv(v[0]-O)Iv^(O<=v[0]&&v[0]<=w)){var _=Ly(f,(-p+b)/g);return Wy(_,d),[v,Qy(_)]}}}function a(t,n){var i=r?e:Iv-e,o=0;return t<-i?o|=1:t>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return XO(o,(function(e){var t,n,l,c,h;return{lineStart:function(){c=l=!1,h=1},point:function(u,d){var f,p=[u,d],g=o(u,d),m=r?g?0:a(u,d):g?a(u+(u<0?Iv:-Iv),d):0;if(!t&&(c=l=g)&&e.lineStart(),g!==l&&(!(f=s(t,p))||LO(t,f)||LO(p,f))&&(p[2]=1),g!==l)h=0,g?(e.lineStart(),f=s(p,t),e.point(f[0],f[1])):(f=s(t,p),e.point(f[0],f[1],2),e.lineEnd()),t=f;else if(i&&t&&r^g){var b;m&n||!(b=s(p,t,!0))||(h=0,r?(e.lineStart(),e.point(b[0][0],b[0][1]),e.point(b[1][0],b[1][1]),e.lineEnd()):(e.point(b[1][0],b[1][1]),e.lineEnd(),e.lineStart(),e.point(b[0][0],b[0][1],3)))}!g||t&&LO(t,p)||e.point(p[0],p[1]),t=p,l=g,n=m},lineEnd:function(){l&&e.lineEnd(),t=null},clean:function(){return h|(c&&l)<<1}}}),(function(t,r,i,o){IO(o,e,n,i,t,r)}),r?[0,-e]:[-Iv,e-Iv])}var GO,KO,JO,ew,tw=1e9,nw=-tw;function rw(e,t,n,r){function i(i,o){return e<=i&&i<=n&&t<=o&&o<=r}function o(i,o,a,c){var h=0,u=0;if(null==i||(h=s(i,a))!==(u=s(o,a))||l(i,o)<0^a>0)do{c.point(0===h||3===h?e:n,h>1?r:t)}while((h=(h+a+4)%4)!==u);else c.point(o[0],o[1])}function s(r,i){return Vv(r[0]-e)0?0:3:Vv(r[0]-n)0?2:1:Vv(r[1]-t)0?1:0:i>0?3:2}function a(e,t){return l(e.x,t.x)}function l(e,t){var n=s(e,1),r=s(t,1);return n!==r?n-r:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}return function(s){var l,c,h,u,d,f,p,g,m,b,v,y=s,O=WO(),w={point:x,lineStart:function(){w.point=S,c&&c.push(h=[]),b=!0,m=!1,p=g=NaN},lineEnd:function(){l&&(S(u,d),f&&m&&O.rejoin(),l.push(O.result())),w.point=x,m&&y.lineEnd()},polygonStart:function(){y=O,l=[],c=[],v=!0},polygonEnd:function(){var t=function(){for(var t=0,n=0,i=c.length;nr&&(d-o)*(r-s)>(f-s)*(e-o)&&++t:f<=r&&(d-o)*(r-s)<(f-s)*(e-o)&&--t;return t}(),n=v&&t,i=(l=Nl(l)).length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),i&&VO(l,a,t,o,s),s.polygonEnd()),y=s,l=c=h=null}};function x(e,t){i(e,t)&&y.point(e,t)}function S(o,s){var a=i(o,s);if(c&&h.push([o,s]),b)u=o,d=s,f=a,b=!1,a&&(y.lineStart(),y.point(o,s));else if(a&&m)y.point(o,s);else{var l=[p=Math.max(nw,Math.min(tw,p)),g=Math.max(nw,Math.min(tw,g))],O=[o=Math.max(nw,Math.min(tw,o)),s=Math.max(nw,Math.min(tw,s))];!function(e,t,n,r,i,o){var s,a=e[0],l=e[1],c=0,h=1,u=t[0]-a,d=t[1]-l;if(s=n-a,u||!(s>0)){if(s/=u,u<0){if(s0){if(s>h)return;s>c&&(c=s)}if(s=i-a,u||!(s<0)){if(s/=u,u<0){if(s>h)return;s>c&&(c=s)}else if(u>0){if(s0)){if(s/=d,d<0){if(s0){if(s>h)return;s>c&&(c=s)}if(s=o-l,d||!(s<0)){if(s/=d,d<0){if(s>h)return;s>c&&(c=s)}else if(d>0){if(s0&&(e[0]=a+c*u,e[1]=l+c*d),h<1&&(t[0]=a+h*u,t[1]=l+h*d),!0}}}}}(l,O,e,t,n,r)?a&&(y.lineStart(),y.point(o,s),v=!1):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(O[0],O[1]),a||y.lineEnd(),v=!1)}p=o,g=s,m=a}return w}}function iw(){var e,t,n,r=0,i=0,o=960,s=500;return n={stream:function(n){return e&&t===n?e:e=rw(r,i,o,s)(t=n)},extent:function(a){return arguments.length?(r=+a[0][0],i=+a[0][1],o=+a[1][0],s=+a[1][1],e=t=null,n):[[r,i],[o,s]]}}}var ow={sphere:iy,point:iy,lineStart:function(){ow.point=aw,ow.lineEnd=sw},lineEnd:iy,polygonStart:iy,polygonEnd:iy};function sw(){ow.point=ow.lineEnd=iy}function aw(e,t){KO=e*=Hv,JO=Gv(t*=Hv),ew=Zv(t),ow.point=lw}function lw(e,t){e*=Hv;var n=Gv(t*=Hv),r=Zv(t),i=Vv(e-KO),o=Zv(i),s=r*Gv(i),a=ew*n-JO*r*o,l=JO*n+ew*r*o;GO.add(jv(Jv(s*s+a*a),l)),KO=e,JO=n,ew=r}function cw(e){return GO=new Na,hy(e,ow),+GO}var hw=[null,null],uw={type:"LineString",coordinates:hw};function dw(e,t){return hw[0]=e,hw[1]=t,cw(uw)}var fw={Feature:function(e,t){return gw(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r0&&(i=dw(e[o],e[o-1]))>0&&n<=i&&r<=i&&(n+r-i)*(1-Math.pow((n-r)/i,2))zv})).map(l)).concat(Hl(Xv(o/f)*f,i,f).filter((function(e){return Vv(e%g)>zv})).map(c))}return b.lines=function(){return v().map((function(e){return{type:"LineString",coordinates:e}}))},b.outline=function(){return{type:"Polygon",coordinates:[h(r).concat(u(s).slice(1),h(n).reverse().slice(1),u(a).reverse().slice(1))]}},b.extent=function(e){return arguments.length?b.extentMajor(e).extentMinor(e):b.extentMinor()},b.extentMajor=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],a=+e[0][1],s=+e[1][1],r>n&&(e=r,r=n,n=e),a>s&&(e=a,a=s,s=e),b.precision(m)):[[r,a],[n,s]]},b.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],o=+n[0][1],i=+n[1][1],t>e&&(n=t,t=e,e=n),o>i&&(n=o,o=i,i=n),b.precision(m)):[[t,o],[e,i]]},b.step=function(e){return arguments.length?b.stepMajor(e).stepMinor(e):b.stepMinor()},b.stepMajor=function(e){return arguments.length?(p=+e[0],g=+e[1],b):[p,g]},b.stepMinor=function(e){return arguments.length?(d=+e[0],f=+e[1],b):[d,f]},b.precision=function(d){return arguments.length?(m=+d,l=xw(o,i,90),c=Sw(t,e,m),h=xw(a,s,90),u=Sw(r,n,m),b):m},b.extentMajor([[-180,-90+zv],[180,90-zv]]).extentMinor([[-180,-80-zv],[180,80+zv]])}function Cw(){return kw()()}function _w(e,t){var n=e[0]*Hv,r=e[1]*Hv,i=t[0]*Hv,o=t[1]*Hv,s=Zv(r),a=Gv(r),l=Zv(o),c=Gv(o),h=s*Zv(n),u=s*Gv(n),d=l*Zv(i),f=l*Gv(i),p=2*ny(Jv(ry(o-r)+s*l*ry(i-n))),g=Gv(p),m=p?function(e){var t=Gv(e*=p)/g,n=Gv(p-e)/g,r=n*h+t*d,i=n*u+t*f,o=n*a+t*c;return[jv(i,r)*Lv,jv(o,Jv(r*r+i*i))*Lv]}:function(){return[n*Lv,r*Lv]};return m.distance=p,m}const Tw=e=>e;var Rw,Ew,Mw,Pw,Aw=new Na,$w=new Na,zw={point:iy,lineStart:iy,lineEnd:iy,polygonStart:function(){zw.lineStart=Qw,zw.lineEnd=Dw},polygonEnd:function(){zw.lineStart=zw.lineEnd=zw.point=iy,Aw.add(Vv($w)),$w=new Na},result:function(){var e=Aw/2;return Aw=new Na,e}};function Qw(){zw.point=Iw}function Iw(e,t){zw.point=Nw,Rw=Mw=e,Ew=Pw=t}function Nw(e,t){$w.add(Pw*e-Mw*t),Mw=e,Pw=t}function Dw(){Nw(Rw,Ew)}const Ww=zw;var Lw=1/0,Hw=Lw,Vw=-Lw,Bw=Vw,jw={point:function(e,t){eVw&&(Vw=e),tBw&&(Bw=t)},lineStart:iy,lineEnd:iy,polygonStart:iy,polygonEnd:iy,result:function(){var e=[[Lw,Hw],[Vw,Bw]];return Vw=Bw=-(Hw=Lw=1/0),e}};const Zw=jw;var Xw,Fw,Yw,qw,Uw=0,Gw=0,Kw=0,Jw=0,ex=0,tx=0,nx=0,rx=0,ix=0,ox={point:sx,lineStart:ax,lineEnd:hx,polygonStart:function(){ox.lineStart=ux,ox.lineEnd=dx},polygonEnd:function(){ox.point=sx,ox.lineStart=ax,ox.lineEnd=hx},result:function(){var e=ix?[nx/ix,rx/ix]:tx?[Jw/tx,ex/tx]:Kw?[Uw/Kw,Gw/Kw]:[NaN,NaN];return Uw=Gw=Kw=Jw=ex=tx=nx=rx=ix=0,e}};function sx(e,t){Uw+=e,Gw+=t,++Kw}function ax(){ox.point=lx}function lx(e,t){ox.point=cx,sx(Yw=e,qw=t)}function cx(e,t){var n=e-Yw,r=t-qw,i=Jv(n*n+r*r);Jw+=i*(Yw+e)/2,ex+=i*(qw+t)/2,tx+=i,sx(Yw=e,qw=t)}function hx(){ox.point=sx}function ux(){ox.point=fx}function dx(){px(Xw,Fw)}function fx(e,t){ox.point=px,sx(Xw=Yw=e,Fw=qw=t)}function px(e,t){var n=e-Yw,r=t-qw,i=Jv(n*n+r*r);Jw+=i*(Yw+e)/2,ex+=i*(qw+t)/2,tx+=i,nx+=(i=qw*e-Yw*t)*(Yw+e),rx+=i*(qw+t),ix+=3*i,sx(Yw=e,qw=t)}const gx=ox;function mx(e){this._context=e}mx.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,Wv)}},result:iy};var bx,vx,yx,Ox,wx,xx=new Na,Sx={point:iy,lineStart:function(){Sx.point=kx},lineEnd:function(){bx&&Cx(vx,yx),Sx.point=iy},polygonStart:function(){bx=!0},polygonEnd:function(){bx=null},result:function(){var e=+xx;return xx=new Na,e}};function kx(e,t){Sx.point=Cx,vx=Ox=e,yx=wx=t}function Cx(e,t){Ox-=e,wx-=t,xx.add(Jv(Ox*Ox+wx*wx)),Ox=e,wx=t}const Tx=Sx;let Rx,Ex,Mx,Px;class Ax{constructor(e){this._append=null==e?$x:function(e){const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return $x;if(t!==Rx){const e=10**t;Rx=t,Ex=function(t){let n=1;this._+=t[0];for(const r=t.length;n=0))throw new RangeError(`invalid digits: ${e}`);i=t}return null===t&&(r=new Ax(i)),s},s.projection(e).digits(i).context(t)}function Qx(e){return{stream:Ix(e)}}function Ix(e){return function(t){var n=new Nx;for(var r in e)n[r]=e[r];return n.stream=t,n}}function Nx(){}function Dx(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),null!=r&&e.clipExtent(null),hy(n,e.stream(Zw)),t(Zw.result()),null!=r&&e.clipExtent(r),e}function Wx(e,t,n){return Dx(e,(function(n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),s=+t[0][0]+(r-o*(n[1][0]+n[0][0]))/2,a=+t[0][1]+(i-o*(n[1][1]+n[0][1]))/2;e.scale(150*o).translate([s,a])}),n)}function Lx(e,t,n){return Wx(e,[[0,0],t],n)}function Hx(e,t,n){return Dx(e,(function(n){var r=+t,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,s=-i*n[0][1];e.scale(150*i).translate([o,s])}),n)}function Vx(e,t,n){return Dx(e,(function(n){var r=+t,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],s=(r-i*(n[1][1]+n[0][1]))/2;e.scale(150*i).translate([o,s])}),n)}Nx.prototype={constructor:Nx,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Bx=16,jx=Zv(30*Hv);function Zx(e,t){return+t?function(e,t){function n(r,i,o,s,a,l,c,h,u,d,f,p,g,m){var b=c-r,v=h-i,y=b*b+v*v;if(y>4*t&&g--){var O=s+d,w=a+f,x=l+p,S=Jv(O*O+w*w+x*x),k=ny(x/=S),C=Vv(Vv(x)-1)t||Vv((b*E+v*M)/y-.5)>.3||s*d+a*f+l*p2?e[2]%360*Hv:0,E()):[m*Lv,b*Lv,v*Lv]},T.angle=function(e){return arguments.length?(y=e%360*Hv,E()):y*Lv},T.reflectX=function(e){return arguments.length?(O=e?-1:1,E()):O<0},T.reflectY=function(e){return arguments.length?(w=e?-1:1,E()):w<0},T.precision=function(e){return arguments.length?(s=Zx(a,_=e*e),M()):Jv(_)},T.fitExtent=function(e,t){return Wx(T,e,t)},T.fitSize=function(e,t){return Lx(T,e,t)},T.fitWidth=function(e,t){return Hx(T,e,t)},T.fitHeight=function(e,t){return Vx(T,e,t)},function(){return t=e.apply(this,arguments),T.invert=t.invert&&R,E()}}function Ux(e){var t=0,n=Iv/3,r=qx(e),i=r(t,n);return i.parallels=function(e){return arguments.length?r(t=e[0]*Hv,n=e[1]*Hv):[t*Lv,n*Lv]},i}function Gx(e,t){var n=Gv(e),r=(n+Gv(t))/2;if(Vv(r)=.12&&i<.234&&r>=-.425&&r<-.214?a:i>=.166&&i<.234&&r>=-.214&&r<-.115?l:s).invert(e)},h.stream=function(n){return e&&t===n?e:e=function(e){var t=e.length;return{point:function(n,r){for(var i=-1;++i0?t<-Nv+zv&&(t=-Nv+zv):t>Nv-zv&&(t=Nv-zv);var n=i/Uv(hS(t),r);return[n*Gv(r*e),i-n*Zv(r*e)]}return o.invert=function(e,t){var n=i-t,o=Kv(r)*Jv(e*e+n*n),s=jv(e,Vv(n))*Kv(n);return n*r<0&&(s-=Iv*Kv(e)*Kv(n)),[s/r,2*Bv(Uv(i/o,1/r))-Nv]},o}function dS(){return Ux(uS).scale(109.5).parallels([30,30])}function fS(e,t){return[e,t]}function pS(){return Yx(fS).scale(152.63)}function gS(e,t){var n=Zv(e),r=e===t?Gv(e):(n-Zv(t))/(t-e),i=n/r+e;if(Vv(r)2?e[2]+90:90]):[(e=n())[0],e[1],e[2]-90]},n([0,0,90]).scale(159.155)}function QS(e,t){return e.parent===t.parent?1:2}function IS(e,t){return e+t.x}function NS(e,t){return Math.max(e,t.y)}function DS(){var e=QS,t=1,n=1,r=!1;function i(i){var o,s=0;i.eachAfter((function(t){var n=t.children;n?(t.x=function(e){return e.reduce(IS,0)/e.length}(n),t.y=function(e){return 1+e.reduce(NS,0)}(n)):(t.x=o?s+=e(t,o):0,t.y=0,o=t)}));var a=function(e){for(var t;t=e.children;)e=t[0];return e}(i),l=function(e){for(var t;t=e.children;)e=t[t.length-1];return e}(i),c=a.x-e(a,l)/2,h=l.x+e(l,a)/2;return i.eachAfter(r?function(e){e.x=(e.x-i.x)*t,e.y=(i.y-e.y)*n}:function(e){e.x=(e.x-c)/(h-c)*t,e.y=(1-(i.y?e.y/i.y:1))*n})}return i.separation=function(t){return arguments.length?(e=t,i):e},i.size=function(e){return arguments.length?(r=!1,t=+e[0],n=+e[1],i):r?null:[t,n]},i.nodeSize=function(e){return arguments.length?(r=!0,t=+e[0],n=+e[1],i):r?[t,n]:null},i}function WS(e){var t=0,n=e.children,r=n&&n.length;if(r)for(;--r>=0;)t+=n[r].value;else t=1;e.value=t}function LS(e,t){e instanceof Map?(e=[void 0,e],void 0===t&&(t=VS)):void 0===t&&(t=HS);for(var n,r,i,o,s,a=new ZS(e),l=[a];n=l.pop();)if((i=t(n.data))&&(s=(i=Array.from(i)).length))for(n.children=i,o=s-1;o>=0;--o)l.push(r=i[o]=new ZS(i[o])),r.parent=n,r.depth=n.depth+1;return a.eachBefore(jS)}function HS(e){return e.children}function VS(e){return Array.isArray(e)?e[1]:null}function BS(e){void 0!==e.data.value&&(e.value=e.data.value),e.data=e.data.data}function jS(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function ZS(e){this.data=e,this.depth=this.height=0,this.parent=null}function XS(e){return null==e?null:FS(e)}function FS(e){if("function"!=typeof e)throw new Error;return e}function YS(){return 0}function qS(e){return function(){return e}}xS.invert=function(e,t){for(var n,r=t,i=r*r,o=i*i*i,s=0;s<12&&(o=(i=(r-=n=(r*(bS+vS*i+o*(yS+OS*i))-t)/(bS+3*vS*i+o*(7*yS+9*OS*i)))*r)*i*i,!(Vv(n)zv&&--i>0);return[e/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},ES.invert=nS(ny),PS.invert=nS((function(e){return 2*Bv(e)})),$S.invert=function(e,t){return[-t,2*Bv(Fv(e))-Nv]},ZS.prototype=LS.prototype={constructor:ZS,count:function(){return this.eachAfter(WS)},each:function(e,t){let n=-1;for(const r of this)e.call(t,r,++n,this);return this},eachAfter:function(e,t){for(var n,r,i,o=this,s=[o],a=[],l=-1;o=s.pop();)if(a.push(o),n=o.children)for(r=0,i=n.length;r=0;--r)o.push(n[r]);return this},find:function(e,t){let n=-1;for(const r of this)if(e.call(t,r,++n,this))return r},sum:function(e){return this.eachAfter((function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n}))},sort:function(e){return this.eachBefore((function(t){t.children&&t.children.sort(e)}))},path:function(e){for(var t=this,n=function(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){return Array.from(this)},leaves:function(){var e=[];return this.eachBefore((function(t){t.children||e.push(t)})),e},links:function(){var e=this,t=[];return e.each((function(n){n!==e&&t.push({source:n.parent,target:n})})),t},copy:function(){return LS(this).eachBefore(BS)},[Symbol.iterator]:function*(){var e,t,n,r,i=this,o=[i];do{for(e=o.reverse(),o=[];i=e.pop();)if(yield i,t=i.children)for(n=0,r=t.length;n(e=(US*e+GS)%KS)/KS}function ek(e){return tk(e,JS())}function tk(e,t){for(var n,r,i=0,o=(e=function(e,t){let n,r,i=e.length;for(;i;)r=t()*i--|0,n=e[i],e[i]=e[r],e[r]=n;return e}(Array.from(e),t)).length,s=[];i0&&n*n>r*r+i*i}function ok(e,t){for(var n=0;n1e-6?(T+Math.sqrt(T*T-4*_*R))/(2*_):R/T);return{x:r+x+S*E,y:i+k+C*E,r:E}}function ck(e,t,n){var r,i,o,s,a=e.x-t.x,l=e.y-t.y,c=a*a+l*l;c?(i=t.r+n.r,i*=i,s=e.r+n.r,i>(s*=s)?(r=(c+s-i)/(2*c),o=Math.sqrt(Math.max(0,s/c-r*r)),n.x=e.x-r*a-o*l,n.y=e.y-r*l+o*a):(r=(c+i-s)/(2*c),o=Math.sqrt(Math.max(0,i/c-r*r)),n.x=t.x+r*a-o*l,n.y=t.y+r*l+o*a)):(n.x=t.x+n.r,n.y=t.y)}function hk(e,t){var n=e.r+t.r-1e-6,r=t.x-e.x,i=t.y-e.y;return n>0&&n*n>r*r+i*i}function uk(e){var t=e._,n=e.next._,r=t.r+n.r,i=(t.x*n.r+n.x*t.r)/r,o=(t.y*n.r+n.y*t.r)/r;return i*i+o*o}function dk(e){this._=e,this.next=null,this.previous=null}function fk(e,t){if(!(s=(n=e,e="object"==typeof n&&"length"in n?n:Array.from(n)).length))return 0;var n,r,i,o,s,a,l,c,h,u,d,f;if((r=e[0]).x=0,r.y=0,!(s>1))return r.r;if(i=e[1],r.x=-i.r,i.x=r.r,i.y=0,!(s>2))return r.r+i.r;ck(i,r,o=e[2]),r=new dk(r),i=new dk(i),o=new dk(o),r.next=o.previous=i,i.next=r.previous=o,o.next=i.previous=r;e:for(c=3;cfunction(e){let t=(e=`${e}`).length;return Mk(e,t-1)&&!Mk(e,t-2)&&(e=e.slice(0,-1)),"/"===e[0]?e:`/${e}`}(e(t,n,r)))),n=t.map(Ek),i=new Set(t).add("");for(const e of n)i.has(e)||(i.add(e),t.push(e),n.push(Ek(e)),d.push(Ck));f=(e,n)=>t[n],p=(e,t)=>n[t]}for(s=0,i=d.length;s=0&&(c=d[e]).data===Ck;--e)c.data=null}if(a.parent=Sk,a.eachBefore((function(e){e.depth=e.parent.depth+1,--i})).eachBefore(jS),a.parent=null,i>0)throw new Error("cycle");return a}return r.id=function(e){return arguments.length?(t=XS(e),r):t},r.parentId=function(e){return arguments.length?(n=XS(e),r):n},r.path=function(t){return arguments.length?(e=XS(t),r):e},r}function Ek(e){let t=e.length;if(t<2)return"";for(;--t>1&&!Mk(e,t););return e.slice(0,t)}function Mk(e,t){if("/"===e[t]){let n=0;for(;t>0&&"\\"===e[--t];)++n;if(!(1&n))return!0}return!1}function Pk(e,t){return e.parent===t.parent?1:2}function Ak(e){var t=e.children;return t?t[0]:e.t}function $k(e){var t=e.children;return t?t[t.length-1]:e.t}function zk(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function Qk(e,t,n){return e.a.parent===t.parent?e.a:n}function Ik(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}function Nk(){var e=Pk,t=1,n=1,r=null;function i(i){var l=function(e){for(var t,n,r,i,o,s=new Ik(e,0),a=[s];t=a.pop();)if(r=t._.children)for(t.children=new Array(o=r.length),i=o-1;i>=0;--i)a.push(n=t.children[i]=new Ik(r[i],i)),n.parent=t;return(s.parent=new Ik(null,0)).children=[s],s}(i);if(l.eachAfter(o),l.parent.m=-l.z,l.eachBefore(s),r)i.eachBefore(a);else{var c=i,h=i,u=i;i.eachBefore((function(e){e.xh.x&&(h=e),e.depth>u.depth&&(u=e)}));var d=c===h?1:e(c,h)/2,f=d-c.x,p=t/(h.x+d+f),g=n/(u.depth||1);i.eachBefore((function(e){e.x=(e.x+f)*p,e.y=e.depth*g}))}return i}function o(t){var n=t.children,r=t.parent.children,i=t.i?r[t.i-1]:null;if(n){!function(e){for(var t,n=0,r=0,i=e.children,o=i.length;--o>=0;)(t=i[o]).z+=n,t.m+=n,n+=t.s+(r+=t.c)}(t);var o=(n[0].z+n[n.length-1].z)/2;i?(t.z=i.z+e(t._,i._),t.m=t.z-o):t.z=o}else i&&(t.z=i.z+e(t._,i._));t.parent.A=function(t,n,r){if(n){for(var i,o=t,s=t,a=n,l=o.parent.children[0],c=o.m,h=s.m,u=a.m,d=l.m;a=$k(a),o=Ak(o),a&&o;)l=Ak(l),(s=$k(s)).a=t,(i=a.z+u-o.z-c+e(a._,o._))>0&&(zk(Qk(a,t,r),t,i),c+=i,h+=i),u+=a.m,c+=o.m,d+=l.m,h+=s.m;a&&!$k(s)&&(s.t=a,s.m+=u-h),o&&!Ak(l)&&(l.t=o,l.m+=c-d,r=t)}return r}(t,i,t.parent.A||r[0])}function s(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function a(e){e.x*=t,e.y=e.depth*n}return i.separation=function(t){return arguments.length?(e=t,i):e},i.size=function(e){return arguments.length?(r=!1,t=+e[0],n=+e[1],i):r?null:[t,n]},i.nodeSize=function(e){return arguments.length?(r=!0,t=+e[0],n=+e[1],i):r?[t,n]:null},i}function Dk(e,t,n,r,i){for(var o,s=e.children,a=-1,l=s.length,c=e.value&&(i-n)/e.value;++ad&&(d=a),m=h*h*g,(f=Math.max(d/m,m/u))>p){h-=a;break}p=f}b.push(s={value:h,dice:l1?t:1)},n}(Wk);function Vk(){var e=Hk,t=!1,n=1,r=1,i=[0],o=YS,s=YS,a=YS,l=YS,c=YS;function h(e){return e.x0=e.y0=0,e.x1=n,e.y1=r,e.eachBefore(u),i=[0],t&&e.eachBefore(Ok),e}function u(t){var n=i[t.depth],r=t.x0+n,h=t.y0+n,u=t.x1-n,d=t.y1-n;u=n-1){var h=a[t];return h.x0=i,h.y0=o,h.x1=s,void(h.y1=l)}for(var u=c[t],d=r/2+u,f=t+1,p=n-1;f>>1;c[g]l-o){var v=r?(i*b+s*m)/r:s;e(t,f,m,i,o,v,l),e(f,n,b,v,o,s,l)}else{var y=r?(o*b+l*m)/r:l;e(t,f,m,i,o,s,y),e(f,n,b,i,y,s,l)}}(0,l,e.value,t,n,r,i)}function jk(e,t,n,r,i){(1&e.depth?Dk:wk)(e,t,n,r,i)}const Zk=function e(t){function n(e,n,r,i,o){if((s=e._squarify)&&s.ratio===t)for(var s,a,l,c,h,u=-1,d=s.length,f=e.value;++u1?t:1)},n}(Wk);function Xk(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}function Fk(e,t){var n=Vu(+e,+t);return function(e){var t=n(e);return t-360*Math.floor(t/360)}}function Yk(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function qk(e){return((e=Math.exp(e))+1/e)/2}const Uk=function e(t,n,r){function i(e,i){var o,s,a=e[0],l=e[1],c=e[2],h=i[0],u=i[1],d=i[2],f=h-a,p=u-l,g=f*f+p*p;if(g<1e-12)s=Math.log(d/c)/t,o=function(e){return[a+e*f,l+e*p,c*Math.exp(t*e*s)]};else{var m=Math.sqrt(g),b=(d*d-c*c+r*g)/(2*c*n*m),v=(d*d-c*c-r*g)/(2*d*n*m),y=Math.log(Math.sqrt(b*b+1)-b),O=Math.log(Math.sqrt(v*v+1)-v);s=(O-y)/t,o=function(e){var r,i=e*s,o=qk(y),h=c/(n*m)*(o*(r=t*i+y,((r=Math.exp(2*r))-1)/(r+1))-function(e){return((e=Math.exp(e))-1/e)/2}(y));return[a+h*f,l+h*p,c*o/qk(t*i+y)]}}return o.duration=1e3*s*t/Math.SQRT2,o}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i}(Math.SQRT2,2,4);function Gk(e){return function(t,n){var r=e((t=Au(t)).h,(n=Au(n)).h),i=Bu(t.s,n.s),o=Bu(t.l,n.l),s=Bu(t.opacity,n.opacity);return function(e){return t.h=r(e),t.s=i(e),t.l=o(e),t.opacity=s(e),t+""}}}const Kk=Gk(Vu);var Jk=Gk(Bu);function eC(e,t){var n=Bu((e=jp(e)).l,(t=jp(t)).l),r=Bu(e.a,t.a),i=Bu(e.b,t.b),o=Bu(e.opacity,t.opacity);return function(t){return e.l=n(t),e.a=r(t),e.b=i(t),e.opacity=o(t),e+""}}function tC(e){return function(t,n){var r=e((t=Kp(t)).h,(n=Kp(n)).h),i=Bu(t.c,n.c),o=Bu(t.l,n.l),s=Bu(t.opacity,n.opacity);return function(e){return t.h=r(e),t.c=i(e),t.l=o(e),t.opacity=s(e),t+""}}}const nC=tC(Vu);var rC=tC(Bu);function iC(e){return function t(n){function r(t,r){var i=e((t=cg(t)).h,(r=cg(r)).h),o=Bu(t.s,r.s),s=Bu(t.l,r.l),a=Bu(t.opacity,r.opacity);return function(e){return t.h=i(e),t.s=o(e),t.l=s(Math.pow(e,n)),t.opacity=a(e),t+""}}return n=+n,r.gamma=t,r}(1)}const oC=iC(Vu);var sC=iC(Bu);function aC(e,t){void 0===t&&(t=e,e=id);for(var n=0,r=t.length-1,i=t[0],o=new Array(r<0?0:r);n1&&uC(e[n[i-2]],e[n[i-1]],e[r])<=0;)--i;n[i++]=r}return n.slice(0,i)}function pC(e){if((n=e.length)<3)return null;var t,n,r=new Array(n),i=new Array(n);for(t=0;t=0;--t)c.push(e[r[o[t]][2]]);for(t=+a;ta!=c>a&&s<(l-n)*(a-r)/(c-r)+n&&(h=!h),l=n,c=r;return h}function mC(e){for(var t,n,r=-1,i=e.length,o=e[i-1],s=o[0],a=o[1],l=0;++r1);return e+n*o*Math.sqrt(-2*Math.log(i)/i)}}return n.source=e,n}(bC),wC=function e(t){var n=OC.source(t);function r(){var e=n.apply(this,arguments);return function(){return Math.exp(e())}}return r.source=e,r}(bC),xC=function e(t){function n(e){return(e=+e)<=0?()=>0:function(){for(var n=0,r=e;r>1;--r)n+=t();return n+r*t()}}return n.source=e,n}(bC),SC=function e(t){var n=xC.source(t);function r(e){if(0==(e=+e))return t;var r=n(e);return function(){return r()/e}}return r.source=e,r}(bC),kC=function e(t){function n(e){return function(){return-Math.log1p(-t())/e}}return n.source=e,n}(bC),CC=function e(t){function n(e){if((e=+e)<0)throw new RangeError("invalid alpha");return e=1/-e,function(){return Math.pow(1-t(),e)}}return n.source=e,n}(bC),_C=function e(t){function n(e){if((e=+e)<0||e>1)throw new RangeError("invalid p");return function(){return Math.floor(t()+e)}}return n.source=e,n}(bC),TC=function e(t){function n(e){if((e=+e)<0||e>1)throw new RangeError("invalid p");return 0===e?()=>1/0:1===e?()=>1:(e=Math.log1p(-e),function(){return 1+Math.floor(Math.log1p(-t())/e)})}return n.source=e,n}(bC),RC=function e(t){var n=OC.source(t)();function r(e,r){if((e=+e)<0)throw new RangeError("invalid k");if(0===e)return()=>0;if(r=null==r?1:+r,1===e)return()=>-Math.log1p(-t())*r;var i=(e<1?e+1:e)-1/3,o=1/(3*Math.sqrt(i)),s=e<1?()=>Math.pow(t(),1/e):()=>1;return function(){do{do{var e=n(),a=1+o*e}while(a<=0);a*=a*a;var l=1-t()}while(l>=1-.0331*e*e*e*e&&Math.log(l)>=.5*e*e+i*(1-a+Math.log(a)));return i*a*s()*r}}return r.source=e,r}(bC),EC=function e(t){var n=RC.source(t);function r(e,t){var r=n(e),i=n(t);return function(){var e=r();return 0===e?0:e/(e+i())}}return r.source=e,r}(bC),MC=function e(t){var n=TC.source(t),r=EC.source(t);function i(e,t){return e=+e,(t=+t)>=1?()=>e:t<=0?()=>0:function(){for(var i=0,o=e,s=t;o*s>16&&o*(1-s)>16;){var a=Math.floor((o+1)*s),l=r(a,o-a+1)();l<=s?(i+=a,o-=a,s=(s-l)/(1-l)):(o=a-1,s/=l)}for(var c=s<.5,h=n(c?s:1-s),u=h(),d=0;u<=o;++d)u+=h();return i+(c?d:o-d)}}return i.source=e,i}(bC),PC=function e(t){function n(e,n,r){var i;return 0==(e=+e)?i=e=>-Math.log(e):(e=1/e,i=t=>Math.pow(t,e)),n=null==n?0:+n,r=null==r?1:+r,function(){return n+r*i(-Math.log1p(-t()))}}return n.source=e,n}(bC),AC=function e(t){function n(e,n){return e=null==e?0:+e,n=null==n?1:+n,function(){return e+n*Math.tan(Math.PI*t())}}return n.source=e,n}(bC),$C=function e(t){function n(e,n){return e=null==e?0:+e,n=null==n?1:+n,function(){var r=t();return e+n*Math.log(r/(1-r))}}return n.source=e,n}(bC),zC=function e(t){var n=RC.source(t),r=MC.source(t);function i(e){return function(){for(var i=0,o=e;o>16;){var s=Math.floor(.875*o),a=n(s)();if(a>o)return i+r(s-1,o/a)();i+=s,o-=a}for(var l=-Math.log1p(-t()),c=0;l<=o;++c)l-=Math.log1p(-t());return i+c}}return i.source=e,i}(bC),QC=1664525,IC=1013904223,NC=1/4294967296;function DC(e=Math.random()){let t=0|(0<=e&&e<1?e/NC:Math.abs(e));return()=>(t=QC*t+IC|0,NC*(t>>>0))}function WC(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function LC(e,t){switch(arguments.length){case 0:break;case 1:"function"==typeof e?this.interpolator(e):this.range(e);break;default:this.domain(e),"function"==typeof t?this.interpolator(t):this.range(t)}return this}const HC=Symbol("implicit");function VC(){var e=new La,t=[],n=[],r=HC;function i(i){let o=e.get(i);if(void 0===o){if(r!==HC)return r;e.set(i,o=t.push(i)-1)}return n[o%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new La;for(const r of n)e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return VC(t,n).unknown(r)},WC.apply(i,arguments),i}function BC(){var e,t,n=VC().unknown(void 0),r=n.domain,i=n.range,o=0,s=1,a=!1,l=0,c=0,h=.5;function u(){var n=r().length,u=st&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}(s[0],s[e-1])),r=e>2?GC:UC,i=o=null,u}function u(t){return null==t||isNaN(t=+t)?n:(i||(i=r(s.map(e),a,l)))(e(c(t)))}return u.invert=function(n){return c(t((o||(o=r(a,s.map(e),Ju)))(n)))},u.domain=function(e){return arguments.length?(s=Array.from(e,XC),h()):s.slice()},u.range=function(e){return arguments.length?(a=Array.from(e),h()):a.slice()},u.rangeRound=function(e){return a=Array.from(e),l=Yk,h()},u.clamp=function(e){return arguments.length?(c=!!e||YC,h()):c!==YC},u.interpolate=function(e){return arguments.length?(l=e,h()):l},u.unknown=function(e){return arguments.length?(n=e,u):n},function(n,r){return e=n,t=r,h()}}function e_(){return JC()(YC,YC)}function t_(e,t,n,r){var i,o=vl(e,t,n);switch((r=yv(null==r?",f":r)).type){case"s":var s=Math.max(Math.abs(e),Math.abs(t));return null!=r.precision||isNaN(i=Av(o,s))||(r.precision=i),_v(r,s);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=$v(o,Math.max(Math.abs(e),Math.abs(t))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=Pv(o))||(r.precision=i-2*("%"===r.type))}return Cv(r)}function n_(e){var t=e.domain;return e.ticks=function(e){var n=t();return ml(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var r=t();return t_(r[0],r[r.length-1],null==e?10:e,n)},e.nice=function(n){null==n&&(n=10);var r,i,o=t(),s=0,a=o.length-1,l=o[s],c=o[a],h=10;for(c0;){if((i=bl(l,c,n))===r)return o[s]=l,o[a]=c,t(o);if(i>0)l=Math.floor(l/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,c=Math.floor(c*i)/i}r=i}return e},e}function r_(){var e=e_();return e.copy=function(){return KC(e,r_())},WC.apply(e,arguments),n_(e)}function i_(e){var t;function n(e){return null==e||isNaN(e=+e)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,XC),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return i_(e).unknown(t)},e=arguments.length?Array.from(e,XC):[0,1],n_(n)}function o_(e,t){var n,r=0,i=(e=e.slice()).length-1,o=e[r],s=e[i];return s-e(-t,n)}function d_(e){const t=e(s_,a_),n=t.domain;let r,i,o=10;function s(){return r=function(e){return e===Math.E?Math.log:10===e&&Math.log10||2===e&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}(o),i=function(e){return 10===e?h_:e===Math.E?Math.exp:t=>Math.pow(e,t)}(o),n()[0]<0?(r=u_(r),i=u_(i),e(l_,c_)):e(s_,a_),t}return t.base=function(e){return arguments.length?(o=+e,s()):o},t.domain=function(e){return arguments.length?(n(e),s()):n()},t.ticks=e=>{const t=n();let s=t[0],a=t[t.length-1];const l=a0){for(;u<=d;++u)for(c=1;ca)break;p.push(h)}}else for(;u<=d;++u)for(c=o-1;c>=1;--c)if(h=u>0?c/i(-u):c*i(u),!(ha)break;p.push(h)}2*p.length{if(null==e&&(e=10),null==n&&(n=10===o?"s":","),"function"!=typeof n&&(o%1||null!=(n=yv(n)).precision||(n.trim=!0),n=Cv(n)),e===1/0)return n;const s=Math.max(1,o*e/t.ticks().length);return e=>{let t=e/i(Math.round(r(e)));return t*on(o_(n(),{floor:e=>i(Math.floor(r(e))),ceil:e=>i(Math.ceil(r(e)))})),t}function f_(){const e=d_(JC()).domain([1,10]);return e.copy=()=>KC(e,f_()).base(e.base()),WC.apply(e,arguments),e}function p_(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function g_(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function m_(e){var t=1,n=e(p_(t),g_(t));return n.constant=function(n){return arguments.length?e(p_(t=+n),g_(t)):t},n_(n)}function b_(){var e=m_(JC());return e.copy=function(){return KC(e,b_()).constant(e.constant())},WC.apply(e,arguments)}function v_(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function y_(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function O_(e){return e<0?-e*e:e*e}function w_(e){var t=e(YC,YC),n=1;return t.exponent=function(t){return arguments.length?1==(n=+t)?e(YC,YC):.5===n?e(y_,O_):e(v_(n),v_(1/n)):n},n_(t)}function x_(){var e=w_(JC());return e.copy=function(){return KC(e,x_()).exponent(e.exponent())},WC.apply(e,arguments),e}function S_(){return x_.apply(null,arguments).exponent(.5)}function k_(e){return Math.sign(e)*e*e}function C_(){var e,t=e_(),n=[0,1],r=!1;function i(n){var i=function(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}(t(n));return isNaN(i)?e:r?Math.round(i):i}return i.invert=function(e){return t.invert(k_(e))},i.domain=function(e){return arguments.length?(t.domain(e),i):t.domain()},i.range=function(e){return arguments.length?(t.range((n=Array.from(e,XC)).map(k_)),i):n.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(r=!!e,i):r},i.clamp=function(e){return arguments.length?(t.clamp(e),i):t.clamp()},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return C_(t.domain(),n).round(r).clamp(t.clamp()).unknown(e)},WC.apply(i,arguments),n_(i)}function T_(){var e,t=[],n=[],r=[];function i(){var e=0,i=Math.max(1,n.length);for(r=new Array(i-1);++e0?r[i-1]:t[0],i=r?[i[r-1],n]:[i[s-1],i[s]]},s.unknown=function(t){return arguments.length?(e=t,s):s},s.thresholds=function(){return i.slice()},s.copy=function(){return R_().domain([t,n]).range(o).unknown(e)},WC.apply(n_(s),arguments)}function E_(){var e,t=[.5],n=[0,1],r=1;function i(i){return null!=i&&i<=i?n[Oa(t,i,0,r)]:e}return i.domain=function(e){return arguments.length?(t=Array.from(e),r=Math.min(t.length,n.length-1),i):t.slice()},i.range=function(e){return arguments.length?(n=Array.from(e),r=Math.min(t.length,n.length-1),i):n.slice()},i.invertExtent=function(e){var r=n.indexOf(e);return[t[r-1],t[r]]},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return E_().domain(t).range(n).unknown(e)},WC.apply(i,arguments)}const M_=1e3,P_=6e4,A_=36e5,$_=864e5,z_=6048e5,Q_=31536e6,I_=new Date,N_=new Date;function D_(e,t,n,r){function i(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{const t=i(e),n=i.ceil(e);return e-t(t(e=new Date(+e),null==n?1:Math.floor(n)),e),i.range=(n,r,o)=>{const s=[];if(n=i.ceil(n),o=null==o?1:Math.floor(o),!(n0))return s;let a;do{s.push(a=new Date(+n)),t(n,o),e(n)}while(aD_((t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)}),((e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););})),n&&(i.count=(t,r)=>(I_.setTime(+t),N_.setTime(+r),e(I_),e(N_),Math.floor(n(I_,N_))),i.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?i.filter(r?t=>r(t)%e==0:t=>i.count(0,t)%e==0):i:null)),i}const W_=D_((()=>{}),((e,t)=>{e.setTime(+e+t)}),((e,t)=>t-e));W_.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?D_((t=>{t.setTime(Math.floor(t/e)*e)}),((t,n)=>{t.setTime(+t+n*e)}),((t,n)=>(n-t)/e)):W_:null);const L_=W_.range,H_=D_((e=>{e.setTime(e-e.getMilliseconds())}),((e,t)=>{e.setTime(+e+t*M_)}),((e,t)=>(t-e)/M_),(e=>e.getUTCSeconds())),V_=H_.range,B_=D_((e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*M_)}),((e,t)=>{e.setTime(+e+t*P_)}),((e,t)=>(t-e)/P_),(e=>e.getMinutes())),j_=B_.range,Z_=D_((e=>{e.setUTCSeconds(0,0)}),((e,t)=>{e.setTime(+e+t*P_)}),((e,t)=>(t-e)/P_),(e=>e.getUTCMinutes())),X_=Z_.range,F_=D_((e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*M_-e.getMinutes()*P_)}),((e,t)=>{e.setTime(+e+t*A_)}),((e,t)=>(t-e)/A_),(e=>e.getHours())),Y_=F_.range,q_=D_((e=>{e.setUTCMinutes(0,0,0)}),((e,t)=>{e.setTime(+e+t*A_)}),((e,t)=>(t-e)/A_),(e=>e.getUTCHours())),U_=q_.range,G_=D_((e=>e.setHours(0,0,0,0)),((e,t)=>e.setDate(e.getDate()+t)),((e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*P_)/$_),(e=>e.getDate()-1)),K_=G_.range,J_=D_((e=>{e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+t)}),((e,t)=>(t-e)/$_),(e=>e.getUTCDate()-1)),eT=J_.range,tT=D_((e=>{e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+t)}),((e,t)=>(t-e)/$_),(e=>Math.floor(e/$_))),nT=tT.range;function rT(e){return D_((t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)}),((e,t)=>{e.setDate(e.getDate()+7*t)}),((e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*P_)/z_))}const iT=rT(0),oT=rT(1),sT=rT(2),aT=rT(3),lT=rT(4),cT=rT(5),hT=rT(6),uT=iT.range,dT=oT.range,fT=sT.range,pT=aT.range,gT=lT.range,mT=cT.range,bT=hT.range;function vT(e){return D_((t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)}),((e,t)=>(t-e)/z_))}const yT=vT(0),OT=vT(1),wT=vT(2),xT=vT(3),ST=vT(4),kT=vT(5),CT=vT(6),_T=yT.range,TT=OT.range,RT=wT.range,ET=xT.range,MT=ST.range,PT=kT.range,AT=CT.range,$T=D_((e=>{e.setDate(1),e.setHours(0,0,0,0)}),((e,t)=>{e.setMonth(e.getMonth()+t)}),((e,t)=>t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())),(e=>e.getMonth())),zT=$T.range,QT=D_((e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)}),((e,t)=>t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())),(e=>e.getUTCMonth())),IT=QT.range,NT=D_((e=>{e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,t)=>{e.setFullYear(e.getFullYear()+t)}),((e,t)=>t.getFullYear()-e.getFullYear()),(e=>e.getFullYear()));NT.every=e=>isFinite(e=Math.floor(e))&&e>0?D_((t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,n)=>{t.setFullYear(t.getFullYear()+n*e)})):null;const DT=NT.range,WT=D_((e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)}),((e,t)=>t.getUTCFullYear()-e.getUTCFullYear()),(e=>e.getUTCFullYear()));WT.every=e=>isFinite(e=Math.floor(e))&&e>0?D_((t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)})):null;const LT=WT.range;function HT(e,t,n,r,i,o){const s=[[H_,1,M_],[H_,5,5e3],[H_,15,15e3],[H_,30,3e4],[o,1,P_],[o,5,3e5],[o,15,9e5],[o,30,18e5],[i,1,A_],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,$_],[r,2,1728e5],[n,1,z_],[t,1,2592e6],[t,3,7776e6],[e,1,Q_]];function a(t,n,r){const i=Math.abs(n-t)/r,o=fa((([,,e])=>e)).right(s,i);if(o===s.length)return e.every(vl(t/Q_,n/Q_,r));if(0===o)return W_.every(Math.max(vl(t,n,r),1));const[a,l]=s[i/s[o-1][2]=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:mE,s:bE,S:NR,u:DR,U:WR,V:HR,w:VR,W:BR,x:null,X:null,y:jR,Y:XR,Z:YR,"%":gE},O={a:function(e){return s[e.getUTCDay()]},A:function(e){return o[e.getUTCDay()]},b:function(e){return l[e.getUTCMonth()]},B:function(e){return a[e.getUTCMonth()]},c:null,d:qR,e:qR,f:eE,g:uE,G:fE,H:UR,I:GR,j:KR,L:JR,m:tE,M:nE,p:function(e){return i[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:mE,s:bE,S:rE,u:iE,U:oE,V:aE,w:lE,W:cE,x:null,X:null,y:hE,Y:dE,Z:pE,"%":gE},w={a:function(e,t,n){var r=f.exec(t.slice(n));return r?(e.w=p.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(e,t,n){var r=u.exec(t.slice(n));return r?(e.w=d.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(e,t,n){var r=b.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(e,t,n){var r=g.exec(t.slice(n));return r?(e.m=m.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(e,n,r){return k(e,t,n,r)},d:yR,e:yR,f:CR,g:gR,G:pR,H:wR,I:wR,j:OR,L:kR,m:vR,M:xR,p:function(e,t,n){var r=c.exec(t.slice(n));return r?(e.p=h.get(r[0].toLowerCase()),n+r[0].length):-1},q:bR,Q:TR,s:RR,S:SR,u:hR,U:uR,V:dR,w:cR,W:fR,x:function(e,t,r){return k(e,n,t,r)},X:function(e,t,n){return k(e,r,t,n)},y:gR,Y:pR,Z:mR,"%":_R};function x(e,t){return function(n){var r,i,o,s=[],a=-1,l=0,c=e.length;for(n instanceof Date||(n=new Date(+n));++a53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=FT(YT(o.y,0,1))).getUTCDay(),r=i>4||0===i?OT.ceil(r):OT(r),r=J_.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=XT(YT(o.y,0,1))).getDay(),r=i>4||0===i?oT.ceil(r):oT(r),r=G_.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?FT(YT(o.y,0,1)).getUTCDay():XT(YT(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,FT(o)):XT(o)}}function k(e,t,n,r){for(var i,o,s=0,a=t.length,l=n.length;s=l)return-1;if(37===(i=t.charCodeAt(s++))){if(i=t.charAt(s++),!(o=w[i in tR?t.charAt(s++):i])||(r=o(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return y.x=x(n,y),y.X=x(r,y),y.c=x(t,y),O.x=x(n,O),O.X=x(r,O),O.c=x(t,O),{format:function(e){var t=x(e+="",y);return t.toString=function(){return e},t},parse:function(e){var t=S(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=x(e+="",O);return t.toString=function(){return e},t},utcParse:function(e){var t=S(e+="",!0);return t.toString=function(){return e},t}}}var UT,GT,KT,JT,eR,tR={"-":"",_:" ",0:"0"},nR=/^\s*\d+/,rR=/^%/,iR=/[\\^$*+?|[\]().{}]/g;function oR(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",o=i.length;return r+(o[e.toLowerCase(),t])))}function cR(e,t,n){var r=nR.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function hR(e,t,n){var r=nR.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function uR(e,t,n){var r=nR.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function dR(e,t,n){var r=nR.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function fR(e,t,n){var r=nR.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function pR(e,t,n){var r=nR.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function gR(e,t,n){var r=nR.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function mR(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function bR(e,t,n){var r=nR.exec(t.slice(n,n+1));return r?(e.q=3*r[0]-3,n+r[0].length):-1}function vR(e,t,n){var r=nR.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function yR(e,t,n){var r=nR.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function OR(e,t,n){var r=nR.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function wR(e,t,n){var r=nR.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function xR(e,t,n){var r=nR.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function SR(e,t,n){var r=nR.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function kR(e,t,n){var r=nR.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function CR(e,t,n){var r=nR.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function _R(e,t,n){var r=rR.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function TR(e,t,n){var r=nR.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function RR(e,t,n){var r=nR.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function ER(e,t){return oR(e.getDate(),t,2)}function MR(e,t){return oR(e.getHours(),t,2)}function PR(e,t){return oR(e.getHours()%12||12,t,2)}function AR(e,t){return oR(1+G_.count(NT(e),e),t,3)}function $R(e,t){return oR(e.getMilliseconds(),t,3)}function zR(e,t){return $R(e,t)+"000"}function QR(e,t){return oR(e.getMonth()+1,t,2)}function IR(e,t){return oR(e.getMinutes(),t,2)}function NR(e,t){return oR(e.getSeconds(),t,2)}function DR(e){var t=e.getDay();return 0===t?7:t}function WR(e,t){return oR(iT.count(NT(e)-1,e),t,2)}function LR(e){var t=e.getDay();return t>=4||0===t?lT(e):lT.ceil(e)}function HR(e,t){return e=LR(e),oR(lT.count(NT(e),e)+(4===NT(e).getDay()),t,2)}function VR(e){return e.getDay()}function BR(e,t){return oR(oT.count(NT(e)-1,e),t,2)}function jR(e,t){return oR(e.getFullYear()%100,t,2)}function ZR(e,t){return oR((e=LR(e)).getFullYear()%100,t,2)}function XR(e,t){return oR(e.getFullYear()%1e4,t,4)}function FR(e,t){var n=e.getDay();return oR((e=n>=4||0===n?lT(e):lT.ceil(e)).getFullYear()%1e4,t,4)}function YR(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+oR(t/60|0,"0",2)+oR(t%60,"0",2)}function qR(e,t){return oR(e.getUTCDate(),t,2)}function UR(e,t){return oR(e.getUTCHours(),t,2)}function GR(e,t){return oR(e.getUTCHours()%12||12,t,2)}function KR(e,t){return oR(1+J_.count(WT(e),e),t,3)}function JR(e,t){return oR(e.getUTCMilliseconds(),t,3)}function eE(e,t){return JR(e,t)+"000"}function tE(e,t){return oR(e.getUTCMonth()+1,t,2)}function nE(e,t){return oR(e.getUTCMinutes(),t,2)}function rE(e,t){return oR(e.getUTCSeconds(),t,2)}function iE(e){var t=e.getUTCDay();return 0===t?7:t}function oE(e,t){return oR(yT.count(WT(e)-1,e),t,2)}function sE(e){var t=e.getUTCDay();return t>=4||0===t?ST(e):ST.ceil(e)}function aE(e,t){return e=sE(e),oR(ST.count(WT(e),e)+(4===WT(e).getUTCDay()),t,2)}function lE(e){return e.getUTCDay()}function cE(e,t){return oR(OT.count(WT(e)-1,e),t,2)}function hE(e,t){return oR(e.getUTCFullYear()%100,t,2)}function uE(e,t){return oR((e=sE(e)).getUTCFullYear()%100,t,2)}function dE(e,t){return oR(e.getUTCFullYear()%1e4,t,4)}function fE(e,t){var n=e.getUTCDay();return oR((e=n>=4||0===n?ST(e):ST.ceil(e)).getUTCFullYear()%1e4,t,4)}function pE(){return"+0000"}function gE(){return"%"}function mE(e){return+e}function bE(e){return Math.floor(+e/1e3)}function vE(e){return UT=qT(e),GT=UT.format,KT=UT.parse,JT=UT.utcFormat,eR=UT.utcParse,UT}function yE(e){return new Date(e)}function OE(e){return e instanceof Date?+e:+new Date(+e)}function wE(e,t,n,r,i,o,s,a,l,c){var h=e_(),u=h.invert,d=h.domain,f=c(".%L"),p=c(":%S"),g=c("%I:%M"),m=c("%I %p"),b=c("%a %d"),v=c("%b %d"),y=c("%B"),O=c("%Y");function w(e){return(l(e)t(r/(e.length-1))))},n.quantiles=function(t){return Array.from({length:t+1},((n,r)=>El(e,r/t)))},n.copy=function(){return PE(t).domain(e)},LC.apply(n,arguments)}function AE(){var e,t,n,r,i,o,s,a=0,l=.5,c=1,h=1,u=YC,d=!1;function f(e){return isNaN(e=+e)?s:(e=.5+((e=+o(e))-t)*(h*eXu(e[e.length-1]);var GE=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(DE);const KE=UE(GE);var JE=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(DE);const eM=UE(JE);var tM=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(DE);const nM=UE(tM);var rM=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(DE);const iM=UE(rM);var oM=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(DE);const sM=UE(oM);var aM=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(DE);const lM=UE(aM);var cM=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(DE);const hM=UE(cM);var uM=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(DE);const dM=UE(uM);var fM=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(DE);const pM=UE(fM);var gM=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(DE);const mM=UE(gM);var bM=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(DE);const vM=UE(bM);var yM=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(DE);const OM=UE(yM);var wM=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(DE);const xM=UE(wM);var SM=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(DE);const kM=UE(SM);var CM=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(DE);const _M=UE(CM);var TM=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(DE);const RM=UE(TM);var EM=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(DE);const MM=UE(EM);var PM=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(DE);const AM=UE(PM);var $M=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(DE);const zM=UE($M);var QM=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(DE);const IM=UE(QM);var NM=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(DE);const DM=UE(NM);var WM=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(DE);const LM=UE(WM);var HM=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(DE);const VM=UE(HM);var BM=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(DE);const jM=UE(BM);var ZM=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(DE);const XM=UE(ZM);var FM=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(DE);const YM=UE(FM);var qM=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(DE);const UM=UE(qM);function GM(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-e*(35.34-e*(2381.73-e*(6402.7-e*(7024.72-2710.57*e)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+e*(170.73+e*(52.82-e*(131.46-e*(176.58-67.37*e)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+e*(442.36-e*(2482.43-e*(6167.24-e*(6614.94-2475.67*e)))))))+")"}const KM=sC(cg(300,.5,0),cg(-240,.5,1));var JM=sC(cg(-100,.75,.35),cg(80,1.5,.8)),eP=sC(cg(260,.75,.35),cg(80,1.5,.8)),tP=cg();function nP(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return tP.h=360*e-100,tP.s=1.5-1.5*t,tP.l=.8-.9*t,tP+""}var rP=Su(),iP=Math.PI/3,oP=2*Math.PI/3;function sP(e){var t;return e=(.5-e)*Math.PI,rP.r=255*(t=Math.sin(e))*t,rP.g=255*(t=Math.sin(e+iP))*t,rP.b=255*(t=Math.sin(e+oP))*t,rP+""}function aP(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+e*(1172.33-e*(10793.56-e*(33300.12-e*(38394.49-14825.05*e)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+e*(557.33+e*(1225.33-e*(3574.96-e*(1073.77+707.56*e)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+e*(3211.1-e*(15327.97-e*(27814-e*(22569.18-6838.66*e)))))))+")"}function lP(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}const cP=lP(DE("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));var hP=lP(DE("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),uP=lP(DE("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),dP=lP(DE("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function fP(e){return Yh(zh(e).call(document.documentElement))}var pP=0;function gP(){return new mP}function mP(){this._="@"+(++pP).toString(36)}function bP(e,t){return e.target&&(e=od(e),void 0===t&&(t=e.currentTarget),e=e.touches||[e]),Array.from(e,(e=>sd(e,t)))}function vP(e){return"string"==typeof e?new Zh([document.querySelectorAll(e)],[document.documentElement]):new Zh([Nc(e)],jh)}function yP(e){return function(){return e}}mP.prototype=gP.prototype={constructor:mP,get:function(e){for(var t=this._;!(t in e);)if(!(e=e.parentNode))return;return e[t]},set:function(e,t){return e[this._]=t},remove:function(e){return this._ in e&&delete e[this._]},toString:function(){return this._}};const OP=Math.abs,wP=Math.atan2,xP=Math.cos,SP=Math.max,kP=Math.min,CP=Math.sin,_P=Math.sqrt,TP=1e-12,RP=Math.PI,EP=RP/2,MP=2*RP;function PP(e){return e>=1?EP:e<=-1?-EP:Math.asin(e)}function AP(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(null==n)t=null;else{const e=Math.floor(n);if(!(e>=0))throw new RangeError(`invalid digits: ${n}`);t=e}return e},()=>new vp(t)}function $P(e){return e.innerRadius}function zP(e){return e.outerRadius}function QP(e){return e.startAngle}function IP(e){return e.endAngle}function NP(e){return e&&e.padAngle}function DP(e,t,n,r,i,o,s){var a=e-n,l=t-r,c=(s?o:-o)/_P(a*a+l*l),h=c*l,u=-c*a,d=e+h,f=t+u,p=n+h,g=r+u,m=(d+p)/2,b=(f+g)/2,v=p-d,y=g-f,O=v*v+y*y,w=i-o,x=d*g-p*f,S=(y<0?-1:1)*_P(SP(0,w*w*O-x*x)),k=(x*y-v*S)/O,C=(-x*v-y*S)/O,_=(x*y+v*S)/O,T=(-x*v+y*S)/O,R=k-m,E=C-b,M=_-m,P=T-b;return R*R+E*E>M*M+P*P&&(k=_,C=T),{cx:k,cy:C,x01:-h,y01:-u,x11:k*(i/w-1),y11:C*(i/w-1)}}function WP(){var e=$P,t=zP,n=yP(0),r=null,i=QP,o=IP,s=NP,a=null,l=AP(c);function c(){var c,h,u,d=+e.apply(this,arguments),f=+t.apply(this,arguments),p=i.apply(this,arguments)-EP,g=o.apply(this,arguments)-EP,m=OP(g-p),b=g>p;if(a||(a=c=l()),fTP)if(m>MP-TP)a.moveTo(f*xP(p),f*CP(p)),a.arc(0,0,f,p,g,!b),d>TP&&(a.moveTo(d*xP(g),d*CP(g)),a.arc(0,0,d,g,p,b));else{var v,y,O=p,w=g,x=p,S=g,k=m,C=m,_=s.apply(this,arguments)/2,T=_>TP&&(r?+r.apply(this,arguments):_P(d*d+f*f)),R=kP(OP(f-d)/2,+n.apply(this,arguments)),E=R,M=R;if(T>TP){var P=PP(T/d*CP(_)),A=PP(T/f*CP(_));(k-=2*P)>TP?(x+=P*=b?1:-1,S-=P):(k=0,x=S=(p+g)/2),(C-=2*A)>TP?(O+=A*=b?1:-1,w-=A):(C=0,O=w=(p+g)/2)}var $=f*xP(O),z=f*CP(O),Q=d*xP(S),I=d*CP(S);if(R>TP){var N,D=f*xP(w),W=f*CP(w),L=d*xP(x),H=d*CP(x);if(m1?0:u<-1?RP:Math.acos(u))/2),F=_P(N[0]*N[0]+N[1]*N[1]);E=kP(R,(d-F)/(X-1)),M=kP(R,(f-F)/(X+1))}else E=M=0}C>TP?M>TP?(v=DP(L,H,$,z,f,M,b),y=DP(D,W,Q,I,f,M,b),a.moveTo(v.cx+v.x01,v.cy+v.y01),MTP&&k>TP?E>TP?(v=DP(Q,I,D,W,d,-E,b),y=DP($,z,L,H,d,-E,b),a.lineTo(v.cx+v.x01,v.cy+v.y01),E=u;--d)a.point(b[d],v[d]);a.lineEnd(),a.areaEnd()}m&&(b[h]=+e(f,h,c),v[h]=+t(f,h,c),a.point(r?+r(f,h,c):b[h],n?+n(f,h,c):v[h]))}if(p)return a=null,p+""||null}function h(){return XP().defined(i).curve(s).context(o)}return e="function"==typeof e?e:void 0===e?jP:yP(+e),t="function"==typeof t?t:yP(void 0===t?0:+t),n="function"==typeof n?n:void 0===n?ZP:yP(+n),c.x=function(t){return arguments.length?(e="function"==typeof t?t:yP(+t),r=null,c):e},c.x0=function(t){return arguments.length?(e="function"==typeof t?t:yP(+t),c):e},c.x1=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:yP(+e),c):r},c.y=function(e){return arguments.length?(t="function"==typeof e?e:yP(+e),n=null,c):t},c.y0=function(e){return arguments.length?(t="function"==typeof e?e:yP(+e),c):t},c.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:yP(+e),c):n},c.lineX0=c.lineY0=function(){return h().x(e).y(t)},c.lineY1=function(){return h().x(e).y(n)},c.lineX1=function(){return h().x(r).y(t)},c.defined=function(e){return arguments.length?(i="function"==typeof e?e:yP(!!e),c):i},c.curve=function(e){return arguments.length?(s=e,null!=o&&(a=s(o)),c):s},c.context=function(e){return arguments.length?(null==e?o=a=null:a=s(o=e),c):o},c}function YP(e,t){return te?1:t>=e?0:NaN}function qP(e){return e}function UP(){var e=qP,t=YP,n=null,r=yP(0),i=yP(MP),o=yP(0);function s(s){var a,l,c,h,u,d=(s=HP(s)).length,f=0,p=new Array(d),g=new Array(d),m=+r.apply(this,arguments),b=Math.min(MP,Math.max(-MP,i.apply(this,arguments)-m)),v=Math.min(Math.abs(b)/d,o.apply(this,arguments)),y=v*(b<0?-1:1);for(a=0;a0&&(f+=u);for(null!=t?p.sort((function(e,n){return t(g[e],g[n])})):null!=n&&p.sort((function(e,t){return n(s[e],s[t])})),a=0,c=f?(b-d*y)/f:0;a0?u*c:0)+y,g[l]={data:s[l],index:a,value:u,startAngle:m,endAngle:h,padAngle:v};return g}return s.value=function(t){return arguments.length?(e="function"==typeof t?t:yP(+t),s):e},s.sortValues=function(e){return arguments.length?(t=e,n=null,s):t},s.sort=function(e){return arguments.length?(n=e,t=null,s):n},s.startAngle=function(e){return arguments.length?(r="function"==typeof e?e:yP(+e),s):r},s.endAngle=function(e){return arguments.length?(i="function"==typeof e?e:yP(+e),s):i},s.padAngle=function(e){return arguments.length?(o="function"==typeof e?e:yP(+e),s):o},s}VP.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};var GP=JP(BP);function KP(e){this._curve=e}function JP(e){function t(t){return new KP(e(t))}return t._curve=e,t}function eA(e){var t=e.curve;return e.angle=e.x,delete e.x,e.radius=e.y,delete e.y,e.curve=function(e){return arguments.length?t(JP(e)):t()._curve},e}function tA(){return eA(XP().curve(GP))}function nA(){var e=FP().curve(GP),t=e.curve,n=e.lineX0,r=e.lineX1,i=e.lineY0,o=e.lineY1;return e.angle=e.x,delete e.x,e.startAngle=e.x0,delete e.x0,e.endAngle=e.x1,delete e.x1,e.radius=e.y,delete e.y,e.innerRadius=e.y0,delete e.y0,e.outerRadius=e.y1,delete e.y1,e.lineStartAngle=function(){return eA(n())},delete e.lineX0,e.lineEndAngle=function(){return eA(r())},delete e.lineX1,e.lineInnerRadius=function(){return eA(i())},delete e.lineY0,e.lineOuterRadius=function(){return eA(o())},delete e.lineY1,e.curve=function(e){return arguments.length?t(JP(e)):t()._curve},e}function rA(e,t){return[(t=+t)*Math.cos(e-=Math.PI/2),t*Math.sin(e)]}KP.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(e,t){this._curve.point(t*Math.sin(e),t*-Math.cos(e))}};class iA{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}}class oA{constructor(e){this._context=e}lineStart(){this._point=0}lineEnd(){}point(e,t){if(e=+e,t=+t,0===this._point)this._point=1;else{const n=rA(this._x0,this._y0),r=rA(this._x0,this._y0=(this._y0+t)/2),i=rA(e,this._y0),o=rA(e,t);this._context.moveTo(...n),this._context.bezierCurveTo(...r,...i,...o)}this._x0=e,this._y0=t}}function sA(e){return new iA(e,!0)}function aA(e){return new iA(e,!1)}function lA(e){return new oA(e)}function cA(e){return e.source}function hA(e){return e.target}function uA(e){let t=cA,n=hA,r=jP,i=ZP,o=null,s=null,a=AP(l);function l(){let l;const c=LP.call(arguments),h=t.apply(this,c),u=n.apply(this,c);if(null==o&&(s=e(l=a())),s.lineStart(),c[0]=h,s.point(+r.apply(this,c),+i.apply(this,c)),c[0]=u,s.point(+r.apply(this,c),+i.apply(this,c)),s.lineEnd(),l)return s=null,l+""||null}return l.source=function(e){return arguments.length?(t=e,l):t},l.target=function(e){return arguments.length?(n=e,l):n},l.x=function(e){return arguments.length?(r="function"==typeof e?e:yP(+e),l):r},l.y=function(e){return arguments.length?(i="function"==typeof e?e:yP(+e),l):i},l.context=function(t){return arguments.length?(null==t?o=s=null:s=e(o=t),l):o},l}function dA(){return uA(sA)}function fA(){return uA(aA)}function pA(){const e=uA(lA);return e.angle=e.x,delete e.x,e.radius=e.y,delete e.y,e}const gA=_P(3),mA={draw(e,t){const n=.59436*_P(t+kP(t/28,.75)),r=n/2,i=r*gA;e.moveTo(0,n),e.lineTo(0,-n),e.moveTo(-i,-r),e.lineTo(i,r),e.moveTo(-i,r),e.lineTo(i,-r)}},bA={draw(e,t){const n=_P(t/RP);e.moveTo(n,0),e.arc(0,0,n,0,MP)}},vA={draw(e,t){const n=_P(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},yA=_P(1/3),OA=2*yA,wA={draw(e,t){const n=_P(t/OA),r=n*yA;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},xA={draw(e,t){const n=.62625*_P(t);e.moveTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.lineTo(-n,0),e.closePath()}},SA={draw(e,t){const n=.87559*_P(t-kP(t/7,2));e.moveTo(-n,0),e.lineTo(n,0),e.moveTo(0,n),e.lineTo(0,-n)}},kA={draw(e,t){const n=_P(t),r=-n/2;e.rect(r,r,n,n)}},CA={draw(e,t){const n=.4431*_P(t);e.moveTo(n,n),e.lineTo(n,-n),e.lineTo(-n,-n),e.lineTo(-n,n),e.closePath()}},_A=CP(RP/10)/CP(7*RP/10),TA=CP(MP/10)*_A,RA=-xP(MP/10)*_A,EA={draw(e,t){const n=_P(.8908130915292852*t),r=TA*n,i=RA*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){const o=MP*t/5,s=xP(o),a=CP(o);e.lineTo(a*n,-s*n),e.lineTo(s*r-a*i,a*r+s*i)}e.closePath()}},MA=_P(3),PA={draw(e,t){const n=-_P(t/(3*MA));e.moveTo(0,2*n),e.lineTo(-MA*n,-n),e.lineTo(MA*n,-n),e.closePath()}},AA=_P(3),$A={draw(e,t){const n=.6824*_P(t),r=n/2,i=n*AA/2;e.moveTo(0,-n),e.lineTo(i,r),e.lineTo(-i,r),e.closePath()}},zA=-.5,QA=_P(3)/2,IA=1/_P(12),NA=3*(IA/2+1),DA={draw(e,t){const n=_P(t/NA),r=n/2,i=n*IA,o=r,s=n*IA+n,a=-o,l=s;e.moveTo(r,i),e.lineTo(o,s),e.lineTo(a,l),e.lineTo(zA*r-QA*i,QA*r+zA*i),e.lineTo(zA*o-QA*s,QA*o+zA*s),e.lineTo(zA*a-QA*l,QA*a+zA*l),e.lineTo(zA*r+QA*i,zA*i-QA*r),e.lineTo(zA*o+QA*s,zA*s-QA*o),e.lineTo(zA*a+QA*l,zA*l-QA*a),e.closePath()}},WA={draw(e,t){const n=.6189*_P(t-kP(t/6,1.7));e.moveTo(-n,-n),e.lineTo(n,n),e.moveTo(-n,n),e.lineTo(n,-n)}},LA=[bA,vA,wA,kA,EA,PA,DA],HA=[bA,SA,WA,$A,mA,CA,xA];function VA(e,t){let n=null,r=AP(i);function i(){let i;if(n||(n=i=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+""||null}return e="function"==typeof e?e:yP(e||bA),t="function"==typeof t?t:yP(void 0===t?64:+t),i.type=function(t){return arguments.length?(e="function"==typeof t?t:yP(t),i):e},i.size=function(e){return arguments.length?(t="function"==typeof e?e:yP(+e),i):t},i.context=function(e){return arguments.length?(n=null==e?null:e,i):n},i}function BA(){}function jA(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function ZA(e){this._context=e}function XA(e){return new ZA(e)}function FA(e){this._context=e}function YA(e){return new FA(e)}function qA(e){this._context=e}function UA(e){return new qA(e)}function GA(e,t){this._basis=new ZA(e),this._beta=t}ZA.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:jA(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:jA(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},FA.prototype={areaStart:BA,areaEnd:BA,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:jA(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},qA.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:jA(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},GA.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r,i=e[0],o=t[0],s=e[n]-i,a=t[n]-o,l=-1;++l<=n;)r=l/n,this._basis.point(this._beta*e[l]+(1-this._beta)*(i+r*s),this._beta*t[l]+(1-this._beta)*(o+r*a));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};const KA=function e(t){function n(e){return 1===t?new ZA(e):new GA(e,t)}return n.beta=function(t){return e(+t)},n}(.85);function JA(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function e$(e,t){this._context=e,this._k=(1-t)/6}e$.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:JA(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:JA(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const t$=function e(t){function n(e){return new e$(e,t)}return n.tension=function(t){return e(+t)},n}(0);function n$(e,t){this._context=e,this._k=(1-t)/6}n$.prototype={areaStart:BA,areaEnd:BA,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:JA(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const r$=function e(t){function n(e){return new n$(e,t)}return n.tension=function(t){return e(+t)},n}(0);function i$(e,t){this._context=e,this._k=(1-t)/6}i$.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:JA(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const o$=function e(t){function n(e){return new i$(e,t)}return n.tension=function(t){return e(+t)},n}(0);function s$(e,t,n){var r=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>TP){var a=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,l=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*a-e._x0*e._l12_2a+e._x2*e._l01_2a)/l,i=(i*a-e._y0*e._l12_2a+e._y2*e._l01_2a)/l}if(e._l23_a>TP){var c=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,h=3*e._l23_a*(e._l23_a+e._l12_a);o=(o*c+e._x1*e._l23_2a-t*e._l12_2a)/h,s=(s*c+e._y1*e._l23_2a-n*e._l12_2a)/h}e._context.bezierCurveTo(r,i,o,s,e._x2,e._y2)}function a$(e,t){this._context=e,this._alpha=t}a$.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:s$(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const l$=function e(t){function n(e){return t?new a$(e,t):new e$(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function c$(e,t){this._context=e,this._alpha=t}c$.prototype={areaStart:BA,areaEnd:BA,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:s$(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const h$=function e(t){function n(e){return t?new c$(e,t):new n$(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function u$(e,t){this._context=e,this._alpha=t}u$.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:s$(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const d$=function e(t){function n(e){return t?new u$(e,t):new i$(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function f$(e){this._context=e}function p$(e){return new f$(e)}function g$(e){return e<0?-1:1}function m$(e,t,n){var r=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(r||i<0&&-0),s=(n-e._y1)/(i||r<0&&-0),a=(o*i+s*r)/(r+i);return(g$(o)+g$(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function b$(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function v$(e,t,n){var r=e._x0,i=e._y0,o=e._x1,s=e._y1,a=(o-r)/3;e._context.bezierCurveTo(r+a,i+a*t,o-a,s-a*n,o,s)}function y$(e){this._context=e}function O$(e){this._context=new w$(e)}function w$(e){this._context=e}function x$(e){return new y$(e)}function S$(e){return new O$(e)}function k$(e){this._context=e}function C$(e){var t,n,r=e.length-1,i=new Array(r),o=new Array(r),s=new Array(r);for(i[0]=0,o[0]=2,s[0]=e[0]+2*e[1],t=1;t=0;--t)i[t]=(s[t]-i[t+1])/o[t];for(o[r-1]=(e[r]+i[r-1])/2,t=0;t1)for(var n,r,i,o=1,s=e[t[0]],a=s.length;o=0;)n[t]=t;return n}function $$(e,t){return e[t]}function z$(e){const t=[];return t.key=e,t}function Q$(){var e=yP([]),t=A$,n=P$,r=$$;function i(i){var o,s,a=Array.from(e.apply(this,arguments),z$),l=a.length,c=-1;for(const e of i)for(o=0,++c;o0){for(var n,r,i,o=0,s=e[0].length;o0)for(var n,r,i,o,s,a,l=0,c=e[t[0]].length;l0?(r[0]=o,r[1]=o+=i):i<0?(r[1]=s,r[0]=s+=i):(r[0]=0,r[1]=i)}function D$(e,t){if((n=e.length)>0){for(var n,r=0,i=e[t[0]],o=i.length;r0&&(r=(n=e[t[0]]).length)>0){for(var n,r,i,o=0,s=1;so&&(o=t,r=n);return r}function V$(e){var t=e.map(B$);return A$(e).sort((function(e,n){return t[e]-t[n]}))}function B$(e){for(var t,n=0,r=-1,i=e.length;++r=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};var F$="%Y-%m-%dT%H:%M:%S.%LZ",Y$=Date.prototype.toISOString?function(e){return e.toISOString()}:JT(F$);const q$=Y$;var U$=+new Date("2000-01-01T00:00:00.000Z")?function(e){var t=new Date(e);return isNaN(t)?null:t}:eR(F$);const G$=U$;function K$(e,t,n){var r=new Od,i=t;return null==t?(r.restart(e,t,n),r):(r._restart=r.restart,r.restart=function(e,t,n){t=+t,n=null==n?vd():+n,r._restart((function o(s){s+=i,r._restart(o,i+=t,n),e(s)}),t,n)},r.restart(e,t,n),r)}const J$=e=>()=>e;function ez(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function tz(e,t,n){this.k=e,this.x=t,this.y=n}tz.prototype={constructor:tz,scale:function(e){return 1===e?this:new tz(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new tz(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var nz=new tz(1,0,0);function rz(e){for(;!e.__zoom;)if(!(e=e.parentNode))return nz;return e.__zoom}function iz(e){e.stopImmediatePropagation()}function oz(e){e.preventDefault(),e.stopImmediatePropagation()}function sz(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function az(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function lz(){return this.__zoom||nz}function cz(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function hz(){return navigator.maxTouchPoints||"ontouchstart"in this}function uz(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function dz(){var e,t,n,r=sz,i=az,o=uz,s=cz,a=hz,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],h=250,u=Uk,d=zc("start","zoom","end"),f=500,p=150,g=0,m=10;function b(e){e.property("__zoom",lz).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",C).on("dblclick.zoom",_).filter(a).on("touchstart.zoom",T).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",E).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(e,t){return(t=Math.max(l[0],Math.min(l[1],t)))===e.k?e:new tz(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new tz(e.k,r,i)}function O(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function w(e,t,n,r){e.on("start.zoom",(function(){x(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){x(this,arguments).event(r).end()})).tween("zoom",(function(){var e=this,o=arguments,s=x(e,o).event(r),a=i.apply(e,o),l=null==n?O(a):"function"==typeof n?n.apply(e,o):n,c=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),h=e.__zoom,d="function"==typeof t?t.apply(e,o):t,f=u(h.invert(l).concat(c/h.k),d.invert(l).concat(c/d.k));return function(e){if(1===e)e=d;else{var t=f(e),n=c/t[2];e=new tz(n,l[0]-t[0]*n,l[1]-t[1]*n)}s.zoom(null,e)}}))}function x(e,t,n){return!n&&e.__zooming||new S(e,t)}function S(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=i.apply(e,t),this.taps=0}function k(e,...t){if(r.apply(this,arguments)){var n=x(this,t).event(e),i=this.__zoom,a=Math.max(l[0],Math.min(l[1],i.k*Math.pow(2,s.apply(this,arguments)))),h=sd(e);if(n.wheel)n.mouse[0][0]===h[0]&&n.mouse[0][1]===h[1]||(n.mouse[1]=i.invert(n.mouse[0]=h)),clearTimeout(n.wheel);else{if(i.k===a)return;n.mouse=[h,i.invert(h)],Wd(this),n.start()}oz(e),n.wheel=setTimeout((function(){n.wheel=null,n.end()}),p),n.zoom("mouse",o(y(v(i,a),n.mouse[0],n.mouse[1]),n.extent,c))}}function C(e,...t){if(!n&&r.apply(this,arguments)){var i=e.currentTarget,s=x(this,t,!0).event(e),a=Yh(e.view).on("mousemove.zoom",(function(e){if(oz(e),!s.moved){var t=e.clientX-h,n=e.clientY-u;s.moved=t*t+n*n>g}s.event(e).zoom("mouse",o(y(s.that.__zoom,s.mouse[0]=sd(e,i),s.mouse[1]),s.extent,c))}),!0).on("mouseup.zoom",(function(e){a.on("mousemove.zoom mouseup.zoom",null),eu(e.view,s.moved),oz(e),s.event(e).end()}),!0),l=sd(e,i),h=e.clientX,u=e.clientY;Jh(e.view),iz(e),s.mouse=[l,this.__zoom.invert(l)],Wd(this),s.start()}}function _(e,...t){if(r.apply(this,arguments)){var n=this.__zoom,s=sd(e.changedTouches?e.changedTouches[0]:e,this),a=n.invert(s),l=n.k*(e.shiftKey?.5:2),u=o(y(v(n,l),s,a),i.apply(this,t),c);oz(e),h>0?Yh(this).transition().duration(h).call(w,u,s,e):Yh(this).call(b.transform,u,s,e)}}function T(n,...i){if(r.apply(this,arguments)){var o,s,a,l,c=n.touches,h=c.length,u=x(this,i,n.changedTouches.length===h).event(n);for(iz(n),s=0;so&&(o=e[0]),e[1]s&&(s=e[1])}function l(e){switch(e.type){case"GeometryCollection":e.geometries.forEach(l);break;case"Point":a(e.coordinates);break;case"MultiPoint":e.coordinates.forEach(a)}}for(t in e.arcs.forEach((function(e){for(var t,a=-1,l=e.length;++ao&&(o=t[0]),t[1]s&&(s=t[1])})),e.objects)l(e.objects[t]);return[r,i,o,s]}function mz(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map((function(t){return bz(e,t)}))}:bz(e,t)}function bz(e,t){var n=t.id,r=t.bbox,i=null==t.properties?{}:t.properties,o=vz(e,t);return null==n&&null==r?{type:"Feature",properties:i,geometry:o}:null==r?{type:"Feature",id:n,properties:i,geometry:o}:{type:"Feature",id:n,bbox:r,properties:i,geometry:o}}function vz(e,t){var n=pz(e.transform),r=e.arcs;function i(e,t){t.length&&t.pop();for(var i=r[e<0?~e:e],o=0,s=i.length;o1)r=function(e,t,n){var r,i=[],o=[];function s(e){var t=e<0?~e:e;(o[t]||(o[t]=[])).push({i:e,g:r})}function a(e){e.forEach(s)}function l(e){e.forEach(a)}return function e(t){switch(r=t,t.type){case"GeometryCollection":t.geometries.forEach(e);break;case"LineString":a(t.arcs);break;case"MultiLineString":case"Polygon":l(t.arcs);break;case"MultiPolygon":!function(e){e.forEach(l)}(t.arcs)}}(t),o.forEach(null==n?function(e){i.push(e[0].i)}:function(e){n(e[0].g,e[e.length-1].g)&&i.push(e[0].i)}),i}(0,t,n);else for(i=0,r=new Array(o=e.arcs.length);i1)for(var o,a,l=1,c=s(i[0]);lc&&(a=i[0],i[0]=i[l],i[l]=a,c=o);return i})).filter((function(e){return e.length>0}))}}function kz(e,t){for(var n=0,r=e.length;n>>1;e[i]=2))throw new Error("n must be ≥2");var n,r=(a=e.bbox||gz(e))[0],i=a[1],o=a[2],s=a[3];t={scale:[o-r?(o-r)/(n-1):1,s-i?(s-i)/(n-1):1],translate:[r,i]}}var a,l,c=_z(t),h=e.objects,u={};function d(e){return c(e)}function f(e){var t;switch(e.type){case"GeometryCollection":t={type:"GeometryCollection",geometries:e.geometries.map(f)};break;case"Point":t={type:"Point",coordinates:d(e.coordinates)};break;case"MultiPoint":t={type:"MultiPoint",coordinates:e.coordinates.map(d)};break;default:return e}return null!=e.id&&(t.id=e.id),null!=e.bbox&&(t.bbox=e.bbox),null!=e.properties&&(t.properties=e.properties),t}for(l in h)u[l]=f(h[l]);return{type:"Topology",bbox:a,transform:t,objects:u,arcs:e.arcs.map((function(e){var t,n=0,r=1,i=e.length,o=new Array(i);for(o[0]=c(e[0],0);++n>1;if(e=Mz[r]))return!0;t=r+1}if(t==n)return!1}}function Az(e){return e>=127462&&e<=127487}(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((e=>e?parseInt(e,36):1));for(let t=0,n=0;t=0&&Az(Nz(e,r));)n++,r-=2;if(n%2==0)break;t+=2}}}return t}function Iz(e,t,n){for(;t>0;){let r=Qz(e,t-2,n);if(r=56320&&e<57344}function Wz(e){return e>=55296&&e<56320}function Lz(e){return e<65536?1:2}class Hz{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Uz(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),Bz.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Uz(this,e,t);let n=[];return this.decompose(e,t,n,0),Bz.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new Xz(this),i=new Xz(e);for(let e=t,o=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(o+=r.value.length,r.done||o>=n)return!0}}iter(e=1){return new Xz(this,e)}iterRange(e,t=this.length){return new Fz(this,e,t)}iterLines(e,t){let n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Yz(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new Vz(e):Bz.from(Vz.split(e,[])):Hz.empty}}class Vz extends Hz{constructor(e,t=function(e){let t=-1;for(let n of e)t+=n.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let o=this.text[i],s=r+o.length;if((t?n:s)>=e)return new qz(r,s,n,o);r=s+1,n++}}decompose(e,t,n,r){let i=e<=0&&t>=this.length?this:new Vz(Zz(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&r){let e=n.pop(),t=jz(i.text,e.text.slice(),0,i.length);if(t.length<=32)n.push(new Vz(t,e.length+i.length));else{let e=t.length>>1;n.push(new Vz(t.slice(0,e)),new Vz(t.slice(e)))}}else n.push(i)}replace(e,t,n){if(!(n instanceof Vz))return super.replace(e,t,n);[e,t]=Uz(this,e,t);let r=jz(this.text,jz(n.text,Zz(this.text,0,e)),t),i=this.length+n.length-(t-e);return r.length<=32?new Vz(r,i):Bz.from(Vz.split(r,[]),i)}sliceString(e,t=this.length,n="\n"){[e,t]=Uz(this,e,t);let r="";for(let i=0,o=0;i<=t&&oe&&o&&(r+=n),ei&&(r+=s.slice(Math.max(0,e-i),t-i)),i=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],r=-1;for(let i of e)n.push(i),r+=i.length+1,32==n.length&&(t.push(new Vz(n,r)),n=[],r=-1);return r>-1&&t.push(new Vz(n,r)),t}}class Bz extends Hz{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,r){for(let i=0;;i++){let o=this.children[i],s=r+o.length,a=n+o.lines-1;if((t?a:s)>=e)return o.lineInner(e,t,n,r);r=s+1,n=a+1}}decompose(e,t,n,r){for(let i=0,o=0;o<=t&&i=o){let i=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!i?n.push(s):s.decompose(e-o,t-o,n,i)}o=a+1}}replace(e,t,n){if([e,t]=Uz(this,e,t),n.lines=i&&t<=s){let a=o.replace(e-i,t-i,n),l=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>l>>6){let i=this.children.slice();return i[r]=a,new Bz(i,this.length-(t-e)+n.length)}return super.replace(i,s,a)}i=s+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n="\n"){[e,t]=Uz(this,e,t);let r="";for(let i=0,o=0;ie&&i&&(r+=n),eo&&(r+=s.sliceString(e-o,t-o,n)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Bz))return 0;let n=0,[r,i,o,s]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,i+=t){if(r==o||i==s)return n;let a=this.children[r],l=e.children[i];if(a!=l)return n+a.scanIdentical(l,t);n+=a.length+1}}static from(e,t=e.reduce(((e,t)=>e+t.length+1),-1)){let n=0;for(let t of e)n+=t.lines;if(n<32){let n=[];for(let t of e)t.flatten(n);return new Vz(n,t)}let r=Math.max(32,n>>5),i=r<<1,o=r>>1,s=[],a=0,l=-1,c=[];function h(e){let t;if(e.lines>i&&e instanceof Bz)for(let t of e.children)h(t);else e.lines>o&&(a>o||!a)?(u(),s.push(e)):e instanceof Vz&&a&&(t=c[c.length-1])instanceof Vz&&e.lines+t.lines<=32?(a+=e.lines,l+=e.length+1,c[c.length-1]=new Vz(t.text.concat(e.text),t.length+1+e.length)):(a+e.lines>r&&u(),a+=e.lines,l+=e.length+1,c.push(e))}function u(){0!=a&&(s.push(1==c.length?c[0]:Bz.from(c,l)),l=-1,a=c.length=0)}for(let t of e)h(t);return u(),1==s.length?s[0]:new Bz(s,t)}}function jz(e,t,n=0,r=1e9){for(let i=0,o=0,s=!0;o=n&&(l>r&&(a=a.slice(0,r-i)),i0?1:(e instanceof Vz?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],o=i>>1,s=r instanceof Vz?r.text.length:r.children.length;if(o==(t>0?s:0)){if(0==n)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&i)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(r instanceof Vz){let i=r.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,i.length>Math.max(0,e))return this.value=0==e?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=r.children[o+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof Vz?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Fz{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Xz(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class Yz{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(Hz.prototype[Symbol.iterator]=function(){return this.iter()},Xz.prototype[Symbol.iterator]=Fz.prototype[Symbol.iterator]=Yz.prototype[Symbol.iterator]=function(){return this});class qz{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}}function Uz(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}function Gz(e,t,n=!0,r=!0){return zz(e,t,n,r)}function Kz(e,t){let n=e.charCodeAt(t);if(!((r=n)>=55296&&r<56320&&t+1!=e.length))return n;var r;let i=e.charCodeAt(t+1);return function(e){return e>=56320&&e<57344}(i)?i-56320+(n-55296<<10)+65536:n}function Jz(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function eQ(e){return e<65536?1:2}const tQ=/\r\n?|\n/;var nQ=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(nQ||(nQ={}));class rQ{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return i+(e-r);i+=s}else{if(n!=nQ.Simple&&l>=e&&(n==nQ.TrackDel&&re||n==nQ.TrackBefore&&re))return null;if(l>e||l==e&&t<0&&!s)return e==r||t<0?i:i+a;i+=a}r=l}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return i}touchesRange(e,t=e){for(let n=0,r=0;n=0&&r<=t&&i>=e)return!(rt)||"cover";r=i}return!1}toString(){let e="";for(let t=0;t=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some((e=>"number"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeDesc");return new rQ(e)}static create(e){return new rQ(e)}}class iQ extends rQ{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return aQ(this,((t,n,r,i,o)=>e=e.replace(r,r+(n-t),o)),!1),e}mapDesc(e,t=!1){return lQ(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let r=0,i=0;r=0){t[r]=s,t[r+1]=o;let a=r>>1;for(;n.length0&&sQ(n,t,i.text),i.forward(e),s+=e}let l=e[o++];for(;s>1].toJSON()))}return e}static of(e,t,n){let r=[],i=[],o=0,s=null;function a(e=!1){if(!e&&!r.length)return;os||e<0||s>t)throw new RangeError(`Invalid change range ${e} to ${s} (in doc of length ${t})`);let h=c?"string"==typeof c?Hz.of(c.split(n||tQ)):c:Hz.empty,u=h.length;if(e==s&&0==u)return;eo&&oQ(r,e-o,-1),oQ(r,s-e,u),sQ(i,r,h),o=s}}(e),a(!s),s}static empty(e){return new iQ(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let r=0;rt&&"string"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==i.length)t.push(i[0],0);else{for(;n.length=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&0==t&&0==e[i]?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function sQ(e,t,n){if(0==n.length)return;let r=t.length-2>>1;if(r>1])),!(n||s==e.sections.length||e.sections[s+1]<0);)a=e.sections[s++],l=e.sections[s++];t(i,c,o,h,u),i=c,o=h}}}function lQ(e,t,n,r=!1){let i=[],o=r?[]:null,s=new hQ(e),a=new hQ(t);for(let e=-1;;){if(s.done&&a.len||a.done&&s.len)throw new Error("Mismatched change set lengths");if(-1==s.ins&&-1==a.ins){let e=Math.min(s.len,a.len);oQ(i,e,-1),s.forward(e),a.forward(e)}else if(a.ins>=0&&(s.ins<0||e==s.i||0==s.off&&(a.len=0&&e=0)){if(s.done&&a.done)return o?iQ.createSet(i,o):rQ.create(i);throw new Error("Mismatched change set lengths")}{let t=0,n=s.len;for(;n;)if(-1==a.ins){let e=Math.min(n,a.len);t+=e,n-=e,a.forward(e)}else{if(!(0==a.ins&&a.lent||s.ins>=0&&s.len>t)&&(e||r.length>n),o.forward2(t),s.forward(t)}}else oQ(r,0,s.ins,e),i&&sQ(i,r,s.text),s.next()}}class hQ{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?Hz.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?Hz.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class uQ{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}get goalColumn(){let e=this.flags>>6;return 16777215==e?void 0:e}map(e,t=-1){let n,r;return this.empty?n=r=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),n==this.from&&r==this.to?this:new uQ(n,r,this.flags)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return dQ.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return dQ.range(this.anchor,r,void 0,void 0,n)}eq(e,t=!1){return!(this.anchor!=e.anchor||this.head!=e.head||this.goalColumn!=e.goalColumn||t&&this.empty&&this.assoc!=e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid JSON representation for SelectionRange");return dQ.range(e.anchor,e.head)}static create(e,t,n){return new uQ(e,t,n)}}class dQ{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:dQ.create(this.ranges.map((n=>n.map(e,t))),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;ne.toJSON())),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new dQ(e.ranges.map((e=>uQ.fromJSON(e))),e.main)}static single(e,t=e){return new dQ([dQ.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw new RangeError("A selection needs at least one range");for(let n=0,r=0;re.from-t.from)),t=e.indexOf(n);for(let n=1;nr.head?dQ.range(s,o):dQ.range(o,s))}}return new dQ(e,t)}}function fQ(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let pQ=0;class gQ{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=pQ++,this.default=e([]),this.extensions="function"==typeof i?i(this):i}get reader(){return this}static define(e={}){return new gQ(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:mQ),!!e.static,e.enables)}of(e){return new bQ([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new bQ(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new bQ(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],(n=>t(n.field(e))))}}function mQ(e,t){return e==t||e.length==t.length&&e.every(((e,n)=>e===t[n]))}class bQ{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=pQ++}dynamicSlot(e){var t;let n=this.value,r=this.facet.compareInput,i=this.id,o=e[i]>>1,s=2==this.type,a=!1,l=!1,c=[];for(let n of this.dependencies)"doc"==n?a=!0:"selection"==n?l=!0:1&(null!==(t=e[n.id])&&void 0!==t?t:1)||c.push(e[n.id]);return{create:e=>(e.values[o]=n(e),1),update(e,t){if(a&&t.docChanged||l&&(t.docChanged||t.selection)||yQ(e,c)){let t=n(e);if(s?!vQ(t,e.values[o],r):!r(t,e.values[o]))return e.values[o]=t,1}return 0},reconfigure:(e,t)=>{let a,l=t.config.address[i];if(null!=l){let i=MQ(t,l);if(this.dependencies.every((n=>n instanceof gQ?t.facet(n)===e.facet(n):!(n instanceof xQ)||t.field(n,!1)==e.field(n,!1)))||(s?vQ(a=n(e),i,r):r(a=n(e),i)))return e.values[o]=i,0}else a=n(e);return e.values[o]=a,1}}}}function vQ(e,t,n){if(e.length!=t.length)return!1;for(let r=0;re[t.id])),i=n.map((e=>e.type)),o=r.filter((e=>!(1&e))),s=e[t.id]>>1;function a(e){let n=[];for(let t=0;te===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(wQ).find((e=>e.field==this));return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],i=this.updateF(r,n);return this.compareF(r,i)?0:(e.values[t]=i,1)},reconfigure:(e,n)=>{let r,i=e.facet(wQ),o=n.facet(wQ);return(r=i.find((e=>e.field==this)))&&r!=o.find((e=>e.field==this))?(e.values[t]=r.create(e),1):null!=n.config.address[this.id]?(e.values[t]=n.field(this),0):(e.values[t]=this.create(e),1)}}}init(e){return[this,wQ.of({field:this,create:e})]}get extension(){return this}}function SQ(e){return t=>new CQ(t,e)}const kQ={highest:SQ(0),high:SQ(1),default:SQ(2),low:SQ(3),lowest:SQ(4)};class CQ{constructor(e,t){this.inner=e,this.prec=t}}class _Q{of(e){return new TQ(this,e)}reconfigure(e){return _Q.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class TQ{constructor(e,t){this.compartment=e,this.inner=t}}class RQ{constructor(e,t,n,r,i,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=i,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,n){let r=[],i=Object.create(null),o=new Map;for(let n of function(e,t,n){let r=[[],[],[],[],[]],i=new Map;return function e(o,s){let a=i.get(o);if(null!=a){if(a<=s)return;let e=r[a].indexOf(o);e>-1&&r[a].splice(e,1),o instanceof TQ&&n.delete(o.compartment)}if(i.set(o,s),Array.isArray(o))for(let t of o)e(t,s);else if(o instanceof TQ){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let r=t.get(o.compartment)||o.inner;n.set(o.compartment,r),e(r,s)}else if(o instanceof CQ)e(o.inner,o.prec);else if(o instanceof xQ)r[s].push(o),o.provides&&e(o.provides,s);else if(o instanceof bQ)r[s].push(o),o.facet.extensions&&e(o.facet.extensions,2);else{let t=o.extension;if(!t)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);e(t,s)}}(e,2),r.reduce(((e,t)=>e.concat(t)))}(e,t,o))n instanceof xQ?r.push(n):(i[n.facet.id]||(i[n.facet.id]=[])).push(n);let s=Object.create(null),a=[],l=[];for(let e of r)s[e.id]=l.length<<1,l.push((t=>e.slot(t)));let c=null==n?void 0:n.config.facets;for(let e in i){let t=i[e],r=t[0].facet,o=c&&c[e]||[];if(t.every((e=>0==e.type)))if(s[r.id]=a.length<<1|1,mQ(o,t))a.push(n.facet(r));else{let e=r.combine(t.map((e=>e.value)));a.push(n&&r.compare(e,n.facet(r))?n.facet(r):e)}else{for(let e of t)0==e.type?(s[e.id]=a.length<<1|1,a.push(e.value)):(s[e.id]=l.length<<1,l.push((t=>e.dynamicSlot(t))));s[r.id]=l.length<<1,l.push((e=>OQ(e,r,t)))}}let h=l.map((e=>e(s)));return new RQ(e,o,h,s,a,i)}}function EQ(e,t){if(1&t)return 2;let n=t>>1,r=e.status[n];if(4==r)throw new Error("Cyclic dependency between fields and/or facets");if(2&r)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function MQ(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}const PQ=gQ.define(),AQ=gQ.define({combine:e=>e.some((e=>e)),static:!0}),$Q=gQ.define({combine:e=>e.length?e[0]:void 0,static:!0}),zQ=gQ.define(),QQ=gQ.define(),IQ=gQ.define(),NQ=gQ.define({combine:e=>!!e.length&&e[0]});class DQ{constructor(e,t){this.type=e,this.value=t}static define(){return new WQ}}class WQ{of(e){return new DQ(this,e)}}class LQ{constructor(e){this.map=e}of(e){return new HQ(this,e)}}class HQ{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new HQ(this.type,t)}is(e){return this.type==e}static define(e={}){return new LQ(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}}HQ.reconfigure=HQ.define(),HQ.appendConfig=HQ.define();class VQ{constructor(e,t,n,r,i,o){this.startState=e,this.changes=t,this.selection=n,this.effects=r,this.annotations=i,this.scrollIntoView=o,this._doc=null,this._state=null,n&&fQ(n,t.newLength),i.some((e=>e.type==VQ.time))||(this.annotations=i.concat(VQ.time.of(Date.now())))}static create(e,t,n,r,i,o){return new VQ(e,t,n,r,i,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(VQ.userEvent);return!(!t||!(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function BQ(e,t){let n=[];for(let r=0,i=0;;){let o,s;if(r=e[r]))o=e[r++],s=e[r++];else{if(!(i=0;i--){let o=n[i](e);o&&Object.keys(o).length&&(r=jQ(r,ZQ(t,o,e.changes.newLength),!0))}return r==e?e:VQ.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}(n?function(e){let t=e.startState,n=!0;for(let r of t.facet(zQ)){let t=r(e);if(!1===t){n=!1;break}Array.isArray(t)&&(n=!0===n?t:BQ(n,t))}if(!0!==n){let r,i;if(!1===n)i=e.changes.invertedDesc,r=iQ.empty(t.doc.length);else{let t=e.changes.filter(n);r=t.changes,i=t.filtered.mapDesc(t.changes).invertedDesc}e=VQ.create(t,r,e.selection&&e.selection.map(i),HQ.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(QQ);for(let n=r.length-1;n>=0;n--){let i=r[n](e);e=i instanceof VQ?i:Array.isArray(i)&&1==i.length&&i[0]instanceof VQ?i[0]:XQ(t,YQ(i),!1)}return e}(i):i)}VQ.time=DQ.define(),VQ.userEvent=DQ.define(),VQ.addToHistory=DQ.define(),VQ.remote=DQ.define();const FQ=[];function YQ(e){return null==e?FQ:Array.isArray(e)?e:[e]}var qQ=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(qQ||(qQ={}));const UQ=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let GQ;try{GQ=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}class KQ{constructor(e,t,n,r,i,o){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=i,o&&(o._state=this);for(let e=0;ei.set(t,e))),n=null),i.set(t.value.compartment,t.value.extension)):t.is(HQ.reconfigure)?(n=null,r=t.value):t.is(HQ.appendConfig)&&(n=null,r=YQ(r).concat(t.value));n?t=e.startState.values.slice():(n=RQ.resolve(r,i,this),t=new KQ(n,this.doc,this.selection,n.dynamicSlots.map((()=>null)),((e,t)=>t.reconfigure(e,this)),null).values);let o=e.startState.facet(AQ)?e.newSelection:e.newSelection.asSingle();new KQ(n,e.newDoc,o,t,((t,n)=>n.update(t,e)),e)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange((t=>({changes:{from:t.from,to:t.to,insert:e},range:dQ.cursor(t.from+e.length)})))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],o=YQ(n.effects);for(let n=1;ni.spec.fromJSON(o,e))))}return KQ.create({doc:e.doc,selection:dQ.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=RQ.resolve(e.extensions||[],new Map),n=e.doc instanceof Hz?e.doc:Hz.of((e.doc||"").split(t.staticFacet(KQ.lineSeparator)||tQ)),r=e.selection?e.selection instanceof dQ?e.selection:dQ.single(e.selection.anchor,e.selection.head):dQ.single(0);return fQ(r,n.length),t.staticFacet(AQ)||(r=r.asSingle()),new KQ(t,n,r,t.dynamicSlots.map((()=>null)),((e,t)=>t.create(e)),null)}get tabSize(){return this.facet(KQ.tabSize)}get lineBreak(){return this.facet(KQ.lineSeparator)||"\n"}get readOnly(){return this.facet(NQ)}phrase(e,...t){for(let t of this.facet(KQ.phrases))if(Object.prototype.hasOwnProperty.call(t,e)){e=t[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,((e,n)=>{if("$"==n)return"$";let r=+(n||1);return!r||r>t.length?e:t[r-1]}))),e}languageDataAt(e,t,n=-1){let r=[];for(let i of this.facet(PQ))for(let o of i(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return n=t.length?t[0]:"",e=>{if(!/\S/.test(e))return qQ.Space;if(function(e){if(GQ)return GQ.test(e);for(let t=0;t"€"&&(n.toUpperCase()!=n.toLowerCase()||UQ.test(n)))return!0}return!1}(e))return qQ.Word;for(let t=0;t-1)return qQ.Word;return qQ.Other};var n}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),i=this.charCategorizer(e),o=e-n,s=e-n;for(;o>0;){let e=Gz(t,o,!1);if(i(t.slice(e,o))!=qQ.Word)break;o=e}for(;se.length?e[0]:4}),KQ.lineSeparator=$Q,KQ.readOnly=NQ,KQ.phrases=gQ.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every((n=>e[n]==t[n]))}}),KQ.languageData=PQ,KQ.changeFilter=zQ,KQ.transactionFilter=QQ,KQ.transactionExtender=IQ,_Q.reconfigure=HQ.define();class eI{eq(e){return this==e}range(e,t=e){return nI.create(e,t,this)}}function tI(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}eI.prototype.startSide=eI.prototype.endSide=0,eI.prototype.point=!1,eI.prototype.mapMode=nQ.TrackDel;class nI{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new nI(e,t,n)}}function rI(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class iI{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,r=0){let i=n?this.to:this.from;for(let o=r,s=i.length;;){if(o==s)return o;let r=o+s>>1,a=i[r]-e||(n?this.value[r].endSide:this.value[r].startSide)-t;if(r==o)return a>=0?o:s;a>=0?s=r:o=r+1}}between(e,t,n,r){for(let i=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,i);ic||l==c&&h.startSide>0&&h.endSide<=0)continue;(c-l||h.endSide-h.startSide)<0||(o<0&&(o=l),h.point&&(s=Math.max(s,c-l)),n.push(h),r.push(l-o),i.push(c-o))}return{mapped:n.length?new iI(r,i,n,s):null,pos:o}}}class oI{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(e,t,n,r){return new oI(e,t,n,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:r=0,filterTo:i=this.length}=e,o=e.filter;if(0==t.length&&!o)return this;if(n&&(t=t.slice().sort(rI)),this.isEmpty)return t.length?oI.of(t):this;let s=new lI(this,null,-1).goto(0),a=0,l=[],c=new sI;for(;s.value||a=0){let e=t[a++];c.addInner(e.from,e.to,e.value)||l.push(e)}else 1==s.rangeIndex&&s.chunkIndexthis.chunkEnd(s.chunkIndex)||is.to||i=i&&e<=i+o.length&&!1===o.between(i,e-i,t-i,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return cI.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return cI.from(e).goto(t)}static compare(e,t,n,r,i=-1){let o=e.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i)),s=t.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i)),a=aI(o,s,n),l=new uI(o,a,i),c=new uI(s,a,i);n.iterGaps(((e,t,n)=>dI(l,e,c,t,n,r))),n.empty&&0==n.length&&dI(l,0,c,0,0,r)}static eq(e,t,n=0,r){null==r&&(r=999999999);let i=e.filter((e=>!e.isEmpty&&t.indexOf(e)<0)),o=t.filter((t=>!t.isEmpty&&e.indexOf(t)<0));if(i.length!=o.length)return!1;if(!i.length)return!0;let s=aI(i,o),a=new uI(i,s,0).goto(n),l=new uI(o,s,0).goto(n);for(;;){if(a.to!=l.to||!fI(a.active,l.active)||a.point&&(!l.point||!tI(a.point,l.point)))return!1;if(a.to>r)return!0;a.next(),l.next()}}static spans(e,t,n,r,i=-1){let o=new uI(e,null,i).goto(t),s=t,a=o.openStart;for(;;){let e=Math.min(o.to,n);if(o.point){let n=o.activeForPoint(o.to),i=o.pointFroms&&(r.span(s,e,o.active,a),a=o.openEnd(e));if(o.to>n)return a+(o.point&&o.to>n?1:0);s=o.to,o.next()}}static of(e,t=!1){let n=new sI;for(let r of e instanceof nI?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n0)return e.slice().sort(rI);t=r}return e}(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(e){if(!e.length)return oI.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let r=e[n];r!=oI.empty;r=r.nextLayer)t=new oI(r.chunkPos,r.chunk,t,Math.max(r.maxPoint,t.maxPoint));return t}}oI.empty=new oI([],[],null,-1),oI.empty.nextLayer=oI.empty;class sI{finishChunk(e){this.chunks.push(new iI(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new sI)).add(e,t,n)}addInner(e,t,n){let r=e-this.lastTo||n.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(r<0||(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),0))}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(oI.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=oI.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function aI(e,t,n){let r=new Map;for(let t of e)for(let e=0;e=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=n&&r.push(new lI(o,t,n,i));return 1==r.length?r[0]:new cI(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)hI(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)hI(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),hI(this.heap,0)}}}function hI(e,t){for(let n=e[t];;){let r=1+(t<<1);if(r>=e.length)break;let i=e[r];if(r+1=0&&(i=e[r+1],r++),n.compare(i)<0)break;e[r]=n,e[t]=i,t=r}}class uI{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=cI.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){pI(this.active,e),pI(this.activeTo,e),pI(this.activeRank,e),this.minActive=mI(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:r,rank:i}=this.cursor;for(;t0;)t++;gI(this.active,t,n),gI(this.activeTo,t,r),gI(this.activeRank,t,i),e&&gI(e,t,this.cursor.from),this.minActive=mI(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&pI(n,r)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let e=this.cursor.value;if(e.point){if(!(t&&this.cursor.to==this.to&&this.cursor.from=0&&n[t]=0&&!(this.activeRank[n]e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function dI(e,t,n,r,i,o){e.goto(t),n.goto(r);let s=r+i,a=r,l=r-t,c=!!o.boundChange;for(let t=!1;;){let r=e.to+l-n.to,i=r||e.endSide-n.endSide,h=i<0?e.to+l:n.to,u=Math.min(h,s);if(e.point||n.point?(e.point&&n.point&&tI(e.point,n.point)&&fI(e.activeForPoint(e.to),n.activeForPoint(n.to))||o.comparePoint(a,u,e.point,n.point),t=!1):(t&&o.boundChange(a),u>a&&!fI(e.active,n.active)&&o.compareRange(a,u,e.active,n.active),c&&us)break;a=h,i<=0&&e.next(),i>=0&&n.next()}}function fI(e,t){if(e.length!=t.length)return!1;for(let n=0;n=t;n--)e[n+1]=e[n];e[t]=n}function mI(e,t){let n=-1,r=1e9;for(let i=0;i=t)return r;if(r==e.length)break;i+=9==e.charCodeAt(r)?n-i%n:1,r=Gz(e,r)}return!0===r?-1:e.length}const yI="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),OI="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),wI="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class xI{constructor(e,t){this.rules=[];let{finish:n}=t||{};function r(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function i(e,t,o,s){let a=[],l=/^@(\w+)\b/.exec(e[0]),c=l&&"keyframes"==l[1];if(l&&null==t)return o.push(e[0]+";");for(let n in t){let s=t[n];if(/&/.test(n))i(n.split(/,\s*/).map((t=>e.map((e=>t.replace(/&/,e))))).reduce(((e,t)=>e.concat(t))),s,o);else if(s&&"object"==typeof s){if(!l)throw new RangeError("The value of a property ("+n+") should be a primitive value.");i(r(n),s,a,c)}else null!=s&&a.push(n.replace(/_.*/,"").replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))+": "+s+";")}(a.length||c)&&o.push((!n||l||s?e:e.map(n)).join(", ")+" {"+a.join(" ")+"}")}for(let t in e)i(r(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=wI[yI]||1;return wI[yI]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let r=e[OI],i=n&&n.nonce;r?i&&r.setNonce(i):r=new kI(e,i),r.mount(Array.isArray(t)?t:[t],e)}}let SI=new Map;class kI{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=SI.get(n);if(t)return e[OI]=t;this.sheet=new r.CSSStyleSheet,SI.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[OI]=this}mount(e,t){let n=this.sheet,r=0,i=0;for(let t=0;t-1&&(this.modules.splice(s,1),i--,s=-1),-1==s){if(this.modules.splice(i++,0,o),n)for(let e=0;e",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},TI="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),RI="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),EI=0;EI<10;EI++)CI[48+EI]=CI[96+EI]=String(EI);for(EI=1;EI<=24;EI++)CI[EI+111]="F"+EI;for(EI=65;EI<=90;EI++)CI[EI]=String.fromCharCode(EI+32),_I[EI]=String.fromCharCode(EI);for(var MI in CI)_I.hasOwnProperty(MI)||(_I[MI]=CI[MI]);function PI(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];"string"==typeof i?e.setAttribute(r,i):null!=i&&(e[r]=i)}t++}for(;t2);var jI={mac:BI||/Mac/.test($I.platform),windows:/Win/.test($I.platform),linux:/Linux|X11/.test($I.platform),ie:DI,ie_version:II?zI.documentMode||6:NI?+NI[1]:QI?+QI[1]:0,gecko:WI,gecko_version:WI?+(/Firefox\/(\d+)/.exec($I.userAgent)||[0,0])[1]:0,chrome:!!LI,chrome_version:LI?+LI[1]:0,ios:BI,android:/Android\b/.test($I.userAgent),webkit:HI,webkit_version:HI?+(/\bAppleWebKit\/(\d+)/.exec($I.userAgent)||[0,0])[1]:0,safari:VI,safari_version:VI?+(/\bVersion\/(\d+(\.\d+)?)/.exec($I.userAgent)||[0,0])[1]:0,tabSize:null!=zI.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};function ZI(e,t){for(let n in e)"class"==n&&t.class?t.class+=" "+e.class:"style"==n&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}const XI=Object.create(null);function FI(e,t,n){if(e==t)return!0;e||(e=XI),t||(t=XI);let r=Object.keys(e),i=Object.keys(t);if(r.length-(n&&r.indexOf(n)>-1?1:0)!=i.length-(n&&i.indexOf(n)>-1?1:0))return!1;for(let o of r)if(o!=n&&(-1==i.indexOf(o)||e[o]!==t[o]))return!1;return!0}function YI(e,t,n){let r=!1;if(t)for(let i in t)n&&i in n||(r=!0,"style"==i?e.style.cssText="":e.removeAttribute(i));if(n)for(let i in n)t&&t[i]==n[i]||(r=!0,"style"==i?e.style.cssText=n[i]:e.setAttribute(i,n[i]));return r}function qI(e){let t=Object.create(null);for(let n=0;n0?3e8:-4e8:t>0?1e8:-1e8,new tN(e,t,t,n,e.widget||null,!1)}static replace(e){let t,n,r=!!e.block;if(e.isBlockGap)t=-5e8,n=4e8;else{let{start:i,end:o}=nN(e,r);t=(i?r?-3e8:-1:5e8)-1,n=1+(o?r?2e8:1:-6e8)}return new tN(e,t,n,r,e.widget||null,!0)}static line(e){return new eN(e)}static set(e,t=!1){return oI.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}KI.none=oI.empty;class JI extends KI{constructor(e){let{start:t,end:n}=nN(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?ZI(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||XI}eq(e){return this==e||e instanceof JI&&this.tagName==e.tagName&&FI(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}JI.prototype.point=!1;class eN extends KI{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof eN&&this.spec.class==e.spec.class&&FI(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}eN.prototype.mapMode=nQ.TrackBefore,eN.prototype.point=!0;class tN extends KI{constructor(e,t,n,r,i,o){super(t,n,i,e),this.block=r,this.isReplace=o,this.mapMode=r?t<=0?nQ.TrackBefore:nQ.TrackAfter:nQ.TrackDel}get type(){return this.startSide!=this.endSide?GI.WidgetRange:this.startSide<=0?GI.WidgetBefore:GI.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof tN&&function(e,t){return e==t||!!(e&&t&&e.compare(t))}(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}function nN(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return null==n&&(n=e.inclusive),null==r&&(r=e.inclusive),{start:null!=n?n:t,end:null!=r?r:t}}function rN(e,t,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=e?n[i]=Math.max(n[i],t):n.push(e,t)}tN.prototype.point=!0;class iN extends eI{constructor(e,t){super(),this.tagName=e,this.attributes=t}eq(e){return e==this||e instanceof iN&&this.tagName==e.tagName&&FI(this.attributes,e.attributes)}static create(e){return new iN(e.tagName,e.attributes||XI)}static set(e,t=!1){return oI.of(e,t)}}function oN(e){let t;return t=11==e.nodeType?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function sN(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function aN(e,t){if(!t.anchorNode)return!1;try{return sN(e,t.anchorNode)}catch(e){return!1}}function lN(e){return 3==e.nodeType?xN(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function cN(e,t,n,r){return!!n&&(dN(e,t,n,r,-1)||dN(e,t,n,r,1))}function hN(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function uN(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function dN(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:fN(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=hN(e)+(i<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if(1==(e=e.childNodes[t+(i<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=i<0?fN(e):0}}}function fN(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function pN(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function gN(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function mN(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-e.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function bN(e,t=!0){let n=e.ownerDocument,r=null,i=null;for(let o=e.parentNode;o&&o!=n.body&&(t&&!r||!i);)if(1==o.nodeType)!i&&o.scrollHeight>o.clientHeight&&(i=o),t&&!r&&o.scrollWidth>o.clientWidth&&(r=o),o=o.assignedSlot||o.parentNode;else{if(11!=o.nodeType)break;o=o.host}return{x:r,y:i}}iN.prototype.startSide=iN.prototype.endSide=-1;class vN{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?fN(t):0),n,Math.min(e.focusOffset,n?fN(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}}let yN,ON=null;function wN(e){if(e.setActive)return e.setActive();if(ON)return e.focus(ON);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==ON?{get preventScroll(){return ON={preventScroll:!0},!0}}:void 0),!ON){ON=!1;for(let e=0;eMath.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function CN(e,t){for(let n=e,r=t;;){if(3==n.nodeType&&r>0)return{node:n,offset:r};if(1==n.nodeType&&r>0){if("false"==n.contentEditable)return null;n=n.childNodes[r-1],r=fN(n)}else{if(!n.parentNode||uN(n))return null;r=hN(n),n=n.parentNode}}}function _N(e,t){for(let n=e,r=t;;){if(3==n.nodeType&&r=26&&(ON=!1);class TN{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new TN(e.parentNode,hN(e),t)}static after(e,t){return new TN(e.parentNode,hN(e)+1,t)}}var RN=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(RN||(RN={}));const EN=RN.LTR,MN=RN.RTL;function PN(e){let t=[];for(let n=0;n=t){if(s.level==n)return o;(i<0||(0!=r?r<0?s.fromt:e[i].level>s.level))&&(i=o)}}if(i<0)throw new RangeError("Index out of range");return i}}function WN(e,t){if(e.length!=t.length)return!1;for(let n=0;nl&&s.push(new DN(l,p.from,d)),VN(e,p.direction==EN!=!(d%2)?r+1:r,i,p.inner,p.from,p.to,s),l=p.to),f=p.to}else{if(f==n||(t?LN[f]!=a:LN[f]==a))break;f++}u?HN(e,l,f,r+1,i,u,s):lt;){let n=!0,h=!1;if(!c||l>o[c-1].to){let e=LN[l-1];e!=a&&(n=!1,h=16==e)}let u=n||1!=a?null:[],d=n?r:r+1,f=l;e:for(;;)if(c&&f==o[c-1].to){if(h)break e;let p=o[--c];if(!n)for(let e=p.from,n=c;;){if(e==t)break e;if(!n||o[n-1].to!=e){if(LN[e-1]==a)break e;break}e=o[--n].from}u?u.push(p):(p.to=0;e-=3)if(QN[e+1]==-n){let t=QN[e+2],n=2&t?i:4&t?1&t?o:i:0;n&&(LN[s]=LN[QN[e]]=n),a=e;break}}else{if(189==QN.length)break;QN[a++]=s,QN[a++]=t,QN[a++]=l}else if(2==(r=LN[s])||1==r){let e=r==i;l=e?0:1;for(let t=a-3;t>=0;t-=3){let n=QN[t+2];if(2&n)break;if(e)QN[t+2]|=2;else{if(4&n)break;QN[t+2]|=4}}}}}(e,i,o,r,a),function(e,t,n,r){for(let i=0,o=r;i<=n.length;i++){let s=i?n[i-1].to:e,a=il;)t==o&&(t=n[--r].from,o=r?n[r-1].to:e),LN[--t]=h;l=s}else o=s,l++}}}(i,o,r,a),HN(e,i,o,t,n,r,s)}function BN(e){return[new DN(0,e,0)]}let jN="";function ZN(e,t,n,r,i){var o;let s=r.head-e.from,a=DN.find(t,s,null!==(o=r.bidiLevel)&&void 0!==o?o:-1,r.assoc),l=t[a],c=l.side(i,n);if(s==c){let e=a+=i?1:-1;if(e<0||e>=t.length)return null;l=t[a=e],s=l.side(!i,n),c=l.side(i,n)}let h=Gz(e.text,s,l.forward(i,n));(hl.to)&&(h=c),jN=e.text.slice(Math.min(s,h),Math.max(s,h));let u=a==(i?t.length-1:0)?null:t[a+(i?1:-1)];return u&&h==c&&u.level+(i?0:1)e.some((e=>e))}),rD=gQ.define({combine:e=>e.some((e=>e))}),iD=gQ.define();class oD{constructor(e,t="nearest",n="nearest",r=5,i=5,o=!1){this.range=e,this.y=t,this.x=n,this.yMargin=r,this.xMargin=i,this.isSnapshot=o}map(e){return e.empty?this:new oD(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new oD(dQ.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const sD=HQ.define({map:(e,t)=>e.map(t)}),aD=HQ.define();function lD(e,t,n){let r=e.facet(UN);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}const cD=gQ.define({combine:e=>!e.length||e[0]});let hD=0;const uD=gQ.define({combine:e=>e.filter(((t,n)=>{for(let r=0;r{let t=[];return o&&t.push(mD.of((t=>{let n=t.plugin(e);return n?o(n):KI.none}))),i&&t.push(i(e)),t}))}static fromClass(e,t){return dD.define(((t,n)=>new e(t,n)),t)}}class fD{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(lD(e.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(e){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){lD(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(null===(t=this.value)||void 0===t?void 0:t.destroy)try{this.value.destroy()}catch(t){lD(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const pD=gQ.define(),gD=gQ.define(),mD=gQ.define(),bD=gQ.define(),vD=gQ.define(),yD=gQ.define(),OD=gQ.define();function wD(e,t){let n=e.state.facet(OD);if(!n.length)return n;let r=n.map((t=>t instanceof Function?t(e):t)),i=[];return oI.spans(r,t.from,t.to,{point(){},span(e,n,r,o){let s=e-t.from,a=n-t.from,l=i;for(let e=r.length-1;e>=0;e--,o--){let n,i=r[e].spec.bidiIsolate;if(null==i&&(i=XN(t.text,s,a)),o>0&&l.length&&(n=l[l.length-1]).to==s&&n.direction==i)n.to=a,l=n.inner;else{let e={from:s,to:a,direction:i,inner:[]};l.push(e),l=e.inner}}}}),i}const xD=gQ.define();function SD(e){let t=0,n=0,r=0,i=0;for(let o of e.state.facet(xD)){let s=o(e);s&&(null!=s.left&&(t=Math.max(t,s.left)),null!=s.right&&(n=Math.max(n,s.right)),null!=s.top&&(r=Math.max(r,s.top)),null!=s.bottom&&(i=Math.max(i,s.bottom)))}return{left:t,right:n,top:r,bottom:i}}const kD=gQ.define();class CD{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}join(e){return new CD(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>n.toA)){if(r.toAr.push(new CD(e,t,n,i)))),this.changedRanges=r}static create(e,t,n){return new _D(e,t,n)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some((e=>e.selection))}get empty(){return 0==this.flags&&0==this.transactions.length}}const TD=[];class RD{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return 1&this.flags}get children(){return TD}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,4&this.flags){this.flags&=-5;let e=this.domAttrs;e&&function(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n].name;null==t[r]&&e.removeAttribute(r)}for(let n in t){let r=t[n];"style"==n?e.style.cssText=r:e.getAttribute(n)!=r&&e.setAttribute(n,r)}}(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let t of this.children){if(t==e)return n;n+=t.length+t.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let n=hN(this.dom),r=this.length?e>0:t>0;return new TN(this.parent.dom,n+(r?1:0),0==e||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&2&this.parent.flags&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof PD)return e;return null}static get(e){return e.cmTile}}class ED extends RD{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(2&this.flags)return;super.sync(e);let t,n=this.dom,r=null,i=(null==e?void 0:e.node)==n?e:null,o=0;for(let s of this.children){if(s.sync(e),o+=s.length+s.breakAfter,t=r?r.nextSibling:n.firstChild,i&&t!=s.dom&&(i.written=!0),s.dom.parentNode==n)for(;t&&t!=s.dom;)t=MD(t);else n.insertBefore(s.dom,t);r=s.dom}for(t=r?r.nextSibling:n.firstChild,i&&t&&(i.written=!0);t;)t=MD(t);this.length=o}}function MD(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class PD extends ED{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=RD.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,r=0,i=0;;)if(r==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&i++,r=t.pop()}else{let o=n.children[r++];if(o instanceof AD)t.push(r),n=o,r=0;else{let t=i+o.length,n=e(o,i);if(void 0!==n)return n;i=t+o.breakAfter}}}resolveBlock(e,t){let n,r,i=-1,o=-1;if(this.blockTiles(((s,a)=>{let l=a+s.length;if(e>=a&&e<=l){if(s.isWidget()&&t>=-1&&t<=1){if(32&s.flags)return!0;16&s.flags&&(n=void 0)}(ae||e==a&&(t>1?s.length:s.covers(-1)))&&(!r||!s.isWidget()&&r.isWidget())&&(r=s,o=e-a)}})),!n&&!r)throw new Error("No tile at position "+e);return n&&t<0||!r?{tile:n,offset:i}:{tile:r,offset:o}}}class AD extends ED{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return!!this.children.length&&(e<0?this.children[0].covers(-1):this.lastChild.covers(1))}get domAttrs(){return this.wrapper.attributes}static of(e,t){let n=new AD(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class $D extends ED{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,n){let r=new $D(t||document.createElement("div"),e);return t&&n||(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(e,t,n){let r=null,i=-1,o=null,s=-1;!function e(a,l){for(let c=0,h=0;c=l&&(u.isComposite()?e(u,l-h):(!o||o.isHidden&&(t>0||n&&zD(o,u)))&&(d>l||32&u.flags)?(o=u,s=l-h):(hn&&(e=n);let r=e,i=e,o=0;0==e&&t<0||e==n&&t>=0?jI.chrome||jI.gecko||(e?(r--,o=1):i=0)?0:s.length-1];return jI.safari&&!o&&0==a.width&&(a=Array.prototype.find.call(s,(e=>e.width))||a),o?pN(a,o<0):a||null}static of(e,t){let n=new ID(t||document.createTextNode(e),e);return t||(n.flags|=2),n}}class ND extends RD{constructor(e,t,n,r){super(e,t,r),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return!(48&this.flags)&&(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(n)return pN(this.dom.getBoundingClientRect(),this.length?0==e:t<=0);{let t=this.dom.getClientRects(),n=null;if(!t.length)return null;let r=!!(16&this.flags)||!(32&this.flags)&&e>0;for(let i=r?t.length-1:0;n=t[i],!(e>0?0==i:i==t.length-1||n.top0;)if(r.isComposite())if(o){if(!e)break;n&&n.break(),e--,o=!1}else if(i==r.children.length){if(!e&&!s.length)break;n&&n.leave(r),o=!!r.breakAfter,({tile:r,index:i}=s.pop()),i++}else{let a=r.children[i],l=a.breakAfter;!(t>0?a.length<=e:a.length=0;e--){let n=t.marks[e],i=r.lastChild;if(i instanceof QD&&i.mark.eq(n.mark))i.dom!=n.dom&&i.setDOM(YD(n.dom)),r=i;else{if(this.cache.reused.get(n)){let e=RD.get(n.dom);e&&e.setDOM(YD(n.dom))}let e=QD.of(n.mark,n.dom);r.append(e),r=e}this.cache.reused.set(n,2)}let i=RD.get(e.text);i&&this.cache.reused.set(i,2);let o=new ID(e.text,e.text.nodeValue);o.flags|=8,r.append(o)}addInlineWidget(e,t,n){let r=this.afterWidget&&48&e.flags&&(48&this.afterWidget.flags)==(48&e.flags);r||this.flushBuffer();let i=this.ensureMarks(t,n);r||16&e.flags||i.append(this.getBuffer(1)),i.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){(this.afterWidget||this.lastBlock).length+=e,this.pos+=e}addLineStart(e,t){var n;e||(e=FD);let r=$D.start(e,t||(null===(n=this.cache.find($D))||void 0===n?void 0:n.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var n;let r=this.curLine;for(let i=e.length-1;i>=0;i--){let o,s=e[i];if(t>0&&(o=r.lastChild)&&o instanceof QD&&o.mark.eq(s))r=o,t--;else{let e=QD.of(s,null===(n=this.cache.find(QD,(e=>e.mark.eq(s))))||void 0===n?void 0:n.dom);r.append(e),r=e,t=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;e&&XD(this.curLine,!1)&&("BR"==e.dom.nodeName||!e.isWidget()||jI.ios&&XD(this.curLine,!0))||this.curLine.append(this.cache.findWidget(UD,0,32)||new ND(UD.toDOM(),0,UD,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to=this.pos){let t=new LD(e.from,e.to,e.value,e.rank),n=this.wrappers.length;for(;n>0&&(this.wrappers[n-1].rank-t.rank||this.wrappers[n-1].to-t.to)<0;)n--;this.wrappers.splice(n,0,t)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let n of this.wrappers){let r=t.lastChild;if(n.frome.wrapper.eq(n.wrapper))))||void 0===e?void 0:e.dom);t.append(r),t=r}}return t}blockPosCovered(){let e=this.lastBlock;return null!=e&&!e.breakAfter&&(!e.isWidget()||(160&e.flags)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(DD,void 0,1);return n&&(n.flags=t),n||new DD(t)}flushBuffer(){!this.afterWidget||32&this.afterWidget.flags||(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class VD{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:r}=this.cursor.next(this.skipCount);if(this.skipCount=0,r)throw new Error("Ran out of text content when drawing inline views");this.text=t;let i=this.textOff=Math.min(e,t.length);return n?null:t.slice(0,i)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}}const BD=[ND,$D,ID,QD,DD,AD,PD];for(let e=0;e[])),this.index=BD.map((()=>0)),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let r=e.bucket,i=this.buckets[r],o=this.index[r];for(let e=i.length-1;e>=0;e--){let s=(e+o)%i.length,a=i[s];if((!t||t(a))&&!this.reused.has(a))return i.splice(s,1),s{if(this.cache.add(e),e.isComposite())return!1},enter:e=>this.cache.add(e),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let r=0,i=0,o=0;;){let s=or){let e=a-r;this.preserve(e,!o,!s),r=a,i+=e}if(!s)break;t&&s.fromA<=t.range.fromA&&s.toA>=t.range.toA?(this.forward(s.fromA,t.range.fromA,t.range.fromA1;n--){let r=n==e.parents.length?e.tile:e.parents[n].tile;r instanceof QD&&t.push(r.mark)}return t}(this.old),i=this.openMarks;this.old.advance(e,n?1:-1,{skip:(e,t,n)=>{if(e.isWidget())if(this.openWidget)this.builder.continueWidget(n-t);else{let o=n>0||t{e.isLine()?this.builder.addLineStart(e.attrs,this.cache.maybeReuse(e)):(this.cache.add(e),e instanceof QD&&r.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?r.length&&(r.length=i=0):e instanceof QD&&(r.shift(),i=Math.min(i,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,r=this.builder,i=0,o=oI.spans(this.decorations,e,t,{point:(e,t,o,s,a,l)=>{if(o instanceof tN){if(this.disallowBlockEffectsFor[l]){if(o.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.view.state.doc.lineAt(e).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(i=s.length,a>s.length)r.continueWidget(t-e);else{let i=o.widget||(o.block?qD.block:qD.inline),l=function(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}(o),c=this.cache.findWidget(i,t-e,l)||ND.of(i,this.view,t-e,l);o.block?(o.startSide>0&&r.addLineStartIfNotCovered(n),r.addBlockWidget(c)):(r.ensureLine(n),r.addInlineWidget(c,s,a))}n=null}else n=function(e,t){let n=t.spec.attributes,r=t.spec.class;return n||r?(e||(e={class:"cm-line"}),n&&ZI(n,e),r&&(e.class+=" "+r),e):e}(n,o);t>e&&this.text.skip(t-e)},span:(e,t,i,o)=>{for(let s=e;si,this.openMarks=o}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let r=e.parentNode;;r=r.parentNode){let e=RD.get(r);if(r==this.view.contentDOM)break;e instanceof QD?t.push(e):(null==e?void 0:e.isLine())?n=e:e instanceof AD||("DIV"!=r.nodeName||n||r==this.view.contentDOM?n||t.push(QD.of(new JI({tagName:r.nodeName.toLowerCase(),attributes:qI(r)}),r)):n=new $D(r,FD))}return{line:n,marks:t}}}function XD(e,t){let n=e=>{for(let r of e.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}const FD={class:"cm-line"};function YD(e){let t=RD.get(e);return t&&t.setDOM(e.cloneNode()),e}class qD extends UI{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}qD.inline=new qD("span"),qD.block=new qD("div");const UD=new class extends UI{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class GD{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=KI.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new PD(e,e.contentDOM),this.updateInner([new CD(0,0,0,e.state.doc.length)],null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every((({fromA:e,toA:t})=>tthis.minWidthTo))?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null===(t=this.domChanged)||void 0===t?void 0:t.newSel)?r=this.domChanged.newSel.head:function(e,t){let n=!1;return t&&e.iterChangedRanges(((e,r)=>{et.from&&(n=!0)})),n}(e.changes,this.hasComposition)||e.selectionSet||(r=e.state.selection.main.head));let i=r>-1?function(e,t,n){let r=JD(e,n);if(!r)return null;let{node:i,from:o,to:s}=r,a=i.nodeValue;if(/[\n\r]/.test(a))return null;if(e.state.doc.sliceString(r.from,r.to)!=a)return null;let l=t.invertedDesc;return{range:new CD(l.mapPos(o),l.mapPos(s),o,s),text:i}}(this.view,e.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:t,to:r}=this.hasComposition;n=new CD(t,r,e.changes.mapPos(t,-1),e.changes.mapPos(r,1)).addToSet(n.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(jI.ie||jI.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,s=this.blockWrappers;this.updateDeco();let a=function(e,t,n){let r=new eW;return oI.compare(e,t,n,r),r.changes}(o,this.decorations,e.changes);a.length&&(n=CD.extendWithRanges(n,a));let l=function(e,t,n){let r=new tW;return oI.compare(e,t,n,r),r.changes}(s,this.blockWrappers,e.changes);return l.length&&(n=CD.extendWithRanges(n,l)),i&&!n.some((e=>e.fromA<=i.range.fromA&&e.toA>=i.range.toA))&&(n=i.range.addToSet(n.slice())),!(2&this.tile.flags&&0==n.length||(this.updateInner(n,i),e.transactions.length&&(this.lastUpdate=Date.now()),0))}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore((()=>{if(t||e.length){let n=this.tile,r=new ZD(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&RD.get(t.text)&&r.cache.reused.set(RD.get(t.text),2),this.tile=r.run(e,t),KD(n,r.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let r=jI.chrome||jI.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(r),!r||!r.written&&n.selectionRange.focusNode==r.node&&this.tile.dom.contains(r.node)||(this.forceSelection=!0),this.tile.dom.style.height=""}));let r=[];if(this.view.viewport.from||this.view.viewport.to-1)&&aN(n,this.view.observer.selectionRange)&&!(r&&n.contains(r));if(!(i||t||o))return;let s=this.forceSelection;this.forceSelection=!1;let a,l,c=this.view.state.selection.main;if(c.empty?l=a=this.inlineDOMNearPos(c.anchor,c.assoc||1):(l=this.inlineDOMNearPos(c.head,c.head==c.from?1:-1),a=this.inlineDOMNearPos(c.anchor,c.anchor==c.from?1:-1)),jI.gecko&&c.empty&&!this.hasComposition&&1==(h=a).node.nodeType&&h.node.firstChild&&(0==h.offset||"false"==h.node.childNodes[h.offset-1].contentEditable)&&(h.offset==h.node.childNodes.length||"false"==h.node.childNodes[h.offset].contentEditable)){let e=document.createTextNode("");this.view.observer.ignore((()=>a.node.insertBefore(e,a.node.childNodes[a.offset]||null))),a=l=new TN(e,0),s=!0}var h;let u=this.view.observer.selectionRange;!s&&u.focusNode&&(cN(a.node,a.offset,u.anchorNode,u.anchorOffset)&&cN(l.node,l.offset,u.focusNode,u.focusOffset)||this.suppressWidgetCursorChange(u,c))||(this.view.observer.ignore((()=>{jI.android&&jI.chrome&&n.contains(u.focusNode)&&function(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(u.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let e=oN(this.view.root);if(e)if(c.empty){if(jI.gecko){let e=function(e,t){return 1!=e.nodeType?0:(t&&"false"==e.childNodes[t-1].contentEditable?1:0)|(tc.head&&([a,l]=[l,a]),t.setEnd(l.node,l.offset),t.setStart(a.node,a.offset),e.removeAllRanges(),e.addRange(t)}o&&this.view.root.activeElement==n&&(n.blur(),r&&r.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new TN(u.anchorNode,u.anchorOffset),this.impreciseHead=l.precise?null:new TN(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&cN(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=oN(e.root),{anchorNode:r,anchorOffset:i}=e.observer.selectionRange;if(!(n&&t.empty&&t.assoc&&n.modify))return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let s=o.posAtStart;if(t.head==s||t.head==s+o.length)return;let a=this.coordsAt(t.head,-1),l=this.coordsAt(t.head,1);if(!a||!l||a.bottom>l.top)return;let c=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(c.node,c.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=t.from&&n.collapse(r,i)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return 2&this.tile.dom.compareDocumentPosition(e)?0:this.view.state.doc.length;let r=n.posAtStart;if(!n.isComposite())return n.isText()?e==n.dom?r+t:r+(t?n.length:0):r;{let i;if(e==n.dom)i=n.dom.childNodes[t];else{let r=0==fN(e)?0:0==t?-1:1;for(;;){let t=e.parentNode;if(t==n.dom)break;0==r&&t.firstChild!=t.lastChild&&(r=e==t.firstChild?-1:1),e=t}i=r<0?e:e.nextSibling}if(i==n.dom.firstChild)return r;for(;i&&!RD.get(i);)i=i.nextSibling;if(!i)return r+n.length;for(let e=0,t=r;;e++){let r=n.children[e];if(r.dom==i)return t;t+=r.length+r.breakAfter}}}domAtPos(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(e,t):n.domIn(r,t)}inlineDOMNearPos(e,t){let n,r,i=-1,o=!1,s=-1,a=!1;return this.tile.blockTiles(((t,l)=>{if(t.isWidget()){if(32&t.flags&&l>=e)return!0;16&t.flags&&(o=!0)}else{let c=l+t.length;if(l<=e&&(n=t,i=e-l,o=c=e&&!r&&(r=t,s=e-l,a=l>e),l>e&&r)return!0}})),n||r?(o&&r?n=null:a&&n&&(r=null),n&&t<0||!r?n.domIn(i,t):r.domIn(s,t)):this.domAtPos(e,t)}coordsAt(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.widget instanceof nW?null:n.coordsInWidget(r,t,!0):n.coordsIn(r,t)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);return t.isLine()?function e(t,n){if(t.isComposite())for(let r of t.children){if(r.length>=n){let t=e(r,n);if(t)return t}if((n-=r.length)<0)break}else if(t.isText()&&nMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,a=this.view.textDirection==RN.LTR,l=0,c=(e,h,u)=>{for(let d=0;dr);d++){let r=e.children[d],f=h+r.length,p=r.dom.getBoundingClientRect(),{height:g}=p;if(u&&!d&&(l+=p.top-u.top),r instanceof AD)f>n&&c(r,h,p);else if(h>=n&&(l>0&&t.push(-l),t.push(g+l),l=0,o)){let e=r.dom.lastChild,t=e?lN(e):[];if(t.length){let e=t[t.length-1],n=a?e.right-p.left:p.right-e.left;n>s&&(s=n,this.minWidth=i,this.minWidthFrom=h,this.minWidthTo=f)}}u&&d==e.children.length-1&&(l+=u.bottom-p.bottom),h=f+r.breakAfter}};return c(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return"rtl"==getComputedStyle(t.dom).direction?RN.RTL:RN.LTR}measureTextSize(){let e=this.tile.blockTiles((e=>{if(e.isLine()&&e.children.length&&e.length<=20){let t,n=0;for(let r of e.children){if(!r.isText()||/[^ -~]/.test(r.text))return;let e=lN(r.dom);if(1!=e.length)return;n+=e[0].width,t=e[0].height}if(n)return{lineHeight:e.dom.getBoundingClientRect().height,charWidth:n/e.length,textHeight:t}}}));if(e)return e;let t,n,r,i=document.createElement("div");return i.className="cm-line",i.style.width="99999px",i.style.position="absolute",i.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.tile.dom.appendChild(i);let e=lN(i.firstChild)[0];t=i.getBoundingClientRect().height,n=e&&e.width?e.width/27:7,r=e&&e.height?e.height:t,i.remove()})),{lineHeight:t,charWidth:n,textHeight:r}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,r=0;;r++){let i=r==t.viewports.length?null:t.viewports[r],o=i?i.from-1:this.view.state.doc.length;if(o>n){let r=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(KI.replace({widget:new nW(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!i)break;n=i.to+1}return KI.set(e)}updateDeco(){let e=1,t=this.view.state.facet(mD).map((t=>(this.dynamicDecorationMap[e++]="function"==typeof t)?t(this.view):t)),n=!1,r=this.view.state.facet(vD).map(((e,t)=>{let r="function"==typeof e;return r&&(n=!0),r?e(this.view):e}));for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(oI.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e"function"==typeof e?e(this.view):e))}scrollIntoView(e){var t;if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);return this.view.scrollDOM.scrollTop=t.top-e.yMargin,void(this.view.scrollDOM.scrollLeft=e.xMargin)}for(let t of this.view.state.facet(iD))try{if(t(this.view,e.range,e))return!0}catch(e){lD(this.view.state,e,"scroll handler")}let n,{range:r}=e,i=this.coordsAt(r.head,null!==(t=r.assoc)&&void 0!==t?t:r.empty?0:r.head>r.anchor?-1:1);if(!i)return;!r.empty&&(n=this.coordsAt(r.anchor,r.anchor>r.head?-1:1))&&(i={left:Math.min(i.left,n.left),top:Math.min(i.top,n.top),right:Math.max(i.right,n.right),bottom:Math.max(i.bottom,n.bottom)});let o=SD(this.view),s={left:i.left-o.left,top:i.top-o.top,right:i.right+o.right,bottom:i.bottom+o.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;if(function(e,t,n,r,i,o,s,a){let l=e.ownerDocument,c=l.defaultView||window;for(let h=e,u=!1;h&&!u;)if(1==h.nodeType){let e,d=h==l.body,f=1,p=1;if(d)e=gN(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(u=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let t=h.getBoundingClientRect();({scaleX:f,scaleY:p}=mN(h,t)),e={left:t.left,right:t.left+h.clientWidth*f,top:t.top,bottom:t.top+h.clientHeight*p}}let g=0,m=0;if("nearest"==i)t.top0&&t.bottom>e.bottom+m&&(m=t.bottom-e.bottom+s)):t.bottom>e.bottom&&(m=t.bottom-e.bottom+s,n<0&&t.top-m0&&t.right>e.right+g&&(g=t.right-e.right+o)):t.right>e.right&&(g=t.right-e.right+o,n<0&&t.lefte.bottom||t.lefte.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),h=h.assignedSlot||h.parentNode}else{if(11!=h.nodeType)break;h=h.host}}(this.view.scrollDOM,s,r.head1&&(i.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||i.bottome.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){KD(this.tile)}}function KD(e,t){let n=null==t?void 0:t.get(e);if(1!=n){null==n&&e.destroy();for(let n of e.children)KD(n,t)}}function JD(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=CN(n.focusNode,n.focusOffset),i=_N(n.focusNode,n.focusOffset),o=r||i;if(i&&r&&i.node!=r.node){let t=RD.get(i.node);if(!t||t.isText()&&t.text!=i.node.nodeValue)o=i;else if(e.docView.lastCompositionAfterCursor){let e=RD.get(r.node);!e||e.isText()&&e.text!=r.node.nodeValue||(o=i)}}if(e.docView.lastCompositionAfterCursor=o!=r,!o)return null;let s=t-o.offset;return{from:s,to:s+o.node.nodeValue.length,node:o.node}}let eW=class{constructor(){this.changes=[]}compareRange(e,t){rN(e,t,this.changes)}comparePoint(e,t){rN(e,t,this.changes)}boundChange(e){rN(e,e,this.changes)}};class tW{constructor(){this.changes=[]}compareRange(e,t){rN(e,t,this.changes)}comparePoint(){}boundChange(e){rN(e,e,this.changes)}}class nW extends UI{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function rW(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let e;for(let i of r.type){if(i.from>t)break;if(!(i.tot)return i;e&&(i.type!=GI.Text||e.type==i.type&&!(n<0?i.fromt))||(e=i)}}return e||r}return r}function iW(e,t,n,r){let i=e.state.doc.lineAt(t.head),o=e.bidiSpans(i),s=e.textDirectionAt(i.from);for(let a=t,l=null;;){let t=ZN(i,o,s,a,n),c=jN;if(!t){if(i.number==(n?e.state.doc.lines:1))return a;c="\n",i=e.state.doc.line(i.number+(n?1:-1)),o=e.bidiSpans(i),t=e.visualLineSide(i,!n)}if(l){if(!l(c))return a}else{if(!r)return t;l=r(c)}a=t}}function oW(e,t,n){for(;;){let r=0;for(let i of e)i.between(t-1,t+1,((e,i,o)=>{if(t>e&&tt(e))),n.from,t.head>n.from?-1:1);return r==n.from?n:dQ.cursor(r,re.viewState.docHeight)return new lW(e.state.doc.length,-1);if(i=e.elementAtHeight(c),null==r)break;if(i.type==GI.Text){if(r<0?i.toe.viewport.to)break;let t=e.docView.coordsAt(r<0?i.from:i.to,r>0?-1:1);if(t&&(r<0?t.top<=c+s:t.bottom>=c+s))break}let t=e.viewState.heightOracle.textHeight/2;c=r>0?i.bottom+t:i.top-t}if(e.viewport.from>=i.to||e.viewport.to<=i.from){if(n)return null;if(i.type==GI.Text){let t=function(e,t,n,r,i){let o=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;o+=Math.floor((i-n.top-.5*(e.defaultLineHeight-t))/t)*e.viewState.heightOracle.lineLength}let s=e.state.sliceDoc(n.from,n.to);return n.from+vI(s,o,e.state.tabSize)}(e,o,i,a,l);return new lW(t,t==i.from?1:-1)}}if(i.type!=GI.Text)return c<(i.top+i.bottom)/2?new lW(i.from,1):new lW(i.to,-1);let h=e.docView.lineAt(i.from,2);return h&&h.length==i.length||(h=e.docView.lineAt(i.from,-2)),new hW(e,a,l,e.textDirectionAt(i.from)).scanTile(h,i.from)}class hW{constructor(e,t,n,r){this.view=e,this.x=t,this.y=n,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to1||n.length&&(n[0].level!=this.baseDir||n[0].to+r.from>1;t:if(a.has(d)){let e=o+Math.floor(Math.random()*u);for(let t=0;t1)){if(a.bottomthis.y)(!r||r.top>a.top)&&(r=a),u=-1;else{let e=a.left>this.x?this.x-a.left:a.right(i.left+i.right)/2==u}}scanText(e,t){let n=[];for(let r=0;r{let i=n[r]-t,o=n[r+1]-t;return xN(e.dom,i,o).getClientRects()}));return r.after?new lW(n[r.i+1],-1):new lW(n[r.i],1)}scanTile(e,t){if(!e.length)return new lW(t,1);if(1==e.children.length){let n=e.children[0];if(n.isText())return this.scanText(n,t);if(n.isComposite())return this.scanTile(n,t)}let n=[t];for(let r=0,i=t;r{let n=e.children[t];return 48&n.flags?null:(1==n.dom.nodeType?n.dom:xN(n.dom,0,n.length)).getClientRects()})),i=e.children[r.i],o=n[r.i];return i.isText()?this.scanText(i,o):i.isComposite()?this.scanTile(i,o):r.after?new lW(n[r.i+1],-1):new lW(o,1)}}const uW="￿";class dW{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(KQ.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=uW}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let e=this.text.length;this.readNode(r);let i=RD.get(r),o=r.nextSibling;if(o==t){(null==i?void 0:i.breakAfter)&&!o&&n!=this.view.contentDOM&&this.lineBreak();break}let s=RD.get(o);(i&&s?i.breakAfter:(i?i.breakAfter:uN(r))||uN(o)&&("BR"!=r.nodeName||(null==i?void 0:i.isWidget()))&&this.text.length>e)&&!pW(o,t)&&this.lineBreak(),r=o}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let i,o=-1,s=1;if(this.lineSeparator?(o=t.indexOf(this.lineSeparator,n),s=this.lineSeparator.length):(i=r.exec(t))&&(o=i.index,s=i[0].length),this.append(t.slice(n,o<0?t.length:o)),o<0)break;if(this.lineBreak(),s>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=s-1);n=o+s}}readNode(e){let t=RD.get(e),n=t&&t.overrideDOMText;if(null!=n){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(3==e.nodeType?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(fW(e,n.node,n.offset)?t:0))}}function fW(e,t,n){for(;;){if(!t||n-1;let{impreciseHead:i,impreciseAnchor:o}=e.docView,s=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=bW(e.docView.tile,t,n,0))){let t=i||o?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}=e.observer.selectionRange;return n&&(t.push(new gW(n,r)),i==n&&o==r||t.push(new gW(i,o))),t}(e),n=new dW(t,e);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=function(e,t){if(0==e.length)return null;let n=e[0].pos,r=2==e.length?e[1].pos:n;return n>-1&&r>-1?dQ.single(n+t,r+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=i&&i.node==t.focusNode&&i.offset==t.focusOffset||!sN(e.contentDOM,t.focusNode)?s.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=o&&o.node==t.anchorNode&&o.offset==t.anchorOffset||!sN(e.contentDOM,t.anchorNode)?s.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),a=e.viewport;if((jI.ios||jI.chrome)&&s.main.empty&&n!=r&&(a.from>0||a.to-1&&s.ranges.length>1)this.newSel=s.replaceRange(dQ.range(r,n));else if(e.lineWrapping&&r==n&&(!s.main.empty||s.main.head!=n)&&e.inputState.lastTouchTime>Date.now()-100){let t=e.coordsAtPos(n,-1),r=0;t&&(r=e.inputState.lastTouchY<=t.bottom?-1:1),this.newSel=dQ.create([dQ.cursor(n,r)])}else this.newSel=dQ.single(r,n)}}}function bW(e,t,n,r){if(e.isComposite()){let i=-1,o=-1,s=-1,a=-1;for(let l=0,c=r,h=r;ln)return bW(r,t,n,c);if(u>=t&&-1==i&&(i=l,o=c),c>n&&r.dom.parentNode==e.dom){s=l,a=h;break}h=u,c=u+r.breakAfter}return{from:o,to:a<0?r+e.length:a,startDOM:(i?e.children[i-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:s=0?e.children[s].dom:null}}return e.isText()?{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function vW(e,t){let n,{newSel:r}=t,{state:i}=e,o=i.selection.main,s=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:e,to:r}=t.bounds,a=o.from,l=null;(8===s||jI.android&&t.text.length=e&&o.to<=r&&(t.typeOver||u!=t.text)&&u.slice(0,o.from-e)==t.text.slice(0,o.from-e)&&u.slice(o.to-e)==t.text.slice(c=t.text.length-(u.length-(o.to-e)))?n={from:o.from,to:o.to,insert:Hz.of(t.text.slice(o.from-e,c).split(uW))}:(h=OW(u,t.text,a-e,l))&&(jI.chrome&&13==s&&h.toB==h.from+2&&t.text.slice(h.from,h.toB)==uW+uW&&h.toB--,n={from:e+h.from,to:e+h.toA,insert:Hz.of(t.text.slice(h.from,h.toB).split(uW))})}else r&&(!e.hasFocus&&i.facet(cD)||wW(r,o))&&(r=null);if(!n&&!r)return!1;if((jI.mac||jI.android)&&n&&n.from==n.to&&n.from==o.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(r&&2==n.insert.length&&(r=dQ.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:Hz.of([n.insert.toString().replace("."," ")])}):i.doc.lineAt(o.from).toDate.now()-50?n={from:o.from,to:o.to,insert:i.toText(e.inputState.insertingText)}:jI.chrome&&n&&n.from==n.to&&n.from==o.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(r&&(r=dQ.single(r.main.anchor-1,r.main.head-1)),n={from:o.from,to:o.to,insert:Hz.of([" "])}),n)return yW(e,n,r,s);if(r&&!wW(r,o)){let t=!1,n="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),n=e.inputState.lastSelectionOrigin,"select.pointer"==n&&(r=sW(i.facet(yD).map((t=>t(e))),r))),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}return!1}function yW(e,t,n,r=-1){if(jI.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if(jI.android&&(t.to==i.to&&(t.from==i.from||t.from==i.from-1&&" "==e.state.sliceDoc(t.from,i.from))&&1==t.insert.length&&2==t.insert.lines&&SN(e.contentDOM,"Enter",13)||(t.from==i.from-1&&t.to==i.to&&0==t.insert.length||8==r&&t.insert.lengthi.head)&&SN(e.contentDOM,"Backspace",8)||t.from==i.from&&t.to==i.to+1&&0==t.insert.length&&SN(e.contentDOM,"Delete",46)))return!0;let o,s=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let a=()=>o||(o=function(e,t,n){let r,i=e.state,o=i.selection.main,s=-1;if(t.from==t.to&&t.fromo.to){let n=t.fromt(e))),r,n);t.from==a&&(s=a)}if(s>-1)r={changes:t,selection:dQ.cursor(t.from+t.insert.length,-1)};else if(t.from>=o.from&&t.to<=o.to&&t.to-t.from>=(o.to-o.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=o.fromt.to?i.sliceDoc(t.to,o.to):"";r=i.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+s))}else{let s=i.changes(t),a=n&&n.main.to<=s.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=o.to+10&&t.to>=o.to-10){let l,c=e.state.sliceDoc(t.from,t.to),h=n&&JD(e,n.main.head);if(h){let e=t.insert.length-(t.to-t.from);l={from:h.from,to:h.to-e}}else l=e.state.doc.lineAt(o.head);let u=o.to-t.to;r=i.changeByRange((n=>{if(n.from==o.from&&n.to==o.to)return{changes:s,range:a||n.map(s)};let r=n.to-u,h=r-c.length;if(e.state.sliceDoc(h,r)!=c||r>=l.from&&h<=l.to)return{range:n};let d=i.changes({from:h,to:r,insert:t.insert}),f=n.to-o.to;return{changes:d,range:a?dQ.range(Math.max(0,a.anchor+f),Math.max(0,a.head+f)):n.map(d)}}))}else r={changes:s,selection:a&&i.selection.replaceRange(a)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:a,scrollIntoView:!0})}(e,t,n));return e.state.facet(KN).some((n=>n(e,t.from,t.to,s,a)))||e.dispatch(a()),!0}function OW(e,t,n,r){let i=Math.min(e.length,t.length),o=0;for(;o0&&a>0&&e.charCodeAt(s-1)==t.charCodeAt(a-1);)s--,a--;return"end"==r&&(n-=s+Math.max(0,o-Math.min(s,a))-o),s=s?o-n:0,a=o+(a-s),s=o):a=a?o-n:0,s=o+(s-a),a=o),{from:o,toA:s,toB:a}}function wW(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class xW{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,jI.safari&&e.contentDOM.addEventListener("input",(()=>null)),jI.gecko&&function(e){XW.has(e)||(XW.add(e),e.addEventListener("copy",(()=>{})),e.addEventListener("cut",(()=>{})))}(e.contentDOM.ownerDocument)}handleEvent(e){(function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n,r=t.target;r!=e.contentDOM;r=r.parentNode)if(!r||11==r.nodeType||(n=RD.get(r))&&n.isWidget()&&!n.isHidden&&n.widget.ignoreEvent(t))return!1;return!0})(this.view,e)&&!this.ignoreDuringComposition(e)&&("keydown"==e.type&&this.keydown(e)||(0!=this.view.updateState?Promise.resolve().then((()=>this.runHandlers(e.type,e))):this.runHandlers(e.type,e)))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=kW(e),n=this.handlers,r=this.view.contentDOM;for(let e in t)if("scroll"!=e){let i=!t[e].handlers.length,o=n[e];o&&i!=!o.handlers.length&&(r.removeEventListener(e,this.handleEvent),o=null),o||r.addEventListener(e,this.handleEvent,{passive:i})}for(let e in n)"scroll"==e||t[e]||r.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=e.keyCode&&TW.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),jI.android&&jI.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return!jI.ios||e.synthetic||e.altKey||e.metaKey||e.shiftKey||!((t=CW.find((t=>t.keyCode==e.keyCode)))&&!e.ctrlKey||_W.indexOf(e.key)>-1&&e.ctrlKey)?(229!=e.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=t||e,setTimeout((()=>this.flushIOSKey()),250),!0)}flushIOSKey(e){let t=this.pendingIOSKey;return!!t&&!("Enter"==t.key&&e&&e.from0||!!(jI.safari&&!jI.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function SW(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){lD(n.state,e)}}}function kW(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec,r=e&&e.plugin.domEventHandlers,i=e&&e.plugin.domEventObservers;if(r)for(let e in r){let i=r[e];i&&n(e).handlers.push(SW(t.value,i))}if(i)for(let e in i){let r=i[e];r&&n(e).observers.push(SW(t.value,r))}}for(let e in MW)n(e).handlers.push(MW[e]);for(let e in PW)n(e).observers.push(PW[e]);return t}const CW=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],_W="dthko",TW=[16,17,18,20,91,92,224,225];function RW(e){return.7*Math.max(0,e)+8}class EW{constructor(e,t,n,r){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=bN(e.contentDOM),this.atoms=e.state.facet(yD).map((t=>t(e)));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(KQ.allowMultipleSelections)&&function(e,t){let n=e.state.facet(FN);return n.length?n[0](t):jI.mac?t.metaKey:t.ctrlKey}(e,t),this.dragging=!(!function(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=oN(e.root);if(!r||0==r.rangeCount)return!0;let i=r.getRangeAt(0).getClientRects();for(let e=0;e=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}(e,t)||1!=LW(t))&&null}start(e){!1===this.dragging&&this.select(e)}move(e){if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&function(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,r=0,i=0,o=this.view.win.innerWidth,s=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:s}=this.scrollParents.y.getBoundingClientRect());let a=SD(this.view);e.clientX-a.left<=r+6?t=-RW(r-e.clientX):e.clientX+a.right>=o-6&&(t=RW(e.clientX-o)),e.clientY-a.top<=i+6?n=-RW(i-e.clientY):e.clientY+a.bottom>=s-6&&(n=RW(e.clientY-s)),this.setScrollSpeed(t,n)}up(e){null==this.dragging&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval((()=>this.scroll()),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),!1===this.dragging&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=sW(this.atoms,this.style.get(e,this.extend,this.multiple));!this.mustSelect&&n.eq(t.state.selection,!1===this.dragging)||this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some((e=>e.isUserEvent("input.type")))?this.destroy():this.style.update(e)&&setTimeout((()=>this.select(this.lastEvent)),20)}}const MW=Object.create(null),PW=Object.create(null),AW=jI.ie&&jI.ie_version<15||jI.ios&&jI.webkit_version<604;function $W(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function zW(e,t){t=$W(e.state,eD,t);let n,{state:r}=e,i=1,o=r.toText(t),s=o.lines==r.selection.ranges.length,a=null!=VW&&r.selection.ranges.every((e=>e.empty))&&VW==o.toString();if(a){let e=-1;n=r.changeByRange((n=>{let a=r.doc.lineAt(n.from);if(a.from==e)return{range:n};e=a.from;let l=r.toText((s?o.line(i++).text:t)+r.lineBreak);return{changes:{from:a.from,insert:l},range:dQ.cursor(n.from+l.length)}}))}else n=s?r.changeByRange((e=>{let t=o.line(i++);return{changes:{from:e.from,to:e.to,insert:t.text},range:dQ.cursor(e.from+t.length)}})):r.replaceSelection(o);e.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function QW(e,t,n,r){if(1==r)return dQ.cursor(t,n);if(2==r)return function(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),o=t-i.from;if(0==i.length)return dQ.cursor(t);0==o?n=1:o==i.length&&(n=-1);let s=o,a=o;n<0?s=Gz(i.text,o,!1):a=Gz(i.text,o);let l=r(i.text.slice(s,a));for(;s>0;){let e=Gz(i.text,s,!1);if(r(i.text.slice(e,s))!=l)break;s=e}for(;a{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},PW.wheel=PW.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()},MW.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&0!=e.inputState.tabFocusMode&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),PW.touchstart=(e,t)=>{let n=e.inputState,r=t.targetTouches[0];n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin("select.pointer")},PW.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},MW.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of e.state.facet(qN))if(n=r(e,t),n)break;if(n||0!=t.button||(n=function(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=LW(t),i=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),i=i.map(e.changes))},get(t,o,s){let a,l=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),c=QW(e,l.pos,l.assoc,r);if(n.pos!=l.pos&&!o){let t=QW(e,n.pos,n.assoc,r),i=Math.min(t.from,c.from),o=Math.max(t.to,c.to);c=i1&&(a=function(e,t){for(let n=0;n=t)return dQ.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}(i,l.pos))?a:s?i.addRange(c):dQ.create([c])}}}(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new EW(e,t,n,r)),r&&e.observer.ignore((()=>{wN(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()}));let i=e.inputState.mouseSelection;if(i)return i.start(t),!1===i.dragging}else e.inputState.setSelectionOrigin("select.pointer");return!1};const IW=jI.ie&&jI.ie_version<=11;let NW=null,DW=0,WW=0;function LW(e){if(!IW)return e.detail;let t=NW,n=WW;return NW=e,WW=Date.now(),DW=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(DW+1)%3:1}function HW(e,t,n,r){if(!(n=$W(e.state,eD,n)))return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:o}=e.inputState,s=r&&o&&function(e,t){let n=e.state.facet(YN);return n.length?n[0](t):jI.mac?!t.altKey:!t.ctrlKey}(e,t)?{from:o.from,to:o.to}:null,a={from:i,insert:n},l=e.state.changes(s?[s,a]:a);e.focus(),e.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:s?"move.drop":"input.drop"}),e.inputState.draggedContent=null}MW.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let e=r.posAtStart,t=e+r.length;(e>=n.to||t<=n.from)&&(n=dQ.range(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",$W(e.state,tD,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1},MW.dragend=e=>(e.inputState.draggedContent=null,!1),MW.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,o=()=>{++i==n.length&&HW(e,t,r.filter((e=>null!=e)).join(e.state.lineBreak),!1)};for(let e=0;e{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(r[e]=t.result),o()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData("Text");if(n)return HW(e,t,n,!0),!0}return!1},MW.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=AW?null:t.clipboardData;return n?(zW(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(function(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout((()=>{e.focus(),n.remove(),zW(e,n.value)}),50)}(e),!1)};let VW=null;MW.copy=MW.cut=(e,t)=>{if(!aN(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=function(e){let t=[],n=[],r=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let i=-1;for(let{from:r}of e.selection.ranges){let o=e.doc.lineAt(r);o.number>i&&(t.push(o.text),n.push({from:o.from,to:Math.min(e.doc.length,o.to+1)})),i=o.number}r=!0}return{text:$W(e,tD,t.join(e.lineBreak)),ranges:n,linewise:r}}(e.state);if(!n&&!i)return!1;VW=i?n:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let o=AW?null:t.clipboardData;return o?(o.clearData(),o.setData("text/plain",n),!0):(function(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout((()=>{r.remove(),e.focus()}),50)}(e,n),!1)};const BW=DQ.define();function jW(e,t){let n=[];for(let r of e.facet(JN)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:BW.of(!0)}):null}function ZW(e){setTimeout((()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=jW(e.state,t);n?e.dispatch(n):e.update([])}}),10)}PW.focus=e=>{e.inputState.lastFocusTime=Date.now(),e.scrollDOM.scrollTop||!e.inputState.lastScrollTop&&!e.inputState.lastScrollLeft||(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),ZW(e)},PW.blur=e=>{e.observer.clearSelectionRange(),ZW(e)},PW.compositionstart=PW.compositionupdate=e=>{e.observer.editContext||(null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},PW.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,jI.chrome&&jI.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then((()=>e.observer.flush())):setTimeout((()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])}),50))},PW.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},MW.beforeinput=(e,t)=>{var n,r;if("insertText"!=t.inputType&&"insertCompositionText"!=t.inputType||(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),"insertReplacementText"==t.inputType&&e.observer.editContext){let r=null===(n=t.dataTransfer)||void 0===n?void 0:n.getData("text/plain"),i=t.getTargetRanges();if(r&&i.length){let t=i[0],n=e.posAtDOM(t.startContainer,t.startOffset),o=e.posAtDOM(t.endContainer,t.endOffset);return yW(e,{from:n,to:o,insert:e.state.toText(r)},null),!0}}let i;if(jI.chrome&&jI.android&&(i=CW.find((e=>e.inputType==t.inputType)))&&(e.observer.delayAndroidKey(i.key,i.keyCode),"Backspace"==i.key||"Delete"==i.key)){let t=(null===(r=window.visualViewport)||void 0===r?void 0:r.height)||0;setTimeout((()=>{var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())}),100)}return jI.ios&&"deleteContentForward"==t.inputType&&e.observer.flushSoon(),jI.safari&&"insertText"==t.inputType&&e.inputState.composing>=0&&setTimeout((()=>PW.compositionend(e,t)),20),!1};const XW=new Set,FW=["pre-wrap","normal","pre-line","break-spaces"];let YW=!1;function qW(){YW=!1}class UW{constructor(e){this.lineWrapping=e,this.doc=Hz.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return FW.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n-1,a=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=s||Math.abs(n-this.charWidth)>.1;if(this.lineWrapping=s,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=i,a){this.heightSamples={};for(let e=0;e0}set outdated(e){this.flags=(e?2:0)|-3&this.flags}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>eL&&(YW=!0),this.height=e)}replace(e,t,n){return tL.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,r){let i=this,o=n.doc;for(let s=r.length-1;s>=0;s--){let{fromA:a,toA:l,fromB:c,toB:h}=r[s],u=i.lineAt(a,JW.ByPosNoHeight,n.setDoc(t),0,0),d=u.to>=l?u:i.lineAt(l,JW.ByPosNoHeight,n,0,0);for(h+=d.to-l,l=d.to;s>0&&u.from<=r[s-1].toA;)a=r[s-1].fromA,c=r[s-1].fromB,s--,a2*i){let i=e[t-1];i.break?e.splice(--t,1,i.left,null,i.right):e.splice(--t,1,i.left,i.right),n+=1+i.break,r-=i.size}else{if(!(i>2*r))break;{let t=e[n];t.break?e.splice(n,1,t.left,null,t.right):e.splice(n,1,t.left,t.right),n+=2+t.break,i-=t.size}}else if(r=i&&o(this.lineAt(0,JW.ByPos,n,r,i))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class oL extends iL{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new KW(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,n){let r=n[0];return 1==n.length&&(r instanceof oL||r instanceof sL&&4&r.flags)&&Math.abs(this.length-r.length)<10?(r instanceof sL?r=new oL(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):tL.of(n)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more?this.setMeasuredHeight(r):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class sL extends tL{constructor(e){super(e,0)}heightMetrics(e,t){let n,r=e.doc.lineAt(t).number,i=e.doc.lineAt(t+this.length).number,o=i-r+1,s=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*o);n=t/o,this.length>o+1&&(s=(this.height-t)/(this.length-o-1))}else n=this.height/o;return{firstLine:r,lastLine:i,perLine:n,perChar:s}}blockAt(e,t,n,r){let{firstLine:i,lastLine:o,perLine:s,perChar:a}=this.heightMetrics(t,r);if(t.lineWrapping){let i=r+(e0){let e=n[n.length-1];e instanceof sL?n[n.length-1]=new sL(e.length+r):n.push(null,new sL(r-1))}if(e>0){let t=n[0];t instanceof sL?n[0]=new sL(e+t.length):n.unshift(new sL(e-1),null)}return tL.of(n)}decomposeLeft(e,t){t.push(new sL(e-1),null)}decomposeRight(e,t){t.push(null,new sL(this.length-e-1))}updateHeight(e,t=0,n=!1,r){let i=t+this.length;if(r&&r.from<=t+this.length&&r.more){let n=[],o=Math.max(t,r.from),s=-1;for(r.from>t&&n.push(new sL(r.from-t-1).updateHeight(e,t));o<=i&&r.more;){let t=e.doc.lineAt(o).length;n.length&&n.push(null);let i=r.heights[r.index++],a=0;i<0&&(a=-i,i=r.heights[r.index++]),-1==s?s=i:Math.abs(i-s)>=eL&&(s=-2);let l=new oL(t,i,a);l.outdated=!1,n.push(l),o+=t+1}o<=i&&n.push(null,new sL(i-o).updateHeight(e,o));let a=tL.of(n);return(s<0||Math.abs(a.height-this.height)>=eL||Math.abs(s-this.heightMetrics(e,t).perLine)>=eL)&&(YW=!0),nL(this,a)}return(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class aL extends tL{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return 1&this.flags}blockAt(e,t,n,r){let i=n+this.left.height;return es))return l;let c=t==JW.ByPosNoHeight?JW.ByPosNoHeight:JW.ByPos;return a?l.join(this.right.lineAt(s,c,n,o,s)):this.left.lineAt(s,c,n,r,i).join(l)}forEachLine(e,t,n,r,i,o){let s=r+this.left.height,a=i+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,t,n,s,a,o);else{let l=this.lineAt(a,JW.ByPos,n,r,i);e=e&&l.from<=t&&o(l),t>l.to&&this.right.forEachLine(l.to+1,t,n,s,a,o)}}replace(e,t,n){let r=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let i=[];e>0&&this.decomposeLeft(e,i);let o=i.length;for(let e of n)i.push(e);if(e>0&&lL(i,o-1),t=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e2*t.size||t.size>2*e.size?tL.of(this.break?[e,null,t]:[e,t]):(this.left=nL(this.left,e),this.right=nL(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,r){let{left:i,right:o}=this,s=t+i.length+this.break,a=null;return r&&r.from<=t+i.length&&r.more?a=i=i.updateHeight(e,t,n,r):i.updateHeight(e,t,n),r&&r.from<=s+o.length&&r.more?a=o=o.updateHeight(e,s,n,r):o.updateHeight(e,s,n),a?this.balanced(i,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function lL(e,t){let n,r;null==e[t]&&(n=e[t-1])instanceof sL&&(r=e[t+1])instanceof sL&&e.splice(t-1,3,new sL(n.length+1+r.length))}class cL{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof oL?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new oL(e-this.pos,-1,0)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e=5)&&this.addLineDeco(r,i,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new oL(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new sL(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof oL)return e;let t=new oL(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof oL||this.isCovered?(this.writtenTon.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=r.overflow){let r=n.getBoundingClientRect();o=Math.max(o,r.left),s=Math.min(s,r.right),a=Math.max(a,r.top),l=Math.min(t==e.parentNode?i.innerHeight:l,r.bottom)}t="absolute"==r.position||"fixed"==r.position?n.offsetParent:n.parentNode}else{if(11!=t.nodeType)break;t=t.host}return{left:o-n.left,right:Math.max(o,s)-n.left,top:a-(n.top+t),bottom:Math.max(a,l)-(n.top+t)}}function dL(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class fL{constructor(e,t,n,r){this.from=e,this.to=t,this.size=n,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n"function"!=typeof e&&"cm-lineWrapping"==e.class));this.heightOracle=new UW(n),this.stateDeco=OL(t),this.heightMap=tL.empty().applyChanges(this.stateDeco,Hz.empty,this.heightOracle.setDoc(t.doc),[new CD(0,0,0,t.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=KI.set(this.lineGaps.map((e=>e.draw(this,!1)))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let r=n?t.head:t.anchor;if(!e.some((({from:e,to:t})=>r>=e&&r<=t))){let{from:t,to:n}=this.lineBlockAt(r);e.push(new mL(t,n))}}return this.viewports=e.sort(((e,t)=>e.from-t.from)),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?yL:new wL(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(e=>{this.viewportLines.push(xL(e,this.scaler))}))}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=OL(this.state);let r=e.changedRanges,i=CD.extendWithRanges(r,function(e,t,n){let r=new hL;return oI.compare(e,t,n,r,0),r.changes}(n,this.stateDeco,e?e.changes:iQ.empty(this.state.doc.length))),o=this.heightMap.height,s=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);qW(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||YW)&&(e.flags|=2),s?(this.scrollAnchorPos=e.changes.mapPos(s.from,-1),this.scrollAnchorHeight=s.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let l=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(l||!e.changes.empty||2&e.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(rD)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,n=window.getComputedStyle(t),r=this.heightOracle,i=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?RN.RTL:RN.LTR;let o=this.heightOracle.mustRefreshForWrapping(i)||"refresh"===this.mustMeasureContent,s=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=s.height;this.contentDOMHeight=s.height,this.mustMeasureContent=!1;let l=0,c=0;if(s.width&&s.height){let{scaleX:e,scaleY:n}=mN(t,s);(e>.005&&Math.abs(this.scaleX-e)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=e,this.scaleY=n,l|=16,o=a=!0)}let h=(parseInt(n.paddingTop)||0)*this.scaleY,u=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==h&&this.paddingBottom==u||(this.paddingTop=h,this.paddingBottom=u,l|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,l|=16);let d=bN(this.view.contentDOM,!1).y;d!=this.scrollParent&&(this.scrollParent=d,this.scrollAnchorHeight=-1,this.scrollOffset=0);let f=this.getScrollOffset();this.scrollOffset!=f&&(this.scrollAnchorHeight=-1,this.scrollOffset=f),this.scrolledToBottom=kN(this.scrollParent||e.win);let p=(this.printing?dL:uL)(t,this.paddingTop),g=p.top-this.pixelViewport.top,m=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let b=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(b!=this.inView&&(this.inView=b,b&&(a=!0)),!this.inView&&!this.scrollTarget&&!function(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left0&&t.top0}(e.dom))return 0;let v=s.width;if(this.contentDOMWidth==v&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=s.width,this.editorHeight=e.scrollDOM.clientHeight,l|=16),a){let t=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(t)&&(o=!0),o||r.lineWrapping&&Math.abs(v-this.contentDOMWidth)>r.charWidth){let{lineHeight:n,charWidth:s,textHeight:a}=e.docView.measureTextSize();o=n>0&&r.refresh(i,n,s,a,Math.max(5,v/s),t),o&&(e.docView.minWidth=0,l|=16)}g>0&&m>0?c=Math.max(g,m):g<0&&m<0&&(c=Math.min(g,m)),qW();for(let n of this.viewports){let i=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(o?tL.empty().applyChanges(this.stateDeco,Hz.empty,this.heightOracle,[new CD(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new GW(n.from,i))}YW&&(l|=2)}let y=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return y&&(2&l&&(l|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),l|=this.updateForViewport()),(2&l||y)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),l|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),l}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,i=this.heightOracle,{visibleTop:o,visibleBottom:s}=this,a=new mL(r.lineAt(o-1e3*n,JW.ByHeight,i,0,0).from,r.lineAt(s+1e3*(1-n),JW.ByHeight,i,0,0).to);if(t){let{head:e}=t.range;if(ea.to){let n,o=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),s=r.lineAt(e,JW.ByPos,i,0,0);n="center"==t.y?(s.top+s.bottom)/2-o/2:"start"==t.y||"nearest"==t.y&&e=s+Math.max(10,Math.min(n,250)))&&r>o-2e3&&i>1,o=r<<1;if(this.defaultTextDirection!=RN.LTR&&!n)return[];let s=[],a=(r,o,l,c)=>{if(o-rr&&ee.from>=l.from&&e.to<=l.to&&Math.abs(e.from-r)e.fromt))));if(!d){if(oe.from<=o&&e.to>=o))){let e=t.moveToLineBoundary(dQ.cursor(o),!1,!0).head;e>r&&(o=e)}let e=this.gapSize(l,r,o,c);d=new fL(r,o,e,n||e<2e6?e:2e6)}s.push(d)},l=t=>{if(t.lengthi&&(r.push({from:i,to:e}),o+=e-i),i=t}},20),i2e6)for(let n of e)n.from>=t.from&&n.fromt.from&&a(t.from,s,t,i),le.draw(this,this.heightOracle.lineWrapping)))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];oI.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let t=0;t=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find((t=>t.from<=e&&t.to>=e))||xL(this.heightMap.lineAt(e,JW.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find((t=>t.top<=e&&t.bottom>=e))||xL(this.heightMap.lineAt(this.scaler.fromDOM(e),JW.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return xL(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class mL{constructor(e,t){this.from=e,this.to=t}}function bL({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:i}=t[e],o=i-n;if(r<=o)return n+r;r-=o}}function vL(e,t){let n=0;for(let{from:r,to:i}of e.ranges){if(t<=i){n+=t-r;break}n+=i-r}return n/e.total}const yL={toDOM:e=>e,fromDOM:e=>e,scale:1,eq(e){return e==this}};function OL(e){let t=e.facet(mD).filter((e=>"function"!=typeof e)),n=e.facet(vD).filter((e=>"function"!=typeof e));return n.length&&t.push(oI.join(n)),t}class wL{constructor(e,t,n){let r=0,i=0,o=0;this.viewports=n.map((({from:n,to:i})=>{let o=t.lineAt(n,JW.ByPos,e,0,0).top,s=t.lineAt(i,JW.ByPos,e,0,0).bottom;return r+=s-o,{from:n,to:i,top:o,bottom:s,domTop:0,domBottom:0}})),this.scale=(7e6-r)/(t.height-r);for(let e of this.viewports)e.domTop=o+(e.top-i)*this.scale,o=e.domBottom=e.domTop+(e.bottom-e.top),i=e.bottom}toDOM(e){for(let t=0,n=0,r=0;;t++){let i=tt.from==e.viewports[n].from&&t.to==e.viewports[n].to))}}function xL(e,t){if(1==t.scale)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new KW(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map((e=>xL(e,t))):e._content)}const SL=gQ.define({combine:e=>e.join(" ")}),kL=gQ.define({combine:e=>e.indexOf(!0)>-1}),CL=xI.newName(),_L=xI.newName(),TL=xI.newName(),RL={"&light":"."+_L,"&dark":"."+TL};function EL(e,t,n){return new xI(t,{finish:t=>/&/.test(t)?t.replace(/&\w*/,(t=>{if("&"==t)return e;if(!n||!n[t])throw new RangeError(`Unsupported selector: ${t}`);return n[t]})):e+" "+t})}const ML=EL("."+CL,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},RL),PL={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},AL=jI.ie&&jI.ie_version<=11;class $L{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new vN,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver((t=>{for(let e of t)this.queue.push(e);(jI.ie&&jI.ie_version<=11||jI.ios&&e.composing)&&t.some((e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),!window.EditContext||!jI.android||!1===e.constructor.EDIT_CONTEXT||jI.chrome&&jI.chrome_version<126||(this.editContext=new IL(e),e.state.facet(cD)&&(e.contentDOM.editContext=this.editContext.editContext)),AL&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((()=>{var e;(null===(e=this.view.docView)||void 0===e?void 0:e.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))}),{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver((e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((()=>{this.resizeTimeout=-1,this.view.requestMeasure()}),50))}onPrint(e){("change"!=e.type&&e.type||e.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout((()=>{this.view.viewState.printing=!1,this.view.requestMeasure()}),500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some(((t,n)=>t!=e[n])))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(cD)?n.root.activeElement!=this.dom:!aN(this.dom,r))return;let i=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);i&&i.isWidget()&&i.widget.ignoreEvent(e)?t||(this.selectionChanged=!1):(jI.ie&&jI.ie_version<=11||jI.android&&jI.chrome)&&!n.state.selection.main.empty&&r.focusNode&&cN(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=oN(e.root);if(!t)return!1;let n=jI.safari&&11==e.root.nodeType&&e.root.activeElement==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return QL(e,n)}let n=null;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",r,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",r,!0),n?QL(e,n):null}(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=aN(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&SN(this.dom,e.key,e.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&"Enter"!=e||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()})))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,r=!1;for(let i of e){let e=this.readMutation(i);e&&(e.typeOver&&(r=!0),-1==t?({from:t,to:n}=e):(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:r}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),r=this.selectionChanged&&aN(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new mW(this.view,e,t,n);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,r=vW(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!wW(this.view.state.selection,t.newSel.main))&&this.view.update([]),r}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty("attributes"==e.type),"childList"==e.type){let n=zL(t,e.previousSibling||e.target.previousSibling,-1),r=zL(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(cD)!=e.state.facet(cD)&&(e.view.contentDOM.editContext=e.state.facet(cD)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),null===(e=this.intersection)||void 0===e||e.disconnect(),null===(t=this.gapIntersection)||void 0===t||t.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect();for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function zL(e,t,n){for(;t;){let r=RD.get(t);if(r&&r.parent==e)return r;let i=t.parentNode;t=i!=e.dom?i:n>0?t.nextSibling:t.previousSibling}return null}function QL(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,o=t.endOffset,s=e.docView.domAtPos(e.state.selection.main.anchor,1);return cN(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}class IL{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let r=e.state.selection.main,{anchor:i,head:o}=r,s=this.toEditorPos(n.updateRangeStart),a=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:s,drifted:!1});let l=a-s>n.text.length;s==this.from&&ithis.to&&(a=i);let c=OW(e.state.sliceDoc(s,a),n.text,(l?r.from:r.to)-s,l?"end":null);if(!c){let t=dQ.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));return void(wW(t,r)||e.dispatch({selection:t,userEvent:"select"}))}let h={from:c.from+s,to:c.toA+s,insert:Hz.of(n.text.slice(c.from,c.toB).split("\n"))};if((jI.mac||jI.android)&&h.from==o-1&&/^\. ?$/.test(n.text)&&"off"==e.contentDOM.getAttribute("autocorrect")&&(h={from:s,to:a,insert:Hz.of([n.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let t=this.to-this.from+(h.to-h.from+h.insert.length);yW(e,h,dQ.single(this.toEditorPos(n.selectionStart,t),this.toEditorPos(n.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),h.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],i=null;for(let t=this.toEditorPos(n.rangeStart),o=this.toEditorPos(n.rangeEnd);t{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,r=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(r)){let i=this.toEditorPos(e.rangeStart),o=this.toEditorPos(e.rangeEnd);if(i{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{this.editContext.updateControlBounds(e.contentDOM.getBoundingClientRect());let t=oN(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges(((i,o,s,a,l)=>{if(n)return;let c=l.length-(o-i);if(r&&o>=r.to){if(r.from==i&&r.to==o&&r.insert.eq(l))return r=this.pendingContextChange=null,t+=c,void(this.to+=c);r=null,this.revertPending(e.state)}if(i+=t,(o+=t)<=this.from)this.from+=c,this.to+=c;else if(ithis.to||this.to-this.from+l.length>3e4)return void(n=!0);this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),l.toString()),this.to+=c}t+=c})),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some((e=>!e.isUserEvent("input.type")&&e.changes.touchesRange(this.from,this.to))))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):this.applyEdits(e)&&this.rangeIsValid(e.state)?(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state):(this.pendingContextChange=null,this.reset(e.state)),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);this.editContext.selectionStart==n&&this.editContext.selectionEnd==r||this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class NL{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(e=>e.forEach((e=>n(e,this))))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(e.parent)||document,this.viewState=new gL(this,e.state||KQ.create(e)),e.scrollTo&&e.scrollTo.is(sD)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(uD).map((e=>new fD(e)));for(let e of this.plugins)e.update(this);this.observer=new $L(this),this.inputState=new xW(this),this.inputState.ensureHandlers(this.plugins),this.docView=new GD(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null===(t=document.fonts)||void 0===t?void 0:t.ready)&&document.fonts.ready.then((()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()}))}dispatch(...e){let t=1==e.length&&e[0]instanceof VQ?e:1==e.length&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t,n=!1,r=!1,i=this.state;for(let t of e){if(t.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=t.state}if(this.destroyed)return void(this.viewState.state=i);let o=this.hasFocus,s=0,a=null;e.some((e=>e.annotation(BW)))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=jW(i,o),a||(s=1));let l=this.observer.delayedAndroidKey,c=null;if(l?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(c=null)):this.observer.clear(),i.facet(KQ.phrases)!=this.state.facet(KQ.phrases))return this.setState(i);t=_D.create(this,i,e),t.flags|=s;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let t of e){if(h&&(h=h.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection;h=new oD(e.empty?e:dQ.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(sD)&&(h=e.value.clip(this.state))}this.viewState.update(t,h),this.bidiCache=LL.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),n=this.docView.update(t),this.state.facet(kD)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some((e=>e.isUserEvent("select.pointer"))))}finally{this.updateState=0}if(t.startState.facet(SL)!=t.state.facet(SL)&&(this.viewState.mustMeasureContent=!0),(n||r||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!t.empty)for(let e of this.state.facet(GN))try{e(t)}catch(e){lD(this.state,e,"update listener")}(a||c)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!vW(this,c)&&l.force&&SN(this.contentDOM,l.key,l.keyCode)}))}setState(e){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=e);this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new gL(this,e),this.plugins=e.facet(uD).map((e=>new fD(e))),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new GD(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(uD),n=e.state.facet(uD);if(t!=n){let r=[];for(let i of n){let n=t.indexOf(i);if(n<0)r.push(new fD(i));else{let t=this.plugins[n];t.mustUpdate=e,r.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:i,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(o<0)if(kN(n||this.win))i=-1,o=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(r);i=e.from,o=e.top}this.updateState=1;let s=this.viewState.measure();if(!s&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(e>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let a=[];4&s||([this.measureRequests,a]=[a,this.measureRequests]);let l=a.map((e=>{try{return e.read(this)}catch(e){return lD(this.state,e),WL}})),c=_D.create(this,this.state,[]),h=!1;c.flags|=s,t?t.flags|=s:t=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),h=this.docView.update(c),h&&this.docViewUpdate());for(let e=0;e1||e<-1)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r+=e,n?n.scrollTop+=e:this.win.scrollBy(0,e),o=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(GN))e(t)}get themeClasses(){return CL+" "+(this.state.facet(kL)?TL:_L)+" "+this.state.facet(SL)}updateAttrs(){let e=HL(this,pD,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(cD)?"true":"false",class:"cm-content",style:`${jI.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),HL(this,gD,t);let n=this.observer.ignore((()=>{let n=YI(this.contentDOM,this.contentAttrs,t),r=YI(this.dom,this.editorAttrs,e);return n||r}));return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let e of n.effects)e.is(NL.announce)&&(t&&(this.announceDOM.textContent=""),t=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value)}mountStyles(){this.styleModules=this.state.facet(kD);let e=this.state.facet(NL.cspNonce);xI.mount(this.root,this.styleModules.concat(ML).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((()=>this.measure()))),e){if(this.measureRequests.indexOf(e)>-1)return;if(null!=e.key)for(let t=0;tt.plugin==e))||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return aW(this,e,iW(this,e,t,n))}moveByGroup(e,t){return aW(this,e,iW(this,e,t,(t=>function(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return e=>{let t=r(e);return i==qQ.Space&&(i=t),i==t}}(this,e.head,t))))}visualLineSide(e,t){let n=this.bidiSpans(e),r=this.textDirectionAt(e.from),i=n[t?n.length-1:0];return dQ.cursor(i.side(t,r)+e.from,i.forward(!t,r)?1:-1)}moveToLineBoundary(e,t,n=!0){return function(e,t,n,r){let i=rW(e,t.head,t.assoc||-1),o=r&&i.type==GI.Text&&(e.lineWrapping||i.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>i.from?t.head-1:t.head):null;if(o){let t=e.dom.getBoundingClientRect(),r=e.textDirectionAt(i.from),s=e.posAtCoords({x:n==(r==RN.LTR)?t.right-1:t.left+1,y:(o.top+o.bottom)/2});if(null!=s)return dQ.cursor(s,n?-1:1)}return dQ.cursor(n?i.to:i.from,n?-1:1)}(this,e,t,n)}moveVertically(e,t,n){return aW(this,e,function(e,t,n,r){let i=t.head,o=n?1:-1;if(i==(n?e.state.doc.length:0))return dQ.cursor(i,t.assoc);let s,a=t.goalColumn,l=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(i,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),h=e.documentTop;if(c)null==a&&(a=c.left-l.left),s=o<0?c.top:c.bottom;else{let t=e.viewState.lineBlockAt(i);null==a&&(a=Math.min(l.right-l.left,e.defaultCharacterWidth*(i-t.from))),s=(o<0?t.top:t.bottom)+h}let u=l.left+a,d=e.viewState.heightOracle.textHeight>>1,f=null!=r?r:d;for(let t=0;;t+=d){let r=s+(f+t)*o,i=cW(e,{x:u,y:r},!1,o);if(n?r>l.bottom:rs:h0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(nD)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>DL)return BN(e.length);let t,n=this.textDirectionAt(e.from);for(let r of this.bidiCache)if(r.from==e.from&&r.dir==n&&(r.fresh||WN(r.isolates,t=wD(this,e))))return r.order;t||(t=wD(this,e));let r=function(e,t,n){if(!e)return[new DN(0,0,t==MN?1:0)];if(t==EN&&!n.length&&!NN.test(e))return BN(e.length);if(n.length)for(;e.length>LN.length;)LN[LN.length]=256;let r=[],i=t==EN?0:1;return VN(e,i,i,n,0,e.length,r),r}(e.text,n,t);return this.bidiCache.push(new LL(e.from,e.to,n,t,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||jI.safari&&(null===(e=this.inputState)||void 0===e?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{wN(this.contentDOM),this.docView.updateSelection()}))}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return sD.of(new oD("number"==typeof e?dQ.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return sD.of(new oD(dQ.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){null==e?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof e?this.inputState.tabFocusMode=e?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return dD.define((()=>({})),{eventHandlers:e})}static domEventObservers(e){return dD.define((()=>({})),{eventObservers:e})}static theme(e,t){let n=xI.newName(),r=[SL.of(n),kD.of(EL(`.${n}`,e))];return t&&t.dark&&r.push(kL.of(!0)),r}static baseTheme(e){return kQ.lowest(kD.of(EL("."+CL,e,RL)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),r=n&&RD.get(n)||RD.get(e);return(null===(t=null==r?void 0:r.root)||void 0===t?void 0:t.view)||null}}NL.styleModule=kD,NL.inputHandler=KN,NL.clipboardInputFilter=eD,NL.clipboardOutputFilter=tD,NL.scrollHandler=iD,NL.focusChangeEffect=JN,NL.perLineTextDirection=nD,NL.exceptionSink=UN,NL.updateListener=GN,NL.editable=cD,NL.mouseSelectionStyle=qN,NL.dragMovesSelection=YN,NL.clickAddsSelectionRange=FN,NL.decorations=mD,NL.blockWrappers=bD,NL.outerDecorations=vD,NL.atomicRanges=yD,NL.bidiIsolatedRanges=OD,NL.scrollMargins=xD,NL.darkTheme=kL,NL.cspNonce=gQ.define({combine:e=>e.length?e[0]:""}),NL.contentAttributes=gD,NL.editorAttributes=pD,NL.lineWrapping=NL.contentAttributes.of({class:"cm-lineWrapping"}),NL.announce=HQ.define();const DL=4096,WL={};class LL{constructor(e,t,n,r,i,o){this.from=e,this.to=t,this.dir=n,this.isolates=r,this.fresh=i,this.order=o}static update(e,t){if(t.empty&&!e.some((e=>e.fresh)))return e;let n=[],r=e.length?e[e.length-1].dir:RN.LTR;for(let i=Math.max(0,e.length-10);i=0;i--){let t=r[i],o="function"==typeof t?t(e):t;o&&ZI(o,n)}return n}const VL=jI.mac?"mac":jI.windows?"win":jI.linux?"linux":"key";function BL(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}const jL=kQ.default(NL.domEventHandlers({keydown:(e,t)=>GL(FL(t.state),e,t,"editor")})),ZL=gQ.define({enables:jL}),XL=new WeakMap;function FL(e){let t=e.facet(ZL),n=XL.get(t);return n||XL.set(t,n=function(e,t=VL){let n=Object.create(null),r=Object.create(null),i=(e,t)=>{let n=r[e];if(null==n)r[e]=t;else if(n!=t)throw new Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},o=(e,r,o,s,a)=>{var l,c;let h=n[e]||(n[e]=Object.create(null)),u=r.split(/ (?!$)/).map((e=>function(e,t){const n=e.split(/-(?!$)/);let r,i,o,s,a=n[n.length-1];"Space"==a&&(a=" ");for(let e=0;e{let r=YL={view:t,prefix:n,scope:e};return setTimeout((()=>{YL==r&&(YL=null)}),qL),!0}]})}let d=u.join(" ");i(d,!1);let f=h[d]||(h[d]={preventDefault:!1,stopPropagation:!1,run:(null===(c=null===(l=h._any)||void 0===l?void 0:l.run)||void 0===c?void 0:c.slice())||[]});o&&f.run.push(o),s&&(f.preventDefault=!0),a&&(f.stopPropagation=!0)};for(let r of e){let e=r.scope?r.scope.split(" "):["editor"];if(r.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||(e._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:i}=r;for(let t in e)e[t].run.push((e=>i(e,UL)))}let i=r[t]||r.key;if(i)for(let t of e)o(t,i,r.run,r.preventDefault,r.stopPropagation),r.shift&&o(t,"Shift-"+i,r.shift,r.preventDefault,r.stopPropagation)}return n}(t.reduce(((e,t)=>e.concat(t)),[]))),n}let YL=null;const qL=4e3;let UL=null;function GL(e,t,n,r){UL=t;let i=function(e){var t=!(TI&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||RI&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?_I:CI)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(t),o=eQ(Kz(i,0))==i.length&&" "!=i,s="",a=!1,l=!1,c=!1;YL&&YL.view==n&&YL.scope==r&&(s=YL.prefix+" ",TW.indexOf(t.keyCode)<0&&(l=!0,YL=null));let h,u,d=new Set,f=e=>{if(e){for(let t of e.run)if(!d.has(t)&&(d.add(t),t(n)))return e.stopPropagation&&(c=!0),!0;e.preventDefault&&(e.stopPropagation&&(c=!0),l=!0)}return!1},p=e[r];return p&&(f(p[s+BL(i,t,!o)])?a=!0:!o||!(t.altKey||t.metaKey||t.ctrlKey)||jI.windows&&t.ctrlKey&&t.altKey||jI.mac&&t.altKey&&!t.ctrlKey&&!t.metaKey||!(h=CI[t.keyCode])||h==i?o&&t.shiftKey&&f(p[s+BL(i,t,!0)])&&(a=!0):(f(p[s+BL(h,t,!0)])||t.shiftKey&&(u=_I[t.keyCode])!=i&&u!=h&&f(p[s+BL(u,t,!1)]))&&(a=!0),!a&&f(p._any)&&(a=!0)),l&&(a=!0),a&&c&&t.stopPropagation(),UL=null,a}class KL{constructor(e,t,n,r,i){this.className=e,this.left=t,this.top=n,this.width=r,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",null!=this.width&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,n){if(n.empty){let r=e.coordsAtPos(n.head,n.assoc||1);if(!r)return[];let i=JL(e);return[new KL(t,r.left-i.left,r.top-i.top,null,r.bottom-r.top)]}return function(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),i=Math.min(n.to,e.viewport.to),o=e.textDirection==RN.LTR,s=e.contentDOM,a=s.getBoundingClientRect(),l=JL(e),c=s.querySelector(".cm-line"),h=c&&window.getComputedStyle(c),u=a.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),d=a.right-(h?parseInt(h.paddingRight):0),f=rW(e,r,1),p=rW(e,i,-1),g=f.type==GI.Text?f:null,m=p.type==GI.Text?p:null;if(g&&(e.lineWrapping||f.widgetLineBreaks)&&(g=eH(e,r,1,g)),m&&(e.lineWrapping||p.widgetLineBreaks)&&(m=eH(e,i,-1,m)),g&&m&&g.from==m.from&&g.to==m.to)return v(y(n.from,n.to,g));{let t=g?y(n.from,null,g):O(f,!1),r=m?y(null,n.to,m):O(p,!0),i=[];return(g||f).to<(m||p).from-(g&&m?1:0)||f.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2c&&r.from=o)break;a>i&&l(Math.max(e,i),null==t&&e<=c,Math.min(a,o),null==n&&a>=h,s.dir)}if(i=r.to+1,i>=o)break}return 0==a.length&&l(c,null==t,h,null==n,e.textDirection),{top:i,bottom:s,horizontal:a}}function O(e,t){let n=a.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}(e,t,n)}}function JL(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==RN.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function eH(e,t,n,r){let i=e.coordsAtPos(t,2*n);if(!i)return r;let o=e.dom.getBoundingClientRect(),s=(i.top+i.bottom)/2,a=e.posAtCoords({x:o.left+1,y:s}),l=e.posAtCoords({x:o.right-1,y:s});return null==a||null==l?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}class tH{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(nH)!=e.state.facet(nH)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){!1!==this.layer.updateOnDocViewUpdate&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(nH);for(;t!function(e,t){return e.constructor==t.constructor&&e.eq(t)}(e,this.drawn[t])))){let t=this.dom.firstChild,n=0;for(let r of e)r.update&&t&&r.constructor&&this.drawn[n].constructor&&r.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(r.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e,jI.safari&&jI.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const nH=gQ.define();function rH(e){return[dD.define((t=>new tH(t,e))),nH.of(e)]}const iH=gQ.define({combine:e=>JQ(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})});function oH(e){return e.startState.facet(iH)!=e.state.facet(iH)}const sH=rH({above:!0,markers(e){let{state:t}=e,n=t.facet(iH),r=[];for(let i of t.selection.ranges){let o=i==t.selection.main;if(i.empty||n.drawRangeCursor&&!(o&&jI.ios&&n.iosSelectionHandles)){let t=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",n=i.empty?i:dQ.cursor(i.head,i.assoc);for(let i of KL.forRange(e,t,n))r.push(i)}}return r},update(e,t){e.transactions.some((e=>e.selection))&&(t.style.animationName="cm-blink"==t.style.animationName?"cm-blink2":"cm-blink");let n=oH(e);return n&&aH(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){aH(t.state,e)},class:"cm-cursorLayer"});function aH(e,t){t.style.animationDuration=e.facet(iH).cursorBlinkRate+"ms"}const lH=rH({above:!1,markers(e){let t=[],{main:n,ranges:r}=e.state.selection;for(let n of r)if(!n.empty)for(let r of KL.forRange(e,"cm-selectionBackground",n))t.push(r);if(jI.ios&&!n.empty&&e.state.facet(iH).iosSelectionHandles){for(let r of KL.forRange(e,"cm-selectionHandle cm-selectionHandle-start",dQ.cursor(n.from,1)))t.push(r);for(let r of KL.forRange(e,"cm-selectionHandle cm-selectionHandle-end",dQ.cursor(n.to,1)))t.push(r)}return t},update:(e,t)=>e.docChanged||e.selectionSet||e.viewportChanged||oH(e),class:"cm-selectionLayer"}),cH=kQ.highest(NL.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),hH=HQ.define({map:(e,t)=>null==e?null:t.mapPos(e)}),uH=xQ.define({create:()=>null,update:(e,t)=>(null!=e&&(e=t.changes.mapPos(e)),t.effects.reduce(((e,t)=>t.is(hH)?t.value:e),e))}),dH=dD.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(uH);null==n?null!=this.cursor&&(null===(t=this.cursor)||void 0===t||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(uH)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(uH),n=null!=t&&e.coordsAtPos(t);if(!n)return null;let r=e.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-r.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+"px",this.cursor.style.top=e.top/n+"px",this.cursor.style.height=e.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(uH)!=e&&this.view.dispatch({effects:hH.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){e.target!=this.view.contentDOM&&this.view.contentDOM.contains(e.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function fH(e,t,n,r,i){t.lastIndex=0;for(let o,s=e.iterRange(n,r),a=n;!s.next().done;a+=s.value.length)if(!s.lineBreak)for(;o=t.exec(s.value);)i(a+o.index,o)}class pH{constructor(e){const{regexp:t,decoration:n,decorate:r,boundary:i,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,r)this.addMatch=(e,t,n,i)=>r(i,n,n+e[0].length,e,t);else if("function"==typeof n)this.addMatch=(e,t,r,i)=>{let o=n(e,t,r);o&&i(r,r+e[0].length,o)};else{if(!n)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(e,t,r,i)=>i(r,r+e[0].length,n)}this.boundary=i,this.maxLength=o}createDeco(e){let t=new sI,n=t.add.bind(t);for(let{from:t,to:r}of function(e,t){let n=e.visibleRanges;if(1==n.length&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let r=[];for(let{from:i,to:o}of n)i=Math.max(e.state.doc.lineAt(i).from,i-t),o=Math.min(e.state.doc.lineAt(o).to,o+t),r.length&&r[r.length-1].to>=i?r[r.length-1].to=o:r.push({from:i,to:o});return r}(e,this.maxLength))fH(e.state.doc,this.regexp,t,r,((t,r)=>this.addMatch(r,e,t,n)));return t.finish()}updateDeco(e,t){let n=1e9,r=-1;return e.docChanged&&e.changes.iterChanges(((t,i,o,s)=>{s>=e.view.viewport.from&&o<=e.view.viewport.to&&(n=Math.min(o,n),r=Math.max(s,r))})),e.viewportMoved||r-n>1e3?this.createDeco(e.view):r>-1?this.updateRange(e.view,t.map(e.changes),n,r):t}updateRange(e,t,n,r){for(let i of e.visibleRanges){let o=Math.max(i.from,n),s=Math.min(i.to,r);if(s>=o){let n=e.state.doc.lineAt(o),r=n.ton.from;o--)if(this.boundary.test(n.text[o-1-n.from])){a=o;break}for(;sh.push(n.range(e,t));if(n==r)for(this.regexp.lastIndex=a-n.from;(c=this.regexp.exec(n.text))&&c.indexthis.addMatch(n,e,t,u)));t=t.update({filterFrom:a,filterTo:l,filter:(e,t)=>el,add:h})}}return t}}const gH=null!=/x/.unicode?"gu":"g",mH=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",gH),bH={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let vH=null;const yH=gQ.define({combine(e){let t=JQ(e,{render:null,specialChars:mH,addSpecialChars:null});return(t.replaceTabs=!function(){var e;if(null==vH&&"undefined"!=typeof document&&document.body){let t=document.body.style;vH=null!=(null!==(e=t.tabSize)&&void 0!==e?e:t.MozTabSize)}return vH||!1}())&&(t.specialChars=new RegExp("\t|"+t.specialChars.source,gH)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,gH)),t}});let OH=null;class wH extends UI{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=function(e){return e>=32?"•":10==e?"␤":String.fromCharCode(9216+e)}(this.code),n=e.state.phrase("Control character")+" "+(bH[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,t);if(r)return r;let i=document.createElement("span");return i.textContent=t,i.title=n,i.setAttribute("aria-label",n),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class xH extends UI{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent="\t",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}const SH=KI.line({class:"cm-activeLine"}),kH=dD.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let r of e.state.selection.ranges){let i=e.lineBlockAt(r.head);i.from>t&&(n.push(SH.range(i.from)),t=i.from)}return KI.set(n)}},{decorations:e=>e.decorations});class CH extends UI{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):"function"==typeof this.content?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?lN(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),r=pN(t[0],"rtl"!=n.direction),i=parseInt(n.lineHeight);return r.bottom-r.top>1.5*i?{left:r.left,right:r.right,top:r.top,bottom:r.top+i}:r}ignoreEvent(){return!1}}const _H=2e3;function TH(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),r=e.state.doc.lineAt(n),i=n-r.from,o=i>_H?-1:i==r.length?function(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}(e,t.clientX):bI(r.text,e.state.tabSize,n-r.from);return{line:r.number,col:o,off:i}}const RH={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},EH={style:"cursor: crosshair"},MH="-10000px";class PH{constructor(e,t,n,r){this.facet=t,this.createTooltipView=n,this.removeTooltipView=r,this.input=e.state.facet(t),this.tooltips=this.input.filter((e=>e));let i=null;this.tooltipViews=this.tooltips.map((e=>i=n(e,i)))}update(e,t){var n;let r=e.state.facet(this.facet),i=r.filter((e=>e));if(r===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let o=[],s=t?[]:null;for(let n=0;nt[n]=e)),t.length=s.length),this.input=r,this.tooltips=i,this.tooltipViews=o,!0}}function AH(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const $H=gQ.define({combine:e=>{var t,n,r;return{position:jI.ios?"absolute":(null===(t=e.find((e=>e.position)))||void 0===t?void 0:t.position)||"fixed",parent:(null===(n=e.find((e=>e.parent)))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(r=e.find((e=>e.tooltipSpace)))||void 0===r?void 0:r.tooltipSpace)||AH}}}),zH=new WeakMap,QH=dD.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet($H);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver((()=>this.measureSoon())):null,this.manager=new PH(e,WH,((e,t)=>this.createTooltip(e,t)),(e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()})),this.above=this.manager.tooltips.map((e=>!!e.above)),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,r=e.state.facet($H);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),r=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=MH,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),null===(e=t.destroy)||void 0===e||e.call(t);this.parent&&this.container.remove(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(n=this.intersectionObserver)||void 0===n||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(jI.safari){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else n=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(n||"absolute"==this.position)if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=SD(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map(((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)})),size:this.manager.tooltipViews.map((({dom:e})=>e.getBoundingClientRect())),space:this.view.state.facet($H).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let e of this.manager.tooltipViews)e.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:o}=e,s=[];for(let a=0;a=Math.min(n.bottom,r.bottom)||u.rightMath.min(n.right,r.right)+.1)){h.style.top=MH;continue}let f=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=f?7:0,g=d.right-d.left,m=null!==(t=zH.get(c))&&void 0!==t?t:d.bottom-d.top,b=c.offset||DH,v=this.view.textDirection==RN.LTR,y=d.width>r.right-r.left?v?r.left:r.right-d.width:v?Math.max(r.left,Math.min(u.left-(f?14:0)+b.x,r.right-g)):Math.min(Math.max(r.left,u.left-g+(f?14:0)-b.x),r.right-g),O=this.above[a];!l.strictSide&&(O?u.top-m-p-b.yr.bottom)&&O==r.bottom-u.bottom>u.top-r.top&&(O=this.above[a]=!O);let w=(O?u.top-r.top:r.bottom-u.bottom)-p;if(wy&&e.topx&&(x=O?e.top-m-2-p:e.bottom+p+2);if("absolute"==this.position?(h.style.top=(x-e.parent.top)/o+"px",IH(h,(y-e.parent.left)/i)):(h.style.top=x/o+"px",IH(h,y/i)),f){let e=u.left+(v?b.x:-b.x)-(y+14-7);f.style.left=e/i+"px"}!0!==c.overlap&&s.push({left:y,top:x,right:S,bottom:x+m}),h.classList.toggle("cm-tooltip-above",O),h.classList.toggle("cm-tooltip-below",!O),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=MH}},{eventObservers:{scroll(){this.maybeMeasure()}}});function IH(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const NH=NL.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),DH={x:0,y:0},WH=gQ.define({enables:[QH,NH]}),LH=gQ.define({combine:e=>e.reduce(((e,t)=>e.concat(t)),[])});class HH{static create(e){return new HH(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new PH(e,LH,((e,t)=>this.createHostedView(e,t)),(e=>e.dom.remove()))}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)null===(e=t.destroy)||void 0===e||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let r=n[e];if(void 0!==r)if(void 0===t)t=r;else if(t!==r)return}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const VH=WH.compute([LH],(e=>{let t=e.facet(LH);return 0===t.length?null:{pos:Math.min(...t.map((e=>e.pos))),end:Math.max(...t.map((e=>{var t;return null!==(t=e.end)&&void 0!==t?t:e.pos}))),create:HH.create,above:t[0].above,arrow:t.some((e=>e.arrow))}}));class BH{constructor(e,t,n,r,i){this.view=e,this.source=t,this.field=n,this.setHover=r,this.hoverTime=i,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout((()=>this.startHover()),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;en.bottom||t.xn.right+e.defaultCharacterWidth)return;let o=e.bidiSpans(e.state.doc.lineAt(r)).find((e=>e.from<=r&&e.to>=r)),s=o&&o.dir==RN.RTL?-1:1;i=t.x{this.pending==t&&(this.pending=null,!n||Array.isArray(n)&&!n.length||e.dispatch({effects:this.setHover.of(Array.isArray(n)?n:[n])}))}),(t=>lD(e.state,t,"hover tooltip")))}else!o||Array.isArray(o)&&!o.length||e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(QH),t=e?e.manager.tooltips.findIndex((e=>e.create==HH.create)):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:r,tooltip:i}=this;if(r.length&&i&&!function(e,t){let n,{left:r,right:i,top:o,bottom:s}=e.getBoundingClientRect();if(n=e.querySelector(".cm-tooltip-arrow")){let e=n.getBoundingClientRect();o=Math.min(e.top,o),s=Math.max(e.bottom,s)}return t.clientX>=r-jH&&t.clientX<=i+jH&&t.clientY>=o-jH&&t.clientY<=s+jH}(i.dom,e)||this.pending){let{pos:i}=r[0]||this.pending,o=null!==(n=null===(t=r[0])||void 0===t?void 0:t.end)&&void 0!==n?n:i;(i==o?this.view.posAtCoords(this.lastMove)==i:function(e,t,n,r,i,o){let s=e.scrollDOM.getBoundingClientRect(),a=e.documentTop+e.documentPadding.top+e.contentHeight;if(s.left>r||s.righti||Math.min(s.bottom,a)=t&&l<=n}(this.view,i,o,e.clientX,e.clientY))||(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const jH=4;function ZH(e,t={}){let n=HQ.define(),r=xQ.define({create:()=>[],update(e,r){if(e.length&&(t.hideOnChange&&(r.docChanged||r.selection)?e=[]:t.hideOn&&(e=e.filter((e=>!t.hideOn(r,e)))),r.docChanged)){let t=[];for(let n of e){let e=r.changes.mapPos(n.pos,-1,nQ.TrackDel);if(null!=e){let i=Object.assign(Object.create(null),n);i.pos=e,null!=i.end&&(i.end=r.changes.mapPos(i.end)),t.push(i)}}e=t}for(let t of r.effects)t.is(n)&&(e=t.value),t.is(FH)&&(e=[]);return e},provide:e=>LH.from(e)});return{active:r,extension:[r,dD.define((i=>new BH(i,e,r,n,t.hoverTime||300))),VH]}}function XH(e,t){let n=e.plugin(QH);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}const FH=HQ.define(),YH=gQ.define({combine(e){let t,n;for(let r of e)t=t||r.topContainer,n=n||r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function qH(e,t){let n=e.plugin(UH),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}const UH=dD.fromClass(class{constructor(e){this.input=e.state.facet(JH),this.specs=this.input.filter((e=>e)),this.panels=this.specs.map((t=>t(e)));let t=e.state.facet(YH);this.top=new GH(e,!0,t.topContainer),this.bottom=new GH(e,!1,t.bottomContainer),this.top.sync(this.panels.filter((e=>e.top))),this.bottom.sync(this.panels.filter((e=>!e.top)));for(let e of this.panels)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}update(e){let t=e.state.facet(YH);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new GH(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new GH(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(JH);if(n!=this.input){let t=n.filter((e=>e)),r=[],i=[],o=[],s=[];for(let n of t){let t,a=this.specs.indexOf(n);a<0?(t=n(e.view),s.push(t)):(t=this.panels[a],t.update&&t.update(e)),r.push(t),(t.top?i:o).push(t)}this.specs=t,this.panels=r,this.top.sync(i),this.bottom.sync(o);for(let e of s)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>NL.scrollMargins.of((t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}}))});class GH{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=KH(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=KH(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function KH(e){let t=e.nextSibling;return e.remove(),t}const JH=gQ.define({enables:UH});const eV=xQ.define({create:()=>[],update(e,t){for(let n of t.effects)n.is(tV)?e=[n.value].concat(e):n.is(nV)&&(e=e.filter((e=>e!=n.value)));return e},provide:e=>JH.computeN([e],(t=>t.field(e)))}),tV=HQ.define(),nV=HQ.define();class rV extends eI{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}rV.prototype.elementClass="",rV.prototype.toDOM=void 0,rV.prototype.mapMode=nQ.TrackBefore,rV.prototype.startSide=rV.prototype.endSide=-1,rV.prototype.point=!0;const iV=gQ.define(),oV=gQ.define(),sV={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>oI.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},aV=gQ.define();function lV(e){return[hV(),aV.of({...sV,...e})]}const cV=gQ.define({combine:e=>e.some((e=>e))});function hV(e){let t=[uV];return e&&!1===e.fixed&&t.push(cV.of(!0)),t}const uV=dD.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(aV).map((t=>new gV(e,t))),this.fixed=!e.state.facet(cV);for(let e of this.gutters)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,r=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(r<.8*(n.to-n.from))}if(e.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(cV)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=oI.iter(this.view.state.facet(iV),this.view.viewport.from),r=[],i=this.gutters.map((e=>new pV(e,this.view.viewport,-this.view.documentPadding.top)));for(let e of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(e.type)){let t=!0;for(let o of e.type)if(o.type==GI.Text&&t){fV(n,r,o.from);for(let e of i)e.line(this.view,o,r);t=!1}else if(o.widget)for(let e of i)e.widget(this.view,o)}else if(e.type==GI.Text){fV(n,r,e.from);for(let t of i)t.line(this.view,e,r)}else if(e.widget)for(let t of i)t.widget(this.view,e);for(let e of i)e.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(aV),n=e.state.facet(aV),r=e.docChanged||e.heightChanged||e.viewportChanged||!oI.eq(e.startState.facet(iV),e.state.facet(iV),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(r=!0);else{r=!0;let i=[];for(let r of n){let n=t.indexOf(r);n<0?i.push(new gV(this.view,r)):(this.gutters[n].update(e),i.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),i.indexOf(e)<0&&e.destroy();for(let e of i)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.gutters=i}return r}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>NL.scrollMargins.of((t=>{let n=t.plugin(e);if(!n||0==n.gutters.length||!n.fixed)return null;let r=n.dom.offsetWidth*t.scaleX,i=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==RN.LTR?{left:r,right:i}:{right:r,left:i}}))});function dV(e){return Array.isArray(e)?e:[e]}function fV(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class pV{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=oI.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:r}=this,i=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==r.elements.length){let t=new mV(e,o,i,n);r.elements.push(t),r.dom.appendChild(t.dom)}else r.elements[this.i].update(e,o,i,n);this.height=t.bottom,this.i++}line(e,t,n){let r=[];fV(this.cursor,r,t.from),n.length&&(r=r.concat(n));let i=this.gutter.config.lineMarker(e,t,r);i&&r.unshift(i);let o=this.gutter;(0!=r.length||o.config.renderEmptyElements)&&this.addElement(e,t,r)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),r=n?[n]:null;for(let n of e.state.facet(oV)){let i=n(e,t.widget,t);i&&(r||(r=[])).push(i)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class gV{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,(r=>{let i,o=r.target;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let e=o.getBoundingClientRect();i=(e.top+e.bottom)/2}else i=r.clientY;let s=e.lineBlockAtHeight(i-e.documentTop);t.domEventHandlers[n](e,s,r)&&r.preventDefault()}));this.markers=dV(t.markers(e)),t.initialSpacer&&(this.spacer=new mV(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=dV(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!oI.eq(this.markers,t,n.from,n.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}destroy(){for(let e of this.elements)e.destroy()}}class mV{constructor(e,t,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,r)}update(e,t,n,r){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),function(e,t){if(e.length!=t.length)return!1;for(let n=0;nJQ(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let e in t){let r=n[e],i=t[e];n[e]=r?(e,t,n)=>r(e,t,n)||i(e,t,n):i}return n}})});class OV extends rV{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function wV(e,t){return e.state.facet(yV).formatNumber(t,e.state)}const xV=aV.compute([yV],(e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:e=>e.state.facet(bV),lineMarker:(e,t,n)=>n.some((e=>e.toDOM))?null:new OV(wV(e,e.state.doc.lineAt(t.from).number)),widgetMarker:(e,t,n)=>{for(let r of e.state.facet(vV)){let i=r(e,t,n);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(yV)!=e.state.facet(yV),initialSpacer:e=>new OV(wV(e,SV(e.state.doc.lines))),updateSpacer(e,t){let n=wV(t.view,SV(t.view.state.doc.lines));return n==e.number?e:new OV(n)},domEventHandlers:e.facet(yV).domEventHandlers,side:"before"})));function SV(e){let t=9;for(;t{let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.head).from;i>n&&(n=i,t.push(kV.range(i)))}return oI.of(t)})),_V=1024;let TV=0;class RV{constructor(e,t){this.from=e,this.to=t}}class EV{constructor(e={}){this.id=TV++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=AV.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}EV.closedBy=new EV({deserialize:e=>e.split(" ")}),EV.openedBy=new EV({deserialize:e=>e.split(" ")}),EV.group=new EV({deserialize:e=>e.split(" ")}),EV.isolate=new EV({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}}),EV.contextHash=new EV({perNode:!0}),EV.lookAhead=new EV({perNode:!0}),EV.mounted=new EV({perNode:!0});class MV{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[EV.mounted.id]}}const PV=Object.create(null);class AV{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):PV,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),r=new AV(e.name||"",t,e.id,n);if(e.props)for(let n of e.props)if(Array.isArray(n)||(n=n(r)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}return r}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(EV.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(" "))t[r]=e[n];return e=>{for(let n=e.prop(EV.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}}AV.none=new AV("",Object.create(null),0,8);class $V{constructor(e){this.types=e;for(let t=0;t=t){let s=new BV(o.tree,o.overlay[0].from+e.from,-1,e);(i||(i=[r])).push(HV(s,t,n,!1))}}return i?YV(i):r}(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,o=e.mode||0,s=(o&IV.IncludeAnonymous)>0;for(let e=this.cursor(o|IV.IncludeAnonymous);;){let o=!1;if(e.from<=i&&e.to>=r&&(!s&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;o=!0}for(;o&&n&&(s||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;o=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:eB(AV.none,this.children,this.positions,0,this.children.length,0,this.length,((e,t,n)=>new NV(this.type,e,t,n,this.propValues)),e.makeTree||((e,t,n)=>new NV(AV.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:i=_V,reused:o=[],minRepeatType:s=r.types.length}=e,a=Array.isArray(n)?new DV(n,n.length):n,l=r.types,c=0,h=0;function u(e,t,n,m,b,v){let{id:y,start:O,end:w,size:x}=a,S=h,k=c;if(x<0){if(a.next(),-1==x){let t=o[y];return n.push(t),void m.push(O-e)}if(-3==x)return void(c=y);if(-4==x)return void(h=y);throw new RangeError(`Unrecognized record size: ${x}`)}let C,_,T=l[y],R=O-e;if(w-O<=i&&(_=function(e,t){let n=a.fork(),r=0,o=0,l=0,c=n.end-i,h={size:0,start:0,skip:0};e:for(let i=n.pos-e;n.pos>i;){let e=n.size;if(n.id==t&&e>=0){h.size=r,h.start=o,h.skip=l,l+=4,r+=4,n.next();continue}let a=n.pos-e;if(e<0||a=s?4:0,d=n.start;for(n.next();n.pos>a;){if(n.size<0){if(-3!=n.size&&-4!=n.size)break e;u+=4}else n.id>=s&&(u+=4);n.next()}o=d,r+=e,l+=u}return(t<0||r==e)&&(h.size=r,h.start=o,h.skip=l),h.size>4?h:void 0}(a.pos-t,b))){let t=new Uint16Array(_.size-_.skip),n=a.pos-_.size,i=t.length;for(;a.pos>n;)i=g(_.start,t,i);C=new WV(t,w-_.start,r),R=_.start-e}else{let e=a.pos-x;a.next();let t=[],n=[],r=y>=s?y:-1,o=0,l=w;for(;a.pos>e;)r>=0&&a.id==r&&a.size>=0?(a.end<=l-i&&(f(t,n,O,o,a.end,l,r,S,k),o=t.length,l=a.end),a.next()):v>2500?d(O,e,t,n):u(O,e,t,n,r,v+1);if(r>=0&&o>0&&o-1&&o>0){let e=function(e,t){return(n,r,i)=>{let o,s,a=0,l=n.length-1;if(l>=0&&(o=n[l])instanceof NV){if(!l&&o.type==e&&o.length==i)return o;(s=o.prop(EV.lookAhead))&&(a=r[l]+o.length+s)}return p(e,n,r,i,a,t)}}(T,k);C=eB(T,t,n,0,t.length,0,w-O,e,e)}else C=p(T,t,n,w-O,S-w,k)}n.push(C),m.push(R)}function d(e,t,n,o){let s=[],l=0,c=-1;for(;a.pos>t;){let{id:e,start:t,end:n,size:r}=a;if(r>4)a.next();else{if(c>-1&&t=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-i,t[n++]=s[e+2]-i,t[n++]=n;n.push(new WV(t,s[2]-i,r)),o.push(i-e)}}function f(e,t,n,i,o,s,a,l,c){let h=[],u=[];for(;e.length>i;)h.push(e.pop()),u.push(t.pop()+n-o);e.push(p(r.types[a],h,u,s-o,l-s,c)),t.push(o-n)}function p(e,t,n,r,i,o,s){if(o){let e=[EV.contextHash,o];s=s?[e].concat(s):[e]}if(i>25){let e=[EV.lookAhead,i];s=s?[e].concat(s):[e]}return new NV(e,t,n,r,s)}function g(e,t,n){let{id:r,start:i,end:o,size:l}=a;if(a.next(),l>=0&&r4){let r=a.pos-(l-4);for(;a.pos>r;)n=g(e,t,n)}t[--n]=s,t[--n]=o-e,t[--n]=i-e,t[--n]=r}else-3==l?c=r:-4==l&&(h=r);return n}let m=[],b=[];for(;a.pos>0;)u(e.start||0,e.bufferStart||0,m,b,-1,0);let v=null!==(t=e.length)&&void 0!==t?t:m.length?b[0]+m[0].length:0;return new NV(l[e.topID],m.reverse(),b.reverse(),v)}(e)}}NV.empty=new NV(AV.none,[],[],0);class DV{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new DV(this.buffer,this.index)}}class WV{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return AV.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return s}slice(e,t,n){let r=this.buffer,i=new Uint16Array(t-e),o=0;for(let s=e,a=0;s=t&&nt;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function HV(e,t,n,r){for(var i;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to0?s.length:-1;e!=l;e+=t){let l,c=s[e],h=a[e]+o.from;if(i&IV.EnterBracketed&&c instanceof NV&&(l=MV.get(c))&&!l.overlay&&l.bracketed&&n>=h&&n<=h+c.length||LV(r,n,h,h+c.length))if(c instanceof WV){if(i&IV.ExcludeBuffers)continue;let s=c.findChild(0,c.buffer.length,t,n-h,r);if(s>-1)return new FV(new XV(o,c,e,h),null,s)}else if(i&IV.IncludeAnonymous||!c.type.isAnonymous||GV(c)){let s;if(!(i&IV.IgnoreMounts)&&(s=MV.get(c))&&!s.overlay)return new BV(s.tree,h,e,o);let a=new BV(c,h,e,o);return i&IV.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(t<0?c.children.length-1:0,t,n,r,i)}}if(i&IV.IncludeAnonymous||!o.type.isAnonymous)return null;if(e=o.index>=0?o.index+t:t<0?-1:o._parent._tree.children.length,o=o._parent,!o)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let r;if(!(n&IV.IgnoreOverlays)&&(r=MV.get(this._tree))&&r.overlay){let i=e-this.from,o=n&IV.EnterBracketed&&r.bracketed;for(let{from:e,to:n}of r.overlay)if((t>0||o?e<=i:e=i:n>i))return new BV(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function jV(e,t,n,r){let i=e.cursor(),o=[];if(!i.firstChild())return o;if(null!=n)for(let e=!1;!e;)if(e=i.type.is(n),!i.nextSibling())return o;for(;;){if(null!=r&&i.type.is(r))return o;if(i.type.is(t)&&o.push(i.node),!i.nextSibling())return null==r?o:[]}}function ZV(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}class XV{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class FV extends VV{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return i<0?null:new FV(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&IV.ExcludeBuffers)return null;let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return i<0?null:new FV(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new FV(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new FV(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,i=n.buffer[this.index+3];if(i>r){let o=n.buffer[this.index+1];e.push(n.slice(r,i,o)),t.push(0)}return new NV(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function YV(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;rn.from||i.to0){if(this.index-1)for(let r=t+e,i=e<0?-1:n._tree.children.length;r!=i;r+=e){let e=n._tree.children[r];if(this.mode&IV.IncludeAnonymous||e instanceof WV||!e.type.isAnonymous||GV(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,n=i+1;break e}r=this.stack[--i]}for(let e=n;e=0;i--){if(i<0)return ZV(this._tree,e,r);let o=n[t.buffer[this.stack[i]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function GV(e){return e.children.some((e=>e instanceof WV||!e.type.isAnonymous||GV(e)))}const KV=new WeakMap;function JV(e,t){if(!e.isAnonymous||t instanceof WV||t.type!=e)return 1;let n=KV.get(t);if(null==n){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof NV)){n=1;break}n+=JV(e,r)}KV.set(t,n)}return n}function eB(e,t,n,r,i,o,s,a,l){let c=0;for(let n=r;n=h)break;p+=t}if(c==i+1){if(p>h){let e=n[i];t(e.children,e.positions,0,e.children.length,r[i]+a);continue}u.push(n[i])}else{let t=r[c-1]+n[c-1].length-f;u.push(eB(e,n,r,i,c,f,t,null,l))}d.push(f+a-o)}}(t,n,r,i,0),(a||l)(u,d,s)}class tB{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof FV?this.setBuffer(e.context.buffer,e.index,t):e instanceof BV&&this.map.set(e.tree,t)}get(e){return e instanceof FV?this.getBuffer(e.context.buffer,e.index):e instanceof BV?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class nB{constructor(e,t,n,r,i=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=(i?1:0)|(o?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],n=!1){let r=[new nB(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&r.push(n);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],i=1,o=e.length?e[0]:null;for(let s=0,a=0,l=0;;s++){let c=s=n)for(;o&&o.from=t.from||h<=t.to||l){let e=Math.max(t.from,a)-l,n=Math.min(t.to,h)-l;t=e>=n?null:new nB(e,n,t.tree,t.offset+l,s>0,!!c)}if(t&&r.push(t),o.to>h)break;o=inew RV(e.from,e.to))):[new RV(0,0)]:[new RV(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let e=r.advance();if(e)return e}}}class iB{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new EV({perNode:!0});let oB=0;class sB{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=oB++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n="string"==typeof e?e:"?";if(e instanceof sB&&(t=e),null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let r=new sB(n,[],null,[]);if(r.set.push(r),t)for(let e of t.set)r.set.push(e);return r}static defineModifier(e){let t=new lB(e);return e=>e.modified.indexOf(t)>-1?e:lB.get(e.base||e,e.modified.concat(t).sort(((e,t)=>e.id-t.id)))}}let aB=0;class lB{constructor(e){this.name=e,this.instances=[],this.id=aB++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find((n=>n.base==e&&function(e,t){return e.length==t.length&&e.every(((e,n)=>e==t[n]))}(t,n.modified)));if(n)return n;let r=[],i=new sB(e.name,r,e,t);for(let e of t)e.instances.push(i);let o=function(e){let t=[[]];for(let n=0;nt.length-e.length))}(t);for(let t of e.set)if(!t.modified.length)for(let e of o)r.push(lB.get(t,e));return i}}function cB(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let e of n.split(" "))if(e){let n=[],i=2,o=e;for(let t=0;;){if("..."==o&&t>0&&t+3==e.length){i=1;break}let r=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);if(!r)throw new RangeError("Invalid path: "+e);if(n.push("*"==r[0]?"":'"'==r[0][0]?JSON.parse(r[0]):r[0]),t+=r[0].length,t==e.length)break;let s=e[t++];if(t==e.length&&"!"==s){i=0;break}if("/"!=s)throw new RangeError("Invalid path: "+e);o=e.slice(t)}let s=n.length-1,a=n[s];if(!a)throw new RangeError("Invalid path: "+e);let l=new uB(r,i,s>0?n.slice(0,s):null);t[a]=l.sort(t[a])}}return hB.add(t)}const hB=new EV({combine(e,t){let n,r,i;for(;e||t;){if(!e||t&&e.depth>=t.depth?(i=t,t=t.next):(i=e,e=e.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let o=new uB(i.tags,i.mode,i.context);n?n.next=o:r=o,n=o}return r}});class uB{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth{let t=i;for(let r of e)for(let e of r.set){let r=n[e.id];if(r){t=t?t+" "+r:r;break}}return t},scope:r}}function fB(e,t,n,r=0,i=e.length){let o=new pB(r,Array.isArray(t)?t:[t],n);o.highlightRange(e.cursor(),r,i,"",o.highlighters),o.flush(i)}uB.empty=new uB([],2,null);class pB{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,i){let{type:o,from:s,to:a}=e;if(s>=n||a<=t)return;o.isTop&&(i=this.highlighters.filter((e=>!e.scope||e.scope(o))));let l=r,c=function(e){let t=e.type.prop(hB);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||uB.empty,h=function(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+" "+e:e)}return n}(i,c.tags);if(h&&(l&&(l+=" "),l+=h,1==c.mode&&(r+=(r?" ":"")+h)),this.startSpan(Math.max(t,s),l),c.opaque)return;let u=e.tree&&e.tree.prop(EV.mounted);if(u&&u.overlay){let o=e.node.enter(u.overlay[0].from+s,1),c=this.highlighters.filter((e=>!e.scope||e.scope(u.tree.type))),h=e.firstChild();for(let d=0,f=s;;d++){let p=d=g)&&e.nextSibling()););if(!p||g>n)break;f=p.to+s,f>t&&(this.highlightRange(o.cursor(),Math.max(t,p.from+s),Math.min(n,f),"",c),this.startSpan(Math.min(n,f),l))}h&&e.parent()}else if(e.firstChild()){u&&(r="");do{if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,i),this.startSpan(Math.min(n,e.to),l)}}while(e.nextSibling());e.parent()}}}const gB=sB.define,mB=gB(),bB=gB(),vB=gB(bB),yB=gB(bB),OB=gB(),wB=gB(OB),xB=gB(OB),SB=gB(),kB=gB(SB),CB=gB(),_B=gB(),TB=gB(),RB=gB(TB),EB=gB(),MB={comment:mB,lineComment:gB(mB),blockComment:gB(mB),docComment:gB(mB),name:bB,variableName:gB(bB),typeName:vB,tagName:gB(vB),propertyName:yB,attributeName:gB(yB),className:gB(bB),labelName:gB(bB),namespace:gB(bB),macroName:gB(bB),literal:OB,string:wB,docString:gB(wB),character:gB(wB),attributeValue:gB(wB),number:xB,integer:gB(xB),float:gB(xB),bool:gB(OB),regexp:gB(OB),escape:gB(OB),color:gB(OB),url:gB(OB),keyword:CB,self:gB(CB),null:gB(CB),atom:gB(CB),unit:gB(CB),modifier:gB(CB),operatorKeyword:gB(CB),controlKeyword:gB(CB),definitionKeyword:gB(CB),moduleKeyword:gB(CB),operator:_B,derefOperator:gB(_B),arithmeticOperator:gB(_B),logicOperator:gB(_B),bitwiseOperator:gB(_B),compareOperator:gB(_B),updateOperator:gB(_B),definitionOperator:gB(_B),typeOperator:gB(_B),controlOperator:gB(_B),punctuation:TB,separator:gB(TB),bracket:RB,angleBracket:gB(RB),squareBracket:gB(RB),paren:gB(RB),brace:gB(RB),content:SB,heading:kB,heading1:gB(kB),heading2:gB(kB),heading3:gB(kB),heading4:gB(kB),heading5:gB(kB),heading6:gB(kB),contentSeparator:gB(SB),list:gB(SB),quote:gB(SB),emphasis:gB(SB),strong:gB(SB),link:gB(SB),monospace:gB(SB),strikethrough:gB(SB),inserted:gB(),deleted:gB(),changed:gB(),invalid:gB(),meta:EB,documentMeta:gB(EB),annotation:gB(EB),processingInstruction:gB(EB),definition:sB.defineModifier("definition"),constant:sB.defineModifier("constant"),function:sB.defineModifier("function"),standard:sB.defineModifier("standard"),local:sB.defineModifier("local"),special:sB.defineModifier("special")};for(let e in MB){let t=MB[e];t instanceof sB&&(t.name=e)}var PB;dB([{tag:MB.link,class:"tok-link"},{tag:MB.heading,class:"tok-heading"},{tag:MB.emphasis,class:"tok-emphasis"},{tag:MB.strong,class:"tok-strong"},{tag:MB.keyword,class:"tok-keyword"},{tag:MB.atom,class:"tok-atom"},{tag:MB.bool,class:"tok-bool"},{tag:MB.url,class:"tok-url"},{tag:MB.labelName,class:"tok-labelName"},{tag:MB.inserted,class:"tok-inserted"},{tag:MB.deleted,class:"tok-deleted"},{tag:MB.literal,class:"tok-literal"},{tag:MB.string,class:"tok-string"},{tag:MB.number,class:"tok-number"},{tag:[MB.regexp,MB.escape,MB.special(MB.string)],class:"tok-string2"},{tag:MB.variableName,class:"tok-variableName"},{tag:MB.local(MB.variableName),class:"tok-variableName tok-local"},{tag:MB.definition(MB.variableName),class:"tok-variableName tok-definition"},{tag:MB.special(MB.variableName),class:"tok-variableName2"},{tag:MB.definition(MB.propertyName),class:"tok-propertyName tok-definition"},{tag:MB.typeName,class:"tok-typeName"},{tag:MB.namespace,class:"tok-namespace"},{tag:MB.className,class:"tok-className"},{tag:MB.macroName,class:"tok-macroName"},{tag:MB.propertyName,class:"tok-propertyName"},{tag:MB.operator,class:"tok-operator"},{tag:MB.comment,class:"tok-comment"},{tag:MB.meta,class:"tok-meta"},{tag:MB.invalid,class:"tok-invalid"},{tag:MB.punctuation,class:"tok-punctuation"}]);const AB=new EV;function $B(e){return gQ.define({combine:e?t=>t.concat(e):void 0})}const zB=new EV;class QB{constructor(e,t,n=[],r=""){this.data=e,this.name=r,KQ.prototype.hasOwnProperty("tree")||Object.defineProperty(KQ.prototype,"tree",{get(){return DB(this)}}),this.parser=t,this.extension=[FB.of(this),KQ.languageData.of(((e,t,n)=>{let r=IB(e,t,n),i=r.type.prop(AB);if(!i)return[];let o=e.facet(i),s=r.type.prop(zB);if(s){let i=r.resolve(t-r.from,n);for(let t of s)if(t.test(i,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(o)}}return o}))].concat(n)}isActiveAt(e,t,n=-1){return IB(e,t,n).type.prop(AB)==this.data}findRegions(e){let t=e.facet(FB);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(e,t)=>{if(e.prop(AB)==this.data)return void n.push({from:t,to:t+e.length});let i=e.prop(EV.mounted);if(i){if(i.tree.prop(AB)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(i.overlay){let e=n.length;if(r(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;ne.isTop?t:void 0))]}),e.name)}configure(e,t){return new NB(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function DB(e){let t=e.field(QB.state,!1);return t?t.tree:NV.empty}class WB{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let LB=null;class HB{constructor(e,t,n=[],r,i,o,s,a){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=o,this.skipped=s,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new HB(e,t,[],NV.empty,0,n,[],null)}startParse(){return this.parser.startParse(new WB(this.state.doc),this.fragments)}work(e,t){return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=NV.empty&&this.isDone(null!=t?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext((()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext((()=>{for(;!(t=this.parse.advance()););})),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(nB.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=LB;LB=this;try{return e()}finally{LB=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=VB(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:r,treeLen:i,viewport:o,skipped:s}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges(((e,n,r,i)=>t.push({fromA:e,toA:n,fromB:r,toB:i}))),n=nB.applyChanges(n,t),r=NV.empty,i=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){s=[];for(let t of this.skipped){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);ne.from&&(this.fragments=VB(this.fragments,n,r),this.skipped.splice(t--,1))}return!(this.skipped.length>=t||(this.reset(),0))}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends rB{createParse(t,n,r){let i=r[0].from,o=r[r.length-1].to,s={parsedPos:i,advance(){let t=LB;if(t){for(let e of r)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=o,new NV(AV.none,[],[],o-i)},stoppedAt:null,stopAt(){}};return s}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return LB}}function VB(e,t,n){return nB.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class BB{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new BB(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=HB.create(e.facet(FB).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new BB(n)}}QB.state=xQ.define({create:BB.init,update(e,t){for(let e of t.effects)if(e.is(QB.setState))return e.value;return t.startState.facet(FB)!=t.state.facet(FB)?BB.init(t.state):e.apply(t)}});let jB=e=>{let t=setTimeout((()=>e()),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(jB=e=>{let t=-1,n=setTimeout((()=>{t=requestIdleCallback(e,{timeout:400})}),100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const ZB="undefined"!=typeof navigator&&(null===(PB=navigator.scheduling)||void 0===PB?void 0:PB.isInputPending)?()=>navigator.scheduling.isInputPending():null,XB=dD.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(QB.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(QB.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=jB(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndr+1e3,a=i.context.work((()=>ZB&&ZB()||Date.now()>o),r+(s?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:QB.setState.of(new BB(i.context))})),this.chunkBudget>0&&(!a||s)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then((()=>this.scheduleWork())).catch((e=>lD(this.view.state,e))).then((()=>this.workScheduled--)),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),FB=gQ.define({combine:e=>e.length?e[0]:null,enables:e=>[QB.state,XB,NL.contentAttributes.compute([e],(t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}}))]});class YB{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const qB=gQ.define(),UB=gQ.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some((e=>e!=t[0])))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function GB(e){let t=e.facet(UB);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function KB(e,t){let n="",r=e.tabSize,i=e.facet(UB)[0];if("\t"==i){for(;t>=r;)n+="\t",t-=r;i=" "}for(let e=0;e=t?function(e,t,n){let r=t.resolveStack(n),i=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let e=[];for(let t=i;t&&!(t.fromr.node.to||t.from==r.node.from&&t.type==r.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)r={node:e[t],next:r}}return nj(r,e,n)}(e,n,t):null}class ej{constructor(e,t={}){this.state=e,this.options=t,this.unit=GB(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return null!=r&&r>=n.from&&r<=n.to?i&&r==e?{text:"",from:e}:(t<0?r-1&&(i+=o-this.countColumn(n,n.search(/\S|$/))),i}countColumn(e,t=e.length){return bI(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.options.overrideIndentation;if(i){let e=i(r);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const tj=new EV;function nj(e,t,n){for(let r=e;r;r=r.next){let e=rj(r.node);if(e)return e(oj.create(t,n,r))}return 0}function rj(e){let t=e.type.prop(tj);if(t)return t;let n,r=e.firstChild;if(r&&(n=r.type.prop(EV.closedBy))){let t=e.lastChild,r=t&&n.indexOf(t.name)>-1;return e=>lj(e,!0,1,void 0,r&&!function(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}(e)?t.from:void 0)}return null==e.parent?ij:null}function ij(){return 0}class oj extends ej{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new oj(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(sj(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return nj(this.context.next,this.base,this.pos)}}function sj(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function aj({closing:e,align:t=!0,units:n=1}){return r=>lj(r,t,n,e)}function lj(e,t,n,r,i){let o=e.textAfter,s=o.match(/^\s*/)[0].length,a=r&&o.slice(s,s+r.length)==r||i==e.pos+s,l=t?function(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,o=e.state.doc.lineAt(n.from),s=null==i||i<=o.from?o.to:Math.min(o.to,i);for(let e=n.to;;){let i=t.childAfter(e);if(!i||i==r)return null;if(!i.type.isSkipped){if(i.from>=s)return null;let e=/^ */.exec(o.text.slice(n.to-o.from))[0].length;return{from:n.from,to:n.to+e}}e=i.to}}(e):null;return l?a?e.column(l.from):e.column(l.to):e.baseIndent+(a?0:e.unit*n)}function cj({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}const hj=gQ.define(),uj=new EV;function dj(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function fj(e,t,n){for(let r of e.facet(hj)){let i=r(e,t,n);if(i)return i}return function(e,t,n){let r=DB(e);if(r.lengthn)continue;if(i&&s.from=t&&r.to>n&&(i=r)}}return i}(e,t,n)}function pj(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}const gj=HQ.define({map:pj}),mj=HQ.define({map:pj});function bj(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some((e=>e.from<=n&&e.to>=n))||t.push(e.lineBlockAt(n));return t}const vj=xQ.define({create:()=>KI.none,update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges(((t,n)=>e=yj(e,t,n))),e=e.map(t.changes);for(let n of t.effects)if(n.is(gj)&&!wj(e,n.value.from,n.value.to)){let{preparePlaceholder:r}=t.state.facet(_j),i=r?KI.replace({widget:new Mj(r(t.state,n.value))}):Ej;e=e.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(mj)&&(e=e.update({filter:(e,t)=>n.value.from!=e||n.value.to!=t,filterFrom:n.value.from,filterTo:n.value.to}));return t.selection&&(e=yj(e,t.selection.main.head)),e},provide:e=>NL.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,((e,t)=>{n.push(e,t)})),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n{et&&(r=!0)})),r?e.update({filterFrom:t,filterTo:n,filter:(e,r)=>e>=n||r<=t}):e}function Oj(e,t,n){var r;let i=null;return null===(r=e.field(vj,!1))||void 0===r||r.between(t,n,((e,t)=>{(!i||i.from>e)&&(i={from:e,to:t})})),i}function wj(e,t,n){let r=!1;return e.between(t,t,((e,i)=>{e==t&&i==n&&(r=!0)})),r}function xj(e,t){return e.field(vj,!1)?t:t.concat(HQ.appendConfig.of(Tj()))}function Sj(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return NL.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${e.state.phrase("to")} ${i}.`)}const kj=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:e=>{for(let t of bj(e)){let n=fj(e.state,t.from,t.to);if(n)return e.dispatch({effects:xj(e.state,[gj.of(n),Sj(e,n)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:e=>{if(!e.state.field(vj,!1))return!1;let t=[];for(let n of bj(e)){let r=Oj(e.state,n.from,n.to);r&&t.push(mj.of(r),Sj(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0}},{key:"Ctrl-Alt-[",run:e=>{let{state:t}=e,n=[];for(let r=0;r{let t=e.state.field(vj,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,((e,t)=>{n.push(mj.of({from:e,to:t}))})),e.dispatch({effects:n}),!0}}],Cj={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},_j=gQ.define({combine:e=>JQ(e,Cj)});function Tj(e){let t=[vj,$j];return e&&t.push(_j.of(e)),t}function Rj(e,t){let{state:n}=e,r=n.facet(_j),i=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),r=Oj(e.state,n.from,n.to);r&&e.dispatch({effects:mj.of(r)}),t.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,i,t);let o=document.createElement("span");return o.textContent=r.placeholderText,o.setAttribute("aria-label",n.phrase("folded code")),o.title=n.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=i,o}const Ej=KI.replace({widget:new class extends UI{toDOM(e){return Rj(e,null)}}});class Mj extends UI{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return Rj(e,this.value)}}const Pj={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Aj extends rV{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}const $j=NL.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class zj{constructor(e,t){let n;function r(e){let t=xI.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;const i="string"==typeof t.all?t.all:t.all?r(t.all):void 0,o=t.scope;this.scope=o instanceof QB?e=>e.prop(AB)==o.data:o?e=>e==o:void 0,this.style=dB(e.map((e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))}))),{all:i}).style,this.module=n?new xI(n):null,this.themeType=t.themeType}static define(e,t){return new zj(e,t||{})}}const Qj=gQ.define(),Ij=gQ.define({combine:e=>e.length?[e[0]]:null});function Nj(e){let t=e.facet(Qj);return t.length?t:e.facet(Ij)}function Dj(e,t){let n,r=[Lj];return e instanceof zj&&(e.module&&r.push(NL.styleModule.of(e.module)),n=e.themeType),(null==t?void 0:t.fallback)?r.push(Ij.of(e)):n?r.push(Qj.computeN([NL.darkTheme],(t=>t.facet(NL.darkTheme)==("dark"==n)?[e]:[]))):r.push(Qj.of(e)),r}class Wj{constructor(e){this.markCache=Object.create(null),this.tree=DB(e.state),this.decorations=this.buildDeco(e,Nj(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=DB(e.state),n=Nj(e.state),r=n!=Nj(e.startState),{viewport:i}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=i.to)}buildDeco(e,t){if(!t||!this.tree.length)return KI.none;let n=new sI;for(let{from:r,to:i}of e.visibleRanges)fB(this.tree,t,((e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=KI.mark({class:r})))}),r,i);return n.finish()}}const Lj=kQ.high(dD.fromClass(Wj,{decorations:e=>e.decorations})),Hj=zj.define([{tag:MB.meta,color:"#404740"},{tag:MB.link,textDecoration:"underline"},{tag:MB.heading,textDecoration:"underline",fontWeight:"bold"},{tag:MB.emphasis,fontStyle:"italic"},{tag:MB.strong,fontWeight:"bold"},{tag:MB.strikethrough,textDecoration:"line-through"},{tag:MB.keyword,color:"#708"},{tag:[MB.atom,MB.bool,MB.url,MB.contentSeparator,MB.labelName],color:"#219"},{tag:[MB.literal,MB.inserted],color:"#164"},{tag:[MB.string,MB.deleted],color:"#a11"},{tag:[MB.regexp,MB.escape,MB.special(MB.string)],color:"#e40"},{tag:MB.definition(MB.variableName),color:"#00f"},{tag:MB.local(MB.variableName),color:"#30a"},{tag:[MB.typeName,MB.namespace],color:"#085"},{tag:MB.className,color:"#167"},{tag:[MB.special(MB.variableName),MB.macroName],color:"#256"},{tag:MB.definition(MB.propertyName),color:"#00c"},{tag:MB.comment,color:"#940"},{tag:MB.invalid,color:"#f00"}]),Vj=NL.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Bj=1e4,jj="()[]{}",Zj=gQ.define({combine:e=>JQ(e,{afterCursor:!0,brackets:jj,maxScanDistance:Bj,renderMatch:Yj})}),Xj=KI.mark({class:"cm-matchingBracket"}),Fj=KI.mark({class:"cm-nonmatchingBracket"});function Yj(e){let t=[],n=e.matched?Xj:Fj;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}function qj(e){let t=[],n=e.facet(Zj);for(let r of e.selection.ranges){if(!r.empty)continue;let i=eZ(e,r.head,-1,n)||r.head>0&&eZ(e,r.head-1,1,n)||n.afterCursor&&(eZ(e,r.head,1,n)||r.heade.decorations}),Vj],Gj=new EV;function Kj(e,t,n){let r=e.prop(t<0?EV.openedBy:EV.closedBy);if(r)return r;if(1==e.name.length){let r=n.indexOf(e.name);if(r>-1&&r%2==(t<0?1:0))return[n[r+t]]}return null}function Jj(e){let t=e.type.prop(Gj);return t?t(e.node):e}function eZ(e,t,n,r={}){let i=r.maxScanDistance||Bj,o=r.brackets||jj,s=DB(e),a=s.resolveInner(t,n);for(let e=a;e;e=e.parent){let r=Kj(e.type,n,o);if(r&&e.from0?t>=i.from&&ti.from&&t<=i.to))return tZ(0,0,n,e,i,r,o)}}return function(e,t,n,r,i,o,s){let a=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=s.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},h=e.doc.iterRange(t,n>0?e.doc.length:0),u=0;for(let e=0;!h.next().done&&e<=o;){let o=h.value;n<0&&(e+=o.length);let a=t+e*n;for(let e=n>0?0:o.length-1,t=n>0?o.length:-1;e!=t;e+=n){let t=s.indexOf(o[e]);if(!(t<0||r.resolveInner(a+e,1).type!=i))if(t%2==0==n>0)u++;else{if(1==u)return{start:c,end:{from:a+e,to:a+e+1},matched:t>>1==l>>1};u--}}n>0&&(e+=o.length)}return h.done?{start:c,matched:!1}:null}(e,t,n,s,a.type,i,o)}function tZ(e,t,n,r,i,o,s){let a=r.parent,l={from:i.from,to:i.to},c=0,h=null==a?void 0:a.cursor();if(h&&(n<0?h.childBefore(r.from):h.childAfter(r.to)))do{if(n<0?h.to<=r.from:h.from>=r.to){if(0==c&&o.indexOf(h.type.name)>-1&&h.from-1||(iZ.push(e),console.warn(t))}function lZ(e,t){let n=[];for(let r of t.split(" ")){let t=[];for(let n of r.split(".")){let r=e[n]||MB[n];r?"function"==typeof r?t.length?t=t.map(r):aZ(n,`Modifier ${n} used at start of tag`):t.length?aZ(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:aZ(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let r=t.replace(/ /g,"_"),i=r+" "+n.map((e=>e.id)),o=oZ[i];if(o)return o.id;let s=oZ[i]=AV.define({id:rZ.length,name:r,props:[cB({[r]:n})]});return rZ.push(s),s.id}function cZ(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return!!i&&(r(n.update(i)),!0)}}RN.RTL,RN.LTR;const hZ=cZ(mZ,0),uZ=cZ(gZ,0),dZ=cZ(((e,t)=>gZ(e,t,function(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let o=t.length-1;o>=0&&t[o].to>r.from?t[o].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}(t))),0);function fZ(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const pZ=50;function gZ(e,t,n=t.selection.ranges){let r=n.map((e=>fZ(t,e.from).block));if(!r.every((e=>e)))return null;let i=n.map(((e,n)=>function(e,{open:t,close:n},r,i){let o,s,a=e.sliceDoc(r-pZ,r),l=e.sliceDoc(i,i+pZ),c=/\s*$/.exec(a)[0].length,h=/^\s*/.exec(l)[0].length,u=a.length-c;if(a.slice(u-t.length,u)==t&&l.slice(h,h+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:i+h,margin:h&&1}};i-r<=2*pZ?o=s=e.sliceDoc(r,i):(o=e.sliceDoc(r,r+pZ),s=e.sliceDoc(i-pZ,i));let d=/^\s*/.exec(o)[0].length,f=/\s*$/.exec(s)[0].length,p=s.length-f-n.length;return o.slice(d,d+t.length)==t&&s.slice(p,p+n.length)==n?{open:{pos:r+d+t.length,margin:/\s/.test(o.charAt(d+t.length))?1:0},close:{pos:i-f-n.length,margin:/\s/.test(s.charAt(p-1))?1:0}}:null}(t,r[n],e.from,e.to)));if(2!=e&&!i.every((e=>e)))return{changes:t.changes(n.map(((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+" "},{from:e.to,insert:" "+r[t].close}])))};if(1!=e&&i.some((e=>e))){let e=[];for(let t,n=0;ni&&(e==o||o>l.from)){i=l.from;let e=/^\s*/.exec(l.text)[0].length,t=e==l.length,o=l.text.slice(e,e+n.length)==n?e:-1;ee.comment<0&&(!e.empty||e.single)))){let e=[];for(let{line:t,token:n,indent:i,empty:o,single:s}of r)!s&&o||e.push({from:t.from+i,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&r.some((e=>e.comment>=0))){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,o=r+i.length;" "==t.text[o-t.from]&&o++,e.push({from:r,to:o})}return{changes:e}}return null}const bZ=DQ.define(),vZ=DQ.define(),yZ=gQ.define(),OZ=gQ.define({combine:e=>JQ(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}),wZ=xQ.define({create:()=>NZ.empty,update(e,t){let n=t.state.facet(OZ),r=t.annotation(bZ);if(r){let i=TZ.fromTransaction(t,r.selection),o=r.side,s=0==o?e.undone:e.done;return s=i?RZ(s,s.length,n.minDepth,i):AZ(s,t.startState.selection),new NZ(0==o?r.rest:s,0==o?s:r.rest)}let i=t.annotation(vZ);if("full"!=i&&"before"!=i||(e=e.isolate()),!1===t.annotation(VQ.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let o=TZ.fromTransaction(t),s=t.annotation(VQ.time),a=t.annotation(VQ.userEvent);return o?e=e.addChanges(o,s,a,n,t):t.selection&&(e=e.addSelection(t.startState.selection,s,a,n.newGroupDelay)),"full"!=i&&"after"!=i||(e=e.isolate()),e},toJSON:e=>({done:e.done.map((e=>e.toJSON())),undone:e.undone.map((e=>e.toJSON()))}),fromJSON:e=>new NZ(e.done.map(TZ.fromJSON),e.undone.map(TZ.fromJSON))});function xZ(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(wZ,!1);if(!i)return!1;let o=i.pop(e,n,t);return!!o&&(r(o),!0)}}const SZ=xZ(0,!1),kZ=xZ(1,!1),CZ=xZ(0,!0),_Z=xZ(1,!0);class TZ{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(e){return new TZ(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((e=>e.toJSON()))}}static fromJSON(e){return new TZ(e.changes&&iQ.fromJSON(e.changes),[],e.mapped&&rQ.fromJSON(e.mapped),e.startSelection&&dQ.fromJSON(e.startSelection),e.selectionsAfter.map(dQ.fromJSON))}static fromTransaction(e,t){let n=MZ;for(let t of e.startState.facet(yZ)){let r=t(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new TZ(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,MZ)}static selection(e){return new TZ(void 0,MZ,void 0,void 0,e)}}function RZ(e,t,n,r){let i=t+1>n+20?t-n-1:0,o=e.slice(i,t);return o.push(r),o}function EZ(e,t){return e.length?t.length?e.concat(t):e:t}const MZ=[],PZ=200;function AZ(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-PZ));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),RZ(e,e.length-1,1e9,n.setSelAfter(r)))}return[TZ.selection([t])]}function $Z(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function zZ(e,t){if(!e.length)return e;let n=e.length,r=MZ;for(;n;){let i=QZ(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[TZ.selection(r)]:MZ}function QZ(e,t,n){let r=EZ(e.selectionsAfter.length?e.selectionsAfter.map((e=>e.map(t))):MZ,n);if(!e.changes)return TZ.selection(r);let i=e.changes.map(t),o=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(o):o;return new TZ(i,HQ.mapEffects(e.effects,t),s,e.startSelection.map(o),r)}const IZ=/^(input\.type|delete)($|\.)/;class NZ{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new NZ(this.done,this.undone):this}addChanges(e,t,n,r,i){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&e.changes&&(!n||IZ.test(n))&&(!s.selectionsAfter.length&&t-this.prevTimen.push(e,t))),t.iterChangedRanges(((e,t,i,o)=>{for(let e=0;e=t&&i<=s&&(r=!0)}})),r}(s.changes,e.changes))||"input.type.compose"==n)?RZ(o,o.length-1,r.minDepth,new TZ(e.changes.compose(s.changes),EZ(HQ.mapEffects(e.effects,s.changes),s.effects),s.mapped,s.startSelection,MZ)):RZ(o,o.length,r.minDepth,e),new NZ(o,MZ,t,n)}addSelection(e,t,n,r){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:MZ;return i.length>0&&t-this.prevTimee.empty!=t.ranges[n].empty)).length}(i[i.length-1],e)?this:new NZ(AZ(this.done,e),this.undone,t,n)}addMapping(e){return new NZ(zZ(this.done,e),zZ(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=0==e?this.done:this.undone;if(0==r.length)return null;let i=r[r.length-1],o=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:bZ.of({side:e,rest:$Z(r),selection:o}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let n=1==r.length?MZ:r.slice(0,r.length-1);return i.mapped&&(n=zZ(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:bZ.of({side:e,rest:n,selection:o}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}}NZ.empty=new NZ(MZ,MZ);const DZ=[{key:"Mod-z",run:SZ,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:kZ,preventDefault:!0},{linux:"Ctrl-Shift-z",run:kZ,preventDefault:!0},{key:"Mod-u",run:CZ,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:_Z,preventDefault:!0}];function WZ(e,t){return dQ.create(e.ranges.map(t),e.mainIndex)}function LZ(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function HZ({state:e,dispatch:t},n){let r=WZ(e.selection,n);return!r.eq(e.selection,!0)&&(t(LZ(e,r)),!0)}function VZ(e,t){return dQ.cursor(t?e.to:e.from)}function BZ(e,t){return HZ(e,(n=>n.empty?e.moveByChar(n,t):VZ(n,t)))}function jZ(e){return e.textDirectionAt(e.state.selection.main.head)==RN.LTR}const ZZ=e=>BZ(e,!jZ(e)),XZ=e=>BZ(e,jZ(e));function FZ(e,t){return HZ(e,(n=>n.empty?e.moveByGroup(n,t):VZ(n,t)))}function YZ(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function qZ(e,t,n){let r,i,o=DB(e).resolveInner(t.head),s=n?EV.closedBy:EV.openedBy;for(let r=t.head;;){let t=n?o.childAfter(r):o.childBefore(r);if(!t)break;YZ(e,t,s)?o=t:r=n?t.to:t.from}return i=o.type.prop(s)&&(r=n?eZ(e,o.from,1):eZ(e,o.to,-1))&&r.matched?n?r.end.to:r.end.from:n?o.to:o.from,dQ.cursor(i,n?-1:1)}function UZ(e,t){return HZ(e,(n=>{if(!n.empty)return VZ(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)}))}"undefined"!=typeof Intl&&Intl.Segmenter;const GZ=e=>UZ(e,!1),KZ=e=>UZ(e,!0);function JZ(e){let t,n=e.scrollDOM.clientHeightn.empty?e.moveVertically(n,t,r.height):VZ(n,t)));if(o.eq(i.selection))return!1;if(r.selfScroll){let t=e.coordsAtPos(i.selection.main.head),s=e.scrollDOM.getBoundingClientRect(),a=s.top+r.marginTop,l=s.bottom-r.marginBottom;t&&t.top>a&&t.bottomeX(e,!1),nX=e=>eX(e,!0);function rX(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=dQ.cursor(r.from+n))}return i}function iX(e,t){let n=WZ(e.state.selection,(e=>{let n=t(e);return dQ.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0,n.assoc)}));return!n.eq(e.state.selection)&&(e.dispatch(LZ(e.state,n)),!0)}function oX(e,t){return iX(e,(n=>e.moveByChar(n,t)))}const sX=e=>oX(e,!jZ(e)),aX=e=>oX(e,jZ(e));function lX(e,t){return iX(e,(n=>e.moveByGroup(n,t)))}function cX(e,t){return iX(e,(n=>e.moveVertically(n,t)))}const hX=e=>cX(e,!1),uX=e=>cX(e,!0);function dX(e,t){return iX(e,(n=>e.moveVertically(n,t,JZ(e).height)))}const fX=e=>dX(e,!1),pX=e=>dX(e,!0),gX=({state:e,dispatch:t})=>(t(LZ(e,{anchor:0})),!0),mX=({state:e,dispatch:t})=>(t(LZ(e,{anchor:e.doc.length})),!0),bX=({state:e,dispatch:t})=>(t(LZ(e,{anchor:e.selection.main.anchor,head:0})),!0),vX=({state:e,dispatch:t})=>(t(LZ(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function yX(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let o=n.doc.lineAt(r.head);if(t?o.to0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.heado.to){i.some((e=>e.head==r.head))||i.push(r);break}if(r.head==n.head)break;n=r}}return i.length!=r.ranges.length&&(e.dispatch(LZ(n,dQ.create(i,i.length-1))),!0)}function OX(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,i=r.changeByRange((r=>{let{from:i,to:o}=r;if(i==o){let s=t(r);si&&(n="delete.forward",s=wX(e,s,!0)),i=Math.min(i,s),o=Math.max(o,s)}else i=wX(e,i,!1),o=wX(e,o,!0);return i==o?{range:r}:{changes:{from:i,to:o},range:dQ.cursor(i,it(e))))r.between(t,t,((e,r)=>{et&&(t=n?r:e)}));return t}const xX=(e,t,n)=>OX(e,(r=>{let i,o,s=r.from,{state:a}=e,l=a.doc.lineAt(s);if(n&&!t&&s>l.from&&sxX(e,!1,!0),kX=e=>xX(e,!0,!1),CX=(e,t)=>OX(e,(n=>{let r=n.head,{state:i}=e,o=i.doc.lineAt(r),s=i.charCategorizer(r);for(let e=null;;){if(r==(t?o.to:o.from)){r==n.head&&o.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let a=Gz(o.text,r-o.from,t)+o.from,l=o.text.slice(Math.min(r,a)-o.from,Math.max(r,a)-o.from),c=s(l);if(null!=e&&c!=e)break;" "==l&&r==n.head||(e=c),r=a}return r})),_X=e=>CX(e,!1);function TX(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),o=e.doc.lineAt(r.to);if(r.empty||r.to!=o.from||(o=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=o.to,e.ranges.push(r)}else t.push({from:i.from,to:o.to,ranges:[r]});n=o.number+1}return t}function RX(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of TX(e)){if(n?t.to==e.doc.length:0==t.from)continue;let o=e.doc.lineAt(n?t.to+1:t.from-1),s=o.length+1;if(n){r.push({from:t.to,to:o.to},{from:t.from,insert:o.text+e.lineBreak});for(let n of t.ranges)i.push(dQ.range(Math.min(e.doc.length,n.anchor+s),Math.min(e.doc.length,n.head+s)))}else{r.push({from:o.from,to:t.from},{from:t.to,insert:e.lineBreak+o.text});for(let e of t.ranges)i.push(dQ.range(e.anchor-s,e.head-s))}}return!!r.length&&(t(e.update({changes:r,scrollIntoView:!0,selection:dQ.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0)}function EX(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of TX(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const MX=AX(!1),PX=AX(!0);function AX(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange((n=>{let{from:r,to:i}=n,o=t.doc.lineAt(r),s=!e&&r==i&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,r=DB(e).resolveInner(t),i=r.childBefore(t),o=r.childAfter(t);return i&&o&&i.to<=t&&o.from>=t&&(n=i.type.prop(EV.closedBy))&&n.indexOf(o.name)>-1&&e.doc.lineAt(i.to).from==e.doc.lineAt(o.from).from&&!/\S/.test(e.sliceDoc(i.to,o.from))?{from:i.to,to:o.from}:null}(t,r);e&&(r=i=(i<=o.to?o:t.doc.lineAt(i)).to);let a=new ej(t,{simulateBreak:r,simulateDoubleBreak:!!s}),l=JB(a,r);for(null==l&&(l=bI(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize));io.from&&r{let i=[];for(let o=r.from;o<=r.to;){let s=e.doc.lineAt(o);s.number>n&&(r.empty||r.to>s.from)&&(t(s,i,r),n=s.number),o=s.to+1}let o=e.changes(i);return{changes:i,range:dQ.range(o.mapPos(r.anchor,1),o.mapPos(r.head,1))}}))}const zX=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update($X(e,((t,n)=>{n.push({from:t.from,insert:e.facet(UB)})})),{userEvent:"input.indent"})),!0),QX=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update($X(e,((t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=bI(r,e.tabSize),o=0,s=KB(e,Math.max(0,i-GB(e)));for(;oHZ(e,(t=>dQ.cursor(e.lineBlockAt(t.head).from,1))),shift:e=>iX(e,(t=>dQ.cursor(e.lineBlockAt(t.head).from)))},{key:"Ctrl-e",run:e=>HZ(e,(t=>dQ.cursor(e.lineBlockAt(t.head).to,-1))),shift:e=>iX(e,(t=>dQ.cursor(e.lineBlockAt(t.head).to)))},{key:"Ctrl-d",run:kX},{key:"Ctrl-h",run:SX},{key:"Ctrl-k",run:e=>OX(e,(t=>{let n=e.lineBlockAt(t.head).to;return t.head{if(e.readOnly)return!1;let n=e.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:Hz.of(["",""])},range:dQ.cursor(e.from)})));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:Gz(r.text,n-r.from,!1)+r.from,o=n==r.to?n+1:Gz(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:o,insert:e.doc.slice(n,o).append(e.doc.slice(i,n))},range:dQ.cursor(o)}}));return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:nX}],NX=[{key:"ArrowLeft",run:ZZ,shift:sX,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>FZ(e,!jZ(e)),shift:e=>lX(e,!jZ(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>HZ(e,(t=>rX(e,t,!jZ(e)))),shift:e=>iX(e,(t=>rX(e,t,!jZ(e)))),preventDefault:!0},{key:"ArrowRight",run:XZ,shift:aX,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>FZ(e,jZ(e)),shift:e=>lX(e,jZ(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>HZ(e,(t=>rX(e,t,jZ(e)))),shift:e=>iX(e,(t=>rX(e,t,jZ(e)))),preventDefault:!0},{key:"ArrowUp",run:GZ,shift:hX,preventDefault:!0},{mac:"Cmd-ArrowUp",run:gX,shift:bX},{mac:"Ctrl-ArrowUp",run:tX,shift:fX},{key:"ArrowDown",run:KZ,shift:uX,preventDefault:!0},{mac:"Cmd-ArrowDown",run:mX,shift:vX},{mac:"Ctrl-ArrowDown",run:nX,shift:pX},{key:"PageUp",run:tX,shift:fX},{key:"PageDown",run:nX,shift:pX},{key:"Home",run:e=>HZ(e,(t=>rX(e,t,!1))),shift:e=>iX(e,(t=>rX(e,t,!1))),preventDefault:!0},{key:"Mod-Home",run:gX,shift:bX},{key:"End",run:e=>HZ(e,(t=>rX(e,t,!0))),shift:e=>iX(e,(t=>rX(e,t,!0))),preventDefault:!0},{key:"Mod-End",run:mX,shift:vX},{key:"Enter",run:MX,shift:MX},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:SX,shift:SX,preventDefault:!0},{key:"Delete",run:kX,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:_X,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>CX(e,!0),preventDefault:!0},{mac:"Mod-Backspace",run:e=>OX(e,(t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)})),preventDefault:!0},{mac:"Mod-Delete",run:e=>OX(e,(t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head({mac:e.key,run:e.run,shift:e.shift})))),DX=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>HZ(e,(t=>qZ(e.state,t,!jZ(e)))),shift:e=>iX(e,(t=>qZ(e.state,t,!jZ(e))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>HZ(e,(t=>qZ(e.state,t,jZ(e)))),shift:e=>iX(e,(t=>qZ(e.state,t,jZ(e))))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>RX(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>EX(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>RX(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>EX(e,t,!0)},{key:"Mod-Alt-ArrowUp",run:e=>yX(e,!1)},{key:"Mod-Alt-ArrowDown",run:e=>yX(e,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=dQ.create([n.main]):n.main.empty||(r=dQ.create([dQ.cursor(n.main.head)])),!!r&&(t(LZ(e,r)),!0)}},{key:"Mod-Enter",run:PX},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=TX(e).map((({from:t,to:n})=>dQ.range(t,Math.min(n+1,e.doc.length))));return t(e.update({selection:dQ.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=WZ(e.selection,(t=>{let n=DB(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return dQ.range(n.to,n.from)}return t}));return!n.eq(e.selection)&&(t(LZ(e,n)),!0)},preventDefault:!0},{key:"Mod-[",run:QX},{key:"Mod-]",run:zX},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new ej(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),i=$X(e,((t,i,o)=>{let s=JB(r,t.from);if(null==s)return;/\S/.test(t.text)||(s=0);let a=/^\s*/.exec(t.text)[0],l=KB(e,s);(a!=l||o.from{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(TX(t).map((({from:e,to:n})=>(e>0?e--:n{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)})).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>function(e,t,n){let r=!1,i=WZ(e.selection,(t=>{let i=eZ(e,t.head,-1)||eZ(e,t.head,1)||t.head>0&&eZ(e,t.head-1,1)||t.head{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=fZ(e.state,n.from);return r.line?hZ(e):!!r.block&&dZ(e)}},{key:"Alt-A",run:uZ},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat(NX),WX={key:"Tab",run:zX,shift:QX},LX="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e;class HX{constructor(e,t,n=0,r=e.length,i,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(LX(e)):LX,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Kz(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Jz(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=eQ(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let o=r.charCodeAt(e),s=this.match(o,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(s)return this.value=s,this;break}i==n&&ethis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=YX(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(nthis.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length=n||r.to<=t){let r=new XX(t,e.sliceString(t,n));return ZX.set(e,r),r}if(r.from==t&&r.to==n)return r;let{text:i,from:o}=r;return o>t&&(i=e.sliceString(t,o)+i,o=t),r.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=YX(this.text,n+(e==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=XX.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function YX(e,t){if(t>=e.length)return t;let n,r=e.lineAt(t);for(;t=56320&&n<57344;)t++;return t}"undefined"!=typeof Symbol&&(jX.prototype[Symbol.iterator]=FX.prototype[Symbol.iterator]=function(){return this});const qX={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},UX=gQ.define({combine:e=>JQ(e,qX,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}),GX=KI.mark({class:"cm-selectionMatch"}),KX=KI.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function JX(e,t,n,r){return!(0!=n&&e(t.sliceDoc(n-1,n))==qQ.Word||r!=t.doc.length&&e(t.sliceDoc(r,r+1))==qQ.Word)}const eF=dD.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(UX),{state:n}=e,r=n.selection;if(r.ranges.length>1)return KI.none;let i,o=r.main,s=null;if(o.empty){if(!t.highlightWordAroundCursor)return KI.none;let e=n.wordAt(o.head);if(!e)return KI.none;s=n.charCategorizer(o.head),i=n.sliceDoc(e.from,e.to)}else{let e=o.to-o.from;if(e200)return KI.none;if(t.wholeWords){if(i=n.sliceDoc(o.from,o.to),s=n.charCategorizer(o.head),!JX(s,n,o.from,o.to)||!function(e,t,n,r){return e(t.sliceDoc(n,n+1))==qQ.Word&&e(t.sliceDoc(r-1,r))==qQ.Word}(s,n,o.from,o.to))return KI.none}else if(i=n.sliceDoc(o.from,o.to),!i)return KI.none}let a=[];for(let r of e.visibleRanges){let e=new HX(n.doc,i,r.from,r.to);for(;!e.next().done;){let{from:r,to:i}=e.value;if((!s||JX(s,n,r,i))&&(o.empty&&r<=o.from&&i>=o.to?a.push(KX.range(r,i)):(r>=o.to||i<=o.from)&&a.push(GX.range(r,i)),a.length>t.maxMatches))return KI.none}}return KI.set(a)}},{decorations:e=>e.decorations}),tF=NL.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),nF=gQ.define({combine:e=>JQ(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new PF(e),scrollToMatch:e=>NL.scrollIntoView(e)})});class rF{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||function(e){try{return new RegExp(e,BX),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,((e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?"\t":"\\"))}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new hF(this):new sF(this)}getCursor(e,t=0,n){let r=e.doc?e:KQ.create({doc:e});return null==n&&(n=r.doc.length),this.regexp?aF(this,r,t,n):oF(this,r,t,n)}}class iF{constructor(e){this.spec=e}}function oF(e,t,n,r){let i;return e.wholeWord&&(i=function(e,t){return(n,r,i,o)=>((o>n||o+i.length{if(n&&!n(r,i,o,s))return!1;let a=r>=s&&i<=s+o.length?o.slice(r-s,i-s):t.doc.sliceString(r,i);return e(a,t,r,i)}}(e.test,t,i)),new HX(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}class sF extends iF{constructor(e){super(e)}nextMatch(e,t,n){let r=oF(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=oF(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=oF(this.spec,e,n,r),o=null;for(;!i.nextOverlapping().done;)o=i.value;if(o)return o;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||(r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),!r||r.from==t&&r.to==n?null:r}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=oF(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=oF(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}function aF(e,t,n,r){let i;var o;return e.wholeWord&&(o=t.charCategorizer(t.selection.main.head),i=(e,t,n)=>!n[0].length||(o(lF(n.input,n.index))!=qQ.Word||o(cF(n.input,n.index))!=qQ.Word)&&(o(cF(n.input,n.index+n[0].length))!=qQ.Word||o(lF(n.input,n.index+n[0].length))!=qQ.Word)),e.test&&(i=function(e,t,n){return(r,i,o)=>(!n||n(r,i,o))&&e(o[0],t,r,i)}(e.test,t,i)),new jX(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function lF(e,t){return e.slice(Gz(e,t,!1),t)}function cF(e,t){return e.slice(t,Gz(e,t))}class hF extends iF{nextMatch(e,t,n){let r=aF(this.spec,e,n,e.doc.length).next();return r.done&&(r=aF(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-1e4*r),o=aF(this.spec,e,i,n),s=null;for(;!o.next().done;)s=o.value;if(s&&(i==t||s.from>i+10))return s;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,((t,n)=>{if("&"==n)return e.match[0];if("$"==n)return"$";for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=aF(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}const uF=HQ.define(),dF=HQ.define(),fF=xQ.define({create:e=>new pF(CF(e).create(),null),update(e,t){for(let n of t.effects)n.is(uF)?e=new pF(n.value.create(),e.panel):n.is(dF)&&(e=new pF(e.query,n.value?kF:null));return e},provide:e=>JH.from(e,(e=>e.panel))});class pF{constructor(e,t){this.query=e,this.panel=t}}const gF=KI.mark({class:"cm-searchMatch"}),mF=KI.mark({class:"cm-searchMatch cm-searchMatch-selected"}),bF=dD.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(fF))}update(e){let t=e.state.field(fF);(t!=e.startState.field(fF)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return KI.none;let{view:n}=this,r=new sI;for(let t=0,i=n.visibleRanges,o=i.length;ti[t+1].from-500;)a=i[++t].to;e.highlight(n.state,s,a,((e,t)=>{let i=n.state.selection.ranges.some((n=>n.from==e&&n.to==t));r.add(e,t,i?mF:gF)}))}return r.finish()}},{decorations:e=>e.decorations});function vF(e){return t=>{let n=t.state.field(fF,!1);return n&&n.query.spec.valid?e(t,n):RF(t)}}const yF=vF(((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=dQ.single(r.from,r.to),o=e.state.facet(nF);return e.dispatch({selection:i,effects:[QF(e,r),o.scrollToMatch(i.main,e)],userEvent:"select.search"}),TF(e),!0})),OF=vF(((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let o=dQ.single(i.from,i.to),s=e.state.facet(nF);return e.dispatch({selection:o,effects:[QF(e,i),s.scrollToMatch(o.main,e)],userEvent:"select.search"}),TF(e),!0})),wF=vF(((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!(!n||!n.length||(e.dispatch({selection:dQ.create(n.map((e=>dQ.range(e.from,e.to)))),userEvent:"select.search.matches"}),0))})),xF=vF(((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let o=t.nextMatch(n,r,r);if(!o)return!1;let s,a,l=o,c=[],h=[];l.from==r&&l.to==i&&(a=n.toText(t.getReplacement(l)),c.push({from:l.from,to:l.to,insert:a}),l=t.nextMatch(n,l.from,l.to),h.push(NL.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let u=e.state.changes(c);return l&&(s=dQ.single(l.from,l.to).map(u),h.push(QF(e,l)),h.push(n.facet(nF).scrollToMatch(s.main,e))),e.dispatch({changes:u,selection:s,effects:h,userEvent:"input.replace"}),!0})),SF=vF(((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map((e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}}));if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:NL.announce.of(r),userEvent:"input.replace.all"}),!0}));function kF(e){return e.state.facet(nF).createPanel(e)}function CF(e,t){var n,r,i,o,s;let a=e.selection.main,l=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!l)return t;let c=e.facet(nF);return new rF({search:(null!==(n=null==t?void 0:t.literal)&&void 0!==n?n:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:null!==(r=null==t?void 0:t.caseSensitive)&&void 0!==r?r:c.caseSensitive,literal:null!==(i=null==t?void 0:t.literal)&&void 0!==i?i:c.literal,regexp:null!==(o=null==t?void 0:t.regexp)&&void 0!==o?o:c.regexp,wholeWord:null!==(s=null==t?void 0:t.wholeWord)&&void 0!==s?s:c.wholeWord})}function _F(e){let t=qH(e,kF);return t&&t.dom.querySelector("[main-field]")}function TF(e){let t=_F(e);t&&t==e.root.activeElement&&t.select()}const RF=e=>{let t=e.state.field(fF,!1);if(t&&t.panel){let n=_F(e);if(n&&n!=e.root.activeElement){let r=CF(e.state,t.query.spec);r.valid&&e.dispatch({effects:uF.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[dF.of(!0),t?uF.of(CF(e.state,t.query.spec)):HQ.appendConfig.of(NF)]});return!0},EF=e=>{let t=e.state.field(fF,!1);if(!t||!t.panel)return!1;let n=qH(e,kF);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:dF.of(!1)}),!0},MF=[{key:"Mod-f",run:RF,scope:"editor search-panel"},{key:"F3",run:yF,shift:OF,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:yF,shift:OF,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:EF,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,o=[],s=0;for(let t=new HX(e.doc,e.sliceDoc(r,i));!t.next().done;){if(o.length>1e3)return!1;t.value.from==r&&(s=o.length),o.push(dQ.range(t.value.from,t.value.to))}return t(e.update({selection:dQ.create(o,s),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=function(e,t){let n,r=new Promise((e=>n=e)),i=e=>function(e,t,n){let r=t.content?t.content(e,(()=>s(null))):null;if(!r){if(r=PI("form"),t.input){let e=PI("input",t.input);/^(text|password|number|email|tel|url)$/.test(e.type)&&e.classList.add("cm-textfield"),e.name||(e.name="input"),r.appendChild(PI("label",(t.label||"")+": ",e))}else r.appendChild(document.createTextNode(t.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(PI("button",{class:"cm-button",type:"submit"},t.submitLabel||"OK"))}let i="FORM"==r.nodeName?[r]:r.querySelectorAll("form");for(let e=0;e{27==e.keyCode?(e.preventDefault(),s(null)):13==e.keyCode&&(e.preventDefault(),s(t))})),t.addEventListener("submit",(e=>{e.preventDefault(),s(t)}))}let o=PI("div",r,PI("button",{onclick:()=>s(null),"aria-label":e.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));function s(t){o.contains(o.ownerDocument.activeElement)&&e.focus(),n(t)}return t.class&&(o.className=t.class),o.classList.add("cm-dialog"),{dom:o,top:t.top,mount:()=>{if(t.focus){let e;e="string"==typeof t.focus?r.querySelector(t.focus):r.querySelector("input")||r.querySelector("button"),e&&"select"in e?e.select():e&&"focus"in e&&e.focus()}}}}(e,t,n);e.state.field(eV,!1)?e.dispatch({effects:tV.of(i)}):e.dispatch({effects:HQ.appendConfig.of(eV.init((()=>[i])))});let o=nV.of(i);return{close:o,result:r.then((t=>{let n=e.win.queueMicrotask||(t=>e.win.setTimeout(t,10));return n((()=>{e.state.field(eV).indexOf(i)>-1&&e.dispatch({effects:o})})),t}))}}(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:t.phrase("go")});return i.then((n=>{let i=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!i)return void e.dispatch({effects:r});let o=t.doc.lineAt(t.selection.main.head),[,s,a,l,c]=i,h=l?+l.slice(1):0,u=a?+a:o.number;if(a&&c){let e=u/100;s&&(e=e*("-"==s?-1:1)+o.number/t.doc.lines),u=Math.round(t.doc.lines*e)}else a&&s&&(u=u*("-"==s?-1:1)+o.number);let d=t.doc.line(Math.max(1,Math.min(t.doc.lines,u))),f=dQ.cursor(d.from+Math.max(0,Math.min(h,d.length)));e.dispatch({effects:[r,NL.scrollIntoView(f.from,{y:"center"})],selection:f})})),!0}},{key:"Mod-d",run:({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some((e=>e.from===e.to)))return(({state:e,dispatch:t})=>{let{selection:n}=e,r=dQ.create(n.ranges.map((t=>e.wordAt(t.head)||dQ.cursor(t.head))),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)})({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some((t=>e.sliceDoc(t.from,t.to)!=r)))return!1;let i=function(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),o=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new HX(e.doc,t,r[r.length-1].to);;){if(i.next(),!i.done){if(n&&r.some((e=>e.from==i.value.from)))continue;if(o){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}if(n)return null;i=new HX(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}}(e,r);return!!i&&(t(e.update({selection:e.selection.addRange(dQ.range(i.from,i.to),!1),effects:NL.scrollIntoView(i.to)})),!0)},preventDefault:!0}];class PF{constructor(e){this.view=e;let t=this.query=e.state.field(fF).query.spec;function n(e,t,n){return PI("button",{class:"cm-button",name:e,onclick:t,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=PI("input",{value:t.search,placeholder:AF(e,"Find"),"aria-label":AF(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=PI("input",{value:t.replace,placeholder:AF(e,"Replace"),"aria-label":AF(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=PI("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=PI("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=PI("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=PI("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,n("next",(()=>yF(e)),[AF(e,"next")]),n("prev",(()=>OF(e)),[AF(e,"previous")]),n("select",(()=>wF(e)),[AF(e,"all")]),PI("label",null,[this.caseField,AF(e,"match case")]),PI("label",null,[this.reField,AF(e,"regexp")]),PI("label",null,[this.wordField,AF(e,"by word")]),...e.state.readOnly?[]:[PI("br"),this.replaceField,n("replace",(()=>xF(e)),[AF(e,"replace")]),n("replaceAll",(()=>SF(e)),[AF(e,"replace all")])],PI("button",{name:"close",onclick:()=>EF(e),"aria-label":AF(e,"close"),type:"button"},["×"])])}commit(){let e=new rF({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:uF.of(e)}))}keydown(e){!function(e,t,n){return GL(FL(e.state),t,e,"search-panel")}(this.view,e)?13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?OF:yF)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),xF(this.view)):e.preventDefault()}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(uF)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(nF).top}}function AF(e,t){return e.state.phrase(t)}const $F=30,zF=/[\s\.,:;?!]/;function QF(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,o=Math.max(r.from,t-$F),s=Math.min(i,n+$F),a=e.state.sliceDoc(o,s);if(o!=r.from)for(let e=0;e<$F;e++)if(!zF.test(a[e+1])&&zF.test(a[e])){a=a.slice(e);break}if(s!=i)for(let e=a.length-1;e>a.length-$F;e--)if(!zF.test(a[e-1])&&zF.test(a[e])){a=a.slice(0,e);break}return NL.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${r.number}.`)}const IF=NL.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),NF=[fF,kQ.low(bF),IF];class DF{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=DB(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(BF(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return null==this.abortListeners}addEventListener(e,t,n){"abort"==e&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function WF(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function LF(e){let t=e.map((e=>"string"==typeof e?{label:e}:e)),[n,r]=t.every((e=>/^\w+$/.test(e.label)))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}class HF{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}}function VF(e){return e.selection.main.from}function BF(e,t){var n;let{source:r}=e,i=t&&"^"!=r[0],o="$"!=r[r.length-1];return i||o?new RegExp(`${i?"^":""}(?:${r})${o?"$":""}`,null!==(n=e.flags)&&void 0!==n?n:e.ignoreCase?"i":""):e}const jF=DQ.define();function ZF(e,t,n,r){let{main:i}=e.selection,o=n-i.from,s=r-i.from;return{...e.changeByRange((a=>{if(a!=i&&n!=r&&e.sliceDoc(a.from+o,a.from+s)!=e.sliceDoc(n,r))return{range:a};let l=e.toText(t);return{changes:{from:a.from+o,to:r==i.from?a.to:a.from+s,insert:l},range:dQ.cursor(a.from+o+l.length)}})),scrollIntoView:!0,userEvent:"input.complete"}}const XF=new WeakMap;function FF(e){if(!Array.isArray(e))return e;let t=XF.get(e);return t||XF.set(e,t=LF(e)),t}const YF=HQ.define(),qF=HQ.define();class UF{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(v=Jz(l))!=v.toLowerCase()?1:v!=v.toUpperCase()?2:0;(!r||1==y&&g||0==b&&0!=y)&&(t[h]==l||n[h]==l&&(u=!0)?o[h++]=r:o.length&&(m=!1)),b=y,r+=eQ(l)}return h==a&&0==o[0]&&m?this.result((u?-200:0)-100,o,e):d==a&&0==f?this.ret(-200-e.length+(p==e.length?0:-100),[0,p]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):d==a?this.ret(-900-e.length,[f,p]):h==a?this.result((u?-200:0)-100-700+(m?0:-1100),o,e):2==t.length?null:this.result((r[0]?-700:0)-200-1100,r,e)}result(e,t,n){let r=[],i=0;for(let e of t){let t=e+(this.astral?eQ(Kz(n,e)):1);i&&r[i-1]==e?r[i-1]=t:(r[i++]=e,r[i++]=t)}return this.ret(e-n.length,r)}}class GF{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.lengthJQ(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:eY,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>JF(e(n),t(n)),optionClass:(e,t)=>n=>JF(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})});function JF(e,t){return e?t?e+" "+t:e:t}function eY(e,t,n,r,i,o){let s,a,l=e.textDirection==RN.RTL,c=l,h=!1,u="top",d=t.left-i.left,f=i.right-t.right,p=r.right-r.left,g=r.bottom-r.top;if(c&&d=g||e>t.top?s=n.bottom-t.top:(u="bottom",s=t.bottom-n.top)}return{style:`${u}: ${s/((t.bottom-t.top)/o.offsetHeight)}px; max-width: ${a/((t.right-t.left)/o.offsetWidth)}px`,class:"cm-completionInfo-"+(h?l?"left-narrow":"right-narrow":c?"left":"right")}}const tY=HQ.define();function nY(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.floor((e-t)/n);return{from:e-(r+1)*n,to:e-r*n}}class rY{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let r=e.state.field(t),{options:i,selected:o}=r.open,s=e.state.facet(KF);this.optionContent=function(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map((e=>"cm-completionIcon-"+e))),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement("span");i.className="cm-completionLabel";let o=e.displayLabel||e.label,s=0;for(let e=0;es&&i.appendChild(document.createTextNode(o.slice(s,t)));let a=i.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(o.slice(t,n))),a.className="cm-completionMatchedText",s=n}return se.position-t.position)).map((e=>e.render))}(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=nY(i.length,o,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",(n=>{let{options:r}=e.state.field(t).open;for(let t,i=n.target;i&&i!=this.dom;i=i.parentNode)if("LI"==i.nodeName&&(t=/-(\d+)$/.exec(i.id))&&+t[1]this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;null!=t&&(e.dispatch({effects:tY.of(t)}),n.preventDefault())}})),this.dom.addEventListener("focusout",(t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(KF).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:qF.of(null)})})),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}update(e){var t;let n=e.state.field(this.stateField),r=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=r){let{options:i,selected:o,disabled:s}=n.open;r.open&&r.open.options==i||(this.range=nY(i.length,o,e.state.facet(KF).maxRenderedOptions),this.showOptions(i,n.id)),this.updateSel(),s!=(null===(t=r.open)||void 0===t?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected=this.range.to)&&(this.range=nY(t.options.length,t.selected,this.view.state.facet(KF).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let o="string"==typeof i?document.createTextNode(i):i(r);if(!o)return;"then"in o?o.then((t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)})).catch((e=>lD(this.view.state,e,"completion info"))):(this.addInfoPane(o,r),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(65535*Math.random()).toString(16),null!=e.nodeType)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)"LI"==n.nodeName&&n.id?r==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby")):r--;return t&&function(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.topn.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom{e.target==r&&e.preventDefault()}));let i=null;for(let o=n.from;on.from||0==n.from)&&(i=e,"string"!=typeof l&&l.header?r.appendChild(l.header(l)):r.appendChild(document.createElement("completion-section")).textContent=e)}const c=r.appendChild(document.createElement("li"));c.id=t+"-"+o,c.setAttribute("role","option");let h=this.optionClass(s);h&&(c.className=h);for(let e of this.optionContent){let t=e(s,this.view.state,this.view,a);t&&c.appendChild(t)}}return n.from&&r.classList.add("cm-completionListIncompleteTop"),n.tonew rY(n,e,t)}function oY(e){return 100*(e.boost||0)+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}class sY{constructor(e,t,n,r,i,o){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new sY(this.options,hY(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,r,i,o){if(r&&!o&&e.some((e=>e.isPending)))return r.setDisabled();let s=function(e,t){let n=[],r=null,i=null,o=e=>{n.push(e);let{section:t}=e.completion;if(t){r||(r=[]);let e="string"==typeof t?t:t.name;r.some((t=>t.name==e))||r.push("string"==typeof t?{name:e}:t)}},s=t.facet(KF);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(!1===r.result.filter)for(let t of r.result.options)o(new HF(t,r.source,e?e(t):[],1e9-n.length));else{let n,a=t.sliceDoc(r.from,r.to),l=s.filterStrict?new GF(a):new UF(a);for(let t of r.result.options)if(n=l.match(t.label)){let s=t.displayLabel?e?e(t,n.matched):[]:n.matched,a=n.score+(t.boost||0);if(o(new HF(t,r.source,s,a)),"object"==typeof t.section&&"dynamic"===t.section.rank){let{name:e}=t.section;i||(i=Object.create(null)),i[e]=Math.max(a,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,o=(e,t)=>("dynamic"===e.rank&&"dynamic"===t.rank?i[t.name]-i[e.name]:0)||("number"==typeof e.rank?e.rank:1e9)-("number"==typeof t.rank?t.rank:1e9)||(e.namet.score-e.score||c(e.completion,t.completion)))){let t=e.completion;!l||l.label!=t.label||l.detail!=t.detail||null!=l.type&&null!=t.type&&l.type!=t.type||l.apply!=t.apply||l.boost!=t.boost?a.push(e):oY(e.completion)>oY(l)&&(a[a.length-1]=e),l=e.completion}return a}(e,t);if(!s.length)return r&&e.some((e=>e.isPending))?r.setDisabled():null;let a=t.facet(KF).selectOnOpen?0:-1;if(r&&r.selected!=a&&-1!=r.selected){let e=r.options[r.selected].completion;for(let t=0;tt.hasResult()?Math.min(e,t.from):e),1e8),create:vY,above:i.aboveCursor},r?r.timestamp:Date.now(),a,!1)}map(e){return new sY(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new sY(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class aY{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new aY(uY,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(KF),r=(n.override||t.languageDataAt("autocomplete",VF(t)).map(FF)).map((t=>{let r=this.active.find((e=>e.source==t))||new fY(t,this.active.some((e=>0!=e.state))?1:0);return r.update(e,n)}));r.length==this.active.length&&r.every(((e,t)=>e==this.active[t]))&&(r=this.active);let i=this.open,o=e.effects.some((e=>e.is(gY)));i&&e.docChanged&&(i=i.map(e.changes)),e.selection||r.some((t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to)))||!function(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;ne.isPending))&&(i=null),!i&&r.every((e=>!e.isPending))&&r.some((e=>e.hasResult()))&&(r=r.map((e=>e.hasResult()?new fY(e.source,0):e)));for(let t of e.effects)t.is(tY)&&(i=i&&i.setSelected(t.value,this.id));return r==this.active&&i==this.open?this:new aY(r,this.id,i)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?lY:cY}}const lY={"aria-autocomplete":"list"},cY={};function hY(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const uY=[];function dY(e,t){if(e.isUserEvent("input.complete")){let n=e.annotation(jF);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class fY{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return 1==this.state}update(e,t){let n=dY(e,t),r=this;(8&n||16&n&&this.touches(e))&&(r=new fY(r.source,0)),4&n&&0==r.state&&(r=new fY(this.source,1)),r=r.updateFor(e,n);for(let t of e.effects)if(t.is(YF))r=new fY(r.source,1,t.value);else if(t.is(qF))r=new fY(r.source,0);else if(t.is(gY))for(let e of t.value)e.source==r.source&&(r=e);return r}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(VF(e.state))}}class pY extends fY{constructor(e,t,n,r,i,o){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=o}hasResult(){return!0}updateFor(e,t){var n;if(!(3&t))return this.map(e.changes);let r=this.result;r.map&&!e.changes.empty&&(r=r.map(r,e.changes));let i=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),s=VF(e.state);if(s>o||!r||2&t&&(VF(e.startState)==this.from||se.map((e=>e.map(t)))}),mY=xQ.define({create:()=>aY.start(),update:(e,t)=>e.update(t),provide:e=>[WH.from(e,(e=>e.tooltip)),NL.contentAttributes.from(e,(e=>e.attrs))]});function bY(e,t){const n=t.completion.apply||t.completion.label;let r=e.state.field(mY).active.find((e=>e.source==t.source));return r instanceof pY&&("string"==typeof n?e.dispatch({...ZF(e.state,n,r.from,r.to),annotations:jF.of(t.completion)}):n(e,t.completion,r.from,r.to),!0)}const vY=iY(mY,bY);function yY(e,t="option"){return n=>{let r=n.state.field(mY,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+o*(e?1:-1):e?0:s-1;return a<0?a="page"==t?0:s-1:a>=s&&(a="page"==t?s-1:0),n.dispatch({effects:tY.of(a)}),!0}}const OY=e=>!!e.state.field(mY,!1)&&(e.dispatch({effects:YF.of(!0)}),!0);class wY{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const xY=dD.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(mY).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(mY),n=e.state.facet(KF);if(!e.selectionSet&&!e.docChanged&&e.startState.field(mY)==t)return;let r=e.transactions.some((e=>{let t=dY(e,n);return 8&t||(e.selection||e.docChanged)&&!(3&t)}));for(let t=0;t50&&Date.now()-n.time>1e3){for(let e of n.context.abortListeners)try{e()}catch(e){lD(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some((e=>e.effects.some((e=>e.is(YF)))))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some((e=>e.isPending&&!this.running.some((t=>t.active.source==e.source))))?setTimeout((()=>this.startUpdate()),i):-1,0!=this.composing)for(let t of e.transactions)t.isUserEvent("input.type")?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(mY);for(let e of t.active)e.isPending&&!this.running.some((t=>t.active.source==e.source))&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout((()=>this.accept()),this.view.state.facet(KF).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=VF(t),r=new DF(t,n,e.explicit,this.view),i=new wY(e,r);this.running.push(i),Promise.resolve(e.source(r)).then((e=>{i.context.aborted||(i.done=e||null,this.scheduleAccept())}),(e=>{this.view.dispatch({effects:qF.of(null)}),lD(this.view.state,e)}))}scheduleAccept(){this.running.every((e=>void 0!==e.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),this.view.state.facet(KF).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(KF),r=this.view.state.field(mY);for(let i=0;ie.source==o.active.source));if(s&&s.isPending)if(null==o.done){let e=new fY(o.active.source,0);for(let t of o.updates)e=e.update(t,n);e.isPending||t.push(e)}else this.startQuery(s)}(t.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:gY.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(mY,!1);if(t&&t.tooltip&&this.view.state.facet(KF).closeOnBlur){let n=t.open&&XH(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout((()=>this.view.dispatch({effects:qF.of(null)})),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:YF.of(!1)})),20),this.composing=0}}}),SY="object"==typeof navigator&&/Win/.test(navigator.platform),kY=kQ.highest(NL.domEventHandlers({keydown(e,t){let n=t.state.field(mY,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&(!SY||!e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find((e=>e.source==r.source)),o=r.completion.commitCharacters||i.result.commitCharacters;return o&&o.indexOf(e.key)>-1&&bY(t,r),!1}})),CY=NL.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class _Y{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}}class TY{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,nQ.TrackDel),n=e.mapPos(this.to,1,nQ.TrackDel);return null==t||null==n?null:new TY(this.field,t,n)}}class RY{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],i=e.doc.lineAt(t),o=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(n.length){let n=o,s=/^\t*/.exec(i)[0].length;for(let t=0;tnew TY(e.field,r[e.line]+e.from,r[e.line]+e.to)));return{text:n,ranges:s}}static parse(e){let t,n=[],r=[],i=[];for(let o of e.split(/\r\n?|\n/)){for(;t=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let e=t[1]?+t[1]:null,s=t[2]||t[3]||"",a=-1,l=s.replace(/\\[{}]/g,(e=>e[1]));for(let t=0;t=a&&e.field++}for(let e of i)if(e.line==r.length&&e.from>t.index){let n=t[2]?3+(t[1]||"").length:2;e.from-=n,e.to-=n}i.push(new _Y(a,r.length,t.index,t.index+l.length)),o=o.slice(0,t.index)+s+o.slice(t.index+t[0].length)}o=o.replace(/\\([{}])/g,((e,t,n)=>{for(let e of i)e.line==r.length&&e.from>n&&(e.from--,e.to--);return t})),r.push(o)}return new RY(r,i)}}let EY=KI.widget({widget:new class extends UI{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),MY=KI.mark({class:"cm-snippetField"});class PY{constructor(e,t){this.ranges=e,this.active=t,this.deco=KI.set(e.map((e=>(e.from==e.to?EY:MY).range(e.from,e.to))),!0)}map(e){let t=[];for(let n of this.ranges){let r=n.map(e);if(!r)return null;t.push(r)}return new PY(t,this.active)}selectionInsideField(e){return e.ranges.every((e=>this.ranges.some((t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))))}}const AY=HQ.define({map:(e,t)=>e&&e.map(t)}),$Y=HQ.define(),zY=xQ.define({create:()=>null,update(e,t){for(let n of t.effects){if(n.is(AY))return n.value;if(n.is($Y)&&e)return new PY(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>NL.decorations.from(e,(e=>e?e.deco:KI.none))});function QY(e,t){return dQ.create(e.filter((e=>e.field==t)).map((e=>dQ.range(e.from,e.to))))}function IY(e){let t=RY.parse(e);return(e,n,r,i)=>{let{text:o,ranges:s}=t.instantiate(e.state,r),{main:a}=e.state.selection,l={changes:{from:r,to:i==a.from?a.to:i,insert:Hz.of(o)},scrollIntoView:!0,annotations:n?[jF.of(n),VQ.userEvent.of("input.complete")]:void 0};if(s.length&&(l.selection=QY(s,0)),s.some((e=>e.field>0))){let t=new PY(s,0),n=l.effects=[AY.of(t)];void 0===e.state.field(zY,!1)&&n.push(HQ.appendConfig.of([zY,LY,VY,CY]))}e.dispatch(e.state.update(l))}}function NY(e){return({state:t,dispatch:n})=>{let r=t.field(zY,!1);if(!r||e<0&&0==r.active)return!1;let i=r.active+e,o=e>0&&!r.ranges.some((t=>t.field==i+e));return n(t.update({selection:QY(r.ranges,i),effects:AY.of(o?null:new PY(r.ranges,i)),scrollIntoView:!0})),!0}}const DY=[{key:"Tab",run:NY(1),shift:NY(-1)},{key:"Escape",run:({state:e,dispatch:t})=>!!e.field(zY,!1)&&(t(e.update({effects:AY.of(null)})),!0)}],WY=gQ.define({combine:e=>e.length?e[0]:DY}),LY=kQ.highest(ZL.compute([WY],(e=>e.facet(WY))));function HY(e,t){return{...t,apply:IY(e)}}const VY=NL.domEventHandlers({mousedown(e,t){let n,r=t.state.field(zY,!1);if(!r||null==(n=t.posAtCoords({x:e.clientX,y:e.clientY})))return!1;let i=r.ranges.find((e=>e.from<=n&&e.to>=n));return!(!i||i.field==r.active||(t.dispatch({selection:QY(r.ranges,i.field),effects:AY.of(r.ranges.some((e=>e.field>i.field))?new PY(r.ranges,i.field):null),scrollIntoView:!0}),0))}}),BY={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},jY=HQ.define({map(e,t){let n=t.mapPos(e,-1,nQ.TrackAfter);return null==n?void 0:n}}),ZY=new class extends eI{};ZY.startSide=1,ZY.endSide=-1;const XY=xQ.define({create:()=>oI.empty,update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(jY)&&(e=e.update({add:[ZY.range(n.value,n.value+1)]}));return e}}),FY="()[]{}<>«»»«[]{}";function YY(e){for(let t=0;t<16;t+=2)if(FY.charCodeAt(t)==e)return FY.charAt(t+1);return Jz(e<128?e:e+1)}function qY(e,t){return e.languageDataAt("closeBrackets",t)[0]||BY}const UY="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),GY=NL.inputHandler.of(((e,t,n,r)=>{if((UY?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||2==r.length&&1==eQ(Kz(r,0))||t!=i.from||n!=i.to)return!1;let o=function(e,t){let n=qY(e,e.selection.main.head),r=n.brackets||BY.brackets;for(let i of r){let o=YY(Kz(i,0));if(t==i)return o==i?rq(e,i,r.indexOf(i+i+i)>-1,n):tq(e,i,o,n.before||BY.before);if(t==o&&JY(e,e.selection.main.from))return nq(e,0,o)}return null}(e.state,r);return!!o&&(e.dispatch(o),!0)})),KY=[{key:"Backspace",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=qY(e,e.selection.main.head).brackets||BY.brackets,r=null,i=e.changeByRange((t=>{if(t.empty){let r=function(e,t){let n=e.sliceString(t-2,t);return eQ(Kz(n,0))==n.length?n:n.slice(1)}(e.doc,t.head);for(let i of n)if(i==r&&eq(e.doc,t.head)==YY(Kz(i,0)))return{changes:{from:t.head-i.length,to:t.head+i.length},range:dQ.cursor(t.head-i.length)}}return{range:r=t}}));return r||t(e.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!r}}];function JY(e,t){let n=!1;return e.field(XY).between(0,e.doc.length,(e=>{e==t&&(n=!0)})),n}function eq(e,t){let n=e.sliceString(t,t+2);return n.slice(0,eQ(Kz(n,0)))}function tq(e,t,n,r){let i=null,o=e.changeByRange((o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:n,from:o.to}],effects:jY.of(o.to+t.length),range:dQ.range(o.anchor+t.length,o.head+t.length)};let s=eq(e.doc,o.head);return!s||/\s/.test(s)||r.indexOf(s)>-1?{changes:{insert:t+n,from:o.head},effects:jY.of(o.head+t.length),range:dQ.cursor(o.head+t.length)}:{range:i=o}}));return i?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function nq(e,t,n){let r=null,i=e.changeByRange((t=>t.empty&&eq(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:dQ.cursor(t.head+n.length)}:r={range:t}));return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function rq(e,t,n,r){let i=r.stringPrefixes||BY.stringPrefixes,o=null,s=e.changeByRange((r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:jY.of(r.to+t.length),range:dQ.range(r.anchor+t.length,r.head+t.length)};let s,a=r.head,l=eq(e.doc,a);if(l==t){if(iq(e,a))return{changes:{insert:t+t,from:a},effects:jY.of(a+t.length),range:dQ.cursor(a+t.length)};if(JY(e,a)){let r=n&&e.sliceDoc(a,a+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:a,to:a+r.length,insert:r},range:dQ.cursor(a+r.length)}}}else{if(n&&e.sliceDoc(a-2*t.length,a)==t+t&&(s=oq(e,a-2*t.length,i))>-1&&iq(e,s))return{changes:{insert:t+t+t+t,from:a},effects:jY.of(a+t.length),range:dQ.cursor(a+t.length)};if(e.charCategorizer(a)(l)!=qQ.Word&&oq(e,a,i)>-1&&!function(e,t,n,r){let i=DB(e).resolveInner(t,-1),o=r.reduce(((e,t)=>Math.max(e,t.length)),0);for(let s=0;s<5;s++){let s=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+o)),a=s.indexOf(n);if(!a||a>-1&&r.indexOf(s.slice(0,a))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+a;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let l=i.to==t&&i.parent;if(!l)break;i=l}return!1}(e,a,t,i))return{changes:{insert:t+t,from:a},effects:jY.of(a+t.length),range:dQ.cursor(a+t.length)}}return{range:o=r}}));return o?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function iq(e,t){let n=DB(e).resolveInner(t+1);return n.parent&&n.from==t}function oq(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=qQ.Word)return t;for(let i of n){let n=t-i.length;if(e.sliceDoc(n,t)==i&&r(e.sliceDoc(n-1,n))!=qQ.Word)return n}return-1}const sq=[{key:"Ctrl-Space",run:OY},{mac:"Alt-`",run:OY},{mac:"Alt-i",run:OY},{key:"Escape",run:e=>{let t=e.state.field(mY,!1);return!(!t||!t.active.some((e=>0!=e.state))||(e.dispatch({effects:qF.of(null)}),0))}},{key:"ArrowDown",run:yY(!0)},{key:"ArrowUp",run:yY(!1)},{key:"PageDown",run:yY(!0,"page")},{key:"PageUp",run:yY(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(mY,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestampe.facet(KF).defaultKeymap?[sq]:[])));class lq{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class cq{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let r=n.facet(Oq).markerFilter;r&&(e=r(e,n));let i=e.slice().sort(((e,t)=>e.from-t.from||e.to-t.to)),o=new sI,s=[],a=0,l=n.doc.iter(),c=0,h=n.doc.length;for(let e=0;;){let t,n,r=e==i.length?null:i[e];if(!r&&!s.length)break;if(s.length)t=a,n=s.reduce(((e,t)=>Math.min(e,t.to)),r&&r.from>t?r.from:1e8);else{if(t=r.from,t>h)break;n=r.to,s.push(r),e++}for(;er.from||r.to==t)){n=Math.min(r.from,n);break}s.push(r),e++,n=Math.min(r.to,n)}n=Math.min(n,h);let u=!1;if(s.some((e=>e.from==t&&(e.to==n||n==h)))&&(u=t==n,!u&&n-t<10)){let e=t-(c+l.value.length);e>0&&(l.next(e),c=t);for(let e=t;;){if(e>=n){u=!0;break}if(!l.lineBreak&&c+l.value.length>e)break;e=c+l.value.length,c+=l.value.length,l.next()}}let d=Mq(s);if(u)o.add(t,t,KI.widget({widget:new kq(d),diagnostics:s.slice()}));else{let e=s.reduce(((e,t)=>t.markClass?e+" "+t.markClass:e),"");o.add(t,n,KI.mark({class:"cm-lintRange cm-lintRange-"+d+e,diagnostics:s.slice(),inclusiveEnd:s.some((e=>e.to>n))}))}if(a=n,a==h)break;for(let e=0;e{if(!(t&&i.diagnostics.indexOf(t)<0))if(r){if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new lq(r.from,n,r.diagnostic)}else r=new lq(e,n,t||i.diagnostics[0])})),r}const uq=HQ.define(),dq=HQ.define(),fq=HQ.define(),pq=xQ.define({create:()=>new cq(KI.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=hq(n,e.selected.diagnostic,i)||hq(n,null,i)}!n.size&&i&&t.state.facet(Oq).autoPanel&&(i=null),e=new cq(n,i,r)}for(let n of t.effects)if(n.is(uq)){let r=t.state.facet(Oq).autoPanel?n.value.length?_q.open:null:e.panel;e=cq.init(n.value,r,t.state)}else n.is(dq)?e=new cq(e.diagnostics,n.value?_q.open:null,e.selected):n.is(fq)&&(e=new cq(e.diagnostics,e.panel,n.value));return e},provide:e=>[JH.from(e,(e=>e.panel)),NL.decorations.from(e,(e=>e.diagnostics))]}),gq=KI.mark({class:"cm-lintRange cm-lintRange-active"});function mq(e,t,n){let r,{diagnostics:i}=e.state.field(pq),o=-1,s=-1;i.between(t-(n<0?1:0),t+(n>0?1:0),((e,i,{spec:a})=>{if(t>=e&&t<=i&&(e==i||(t>e||n>0)&&(t({dom:bq(e,r)})}:null}function bq(e,t){return PI("ul",{class:"cm-tooltip-lint"},t.map((t=>Sq(e,t,!1))))}const vq=e=>{let t=e.state.field(pq,!1);return!(!t||!t.panel||(e.dispatch({effects:dq.of(!1)}),0))},yq=[{key:"Mod-Shift-m",run:e=>{let t=e.state.field(pq,!1);var n,r;t&&t.panel||e.dispatch({effects:(n=e.state,r=[dq.of(!0)],n.field(pq,!1)?r:r.concat(HQ.appendConfig.of(Pq)))});let i=qH(e,_q.open);return i&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:e=>{let t=e.state.field(pq,!1);if(!t)return!1;let n=e.state.selection.main,r=hq(t.diagnostics,null,n.to+1);return!(!r&&(r=hq(t.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)||(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),0))}}],Oq=gQ.define({combine:e=>({sources:e.map((e=>e.source)).filter((e=>null!=e)),...JQ(e.map((e=>e.config)),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:wq,tooltipFilter:wq,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})})});function wq(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function xq(e){let t=[];if(e)e:for(let{name:n}of e){for(let e=0;ee.toLowerCase()==r.toLowerCase()))){t.push(r);continue e}}t.push("")}return t}function Sq(e,t,n){var r;let i=n?xq(t.actions):[];return PI("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},PI("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null===(r=t.actions)||void 0===r?void 0:r.map(((n,r)=>{let o=!1,s=r=>{if(r.preventDefault(),o)return;o=!0;let i=hq(e.state.field(pq).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:a}=n,l=i[r]?a.indexOf(i[r]):-1,c=l<0?a:[a.slice(0,l),PI("u",a.slice(l,l+1)),a.slice(l+1)];return PI("button",{type:"button",class:"cm-diagnosticAction"+(n.markClass?" "+n.markClass:""),onclick:s,onmousedown:s,"aria-label":` Action: ${a}${l<0?"":` (access key "${i[r]})"`}.`},c)})),t.source&&PI("div",{class:"cm-diagnosticSource"},t.source))}class kq extends UI{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return PI("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Cq{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=Sq(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class _q{constructor(e){this.view=e,this.items=[],this.list=PI("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(27==t.keyCode)vq(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:n}=this.items[this.selectedIndex],r=xq(n.actions);for(let i=0;i{for(let t=0;tvq(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(pq).selected;if(!e)return-1;for(let t=0;t{for(let e of a.diagnostics){if(o.has(e))continue;o.add(e);let s,a=-1;for(let t=n;tn&&(this.items.splice(n,a-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute("aria-selected")||(s.dom.setAttribute("aria-selected","true"),i=s):s.dom.hasAttribute("aria-selected")&&s.dom.removeAttribute("aria-selected"),n++}}));n({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.topt.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=hq(this.view.state.field(pq).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:fq.of(t)})}static open(e){return new _q(e)}}function Tq(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(e)}')`}(``,'width="6" height="3"')}const Rq=NL.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Tq("#d11")},".cm-lintRange-warning":{backgroundImage:Tq("orange")},".cm-lintRange-info":{backgroundImage:Tq("#999")},".cm-lintRange-hint":{backgroundImage:Tq("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function Eq(e){return"error"==e?4:"warning"==e?3:"info"==e?2:1}function Mq(e){let t="hint",n=1;for(let r of e){let e=Eq(r.severity);e>n&&(n=e,t=r.severity)}return t}const Pq=[pq,NL.decorations.compute([pq],(e=>{let{selected:t,panel:n}=e.field(pq);return t&&n&&t.from!=t.to?KI.set([gq.range(t.from,t.to)]):KI.none})),ZH(mq,{hideOn:function(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(Oq).hideOn(e,n,r);if(null!=i)return i;let o=e.startState.doc.lineAt(t.pos);return!(!e.effects.some((e=>e.is(uq)))&&!e.changes.touchesRange(o.from,Math.max(o.to,r)))}}),Rq];var Aq=function(e){void 0===e&&(e={});var{crosshairCursor:t=!1}=e,n=[];!1!==e.closeBracketsKeymap&&(n=n.concat(KY)),!1!==e.defaultKeymap&&(n=n.concat(DX)),!1!==e.searchKeymap&&(n=n.concat(MF)),!1!==e.historyKeymap&&(n=n.concat(DZ)),!1!==e.foldKeymap&&(n=n.concat(kj)),!1!==e.completionKeymap&&(n=n.concat(sq)),!1!==e.lintKeymap&&(n=n.concat(yq));var r=[];return!1!==e.lineNumbers&&r.push(function(e={}){return[yV.of(e),hV(),xV]}()),!1!==e.highlightActiveLineGutter&&r.push(CV),!1!==e.highlightSpecialChars&&r.push(function(e={}){return[yH.of(e),OH||(OH=dD.fromClass(class{constructor(e){this.view=e,this.decorations=KI.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(yH)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new pH({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:i}=n.state,o=Kz(t[0],0);if(9==o){let e=i.lineAt(r),t=n.state.tabSize,o=bI(e.text,t,r-e.from);return KI.replace({widget:new xH((t-o%t)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=KI.replace({widget:new wH(e,o)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(yH);e.startState.facet(yH)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))]}()),!1!==e.history&&r.push(function(e={}){return[wZ,OZ.of(e),NL.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?SZ:"historyRedo"==e.inputType?kZ:null;return!!n&&(e.preventDefault(),n(t))}})]}()),!1!==e.foldGutter&&r.push(function(e={}){let t={...Pj,...e},n=new Aj(t,!0),r=new Aj(t,!1),i=dD.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(FB)!=e.state.facet(FB)||e.startState.field(vj,!1)!=e.state.field(vj,!1)||DB(e.startState)!=DB(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new sI;for(let i of e.viewportLineBlocks){let o=Oj(e.state,i.from,i.to)?r:fj(e.state,i.from,i.to)?n:null;o&&t.add(i.from,i.from,o)}return t.finish()}}),{domEventHandlers:o}=t;return[i,lV({class:"cm-foldGutter",markers(e){var t;return(null===(t=e.plugin(i))||void 0===t?void 0:t.markers)||oI.empty},initialSpacer:()=>new Aj(t,!1),domEventHandlers:{...o,click:(e,t,n)=>{if(o.click&&o.click(e,t,n))return!0;let r=Oj(e.state,t.from,t.to);if(r)return e.dispatch({effects:mj.of(r)}),!0;let i=fj(e.state,t.from,t.to);return!!i&&(e.dispatch({effects:gj.of(i)}),!0)}}}),Tj()]}()),!1!==e.drawSelection&&r.push(function(e={}){return[iH.of(e),sH,lH,cH,rD.of(!0)]}()),!1!==e.dropCursor&&r.push([uH,dH]),!1!==e.allowMultipleSelections&&r.push(KQ.allowMultipleSelections.of(!0)),!1!==e.indentOnInput&&r.push(KQ.transactionFilter.of((e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:r}=e.newSelection.main,i=n.lineAt(r);if(r>i.from+200)return e;let o=n.sliceString(i.from,r);if(!t.some((e=>e.test(o))))return e;let{state:s}=e,a=-1,l=[];for(let{head:e}of s.selection.ranges){let t=s.doc.lineAt(e);if(t.from==a)continue;a=t.from;let n=JB(s,t.from);if(null==n)continue;let r=/^\s*/.exec(t.text)[0],i=KB(s,n);r!=i&&l.push({from:t.from,to:t.from+r.length,insert:i})}return l.length?[e,{changes:l,sequential:!0}]:e}))),!1!==e.syntaxHighlighting&&r.push(Dj(Hj,{fallback:!0})),!1!==e.bracketMatching&&r.push(function(e={}){return[Zj.of(e),Uj]}()),!1!==e.closeBrackets&&r.push([GY,XY]),!1!==e.autocompletion&&r.push(function(e={}){return[kY,mY,KF.of(e),xY,aq,CY]}()),!1!==e.rectangularSelection&&r.push(function(e){let t=e=>e.altKey&&0==e.button;return NL.mouseSelectionStyle.of(((e,n)=>t(n)?function(e,t){let n=TH(e,t),r=e.state.selection;return n?{update(e){if(e.docChanged){let t=e.changes.mapPos(e.startState.doc.line(n.line).from),i=e.state.doc.lineAt(t);n={line:i.number,col:n.col,off:Math.min(n.off,i.length)},r=r.map(e.changes)}},get(t,i,o){let s=TH(e,t);if(!s)return r;let a=function(e,t,n){let r=Math.min(t.line,n.line),i=Math.max(t.line,n.line),o=[];if(t.off>_H||n.off>_H||t.col<0||n.col<0){let s=Math.min(t.off,n.off),a=Math.max(t.off,n.off);for(let t=r;t<=i;t++){let n=e.doc.line(t);n.length<=a&&o.push(dQ.range(n.from+s,n.to+a))}}else{let s=Math.min(t.col,n.col),a=Math.max(t.col,n.col);for(let t=r;t<=i;t++){let n=e.doc.line(t),r=vI(n.text,s,e.tabSize,!0);if(r<0)o.push(dQ.cursor(n.to));else{let t=vI(n.text,a,e.tabSize);o.push(dQ.range(n.from+r,n.from+t))}}}return o}(e.state,n,s);return a.length?o?dQ.create(a.concat(r.ranges)):dQ.create(a):r}}:null}(e,n):null))}()),!1!==t&&r.push(function(e={}){let[t,n]=RH[e.key||"Alt"],r=dD.fromClass(class{constructor(e){this.view=e,this.isDown=!1}set(e){this.isDown!=e&&(this.isDown=e,this.view.update([]))}},{eventObservers:{keydown(e){this.set(e.keyCode==t||n(e))},keyup(e){e.keyCode!=t&&n(e)||this.set(!1)},mousemove(e){this.set(n(e))}}});return[r,NL.contentAttributes.of((e=>{var t;return(null===(t=e.plugin(r))||void 0===t?void 0:t.isDown)?EH:null}))]}()),!1!==e.highlightActiveLine&&r.push(kH),!1!==e.highlightSelectionMatches&&r.push(function(e){let t=[tF,eF];return t}()),e.tabSize&&"number"==typeof e.tabSize&&r.push(UB.of(" ".repeat(e.tabSize))),r.concat([ZL.of(n.flat())]).filter(Boolean)};const $q="#e06c75",zq="#abb2bf",Qq="#7d8799",Iq="#d19a66",Nq="#2c313a",Dq="#282c34",Wq="#353a42",Lq="#528bff",Hq=[NL.theme({"&":{color:zq,backgroundColor:Dq},".cm-content":{caretColor:Lq},".cm-cursor, .cm-dropCursor":{borderLeftColor:Lq},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"#3E4451"},".cm-panels":{backgroundColor:"#21252b",color:zq},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:Dq,color:Qq,border:"none"},".cm-activeLineGutter":{backgroundColor:Nq},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Wq},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Wq,borderBottomColor:Wq},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Nq,color:zq}}},{dark:!0}),Dj(zj.define([{tag:MB.keyword,color:"#c678dd"},{tag:[MB.name,MB.deleted,MB.character,MB.propertyName,MB.macroName],color:$q},{tag:[MB.function(MB.variableName),MB.labelName],color:"#61afef"},{tag:[MB.color,MB.constant(MB.name),MB.standard(MB.name)],color:Iq},{tag:[MB.definition(MB.name),MB.separator],color:zq},{tag:[MB.typeName,MB.className,MB.number,MB.changed,MB.annotation,MB.modifier,MB.self,MB.namespace],color:"#e5c07b"},{tag:[MB.operator,MB.operatorKeyword,MB.url,MB.escape,MB.regexp,MB.link,MB.special(MB.string)],color:"#56b6c2"},{tag:[MB.meta,MB.comment],color:Qq},{tag:MB.strong,fontWeight:"bold"},{tag:MB.emphasis,fontStyle:"italic"},{tag:MB.strikethrough,textDecoration:"line-through"},{tag:MB.link,color:Qq,textDecoration:"underline"},{tag:MB.heading,fontWeight:"bold",color:$q},{tag:[MB.atom,MB.bool,MB.special(MB.variableName)],color:Iq},{tag:[MB.processingInstruction,MB.string,MB.inserted],color:"#98c379"},{tag:MB.invalid,color:"#ffffff"}]))];var Vq=NL.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),Bq=function(e){void 0===e&&(e={});var{indentWithTab:t=!0,editable:n=!0,readOnly:r=!1,theme:i="light",placeholder:o="",basicSetup:s=!0}=e,a=[];switch(t&&a.unshift(ZL.of([WX])),s&&("boolean"==typeof s?a.unshift(Aq()):a.unshift(Aq(s))),o&&a.unshift(function(e){let t=dD.fromClass(class{constructor(t){this.view=t,this.placeholder=e?KI.set([KI.widget({widget:new CH(e),side:1}).range(0)]):KI.none}get decorations(){return this.view.state.doc.length?KI.none:this.placeholder}},{decorations:e=>e.decorations});return"string"==typeof e?[t,NL.contentAttributes.of({"aria-placeholder":e})]:t}(o)),i){case"light":a.push(Vq);break;case"dark":a.push(Hq);break;case"none":break;default:a.push(i)}return!1===n&&a.push(NL.editable.of(!1)),r&&a.push(KQ.readOnly.of(!0)),[...a]};class jq{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach((e=>{try{e()}catch(e){console.error("TimeoutLatch callback error:",e)}}))}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class Zq{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),0===this.latches.size&&this.stop()}start(){null===this.interval&&(this.interval=setInterval((()=>{this.latches.forEach((e=>{e.tick(),e.isDone&&this.remove(e)}))}),1))}stop(){null!==this.interval&&(clearInterval(this.interval),this.interval=null)}}var Xq=null,Fq=DQ.define(),Yq=[];var qq=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Uq=(0,c.forwardRef)(((e,t)=>{var{className:n,value:r="",selection:i,extensions:o=[],onChange:s,onStatistics:a,onCreateEditor:h,onUpdate:u,autoFocus:d,theme:f="light",height:p,minHeight:g,maxHeight:m,width:b,minWidth:v,maxWidth:y,basicSetup:O,placeholder:w,indentWithTab:x,editable:S,readOnly:k,root:C,initialState:_}=e,T=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(e,qq),R=(0,c.useRef)(null),{state:E,view:M,container:P,setContainer:A}=function(e){var{value:t,selection:n,onChange:r,onStatistics:i,onCreateEditor:o,onUpdate:s,extensions:a=Yq,autoFocus:l,theme:h="light",height:u=null,minHeight:d=null,maxHeight:f=null,width:p=null,minWidth:g=null,maxWidth:m=null,placeholder:b="",editable:v=!0,readOnly:y=!1,indentWithTab:O=!0,basicSetup:w=!0,root:x,initialState:S}=e,[k,C]=(0,c.useState)(),[_,T]=(0,c.useState)(),[R,E]=(0,c.useState)(),M=(0,c.useState)((()=>({current:null})))[0],P=(0,c.useState)((()=>({current:null})))[0],A=NL.theme({"&":{height:u,minHeight:d,maxHeight:f,width:p,minWidth:g,maxWidth:m},"& .cm-scroller":{height:"100% !important"}}),$=NL.updateListener.of((e=>{if(e.docChanged&&"function"==typeof r&&!e.transactions.some((e=>e.annotation(Fq)))){M.current?M.current.reset():(M.current=new jq((()=>{if(P.current){var e=P.current;P.current=null,e()}M.current=null}),200),("undefined"==typeof window?new Zq:(Xq||(Xq=new Zq),Xq)).add(M.current));var t=e.state.doc.toString();r(t,e)}i&&i((e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map((t=>e.state.sliceDoc(t.from,t.to))),selectedText:e.state.selection.ranges.some((e=>!e.empty))}))(e))})),z=[$,A,...Bq({theme:h,editable:v,readOnly:y,placeholder:b,indentWithTab:O,basicSetup:w})];return s&&"function"==typeof s&&z.push(NL.updateListener.of(s)),z=z.concat(a),(0,c.useLayoutEffect)((()=>{if(k&&!R){var e={doc:t,selection:n,extensions:z},r=S?KQ.fromJSON(S.json,e,S.fields):KQ.create(e);if(E(r),!_){var i=new NL({state:r,parent:k,root:x});T(i),o&&o(i,r)}}return()=>{_&&(E(void 0),T(void 0))}}),[k,R]),(0,c.useEffect)((()=>{e.container&&C(e.container)}),[e.container]),(0,c.useEffect)((()=>()=>{_&&(_.destroy(),T(void 0)),M.current&&(M.current.cancel(),M.current=null)}),[_]),(0,c.useEffect)((()=>{l&&_&&_.focus()}),[l,_]),(0,c.useEffect)((()=>{_&&_.dispatch({effects:HQ.reconfigure.of(z)})}),[h,a,u,d,f,p,g,m,b,v,y,O,w,r,s]),(0,c.useEffect)((()=>{if(void 0!==t){var e=_?_.state.doc.toString():"";if(_&&t!==e){var n=()=>{_&&t!==_.state.doc.toString()&&_.dispatch({changes:{from:0,to:_.state.doc.toString().length,insert:t||""},annotations:[Fq.of(!0)]})};M.current&&!M.current.isDone?P.current=n:n()}}}),[t,_]),{state:R,setState:E,view:_,setView:T,container:k,setContainer:C}}({root:C,value:r,autoFocus:d,theme:f,height:p,minHeight:g,maxHeight:m,width:b,minWidth:v,maxWidth:y,basicSetup:O,placeholder:w,indentWithTab:x,editable:S,readOnly:k,selection:i,onChange:s,onStatistics:a,onCreateEditor:h,onUpdate:u,extensions:o,initialState:_});(0,c.useImperativeHandle)(t,(()=>({editor:R.current,state:E,view:M})),[R,P,E,M]);var $=(0,c.useCallback)((e=>{R.current=e,A(e)}),[A]);if("string"!=typeof r)throw new Error("value must be typeof string but got "+typeof r);var z="string"==typeof f?"cm-theme-"+f:"cm-theme";return(0,l.jsx)("div",Rz({ref:$,className:z+(n?" "+n:"")},T))}));Uq.displayName="CodeMirror";const Gq=Uq;class Kq{constructor(e,t,n,r,i,o,s,a,l,c=0,h){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=o,this.buffer=s,this.bufferBase=a,this.curContext=l,this.lookAhead=c,this.parent=h}toString(){return`[${this.stack.filter(((e,t)=>t%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let r=e.parser.context;return new Kq(e,[],t,n,n,0,[],0,r?new Jq(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,r=65535&e,{parser:i}=this.p,o=this.reducePos=2e3&&!(null===(t=this.p.parser.nodeSet.types[r])||void 0===t?void 0:t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(r,l)}storeNode(e,t,n,r=4,i=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==e.buffer[r-4]&&e.buffer[r-1]>-1){if(t==n)return;if(e.buffer[r-2]>=t)return void(e.buffer[r-2]=n)}}if(i&&this.pos!=n){let i=this.buffer.length;if(i>0&&(0!=this.buffer[i-4]||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}else this.buffer.push(e,t,n,r)}shift(e,t,n,r){if(131072&e)this.pushState(65535&e,this.pos);else if(262144&e)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let i=e,{parser:o}=this.p;this.pos=r;let s=o.stateFlag(i,1);!s&&(r>n||t<=o.maxNode)&&(this.reducePos=r),this.pushState(i,s?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=o.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){65536&e?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),r=e.bufferBase+t;for(;e&&r==e.bufferBase;)e=e.parent;return new Kq(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new eU(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==n)return!1;if(!(65536&n))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r,i=0;i1&t&&e==r))||n.push(t[e],r)}t=n}let n=[];for(let e=0;e>19,r=65535&t,i=this.stack.length-3*n;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,(t=>{if(393216&t);else if(65536&t){let n=(t>>19)-i;if(n>1){let r=65535&t,i=this.stack.length-3*n;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(null!=e)return e}}))};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t0&&this.emitLookAhead()}}class Jq{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class eU{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=65535&e,n=e>>19;0==n?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(n-1);let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}}class tU{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new tU(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new tU(this.stack,this.pos,this.index)}}function nU(e,t=Uint16Array){if("string"!=typeof e)return e;let n=null;for(let r=0,i=0;r=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),o+=i,n)break;o*=46}n?n[i++]=o:n=new t(o)}return n}class rU{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const iU=new rU;class oU{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=iU,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;in.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t,n,r=this.chunkOff+e;if(r>=0&&r=this.chunk2Pos&&tr.to&&(this.chunk2=this.chunk2.slice(0,r.to-t)),n=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),n}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(null==n||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=iU,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}}class sU{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;cU(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}sU.prototype.contextual=sU.prototype.fallback=sU.prototype.extend=!1;class aU{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data="string"==typeof e?nU(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(cU(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(null==this.elseToken)return;if(n||r++,null==i)break;e.reset(i,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}}aU.prototype.contextual=sU.prototype.fallback=sU.prototype.extend=!1;class lU{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function cU(e,t,n,r,i,o){let s=0,a=1<0){let n=e[r];if(l.allows(n)&&(-1==t.token.value||t.token.value==n||uU(n,t.token.value,i,o))){t.acceptToken(n);break}}let r=t.next,c=0,h=e[s+2];if(!(t.next<0&&h>c&&65535==e[n+3*h-3])){for(;c>1,o=n+i+(i<<1),a=e[o],l=e[o+1]||65536;if(r=l)){s=e[o+2],t.advance();continue e}c=i+1}}break}s=e[n+3*h-1]}}function hU(e,t,n){for(let r,i=t;65535!=(r=e[i]);i++)if(r==n)return i-t;return-1}function uU(e,t,n,r){let i=hU(n,r,t);return i<0||hU(n,r,e)t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}class gU{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?pU(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?pU(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(i instanceof NV){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+i.length}}}class mU{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map((e=>new rU))}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,o=r.stateSlot(e.state,3),s=e.curContext?e.curContext.hash:0,a=0;for(let r=0;rc.end+25&&(a=Math.max(c.lookAhead,a)),0!=c.value)){let r=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!l.extend&&(n=c,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),n||e.pos!=this.stream.end||(n=new rU,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new rU,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r=0&&n.p.parser.dialect.allows(i>>1)){1&i?e.extended=i>>1:e.value=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;t4*e.bufferLength?new gU(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,n=this.stacks,r=this.minStackPos,i=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){let[e]=n;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;or)i.push(s);else{if(this.advanceStack(s,i,n))continue;{e||(e=[],t=[]),e.push(s);let n=this.tokens.getMainToken(s);t.push(n.value,n.end)}}break}}if(!i.length){let t=e&&function(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||null!=e&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.scorethis.stoppedAt?e[0]:this.runRecovery(e,t,i);if(n)return dU&&console.log("Force-finish "+this.stackID(n)),this.stackToTree(n.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(i.length>e)for(i.sort(((e,t)=>t.score-e.score));i.length>e;)i.pop();i.some((e=>e.reducePos>r))&&this.recovering--}else if(i.length>1){e:for(let e=0;e500&&r.buffer.length>500){if(!((t.score-r.score||t.buffer.length-r.buffer.length)>0)){i.splice(e--,1);continue e}i.splice(n--,1)}}}i.length>12&&(i.sort(((e,t)=>t.score-e.score)),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let e=1;e ":"";if(null!=this.stoppedAt&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let s=this.fragments.nodeAt(r);s;){let r=this.parser.nodeSet.types[s.type.id]==s.type?i.getGoto(e.state,s.type.id):-1;if(r>-1&&s.length&&(!t||(s.prop(EV.contextHash)||0)==n))return e.useNode(s,r),dU&&console.log(o+this.stackID(e)+` (via reuse of ${i.getName(s.type.id)})`),!0;if(!(s instanceof NV)||0==s.children.length||s.positions[0]>0)break;let a=s.children[0];if(!(a instanceof NV&&0==s.positions[0]))break;s=a}}let s=i.stateSlot(e.state,4);if(s>0)return e.reduce(s),dU&&console.log(o+this.stackID(e)+` (via always-reduce ${i.getName(65535&s)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let s=0;sr?t.push(d):n.push(d)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return vU(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let o=0;o ":"";if(s.deadEnd){if(i)continue;if(i=!0,s.restart(),dU&&console.log(c+this.stackID(s)+" (restarted)"),this.advanceFully(s,n))continue}let h=s.split(),u=c;for(let e=0;e<10&&h.forceReduce()&&(dU&&console.log(u+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,n));e++)dU&&(u=this.stackID(h)+" -> ");for(let e of s.recoverByInsert(a))dU&&console.log(c+this.stackID(e)+" (via recover-insert)"),this.advanceFully(e,n);this.stream.end>s.pos?(l==s.pos&&(l++,a=0),s.recoverByDelete(a,l),dU&&console.log(c+this.stackID(s)+` (via recover-delete ${this.parser.getName(a)})`),vU(s,n)):(!r||r.scoree;class wU extends rB{constructor(e){if(super(),this.wrappers=[],14!=e.version)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let n=0;ne.topRules[t][1])),r=[];for(let e=0;e=0)i(r,e,t[n++]);else{let o=t[n+-r];for(let s=-r;s>0;s--)i(t[n++],e,o);n++}}}this.nodeSet=new $V(t.map(((t,i)=>AV.define({name:i>=this.minRepeatTerm?void 0:t,id:i,props:r[i],top:n.indexOf(i)>-1,error:0==i,skipped:e.skippedNodes&&e.skippedNodes.indexOf(i)>-1})))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=_V;let o=nU(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e"number"==typeof e?new sU(o,e):e)),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new bU(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let i=r[t+1];;){let t=r[i++],o=1&t,s=r[i++];if(o&&n)return s;for(let n=i+(t>>1);i0}validAction(e,t){return!!this.allActions(e,(e=>e==t||null))}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);null==r;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=xU(this.data,n+2)}r=t(xU(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=xU(this.data,n+2)}if(!(1&this.data[n+2])){let e=this.data[n+1];t.some(((t,n)=>1&n&&t==e))||t.push(this.data[n],e)}}return t}configure(e){let t=Object.assign(Object.create(wU.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map((t=>{let n=e.tokenizers.find((e=>e.from==t));return n?n.to:t}))),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map(((n,r)=>{let i=e.specializers.find((e=>e.from==n.external));if(!i)return n;let o=Object.assign(Object.assign({},n),{external:i.to});return t.specializers[r]=SU(o),o}))),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),null!=e.bufferLength&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map((()=>!1));if(e)for(let r of e.split(" ")){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;ee.external(n,r)<<1|t}return e.get}const kU=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],CU=new class{constructor(e){this.start=e.start,this.shift=e.shift||OU,this.reduce=e.reduce||OU,this.reuse=e.reuse||OU,this.hash=e.hash||(()=>0),this.strict=!1!==e.strict}}({start:!1,shift:(e,t)=>5==t||6==t||320==t?e:321==t,strict:!1}),_U=new lU(((e,t)=>{let{next:n}=e;(125==n||-1==n||t.context)&&e.acceptToken(318)}),{contextual:!0,fallback:!0}),TU=new lU(((e,t)=>{let n,{next:r}=e;kU.indexOf(r)>-1||(47!=r||47!=(n=e.peek(1))&&42!=n)&&(125==r||59==r||-1==r||t.context||e.acceptToken(316))}),{contextual:!0}),RU=new lU(((e,t)=>{91!=e.next||t.context||e.acceptToken(317)}),{contextual:!0}),EU=new lU(((e,t)=>{let{next:n}=e;if(43==n||45==n){if(e.advance(),n==e.next){e.advance();let n=!t.context&&t.canShift(1);e.acceptToken(n?1:2)}}else 63==n&&46==e.peek(1)&&(e.advance(),e.advance(),(e.next<48||e.next>57)&&e.acceptToken(3))}),{contextual:!0});function MU(e,t){return e>=65&&e<=90||e>=97&&e<=122||95==e||e>=192||!t&&e>=48&&e<=57}const PU=new lU(((e,t)=>{if(60!=e.next||!t.dialectEnabled(0))return;if(e.advance(),47==e.next)return;let n=0;for(;kU.indexOf(e.next)>-1;)e.advance(),n++;if(MU(e.next,!0)){for(e.advance(),n++;MU(e.next,!1);)e.advance(),n++;for(;kU.indexOf(e.next)>-1;)e.advance(),n++;if(44==e.next)return;for(let t=0;;t++){if(7==t){if(!MU(e.next,!0))return;break}if(e.next!="extends".charCodeAt(t))break;e.advance(),n++}}e.acceptToken(4,-n)})),AU=cB({"get set async static":MB.modifier,"for while do if else switch try catch finally return throw break continue default case defer":MB.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":MB.operatorKeyword,"let var const using function class extends":MB.definitionKeyword,"import export from":MB.moduleKeyword,"with debugger new":MB.keyword,TemplateString:MB.special(MB.string),super:MB.atom,BooleanLiteral:MB.bool,this:MB.self,null:MB.null,Star:MB.modifier,VariableName:MB.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":MB.function(MB.variableName),VariableDefinition:MB.definition(MB.variableName),Label:MB.labelName,PropertyName:MB.propertyName,PrivatePropertyName:MB.special(MB.propertyName),"CallExpression/MemberExpression/PropertyName":MB.function(MB.propertyName),"FunctionDeclaration/VariableDefinition":MB.function(MB.definition(MB.variableName)),"ClassDeclaration/VariableDefinition":MB.definition(MB.className),"NewExpression/VariableName":MB.className,PropertyDefinition:MB.definition(MB.propertyName),PrivatePropertyDefinition:MB.definition(MB.special(MB.propertyName)),UpdateOp:MB.updateOperator,"LineComment Hashbang":MB.lineComment,BlockComment:MB.blockComment,Number:MB.number,String:MB.string,Escape:MB.escape,ArithOp:MB.arithmeticOperator,LogicOp:MB.logicOperator,BitOp:MB.bitwiseOperator,CompareOp:MB.compareOperator,RegExp:MB.regexp,Equals:MB.definitionOperator,Arrow:MB.function(MB.punctuation),": Spread":MB.punctuation,"( )":MB.paren,"[ ]":MB.squareBracket,"{ }":MB.brace,"InterpolationStart InterpolationEnd":MB.special(MB.brace),".":MB.derefOperator,", ;":MB.separator,"@":MB.meta,TypeName:MB.typeName,TypeDefinition:MB.definition(MB.typeName),"type enum interface implements namespace module declare":MB.definitionKeyword,"abstract global Privacy readonly override":MB.modifier,"is keyof unique infer asserts":MB.operatorKeyword,JSXAttributeValue:MB.attributeValue,JSXText:MB.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":MB.angleBracket,"JSXIdentifier JSXNameSpacedName":MB.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":MB.attributeName,"JSXBuiltin/JSXIdentifier":MB.standard(MB.tagName)}),$U={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},zU={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},QU={__proto__:null,"<":193},IU=wU.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Il'#IlO1XQ`O'#GsO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JrO6[Q!0MxO'#JsO6uQ`O'#F]O6zQ,UO'#FtOOQ!0Lf'#Ff'#FfO7VO7dO'#FfO9XQMhO'#F|O9`Q`O'#F{OOQ!0Lf'#Js'#JsOOQ!0Lb'#Jr'#JrO9eQ`O'#GwOOQ['#K_'#K_O9pQ`O'#IYO9uQ!0LrO'#IZOOQ['#J`'#J`OOQ['#I_'#I_Q`QlOOQ`QlOOO9}Q!L^O'#DvO:UQlO'#EOO:]QlO'#EQO9kQ`O'#GsO:dQMhO'#CoO:rQ`O'#EnO:}Q`O'#EyO;hQMhO'#FeO;xQ`O'#GsOOQO'#K`'#K`O;}Q`O'#K`O<]Q`O'#G{O<]Q`O'#G|O<]Q`O'#HOO9kQ`O'#HRO=SQ`O'#HUO>kQ`O'#CeO>{Q`O'#HcO?TQ`O'#HiO?TQ`O'#HkO`QlO'#HmO?TQ`O'#HoO?TQ`O'#HrO?YQ`O'#HxO?_Q!0LsO'#IOO%[QlO'#IQO?jQ!0LsO'#ISO?uQ!0LsO'#IUO9uQ!0LrO'#IWO@QQ!0MxO'#CiOASQpO'#DlQOQ`OOO%[QlO'#EQOAjQ`O'#ETO:dQMhO'#EnOAuQ`O'#EnOBQQ!bO'#FeOOQ['#Cg'#CgOOQ!0Lb'#Dq'#DqOOQ!0Lb'#Jv'#JvO%[QlO'#JvOOQO'#Jy'#JyOOQO'#Ih'#IhOCQQpO'#EgOOQ!0Lb'#Ef'#EfOOQ!0Lb'#J}'#J}OC|Q!0MSO'#EgODWQpO'#EWOOQO'#Jx'#JxODlQpO'#JyOEyQpO'#EWODWQpO'#EgPFWO&2DjO'#CbPOOO)CD})CD}OOOO'#I`'#I`OFcO#tO,59UOOQ!0Lh,59U,59UOOOO'#Ia'#IaOFqO&jO,59UOGPQ!L^O'#DcOOOO'#Ic'#IcOGWO#@ItO,59{OOQ!0Lf,59{,59{OGfQlO'#IdOGyQ`O'#JtOIxQ!fO'#JtO+}QlO'#JtOJPQ`O,5:ROJgQ`O'#EpOJtQ`O'#KTOKPQ`O'#KSOKPQ`O'#KSOKXQ`O,5;^OK^Q`O'#KROOQ!0Ln,5:^,5:^OKeQlO,5:^OMcQ!0MxO,5:fONSQ`O,5:nONmQ!0LrO'#KQONtQ`O'#KPO9eQ`O'#KPO! YQ`O'#KPO! bQ`O,5;]O! gQ`O'#KPO!#lQ!fO'#JsOOQ!0Lh'#Ci'#CiO%[QlO'#ESO!$[Q!fO,5:sOOQS'#Jz'#JzOOQO-EtOOQ['#Jh'#JhOOQ[,5>u,5>uOOQ[-E<]-E<]O!TO`QlO,5>VO!LOQ`O,5>XO`QlO,5>ZO!LTQ`O,5>^O!LYQlO,5>dOOQ[,5>j,5>jO%[QlO,5>jO9uQ!0LrO,5>lOOQ[,5>n,5>nO#!dQ`O,5>nOOQ[,5>p,5>pO#!dQ`O,5>pOOQ[,5>r,5>rO##QQpO'#D_O%[QlO'#JvO##sQpO'#JvO##}QpO'#DmO#$`QpO'#DmO#&qQlO'#DmO#&xQ`O'#JuO#'QQ`O,5:WO#'VQ`O'#EtO#'eQ`O'#KUO#'mQ`O,5;_O#'rQpO'#DmO#(PQpO'#EVOOQ!0Lf,5:o,5:oO%[QlO,5:oO#(WQ`O,5:oO?YQ`O,5;YO!CUQpO,5;YO!C^QMhO,5;YO:dQMhO,5;YO#(`Q`O,5@bO#(eQ07dO,5:sOOQO-EPO$6^Q`O,5>POOQ[1G3i1G3iO`QlO1G3iOOQ[1G3o1G3oOOQ[1G3q1G3qO?TQ`O1G3sO$6cQlO1G3uO$:gQlO'#HtOOQ[1G3x1G3xO$:tQ`O'#HzO?YQ`O'#H|OOQ[1G4O1G4OO$:|QlO1G4OO9uQ!0LrO1G4UOOQ[1G4W1G4WOOQ!0Lb'#G_'#G_O9uQ!0LrO1G4YO9uQ!0LrO1G4[O$?TQ`O,5@bO!)[QlO,5;`O9eQ`O,5;`O?YQ`O,5:XO!)[QlO,5:XO!CUQpO,5:XO$?YQ?MtO,5:XOOQO,5;`,5;`O$?dQpO'#IeO$?zQ`O,5@aOOQ!0Lf1G/r1G/rO$@SQpO'#IkO$@^Q`O,5@pOOQ!0Lb1G0y1G0yO#$`QpO,5:XOOQO'#Ig'#IgO$@fQpO,5:qOOQ!0Ln,5:q,5:qO#(ZQ`O1G0ZOOQ!0Lf1G0Z1G0ZO%[QlO1G0ZOOQ!0Lf1G0t1G0tO?YQ`O1G0tO!CUQpO1G0tO!C^QMhO1G0tOOQ!0Lb1G5|1G5|O!ByQ!0LrO1G0^OOQO1G0m1G0mO%[QlO1G0mO$@mQ!0LrO1G0mO$@xQ!0LrO1G0mO!CUQpO1G0^ODWQpO1G0^O$AWQ!0LrO1G0mOOQO1G0^1G0^O$AlQ!0MxO1G0mPOOO-E<[-E<[POOO1G.h1G.hOOOO1G/i1G/iO$AvQ!bO,5QQpO,5@}OOQ!0Lb1G3c1G3cOOQ[7+$V7+$VO@zQ`O7+$VO9uQ!0LrO7+$VO%>]Q`O7+$VO%[QlO1G6lO%[QlO1G6mO%>bQ!0LrO1G6lO%>lQlO1G3kO%>sQ`O1G3kO%>xQlO1G3kOOQ[7+)T7+)TO9uQ!0LrO7+)_O`QlO7+)aOOQ['#Kh'#KhOOQ['#JS'#JSO%?PQlO,5>`OOQ[,5>`,5>`O%[QlO'#HuO%?^Q`O'#HwOOQ[,5>f,5>fO9eQ`O,5>fOOQ[,5>h,5>hOOQ[7+)j7+)jOOQ[7+)p7+)pOOQ[7+)t7+)tOOQ[7+)v7+)vO%?cQpO1G5|O%?}Q?MtO1G0zO%@XQ`O1G0zOOQO1G/s1G/sO%@dQ?MtO1G/sO?YQ`O1G/sO!)[QlO'#DmOOQO,5?P,5?POOQO-ERQ`O7+,WO&>WQ`O7+,XO%[QlO7+,WO%[QlO7+,XOOQ[7+)V7+)VO&>]Q`O7+)VO&>bQlO7+)VO&>iQ`O7+)VOOQ[<nQ`O,5>aOOQ[,5>c,5>cO&>sQ`O1G4QO9eQ`O7+&fO!)[QlO7+&fOOQO7+%_7+%_O&>xQ?MtO1G6ZO?YQ`O7+%_OOQ!0Lf<yQ?MvO,5?aO'@|Q?MvO,5?cO'CPQ?MvO7+'|O'DuQMjOG27TOOQO<VO!l$xO#jROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]$_Oa$qa'z$qa'w$qa!k$qa!Y$qa!_$qa%i$qa!g$qa~Ol)dO~P!&zOh%VOp%WOr%XOs$tOt$tOz%YO|%ZO!O%]O!S${O!_$|O!i%bO!l$xO#j%cO$W%`O$t%^O$v%_O$y%aO(T(vO(VTO(YUO(a$uO(y$}O(z%PO~Og(pP~P!,TO!Q)iO!g)hO!_$^X$Z$^X$]$^X$_$^X$f$^X~O!g)hO!_({X$Z({X$]({X$_({X$f({X~O!Q)iO~P!.^O!Q)iO!_({X$Z({X$]({X$_({X$f({X~O!_)kO$Z)oO$])jO$_)jO$f)pO~O![)sO~P!)[O$]$hO$_$gO$f)wO~On$zX!Q$zX#S$zX'y$zX(y$zX(z$zX~OgmXg$zXnmX!]mX#`mX~P!0SOx)yO(b)zO(c)|O~On*VO!Q*OO'y*PO(y$}O(z%PO~Og)}O~P!1WOg*WO~Oh%VOr%XOs$tOt$tOz%YO|%ZO!OVO!l$xO#jVO!l$xO#jROe!iOpkOrPO(VTO(YUO(aVO(o[O~O(T=QO~P#$qO!]-]O!^(iX~O!^-_O~O!g-VO#`-UO!]#hX!^#hX~O!]-`O!^(xX~O!^-bO~O!c-cO!d-cO(U!lO~P#$`O!^-fO~P'_On-iO!_'`O~O!Y-nO~Os!{a!b!{a!c!{a!d!{a#T!{a#U!{a#V!{a#W!{a#X!{a#[!{a#]!{a(U!{a(V!{a(Y!{a(e!{a(o!{a~P!#vO!p-sO#`-qO~PChO!c-uO!d-uO(U!lO~PDWOa%nO#`-qO'z%nO~Oa%nO!g#vO#`-qO'z%nO~Oa%nO!g#vO!p-sO#`-qO'z%nO(r'pO~O(P'xO(Q'xO(R-zO~Ov-{O~O!Y'Wa!]'Wa~P!:tO![.PO!Y'WX!]'WX~P%[O!](VO!Y(ha~O!Y(ha~PHRO!](^O!Y(va~O!S%hO![.TO!_%iO(T%gO!Y'^X!]'^X~O#`.VO!](ta!k(taa(ta'z(ta~O!g#vO~P#,wO!](jO!k(sa~O!S%hO!_%iO#j.ZO(T%gO~Op.`O!S%hO![.]O!_%iO!|]O#i._O#j.]O(T%gO!]'aX!k'aX~OR.dO!l#xO~Oh%VOn.gO!_'`O%i.fO~Oa#ci!]#ci'z#ci'w#ci!Y#ci!k#civ#ci!_#ci%i#ci!g#ci~P!:tOn>]O!Q*OO'y*PO(y$}O(z%PO~O#k#_aa#_a#`#_a'z#_a!]#_a!k#_a!_#_a!Y#_a~P#/sO#k(`XP(`XR(`X[(`Xa(`Xj(`Xr(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X'z(`X(a(`X(r(`X!k(`X!Y(`X'w(`Xv(`X!_(`X%i(`X!g(`X~P!6kO!].tO!k(kX~P!:tO!k.wO~O!Y.yO~OP$[OR#zO!Q#yO!S#{O!l#xO!p$[O(aVO[#mia#mij#mir#mi!]#mi#R#mi#o#mi#p#mi#q#mi#r#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#n#mi~P#3cO#n$OO~P#3cOP$[OR#zOr$aO!Q#yO!S#{O!l#xO!p$[O#n$OO#o$PO#p$PO#q$PO(aVO[#mia#mij#mi!]#mi#R#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#r#mi~P#6QO#r$QO~P#6QOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO(aVOa#mi!]#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#v#mi~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO(aVO(z#}Oa#mi!]#mi#z#mi#{#mi'z#mi(r#mi(y#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#x$UO~P#;VO#x#mi~P#;VO#v$SO~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO#x$UO(aVO(y#|O(z#}Oa#mi!]#mi#{#mi'z#mi(r#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#z#mi~P#={O#z$WO~P#={OP]XR]X[]Xj]Xr]X!Q]X!S]X!l]X!p]X#R]X#S]X#`]X#kfX#n]X#o]X#p]X#q]X#r]X#s]X#t]X#u]X#v]X#x]X#z]X#{]X$Q]X(a]X(r]X(y]X(z]X!]]X!^]X~O$O]X~P#@jOP$[OR#zO[]O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P#EyO!]/POg(pX~P!1WOg/RO~Oa$Pi!]$Pi'z$Pi'w$Pi!Y$Pi!k$Piv$Pi!_$Pi%i$Pi!g$Pi~P!:tO$]/SO$_/SO~O$]/TO$_/TO~O!g)hO#`/UO!_$cX$Z$cX$]$cX$_$cX$f$cX~O![/VO~O!_)kO$Z/XO$])jO$_)jO$f/YO~O!]VO!l$xO#j^O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P&,QO#S$dOP(`XR(`X[(`Xj(`Xn(`Xr(`X!Q(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X$O(`X'y(`X(a(`X(r(`X(y(`X(z(`X!](`X!^(`X~O$O$Pi!]$Pi!^$Pi~P#BwO$O!ri!^!ri~P$+oOg']a!]']a~P!1WO!^7nO~O!]'da!^'da~P#BwO!Y7oO~P#/sO!g#vO(r'pO!]'ea!k'ea~O!]/pO!k)Oi~O!]/pO!g#vO!k)Oi~Og$|q!]$|q#`$|q$O$|q~P!1WO!Y'ga!]'ga~P#/sO!g7vO~O!]/yO!Y)Pi~P#/sO!]/yO!Y)Pi~O!Y7yO~Oh%VOr8OO!l%eO(r'pO~Oj8QO!g#vO~Or8TO!g#vO(r'pO~O!Q*OO'y*PO(z%POn'ja(y'ja!]'ja#`'ja~Og'ja$O'ja~P&5RO!Q*OO'y*POn'la(y'la(z'la!]'la#`'la~Og'la$O'la~P&5tOg(_q!](_q~P!1WO#`8VOg(_q!](_q~P!1WO!Y8WO~Og%Oq!]%Oq#`%Oq$O%Oq~P!1WOa$oy!]$oy'z$oy'w$oy!Y$oy!k$oyv$oy!_$oy%i$oy!g$oy~P!:tO!g6rO~O!]5[O!_)Qa~O!_'`OP$TaR$Ta[$Taj$Tar$Ta!Q$Ta!S$Ta!]$Ta!l$Ta!p$Ta#R$Ta#n$Ta#o$Ta#p$Ta#q$Ta#r$Ta#s$Ta#t$Ta#u$Ta#v$Ta#x$Ta#z$Ta#{$Ta(a$Ta(r$Ta(y$Ta(z$Ta~O%i7WO~P&8fO%^8[Oa%[i!_%[i'z%[i!]%[i~Oa#cy!]#cy'z#cy'w#cy!Y#cy!k#cyv#cy!_#cy%i#cy!g#cy~P!:tO[8^O~Ob8`O(T+qO(VTO(YUO~O!]1TO!^)Xi~O`8dO~O(e(|O!]'pX!^'pX~O!]5uO!^)Ua~O!^8nO~P%;eO(o!sO~P$&YO#[8oO~O!_1oO~O!_1oO%i8qO~On8tO!_1oO%i8qO~O[8yO!]'sa!^'sa~O!]1zO!^)Vi~O!k8}O~O!k9OO~O!k9RO~O!k9RO~P%[Oa9TO~O!g9UO~O!k9VO~O!](wi!^(wi~P#BwOa%nO#`9_O'z%nO~O!](ty!k(tya(ty'z(ty~P!:tO!](jO!k(sy~O%i9bO~P&8fO!_'`O%i9bO~O#k$|qP$|qR$|q[$|qa$|qj$|qr$|q!S$|q!]$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q'z$|q(a$|q(r$|q!k$|q!Y$|q'w$|q#`$|qv$|q!_$|q%i$|q!g$|q~P#/sO#k'jaP'jaR'ja['jaa'jaj'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja'z'ja(a'ja(r'ja!k'ja!Y'ja'w'jav'ja!_'ja%i'ja!g'ja~P&5RO#k'laP'laR'la['laa'laj'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la'z'la(a'la(r'la!k'la!Y'la'w'lav'la!_'la%i'la!g'la~P&5tO#k%OqP%OqR%Oq[%Oqa%Oqj%Oqr%Oq!S%Oq!]%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq'z%Oq(a%Oq(r%Oq!k%Oq!Y%Oq'w%Oq#`%Oqv%Oq!_%Oq%i%Oq!g%Oq~P#/sO!]'Yi!k'Yi~P!:tO$O#cq!]#cq!^#cq~P#BwO(y$}OP%aaR%aa[%aaj%aar%aa!S%aa!l%aa!p%aa#R%aa#n%aa#o%aa#p%aa#q%aa#r%aa#s%aa#t%aa#u%aa#v%aa#x%aa#z%aa#{%aa$O%aa(a%aa(r%aa!]%aa!^%aa~On%aa!Q%aa'y%aa(z%aa~P&IyO(z%POP%caR%ca[%caj%car%ca!S%ca!l%ca!p%ca#R%ca#n%ca#o%ca#p%ca#q%ca#r%ca#s%ca#t%ca#u%ca#v%ca#x%ca#z%ca#{%ca$O%ca(a%ca(r%ca!]%ca!^%ca~On%ca!Q%ca'y%ca(y%ca~P&LQOn>^O!Q*OO'y*PO(z%PO~P&IyOn>^O!Q*OO'y*PO(y$}O~P&LQOR0kO!Q0kO!S0lO#S$dOP}a[}aj}an}ar}a!l}a!p}a#R}a#n}a#o}a#p}a#q}a#r}a#s}a#t}a#u}a#v}a#x}a#z}a#{}a$O}a'y}a(a}a(r}a(y}a(z}a!]}a!^}a~O!Q*OO'y*POP$saR$sa[$saj$san$sar$sa!S$sa!l$sa!p$sa#R$sa#n$sa#o$sa#p$sa#q$sa#r$sa#s$sa#t$sa#u$sa#v$sa#x$sa#z$sa#{$sa$O$sa(a$sa(r$sa(y$sa(z$sa!]$sa!^$sa~O!Q*OO'y*POP$uaR$ua[$uaj$uan$uar$ua!S$ua!l$ua!p$ua#R$ua#n$ua#o$ua#p$ua#q$ua#r$ua#s$ua#t$ua#u$ua#v$ua#x$ua#z$ua#{$ua$O$ua(a$ua(r$ua(y$ua(z$ua!]$ua!^$ua~On>^O!Q*OO'y*PO(y$}O(z%PO~OP%TaR%Ta[%Taj%Tar%Ta!S%Ta!l%Ta!p%Ta#R%Ta#n%Ta#o%Ta#p%Ta#q%Ta#r%Ta#s%Ta#t%Ta#u%Ta#v%Ta#x%Ta#z%Ta#{%Ta$O%Ta(a%Ta(r%Ta!]%Ta!^%Ta~P''VO$O$mq!]$mq!^$mq~P#BwO$O$oq!]$oq!^$oq~P#BwO!^9oO~O$O9pO~P!1WO!g#vO!]'ei!k'ei~O!g#vO(r'pO!]'ei!k'ei~O!]/pO!k)Oq~O!Y'gi!]'gi~P#/sO!]/yO!Y)Pq~Or9wO!g#vO(r'pO~O[9yO!Y9xO~P#/sO!Y9xO~Oj:PO!g#vO~Og(_y!](_y~P!1WO!]'na!_'na~P#/sOa%[q!_%[q'z%[q!]%[q~P#/sO[:UO~O!]1TO!^)Xq~O`:YO~O#`:ZO!]'pa!^'pa~O!]5uO!^)Ui~P#BwO!S:]O~O!_1oO%i:`O~O(VTO(YUO(e:eO~O!]1zO!^)Vq~O!k:hO~O!k:iO~O!k:jO~O!k:jO~P%[O#`:mO!]#hy!^#hy~O!]#hy!^#hy~P#BwO%i:rO~P&8fO!_'`O%i:rO~O$O#|y!]#|y!^#|y~P#BwOP$|iR$|i[$|ij$|ir$|i!S$|i!l$|i!p$|i#R$|i#n$|i#o$|i#p$|i#q$|i#r$|i#s$|i#t$|i#u$|i#v$|i#x$|i#z$|i#{$|i$O$|i(a$|i(r$|i!]$|i!^$|i~P''VO!Q*OO'y*PO(z%POP'iaR'ia['iaj'ian'iar'ia!S'ia!l'ia!p'ia#R'ia#n'ia#o'ia#p'ia#q'ia#r'ia#s'ia#t'ia#u'ia#v'ia#x'ia#z'ia#{'ia$O'ia(a'ia(r'ia(y'ia!]'ia!^'ia~O!Q*OO'y*POP'kaR'ka['kaj'kan'kar'ka!S'ka!l'ka!p'ka#R'ka#n'ka#o'ka#p'ka#q'ka#r'ka#s'ka#t'ka#u'ka#v'ka#x'ka#z'ka#{'ka$O'ka(a'ka(r'ka(y'ka(z'ka!]'ka!^'ka~O(y$}OP%aiR%ai[%aij%ain%air%ai!Q%ai!S%ai!l%ai!p%ai#R%ai#n%ai#o%ai#p%ai#q%ai#r%ai#s%ai#t%ai#u%ai#v%ai#x%ai#z%ai#{%ai$O%ai'y%ai(a%ai(r%ai(z%ai!]%ai!^%ai~O(z%POP%ciR%ci[%cij%cin%cir%ci!Q%ci!S%ci!l%ci!p%ci#R%ci#n%ci#o%ci#p%ci#q%ci#r%ci#s%ci#t%ci#u%ci#v%ci#x%ci#z%ci#{%ci$O%ci'y%ci(a%ci(r%ci(y%ci!]%ci!^%ci~O$O$oy!]$oy!^$oy~P#BwO$O#cy!]#cy!^#cy~P#BwO!g#vO!]'eq!k'eq~O!]/pO!k)Oy~O!Y'gq!]'gq~P#/sOr:|O!g#vO(r'pO~O[;QO!Y;PO~P#/sO!Y;PO~Og(_!R!](_!R~P!1WOa%[y!_%[y'z%[y!]%[y~P#/sO!]1TO!^)Xy~O!]5uO!^)Uq~O(T;XO~O!_1oO%i;[O~O!k;_O~O%i;dO~P&8fOP$|qR$|q[$|qj$|qr$|q!S$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q$O$|q(a$|q(r$|q!]$|q!^$|q~P''VO!Q*OO'y*PO(z%POP'jaR'ja['jaj'jan'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja$O'ja(a'ja(r'ja(y'ja!]'ja!^'ja~O!Q*OO'y*POP'laR'la['laj'lan'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la$O'la(a'la(r'la(y'la(z'la!]'la!^'la~OP%OqR%Oq[%Oqj%Oqr%Oq!S%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq$O%Oq(a%Oq(r%Oq!]%Oq!^%Oq~P''VOg%e!Z!]%e!Z#`%e!Z$O%e!Z~P!1WO!Y;hO~P#/sOr;iO!g#vO(r'pO~O[;kO!Y;hO~P#/sO!]'pq!^'pq~P#BwO!]#h!Z!^#h!Z~P#BwO#k%e!ZP%e!ZR%e!Z[%e!Za%e!Zj%e!Zr%e!Z!S%e!Z!]%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z'z%e!Z(a%e!Z(r%e!Z!k%e!Z!Y%e!Z'w%e!Z#`%e!Zv%e!Z!_%e!Z%i%e!Z!g%e!Z~P#/sOr;tO!g#vO(r'pO~O!Y;uO~P#/sOr;|O!g#vO(r'pO~O!Y;}O~P#/sOP%e!ZR%e!Z[%e!Zj%e!Zr%e!Z!S%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z$O%e!Z(a%e!Z(r%e!Z!]%e!Z!^%e!Z~P''VOrROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]WO!l$xO#jgPPP!>oI[PPPPPPPPP!BOP!C]PPI[!DnPI[PI[I[I[I[I[PI[!FQP!I[P!LbP!Lf!Lp!Lt!LtP!IXP!Lx!LxP#!OP#!SI[PI[#!Y#%_CjA^PA^PA^A^P#&lA^A^#)OA^#+vA^#.SA^A^#.r#1W#1W#1]#1f#1W#1qPP#1WPA^#2ZA^#6YA^A^6mPPP#:_PPP#:x#:xP#:xP#;`#:xPP#;fP#;]P#;]#;y#;]#P#>V#>]#>k#>q#>{#?R#?]#?c#?s#?y#@k#@}#AT#AZ#Ai#BO#Cs#DR#DY#Et#FS#Gt#HS#HY#H`#Hf#Hp#Hv#H|#IW#Ij#IpPPPPPPPPPPP#IvPPPPPPP#Jk#Mx$ b$ i$ qPPP$']P$'f$*_$0x$0{$1O$1}$2Q$2X$2aP$2g$2jP$3W$3[$4S$5b$5g$5}PP$6S$6Y$6^$6a$6e$6i$7e$7|$8e$8i$8l$8o$8y$8|$9Q$9UR!|RoqOXst!Z#d%m&r&t&u&w,s,x2[2_Y!vQ'`-e1o5{Q%tvQ%|yQ&T|Q&j!VS'W!e-]Q'f!iS'l!r!yU*k$|*Z*oQ+o%}S+|&V&WQ,d&dQ-c'_Q-m'gQ-u'mQ0[*qQ1b,OQ1y,eR<{SU+P%]S!S!nQ!r!v!y!z$|'W'_'`'l'm'n*k*o*q*r-]-c-e-u0[0_1o5{5}%[$ti#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^Q&X|Q'U!eS'[%i-`Q+t&PQ,P&WQ,f&gQ0n+SQ1Y+uQ1_+{Q2Q,jQ2R,kQ5f1TQ5o1aQ6[1zQ6_1|Q6`2PQ8`5gQ8c5lQ8|6bQ:X8dQ:f8yQ;V:YR<}*ZrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R,h&k&z^OPXYstuvwz!Z!`!g!j!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'b'r(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mR>S[#]WZ#W#Z'X(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ%wxQ%{yW&Q|&V&W,OQ&_!TQ'c!hQ'e!iQ(q#sS+n%|%}Q+r&PQ,_&bQ,c&dS-l'f'gQ.i(rQ1R+oQ1X+uQ1Z+vQ1^+zQ1t,`S1x,d,eQ2|-mQ5e1TQ5i1WQ5n1`Q6Z1yQ8_5gQ8b5kQ8f5pQ:T8^R;T:U!U$zi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y!^%yy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{Q+h%wQ,T&[Q,W&]Q,b&dQ.h(qQ1s,_U1w,c,d,eQ3e.iQ6U1tS6Y1x1yQ8x6Z#f>T#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o>UPS&[!Q&iQ&]!RQ&^!SU*}%[%d=sR,R&Y%]%Si#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^T)z$u){V+P%]S$i$^c#Y#e%q%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.|.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SQ'Y!eR2q-]!W!nQ!e!r!v!y!z$|'W'_'`'l'm'n*Z*k*o*q*r-]-c-e-u0[0_1o5{5}R1l,ZnqOXst!Z#d%m&r&t&u&w,s,x2[2_Q&y!^Q'v!xS(s#u<^Q+l%zQ,]&_Q,^&aQ-j'dQ-w'oS.r(x=PS0q+X=ZQ1P+mQ1n,[Q2c,zQ2e,{Q2m-WQ2z-kQ2}-oS5Y0r=eQ5a1QS5d1S=fQ6t2oQ6x2{Q6}3SQ8]5bQ9Y6vQ9Z6yQ9^7OR:l9V$d$]c#Y#e%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SS#q]SU$fd)_,mS(p#p'iU*v%R(w4OU0m+O.n7gQ5^0xQ7V3`Q9d7YR:s9em!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}Q't!uS(f#g2US-s'k'wQ/s*]Q0R*jQ3U-vQ4f/tQ4r0TQ4s0UQ4x0^Q7r4`S7}4t4vS8R4y4{Q9r7sQ9v7yQ9{8OQ:Q8TS:{9w9xS;g:|;PS;s;h;iS;{;t;uSSR=o>R%^bOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Q%fj!^%xy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{S&Oz!jQ+k%yQ,a&dW1v,b,c,d,eU6X1w1x1yS8w6Y6ZQ:d8x!r=j$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ=t>QR=u>R%QeOPXYstuvw!Z!`!g!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Y#bWZ#W#Z(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ,n&o!p=k$Z$n)s-U-X/V2p4T5w6s:Z:mSR=n'XU']!e%i*ZR2s-`%SdOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+],p,s,x-i-q.P.V.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3l4z6T6e6f6i6|8t9T9_!r)_$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ,m&oQ0x+gQ3`.gQ7Y3dR9e7[!b$Tc#Y%q(S(Y(t(y)Z)[)`)g+x-x-}.S.U.s.v/b0p3O3V3k3{5X5c6{7Q7a9]:oS)^)q-Z.|2k2n3p4P4X6u7b7k7l8k9X9g9m9n;W;`=vQ>X>ZR>Y>['QkOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mSS$oh$pR4U/U'XgOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$kf$qQ$ifS)j$l)nR)v$qT$jf$qT)l$l)n'XhOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$oh$pQ$rhR)u$p%^jOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_!s>Q$Z$n'X)s-U-X/V2p4T5w6s:Z:mS#glOPXZst!Z!`!o#S#d#o#{$n%m&k&n&o&r&t&u&w&{'T'b)O)s*i+]+g,p,s,x-i.g/V/n0]0l1r2S2T2V2X2[2_2a3d4T4z6T6e6f6i7[8t9T!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^Q+T%aQ/c*Oo4OP>X>YQ*c$zU*l$|*Z*oQ+U%bQ0W*m#f=q#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^n=rTQ=x>UQ=y>VR=z>W!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o4OP>X>Y>]>^Q,U&]Q1h,WQ5s1gR8h5tV*n$|*Z*oU*n$|*Z*oT5z1o5{S0P*i/nQ4w0]T8S4z:]Q+j%xQ0V*lQ1O+kQ1u,aQ6W1vQ8v6XQ:c8wR;^:d!U%Oi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Yx*R$v)e*S*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>OS0`*t0a#f]>^nZ>[`=T3}7c7f7j9h:t:w;yS=_.l3iT=`7e9k!U%Qi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y|*T$v)e*U*t+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>OS0b*u0c#f]>^nZ>[d=V3}7d7e7j9h9i:t:u:w;yS=a.m3jT=b7f9lrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q&f!UR,p&ornOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R&f!UQ,Y&^R1d,RsnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q1p,_S6R1s1tU8p6P6Q6US:_8r8sS;Y:^:aQ;m;ZR;w;nQ&m!VR,i&iR6_1|R:f8yW&Q|&V&W,OR1Z+vQ&r!WR,s&sR,y&xT2],x2_R,}&yQ,|&yR2f,}Q'y!{R-y'ySsOtQ#dXT%ps#dQ#OTR'{#OQ#RUR'}#RQ){$uR/`){Q#UVR(Q#UQ#XWU(W#X(X.QQ(X#YR.Q(YQ-^'YR2r-^Q.u(yS3m.u3nR3n.vQ-e'`R2v-eY!rQ'`-e1o5{R'j!rQ/Q)eR4S/QU#_W%h*YU(_#_(`.RQ(`#`R.R(ZQ-a']R2t-at`OXst!V!Z#d%m&i&k&r&t&u&w,s,x2[2_S#hZ%eU#r`#h.[R.[(jQ(k#jQ.X(gW.a(k.X3X7RQ3X.YR7R3YQ)n$lR/W)nQ$phR)t$pQ$`cU)a$`-|O>Z>[Q/z*eU4k/z4m7xQ4m/|R7x4lS*o$|*ZR0Y*ox*S$v)e*t*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>O!d.j(u)c*[*e.l.m.q/_/k/|0v1e3h4[4h4l5r7]7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/h*S.j7ca7c3}7e7f7j9h:t:w;yQ0a*tQ3i.lU4}0a3i9kR9k7e|*U$v)e*t*u+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>O!h.k(u)c*[*e.l.m.q/_/k/|0v1e3f3h4[4h4l5r7]7^7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/j*U.k7de7d3}7e7f7j9h9i:t:u:w;yQ0c*uQ3j.mU5P0c3j9lR9l7fQ*z%UR0g*zQ5]0vR8Y5]Q+_%kR0u+_Q5v1jS8j5v:[R:[8kQ,[&_R1m,[Q5{1oR8m5{Q1{,fS6]1{8zR8z6_Q1U+rW5h1U5j8a:VQ5j1XQ8a5iR:V8bQ+w&QR1[+wQ2_,xR6m2_YrOXst#dQ&v!ZQ+a%mQ,r&rQ,t&tQ,u&uQ,w&wQ2Y,sS2],x2_R6l2[Q%opQ&z!_Q&}!aQ'P!bQ'R!cQ'q!uQ+`%lQ+l%zQ,Q&XQ,h&mQ-P&|W-p'k's't'wQ-w'oQ0X*nQ1P+mQ1c,PS2O,i,lQ2g-OQ2h-RQ2i-SQ2}-oW3P-r-s-v-xQ5a1QQ5m1_Q5q1eQ6V1uQ6a2QQ6k2ZU6z3O3R3UQ6}3SQ8]5bQ8e5oQ8g5rQ8l5zQ8u6WQ8{6`S9[6{7PQ9^7OQ:W8cQ:b8vQ:g8|Q:n9]Q;U:XQ;]:cQ;a:oQ;l;VR;o;^Q%zyQ'd!iQ'o!uU+m%{%|%}Q-W'VU-k'e'f'gS-o'k'uQ0Q*jS1Q+n+oQ2o-YS2{-l-mQ3S-tS4p0R0UQ5b1RQ6v2uQ6y2|Q7O3TU7{4r4s4vQ9z7}R;O9{S$wi>PR*{%VU%Ui%V>PR0f*yQ$viS(u#v+iS)c$b$cQ)e$dQ*[$xS*e${*YQ*t%OQ*u%QQ+Q%^Q+R%_Q+V%cQ.lPQ=}>XQ>O>YQ>Z>]R>[>^Q+O%]Q.nSR#[WR'Z!el!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}S'V!e-]U*j$|*Z*oS-Y'W'_S0U*k*qQ0^*rQ2u-cQ4v0[R4{0_R({#xQ!fQT-d'`-e]!qQ!r'`-e1o5{Q#p]R'i < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:380,context:CU,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,"Expression",-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",160,"JSXStartCloseTag"],["closedBy",-2,24,168,">",40,"InterpolationEnd",50,"]",61,"}",74,")",165,"JSXEndTag"]],propSources:[AU],skippedNodes:[0,5,6,278],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$i&j(WpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(WpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Wp(Z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z07[+rq$i&j(Wp(Z!b'|0/lOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z07[.ST(X#S$i&j'}0/lO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c07[.n_$i&j(Wp(Z!b'}0/lOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)3p/x`$i&j!p),Q(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW1V`#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW2d_#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'At3l_(V':f$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$i&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$d`$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$d``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$d`$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(Z!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$d`(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k%9[:hh$i&j(Wp(Z!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXWS$i&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSWSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWWS(Z!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]WS$i&j(WpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWWS(WpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYWS(Wp(Z!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%l^!Q^$i&j!X7`OY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@c!_!}!=y!}#O!CW#O#P!Dy#P#o!=y#o#p!@c#p;'S!=y;'S;=`!Ek<%lO!=y|#X#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#k!>|#k#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&c7`!@hX!X7`OY!@cZ!P!@c!P!Q!AT!Q!}!@c!}#O!Ar#O#P!Bq#P;'S!@c;'S;=`!CQ<%lO!@c7`!AYW!X7`#W#X!AT#Z#[!AT#]#^!AT#a#b!AT#g#h!AT#i#j!AT#j#k!AT#m#n!AT7`!AuVOY!ArZ#O!Ar#O#P!B[#P#Q!@c#Q;'S!Ar;'S;=`!Bk<%lO!Ar7`!B_SOY!ArZ;'S!Ar;'S;=`!Bk<%lO!Ar7`!BnP;=`<%l!Ar7`!BtSOY!@cZ;'S!@c;'S;=`!CQ<%lO!@c7`!CTP;=`<%l!@c^!Ezl$i&j(Z!b!X7`OY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#W&}#W#X!Eq#X#Z&}#Z#[!Eq#[#]&}#]#^!Eq#^#a&}#a#b!Eq#b#g&}#g#h!Eq#h#i&}#i#j!Eq#j#k!Eq#k#m&}#m#n!Eq#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}8r!GyZ(Z!b!X7`OY!GrZw!Grwx!@cx!P!Gr!P!Q!Hl!Q!}!Gr!}#O!JU#O#P!Bq#P;'S!Gr;'S;=`!J|<%lO!Gr8r!Hse(Z!b!X7`OY'}Zw'}x#O'}#P#W'}#W#X!Hl#X#Z'}#Z#[!Hl#[#]'}#]#^!Hl#^#a'}#a#b!Hl#b#g'}#g#h!Hl#h#i'}#i#j!Hl#j#k!Hl#k#m'}#m#n!Hl#n;'S'};'S;=`(f<%lO'}8r!JZX(Z!bOY!JUZw!JUwx!Arx#O!JU#O#P!B[#P#Q!Gr#Q;'S!JU;'S;=`!Jv<%lO!JU8r!JyP;=`<%l!JU8r!KPP;=`<%l!Gr>^!KZ^$i&j(Z!bOY!KSYZ&cZw!KSwx!CWx!^!KS!^!_!JU!_#O!KS#O#P!DR#P#Q!^!LYP;=`<%l!KS>^!L`P;=`<%l!_#c#d#Bq#d#l%Z#l#m#Es#m#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#>j_$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#?rd$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#A]f$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Bzc$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Dbe$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#E|g$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Gpi$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z*)x#Il_!g$b$i&j$O)Lv(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)[#Jv_al$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z04f#LS^h#)`#R-v$?V_!^(CdvBr$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z?O$@a_!q7`$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z07[$Aq|$i&j(Wp(Z!b'|0/l$]#t(T,2j(e$I[OX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr07[$D|k$i&j(Wp(Z!b'}0/l$]#t(T,2j(e$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[TU,RU,EU,PU,2,3,4,5,6,7,8,9,10,11,12,13,14,_U,new aU("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(c~~",141,340),new aU("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~",25,323)],topRules:{Script:[0,7],SingleExpression:[1,276],SingleClassItem:[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:327,get:e=>$U[e]||-1},{term:343,get:e=>zU[e]||-1},{term:95,get:e=>QU[e]||-1}],tokenPrec:15201}),NU=[HY("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),HY("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),HY("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),HY("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),HY("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),HY("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),HY("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),HY("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),HY("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),HY('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),HY('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],DU=NU.concat([HY("interface ${name} {\n\t${}\n}",{label:"interface",detail:"definition",type:"keyword"}),HY("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),HY("enum ${name} {\n\t${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),WU=new tB,LU=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function HU(e){return(t,n)=>{let r=t.node.getChild("VariableDefinition");return r&&n(r,e),!0}}const VU=["FunctionDeclaration"],BU={FunctionDeclaration:HU("function"),ClassDeclaration:HU("class"),ClassExpression:()=>!0,EnumDeclaration:HU("constant"),TypeAliasDeclaration:HU("type"),NamespaceDeclaration:HU("namespace"),VariableDefinition(e,t){e.matchContext(VU)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function jU(e,t){let n=WU.get(t);if(n)return n;let r=[],i=!0;function o(t,n){let i=e.sliceString(t.from,t.to);r.push({label:i,type:n})}return t.cursor(IV.IncludeAnonymous).iterate((t=>{if(i)i=!1;else if(t.name){let e=BU[t.name];if(e&&e(t,o)||LU.has(t.name))return!1}else if(t.to-t.from>8192){for(let n of jU(e,t.node))r.push(n);return!1}})),WU.set(t,r),r}const ZU=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,XU=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function FU(e){let t=DB(e.state).resolveInner(e.pos,-1);if(XU.indexOf(t.name)>-1)return null;let n="VariableName"==t.name||t.to-t.from<20&&ZU.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let n=t;n;n=n.parent)LU.has(n.name)&&(r=r.concat(jU(e.state.doc,n)));return{options:r,from:n?t.from:e.pos,validFor:ZU}}const YU=NB.define({name:"javascript",parser:IU.configure({props:[tj.add({IfStatement:cj({except:/^\s*({|else\b)/}),TryStatement:cj({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:e=>e.baseIndent,SwitchBody:e=>{let t=e.textAfter,n=/^\s*\}/.test(t),r=/^\s*(case|default)\b/.test(t);return e.baseIndent+(n?0:r?1:2)*e.unit},Block:aj({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":cj({except:/^\s*{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag":e=>e.column(e.node.from)+e.unit}),uj.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":function(e){let t=e.firstChild,n=e.lastChild;return t&&t.to({from:e.from+2,to:e.to-2}),JSXElement(e){let t=e.firstChild;if(!t||"JSXSelfClosingTag"==t.name)return null;let n=e.lastChild;return{from:t.to,to:n.type.isError?e.to:n.from}},"JSXSelfClosingTag JSXOpenTag"(e){var t;let n=null===(t=e.firstChild)||void 0===t?void 0:t.nextSibling,r=e.lastChild;return!n||n.type.isError?null:{from:n.to,to:r.type.isError?e.to:r.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),qU={test:e=>/^JSX/.test(e.name),facet:$B({commentTokens:{block:{open:"{/*",close:"*/}"}}})},UU=YU.configure({dialect:"ts"},"typescript"),GU=YU.configure({dialect:"jsx",props:[zB.add((e=>e.isTop?[qU]:void 0))]}),KU=YU.configure({dialect:"jsx ts",props:[zB.add((e=>e.isTop?[qU]:void 0))]},"typescript");let JU=e=>({label:e,type:"keyword"});const eG="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(JU),tG=eG.concat(["declare","implements","private","protected","public"].map(JU));function nG(e={}){let t=e.jsx?e.typescript?KU:GU:e.typescript?UU:YU,n=e.typescript?DU.concat(tG):NU.concat(eG);return new YB(t,[YU.data.of({autocomplete:(r=XU,i=LF(n),e=>{for(let t=DB(e.state).resolveInner(e.pos,-1);t;t=t.parent){if(r.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return i(e)})}),YU.data.of({autocomplete:FU}),e.jsx?oG:[]]);var r,i}function rG(e,t,n=e.length){for(let r=null==t?void 0:t.firstChild;r;r=r.nextSibling)if("JSXIdentifier"==r.name||"JSXBuiltin"==r.name||"JSXNamespacedName"==r.name||"JSXMemberExpression"==r.name)return e.sliceString(r.from,Math.min(r.to,n));return""}const iG="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),oG=NL.inputHandler.of(((e,t,n,r,i)=>{if((iG?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||">"!=r&&"/"!=r||!YU.isActiveAt(e.state,t,-1))return!1;let o=i(),{state:s}=o,a=s.changeByRange((e=>{var t;let n,{head:i}=e,o=DB(s).resolveInner(i-1,-1);if("JSXStartTag"==o.name&&(o=o.parent),s.doc.sliceString(i-1,i)!=r||"JSXAttributeValue"==o.name&&o.to>i);else{if(">"==r&&"JSXFragmentTag"==o.name)return{range:e,changes:{from:i,insert:""}};if("/"==r&&"JSXStartCloseTag"==o.name){let e=o.parent,r=e.parent;if(r&&e.from==i-2&&((n=rG(s.doc,r.firstChild,i))||"JSXFragmentTag"==(null===(t=r.firstChild)||void 0===t?void 0:t.name))){let e=`${n}>`;return{range:dQ.cursor(i+e.length,-1),changes:{from:i,insert:e}}}}else if(">"==r){let t=function(e){for(;;){if("JSXOpenTag"==e.name||"JSXSelfClosingTag"==e.name||"JSXFragmentTag"==e.name)return e;if("JSXEscape"==e.name||!e.parent)return null;e=e.parent}}(o);if(t&&"JSXOpenTag"==t.name&&!/^\/?>|^<\//.test(s.doc.sliceString(i,i+2))&&(n=rG(s.doc,t,i)))return{range:e,changes:{from:i,insert:``}}}}return{range:e}}));return!a.changes.empty&&(e.dispatch([o,s.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)})),{ajaxUrl:sG,nonce:aG}=window.vizAIBuilder||{};async function lG(e,t,n={}){const{nonceOverride:r=null,omitEmpty:i=!1}=n,o=new FormData;o.append("action",e),o.append("nonce",r||aG);for(const[e,n]of Object.entries(t))(!i||null!=n&&""!==n)&&o.append(e,n);const s=await fetch(sG,{method:"POST",body:o});let a;try{a=await s.json()}catch{throw new Error("Server returned an unexpected response.")}if(!a.success)throw new Error(a.data?.message||"Request failed.");return a.data}async function cG(e){return lG("visualizer-ai-chart-nonce",{chart_id:e})}async function hG(e){return lG("visualizer-ai-fetch",{chart_id:e})}async function uG(e,t,n){return lG("visualizer-ai-upload",{chart_id:e,source_type:"csv_string",csv_data:n},{nonceOverride:t,omitEmpty:!0})}async function dG(e,t,n,r,i=null,o=null,s=null){const a={chart_id:e,prompt:t,series:JSON.stringify(n),data:JSON.stringify(r)};return i&&(a.existing_code=i),o&&(a.ref_image=o,a.ref_image_mime=s||"image/jpeg"),lG("visualizer-ai-generate",a)}async function fG(e){return lG("visualizer-ai-status",{workflow_id:e})}const pG=(0,c.forwardRef)((function(e,t){const{direction:n="column",align:r,justify:i,gap:o="0.5rem",wrap:s,children:a,separator:h,className:u,...d}=e,f=(0,c.useMemo)((()=>function(e){const{gap:t,direction:n}=e,r={column:{marginY:t,marginX:0,borderInlineStartWidth:0,borderTopWidth:"1px"},"column-reverse":{marginY:t,marginX:0,borderInlineStartWidth:0,borderTopWidth:"1px"},row:{marginX:t,marginY:0,borderInlineStartWidth:"1px",borderTopWidth:0},"row-reverse":{marginX:t,marginY:0,borderInlineStartWidth:"1px",borderTopWidth:0}};return{"&":yt(n,(e=>r[e]))}}({gap:o,direction:n})),[o,n]),p=(0,c.useMemo)((()=>(0,c.isValidElement)(h)?function(e){return c.Children.toArray(e).filter((e=>(0,c.isValidElement)(e)))}(a).map(((e,t,n)=>{const r=void 0!==e.key?e.key:t,i=h,o=(0,c.cloneElement)(i,{css:[f,i.props.css]});return(0,l.jsxs)(c.Fragment,{children:[e,t===n.length-1?null:o]},r)})):a),[a,h,f]);return(0,l.jsx)(Js.div,{ref:t,display:"flex",alignItems:r,justifyContent:i,flexDirection:n,flexWrap:s,gap:h?void 0:o,className:wn("chakra-stack",u),...d,children:p})}));pG.displayName="Stack";const gG=window.ReactDOM;n(4114),n(6280),n(9848);var mG=n(2838);function bG(e){return e[0].toUpperCase()+e.substr(1)}function vG(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+e()+e()}function yG(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=-1,r=null,i=e;for(;null!==i;){if(n===t){r=i;break}i.host&&i.nodeType===Node.DOCUMENT_FRAGMENT_NODE?i=i.host:(n+=1,i=i.parentNode)}return r}function OG(e){return function(e){return Object.getPrototypeOf(e.parent)&&e.frameElement}(e)&&e.parent}function wG(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0;const{ELEMENT_NODE:r,DOCUMENT_FRAGMENT_NODE:i}=Node;let o=e;for(;null!=o&&o!==n;){const{nodeType:e,nodeName:n}=o;if(e===r&&(t.includes(n)||t.includes(o)))return o;const{host:s}=o;o=s&&e===i?s:o.parentNode}return null}function xG(e,t,n){const r=[];let i=e;for(;i&&(i=wG(i,t,n),i&&(!n||n.contains(i)));)r.push(i),i=i.host&&i.nodeType===Node.DOCUMENT_FRAGMENT_NODE?i.host:i.parentNode;const o=r.length;return o?r[o-1]:null}function SG(e,t){let n=e.parentNode,r=[];for("string"==typeof t?r=e.defaultView?Array.prototype.slice.call(e.querySelectorAll(t),0):Array.prototype.slice.call(e.ownerDocument.querySelectorAll(t),0):r.push(t);null!==n;){if(r.indexOf(n)>-1)return!0;n=n.parentNode}return!1}function kG(e,t,n){const r=n.parentElement.querySelector(`.ht_clone_${e}`);return r?r.contains(t):null}function CG(e){return e&&e.length?e.filter((e=>!!e)):[]}function _G(e,t){return void 0!==e.classList&&"string"==typeof t&&""!==t&&e.classList.contains(t)}function TG(e,t){"string"==typeof t&&(t=t.split(" ")),(t=CG(t)).length>0&&e.classList.add(...t)}function RG(e,t){"string"==typeof t&&(t=t.split(" ")),(t=CG(t)).length>0&&e.classList.remove(...t)}function EG(e){if(3===e.nodeType)e.parentNode.removeChild(e);else if(["TABLE","THEAD","TBODY","TFOOT","TR"].indexOf(e.nodeName)>-1){const t=e.childNodes;for(let e=t.length-1;e>=0;e--)EG(t[e])}}function MG(e){let t;for(;t=e.lastChild;)e.removeChild(t)}const PG=/(<(.*)>|&(.*);)/;function AG(e,t){const n=e.firstChild;n&&3===n.nodeType&&null===n.nextSibling?n.textContent=t:(MG(e),e.appendChild(e.ownerDocument.createTextNode(t)))}function $G(e){const t=e.ownerDocument.documentElement;let n=e;for(;n!==t;){if(null===n)return!1;if(n.nodeType===Node.DOCUMENT_FRAGMENT_NODE){if(n.host){if(n.host.impl)return $G(n.host.impl);if(n.host)return $G(n.host);throw new Error("Lost in Web Components world")}return!1}if(n.style&&"none"===n.style.display)return!1;n=n.parentNode}return!0}function zG(e){const t=e.ownerDocument,n=t.defaultView,r=t.documentElement;let i,o,s,a=e;for(i=a.offsetLeft,o=a.offsetTop,s=a;(a=a.offsetParent)&&a!==t.body;)i+=a.offsetLeft,o+=a.offsetTop,s=a;return s&&"fixed"===s.style.position&&(i+=n.pageXOffset||r.scrollLeft,o+=n.pageYOffset||r.scrollTop),{left:i,top:o}}function QG(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).scrollY}function IG(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).scrollX}function NG(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;return e===t?QG(t):e.scrollTop}function DG(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;return e===t?IG(t):e.scrollLeft}function WG(e){let t=e.ownerDocument,n=t?t.defaultView:void 0;t||(t=e.document?e.document:e,n=t.defaultView);const r=["auto","scroll"];let i=e.parentNode;for(;i&&i.style&&t.body!==i;){let{overflow:e,overflowX:t,overflowY:o}=i.style;if([e,t,o].includes("scroll"))return i;if(({overflow:e,overflowX:t,overflowY:o}=n.getComputedStyle(i)),r.includes(e)||r.includes(t)||r.includes(o))return i;if(i.clientHeight<=i.scrollHeight+1&&(r.includes(o)||r.includes(e)))return i;if(i.clientWidth<=i.scrollWidth+1&&(r.includes(t)||r.includes(e)))return i;i=i.parentNode}return n}function LG(e){const t=e.ownerDocument,n=t.defaultView;let r=e.parentNode;for(;r&&r.style&&t.body!==r;){if("visible"!==r.style.overflow&&""!==r.style.overflow)return r;const e=VG(r,n),t=["scroll","hidden","auto"],i=e.getPropertyValue("overflow"),o=e.getPropertyValue("overflow-y"),s=e.getPropertyValue("overflow-x");if(t.includes(i)||t.includes(o)||t.includes(s))return r;r=r.parentNode}return n}function HG(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window;if(!e)return;if(e===n)return"width"===t?`${n.innerWidth}px`:"height"===t?`${n.innerHeight}px`:void 0;const r=e.style[t];if(""!==r&&void 0!==r)return r;const i=VG(e,n);return""!==i[t]&&void 0!==i[t]?i[t]:void 0}function VG(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;return e.currentStyle||t.getComputedStyle(e)}function BG(e){return e.offsetWidth}function jG(e){return e.offsetHeight}function ZG(e){return e.clientHeight||e.innerHeight}function XG(e){return e.clientWidth||e.innerWidth}function FG(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;e.getSelection&&(e.getSelection().empty?e.getSelection().empty():e.getSelection().removeAllRanges&&e.getSelection().removeAllRanges())}function YG(e,t,n){if(void 0===n&&(n=t),e.setSelectionRange){e.focus();try{e.setSelectionRange(t,n)}catch(r){const i=e.parentNode,o=i.style.display;i.style.display="block",e.setSelectionRange(t,n),i.style.display=o}}}let qG;function UG(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;return void 0===qG&&(qG=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;const t=e.createElement("div");t.style.height="200px",t.style.width="100%";const n=e.createElement("div");n.style.boxSizing="content-box",n.style.height="150px",n.style.left="0px",n.style.overflow="hidden",n.style.position="absolute",n.style.top="0px",n.style.width="200px",n.style.visibility="hidden",n.appendChild(t),(e.body||e.documentElement).appendChild(n);const r=t.offsetWidth;n.style.overflow="scroll";let i=t.offsetWidth;return r===i&&(i=n.clientWidth),(e.body||e.documentElement).removeChild(n),r-i}(e)),qG}function GG(e,t,n){e.style.transform=`translate3d(${t},${n},0)`}function KG(e){e.style.transform&&""!==e.style.transform&&(e.style.transform="")}function JG(e){return e&&(["INPUT","SELECT","TEXTAREA"].indexOf(e.nodeName)>-1||"true"===e.contentEditable)}function eK(e){return JG(e)&&!1===e.hasAttribute("data-hot-input")}const tK=window.moment;function nK(e,t){const n=t.length;let r=0;for(;r{o=o.filter((t=>!e.includes(t)))})),o}function cK(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";return e.split(t)}function hK(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re+t.replace(/\r?\n\s*/g,"")+(n[r]?n[r]:"")),"");return i.trim()}function uK(e){let t;switch(typeof e){case"string":case"number":t=`${e}`;break;case"object":t=null===e?"":e.toString();break;case"undefined":t="";break;default:t=e.toString()}return t}function dK(e){return void 0!==e}function fK(e){return void 0===e}function pK(e){return null===e||""===e||fK(e)}const gK="length",mK=e=>parseInt(e,16),bK=e=>parseInt(e,10),vK=(e,t,n)=>e.substr(t,n),yK=e=>e.codePointAt(0)-65,OK=e=>`${e}`.replace(/\-/g,""),wK=e=>mK(vK(OK(e),mK("12"),yK("F")))/(mK(vK(OK(e),yK("B"),~~![][gK]))||9),xK=()=>"undefined"!=typeof location&&/^([a-z0-9\-]+\.)?\x68\x61\x6E\x64\x73\x6F\x6E\x74\x61\x62\x6C\x65\x2E\x63\x6F\x6D$/i.test(location.host);let SK=!1;const kK={invalid:()=>hK` The license key for Handsontable is invalid.\x20 If you need any help, contact us at support@handsontable.com.`,expired:e=>{let{keyValidityDate:t,hotVersion:n}=e;return hK` The license key for Handsontable expired on ${t}, and is not valid for the installed\x20 version ${n}. Renew your license key at handsontable.com or downgrade to a version released prior\x20 to ${t}. If you need any help, contact us at sales@handsontable.com.`},missing:()=>hK` The license key for Handsontable is missing. Use your purchased key to activate the product.\x20 Alternatively, you can activate Handsontable to use for non-commercial purposes by\x20 passing the key: 'non-commercial-and-evaluation'. If you need any help, contact\x20 us at support@handsontable.com.`,non_commercial:()=>""},CK={invalid:()=>hK` The license key for Handsontable is invalid.\x20 Read more on how to\x20 install it properly or contact us at support@handsontable.com.`,expired:e=>{let{keyValidityDate:t,hotVersion:n}=e;return hK` The license key for Handsontable expired on ${t}, and is not valid for the installed\x20 version ${n}. Renew your\x20 license key or downgrade to a version released prior to ${t}. If you need any\x20 help, contact us at sales@handsontable.com.`},missing:()=>hK` The license key for Handsontable is missing. Use your purchased key to activate the product.\x20 Alternatively, you can activate Handsontable to use for non-commercial purposes by\x20 passing the key: 'non-commercial-and-evaluation'.\x20 Read more about it in\x20 the documentation or contact us at support@handsontable.com.`,non_commercial:()=>""};function _K(e){return"function"==typeof e}function TK(e,t,n,r,i,o,s,a){return dK(a)?e.call(t,n,r,i,o,s,a):dK(s)?e.call(t,n,r,i,o,s):dK(o)?e.call(t,n,r,i,o):dK(i)?e.call(t,n,r,i):dK(r)?e.call(t,n,r):dK(n)?e.call(t,n):e.call(t)}function RK(e){let t;return Array.isArray(e)?t=e.length?new Array(e.length).fill(null):[]:(t={},IK(e,((e,n)=>{"__children"!==n&&(e&&"object"==typeof e&&!Array.isArray(e)?t[n]=RK(e):Array.isArray(e)?e.length&&"object"==typeof e[0]&&!Array.isArray(e[0])?t[n]=[RK(e[0])]:t[n]=[]:t[n]=null)}))),t}function EK(e,t,n){const r=Array.isArray(n);return IK(t,((t,i)=>{(!1===r||n.includes(i))&&(e[i]=t)})),e}function MK(e,t){IK(t,((n,r)=>{t[r]&&"object"==typeof t[r]?(e[r]||(Array.isArray(t[r])?e[r]=[]:"[object Date]"===Object.prototype.toString.call(t[r])?e[r]=t[r]:e[r]={}),MK(e[r],t[r])):e[r]=t[r]}))}function PK(e){return"object"==typeof e?JSON.parse(JSON.stringify(e)):e}function AK(e){e.MIXINS||(e.MIXINS=[]);for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{e.MIXINS.push(t.MIXIN_NAME),IK(t,((t,n)=>{if(void 0!==e.prototype[n])throw new Error(`Mixin conflict. Property '${n}' already exist and cannot be overwritten.`);if("function"==typeof t)e.prototype[n]=t;else{const r=function(e,t){const n=`_${e}`;return function(){return void 0===this[n]&&(this[n]=(e=>{let t=e;return(Array.isArray(t)||zK(t))&&(t=PK(t)),t})(t)),this[n]}},i=function(e){const t=`_${e}`;return function(e){this[t]=e}};Object.defineProperty(e.prototype,n,{get:r(n,t),set:i(n),configurable:!0})}}))})),e}function $K(e,t){return JSON.stringify(e)===JSON.stringify(t)}function zK(e){return"[object Object]"===Object.prototype.toString.call(e)}function QK(e,t,n,r){r.value=n,r.writable=!1!==r.writable,r.enumerable=!1!==r.enumerable,r.configurable=!1!==r.configurable,Object.defineProperty(e,t,r)}function IK(e,t){for(const n in e)if((!e.hasOwnProperty||e.hasOwnProperty&&Object.prototype.hasOwnProperty.call(e,n))&&!1===t(e[n],n,e))break;return e}function NK(e,t,n){const r=t.split(".");let i=e;r.forEach(((e,t)=>{t!==r.length-1?(LK(i,e)||(i[e]={}),i=i[e]):i[e]=n}))}function DK(e){if(!zK(e))return 0;const t=function(e){let n=0;return zK(e)?IK(e,((e,r)=>{"__children"!==r&&(n+=t(e))})):n+=1,n};return t(e)}function WK(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"value";const n=`_${t}`,r={_touched:!1,[n]:e,isTouched(){return this._touched}};return Object.defineProperty(r,t,{get(){return this[n]},set(e){this._touched=!0,this[n]=e},enumerable:!0,configurable:!0}),r}function LK(e,t){return Object.prototype.hasOwnProperty.call(e,t)}n(3110);const HK=e=>{const t={value:!1,test:(n,r)=>{t.value=e(n,r)}};return t},VK={chrome:HK(((e,t)=>/Chrome/.test(e)&&/Google/.test(t))),chromeWebKit:HK((e=>/CriOS/.test(e))),edge:HK((e=>/Edge/.test(e))),edgeWebKit:HK((e=>/EdgiOS/.test(e))),firefox:HK((e=>/Firefox/.test(e))),firefoxWebKit:HK((e=>/FxiOS/.test(e))),mobile:HK((e=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(e))),safari:HK(((e,t)=>/Safari/.test(e)&&/Apple Computer/.test(t)))},BK={mac:HK((e=>/^Mac/.test(e))),win:HK((e=>/^Win/.test(e))),linux:HK((e=>/^Linux/.test(e))),ios:HK((e=>/iPhone|iPad|iPod/i.test(e)))};function jK(){return VK.firefox.value}function ZK(){return VK.mobile.value}function XK(){return BK.ios.value}function FK(){return BK.mac.value}!function(){let{userAgent:e=navigator.userAgent,vendor:t=navigator.vendor}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};IK(VK,(n=>{let{test:r}=n;r(e,t)}))}(),function(){let{platform:e=navigator.platform}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};IK(BK,(t=>{let{test:n}=t;n(e)}))}();const YK={ALT:18,ARROW_DOWN:40,ARROW_LEFT:37,ARROW_RIGHT:39,ARROW_UP:38,AUDIO_DOWN:jK()?182:174,AUDIO_MUTE:jK()?181:173,AUDIO_UP:jK()?183:175,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND_LEFT:91,COMMAND_RIGHT:93,COMMAND_FIREFOX:224,CONTROL:17,DELETE:46,END:35,ENTER:13,ESCAPE:27,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,F13:124,F14:125,F15:126,F16:127,F17:128,F18:129,F19:130,HOME:36,INSERT:45,MEDIA_NEXT:176,MEDIA_PLAY_PAUSE:179,MEDIA_PREV:177,MEDIA_STOP:178,NULL:0,NUM_LOCK:144,PAGE_DOWN:34,PAGE_UP:33,PAUSE:19,PERIOD:190,SCROLL_LOCK:145,SHIFT:16,SPACE:32,TAB:9,A:65,C:67,D:68,F:70,L:76,O:79,P:80,S:83,V:86,X:88,Y:89,Z:90},qK=[YK.ALT,YK.ARROW_DOWN,YK.ARROW_LEFT,YK.ARROW_RIGHT,YK.ARROW_UP,YK.AUDIO_DOWN,YK.AUDIO_MUTE,YK.AUDIO_UP,YK.BACKSPACE,YK.CAPS_LOCK,YK.DELETE,YK.END,YK.ENTER,YK.ESCAPE,YK.F1,YK.F2,YK.F3,YK.F4,YK.F5,YK.F6,YK.F7,YK.F8,YK.F9,YK.F10,YK.F11,YK.F12,YK.F13,YK.F14,YK.F15,YK.F16,YK.F17,YK.F18,YK.F19,YK.HOME,YK.INSERT,YK.MEDIA_NEXT,YK.MEDIA_PLAY_PAUSE,YK.MEDIA_PREV,YK.MEDIA_STOP,YK.NULL,YK.NUM_LOCK,YK.PAGE_DOWN,YK.PAGE_UP,YK.PAUSE,YK.SCROLL_LOCK,YK.SHIFT,YK.TAB];function UK(e){e.isImmediatePropagationEnabled=!1,e.cancelBubble=!0}function GK(e){return!1===e.isImmediatePropagationEnabled}function KK(e){return 2===e.button}function JK(e){return 0===e.button}function eJ(){dK(console)&&console.warn(...arguments)}const tJ=["afterCellMetaReset","afterChange","afterContextMenuDefaultOptions","beforeContextMenuSetItems","afterDropdownMenuDefaultOptions","beforeDropdownMenuSetItems","afterContextMenuHide","beforeContextMenuShow","afterContextMenuShow","afterCopyLimit","beforeCreateCol","afterColumnSequenceChange","afterCreateCol","beforeCreateRow","afterCreateRow","afterDeselect","afterDestroy","afterDocumentKeyDown","afterDrawSelection","beforeRemoveCellClassNames","afterGetCellMeta","afterGetColHeader","afterGetRowHeader","afterInit","afterLoadData","afterUpdateData","afterMomentumScroll","afterOnCellCornerMouseDown","afterOnCellCornerDblClick","afterOnCellMouseDown","afterOnCellMouseUp","afterOnCellContextMenu","afterOnCellMouseOver","afterOnCellMouseOut","afterRemoveCol","afterRemoveRow","beforeRenderer","afterRenderer","afterRowSequenceChange","afterScrollHorizontally","afterScrollVertically","afterSelection","afterSelectionByProp","afterSelectionEnd","afterSelectionEndByProp","afterSetCellMeta","afterRemoveCellMeta","afterSetDataAtCell","afterSetDataAtRowProp","afterSetSourceDataAtCell","afterUpdateSettings","afterValidate","beforeLanguageChange","afterLanguageChange","beforeAutofill","afterAutofill","beforeCellAlignment","beforeChange","beforeChangeRender","beforeDrawBorders","beforeGetCellMeta","beforeRemoveCellMeta","beforeInit","beforeInitWalkontable","beforeLoadData","beforeUpdateData","beforeKeyDown","beforeOnCellMouseDown","beforeOnCellMouseUp","beforeOnCellContextMenu","beforeOnCellMouseOver","beforeOnCellMouseOut","beforeRemoveCol","beforeRemoveRow","beforeViewRender","afterViewRender","beforeRender","afterRender","beforeSetCellMeta","beforeSetRangeStartOnly","beforeSetRangeStart","beforeSetRangeEnd","beforeTouchScroll","beforeValidate","beforeValueRender","construct","init","modifyColHeader","modifyColWidth","modifyRowHeader","modifyRowHeight","modifyData","modifySourceData","modifyRowData","modifyGetCellCoords","beforeHighlightingRowHeader","beforeHighlightingColumnHeader","persistentStateLoad","persistentStateReset","persistentStateSave","beforeColumnSort","afterColumnSort","modifyAutofillRange","modifyCopyableRange","beforeCut","afterCut","beforeCopy","afterCopy","beforePaste","afterPaste","beforeColumnFreeze","afterColumnFreeze","beforeColumnMove","afterColumnMove","beforeColumnUnfreeze","afterColumnUnfreeze","beforeRowMove","afterRowMove","beforeColumnResize","afterColumnResize","beforeRowResize","afterRowResize","afterGetColumnHeaderRenderers","afterGetRowHeaderRenderers","beforeStretchingColumnWidth","beforeFilter","afterFilter","afterFormulasValuesUpdate","afterNamedExpressionAdded","afterNamedExpressionRemoved","afterSheetAdded","afterSheetRenamed","afterSheetRemoved","modifyColumnHeaderHeight","modifyColumnHeaderValue","beforeUndo","beforeUndoStackChange","afterUndo","afterUndoStackChange","beforeRedo","beforeRedoStackChange","afterRedo","afterRedoStackChange","modifyRowHeaderWidth","modifyTransformStart","modifyTransformEnd","afterModifyTransformStart","afterModifyTransformEnd","afterViewportRowCalculatorOverride","afterViewportColumnCalculatorOverride","afterPluginsInitialized","beforeHideRows","afterHideRows","beforeUnhideRows","afterUnhideRows","beforeHideColumns","afterHideColumns","beforeUnhideColumns","afterUnhideColumns","beforeTrimRow","afterTrimRow","beforeUntrimRow","afterUntrimRow","beforeDropdownMenuShow","afterDropdownMenuShow","afterDropdownMenuHide","beforeAddChild","afterAddChild","beforeDetachChild","afterDetachChild","afterBeginEditing","beforeMergeCells","afterMergeCells","beforeUnmergeCells","afterUnmergeCells","afterListen","afterUnlisten","afterRefreshDimensions","beforeRefreshDimensions","beforeColumnCollapse","afterColumnCollapse","beforeColumnExpand","afterColumnExpand","modifyAutoColumnSizeSeed"],nJ=hK`The plugin hook "[hookName]" was removed in Handsontable [removedInVersion].\x20 Please consult release notes https://github.com/handsontable/handsontable/releases/tag/[removedInVersion] to\x20 learn about the migration path.`,rJ=new Map([["modifyRow","8.0.0"],["modifyCol","8.0.0"],["unmodifyRow","8.0.0"],["unmodifyCol","8.0.0"],["skipLengthCache","8.0.0"],["hiddenColumn","8.0.0"],["hiddenRow","8.0.0"]]),iJ=new Map([]);class oJ{static getSingleton(){return sJ}constructor(){this.globalBucket=this.createEmptyBucket()}createEmptyBucket(){const e=Object.create(null);return aK(tJ,(t=>e[t]=[])),e}getBucket(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return e?(e.pluginHookBucket||(e.pluginHookBucket=this.createEmptyBucket()),e.pluginHookBucket):this.globalBucket}add(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(Array.isArray(t))aK(t,(t=>this.add(e,t,n)));else{rJ.has(e)&&eJ(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return`${e}`.replace(/(?:\\)?\[([^[\]]+)]/g,((e,n)=>"\\"===e.charAt(0)?e.substr(1,e.length-1):void 0===t[n]?"":t[n]))}(nJ,{hookName:e,removedInVersion:rJ.get(e)})),iJ.has(e)&&eJ(iJ.get(e));const r=this.getBucket(n);if(void 0===r[e]&&(this.register(e),r[e]=[]),t.skip=!1,-1===r[e].indexOf(t)){let n=!1;t.initialHook&&aK(r[e],((i,o)=>{if(i.initialHook)return r[e][o]=t,n=!0,!1})),n||r[e].push(t)}}return this}once(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;Array.isArray(t)?aK(t,(t=>this.once(e,t,n))):(t.runOnce=!0,this.add(e,t,n))}remove(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const r=this.getBucket(n);return void 0!==r[e]&&r[e].indexOf(t)>=0&&(t.skip=!0,!0)}has(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const n=this.getBucket(t);return!(void 0===n[e]||!n[e].length)}run(e,t,n,r,i,o,s,a){{const l=this.globalBucket[t],c=l?l.length:0;let h=0;if(c)for(;h0&&void 0!==arguments[0]?arguments[0]:null;IK(this.getBucket(e),((e,t,n)=>n[t].length=0))}register(e){this.isRegistered(e)||tJ.push(e)}deregister(e){this.isRegistered(e)&&tJ.splice(tJ.indexOf(e),1)}isDeprecated(e){return iJ.has(e)||rJ.has(e)}isRegistered(e){return tJ.indexOf(e)>=0}getRegistered(){return tJ}}const sJ=new oJ,aJ=oJ,lJ=new Map;function cJ(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"common";lJ.has(e)||lJ.set(e,new Map);const t=lJ.get(e);return{register:function(e,n){t.set(e,n)},getItem:function(e){return t.get(e)},hasItem:function(e){return t.has(e)},getNames:function(){return[...t.keys()]},getValues:function(){return[...t.values()]}}}const hJ=new WeakMap,{register:uJ,getItem:dJ,hasItem:fJ,getNames:pJ,getValues:gJ}=cJ("editors");function mJ(e){const t={},n=e;this.getConstructor=function(){return e},this.getInstance=function(e){return e.guid in t||(t[e.guid]=new n(e)),t[e.guid]},aJ.getSingleton().add("afterDestroy",(function(){t[this.guid]=null}))}function bJ(e){if("function"==typeof e)return e;if(!fJ(e))throw Error(`No registered editor found under "${e}" name`);return dJ(e).getConstructor()}function vJ(e,t){e&&"string"!=typeof e&&(e=(t=e).EDITOR_TYPE);const n=new mJ(t);"string"==typeof e&&uJ(e,n),hJ.set(t,n)}let yJ=0;const OJ=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.context=e||this,this.context.eventListeners||(this.context.eventListeners=[])}addEventListener(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];function i(e){n.call(this,function(e){const t=e.stopImmediatePropagation;return e.stopImmediatePropagation=function(){t.apply(this),UK(this)},e}(e))}return this.context.eventListeners.push({element:e,event:t,callback:n,callbackProxy:i,options:r,eventManager:this}),e.addEventListener(t,i,r),yJ+=1,()=>{this.removeEventListener(e,t,n)}}removeEventListener(e,t,n){let r,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=this.context.eventListeners.length;for(;o;)if(o-=1,r=this.context.eventListeners[o],r.event===t&&r.element===e){if(n&&n!==r.callback)continue;if(i&&r.eventManager!==this)continue;this.context.eventListeners.splice(o,1),r.element.removeEventListener(r.event,r.callbackProxy,r.options),yJ-=1}}clearEvents(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.context)return;let t=this.context.eventListeners.length;for(;t;){t-=1;const n=this.context.eventListeners[t];e&&n.eventManager!==this||(this.context.eventListeners.splice(t,1),n.element.removeEventListener(n.event,n.callbackProxy,n.options),yJ-=1)}}clear(){this.clearEvents()}destroy(){this.clearEvents(),this.context=null}destroyWithOwnEventsOnly(){this.clearEvents(!0),this.context=null}fireEvent(e,t){let n=e.document,r=e;n||(n=e.ownerDocument?e.ownerDocument:e,r=n.defaultView);const i={bubbles:!0,cancelable:"mousemove"!==t,view:r,detail:0,screenX:0,screenY:0,clientX:1,clientY:1,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:void 0};let o;n.createEvent?(o=n.createEvent("MouseEvents"),o.initMouseEvent(t,i.bubbles,i.cancelable,i.view,i.detail,i.screenX,i.screenY,i.clientX,i.clientY,i.ctrlKey,i.altKey,i.shiftKey,i.metaKey,i.button,i.relatedTarget||n.body.parentNode)):o=n.createEventObject(),e.dispatchEvent?e.dispatchEvent(o):e.fireEvent(`on${t}`,o)}},wJ="editorManager.navigation",xJ="editorManager.handlingEditor";class SJ{constructor(e,t,n){this.instance=e,this.tableMeta=t,this.selection=n,this.eventManager=new OJ(e),this.destroyed=!1,this.lock=!1,this.activeEditor=void 0,this.cellProperties=void 0,this.instance.getShortcutManager().addContext("editor"),this.registerShortcuts(),this.instance.addHook("afterDocumentKeyDown",(e=>this.onAfterDocumentKeyDown(e))),this.eventManager.addEventListener(this.instance.rootDocument.documentElement,"compositionstart",(e=>{!this.destroyed&&this.instance.isListening()&&this.openEditor("",e)})),this.instance.view._wt.update("onCellDblClick",((e,t,n)=>this.onCellDblClick(e,t,n)))}registerShortcuts(){const e=this.instance.getShortcutManager(),t=e.getContext("grid"),n=e.getContext("editor"),r={group:xJ};n.addShortcuts([{keys:[["Enter"],["Enter","Shift"],["Enter","Control/Meta"],["Enter","Control/Meta","Shift"]],callback:(t,n)=>{this.closeEditorAndSaveChanges(e.isCtrlPressed()),this.moveSelectionAfterEnter(n.includes("shift"))}},{keys:[["Escape"],["Escape","Control/Meta"]],callback:()=>{this.closeEditorAndRestoreOriginalValue(e.isCtrlPressed()),this.activeEditor.focus()}}],r),t.addShortcuts([{keys:[["F2"]],callback:e=>{this.openEditor(null,e,!0)}},{keys:[["Backspace"],["Delete"]],callback:()=>{this.instance.emptySelectedCells(),this.prepareEditor()}},{keys:[["Enter"],["Enter","Shift"]],callback:(e,t)=>{this.instance.getSettings().enterBeginsEditing?this.cellProperties.readOnly?this.moveSelectionAfterEnter():this.openEditor(null,e,!0):this.moveSelectionAfterEnter(t.includes("shift")),UK(e)}}],{...r,runOnlyIf:()=>dK(this.instance.getSelected())})}lockEditor(){this.lock=!0}unlockEditor(){this.lock=!1}destroyEditor(e){this.lock||this.closeEditor(e)}getActiveEditor(){return this.activeEditor}prepareEditor(){if(this.lock)return;if(this.activeEditor&&this.activeEditor.isWaiting())return void this.closeEditor(!1,!1,(e=>{e&&this.prepareEditor()}));const{row:e,col:t}=this.instance.getSelectedRangeLast().highlight,n=this.instance.runHooks("modifyGetCellCoords",e,t);let r=e,i=t;Array.isArray(n)&&([r,i]=n),this.cellProperties=this.instance.getCellMeta(r,i);const{activeElement:o}=this.instance.rootDocument;if(o&&eK(o)&&o.blur(),!this.isCellEditable())return void this.clearActiveEditor();const s=this.instance.getCell(e,t,!0);if(s){const n=this.instance.getCellEditor(this.cellProperties),o=this.instance.colToProp(i),a=this.instance.getSourceDataAtCell(this.instance.toPhysicalRow(r),i);this.activeEditor=function(e,t){let n;if("function"==typeof e)hJ.get(e)||vJ(null,e),n=hJ.get(e);else{if("string"!=typeof e)throw Error('Only strings and functions can be passed as "editor" parameter');n=dJ(e)}if(!n)throw Error(`No editor registered under name "${e}"`);return n.getInstance(t)}(n,this.instance),this.activeEditor.prepare(e,t,o,s,a,this.cellProperties)}}isEditorOpened(){return this.activeEditor&&this.activeEditor.isOpened()}openEditor(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.isCellEditable()){if(!this.activeEditor){const{row:e,col:t}=this.instance.getSelectedRangeLast().highlight,n=this.instance.rowIndexMapper.getRenderableFromVisualIndex(e),r=this.instance.columnIndexMapper.getRenderableFromVisualIndex(t);this.instance.view.scrollViewport(this.instance._createCellCoords(n,r)),this.instance.view.render(),this.prepareEditor()}this.activeEditor&&(n&&this.activeEditor.enableFullEditMode(),this.activeEditor.beginEditing(e,t))}else this.clearActiveEditor()}closeEditor(e,t,n){this.activeEditor?this.activeEditor.finishEditing(e,t,n):n&&n(!1)}closeEditorAndSaveChanges(e){this.closeEditor(!1,e)}closeEditorAndRestoreOriginalValue(e){this.closeEditor(!0,e)}clearActiveEditor(){this.activeEditor=void 0}isCellEditable(){const e=this.instance.getCellEditor(this.cellProperties),{row:t,col:n}=this.instance.getSelectedRangeLast().highlight,{rowIndexMapper:r,columnIndexMapper:i}=this.instance,o=r.isHidden(this.instance.toPhysicalRow(t))||i.isHidden(this.instance.toPhysicalColumn(n));return!(this.cellProperties.readOnly||!e||o)}moveSelectionAfterEnter(e){const t="function"==typeof this.tableMeta.enterMoves?this.tableMeta.enterMoves(event):this.tableMeta.enterMoves;e?this.selection.transformStart(-t.row,-t.col):this.selection.transformStart(t.row,t.col,!0)}onAfterDocumentKeyDown(e){if(!this.instance.isListening())return;const{keyCode:t}=e;if(!this.selection.isSelected())return;const n=(e.ctrlKey||e.metaKey)&&!e.altKey;if((!this.activeEditor||this.activeEditor&&!this.activeEditor.isWaiting())&&!(function(e){return qK.includes(e)}(t)||function(e){return[YK.CONTROL,YK.COMMAND_LEFT,YK.COMMAND_RIGHT,YK.COMMAND_FIREFOX].includes(e)}(t)||n||this.isEditorOpened())){const t=this.instance.getShortcutManager().getContext("editor"),n={runOnlyIf:()=>dK(this.instance.getSelected()),group:wJ};t.addShortcuts([{keys:[["ArrowUp"]],callback:()=>{this.instance.selection.transformStart(-1,0)}},{keys:[["ArrowDown"]],callback:()=>{this.instance.selection.transformStart(1,0)}},{keys:[["ArrowLeft"]],callback:()=>{this.instance.selection.transformStart(0,-1*this.instance.getDirectionFactor())}},{keys:[["ArrowRight"]],callback:()=>{this.instance.selection.transformStart(0,this.instance.getDirectionFactor())}}],n),this.openEditor("",e)}}onCellDblClick(e,t,n){"TD"===n.nodeName&&this.openEditor(null,e,!0)}destroy(){this.destroyed=!0,this.eventManager.destroy()}}const kJ=new WeakMap;SJ.getInstance=function(e,t,n){let r=kJ.get(e);return r||(r=new SJ(e,t,n),kJ.set(e,r)),r};const CJ=SJ;function _J(e){const t=e.hasColHeaders(),n=e.hasRowHeaders(),r=[t?-1:0,n?-1:0,e.countRows()-1,e.countCols()-1],i=e.getData(...r),o=i.length,s=o>0?i[0].length:0,a=["","
"],l=t?["",""]:[],c=["",""],h=n?1:0,u=t?1:0;for(let r=0;r${e.getColHeader(t-h)}`;else if(s)l=`${e.getRowHeader(r-u)}`;else{const n=i[r][t],{hidden:o,rowspan:s,colspan:a}=e.getCellMeta(r-u,t-h);if(!o){const e=[];if(s&&e.push(`rowspan="${s}"`),a&&e.push(`colspan="${a}"`),pK(n))l=``;else{const t=n.toString().replace("<","<").replace(">",">").replace(/((\r\n|\n)?|\r\n|\n)/g,"
\r\n").replace(/\x20/gi," ").replace(/\t/gi," ");l=`${t}`}}}a.push(l)}const d=["",...a,""].join("");o?l.splice(1,0,d):c.splice(-1,0,d)}return a.splice(1,0,l.join(""),c.join("")),a.join("")}function TJ(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n=typeof e;if("number"===n)return!isNaN(e)&&isFinite(e);if("string"===n){if(0===e.length)return!1;if(1===e.length)return/\d/.test(e);const n=Array.from(new Set([".",...t])).map((e=>`\\${e}`)).join("|");return new RegExp(`^[+-]?\\s*(((${n})?\\d+((${n})\\d+)?(e[+-]?\\d+)?)|(0x[a-f\\d]+))$`,"i").test(e.trim())}return"object"===n&&!(!e||"number"!=typeof e.valueOf()||e instanceof Date)}function RJ(e){return TJ(e,[","])}function EJ(e,t,n){let r=-1;for("function"==typeof t?(n=t,t=e):r=e-1;++r<=t&&!1!==n(r););}function MJ(e,t,n){let r=e+1;for("function"==typeof t&&(n=t,t=0);--r>=t&&!1!==n(r););}new RegExp(Object.keys({" ":" ","&":"&","<":"<",">":">"}).map((e=>`(${e})`)).join("|"),"gi");const PJ="asc",AJ=new Map([[PJ,[-1,1]],["desc",[1,-1]]]),$J=e=>`The priority '${e}' is already declared in a map.`,zJ=e=>`The priority '${e}' is not a number.`,QJ=e=>`The id '${e}' is already declared in a map.`;function IJ(){let{errorIdExists:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=new Map;function n(){return[...t]}function r(e){return t.has(e)}return e=_K(e)?e:QJ,{addItem:function(n,i){if(r(n))throw new Error(e(n));t.set(n,i)},clear:function(){t.clear()},getId:function(e){const[t]=n().find((t=>{let[n,r]=t;return e===r&&n}))||[null];return t},getItem:function(e){return t.get(e)},getItems:n,hasItem:r,removeItem:function(e){return t.delete(e)}}}const NJ=e=>`'${e}' value is already declared in a unique set.`,DJ=e=>`There is already registered "${e}" plugin.`,WJ=function(){let{errorPriorityExists:e,errorPriorityNaN:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new Map;return e=_K(e)?e:$J,t=_K(t)?t:zJ,{addItem:function(r,i){if(!TJ(r))throw new Error(t(r));if(n.has(r))throw new Error(e(r));n.set(r,i)},getItems:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:PJ;const[t,r]=AJ.get(e)||AJ.get(PJ);return[...n].sort(((e,n)=>e[0]e[1]))}}}({errorPriorityExists:e=>`There is already registered plugin on priority "${e}".`,errorPriorityNaN:e=>`The priority "${e}" is not a number.`}),LJ=function(){let{errorItemExists:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=new Set;return e=_K(e)?e:NJ,{addItem:function(n){if(t.has(n))throw new Error(e(n));t.add(n)},clear:function(){t.clear()},getItems:function(){return[...t]}}}({errorItemExists:DJ}),HJ=IJ({errorIdExists:DJ});const{register:VJ,getItem:BJ,hasItem:jJ,getNames:ZJ,getValues:XJ}=cJ("renderers");function FJ(e){if("function"==typeof e)return e;if(!jJ(e))throw Error(`No registered renderer found under "${e}" name`);return BJ(e)}const{register:YJ,getItem:qJ,hasItem:UJ,getNames:GJ,getValues:KJ}=cJ("validators"),JJ=new WeakMap,e0=class{constructor(e,t,n,r,i,o){let s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null;this.wtSettings=n,this.domBindings=t,this.wtTable=i,this.selections=o,this.parent=s,this.eventManager=r,this.facadeGetter=e,JJ.set(this,{selectedCellBeforeTouchEnd:void 0,dblClickTimeout:[null,null],dblClickOrigin:[null,null]}),this.registerEvents()}registerEvents(){this.eventManager.addEventListener(this.wtTable.holder,"contextmenu",(e=>this.onContextMenu(e))),this.eventManager.addEventListener(this.wtTable.TABLE,"mouseover",(e=>this.onMouseOver(e))),this.eventManager.addEventListener(this.wtTable.TABLE,"mouseout",(e=>this.onMouseOut(e)));const e=()=>{this.eventManager.addEventListener(this.wtTable.holder,"touchstart",(e=>this.onTouchStart(e))),this.eventManager.addEventListener(this.wtTable.holder,"touchend",(e=>this.onTouchEnd(e))),this.momentumScrolling||(this.momentumScrolling={}),this.eventManager.addEventListener(this.wtTable.holder,"scroll",(()=>{clearTimeout(this.momentumScrolling._timeout),this.momentumScrolling.ongoing||this.wtSettings.getSetting("onBeforeTouchScroll"),this.momentumScrolling.ongoing=!0,this.momentumScrolling._timeout=setTimeout((()=>{this.touchApplied||(this.momentumScrolling.ongoing=!1,this.wtSettings.getSetting("onAfterMomentumScroll"))}),200)}))};ZK()?e():("ontouchstart"in window&&e(),(()=>{this.eventManager.addEventListener(this.wtTable.holder,"mouseup",(e=>this.onMouseUp(e))),this.eventManager.addEventListener(this.wtTable.holder,"mousedown",(e=>this.onMouseDown(e)))})())}selectedCellWasTouched(e){const t=JJ.get(this),n=this.parentCell(e).coords;if(t.selectedCellBeforeTouchEnd&&n){const[e,r]=[n.row,t.selectedCellBeforeTouchEnd.from.row],[i,o]=[n.col,t.selectedCellBeforeTouchEnd.from.col];return e===r&&i===o}return!1}parentCell(e){const t={},n=xG(e,["TD","TH"],this.wtTable.TABLE);return n?(t.coords=this.wtTable.getCoords(n),t.TD=n):_G(e,"wtBorder")&&_G(e,"current")?(t.coords=this.selections.getCell().cellRange.highlight,t.TD=this.wtTable.getCell(t.coords)):_G(e,"wtBorder")&&_G(e,"area")&&this.selections.createOrGetArea().cellRange&&(t.coords=this.selections.createOrGetArea().cellRange.to,t.TD=this.wtTable.getCell(t.coords)),t}onMouseDown(e){const t=JJ.get(this),n=this.domBindings.rootDocument.activeElement,r=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{t.dblClickOrigin[0]=null}),1e3))}onContextMenu(e){if(this.wtSettings.has("onCellContextMenu")){const t=this.parentCell(e.target);t.TD&&this.callListener("onCellContextMenu",e,t.coords,t.TD)}}onMouseOver(e){if(!this.wtSettings.has("onCellMouseOver"))return;const t=this.wtTable.TABLE,n=xG(e.target,["TD","TH"],t),r=this.parent||this;n&&n!==r.lastMouseOver&&SG(n,t)&&(r.lastMouseOver=n,this.callListener("onCellMouseOver",e,this.wtTable.getCoords(n),n))}onMouseOut(e){if(!this.wtSettings.has("onCellMouseOut"))return;const t=this.wtTable.TABLE,n=xG(e.target,["TD","TH"],t),r=xG(e.relatedTarget,["TD","TH"],t),i=this.parent||this;n&&n!==r&&SG(n,t)&&(this.callListener("onCellMouseOut",e,this.wtTable.getCoords(n),n),null===r&&(i.lastMouseOver=null))}onMouseUp(e){const t=JJ.get(this),n=this.parentCell(e.target);n.TD&&this.wtSettings.has("onCellMouseUp")&&this.callListener("onCellMouseUp",e,n.coords,n.TD),(0===e.button||this.touchApplied)&&(n.TD===t.dblClickOrigin[0]&&n.TD===t.dblClickOrigin[1]?(_G(e.target,"corner")?this.callListener("onCellCornerDblClick",e,n.coords,n.TD):this.callListener("onCellDblClick",e,n.coords,n.TD),t.dblClickOrigin[0]=null,t.dblClickOrigin[1]=null):n.TD===t.dblClickOrigin[0]&&(t.dblClickOrigin[1]=n.TD,clearTimeout(t.dblClickTimeout[1]),t.dblClickTimeout[1]=setTimeout((()=>{t.dblClickOrigin[1]=null}),500)))}onTouchStart(e){JJ.get(this).selectedCellBeforeTouchEnd=this.selections.getCell().cellRange,this.touchApplied=!0,this.onMouseDown(e)}onTouchEnd(e){var t;const n=e.target,r=null===(t=this.parentCell(n))||void 0===t?void 0:t.coords,i=dK(r)&&r.row>=0&&r.col>=0;if(e.cancelable&&i&&this.wtSettings.getSetting("isDataViewInstance")){const t=["A","BUTTON","INPUT"];XK()&&(VK.chromeWebKit.value||VK.firefoxWebKit.value)&&this.selectedCellWasTouched(n)&&!t.includes(n.tagName)?e.preventDefault():this.selectedCellWasTouched(n)||e.preventDefault()}this.onMouseUp(e),this.touchApplied=!1}callListener(e,t,n,r){const i=this.wtSettings.getSettingPure(e);i&&i(t,n,r,this.facadeGetter())}destroy(){const e=JJ.get(this);clearTimeout(e.dblClickTimeout[0]),clearTimeout(e.dblClickTimeout[1]),this.eventManager.destroy()}},t0=class{constructor(e,t,n){this.offset=e,this.total=t,this.countTH=n}offsetted(e){return e+this.offset}unOffsetted(e){return e-this.offset}renderedToSource(e){return this.offsetted(e)}sourceToRendered(e){return this.unOffsetted(e)}offsettedTH(e){return e-this.countTH}unOffsettedTH(e){return e+this.countTH}visibleRowHeadedColumnToSourceColumn(e){return this.renderedToSource(this.offsettedTH(e))}sourceColumnToVisibleRowHeadedColumn(e){return this.unOffsettedTH(this.sourceToRendered(e))}},n0=class{constructor(e,t,n){this.offset=e,this.total=t,this.countTH=n}offsetted(e){return e+this.offset}unOffsetted(e){return e-this.offset}renderedToSource(e){return this.offsetted(e)}sourceToRendered(e){return this.unOffsetted(e)}offsettedTH(e){return e-this.countTH}unOffsettedTH(e){return e+this.countTH}visibleColHeadedRowToSourceRow(e){return this.renderedToSource(this.offsettedTH(e))}sourceRowToVisibleColHeadedRow(e){return this.unOffsettedTH(this.sourceToRendered(e))}};class r0{constructor(){this.currentSize=0,this.nextSize=0,this.currentOffset=0,this.nextOffset=0}setSize(e){this.currentSize=this.nextSize,this.nextSize=e}setOffset(e){this.currentOffset=this.nextOffset,this.nextOffset=e}}class i0{constructor(){this.size=new r0,this.workingSpace=0,this.sharedSize=null}setSize(e){this.size.setSize(e)}setOffset(e){this.size.setOffset(e)}getViewSize(){return this.size}isShared(){return this.sharedSize instanceof r0}isPlaceOn(e){return this.workingSpace===e}append(e){this.workingSpace=1,e.workingSpace=2,this.sharedSize=e.getViewSize()}prepend(e){this.workingSpace=2,e.workingSpace=1,this.sharedSize=e.getViewSize()}}class o0{constructor(e,t,n){this.rootNode=e,this.nodesPool=t,this.sizeSet=new i0,this.childNodeType=n.toUpperCase(),this.visualIndex=0,this.collectedNodes=[]}setSize(e){return this.sizeSet.setSize(e),this}setOffset(e){return this.sizeSet.setOffset(e),this}isSharedViewSet(){return this.sizeSet.isShared()}getNode(e){return e0?this.collectedNodes[e-1]:null}getRenderedChildCount(){const{rootNode:e,sizeSet:t}=this;let n=0;if(this.isSharedViewSet()){let r=e.firstElementChild;for(;r;){if(r.tagName===this.childNodeType)n+=1;else if(t.isPlaceOn(1))break;r=r.nextElementSibling}}else n=e.childElementCount;return n}start(){this.collectedNodes.length=0,this.visualIndex=0;const{rootNode:e,sizeSet:t}=this,n=this.isSharedViewSet(),{nextSize:r}=t.getViewSize();let i=this.getRenderedChildCount();for(;ir;)e.removeChild(o?e.firstChild:e.lastChild),i-=1}render(){const{rootNode:e,sizeSet:t}=this;let n=this.visualIndex;this.isSharedViewSet()&&t.isPlaceOn(2)&&(n+=t.sharedSize.nextSize);let r=e.childNodes[n];if(r.tagName!==this.childNodeType){const t=this.nodesPool();e.replaceChild(t,r),r=t}this.collectedNodes.push(r),this.visualIndex+=1}end(){}}class s0 extends o0{prependView(e){return this.sizeSet.prepend(e.sizeSet),e.sizeSet.append(this.sizeSet),this}appendView(e){return this.sizeSet.append(e.sizeSet),e.sizeSet.prepend(this.sizeSet),this}}class a0{constructor(e){this.nodeType=e.toUpperCase()}setRootDocument(e){this.rootDocument=e}obtain(){return this.rootDocument.createElement(this.nodeType)}}class l0{constructor(e,t){this.nodesPool="string"==typeof e?new a0(e):null,this.nodeType=e,this.rootNode=t,this.table=null,this.renderedNodes=0}setTable(e){this.nodesPool&&this.nodesPool.setRootDocument(e.rootDocument),this.table=e}adjust(){}render(){}}class c0 extends l0{constructor(){super("TH"),this.orderViews=new WeakMap,this.sourceRowIndex=0}obtainOrderView(e){let t;return this.orderViews.has(e)?t=this.orderViews.get(e):(t=new s0(e,(e=>this.nodesPool.obtain(this.sourceRowIndex,e)),this.nodeType),this.orderViews.set(e,t)),t}render(){const{rowsToRender:e,rowHeaderFunctions:t,rowHeadersCount:n,rows:r,cells:i}=this.table;for(let o=0;oi;)n.removeChild(n.lastChild),this.renderedNodes-=1}const o=this.rootNode.childNodes.length;if(o>e)for(let t=e;tn;)this.rootNode.removeChild(this.rootNode.lastChild),this.renderedNodes-=1}render(){this.adjust();const{columnsToRender:e,rowHeadersCount:t}=this.table;for(let e=0;ethis.nodesPool.obtain(e)),this.nodeType)}getRenderedNode(e){return this.orderView.getNode(e)}render(){const{rowsToRender:e}=this.table;!d0&&e>1e3&&(d0=!0,eJ(hK`Performance tip: Handsontable rendered more than 1000 visible rows. Consider limiting\x20 the number of rendered rows by specifying the table height and/or turning off the "renderAllRows" option.`)),this.orderView.setSize(e).setOffset(this.table.renderedRowToSource(0)).start();for(let t=0;tthis.nodesPool.obtain(this.sourceRowIndex,e)),this.nodeType),this.orderViews.set(e,t)),t}render(){const{rowsToRender:e,columnsToRender:t,rows:n,rowHeaders:r}=this.table;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:{};this.rootNode=e,this.rootDocument=this.rootNode.ownerDocument,this.rowHeaders=null,this.columnHeaders=null,this.colGroup=null,this.rows=null,this.cells=null,this.rowFilter=null,this.columnFilter=null,this.rowUtils=null,this.columnUtils=null,this.rowsToRender=0,this.columnsToRender=0,this.rowHeaderFunctions=[],this.rowHeadersCount=0,this.columnHeaderFunctions=[],this.columnHeadersCount=0,this.cellRenderer=t}setAxisUtils(e,t){this.rowUtils=e,this.columnUtils=t}setViewportSize(e,t){this.rowsToRender=e,this.columnsToRender=t}setFilters(e,t){this.rowFilter=e,this.columnFilter=t}setHeaderContentRenderers(e,t){this.rowHeaderFunctions=e,this.rowHeadersCount=e.length,this.columnHeaderFunctions=t,this.columnHeadersCount=t.length}setRenderers(){let{rowHeaders:e,columnHeaders:t,colGroup:n,rows:r,cells:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.setTable(this),t.setTable(this),n.setTable(this),r.setTable(this),i.setTable(this),this.rowHeaders=e,this.columnHeaders=t,this.colGroup=n,this.rows=r,this.cells=i}renderedRowToSource(e){return this.rowFilter.renderedToSource(e)}renderedColumnToSource(e){return this.columnFilter.renderedToSource(e)}render(){this.colGroup.adjust(),this.columnHeaders.adjust(),this.rows.adjust(),this.rowHeaders.adjust(),this.columnHeaders.render(),this.rows.render(),this.rowHeaders.render(),this.cells.render(),this.columnUtils.calculateWidths(),this.colGroup.render();const{rowsToRender:e,rows:t}=this;for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:{};this.renderer=new g0(e,{cellRenderer:s}),this.renderer.setRenderers({rowHeaders:new c0,columnHeaders:new h0(t),colGroup:new u0(n),rows:new f0(r),cells:new p0}),this.renderer.setAxisUtils(i,o)}setFilters(e,t){return this.renderer.setFilters(e,t),this}setViewportSize(e,t){return this.renderer.setViewportSize(e,t),this}setHeaderContentRenderers(e,t){return this.renderer.setHeaderContentRenderers(e,t),this}adjust(){this.renderer.adjust()}render(){this.renderer.render()}}class b0{constructor(e,t){this.dataAccessObject=e,this.wtSettings=t,this.headerWidths=new Map}getWidth(e){return this.wtSettings.getSetting("columnWidth",e)||this.wtSettings.getSetting("defaultColumnWidth")}getStretchedColumnWidth(e){const t=this.dataAccessObject.wtViewport.columnsRenderCalculator;let n=this.getWidth(e);if(t){const r=t.getStretchedColumnWidth(e,n);r&&(n=r)}return n}getHeaderHeight(e){let t=this.wtSettings.getSetting("defaultRowHeight");const n=this.dataAccessObject.wtViewport.oversizedColumnHeaders[e];return void 0!==n&&(t=t?Math.max(t,n):n),t}getHeaderWidth(e){return this.headerWidths.get(this.dataAccessObject.wtTable.columnFilter.sourceToRendered(e))}calculateWidths(){const{wtSettings:e}=this,{wtTable:t,wtViewport:n,cloneSource:r}=this.dataAccessObject,i=r?r.wtTable.holder:t.holder,o=i.offsetHeightthis._modifyRowHeaderWidth(o))),this.rowUtils=new v0(this.dataAccessObject,this.wtSettings),this.columnUtils=new b0(this.dataAccessObject,this.wtSettings),this.tableRenderer=new m0({TABLE:this.TABLE,THEAD:this.THEAD,COLGROUP:this.COLGROUP,TBODY:this.TBODY,rowUtils:this.rowUtils,columnUtils:this.columnUtils,cellRenderer:this.wtSettings.getSettingPure("cellRenderer")})}is(e){return this.name===e}fixTableDomTree(){const e=this.domBindings.rootDocument;this.TBODY=this.TABLE.querySelector("tbody"),this.TBODY||(this.TBODY=e.createElement("tbody"),this.TABLE.appendChild(this.TBODY)),this.THEAD=this.TABLE.querySelector("thead"),this.THEAD||(this.THEAD=e.createElement("thead"),this.TABLE.insertBefore(this.THEAD,this.TBODY)),this.COLGROUP=this.TABLE.querySelector("colgroup"),this.COLGROUP||(this.COLGROUP=e.createElement("colgroup"),this.TABLE.insertBefore(this.COLGROUP,this.THEAD))}createSpreader(e){const t=e.parentNode;let n;return t&&t.nodeType===Node.ELEMENT_NODE&&_G(t,"wtHolder")||(n=this.domBindings.rootDocument.createElement("div"),n.className="wtSpreader",t&&t.insertBefore(n,e),n.appendChild(e)),n.style.position="relative",n}createHider(e){const t=e.parentNode;let n;return t&&t.nodeType===Node.ELEMENT_NODE&&_G(t,"wtHolder")||(n=this.domBindings.rootDocument.createElement("div"),n.className="wtHider",t&&t.insertBefore(n,e),n.appendChild(e)),n}createHolder(e){const t=e.parentNode;let n;return t&&t.nodeType===Node.ELEMENT_NODE&&_G(t,"wtHolder")||(n=this.domBindings.rootDocument.createElement("div"),n.style.position="relative",n.className="wtHolder",t&&t.insertBefore(n,e),this.isMaster&&(n.parentNode.className+="ht_master handsontable",n.parentNode.setAttribute("dir",this.wtSettings.getSettingPure("rtlMode")?"rtl":"ltr")),n.appendChild(e)),n}draw(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{wtSettings:t}=this,{wtOverlays:n,wtViewport:r}=this.dataAccessObject,i=t.getSetting("totalRows"),o=t.getSetting("totalColumns"),s=t.getSetting("rowHeaders"),a=s.length,l=t.getSetting("columnHeaders"),c=l.length;let h=!1,u=e;if(this.isMaster&&(this.holderOffset=zG(this.holder),u=r.createRenderCalculators(u),a&&!t.getSetting("fixedColumnsStart"))){const e=n.inlineStartOverlay.getScrollPosition(),t=this.correctHeaderWidth;this.correctHeaderWidth=0!==e,t!==this.correctHeaderWidth&&(u=!1)}if(this.isMaster&&(h=n.updateStateOfRendering()),u)this.isMaster&&r.createVisibleCalculators(),n&&n.refresh(!0);else{this.isMaster?this.tableOffset=zG(this.TABLE):this.tableOffset=this.dataAccessObject.parentTableOffset;const e=i>0?this.getFirstRenderedRow():0,t=o>0?this.getFirstRenderedColumn():0;this.rowFilter=new n0(e,i,c),this.columnFilter=new t0(t,o,a);let n=!0;if(this.isMaster){this.alignOverlaysWithTrimmingContainer();const e={};this.wtSettings.getSetting("beforeDraw",!0,e),n=!0!==e.skipRender}if(n){let e;if(this.tableRenderer.setHeaderContentRenderers(s,l),(this.is(O0)||this.is(S0))&&this.tableRenderer.setHeaderContentRenderers(s,[]),this.resetOversizedRows(),this.tableRenderer.setViewportSize(this.getRenderedRowsCount(),this.getRenderedColumnsCount()).setFilters(this.rowFilter,this.columnFilter).render(),this.isMaster&&(e=this.dataAccessObject.workspaceWidth,this.dataAccessObject.wtViewport.containerWidth=null,this.markOversizedColumnHeaders()),this.adjustColumnHeaderHeights(),(this.isMaster||this.is(O0))&&this.markOversizedRows(),this.isMaster){this.dataAccessObject.wtViewport.createVisibleCalculators(),this.dataAccessObject.wtOverlays.refresh(!1),this.dataAccessObject.wtOverlays.applyToDOM();const t=BG(this.hider),n=BG(this.TABLE);0!==t&&n!==t&&(this.columnUtils.calculateWidths(),this.tableRenderer.renderer.colGroup.render()),e!==this.dataAccessObject.wtViewport.getWorkspaceWidth()&&(this.dataAccessObject.wtViewport.containerWidth=null,this.columnUtils.calculateWidths(),this.tableRenderer.renderer.colGroup.render()),this.wtSettings.getSetting("onDraw",!0)}else this.is(O0)&&this.dataAccessObject.cloneSource.wtOverlays.adjustElementsSize()}}let d=!1;return this.isMaster&&(d=n.topOverlay.resetFixedPosition(),n.bottomOverlay.clone&&(d=n.bottomOverlay.resetFixedPosition()||d),d=n.inlineStartOverlay.resetFixedPosition()||d,n.topInlineStartCornerOverlay&&n.topInlineStartCornerOverlay.resetFixedPosition(),n.bottomInlineStartCornerOverlay&&n.bottomInlineStartCornerOverlay.clone&&n.bottomInlineStartCornerOverlay.resetFixedPosition()),d?(n.refreshAll(),n.adjustElementsSize()):this.refreshSelections(u),h&&n.syncScrollWithMaster(),this.dataAccessObject.drawn=!0,this}markIfOversizedColumnHeader(e){const t=this.columnFilter.renderedToSource(e);let n=this.wtSettings.getSetting("columnHeaders").length;const r=this.wtSettings.getSetting("defaultRowHeight");let i,o,s;const a=this.wtSettings.getSetting("columnHeaderHeight")||[];for(;n;)n-=1,i=this.getColumnHeaderHeight(n),o=this.getColumnHeader(t,n),o&&(s=ZG(o),(!i&&r=0)throw new Error("TR was expected to be rendered but is not");const o=i.childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(n)];if(!o&&n>=0)throw new Error("TD or TH was expected to be rendered but is not");return o}getRow(e){let t=null,n=null;var r,i;return e<0?(t=null===(r=this.rowFilter)||void 0===r?void 0:r.sourceRowToVisibleColHeadedRow(e),n=this.THEAD):(t=null===(i=this.rowFilter)||void 0===i?void 0:i.sourceToRendered(e),n=this.TBODY),void 0!==t&&void 0!==n&&!(n.childNodes.length1&&void 0!==arguments[1]?arguments[1]:0;const n=this.THEAD.childNodes[t];return null==n?void 0:n.childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(e)]}getColumnHeaders(e){const t=[],n=this.columnFilter.sourceColumnToVisibleRowHeadedColumn(e);return this.THEAD.childNodes.forEach((e=>{const r=e.childNodes[n];r&&t.push(r)})),t}getRowHeader(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0===this.columnFilter.sourceColumnToVisibleRowHeadedColumn(0))return;if(t>=this.wtSettings.getSetting("rowHeaders").length)return;const n=this.TBODY.childNodes[this.rowFilter.sourceToRendered(e)];return null==n?void 0:n.childNodes[t]}getRowHeaders(e){if(0===this.columnFilter.sourceColumnToVisibleRowHeadedColumn(0))return[];const t=[],n=this.wtSettings.getSetting("rowHeaders").length;for(let r=0;r=0)return!1;const t=this.wtSettings.getSetting("rowHeaders").length;return Math.abs(e)<=t}isRowHeaderRendered(e){if(e>=0)return!1;const t=this.wtSettings.getSetting("columnHeaders").length;return Math.abs(e)<=t}isRowBeforeRenderedRows(e){const t=this.getFirstRenderedRow();return e<0&&t<=0?!this.isRowHeaderRendered(e):ethis.getLastRenderedRow()}isColumnBeforeRenderedColumns(e){const t=this.getFirstRenderedColumn();return e<0&&t<=0?!this.isColumnHeaderRendered(e):ethis.getLastRenderedColumn()}isColumnAfterViewport(e){return this.columnFilter&&e>this.getLastVisibleColumn()}isRowAfterViewport(e){return this.rowFilter&&e>this.getLastVisibleRow()}isColumnBeforeViewport(e){return this.columnFilter&&this.columnFilter.sourceToRendered(e)<0&&e>=0}isLastRowFullyVisible(){return this.getLastVisibleRow()===this.getLastRenderedRow()}isLastColumnFullyVisible(){return this.getLastVisibleColumn()===this.getLastRenderedColumn()}allRowsInViewport(){return this.wtSettings.getSetting("totalRows")===this.getVisibleRowsCount()}allColumnsInViewport(){return this.wtSettings.getSetting("totalColumns")===this.getVisibleColumnsCount()}getRowHeight(e){return this.rowUtils.getHeight(e)}getColumnHeaderHeight(e){return this.columnUtils.getHeaderHeight(e)}getColumnWidth(e){return this.columnUtils.getWidth(e)}getStretchedColumnWidth(e){return this.columnUtils.getStretchedColumnWidth(e)}hasDefinedSize(){return this.hasTableHeight&&this.hasTableWidth}getWidth(){return BG(this.TABLE)}getHeight(){return jG(this.TABLE)}getTotalWidth(){const e=BG(this.hider);return 0!==e?e:this.getWidth()}getTotalHeight(){const e=jG(this.hider);return 0!==e?e:this.getHeight()}isVisible(){return $G(this.TABLE)}_modifyRowHeaderWidth(e){let t=_K(e)?e():null;return Array.isArray(t)?(t=[...t],t[t.length-1]=this._correctRowHeaderWidth(t[t.length-1])):t=this._correctRowHeaderWidth(t),t}_correctRowHeaderWidth(e){let t=e;return"number"!=typeof e&&(t=this.wtSettings.getSetting("defaultColumnWidth")),this.correctHeaderWidth&&(t+=1),t}},R0={getFirstRenderedRow(){return 0===this.wtSettings.getSetting("totalRows")?-1:0},getFirstVisibleRow(){return this.getFirstRenderedRow()},getLastRenderedRow(){return this.getRenderedRowsCount()-1},getLastVisibleRow(){return this.getLastRenderedRow()},getRenderedRowsCount(){const e=this.wtSettings.getSetting("totalRows");return Math.min(this.wtSettings.getSetting("fixedRowsTop"),e)},getVisibleRowsCount(){return this.getRenderedRowsCount()}};QK(R0,"MIXIN_NAME","stickyRowsTop",{writable:!1,enumerable:!1});const E0=R0,M0={getFirstRenderedColumn(){const e=this.dataAccessObject.startColumnRendered;return null===e?-1:e},getFirstVisibleColumn(){const e=this.dataAccessObject.startColumnVisible;return null===e?-1:e},getLastRenderedColumn(){const e=this.dataAccessObject.endColumnRendered;return null===e?-1:e},getLastVisibleColumn(){const e=this.dataAccessObject.endColumnVisible;return null===e?-1:e},getRenderedColumnsCount(){return this.dataAccessObject.countColumnsRendered},getVisibleColumnsCount(){return this.dataAccessObject.countColumnsVisible}};QK(M0,"MIXIN_NAME","calculatedColumns",{writable:!1,enumerable:!1});const P0=M0;class A0 extends T0{constructor(e,t,n,r){super(e,t,n,r,y0)}}AK(A0,E0),AK(A0,P0);const $0=A0;function z0(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Q0=class{constructor(e){z0(this,"dataAccessObject",void 0),z0(this,"lastScrolledColumnPos",-1),z0(this,"lastScrolledRowPos",-1),this.dataAccessObject=e}scrollViewport(e,t,n,r,i){const o=this.scrollViewportHorizontally(e.col,n,i),s=this.scrollViewportVertically(e.row,t,r);return o||s}scrollViewportHorizontally(e,t,n){const{drawn:r,totalColumns:i}=this.dataAccessObject;if(!r||!Number.isInteger(e)||e<0||e>i)return!1;const o=this.getFirstVisibleColumn(),s=this.getLastVisibleColumn(),a=void 0===t&&void 0===n,{fixedColumnsStart:l,inlineStartOverlay:c}=this.dataAccessObject;if(a&&ethis.lastScrolledColumnPos:t):(a&&(es)||!a)&&(h=c.scrollTo(e,a?e>s:t)),h&&(this.lastScrolledColumnPos=e),h}scrollViewportVertically(e,t,n){const{drawn:r,totalRows:i}=this.dataAccessObject;if(!r||!Number.isInteger(e)||e<0||e>i)return!1;const o=this.getFirstVisibleRow(),s=this.getLastVisibleRow(),a=void 0===t&&void 0===n,{fixedRowsBottom:l,fixedRowsTop:c,topOverlay:h}=this.dataAccessObject;if(a&&(ei-l-1))return!1;let u=!1;return-1===o?u=h.scrollTo(e,a?e>this.lastScrolledRowPos:n):(a&&(es)||!a)&&(u=h.scrollTo(e,a?e>s:n)),u&&(this.lastScrolledRowPos=e),u}getFirstVisibleRow(){const{topOverlay:e,wtTable:t,wtViewport:n,totalRows:r,fixedRowsTop:i,rootWindow:o}=this.dataAccessObject;let s=t.getFirstVisibleRow();if(e.mainTableScrollableElement===o){const a=zG(t.wtRootElement),l=ZG(t.hider),c=ZG(o),h=NG(o,o);if(a.top+l-c<=h){let t=n.getColumnHeaderHeight();t+=e.sumCellSizes(0,i);for(let n=r;n>0;n--)if(t+=e.sumCellSizes(n-1,n),a.top+l-t<=h){s=n;break}}}return s}getLastVisibleRow(){const{topOverlay:e,wtTable:t,wtViewport:n,totalRows:r,rootWindow:i}=this.dataAccessObject;let o=t.getLastVisibleRow();if(e.mainTableScrollableElement===i){const s=zG(t.wtRootElement),a=NG(i,i);if(s.top>a){const t=ZG(i);let l=n.getColumnHeaderHeight();for(let n=1;n<=r;n++)if(l+=e.sumCellSizes(n-1,n),s.top+l-a>=t){o=n-2;break}}}return o}getFirstVisibleColumn(){const{inlineStartOverlay:e,wtTable:t,wtViewport:n,totalColumns:r,rootWindow:i}=this.dataAccessObject;let o=t.getFirstVisibleColumn();if(e.mainTableScrollableElement===i){const s=zG(t.wtRootElement),a=XG(t.hider),l=XG(i),c=Math.abs(DG(i,i));if(s.left+a-l<=c){let t=n.getRowHeaderWidth();for(let n=r;n>0;n--)if(t+=e.sumCellSizes(n-1,n),s.left+a-t<=c){o=n;break}}}return o}getLastVisibleColumn(){const{wtSettings:e,inlineStartOverlay:t,wtTable:n,wtViewport:r,totalColumns:i,rootWindow:o}=this.dataAccessObject;let s=n.getLastVisibleColumn();if(t.mainTableScrollableElement===o){let a=null;if(e.getSetting("rtlMode")){const e=n.TABLE.getBoundingClientRect(),t=this.dataAccessObject.rootWindow.document.documentElement.offsetWidth;a=Math.abs(e.right-t)}else a=zG(n.wtRootElement).left;const l=Math.abs(DG(o,o));if(a>l){const e=XG(o);let n=r.getRowHeaderWidth();for(let r=1;r<=i;r++)if(n+=t.sumCellSizes(r-1,r),a+n-l>=e){s=r-2;break}}}return s}};function I0(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function N0(e,t){return function(e,t){return t.get?t.get.call(e):t.value}(e,D0(e,t,"get"))}function D0(e,t,n){if(!t.has(e))throw new TypeError("attempted to "+n+" private field on non-instance");return t.get(e)}var W0=new WeakMap;class L0{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];I0(this,"row",null),I0(this,"col",null),function(e,t,n){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,n)}(this,W0,{writable:!0,value:!1}),function(e,t,n){(function(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=n}})(e,D0(e,t,"set"),n)}(this,W0,n),void 0!==e&&void 0!==t&&(this.row=e,this.col=t)}isValid(e){return!(this.row<0||this.col<0||this.row>=e.getSetting("totalRows")||this.col>=e.getSetting("totalColumns"))}isEqual(e){return e===this||this.row===e.row&&this.col===e.col}isSouthEastOf(e){return this.row>=e.row&&(N0(this,W0)?this.col<=e.col:this.col>=e.col)}isNorthWestOf(e){return this.row<=e.row&&(N0(this,W0)?this.col>=e.col:this.col<=e.col)}isSouthWestOf(e){return this.row>=e.row&&(N0(this,W0)?this.col>=e.col:this.col<=e.col)}isNorthEastOf(e){return this.row<=e.row&&(N0(this,W0)?this.col<=e.col:this.col>=e.col)}normalize(){return this.row=null===this.row?this.row:Math.max(this.row,0),this.col=null===this.col?this.col:Math.max(this.col,0),this}clone(){return new L0(this.row,this.col,N0(this,W0))}toObject(){return{row:this.row,col:this.col}}}const H0=L0;function V0(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function B0(e,t){return function(e,t){return t.get?t.get.call(e):t.value}(e,j0(e,t,"get"))}function j0(e,t,n){if(!t.has(e))throw new TypeError("attempted to "+n+" private field on non-instance");return t.get(e)}var Z0=new WeakMap;class X0{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];V0(this,"highlight",null),V0(this,"from",null),V0(this,"to",null),function(e,t,n){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,n)}(this,Z0,{writable:!0,value:!1}),this.highlight=e.clone().normalize(),this.from=t.clone(),this.to=n.clone(),function(e,t,n){(function(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=n}})(e,j0(e,t,"set"),n)}(this,Z0,r)}setHighlight(e){return this.highlight=e.clone().normalize(),this}setFrom(e){return this.from=e.clone(),this}setTo(e){return this.to=e.clone(),this}isValid(e){return this.from.isValid(e)&&this.to.isValid(e)}isSingle(){return this.from.row>=0&&this.from.row===this.to.row&&this.from.col>=0&&this.from.col===this.to.col}getOuterHeight(){return Math.max(this.from.row,this.to.row)-Math.min(this.from.row,this.to.row)+1}getOuterWidth(){return Math.max(this.from.col,this.to.col)-Math.min(this.from.col,this.to.col)+1}getHeight(){if(this.from.row<0&&this.to.row<0)return 0;const e=Math.max(this.from.row,0),t=Math.max(this.to.row,0);return Math.max(e,t)-Math.min(e,t)+1}getWidth(){if(this.from.col<0&&this.to.col<0)return 0;const e=Math.max(this.from.col,0),t=Math.max(this.to.col,0);return Math.max(e,t)-Math.min(e,t)+1}getCellsCount(){return this.getWidth()*this.getHeight()}includes(e){const{row:t,col:n}=e,r=this.getOuterTopStartCorner(),i=this.getOuterBottomEndCorner();return r.row<=t&&i.row>=t&&r.col<=n&&i.col>=n}includesRange(e){return this.includes(e.getOuterTopStartCorner())&&this.includes(e.getOuterBottomEndCorner())}isEqual(e){return Math.min(this.from.row,this.to.row)===Math.min(e.from.row,e.to.row)&&Math.max(this.from.row,this.to.row)===Math.max(e.from.row,e.to.row)&&Math.min(this.from.col,this.to.col)===Math.min(e.from.col,e.to.col)&&Math.max(this.from.col,this.to.col)===Math.max(e.from.col,e.to.col)}overlaps(e){return e.isSouthEastOf(this.getOuterTopLeftCorner())&&e.isNorthWestOf(this.getOuterBottomRightCorner())}isSouthEastOf(e){return this.getOuterTopLeftCorner().isSouthEastOf(e)||this.getOuterBottomRightCorner().isSouthEastOf(e)}isNorthWestOf(e){return this.getOuterTopLeftCorner().isNorthWestOf(e)||this.getOuterBottomRightCorner().isNorthWestOf(e)}isOverlappingHorizontally(e){return this.getOuterTopRightCorner().col>=e.getOuterTopLeftCorner().col&&this.getOuterTopRightCorner().col<=e.getOuterTopRightCorner().col||this.getOuterTopLeftCorner().col<=e.getOuterTopRightCorner().col&&this.getOuterTopLeftCorner().col>=e.getOuterTopLeftCorner().col}isOverlappingVertically(e){return this.getOuterBottomRightCorner().row>=e.getOuterTopRightCorner().row&&this.getOuterBottomRightCorner().row<=e.getOuterBottomRightCorner().row||this.getOuterTopRightCorner().row<=e.getOuterBottomRightCorner().row&&this.getOuterTopRightCorner().row>=e.getOuterTopRightCorner().row}expand(e){const t=this.getOuterTopStartCorner(),n=this.getOuterBottomEndCorner();return(e.rown.row||e.col>n.col)&&(this.from=this._createCellCoords(Math.min(t.row,e.row),Math.min(t.col,e.col)),this.to=this._createCellCoords(Math.max(n.row,e.row),Math.max(n.col,e.col)),!0)}expandByRange(e){if(this.includesRange(e)||!this.overlaps(e))return!1;const t=this.getOuterTopStartCorner(),n=this.getOuterBottomEndCorner(),r=this.getDirection(),i=e.getOuterTopStartCorner(),o=e.getOuterBottomEndCorner(),s=Math.min(t.row,i.row),a=Math.min(t.col,i.col),l=Math.max(n.row,o.row),c=Math.max(n.col,o.col),h=this._createCellCoords(s,a),u=this._createCellCoords(l,c);return this.from=h,this.to=u,this.setDirection(r),this.highlight.row===this.getOuterBottomRightCorner().row&&"N-S"===this.getVerticalDirection()&&this.flipDirectionVertically(),this.highlight.col===this.getOuterTopRightCorner().col&&"W-E"===this.getHorizontalDirection()&&this.flipDirectionHorizontally(),!0}getDirection(){return this.from.isNorthWestOf(this.to)?"NW-SE":this.from.isNorthEastOf(this.to)?"NE-SW":this.from.isSouthEastOf(this.to)?"SE-NW":this.from.isSouthWestOf(this.to)?"SW-NE":void 0}setDirection(e){switch(e){case"NW-SE":[this.from,this.to]=[this.getOuterTopLeftCorner(),this.getOuterBottomRightCorner()];break;case"NE-SW":[this.from,this.to]=[this.getOuterTopRightCorner(),this.getOuterBottomLeftCorner()];break;case"SE-NW":[this.from,this.to]=[this.getOuterBottomRightCorner(),this.getOuterTopLeftCorner()];break;case"SW-NE":[this.from,this.to]=[this.getOuterBottomLeftCorner(),this.getOuterTopRightCorner()]}}getVerticalDirection(){return["NE-SW","NW-SE"].indexOf(this.getDirection())>-1?"N-S":"S-N"}getHorizontalDirection(){return["NW-SE","SW-NE"].indexOf(this.getDirection())>-1?"W-E":"E-W"}flipDirectionVertically(){switch(this.getDirection()){case"NW-SE":this.setDirection("SW-NE");break;case"NE-SW":this.setDirection("SE-NW");break;case"SE-NW":this.setDirection("NE-SW");break;case"SW-NE":this.setDirection("NW-SE")}}flipDirectionHorizontally(){switch(this.getDirection()){case"NW-SE":this.setDirection("NE-SW");break;case"NE-SW":this.setDirection("NW-SE");break;case"SE-NW":this.setDirection("SW-NE");break;case"SW-NE":this.setDirection("SE-NW")}}getTopStartCorner(){return this._createCellCoords(Math.min(this.from.row,this.to.row),Math.min(this.from.col,this.to.col)).normalize()}getTopLeftCorner(){return B0(this,Z0)?this.getTopEndCorner():this.getTopStartCorner()}getBottomEndCorner(){return this._createCellCoords(Math.max(this.from.row,this.to.row),Math.max(this.from.col,this.to.col)).normalize()}getBottomRightCorner(){return B0(this,Z0)?this.getBottomStartCorner():this.getBottomEndCorner()}getTopEndCorner(){return this._createCellCoords(Math.min(this.from.row,this.to.row),Math.max(this.from.col,this.to.col)).normalize()}getTopRightCorner(){return B0(this,Z0)?this.getTopStartCorner():this.getTopEndCorner()}getBottomStartCorner(){return this._createCellCoords(Math.max(this.from.row,this.to.row),Math.min(this.from.col,this.to.col)).normalize()}getBottomLeftCorner(){return B0(this,Z0)?this.getBottomEndCorner():this.getBottomStartCorner()}getOuterTopStartCorner(){return this._createCellCoords(Math.min(this.from.row,this.to.row),Math.min(this.from.col,this.to.col))}getOuterTopLeftCorner(){return B0(this,Z0)?this.getOuterTopEndCorner():this.getOuterTopStartCorner()}getOuterBottomEndCorner(){return this._createCellCoords(Math.max(this.from.row,this.to.row),Math.max(this.from.col,this.to.col))}getOuterBottomRightCorner(){return B0(this,Z0)?this.getOuterBottomStartCorner():this.getOuterBottomEndCorner()}getOuterTopEndCorner(){return this._createCellCoords(Math.min(this.from.row,this.to.row),Math.max(this.from.col,this.to.col))}getOuterTopRightCorner(){return B0(this,Z0)?this.getOuterTopStartCorner():this.getOuterTopEndCorner()}getOuterBottomStartCorner(){return this._createCellCoords(Math.max(this.from.row,this.to.row),Math.min(this.from.col,this.to.col))}getOuterBottomLeftCorner(){return B0(this,Z0)?this.getOuterBottomEndCorner():this.getOuterBottomStartCorner()}isCorner(e,t){return!!(t&&t.includes(e)&&(this.getOuterTopLeftCorner().isEqual(this._createCellCoords(t.from.row,t.from.col))||this.getOuterTopRightCorner().isEqual(this._createCellCoords(t.from.row,t.to.col))||this.getOuterBottomLeftCorner().isEqual(this._createCellCoords(t.to.row,t.from.col))||this.getOuterBottomRightCorner().isEqual(this._createCellCoords(t.to.row,t.to.col))))||e.isEqual(this.getOuterTopLeftCorner())||e.isEqual(this.getOuterTopRightCorner())||e.isEqual(this.getOuterBottomLeftCorner())||e.isEqual(this.getOuterBottomRightCorner())}getOppositeCorner(e,t){if(!(e instanceof H0))return!1;if(t){const{from:n,to:r}=t;if(t.includes(e)){if(this.getOuterTopStartCorner().isEqual(this._createCellCoords(n.row,n.col)))return this.getOuterBottomEndCorner();if(this.getOuterTopEndCorner().isEqual(this._createCellCoords(n.row,r.col)))return this.getOuterBottomStartCorner();if(this.getOuterBottomStartCorner().isEqual(this._createCellCoords(r.row,n.col)))return this.getOuterTopEndCorner();if(this.getOuterBottomEndCorner().isEqual(this._createCellCoords(r.row,r.col)))return this.getOuterTopStartCorner()}}return e.isEqual(this.getOuterBottomEndCorner())?this.getOuterTopStartCorner():e.isEqual(this.getOuterTopStartCorner())?this.getOuterBottomEndCorner():e.isEqual(this.getOuterTopEndCorner())?this.getOuterBottomStartCorner():e.isEqual(this.getOuterBottomStartCorner())?this.getOuterTopEndCorner():void 0}getBordersSharedWith(e){if(!this.includesRange(e))return[];const t=Math.min(this.from.row,this.to.row),n=Math.max(this.from.row,this.to.row),r=Math.min(this.from.col,this.to.col),i=Math.max(this.from.col,this.to.col),o=Math.min(e.from.row,e.to.row),s=Math.max(e.from.row,e.to.row),a=Math.min(e.from.col,e.to.col),l=Math.max(e.from.col,e.to.col),c=[];return t===o&&c.push("top"),i===l&&c.push("right"),n===s&&c.push("bottom"),r===a&&c.push("left"),c}getInner(){const e=this.getOuterTopStartCorner(),t=this.getOuterBottomEndCorner(),n=[];for(let r=e.row;r<=t.row;r++)for(let i=e.col;i<=t.col;i++)this.from.row===r&&this.from.col===i||this.to.row===r&&this.to.col===i||n.push(this._createCellCoords(r,i));return n}getAll(){const e=this.getOuterTopStartCorner(),t=this.getOuterBottomEndCorner(),n=[];for(let r=e.row;r<=t.row;r++)for(let i=e.col;i<=t.col;i++)e.row===r&&e.col===i?n.push(e):t.row===r&&t.col===i?n.push(t):n.push(this._createCellCoords(r,i));return n}forAll(e){const t=this.getOuterTopStartCorner(),n=this.getOuterBottomEndCorner();for(let r=t.row;r<=n.row;r++)for(let i=t.col;i<=n.col;i++)if(!1===e(r,i))return}clone(){return new X0(this.highlight,this.from,this.to,B0(this,Z0))}toObject(){return{from:this.from.toObject(),to:this.to.toObject()}}_createCellCoords(e,t){return new H0(e,t,B0(this,Z0))}}const F0=X0;function Y0(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class q0{get eventManager(){return new OJ(this)}constructor(e,t){Y0(this,"wtTable",void 0),Y0(this,"wtScroll",void 0),Y0(this,"wtViewport",void 0),Y0(this,"wtOverlays",void 0),Y0(this,"selections",void 0),Y0(this,"wtEvent",void 0),Y0(this,"guid",`wt_${vG()}`),Y0(this,"drawInterrupted",!1),Y0(this,"drawn",!1),Y0(this,"domBindings",void 0),Y0(this,"wtSettings",void 0),this.domBindings={rootTable:e,rootDocument:e.ownerDocument,rootWindow:e.ownerDocument.defaultView},this.wtSettings=t,this.wtScroll=new Q0(this.createScrollDao())}findOriginalHeaders(){const e=[];if(this.wtTable.THEAD.childNodes.length&&this.wtTable.THEAD.childNodes[0].childNodes.length){for(let t=0,n=this.wtTable.THEAD.childNodes[0].childNodes.length;t0&&void 0!==arguments[0]&&arguments[0];return this.drawInterrupted=!1,e||this.wtTable.isVisible()?this.wtTable.draw(e):this.drawInterrupted=!0,this}getCell(e){if(!(arguments.length>1&&void 0!==arguments[1]&&arguments[1]))return this.wtTable.getCell(e);const t=this.wtSettings.getSetting("totalRows"),n=this.wtSettings.getSetting("fixedRowsTop"),r=this.wtSettings.getSetting("fixedRowsBottom"),i=this.wtSettings.getSetting("fixedColumnsStart");if(e.row=t-r){if(this.wtOverlays.bottomInlineStartCornerOverlay&&this.wtOverlays.bottomInlineStartCornerOverlay.clone)return this.wtOverlays.bottomInlineStartCornerOverlay.clone.wtTable.getCell(e)}else{if(e.col=t-r&&this.wtOverlays.bottomOverlay&&this.wtOverlays.bottomOverlay.clone)return this.wtOverlays.bottomOverlay.clone.wtTable.getCell(e)}return this.wtTable.getCell(e)}scrollViewport(e,t,n,r,i){return!(e.col<0||e.row<0)&&this.wtScroll.scrollViewport(e,t,n,r,i)}scrollViewportHorizontally(e,t,n){return!(e<0)&&this.wtScroll.scrollViewportHorizontally(e,t,n)}scrollViewportVertically(e,t,n){return!(e<0)&&this.wtScroll.scrollViewportVertically(e,t,n)}getViewport(){return[this.wtTable.getFirstVisibleRow(),this.wtTable.getFirstVisibleColumn(),this.wtTable.getLastVisibleRow(),this.wtTable.getLastVisibleColumn()]}destroy(){this.wtOverlays.destroy(),this.wtEvent.destroy()}createScrollDao(){const e=this;return{get drawn(){return e.drawn},get topOverlay(){return e.wtOverlays.topOverlay},get inlineStartOverlay(){return e.wtOverlays.inlineStartOverlay},get wtTable(){return e.wtTable},get wtViewport(){return e.wtViewport},get wtSettings(){return e.wtSettings},get rootWindow(){return e.domBindings.rootWindow},get totalRows(){return e.wtSettings.getSetting("totalRows")},get totalColumns(){return e.wtSettings.getSetting("totalColumns")},get fixedRowsTop(){return e.wtSettings.getSetting("fixedRowsTop")},get fixedRowsBottom(){return e.wtSettings.getSetting("fixedRowsBottom")},get fixedColumnsStart(){return e.wtSettings.getSetting("fixedColumnsStart")}}}getTableDao(){const e=this;return{get wot(){return e},get parentTableOffset(){return e.cloneSource.wtTable.tableOffset},get cloneSource(){return e.cloneSource},get workspaceWidth(){return e.wtViewport.getWorkspaceWidth()},get wtViewport(){return e.wtViewport},get wtOverlays(){return e.wtOverlays},get selections(){return e.selections},get drawn(){return e.drawn},set drawn(t){e.drawn=t},get wtTable(){return e.wtTable},get startColumnRendered(){return e.wtViewport.columnsRenderCalculator.startColumn},get startColumnVisible(){return e.wtViewport.columnsVisibleCalculator.startColumn},get endColumnRendered(){return e.wtViewport.columnsRenderCalculator.endColumn},get endColumnVisible(){return e.wtViewport.columnsVisibleCalculator.endColumn},get countColumnsRendered(){return e.wtViewport.columnsRenderCalculator.count},get countColumnsVisible(){return e.wtViewport.columnsVisibleCalculator.count},get startRowRendered(){return e.wtViewport.rowsRenderCalculator.startRow},get startRowVisible(){return e.wtViewport.rowsVisibleCalculator.startRow},get endRowRendered(){return e.wtViewport.rowsRenderCalculator.endRow},get endRowVisible(){return e.wtViewport.rowsVisibleCalculator.endRow},get countRowsRendered(){return e.wtViewport.rowsRenderCalculator.count},get countRowsVisible(){return e.wtViewport.rowsVisibleCalculator.count}}}}function U0(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class G0 extends q0{constructor(e,t,n){super(e,t),U0(this,"cloneSource",void 0),U0(this,"cloneOverlay",void 0);const r=this.wtSettings.getSetting("facade",this);this.cloneSource=n.source,this.cloneOverlay=n.overlay,this.wtTable=this.cloneOverlay.createTable(this.getTableDao(),r,this.domBindings,this.wtSettings),this.wtViewport=n.viewport,this.selections=n.selections,this.wtEvent=new e0(r,this.domBindings,this.wtSettings,this.eventManager,this.wtTable,this.selections,n.event),this.findOriginalHeaders()}}class K0{constructor(e,t,n,r,i){(function(e,t,n){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})(this,"wtSettings",null),QK(this,"wot",e,{writable:!1}),this.domBindings=i,this.facadeGetter=t,this.wtSettings=r;const{TABLE:o,hider:s,spreader:a,holder:l,wtRootElement:c}=this.wot.wtTable;this.instance=this.wot,this.type=n,this.mainTableScrollableElement=null,this.TABLE=o,this.hider=s,this.spreader=a,this.holder=l,this.wtRootElement=c,this.trimmingContainer=LG(this.hider.parentNode.parentNode),this.updateStateOfRendering(),this.clone=this.makeClone()}updateStateOfRendering(){const e=this.needFullRender;this.needFullRender=this.shouldBeRendered();const t=e!==this.needFullRender;return t&&!this.needFullRender&&this.reset(),t}shouldBeRendered(){return!0}updateTrimmingContainer(){this.trimmingContainer=LG(this.hider.parentNode.parentNode)}updateMainScrollableElement(){const{wtTable:e}=this.wot,{rootWindow:t}=this.domBindings;"hidden"===t.getComputedStyle(e.wtRootElement.parentNode).getPropertyValue("overflow")?this.mainTableScrollableElement=this.wot.wtTable.holder:this.mainTableScrollableElement=WG(e.TABLE)}getRelativeCellPosition(e,t,n){if(!1===this.clone.wtTable.holder.contains(e))return void eJ(`The provided element is not a child of the ${this.type} overlay`);const r=this.mainTableScrollableElement===this.domBindings.rootWindow,i=n=this.wtSettings.getSetting("totalRows")-this.wtSettings.getSetting("fixedRowsBottom"),a=this.clone.wtTable.spreader,l={start:this.getRelativeStartPosition(a),top:a.offsetTop},c={start:this.getRelativeStartPosition(e),top:e.offsetTop};let h=null;return h=r?this.getRelativeCellPositionWithinWindow(o,i,c,l):this.getRelativeCellPositionWithinHolder(o,s,i,c,l),h}getRelativeStartPosition(e){return this.isRtl()?e.offsetParent.offsetWidth-e.offsetLeft-e.offsetWidth:e.offsetLeft}getRelativeCellPositionWithinWindow(e,t,n,r){const i=this.wot.wtTable.wtRootElement.getBoundingClientRect();let o=0,s=0;if(t){let e=i.left;this.isRtl()&&(e=this.domBindings.rootWindow.innerWidth-(i.left+i.width+UG())),o=e<=0?-1*e:0}else o=r.start;return s=e?this.clone.wtTable.TABLE.getBoundingClientRect().top-i.top:r.top,{start:n.start+o,top:n.top+s}}getRelativeCellPositionWithinHolder(e,t,n,r,i){const o=this.wot.wtOverlays.inlineStartOverlay.getScrollPosition(),s=this.wot.wtOverlays.topOverlay.getScrollPosition();let a=0,l=0;if(n||(a=o-i.start),t){const e=this.wot.wtTable.wtRootElement.getBoundingClientRect();l=-1*this.clone.wtTable.TABLE.getBoundingClientRect().top+e.top}else e||(l=s-i.top);return{start:r.start-a,top:r.top-l}}makeClone(){if(-1===k0.indexOf(this.type))throw new Error(`Clone type "${this.type}" is not supported.`);const{wtTable:e}=this.wot,{rootDocument:t,rootWindow:n}=this.domBindings,r=t.createElement("DIV"),i=t.createElement("TABLE"),o=e.wtRootElement.parentNode;r.className=`${C0.get(this.type)} handsontable`,r.setAttribute("dir",this.isRtl()?"rtl":"ltr"),r.style.position="absolute",r.style.top=0,r.style.overflow="visible",this.isRtl()?r.style.right=0:r.style.left=0,i.className=e.TABLE.className,r.appendChild(i),o.appendChild(r);const s=this.wtSettings.getSetting("preventOverflow");return!0===s||"horizontal"===s&&this.type===y0||"vertical"===s&&this.type===w0?this.mainTableScrollableElement=n:"hidden"===n.getComputedStyle(o).getPropertyValue("overflow")?this.mainTableScrollableElement=e.holder:this.mainTableScrollableElement=WG(e.TABLE),new G0(i,this.wtSettings,{source:this.wot,overlay:this,viewport:this.wot.wtViewport,event:this.wot.wtEvent,selections:this.wot.selections})}refresh(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=this.shouldBeRendered();this.clone&&(this.needFullRender||t)&&this.clone.draw(e),this.needFullRender=t}reset(){if(!this.clone)return;const e=this.clone.wtTable.holder,t=this.clone.wtTable.hider;aK([e.style,t.style,e.parentNode.style],(e=>{e.width="",e.height=""}))}isRtl(){return this.wtSettings.getSetting("rtlMode")}destroy(){this.clone.eventManager.destroy()}}class J0 extends K0{constructor(e,t,n,r){super(e,t,y0,n,r),function(e,t,n){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"cachedFixedRowsTop",-1),this.cachedFixedRowsTop=this.wtSettings.getSetting("fixedRowsTop")}createTable(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]&&arguments[0];this.updateTrimmingContainer(),(this.needFullRender||e)&&(this.adjustRootElementSize(),this.adjustRootChildrenSize())}adjustRootElementSize(){const{wtTable:e}=this.wot,{rootDocument:t,rootWindow:n}=this.domBindings,r=UG(t),i=this.clone.wtTable.holder.parentNode.style,o=this.wtSettings.getSetting("preventOverflow");if(this.trimmingContainer!==n||"horizontal"===o){let t=this.wot.wtViewport.getWorkspaceWidth();this.wot.wtOverlays.hasScrollbarRight&&(t-=r),t=Math.min(t,e.wtRootElement.scrollWidth),i.width=`${t}px`}else i.width="";this.clone.wtTable.holder.style.width=i.width;let s=jG(this.clone.wtTable.TABLE);this.wot.wtTable.hasDefinedSize()||(s=0),i.height=`${s}px`}adjustRootChildrenSize(){var e;const{holder:t}=this.clone.wtTable,{selections:n}=this.wot,r=this.facadeGetter(),i=Math.abs(null!==(e=null==n?void 0:n.getCell().getBorder(r).cornerCenterPointOffset)&&void 0!==e?e:0);this.clone.wtTable.hider.style.width=this.hider.style.width,t.style.width=t.parentNode.style.width,t.style.height=`${parseInt(t.parentNode.style.height,10)+i}px`}applyToDOM(){const e=this.wtSettings.getSetting("totalRows");if("number"==typeof this.wot.wtViewport.rowsRenderCalculator.startPosition)this.spreader.style.top=`${this.wot.wtViewport.rowsRenderCalculator.startPosition}px`;else{if(0!==e)throw new Error("Incorrect value of the rowsRenderCalculator");this.spreader.style.top="0"}this.spreader.style.bottom="",this.needFullRender&&this.syncOverlayOffset()}syncOverlayOffset(){const e=this.isRtl()?"right":"left",{spreader:t}=this.clone.wtTable;"number"==typeof this.wot.wtViewport.columnsRenderCalculator.startPosition?t.style[e]=`${this.wot.wtViewport.columnsRenderCalculator.startPosition}px`:t.style[e]=""}scrollTo(e,t){const{wot:n,wtSettings:r}=this,i=(n.cloneSource?n.cloneSource:n).wtTable.holder;let o=this.getTableParentOffset(),s=0;if(t&&this.wot.wtTable.getRowHeight(e)>this.wot.wtViewport.getViewportHeight()&&(t=!1),t&&i.offsetHeight!==i.clientHeight&&(s=UG(this.domBindings.rootDocument)),t){const t=r.getSetting("fixedRowsBottom"),i=r.getSetting("totalRows");o+=this.sumCellSizes(0,e+1),o-=n.wtViewport.getViewportHeight()-this.sumCellSizes(i-t,i),o+=1}else o+=this.sumCellSizes(r.getSetting("fixedRowsTop"),e);return o+=s,this.setScrollPosition(o)}getTableParentOffset(){return this.mainTableScrollableElement===this.domBindings.rootWindow?this.wot.wtTable.holderOffset.top:0}getScrollPosition(){return NG(this.mainTableScrollableElement,this.domBindings.rootWindow)}getOverlayOffset(){const{rootWindow:e}=this.domBindings,t=this.wtSettings.getSetting("preventOverflow");let n=0;if(this.trimmingContainer===e&&(!t||"vertical"!==t)){const e=this.wot.wtTable.getTotalHeight()-this.clone.wtTable.getTotalHeight();n=Math.max(this.getScrollPosition()-this.getTableParentOffset(),0),n>e&&(n=0)}return n}adjustHeaderBordersPosition(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=this.wot.wtTable.holder.parentNode;this.wtSettings.getSetting("totalColumns")?RG(n,"emptyColumns"):TG(n,"emptyColumns");let r=!1;if(!t){const t=this.wtSettings.getSetting("fixedRowsTop"),i=this.cachedFixedRowsTop!==t,o=this.wtSettings.getSetting("columnHeaders");if((i||0===t)&&o.length>0){const t=_G(n,"innerBorderTop");this.cachedFixedRowsTop=this.wtSettings.getSetting("fixedRowsTop"),e||0===this.wtSettings.getSetting("totalRows")?(TG(n,"innerBorderTop"),r=!t):(RG(n,"innerBorderTop"),r=t)}}return r}}const e1={getFirstRenderedRow(){const e=this.wtSettings.getSetting("totalRows"),t=this.wtSettings.getSetting("fixedRowsBottom"),n=e-t;return 0===e||0===t?-1:n<0?0:n},getFirstVisibleRow(){return this.getFirstRenderedRow()},getLastRenderedRow(){return this.wtSettings.getSetting("totalRows")-1},getLastVisibleRow(){return this.getLastRenderedRow()},getRenderedRowsCount(){const e=this.wtSettings.getSetting("totalRows");return Math.min(this.wtSettings.getSetting("fixedRowsBottom"),e)},getVisibleRowsCount(){return this.getRenderedRowsCount()}};QK(e1,"MIXIN_NAME","stickyRowsBottom",{writable:!1,enumerable:!1});const t1=e1;class n1 extends T0{constructor(e,t,n,r){super(e,t,n,r,O0)}}AK(n1,t1),AK(n1,P0);const r1=n1;class i1 extends K0{constructor(e,t,n,r){super(e,t,O0,n,r),function(e,t,n){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"cachedFixedRowsBottom",-1),this.cachedFixedRowsBottom=this.wtSettings.getSetting("fixedRowsBottom")}createTable(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]&&arguments[0];this.updateTrimmingContainer(),(this.needFullRender||e)&&(this.adjustRootElementSize(),this.adjustRootChildrenSize())}adjustRootElementSize(){const{wtTable:e,wtViewport:t}=this.wot,{rootDocument:n,rootWindow:r}=this.domBindings,i=UG(n),o=this.clone.wtTable.holder.parentNode.style,s=this.wtSettings.getSetting("preventOverflow");if(this.trimmingContainer!==r||"horizontal"===s){let n=t.getWorkspaceWidth();this.wot.wtOverlays.hasScrollbarRight&&(n-=i),n=Math.min(n,e.wtRootElement.scrollWidth),o.width=`${n}px`}else o.width="";this.clone.wtTable.holder.style.width=o.width;let a=jG(this.clone.wtTable.TABLE);this.wot.wtTable.hasDefinedSize()||(a=0),o.height=`${a}px`}adjustRootChildrenSize(){const{holder:e}=this.clone.wtTable;this.clone.wtTable.hider.style.width=this.hider.style.width,e.style.width=e.parentNode.style.width,e.style.height=e.parentNode.style.height}applyToDOM(){const e=this.wtSettings.getSetting("totalRows");if("number"==typeof this.wot.wtViewport.rowsRenderCalculator.startPosition)this.spreader.style.top=`${this.wot.wtViewport.rowsRenderCalculator.startPosition}px`;else{if(0!==e)throw new Error("Incorrect value of the rowsRenderCalculator");this.spreader.style.top="0"}this.spreader.style.bottom="",this.needFullRender&&this.syncOverlayOffset()}syncOverlayOffset(){const e=this.isRtl()?"right":"left",{spreader:t}=this.clone.wtTable;"number"==typeof this.wot.wtViewport.columnsRenderCalculator.startPosition?t.style[e]=`${this.wot.wtViewport.columnsRenderCalculator.startPosition}px`:t.style[e]=""}scrollTo(e,t){let n=this.getTableParentOffset();const r=(this.wot.cloneSource?this.wot.cloneSource:this.wot).wtTable.holder;let i=0;t&&r.offsetHeight!==r.clientHeight&&(i=UG(this.domBindings.rootDocument)),t?(n+=this.sumCellSizes(0,e+1),n-=this.wot.wtViewport.getViewportHeight(),n+=1):n+=this.sumCellSizes(this.wtSettings.getSetting("fixedRowsBottom"),e),n+=i,this.setScrollPosition(n)}getTableParentOffset(){return this.mainTableScrollableElement===this.domBindings.rootWindow?this.wot.wtTable.holderOffset.top:0}getScrollPosition(){return NG(this.mainTableScrollableElement,this.domBindings.rootWindow)}getOverlayOffset(){const{rootWindow:e}=this.domBindings,t=this.wtSettings.getSetting("preventOverflow");let n=0;if(this.trimmingContainer===e&&(!t||"vertical"!==t)){const e=this.wot.wtTable.getTotalHeight(),t=e-this.clone.wtTable.getTotalHeight(),r=this.domBindings.rootDocument.documentElement.clientHeight;n=Math.max(this.getTableParentOffset()-this.getScrollPosition()-r+e,0),n>t&&(n=0)}return n}adjustHeaderBordersPosition(e){const t=this.wtSettings.getSetting("fixedRowsBottom"),n=this.cachedFixedRowsBottom!==t,r=this.wtSettings.getSetting("columnHeaders");let i=!1;if((n||0===t)&&r.length>0){const t=this.wot.wtTable.holder.parentNode,n=_G(t,"innerBorderBottom");this.cachedFixedRowsBottom=this.wtSettings.getSetting("fixedRowsBottom"),e||0===this.wtSettings.getSetting("totalRows")?(TG(t,"innerBorderBottom"),i=!n):(RG(t,"innerBorderBottom"),i=n)}return i}}const o1={getFirstRenderedRow(){const e=this.dataAccessObject.startRowRendered;return null===e?-1:e},getFirstVisibleRow(){const e=this.dataAccessObject.startRowVisible;return null===e?-1:e},getLastRenderedRow(){const e=this.dataAccessObject.endRowRendered;return null===e?-1:e},getLastVisibleRow(){const e=this.dataAccessObject.endRowVisible;return null===e?-1:e},getRenderedRowsCount(){return this.dataAccessObject.countRowsRendered},getVisibleRowsCount(){return this.dataAccessObject.countRowsVisible}};QK(o1,"MIXIN_NAME","calculatedRows",{writable:!1,enumerable:!1});const s1=o1,a1={getFirstRenderedColumn(){return 0===this.wtSettings.getSetting("totalColumns")?-1:0},getFirstVisibleColumn(){return this.getFirstRenderedColumn()},getLastRenderedColumn(){return this.getRenderedColumnsCount()-1},getLastVisibleColumn(){return this.getLastRenderedColumn()},getRenderedColumnsCount(){const e=this.wtSettings.getSetting("totalColumns");return Math.min(this.wtSettings.getSetting("fixedColumnsStart"),e)},getVisibleColumnsCount(){return this.getRenderedColumnsCount()}};QK(a1,"MIXIN_NAME","stickyColumnsStart",{writable:!1,enumerable:!1});const l1=a1;class c1 extends T0{constructor(e,t,n,r){super(e,t,n,r,w0)}}AK(c1,s1),AK(c1,l1);const h1=c1;class u1 extends K0{constructor(e,t,n,r){super(e,t,w0,n,r)}createTable(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]&&arguments[0];this.updateTrimmingContainer(),(this.needFullRender||e)&&(this.adjustRootElementSize(),this.adjustRootChildrenSize())}adjustRootElementSize(){const{wtTable:e}=this.wot,{rootDocument:t,rootWindow:n}=this.domBindings,r=UG(t),i=this.clone.wtTable.holder.parentNode.style,o=this.wtSettings.getSetting("preventOverflow");if(this.trimmingContainer!==n||"vertical"===o){let t=this.wot.wtViewport.getWorkspaceHeight();this.wot.wtOverlays.hasScrollbarBottom&&(t-=r),t=Math.min(t,e.wtRootElement.scrollHeight),i.height=`${t}px`}else i.height="";this.clone.wtTable.holder.style.height=i.height;const s=BG(this.clone.wtTable.TABLE);i.width=`${s}px`}adjustRootChildrenSize(){var e;const{holder:t}=this.clone.wtTable,{selections:n}=this.wot,r=this.facadeGetter(),i=Math.abs(null!==(e=null==n?void 0:n.getCell().getBorder(r).cornerCenterPointOffset)&&void 0!==e?e:0);this.clone.wtTable.hider.style.height=this.hider.style.height,t.style.height=t.parentNode.style.height,t.style.width=`${parseInt(t.parentNode.style.width,10)+i}px`}applyToDOM(){const e=this.wtSettings.getSetting("totalColumns"),t=this.isRtl()?"right":"left";if("number"==typeof this.wot.wtViewport.columnsRenderCalculator.startPosition)this.spreader.style[t]=`${this.wot.wtViewport.columnsRenderCalculator.startPosition}px`;else{if(0!==e)throw new Error("Incorrect value of the columnsRenderCalculator");this.spreader.style[t]="0"}this.isRtl()?this.spreader.style.left="":this.spreader.style.right="",this.needFullRender&&this.syncOverlayOffset()}syncOverlayOffset(){"number"==typeof this.wot.wtViewport.rowsRenderCalculator.startPosition?this.clone.wtTable.spreader.style.top=`${this.wot.wtViewport.rowsRenderCalculator.startPosition}px`:this.clone.wtTable.spreader.style.top=""}scrollTo(e,t){let n=this.getTableParentOffset();const r=(this.wot.cloneSource?this.wot.cloneSource:this.wot).wtTable.holder;let i=0;return t&&this.wot.wtTable.getColumnWidth(e)>this.wot.wtViewport.getViewportWidth()&&(t=!1),t&&r.offsetWidth!==r.clientWidth&&(i=UG(this.domBindings.rootDocument)),t?(n+=this.sumCellSizes(0,e+1),n-=this.wot.wtViewport.getViewportWidth()):n+=this.sumCellSizes(this.wtSettings.getSetting("fixedColumnsStart"),e),n+=i,this.setScrollPosition(n)}getTableParentOffset(){let e=0;return this.wtSettings.getSetting("preventOverflow")||this.trimmingContainer!==this.domBindings.rootWindow||(e=this.wot.wtTable.holderOffset.left),e}getScrollPosition(){return Math.abs(DG(this.mainTableScrollableElement,this.domBindings.rootWindow))}getOverlayOffset(){const{rootWindow:e}=this.domBindings,t=this.wtSettings.getSetting("preventOverflow");let n=0;return this.trimmingContainer!==e||t&&"horizontal"===t||(n=this.isRtl()?Math.abs(Math.min(this.getTableParentOffset()-this.getScrollPosition(),0)):Math.max(this.getScrollPosition()-this.getTableParentOffset(),0),n>this.wot.wtTable.getTotalWidth()-this.clone.wtTable.getTotalWidth()&&(n=0)),n}adjustHeaderBordersPosition(e){const t=this.wot.wtTable.holder.parentNode,n=this.wtSettings.getSetting("rowHeaders"),r=this.wtSettings.getSetting("fixedColumnsStart");this.wtSettings.getSetting("totalRows")?RG(t,"emptyRows"):TG(t,"emptyRows");let i=!1;if(r&&!n.length)TG(t,"innerBorderLeft innerBorderInlineStart");else if(!r&&n.length){const n=_G(t,"innerBorderInlineStart");e?(TG(t,"innerBorderLeft innerBorderInlineStart"),i=!n):(RG(t,"innerBorderLeft innerBorderInlineStart"),i=n)}return i}}class d1 extends T0{constructor(e,t,n,r){super(e,t,n,r,x0)}}AK(d1,E0),AK(d1,l1);const f1=d1;function p1(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class g1 extends K0{constructor(e,t,n,r,i,o){super(e,t,x0,n,r),p1(this,"topOverlay",void 0),p1(this,"inlineStartOverlay",void 0),this.topOverlay=i,this.inlineStartOverlay=o}createTable(){for(var e=arguments.length,t=new Array(e),n=0;n{var t;t=()=>{Array.isArray(e)&&e.length&&this.wtSettings.getSetting("onContainerElementResize")},window.requestAnimationFrame(t)}))),this.wot=e,this.wtSettings=r,this.domBindings=n,this.facadeGetter=t,this.wtTable=o;const{rootDocument:s,rootWindow:a}=this.domBindings;this.instance=this.wot,this.eventManager=i,this.scrollbarSize=UG(s);const l="hidden"===a.getComputedStyle(o.wtRootElement.parentNode).getPropertyValue("overflow");this.scrollableElement=l?o.holder:WG(o.TABLE),this.initOverlays(),this.hasScrollbarBottom=!1,this.hasScrollbarRight=!1,this.destroyed=!1,this.keyPressed=!1,this.spreaderLastSize={width:null,height:null},this.verticalScrolling=!1,this.horizontalScrolling=!1,this.initBrowserLineHeight(),this.registerListeners(),this.lastScrollX=a.scrollX,this.lastScrollY=a.scrollY}getOverlays(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=[this.topOverlay,this.topInlineStartCornerOverlay,this.inlineStartOverlay,this.bottomOverlay,this.bottomInlineStartCornerOverlay];return e&&t.push(this.wtTable),t}initBrowserLineHeight(){const{rootWindow:e,rootDocument:t}=this.domBindings,n=e.getComputedStyle(t.body),r=parseInt(n.lineHeight,10),i=1.2*parseInt(n.fontSize,10);this.browserLineHeight=r||i}initOverlays(){const e=[this.wot,this.facadeGetter,this.wtSettings,this.domBindings];this.topOverlay=new J0(...e),this.bottomOverlay=new i1(...e),this.inlineStartOverlay=new u1(...e),this.topInlineStartCornerOverlay=new g1(...e,this.topOverlay,this.inlineStartOverlay),this.bottomInlineStartCornerOverlay=new v1(...e,this.bottomOverlay,this.inlineStartOverlay)}updateStateOfRendering(){let e=this.topOverlay.updateStateOfRendering();return e=this.bottomOverlay.updateStateOfRendering()||e,e=this.inlineStartOverlay.updateStateOfRendering()||e,this.inlineStartOverlay.needFullRender&&(this.topOverlay.needFullRender&&(e=this.topInlineStartCornerOverlay.updateStateOfRendering()||e),this.bottomOverlay.needFullRender&&(e=this.bottomInlineStartCornerOverlay.updateStateOfRendering()||e)),e}refreshAll(){this.wot.drawn&&(this.wtTable.holder.parentNode?(this.wot.draw(!0),this.verticalScrolling&&this.inlineStartOverlay.onScroll(),this.horizontalScrolling&&this.topOverlay.onScroll(),this.verticalScrolling=!1,this.horizontalScrolling=!1):this.destroy())}registerListeners(){const{rootDocument:e,rootWindow:t}=this.domBindings,{mainTableScrollableElement:n}=this.topOverlay,{mainTableScrollableElement:r}=this.inlineStartOverlay;this.eventManager.addEventListener(e.documentElement,"keydown",(e=>this.onKeyDown(e))),this.eventManager.addEventListener(e.documentElement,"keyup",(()=>this.onKeyUp())),this.eventManager.addEventListener(e,"visibilitychange",(()=>this.onKeyUp())),this.eventManager.addEventListener(n,"scroll",(e=>this.onTableScroll(e)),{passive:!0}),n!==r&&this.eventManager.addEventListener(r,"scroll",(e=>this.onTableScroll(e)),{passive:!0});const i=t.devicePixelRatio&&t.devicePixelRatio>1,o=this.scrollableElement===t,s=this.wtSettings.getSetting("preventWheel"),a={passive:o};let l;(s||i||!VK.chrome.value)&&this.eventManager.addEventListener(this.wtTable.wtRootElement,"wheel",(e=>this.onCloneWheel(e,s)),a),[this.topOverlay,this.bottomOverlay,this.inlineStartOverlay,this.topInlineStartCornerOverlay,this.bottomInlineStartCornerOverlay].forEach((e=>{if(e&&e.needFullRender){const{holder:t}=e.clone.wtTable;this.eventManager.addEventListener(t,"wheel",(e=>this.onCloneWheel(e,s)),a)}})),this.eventManager.addEventListener(t,"resize",(()=>{clearTimeout(l),l=setTimeout((()=>{this.wtSettings.getSetting("onWindowResize")}),200)})),o||this.resizeObserver.observe(this.wtTable.wtRootElement.parentElement)}deregisterListeners(){this.eventManager.clearEvents(!0)}onTableScroll(e){const t=this.domBindings.rootWindow,n=this.inlineStartOverlay.mainTableScrollableElement,r=this.topOverlay.mainTableScrollableElement,i=e.target;this.keyPressed&&(r!==t&&i!==t&&!e.target.contains(r)||n!==t&&i!==t&&!e.target.contains(n))||this.syncScrollPositions(e)}onCloneWheel(e,t){const{rootWindow:n}=this.domBindings,r=this.inlineStartOverlay.mainTableScrollableElement,i=this.topOverlay.mainTableScrollableElement,o=e.target,s=i!==n&&o!==n&&!o.contains(i),a=r!==n&&o!==n&&!o.contains(r);if(this.keyPressed&&(s||a))return;const l=this.translateMouseWheelToScroll(e);(t||this.scrollableElement!==n&&l)&&e.preventDefault()}onKeyDown(e){this.keyPressed=function(e,t){const n="ARROW_UP|ARROW_RIGHT|ARROW_DOWN|ARROW_LEFT".split("|");let r=!1;return aK(n,(t=>{if(e===YK[t])return r=!0,!1})),r}(e.keyCode)}onKeyUp(){this.keyPressed=!1}translateMouseWheelToScroll(e){let t=isNaN(e.deltaY)?-1*e.wheelDeltaY:e.deltaY,n=isNaN(e.deltaX)?-1*e.wheelDeltaX:e.deltaX;1===e.deltaMode&&(n+=n*this.browserLineHeight,t+=t*this.browserLineHeight);const r=this.scrollVertically(t),i=this.scrollHorizontally(n);return r||i}scrollVertically(e){const t=this.scrollableElement.scrollTop;return this.scrollableElement.scrollTop+=e,t!==this.scrollableElement.scrollTop}scrollHorizontally(e){const t=this.scrollableElement.scrollLeft;return this.scrollableElement.scrollLeft+=e,t!==this.scrollableElement.scrollLeft}syncScrollPositions(){if(this.destroyed)return;const{rootWindow:e}=this.domBindings,t=this.topOverlay.clone.wtTable.holder,n=this.inlineStartOverlay.clone.wtTable.holder,[r,i]=[this.scrollableElement.scrollLeft,this.scrollableElement.scrollTop];if(this.horizontalScrolling=t.scrollLeft!==r||this.lastScrollX!==e.scrollX,this.verticalScrolling=n.scrollTop!==i||this.lastScrollY!==e.scrollY,this.lastScrollX=e.scrollX,this.lastScrollY=e.scrollY,this.horizontalScrolling){t.scrollLeft=r;const e=this.bottomOverlay.needFullRender?this.bottomOverlay.clone.wtTable.holder:null;e&&(e.scrollLeft=r)}this.verticalScrolling&&(n.scrollTop=i),this.refreshAll()}syncScrollWithMaster(){const e=this.topOverlay.mainTableScrollableElement,{scrollLeft:t,scrollTop:n}=e;this.topOverlay.needFullRender&&(this.topOverlay.clone.wtTable.holder.scrollLeft=t),this.bottomOverlay.needFullRender&&(this.bottomOverlay.clone.wtTable.holder.scrollLeft=t),this.inlineStartOverlay.needFullRender&&(this.inlineStartOverlay.clone.wtTable.holder.scrollTop=n)}updateMainScrollableElements(){this.deregisterListeners(),this.inlineStartOverlay.updateMainScrollableElement(),this.topOverlay.updateMainScrollableElement(),this.bottomOverlay.needFullRender&&this.bottomOverlay.updateMainScrollableElement();const{wtTable:e}=this,{rootWindow:t}=this.domBindings;"hidden"===t.getComputedStyle(e.wtRootElement.parentNode).getPropertyValue("overflow")?this.scrollableElement=e.holder:this.scrollableElement=WG(e.TABLE),this.registerListeners()}destroy(){this.resizeObserver.disconnect(),this.eventManager.destroy(),this.topOverlay.destroy(),this.bottomOverlay.clone&&this.bottomOverlay.destroy(),this.inlineStartOverlay.destroy(),this.topInlineStartCornerOverlay&&this.topInlineStartCornerOverlay.destroy(),this.bottomInlineStartCornerOverlay&&this.bottomInlineStartCornerOverlay.clone&&this.bottomInlineStartCornerOverlay.destroy(),this.destroyed=!0}refresh(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.updateLastSpreaderSize()&&this.adjustElementsSize(),this.bottomOverlay.clone&&this.bottomOverlay.refresh(e),this.inlineStartOverlay.refresh(e),this.topOverlay.refresh(e),this.topInlineStartCornerOverlay&&this.topInlineStartCornerOverlay.refresh(e),this.bottomInlineStartCornerOverlay&&this.bottomInlineStartCornerOverlay.clone&&this.bottomInlineStartCornerOverlay.refresh(e)}updateLastSpreaderSize(){const e=this.wtTable.spreader,t=e.clientWidth,n=e.clientHeight,r=t!==this.spreaderLastSize.width||n!==this.spreaderLastSize.height;return r&&(this.spreaderLastSize.width=t,this.spreaderLastSize.height=n),r}adjustElementsSize(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{wtViewport:t}=this.wot,{wtTable:n}=this,r=this.wtSettings.getSetting("totalColumns"),i=this.wtSettings.getSetting("totalRows"),o=t.getRowHeaderWidth(),s=t.getColumnHeaderHeight(),a=n.hider.style;if(a.width=`${o+this.inlineStartOverlay.sumCellSizes(0,r)}px`,a.height=`${s+this.topOverlay.sumCellSizes(0,i)+1}px`,this.scrollbarSize>0){const{scrollHeight:e,scrollWidth:t}=n.wtRootElement,{scrollHeight:r,scrollWidth:i}=n.holder;this.hasScrollbarRight=et?this.hasScrollbarBottom=!0:this.hasScrollbarBottom&&n.hider.scrollHeight+this.scrollbarSize>e&&(this.hasScrollbarRight=!0)}this.topOverlay.adjustElementsSize(e),this.inlineStartOverlay.adjustElementsSize(e),this.bottomOverlay.adjustElementsSize(e)}applyToDOM(){this.wtTable.isVisible()&&(this.topOverlay.applyToDOM(),this.bottomOverlay.clone&&this.bottomOverlay.applyToDOM(),this.inlineStartOverlay.applyToDOM())}getParentOverlay(e){if(!e)return null;const t=[this.topOverlay,this.inlineStartOverlay,this.bottomOverlay,this.topInlineStartCornerOverlay,this.bottomInlineStartCornerOverlay];let n=null;return aK(t,(t=>{t&&t.clone&&t.clone.wtTable.TABLE.contains(e)&&(n=t.clone)})),n}syncOverlayTableClassNames(){const e=this.wtTable.TABLE;aK([this.topOverlay,this.inlineStartOverlay,this.bottomOverlay,this.topInlineStartCornerOverlay,this.bottomInlineStartCornerOverlay],(t=>{t&&(t.clone.wtTable.TABLE.className=e.className)}))}};function w1(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class x1{constructor(e){w1(this,"settings",{}),w1(this,"defaults",Object.freeze(this.getDefaults())),IK(this.defaults,((t,n)=>{if(void 0!==e[n])this.settings[n]=e[n];else{if(void 0===t)throw new Error(`A required setting "${n}" was not provided`);this.settings[n]=t}}))}getDefaults(){return{facade:void 0,table:void 0,isDataViewInstance:!0,externalRowCalculator:!1,stretchH:"none",currentRowClassName:null,currentColumnClassName:null,preventOverflow:()=>!1,preventWheel:!1,data:void 0,freezeOverlays:!1,fixedColumnsStart:0,fixedRowsTop:0,fixedRowsBottom:0,shouldRenderInlineStartOverlay:()=>this.getSetting("fixedColumnsStart")>0||this.getSetting("rowHeaders").length>0,shouldRenderTopOverlay:()=>this.getSetting("fixedRowsTop")>0||this.getSetting("columnHeaders").length>0,shouldRenderBottomOverlay:()=>this.getSetting("fixedRowsBottom")>0,minSpareRows:0,rowHeaders:()=>[],columnHeaders:()=>[],totalRows:void 0,totalColumns:void 0,cellRenderer:(e,t,n)=>{const r=this.getSetting("data",e,t);AG(n,null==r?"":r)},columnWidth(){},rowHeight(){},defaultRowHeight:23,defaultColumnWidth:50,selections:null,hideBorderOnMouseDownOver:!1,viewportRowCalculatorOverride:null,viewportColumnCalculatorOverride:null,onCellMouseDown:null,onCellContextMenu:null,onCellMouseOver:null,onCellMouseOut:null,onCellMouseUp:null,onCellDblClick:null,onCellCornerMouseDown:null,onCellCornerDblClick:null,beforeDraw:null,onDraw:null,onBeforeRemoveCellClassNames:null,onAfterDrawSelection:null,onBeforeDrawBorders:null,onScrollVertically:null,onScrollHorizontally:null,onBeforeTouchScroll:null,onAfterMomentumScroll:null,onBeforeStretchingColumnWidth:e=>e,onModifyRowHeaderWidth:null,onModifyGetCellCoords:null,onBeforeHighlightingRowHeader:e=>e,onBeforeHighlightingColumnHeader:e=>e,onWindowResize:null,onContainerElementResize:null,renderAllRows:!1,groups:!1,rowHeaderWidth:null,columnHeaderHeight:null,headerClassName:null,rtlMode:!1}}update(e,t){return void 0===t?IK(e,((e,t)=>{this.settings[t]=e})):this.settings[e]=t,this}getSetting(e,t,n,r,i){return"function"==typeof this.settings[e]?this.settings[e](t,n,r,i):void 0!==t&&Array.isArray(this.settings[e])?this.settings[e][t]:this.settings[e]}getSettingPure(e){return this.settings[e]}has(e){return!!this.settings[e]}}class S1 extends T0{constructor(e,t,n,r){super(e,t,n,r,"master")}alignOverlaysWithTrimmingContainer(){const e=LG(this.wtRootElement),{rootWindow:t}=this.domBindings;if(e===t)this.wtSettings.getSetting("preventOverflow")||(this.holder.style.overflow="visible",this.wtRootElement.style.overflow="visible");else{const n=e.parentElement,r=HG(e,"height",t),i=HG(e,"overflow",t),o=this.holder.style,{scrollWidth:s,scrollHeight:a}=e;let{width:l,height:c}=e.getBoundingClientRect();if(n&&["auto","hidden","scroll"].includes(i)){const r=e.cloneNode(!1);r.style.overflow="auto",r.style.position="absolute",e.nextElementSibling?n.insertBefore(r,e.nextElementSibling):n.appendChild(r);const i=parseInt(VG(r,t).height,10);n.removeChild(r),0===i&&(c=0)}c=Math.min(c,a),o.height="auto"===r?"auto":`${c}px`,l=Math.min(l,s),o.width=`${l}px`,o.overflow="",this.hasTableHeight="auto"===o.height||c>0,this.hasTableWidth=l>0}this.isTableVisible=$G(this.TABLE)}markOversizedColumnHeaders(){const{wtSettings:e}=this,{wtViewport:t}=this.dataAccessObject,n="master",r=e.getSetting("columnHeaders").length;if(r&&!t.hasOversizedColumnHeadersMarked[n]){const i=e.getSetting("rowHeaders").length,o=this.getRenderedColumnsCount();for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:{};C1.set(this,{viewportHeight:e,scrollOffset:t,totalRows:n,rowHeightFn:r,overrideFn:i,calculationType:o,horizontalScrollbarHeight:s}),this.count=0,this.startRow=null,this.endRow=null,this.startPosition=null,this.isVisibleInTrimmingContainer=!1,this.calculate()}calculate(){const e=C1.get(this),t=e.calculationType,n=e.overrideFn,r=e.rowHeightFn,i=e.scrollOffset,o=Math.max(e.scrollOffset,0),s=e.totalRows,a=e.viewportHeight,l=e.horizontalScrollbarHeight||0;let c=0,h=!0;const u=[];let d,f=0,p=0;for(let e=0;e=o&&c+(2===t?d:0)<=o+a-l&&(null===this.startRow&&(this.startRow=e,f=d),this.endRow=e),u.push(c),c+=d,p=d,2!==t&&(this.endRow=e),c>=o+a-l){h=!1;break}const g=2===t?0:p;if(i+a-l<(2===t?f:0)||i>u.at(-1)+g?this.isVisibleInTrimmingContainer=!1:this.isVisibleInTrimmingContainer=!0,this.endRow===s-1&&h)for(this.startRow=this.endRow;this.startRow>0;){const e=u[this.endRow]+d-u[this.startRow-1];if((e<=a-l||2!==t)&&(this.startRow-=1),e>=a-l)break}1===t&&null!==this.startRow&&n&&n(this),this.startPosition=u[this.startRow],void 0===this.startPosition&&(this.startPosition=null),se),inlineStartOffset:l}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};R1.set(this,{viewportWidth:e,scrollOffset:t,totalColumns:n,columnWidthFn:r,overrideFn:i,calculationType:o,stretchingColumnWidthFn:a,inlineStartOffset:l}),this.count=0,this.startColumn=null,this.endColumn=null,this.startPosition=null,this.isVisibleInTrimmingContainer=!1,this.stretchAllRatio=0,this.stretchLastWidth=0,this.stretch=s,this.totalTargetWidth=0,this.needVerifyLastColumnWidth=!0,this.stretchAllColumnsWidth=[],this.calculate()}calculate(){let e=0,t=!0;const n=[];let r,i=0,o=0;const s=R1.get(this),a=s.calculationType,l=s.overrideFn,c=s.scrollOffset,h=Math.max(s.scrollOffset,0),u=s.totalColumns,d=s.viewportWidth,f=h>0?d+1:d;for(let s=0;s=h&&e+(2===a?r:0)<=h+f&&(null!==this.startColumn&&void 0!==this.startColumn||(this.startColumn=s,i=r),this.endColumn=s),n.push(e),e+=r,o=r,2!==a&&(this.endColumn=s),e>=h+d){t=!1;break}const p=2===a?0:o,g=2===a?i:0;if(c+d-f<-1*s.inlineStartOffset||c>n.at(-1)+p||-1*s.scrollOffset-s.viewportWidth>-1*g?this.isVisibleInTrimmingContainer=!1:this.isVisibleInTrimmingContainer=!0,this.endColumn===u-1&&t)for(this.startColumn=this.endColumn;this.startColumn>0;){const e=n[this.endColumn]+r-n[this.startColumn-1];if((e<=d||2!==a)&&(this.startColumn-=1),e>d)break}1===a&&null!==this.startColumn&&l&&l(this),this.startPosition=n[this.startColumn],void 0===this.startPosition&&(this.startPosition=null),u0)this.stretchAllRatio=t/i,this.stretchAllColumnsWidth=[],this.needVerifyLastColumnWidth=!0;else if("last"===this.stretch&&t!==1/0){const e=this._getColumnWidth(r-1),t=o+e;this.stretchLastWidth=t>=0?t:e}}getStretchedColumnWidth(e,t){let n=null;return"all"===this.stretch&&0!==this.stretchAllRatio?n=this._getStretchedAllColumnWidth(e,t):"last"===this.stretch&&0!==this.stretchLastWidth&&(n=this._getStretchedLastColumnWidth(e)),n}_getStretchedAllColumnWidth(e,t){let n=0;const r=R1.get(this),i=r.totalColumns;if(!this.stretchAllColumnsWidth[e]){const n=Math.round(t*this.stretchAllRatio),i=r.stretchingColumnWidthFn(n,e);this.stretchAllColumnsWidth[e]=void 0===i?n:isNaN(i)?this._getColumnWidth(e):i}if(this.stretchAllColumnsWidth.length===i&&this.needVerifyLastColumnWidth){this.needVerifyLastColumnWidth=!1;for(let e=0;e{this.clientHeight=this.getWorkspaceHeight()}))}getWorkspaceHeight(){const e=this.domBindings.rootDocument,t=this.dataAccessObject.topOverlayTrimmingContainer;let n=0;return n=t===this.domBindings.rootWindow?e.documentElement.clientHeight:jG(t)>0&&t.clientHeight>0?t.clientHeight:1/0,n}getWorkspaceWidth(){const{wtSettings:e}=this,{rootDocument:t,rootWindow:n}=this.domBindings,r=this.dataAccessObject.inlineStartOverlayTrimmingContainer,i=t.documentElement.offsetWidth,o=e.getSetting("totalColumns"),s=e.getSetting("preventOverflow"),a=e.getSetting("rtlMode"),l=this.wtTable.TABLE.getBoundingClientRect(),c=i-(a?l.right-i:l.left);let h,u;if(s)return BG(this.wtTable.wtRootElement);if(h=e.getSetting("freezeOverlays")?Math.min(c,i):Math.min(this.getContainerFillWidth(),c,i),r===n&&o>0&&this.sumColumnWidths(0,o-1)>h)return t.documentElement.clientWidth;if(r!==n&&(u=HG(this.dataAccessObject.inlineStartOverlayTrimmingContainer,"overflow",n),"scroll"===u||"hidden"===u||"auto"===u))return Math.max(h,r.clientWidth);const d=e.getSetting("stretchH");return"none"!==d&&d?h:Math.max(h,BG(this.wtTable.TABLE))}hasVerticalScroll(){return this.wtTable.hider.offsetHeight>this.getWorkspaceHeight()}hasHorizontalScroll(){return this.wtTable.hider.offsetWidth>this.getWorkspaceWidth()}sumColumnWidths(e,t){let n=0,r=e;for(;r0&&(e-=t),e}getRowHeaderWidth(){const e=this.wtSettings.getSetting("rowHeaderWidth"),t=this.wtSettings.getSetting("rowHeaders");if(e){this.rowHeaderWidth=0;for(let n=0,r=t.length;n0?e-t:e}createRowsCalculator(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;const{wtSettings:t,wtTable:n}=this;let r,i,o;this.rowHeaderWidth=NaN,r=t.getSetting("renderAllRows")&&1===e?1/0:this.getViewportHeight();let s=this.dataAccessObject.topScrollPosition-this.dataAccessObject.topParentOffset;const a=t.getSetting("fixedRowsTop"),l=t.getSetting("fixedRowsBottom"),c=t.getSetting("totalRows");return a&&s>=0&&(o=this.dataAccessObject.topOverlay.sumCellSizes(0,a),s+=o,r-=o),l&&this.dataAccessObject.bottomOverlay.clone&&(o=this.dataAccessObject.bottomOverlay.sumCellSizes(c-l,c),r-=o),i=n.holder.clientHeight===n.holder.offsetHeight?0:UG(this.domBindings.rootDocument),new T1({viewportSize:r,scrollOffset:s,totalItems:t.getSetting("totalRows"),itemSizeFn:e=>n.getRowHeight(e),overrideFn:t.getSettingPure("viewportRowCalculatorOverride"),calculationType:e,scrollbarHeight:i})}createColumnsCalculator(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;const{wtSettings:t,wtTable:n}=this;let r=this.getViewportWidth(),i=Math.abs(this.dataAccessObject.inlineStartScrollPosition)-this.dataAccessObject.inlineStartParentOffset;this.columnHeaderHeight=NaN;const o=t.getSetting("fixedColumnsStart");if(o&&i>=0){const e=this.dataAccessObject.inlineStartOverlay.sumCellSizes(0,o);i+=e,r-=e}return n.holder.clientWidth!==n.holder.offsetWidth&&(r-=UG(this.domBindings.rootDocument)),new M1({viewportSize:r,scrollOffset:i,totalItems:t.getSetting("totalColumns"),itemSizeFn:e=>n.getColumnWidth(e),overrideFn:t.getSettingPure("viewportColumnCalculatorOverride"),calculationType:e,stretchMode:t.getSetting("stretchH"),stretchingItemWidthFn:(e,n)=>t.getSetting("onBeforeStretchingColumnWidth",e,n),inlineStartOffset:this.dataAccessObject.inlineStartParentOffset})}createRenderCalculators(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e){const t=this.createRowsCalculator(2),n=this.createColumnsCalculator(2);this.areAllProposedVisibleRowsAlreadyRendered(t)&&this.areAllProposedVisibleColumnsAlreadyRendered(n)||(e=!1)}return e||(this.rowsRenderCalculator=this.createRowsCalculator(1),this.columnsRenderCalculator=this.createColumnsCalculator(1)),this.rowsVisibleCalculator=null,this.columnsVisibleCalculator=null,e}createVisibleCalculators(){this.rowsVisibleCalculator=this.createRowsCalculator(2),this.columnsVisibleCalculator=this.createColumnsCalculator(2)}areAllProposedVisibleRowsAlreadyRendered(e){if(!this.rowsVisibleCalculator)return!1;const{startRow:t,endRow:n,isVisibleInTrimmingContainer:r}=e;if(null===t&&null===n)return!r;const{startRow:i,endRow:o}=this.rowsRenderCalculator;return!(t0||n>o||n===o&&n0||n>o||n===o&&n{n[t]=void 0}))}};class A1 extends q0{constructor(e,t){super(e,new x1(t));const n=this.wtSettings.getSetting("facade",this);this.wtTable=new k1(this.getTableDao(),n,this.domBindings,this.wtSettings),this.wtViewport=new P1(this.getViewportDao(),this.domBindings,this.wtSettings,this.eventManager,this.wtTable),this.selections=this.wtSettings.getSetting("selections"),this.wtEvent=new e0(n,this.domBindings,this.wtSettings,this.eventManager,this.wtTable,this.selections),this.wtOverlays=new O1(this,n,this.domBindings,this.wtSettings,this.eventManager,this.wtTable),this.exportSettingsAsClassNames(),this.findOriginalHeaders()}exportSettingsAsClassNames(){const e=[],t=[];IK({rowHeaders:"htRowHeaders",columnHeaders:"htColumnHeaders"},((n,r)=>{this.wtSettings.getSetting(r).length&&t.push(n),e.push(n)})),RG(this.wtTable.wtRootElement.parentNode,e),TG(this.wtTable.wtRootElement.parentNode,t)}getViewportDao(){const e=this;return{get wot(){return e},get topOverlayTrimmingContainer(){return e.wtOverlays.topOverlay.trimmingContainer},get inlineStartOverlayTrimmingContainer(){return e.wtOverlays.inlineStartOverlay.trimmingContainer},get topScrollPosition(){return e.wtOverlays.topOverlay.getScrollPosition()},get topParentOffset(){return e.wtOverlays.topOverlay.getTableParentOffset()},get inlineStartScrollPosition(){return e.wtOverlays.inlineStartOverlay.getScrollPosition()},get inlineStartParentOffset(){return e.wtOverlays.inlineStartOverlay.getTableParentOffset()},get topOverlay(){return e.wtOverlays.topOverlay},get inlineStartOverlay(){return e.wtOverlays.inlineStartOverlay},get bottomOverlay(){return e.wtOverlays.bottomOverlay}}}}class $1{constructor(e){e instanceof q0?this._wot=e:this._initFromSettings(e)}_initFromSettings(e){e.facade=e=>{const t=new $1(e);return()=>t},this._wot=new A1(e.table,e)}get guid(){return this._wot.guid}get rootDocument(){return this._wot.domBindings.rootDocument}get rootWindow(){return this._wot.domBindings.rootWindow}get wtSettings(){return this._wot.wtSettings}get cloneSource(){return this._wot.cloneSource}get cloneOverlay(){return this._wot.cloneOverlay}get selections(){return this._wot.selections}get wtViewport(){return this._wot.wtViewport}get wtOverlays(){return this._wot.wtOverlays}get wtTable(){return this._wot.wtTable}get wtEvent(){return this._wot.wtEvent}get wtScroll(){return this._wot.wtScroll}get drawn(){return this._wot.drawn}set drawn(e){this._wot.drawn=e}get drawInterrupted(){return this._wot.drawInterrupted}set drawInterrupted(e){this._wot.drawInterrupted=e}get lastMouseOver(){return this._wot.lastMouseOver}set lastMouseOver(e){this._wot.lastMouseOver=e}get momentumScrolling(){return this._wot.momentumScrolling}set momentumScrolling(e){this._wot.momentumScrolling=e}get touchApplied(){return this._wot.touchApplied}set touchApplied(e){this._wot.touchApplied=e}get domBindings(){return this._wot.domBindings}get eventListeners(){return this._wot.eventListeners}set eventListeners(e){this._wot.eventListeners=e}get eventManager(){return this._wot.eventManager}createCellCoords(e,t){return this._wot.createCellCoords(e,t)}createCellRange(e,t,n){return this._wot.createCellRange(e,t,n)}draw(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._wot.draw(e),this}getCell(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._wot.getCell(e,t)}scrollViewport(e,t,n,r,i){return this._wot.scrollViewport(e,t,n,r,i)}scrollViewportHorizontally(e,t,n){return this._wot.scrollViewportHorizontally(e,t,n)}scrollViewportVertically(e,t,n){return this._wot.scrollViewportVertically(e,t,n)}getViewport(){return this._wot.getViewport()}getOverlayName(){return this._wot.cloneOverlay?this._wot.cloneOverlay.type:"master"}exportSettingsAsClassNames(){return this._wot.exportSettingsAsClassNames()}update(e,t){return this._wot.wtSettings.update(e,t),this}getSetting(e,t,n,r,i){return this._wot.wtSettings.getSetting(e,t,n,r,i)}hasSetting(e){return this._wot.wtSettings.hasSetting(e)}destroy(){this._wot.destroy()}}function z1(e){let{isShiftKey:t,isLeftClick:n,isRightClick:r,coords:i,selection:o,controller:s,cellCoordsFactory:a}=e;const l=o.isSelected()?o.getSelectedRange().current():null,c=o.isSelectedByCorner(),h=o.isSelectedByRowHeader();if(t&&l)i.row>=0&&i.col>=0&&!s.cell?o.setRangeEnd(i):(c||h)&&i.row>=0&&i.col>=0&&!s.cell?o.setRangeEnd(a(i.row,i.col)):c&&i.row<0&&!s.column?o.setRangeEnd(a(l.to.row,i.col)):h&&i.col<0&&!s.row?o.setRangeEnd(a(i.row,l.to.col)):(!c&&!h&&i.col<0||c&&i.col<0)&&!s.row?o.selectRows(Math.max(l.from.row,0),i.row,i.col):(!c&&!h&&i.row<0||h&&i.row<0)&&!s.column&&o.selectColumns(Math.max(l.from.col,0),i.col,i.row);else{const e=!o.inInSelection(i),t=n||r&&e;i.row<0&&i.col>=0&&!s.column?t&&o.selectColumns(i.col,i.col,i.row):i.col<0&&i.row>=0&&!s.row?t&&o.selectRows(i.row,i.row,i.col):i.col>=0&&i.row>=0&&!s.cell?t&&o.setRangeStart(i):i.col<0&&i.row<0&&o.selectAll(!0,!0)}}const Q1=new Map([["mousedown",z1],["mouseover",function(e){let{isLeftClick:t,coords:n,selection:r,controller:i,cellCoordsFactory:o}=e;if(!t)return;const s=r.isSelectedByRowHeader(),a=r.isSelectedByColumnHeader(),l=r.tableProps.countCols(),c=r.tableProps.countRows();a&&!i.column?r.setRangeEnd(o(c-1,n.col)):s&&!i.row?r.setRangeEnd(o(n.row,l-1)):i.cell||r.setRangeEnd(n)}],["touchstart",z1]]);function I1(e,t){let{coords:n,selection:r,controller:i,cellCoordsFactory:o}=t;Q1.get(e.type)({coords:n,selection:r,controller:i,cellCoordsFactory:o,isShiftKey:e.shiftKey,isLeftClick:JK(e)||"touchstart"===e.type,isRightClick:KK(e)})}const N1=new WeakMap,D1=Symbol("rootInstance");function W1(e){return e===D1}function L1(e){return N1.has(e)}function H1(e,t,n){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,n)}function V1(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function B1(e,t){return function(e,t){return t.get?t.get.call(e):t.value}(e,Z1(e,t,"get"))}function j1(e,t,n){return function(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=n}}(e,Z1(e,t,"set"),n),n}function Z1(e,t,n){if(!t.has(e))throw new TypeError("attempted to "+n+" private field on non-instance");return t.get(e)}const X1=new WeakMap;var F1=new WeakMap,Y1=new WeakMap;const q1=class{constructor(e){V1(this,"instance",void 0),V1(this,"eventManager",void 0),V1(this,"settings",void 0),V1(this,"THEAD",void 0),V1(this,"TBODY",void 0),V1(this,"_wt",void 0),V1(this,"activeWt",void 0),H1(this,F1,{writable:!0,value:0}),H1(this,Y1,{writable:!0,value:0}),V1(this,"postponedAdjustElementsSize",!1),this.instance=e,this.eventManager=new OJ(this.instance),this.settings=this.instance.getSettings(),X1.set(this,{selectionMouseDown:!1,mouseDown:void 0,table:void 0,lastWidth:0,lastHeight:0}),this.createElements(),this.registerEvents(),this.initializeWalkontable()}render(){this.instance.isRenderSuspended()||(this.instance.runHooks("beforeRender",this.instance.forceFullRender),this.postponedAdjustElementsSize&&(this.postponedAdjustElementsSize=!1,this.adjustElementsSize(!0)),this._wt.draw(!this.instance.forceFullRender),this.instance.runHooks("afterRender",this.instance.forceFullRender),this.instance.forceFullRender=!1,this.instance.renderCall=!1)}adjustElementsSize(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.instance.isRenderSuspended()?this.postponedAdjustElementsSize=!0:this._wt.wtOverlays.adjustElementsSize(e)}getCellAtCoords(e,t){const n=this._wt.getCell(e,t);return n<0?null:n}scrollViewport(e,t,n,r,i){return this._wt.scrollViewport(e,t,n,r,i)}scrollViewportHorizontally(e,t,n){return this._wt.scrollViewportHorizontally(e,t,n)}scrollViewportVertically(e,t,n){return this._wt.scrollViewportVertically(e,t,n)}createElements(){const e=X1.get(this),{rootElement:t,rootDocument:n}=this.instance,r=t.getAttribute("style");r&&t.setAttribute("data-originalstyle",r),TG(t,"handsontable"),e.table=n.createElement("TABLE"),TG(e.table,"htCore"),this.instance.getSettings().tableClassName&&TG(e.table,this.instance.getSettings().tableClassName),this.THEAD=n.createElement("THEAD"),e.table.appendChild(this.THEAD),this.TBODY=n.createElement("TBODY"),e.table.appendChild(this.TBODY),this.instance.table=e.table,this.instance.container.insertBefore(e.table,this.instance.container.firstChild)}registerEvents(){const e=X1.get(this),{rootElement:t,rootDocument:n,selection:r}=this.instance,i=n.documentElement;this.eventManager.addEventListener(t,"mousedown",(t=>{if(e.selectionMouseDown=!0,!this.isTextSelectionAllowed(t.target)){const{rootWindow:e}=this.instance;FG(e),t.preventDefault(),e.focus()}})),this.eventManager.addEventListener(t,"mouseup",(()=>{e.selectionMouseDown=!1})),this.eventManager.addEventListener(t,"mousemove",(t=>{e.selectionMouseDown&&!this.isTextSelectionAllowed(t.target)&&(this.settings.fragmentSelection&&FG(this.instance.rootWindow),t.preventDefault())})),this.eventManager.addEventListener(i,"keyup",(e=>{r.isInProgress()&&!e.shiftKey&&r.finish()})),this.eventManager.addEventListener(i,"mouseup",(i=>{r.isInProgress()&&JK(i)&&r.finish(),e.mouseDown=!1,!eK(n.activeElement)&&(r.isSelected()||r.isSelectedByAnyHeader()||t.contains(i.target)||KK(i))||this.instance.unlisten()})),this.eventManager.addEventListener(i,"contextmenu",(t=>{r.isInProgress()&&KK(t)&&(r.finish(),e.mouseDown=!1)})),this.eventManager.addEventListener(i,"touchend",(()=>{r.isInProgress()&&r.finish(),e.mouseDown=!1})),this.eventManager.addEventListener(i,"mousedown",(r=>{const o=r.target,s=r.x||r.clientX,a=r.y||r.clientY;let l=r.target;if(e.mouseDown||!t||!this.instance.view)return;const{holder:c}=this.instance.view._wt.wtTable;if(l===c){const e=UG(n);if(n.elementFromPoint(s+e,a)!==c||n.elementFromPoint(s,a+e)!==c)return}else for(;l!==i;){if(null===l){if(r.isTargetWebComponent)break;return}if(l===t)return;l=l.parentNode}("function"==typeof this.settings.outsideClickDeselects?this.settings.outsideClickDeselects(o):this.settings.outsideClickDeselects)?this.instance.deselectCell():this.instance.destroyEditor(!1,!1)})),this.eventManager.addEventListener(e.table,"selectstart",(e=>{this.settings.fragmentSelection||JG(e.target)||e.preventDefault()}))}translateFromRenderableToVisualCoords(e){let{row:t,col:n}=e;return this.instance._createCellCoords(...this.translateFromRenderableToVisualIndex(t,n))}translateFromRenderableToVisualIndex(e,t){let n=e>=0?this.instance.rowIndexMapper.getVisualFromRenderableIndex(e):e,r=t>=0?this.instance.columnIndexMapper.getVisualFromRenderableIndex(t):t;return null===n&&(n=e),null===r&&(r=t),[n,r]}countRenderableIndexes(e,t){const n=Math.min(e.getNotTrimmedIndexesLength(),t),r=e.getNearestNotHiddenIndex(n-1,-1);return null===r?0:e.getRenderableFromVisualIndex(r)+1}countRenderableColumns(){return this.countRenderableIndexes(this.instance.columnIndexMapper,this.settings.maxCols)}countRenderableRows(){return this.countRenderableIndexes(this.instance.rowIndexMapper,this.settings.maxRows)}countNotHiddenRowIndexes(e,t){return this.countNotHiddenIndexes(e,t,this.instance.rowIndexMapper,this.countRenderableRows())}countNotHiddenColumnIndexes(e,t){return this.countNotHiddenIndexes(e,t,this.instance.columnIndexMapper,this.countRenderableColumns())}countNotHiddenIndexes(e,t,n,r){if(isNaN(e)||e<0)return 0;const i=n.getNearestNotHiddenIndex(e,t),o=n.getRenderableFromVisualIndex(i);if(!Number.isInteger(o))return 0;let s=0;return t<0?s=o+1:t>0&&(s=r-o),s}countNotHiddenFixedColumnsStart(){const e=this.instance.countCols(),t=Math.min(parseInt(this.settings.fixedColumnsStart,10),e)-1;return this.countNotHiddenColumnIndexes(t,-1)}countNotHiddenFixedRowsTop(){const e=this.instance.countRows(),t=Math.min(parseInt(this.settings.fixedRowsTop,10),e)-1;return this.countNotHiddenRowIndexes(t,-1)}countNotHiddenFixedRowsBottom(){const e=this.instance.countRows(),t=Math.max(e-parseInt(this.settings.fixedRowsBottom,10),0);return this.countNotHiddenRowIndexes(t,1)}isMainTableNotFullyCoveredByOverlays(){const e=this.countNotHiddenFixedRowsTop()+this.countNotHiddenFixedRowsBottom(),t=this.countNotHiddenFixedColumnsStart();return this.instance.countRenderedRows()>e&&this.instance.countRenderedCols()>t}initializeWalkontable(){const e=X1.get(this),t={rtlMode:this.instance.isRtl(),externalRowCalculator:this.instance.getPlugin("autoRowSize")&&this.instance.getPlugin("autoRowSize").isEnabled(),table:e.table,isDataViewInstance:()=>L1(this.instance),preventOverflow:()=>this.settings.preventOverflow,preventWheel:()=>this.settings.preventWheel,stretchH:()=>this.settings.stretchH,data:(e,t)=>this.instance.getDataAtCell(...this.translateFromRenderableToVisualIndex(e,t)),totalRows:()=>this.countRenderableRows(),totalColumns:()=>this.countRenderableColumns(),fixedColumnsStart:()=>this.countNotHiddenFixedColumnsStart(),fixedRowsTop:()=>this.countNotHiddenFixedRowsTop(),fixedRowsBottom:()=>this.countNotHiddenFixedRowsBottom(),shouldRenderInlineStartOverlay:()=>this.settings.fixedColumnsStart>0||t.rowHeaders().length>0,shouldRenderTopOverlay:()=>this.settings.fixedRowsTop>0||t.columnHeaders().length>0,shouldRenderBottomOverlay:()=>this.settings.fixedRowsBottom>0,minSpareRows:()=>this.settings.minSpareRows,renderAllRows:this.settings.renderAllRows,rowHeaders:()=>{const e=[];return this.instance.hasRowHeaders()&&e.push(((e,t)=>{const n=e>=0?this.instance.rowIndexMapper.getVisualFromRenderableIndex(e):e;this.appendRowHeader(n,t)})),this.instance.runHooks("afterGetRowHeaderRenderers",e),j1(this,Y1,e.length),e},columnHeaders:()=>{const e=[];return this.instance.hasColHeaders()&&e.push(((e,t)=>{const n=e>=0?this.instance.columnIndexMapper.getVisualFromRenderableIndex(e):e;this.appendColHeader(n,t)})),this.instance.runHooks("afterGetColumnHeaderRenderers",e),j1(this,F1,e.length),e},columnWidth:e=>{const t=this.instance.columnIndexMapper.getVisualFromRenderableIndex(e);return this.instance.getColWidth(null===t?e:t)},rowHeight:e=>{const t=this.instance.rowIndexMapper.getVisualFromRenderableIndex(e);return this.instance.getRowHeight(null===t?e:t)},cellRenderer:(e,t,n)=>{const[r,i]=this.translateFromRenderableToVisualIndex(e,t),o=this.instance.runHooks("modifyGetCellCoords",r,i);let s=r,a=i;Array.isArray(o)&&([s,a]=o);const l=this.instance.getCellMeta(s,a),c=this.instance.colToProp(a);let h=this.instance.getDataAtRowProp(s,c);this.instance.hasHook("beforeValueRender")&&(h=this.instance.runHooks("beforeValueRender",h,l)),this.instance.runHooks("beforeRenderer",n,r,i,c,h,l),this.instance.getCellRenderer(l)(this.instance,n,r,i,c,h,l),this.instance.runHooks("afterRenderer",n,r,i,c,h,l)},selections:this.instance.selection.highlight,hideBorderOnMouseDownOver:()=>this.settings.fragmentSelection,onWindowResize:()=>{this.instance&&!this.instance.isDestroyed&&this.instance.refreshDimensions()},onContainerElementResize:()=>{this.instance&&!this.instance.isDestroyed&&this.instance.refreshDimensions()},onCellMouseDown:(t,n,r,i)=>{const o=this.translateFromRenderableToVisualCoords(n),s={row:!1,column:!1,cell:!1};this.instance.listen(),this.activeWt=i,e.mouseDown=!0,this.instance.runHooks("beforeOnCellMouseDown",t,o,r,s),GK(t)||(I1(t,{coords:o,selection:this.instance.selection,controller:s,cellCoordsFactory:(e,t)=>this.instance._createCellCoords(e,t)}),this.instance.runHooks("afterOnCellMouseDown",t,o,r),this.activeWt=this._wt)},onCellContextMenu:(t,n,r,i)=>{const o=this.translateFromRenderableToVisualCoords(n);this.activeWt=i,e.mouseDown=!1,this.instance.selection.isInProgress()&&this.instance.selection.finish(),this.instance.runHooks("beforeOnCellContextMenu",t,o,r),GK(t)||(this.instance.runHooks("afterOnCellContextMenu",t,o,r),this.activeWt=this._wt)},onCellMouseOut:(e,t,n,r)=>{const i=this.translateFromRenderableToVisualCoords(t);this.activeWt=r,this.instance.runHooks("beforeOnCellMouseOut",e,i,n),GK(e)||(this.instance.runHooks("afterOnCellMouseOut",e,i,n),this.activeWt=this._wt)},onCellMouseOver:(t,n,r,i)=>{const o=this.translateFromRenderableToVisualCoords(n),s={row:!1,column:!1,cell:!1};this.activeWt=i,this.instance.runHooks("beforeOnCellMouseOver",t,o,r,s),GK(t)||(e.mouseDown&&I1(t,{coords:o,selection:this.instance.selection,controller:s,cellCoordsFactory:(e,t)=>this.instance._createCellCoords(e,t)}),this.instance.runHooks("afterOnCellMouseOver",t,o,r),this.activeWt=this._wt)},onCellMouseUp:(e,t,n,r)=>{const i=this.translateFromRenderableToVisualCoords(t);this.activeWt=r,this.instance.runHooks("beforeOnCellMouseUp",e,i,n),GK(e)||this.instance.isDestroyed||(this.instance.runHooks("afterOnCellMouseUp",e,i,n),this.activeWt=this._wt)},onCellCornerMouseDown:e=>{e.preventDefault(),this.instance.runHooks("afterOnCellCornerMouseDown",e)},onCellCornerDblClick:e=>{e.preventDefault(),this.instance.runHooks("afterOnCellCornerDblClick",e)},beforeDraw:(e,t)=>this.beforeRender(e,t),onDraw:e=>this.afterRender(e),onScrollVertically:()=>this.instance.runHooks("afterScrollVertically"),onScrollHorizontally:()=>this.instance.runHooks("afterScrollHorizontally"),onBeforeRemoveCellClassNames:()=>this.instance.runHooks("beforeRemoveCellClassNames"),onBeforeHighlightingRowHeader:(e,t,n)=>{const r=this.instance.rowIndexMapper,i=r.getVisualFromRenderableIndex(e),o=this.instance.runHooks("beforeHighlightingRowHeader",i,t,n);return r.getRenderableFromVisualIndex(r.getNearestNotHiddenIndex(o,1))},onBeforeHighlightingColumnHeader:(e,t,n)=>{const r=this.instance.columnIndexMapper,i=r.getVisualFromRenderableIndex(e),o=this.instance.runHooks("beforeHighlightingColumnHeader",i,t,n);return r.getRenderableFromVisualIndex(r.getNearestNotHiddenIndex(o,1))},onAfterDrawSelection:(e,t,n)=>{let r;const[i,o]=this.translateFromRenderableToVisualIndex(e,t),s=this.instance.selection.getSelectedRange(),a=s.size();if(a>0){const e=(null!=n?n:0)+1-a,t=s.peekByIndex(e);r=[t.from.row,t.from.col,t.to.row,t.to.col]}return this.instance.runHooks("afterDrawSelection",i,o,r,n)},onBeforeDrawBorders:(e,t)=>{const[n,r,i,o]=e,s=[this.instance.rowIndexMapper.getVisualFromRenderableIndex(n),this.instance.columnIndexMapper.getVisualFromRenderableIndex(r),this.instance.rowIndexMapper.getVisualFromRenderableIndex(i),this.instance.columnIndexMapper.getVisualFromRenderableIndex(o)];return this.instance.runHooks("beforeDrawBorders",s,t)},onBeforeTouchScroll:()=>this.instance.runHooks("beforeTouchScroll"),onAfterMomentumScroll:()=>this.instance.runHooks("afterMomentumScroll"),onBeforeStretchingColumnWidth:(e,t)=>{const n=this.instance.columnIndexMapper.getVisualFromRenderableIndex(t);return this.instance.runHooks("beforeStretchingColumnWidth",e,n)},onModifyRowHeaderWidth:e=>this.instance.runHooks("modifyRowHeaderWidth",e),onModifyGetCellCoords:(e,t,n)=>{const r=this.instance.rowIndexMapper,i=this.instance.columnIndexMapper,o=t>=0?i.getVisualFromRenderableIndex(t):t,s=e>=0?r.getVisualFromRenderableIndex(e):e,a=this.instance.runHooks("modifyGetCellCoords",s,o,n);if(Array.isArray(a)){const[e,t,n,o]=a;return[e>=0?r.getRenderableFromVisualIndex(r.getNearestNotHiddenIndex(e,1)):e,t>=0?i.getRenderableFromVisualIndex(i.getNearestNotHiddenIndex(t,1)):t,n>=0?r.getRenderableFromVisualIndex(r.getNearestNotHiddenIndex(n,-1)):n,o>=0?i.getRenderableFromVisualIndex(i.getNearestNotHiddenIndex(o,-1)):o]}},viewportRowCalculatorOverride:e=>{let t=this.settings.viewportRowRenderingOffset;if("auto"===t&&this.settings.fixedRowsTop&&(t=10),t>0||"auto"===t){const n=this.countRenderableRows(),r=e.startRow,i=e.endRow;if("number"==typeof t)e.startRow=Math.max(r-t,0),e.endRow=Math.min(i+t,n-1);else if("auto"===t){const t=Math.ceil(i/n*12);e.startRow=Math.max(r-t,0),e.endRow=Math.min(i+t,n-1)}}this.instance.runHooks("afterViewportRowCalculatorOverride",e)},viewportColumnCalculatorOverride:e=>{let t=this.settings.viewportColumnRenderingOffset;if("auto"===t&&this.settings.fixedColumnsStart&&(t=10),t>0||"auto"===t){const n=this.countRenderableColumns(),r=e.startColumn,i=e.endColumn;if("number"==typeof t&&(e.startColumn=Math.max(r-t,0),e.endColumn=Math.min(i+t,n-1)),"auto"===t){const t=Math.ceil(i/n*6);e.startColumn=Math.max(r-t,0),e.endColumn=Math.min(i+t,n-1)}}this.instance.runHooks("afterViewportColumnCalculatorOverride",e)},rowHeaderWidth:()=>this.settings.rowHeaderWidth,columnHeaderHeight:()=>{const e=this.instance.runHooks("modifyColumnHeaderHeight");return this.settings.columnHeaderHeight||e}};this.instance.runHooks("beforeInitWalkontable",t),this._wt=new $1(t),this.activeWt=this._wt;const n=this._wt.wtTable.spreader,{width:r,height:i}=this.instance.rootElement.getBoundingClientRect();this.setLastSize(r,i),this.eventManager.addEventListener(n,"mousedown",(e=>{e.target===n&&3===e.which&&e.stopPropagation()})),this.eventManager.addEventListener(n,"contextmenu",(e=>{e.target===n&&3===e.which&&e.stopPropagation()})),this.eventManager.addEventListener(this.instance.rootDocument.documentElement,"click",(()=>{this.settings.observeDOMVisibility&&this._wt.drawInterrupted&&(this.instance.forceFullRender=!0,this.render())}))}isTextSelectionAllowed(e){if(JG(e))return!0;const t=SG(e,this.instance.view._wt.wtTable.spreader);return!(!0!==this.settings.fragmentSelection||!t)||!("cell"!==this.settings.fragmentSelection||!this.isSelectedOnlyCell()||!t)||!(this.settings.fragmentSelection||!this.isCellEdited()||!this.isSelectedOnlyCell())}isMouseDown(){return X1.get(this).mouseDown}isSelectedOnlyCell(){var e,t;return null!==(e=null===(t=this.instance.getSelectedRangeLast())||void 0===t?void 0:t.isSingle())&&void 0!==e&&e}isCellEdited(){const e=this.instance.getActiveEditor();return e&&e.isOpened()}beforeRender(e,t){e&&this.instance.runHooks("beforeViewRender",this.instance.forceFullRender,t)}afterRender(e){e&&this.instance.runHooks("afterViewRender",this.instance.forceFullRender)}appendRowHeader(e,t){if(t.firstChild){const n=t.firstChild;if(!_G(n,"relative"))return MG(t),void this.appendRowHeader(e,t);this.updateCellHeader(n.querySelector(".rowHeader"),e,this.instance.getRowHeader)}else{const{rootDocument:n,getRowHeader:r}=this.instance,i=n.createElement("div"),o=n.createElement("span");i.className="relative",o.className="rowHeader",this.updateCellHeader(o,e,r),i.appendChild(o),t.appendChild(i)}this.instance.runHooks("afterGetRowHeader",e,t)}appendColHeader(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.instance.getColHeader,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(t.firstChild){const i=t.firstChild;_G(i,"relative")?this.updateCellHeader(i.querySelector(".colHeader"),e,n,r):(MG(t),this.appendColHeader(e,t,n,r))}else{const{rootDocument:i}=this.instance,o=i.createElement("div"),s=i.createElement("span");o.className="relative",s.className="colHeader",this.updateCellHeader(s,e,n,r),o.appendChild(s),t.appendChild(o)}this.instance.runHooks("afterGetColHeader",e,t,r)}updateCellHeader(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=t;const o=this._wt.wtOverlays.getParentOverlay(e)||this._wt;e.parentNode&&(_G(e,"colHeader")?i=o.wtTable.columnFilter.sourceToRendered(t):_G(e,"rowHeader")&&(i=o.wtTable.rowFilter.sourceToRendered(t))),i>-1?function(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];PG.test(t)?e.innerHTML=n?function(e,t){return mG.sanitize(e,t)}(t):t:AG(e,t)}(e,n(t,r)):(AG(e,String.fromCharCode(160)),TG(e,"cornerHeader"))}maximumVisibleElementWidth(e){const t=this._wt.wtViewport.getWorkspaceWidth()-e;return t>0?t:0}maximumVisibleElementHeight(e){const t=this._wt.wtViewport.getWorkspaceHeight()-e;return t>0?t:0}setLastSize(e,t){const n=X1.get(this);[n.lastWidth,n.lastHeight]=[e,t]}getLastSize(){const e=X1.get(this);return{width:e.lastWidth,height:e.lastHeight}}getFirstFullyVisibleRow(){return this.instance.rowIndexMapper.getVisualFromRenderableIndex(this.instance.view._wt.wtScroll.getFirstVisibleRow())}getLastFullyVisibleRow(){return this.instance.rowIndexMapper.getVisualFromRenderableIndex(this.instance.view._wt.wtScroll.getLastVisibleRow())}getFirstFullyVisibleColumn(){return this.instance.columnIndexMapper.getVisualFromRenderableIndex(this.instance.view._wt.wtScroll.getFirstVisibleColumn())}getLastFullyVisibleColumn(){return this.instance.columnIndexMapper.getVisualFromRenderableIndex(this.instance.view._wt.wtScroll.getLastVisibleColumn())}getColumnHeadersCount(){return B1(this,F1)}getRowHeadersCount(){return B1(this,Y1)}destroy(){this._wt.destroy(),this.eventManager.destroy()}},U1=26;function G1(e){let t=0;return Array.isArray(e)&&(e[0]&&Array.isArray(e[0])?t=e[0].length:e[0]&&zK(e[0])&&(t=DK(e[0]))),t}const K1=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this.hot=e,this.data=t,this.dataType="array",this.colToProp=()=>{},this.propToCol=()=>{}}modifyRowData(e){let t;return this.hot.hasHook("modifyRowData")&&(t=this.hot.runHooks("modifyRowData",e)),void 0===t||Number.isInteger(t)?this.data[e]:t}getData(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.data&&0!==this.data.length?this.getByRange(null,null,e):this.data}setData(e){this.data=e}getAtColumn(e){const t=[];return aK(this.data,((n,r)=>{const i=this.getAtCell(r,e);t.push(i)})),t}getAtRow(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=void 0===t&&void 0===n;let o=null,s=null;if(o=this.modifyRowData(e),Array.isArray(o))s=[],i?o.forEach(((t,n)=>{s[n]=this.getAtPhysicalCell(e,n,o)})):EJ(t,n,(n=>{s[n-t]=this.getAtPhysicalCell(e,n,o)}));else if(zK(o)||_K(o))if(s=r?[]:{},!i||r){const i=0,a=this.countFirstRowKeys()-1;EJ(i,a,(l=>{const c=this.colToProp(l);if(l>=(t||i)&&l<=(n||a)&&!Number.isInteger(c)){const t=this.getAtPhysicalCell(e,c,o);r?s.push(t):NK(s,c,t)}}))}else IK(o,((t,n)=>{NK(s,n,this.getAtPhysicalCell(e,n,o))}));return s}setAtCell(e,t,n){if(!(e>=this.countRows()||t>=this.countFirstRowKeys())){if(this.hot.hasHook("modifySourceData")){const r=WK(n);this.hot.runHooks("modifySourceData",e,t,r,"set"),r.isTouched()&&(n=r.value)}Number.isInteger(t)?this.data[e][t]=n:NK(this.data[e],t,n)}}getAtPhysicalCell(e,t,n){let r=null;if(n&&(r="string"==typeof t?function(e,t){const n=t.split(".");let r=e;return IK(n,(e=>{if(r=r[e],void 0===r)return r=void 0,!1})),r}(n,t):"function"==typeof t?t(n):n[t]),this.hot.hasHook("modifySourceData")){const n=WK(r);this.hot.runHooks("modifySourceData",e,t,n,"get"),n.isTouched()&&(r=n.value)}return r}getAtCell(e,t){const n=this.modifyRowData(e);return this.getAtPhysicalCell(e,this.colToProp(t),n)}getByRange(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=!1,i=null,o=null,s=null,a=null;null===e||null===t?(r=!0,i=0,s=this.countRows()-1):(i=Math.min(e.row,t.row),o=Math.min(e.col,t.col),s=Math.max(e.row,t.row),a=Math.max(e.col,t.col));const l=[];return EJ(i,s,(e=>{l.push(r?this.getAtRow(e,void 0,void 0,n):this.getAtRow(e,o,a,n))})),l}countRows(){if(this.hot.hasHook("modifySourceLength")){const e=this.hot.runHooks("modifySourceLength");if(Number.isInteger(e))return e}return this.data.length}countFirstRowKeys(){return G1(this.data)}destroy(){this.data=null,this.hot=null}},J1={_localHooks:Object.create(null),addLocalHook(e,t){return this._localHooks[e]||(this._localHooks[e]=[]),this._localHooks[e].push(t),this},runLocalHooks(e,t,n,r,i,o,s){if(this._localHooks[e]){const a=this._localHooks[e].length;for(let l=0;l0&&void 0!==arguments[0]?arguments[0]:null;this.indexedValues=[],this.initValueOrFn=e}getValues(){return this.indexedValues}getValueAtIndex(e){const t=this.indexedValues;if(e0&&void 0!==arguments[0]?arguments[0]:this.indexedValues.length;this.indexedValues.length=0,_K(this.initValueOrFn)?EJ(e-1,(e=>this.indexedValues.push(this.initValueOrFn(e)))):EJ(e-1,(()=>this.indexedValues.push(this.initValueOrFn))),this.runLocalHooks("change")}init(e){return this.setDefaultValues(e),this.runLocalHooks("init"),this}insert(){this.runLocalHooks("change")}remove(){this.runLocalHooks("change")}destroy(){this.clearLocalHooks(),this.indexedValues=null,this.initValueOrFn=null}}function n2(e,t,n){return[...e.slice(0,t),...n,...e.slice(t)]}function r2(e,t){return oK(e,(e=>!1===t.includes(e)))}function i2(e,t){return sK(e,(e=>e-t.filter((t=>te>=n?e+r:e))}AK(t2,e2);class s2 extends t2{constructor(){super((e=>e))}insert(e,t){const n=o2(this.indexedValues,t);this.indexedValues=n2(n,e,t),super.insert(e,t)}remove(e){const t=r2(this.indexedValues,e);this.indexedValues=i2(t,e),super.remove(e)}}function a2(e,t,n,r){const i=n.length?n[0]:void 0;return[...e.slice(0,i),...n.map(((e,t)=>_K(r)?r(e,t):r)),...void 0===i?[]:e.slice(i)]}function l2(e,t){return oK(e,((e,n)=>!1===t.includes(n)))}class c2 extends t2{insert(e,t){this.indexedValues=a2(this.indexedValues,0,t,this.initValueOrFn),super.insert(e,t)}remove(e){this.indexedValues=l2(this.indexedValues,e),super.remove(e)}}class h2 extends c2{constructor(){super(arguments.length>0&&void 0!==arguments[0]&&arguments[0])}getHiddenIndexes(){return iK(this.getValues(),((e,t,n)=>(t&&e.push(n),e)),[])}}class u2 extends c2{constructor(){super(arguments.length>0&&void 0!==arguments[0]&&arguments[0])}getTrimmedIndexes(){return iK(this.getValues(),((e,t,n)=>(t&&e.push(n),e)),[])}}const d2=new Map([["hiding",h2],["index",t2],["linkedPhysicalIndexToValue",class extends t2{constructor(){super(...arguments),function(e,t,n){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"orderOfIndexes",[])}getValues(){return this.orderOfIndexes.map((e=>this.indexedValues[e]))}setValues(e){this.orderOfIndexes=[...Array(e.length).keys()],super.setValues(e)}setValueAtIndex(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.orderOfIndexes.length;return e0&&void 0!==arguments[0]?arguments[0]:this.indexedValues.length;this.orderOfIndexes.length=0,super.setDefaultValues(e)}insert(e,t){this.indexedValues=a2(this.indexedValues,0,t,this.initValueOrFn),this.orderOfIndexes=o2(this.orderOfIndexes,t),super.insert(e,t)}remove(e){this.indexedValues=l2(this.indexedValues,e),this.orderOfIndexes=r2(this.orderOfIndexes,e),this.orderOfIndexes=i2(this.orderOfIndexes,e),super.remove(e)}getEntries(){return this.orderOfIndexes.map((e=>[e,this.getValueAtIndex(e)]))}}],["physicalIndexToValue",c2],["trimming",u2]]);let f2=0;class p2{constructor(){this.collection=new Map}register(e,t){!1===this.collection.has(e)&&(this.collection.set(e,t),t.addLocalHook("change",(()=>this.runLocalHooks("change",t))),f2+=1)}unregister(e){const t=this.collection.get(e);dK(t)&&(t.destroy(),this.collection.delete(e),this.runLocalHooks("change",t),f2-=1)}unregisterAll(){this.collection.forEach(((e,t)=>this.unregister(t))),this.collection.clear()}get(e){return fK(e)?Array.from(this.collection.values()):this.collection.get(e)}getLength(){return this.collection.size}removeFromEvery(e){this.collection.forEach((t=>{t.remove(e)}))}insertToEvery(e,t){this.collection.forEach((n=>{n.insert(e,t)}))}initEvery(e){this.collection.forEach((t=>{t.init(e)}))}}AK(p2,e2);class g2 extends p2{constructor(e,t){super(),this.mergedValuesCache=[],this.aggregationFunction=e,this.fallbackValue=t}getMergedValues(){if(!0===(!(arguments.length>0&&void 0!==arguments[0])||arguments[0]))return this.mergedValuesCache;if(0===this.getLength())return[];const e=sK(this.get(),(e=>e.getValues())),t=[],n=dK(e[0])&&e[0].length||0;for(let r=0;r0&&this.runLocalHooks("change",e),this}_writeInitialChanges(e){!function(e,t,n){(function(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=n}})(e,m2(e,t,"set"),n)}(this,b2,e)}}function y2(e,t){const n=[];let r=0,i=0;for(;r0&&void 0!==arguments[0]?arguments[0]:{};O2(this,k2,{writable:!0,value:new Set}),O2(this,C2,{writable:!0,value:[]}),O2(this,_2,{writable:!0,value:[]}),O2(this,T2,{writable:!0,value:!1}),O2(this,R2,{writable:!0,value:!1}),x2(this,R2,null!=e&&e)}createObserver(){const e=new v2;return w2(this,k2).add(e),e.addLocalHook("unsubscribe",(()=>{w2(this,k2).delete(e)})),e._writeInitialChanges(y2(w2(this,C2),w2(this,_2))),e}emit(e){let t=w2(this,_2);w2(this,T2)&&w2(this,C2).length===e.length||(0===e.length?e=new Array(t.length).fill(w2(this,R2)):x2(this,C2,new Array(e.length).fill(w2(this,R2))),w2(this,T2)||(x2(this,T2,!0),t=w2(this,C2)));const n=y2(t,e);w2(this,k2).forEach((e=>e._write(n))),x2(this,_2,e)}}new Set;class M2{constructor(){this.indexesSequence=new s2,this.trimmingMapsCollection=new g2((e=>e.some((e=>!0===e))),!1),this.hidingMapsCollection=new g2((e=>e.some((e=>!0===e))),!1),this.variousMapsCollection=new p2,this.hidingChangesObservable=new E2({initialIndexValue:!1}),this.notTrimmedIndexesCache=[],this.notHiddenIndexesCache=[],this.isBatched=!1,this.indexesSequenceChanged=!1,this.indexesChangeSource=void 0,this.trimmedIndexesChanged=!1,this.hiddenIndexesChanged=!1,this.renderablePhysicalIndexesCache=[],this.fromPhysicalToVisualIndexesCache=new Map,this.fromVisualToRenderableIndexesCache=new Map,this.indexesSequence.addLocalHook("change",(()=>{this.indexesSequenceChanged=!0,this.updateCache(),this.runLocalHooks("indexesSequenceChange",this.indexesChangeSource),this.runLocalHooks("change",this.indexesSequence,null)})),this.trimmingMapsCollection.addLocalHook("change",(e=>{this.trimmedIndexesChanged=!0,this.updateCache(),this.runLocalHooks("change",e,this.trimmingMapsCollection)})),this.hidingMapsCollection.addLocalHook("change",(e=>{this.hiddenIndexesChanged=!0,this.updateCache(),this.runLocalHooks("change",e,this.hidingMapsCollection)})),this.variousMapsCollection.addLocalHook("change",(e=>{this.runLocalHooks("change",e,this.variousMapsCollection)}))}suspendOperations(){this.isBatched=!0}resumeOperations(){this.isBatched=!1,this.updateCache()}createChangesObserver(e){if("hiding"!==e)throw new Error(`Unsupported index map type "${e}".`);return this.hidingChangesObservable.createObserver()}createAndRegisterIndexMap(e,t,n){return this.registerMap(e,function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!d2.has(e))throw new Error(`The provided map type ("${e}") does not exist.`);return new(d2.get(e))(t)}(t,n))}registerMap(e,t){if(this.trimmingMapsCollection.get(e)||this.hidingMapsCollection.get(e)||this.variousMapsCollection.get(e))throw Error(`Map with name "${e}" has been already registered.`);t instanceof u2?this.trimmingMapsCollection.register(e,t):t instanceof h2?this.hidingMapsCollection.register(e,t):this.variousMapsCollection.register(e,t);const n=this.getNumberOfIndexes();return n>0&&t.init(n),t}unregisterMap(e){this.trimmingMapsCollection.unregister(e),this.hidingMapsCollection.unregister(e),this.variousMapsCollection.unregister(e)}unregisterAll(){this.trimmingMapsCollection.unregisterAll(),this.hidingMapsCollection.unregisterAll(),this.variousMapsCollection.unregisterAll()}getPhysicalFromVisualIndex(e){const t=this.notTrimmedIndexesCache[e];return dK(t)?t:null}getPhysicalFromRenderableIndex(e){const t=this.renderablePhysicalIndexesCache[e];return dK(t)?t:null}getVisualFromPhysicalIndex(e){const t=this.fromPhysicalToVisualIndexesCache.get(e);return dK(t)?t:null}getVisualFromRenderableIndex(e){return this.getVisualFromPhysicalIndex(this.getPhysicalFromRenderableIndex(e))}getRenderableFromVisualIndex(e){const t=this.fromVisualToRenderableIndexesCache.get(e);return dK(t)?t:null}getNearestNotHiddenIndex(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(null===this.getPhysicalFromVisualIndex(e))return null;if(this.fromVisualToRenderableIndexesCache.has(e))return e;const r=Array.from(this.fromVisualToRenderableIndexesCache.keys());let i=-1;return i=t>0?r.findIndex((t=>t>e)):r.reverse().findIndex((t=>t0&&void 0!==arguments[0]?arguments[0]:this.getNumberOfIndexes();this.notTrimmedIndexesCache=[...new Array(e).keys()],this.notHiddenIndexesCache=[...new Array(e).keys()],this.suspendOperations(),this.indexesChangeSource="init",this.indexesSequence.init(e),this.indexesChangeSource=void 0,this.trimmingMapsCollection.initEvery(e),this.resumeOperations(),this.suspendOperations(),this.hidingMapsCollection.initEvery(e),this.variousMapsCollection.initEvery(e),this.resumeOperations(),this.runLocalHooks("init")}fitToLength(e){const t=this.getNumberOfIndexes();if(et+e));this.removeIndexes(t)}else this.insertIndexes(t,e-t)}getIndexesSequence(){return this.indexesSequence.getValues()}setIndexesSequence(e){void 0===this.indexesChangeSource&&(this.indexesChangeSource="update"),this.indexesSequence.setValues(e),"update"===this.indexesChangeSource&&(this.indexesChangeSource=void 0)}getNotTrimmedIndexes(){return!0===(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])?this.notTrimmedIndexesCache:this.getIndexesSequence().filter((e=>!1===this.isTrimmed(e)))}getNotTrimmedIndexesLength(){return this.getNotTrimmedIndexes().length}getNotHiddenIndexes(){return!0===(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])?this.notHiddenIndexesCache:this.getIndexesSequence().filter((e=>!1===this.isHidden(e)))}getNotHiddenIndexesLength(){return this.getNotHiddenIndexes().length}getRenderableIndexes(){return!0===(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])?this.renderablePhysicalIndexesCache:this.getNotTrimmedIndexes().filter((e=>!1===this.isHidden(e)))}getRenderableIndexesLength(){return this.getRenderableIndexes().length}getNumberOfIndexes(){return this.getIndexesSequence().length}moveIndexes(e,t){"number"==typeof e&&(e=[e]);const n=sK(e,(e=>this.getPhysicalFromVisualIndex(e))),r=this.getNotTrimmedIndexesLength(),i=e.length,o=r2(this.getIndexesSequence(),n),s=o.filter((e=>!1===this.isTrimmed(e)));let a=o.indexOf(s[s.length-1])+1;if(t+ie+t));this.suspendOperations(),this.indexesChangeSource="insert",this.indexesSequence.insert(i,o),this.indexesChangeSource=void 0,this.trimmingMapsCollection.insertToEvery(i,o),this.hidingMapsCollection.insertToEvery(i,o),this.variousMapsCollection.insertToEvery(i,o),this.resumeOperations()}removeIndexes(e){this.suspendOperations(),this.indexesChangeSource="remove",this.indexesSequence.remove(e),this.indexesChangeSource=void 0,this.trimmingMapsCollection.removeFromEvery(e),this.hidingMapsCollection.removeFromEvery(e),this.variousMapsCollection.removeFromEvery(e),this.resumeOperations()}updateCache(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=this.indexesSequenceChanged||this.trimmedIndexesChanged||this.hiddenIndexesChanged;(!0===e||!1===this.isBatched&&!0===t)&&(this.trimmingMapsCollection.updateCache(),this.hidingMapsCollection.updateCache(),this.notTrimmedIndexesCache=this.getNotTrimmedIndexes(!1),this.notHiddenIndexesCache=this.getNotHiddenIndexes(!1),this.renderablePhysicalIndexesCache=this.getRenderableIndexes(!1),this.cacheFromPhysicalToVisualIndexes(),this.cacheFromVisualToRenderableIndexes(),this.hiddenIndexesChanged&&this.hidingChangesObservable.emit(this.hidingMapsCollection.getMergedValues()),this.runLocalHooks("cacheUpdated",{indexesSequenceChanged:this.indexesSequenceChanged,trimmedIndexesChanged:this.trimmedIndexesChanged,hiddenIndexesChanged:this.hiddenIndexesChanged}),this.indexesSequenceChanged=!1,this.trimmedIndexesChanged=!1,this.hiddenIndexesChanged=!1)}cacheFromPhysicalToVisualIndexes(){const e=this.getNotTrimmedIndexesLength();this.fromPhysicalToVisualIndexesCache.clear();for(let t=0;t{fK(n[t])&&(n[t]=e)})))}(n,r),h3(n,PK(r)),PK(r)}function g3(e){return m3(e)?PK(u3(e)):null}function m3(e){return d3(e)}function b3(e,t,n){const r=g3(e);if(null===r)return null;const i=r[t];if(fK(i))return null;const o=function(e,t){let n=e;return aK(z2(),(r=>{n=r(e,t)})),n}(i,n);return Array.isArray(o)?o[0]:o}p3(a3);const v3="active-header",y3="area",O3="cell",w3="fill",x3="header",S3="custom-selection",k3=class{constructor(e,t){t&&(this.eventManager=e.eventManager,this.instance=e,this.wot=e,this.settings=t,this.mouseDown=!1,this.main=null,this.top=null,this.bottom=null,this.start=null,this.end=null,this.topStyle=null,this.bottomStyle=null,this.startStyle=null,this.endStyle=null,this.cornerDefaultStyle={width:"6px",height:"6px",borderWidth:"1px",borderStyle:"solid",borderColor:"#FFF"},this.cornerCenterPointOffset=-parseInt(this.cornerDefaultStyle.width,10)/2,this.corner=null,this.cornerStyle=null,this.createBorders(t),this.registerListeners())}registerListeners(){const e=this.wot.rootDocument.body;this.eventManager.addEventListener(e,"mousedown",(()=>this.onMouseDown())),this.eventManager.addEventListener(e,"mouseup",(()=>this.onMouseUp()));for(let e=0,t=this.main.childNodes.length;ethis.onMouseEnter(t,this.main.childNodes[e])))}}onMouseDown(){this.mouseDown=!0}onMouseUp(){this.mouseDown=!1}onMouseEnter(e,t){if(!this.mouseDown||!this.wot.getSetting("hideBorderOnMouseDownOver"))return;e.preventDefault(),UK(e);const n=this,r=this.wot.rootDocument.body,i=t.getBoundingClientRect();t.style.display="none",this.eventManager.addEventListener(r,"mousemove",(function e(o){var s;((s=o).clientYMath.ceil(i.top+i.height)||s.clientXMath.ceil(i.left+i.width))&&(n.eventManager.removeEventListener(r,"mousemove",e),t.style.display="block")}))}createBorders(e){const{rootDocument:t}=this.wot;this.main=t.createElement("div");const n=["top","start","bottom","end","corner"];let r=this.main.style;r.position="absolute",r.top=0,r.left=0;for(let i=0;i<5;i++){const o=n[i],s=t.createElement("div");s.className=`wtBorder ${this.settings.className||""}`,this.settings[o]&&this.settings[o].hide&&(s.className+=" hidden"),r=s.style,r.backgroundColor=this.settings[o]&&this.settings[o].color?this.settings[o].color:e.border.color,r.height=this.settings[o]&&this.settings[o].width?`${this.settings[o].width}px`:`${e.border.width}px`,r.width=this.settings[o]&&this.settings[o].width?`${this.settings[o].width}px`:`${e.border.width}px`,this.main.appendChild(s)}this.top=this.main.childNodes[0],this.start=this.main.childNodes[1],this.bottom=this.main.childNodes[2],this.end=this.main.childNodes[3],this.topStyle=this.top.style,this.startStyle=this.start.style,this.bottomStyle=this.bottom.style,this.endStyle=this.end.style,this.corner=this.main.childNodes[4],this.corner.className+=" corner",this.cornerStyle=this.corner.style,this.cornerStyle.width=this.cornerDefaultStyle.width,this.cornerStyle.height=this.cornerDefaultStyle.height,this.cornerStyle.border=[this.cornerDefaultStyle.borderWidth,this.cornerDefaultStyle.borderStyle,this.cornerDefaultStyle.borderColor].join(" "),ZK()&&this.createMultipleSelectorHandles(),this.disappear();const{wtTable:i}=this.wot;let o=i.bordersHolder;o||(o=t.createElement("div"),o.className="htBorders",i.bordersHolder=o,i.spreader.appendChild(o)),o.appendChild(this.main)}createMultipleSelectorHandles(){const{rootDocument:e}=this.wot;this.selectionHandles={top:e.createElement("DIV"),topHitArea:e.createElement("DIV"),bottom:e.createElement("DIV"),bottomHitArea:e.createElement("DIV")},this.selectionHandles.top.className="topSelectionHandle topLeftSelectionHandle",this.selectionHandles.topHitArea.className="topSelectionHandle-HitArea topLeftSelectionHandle-HitArea",this.selectionHandles.bottom.className="bottomSelectionHandle bottomRightSelectionHandle",this.selectionHandles.bottomHitArea.className="bottomSelectionHandle-HitArea bottomRightSelectionHandle-HitArea",this.selectionHandles.styles={top:this.selectionHandles.top.style,topHitArea:this.selectionHandles.topHitArea.style,bottom:this.selectionHandles.bottom.style,bottomHitArea:this.selectionHandles.bottomHitArea.style},IK({position:"absolute",height:"40px",width:"40px","border-radius":`${parseInt(40/1.5,10)}px`},((e,t)=>{this.selectionHandles.styles.bottomHitArea[t]=e,this.selectionHandles.styles.topHitArea[t]=e})),IK({position:"absolute",height:"10px",width:"10px","border-radius":`${parseInt(10/1.5,10)}px`,background:"#F5F5FF",border:"1px solid #4285c8"},((e,t)=>{this.selectionHandles.styles.bottom[t]=e,this.selectionHandles.styles.top[t]=e})),this.main.appendChild(this.selectionHandles.top),this.main.appendChild(this.selectionHandles.bottom),this.main.appendChild(this.selectionHandles.topHitArea),this.main.appendChild(this.selectionHandles.bottomHitArea)}isPartRange(e,t){const n=this.wot.selections.createOrGetArea();return!(!n.cellRange||e===n.cellRange.to.row&&t===n.cellRange.to.col)}updateMultipleSelectionHandlesPosition(e,t,n,r,i,o){const s=this.wot.wtSettings.getSetting("rtlMode")?"right":"left",{top:a,topHitArea:l,bottom:c,bottomHitArea:h}=this.selectionHandles.styles,u=parseInt(a.borderWidth,10),d=parseInt(a.width,10),f=parseInt(l.width,10),p=this.wot.wtTable.getWidth(),g=this.wot.wtTable.getHeight();a.top=`${parseInt(n-d-1,10)}px`,a[s]=`${parseInt(r-d-1,10)}px`,l.top=`${parseInt(n-f/4*3,10)}px`,l[s]=`${parseInt(r-f/4*3,10)}px`;const m=Math.min(parseInt(r+i,10),p-d-2*u),b=Math.min(parseInt(r+i-f/4,10),p-f-2*u);c[s]=`${m}px`,h[s]=`${b}px`;const v=Math.min(parseInt(n+o,10),g-d-2*u),y=Math.min(parseInt(n+o-f/4,10),g-f-2*u);c.top=`${v}px`,h.top=`${y}px`,this.settings.border.cornerVisible&&this.settings.border.cornerVisible()?(a.display="block",l.display="block",this.isPartRange(e,t)?(c.display="none",h.display="none"):(c.display="block",h.display="block")):(a.display="none",c.display="none",l.display="none",h.display="none"),e===this.wot.wtSettings.getSetting("fixedRowsTop")||t===this.wot.wtSettings.getSetting("fixedColumnsStart")?(a.zIndex="9999",l.zIndex="9999"):(a.zIndex="",l.zIndex="")}appear(e){if(this.disabled)return;const{wtTable:t,rootDocument:n,rootWindow:r}=this.wot;let i,o,s,a,l,c;const h=t.getRenderedRowsCount();for(let n=0;n=e[0]&&r<=e[2]){i=r,l=e[0];break}}for(let n=h-1;n>=0;n-=1){const r=t.rowFilter.renderedToSource(n);if(r>=e[0]&&r<=e[2]){o=r;break}}const u=t.getRenderedColumnsCount();for(let n=0;n=e[1]&&r<=e[3]){s=r,c=e[1];break}}for(let n=u-1;n>=0;n-=1){const r=t.columnFilter.renderedToSource(n);if(r>=e[1]&&r<=e[3]){a=r;break}}if(void 0===i||void 0===s)return void this.disappear();let d=t.getCell(this.wot.createCellCoords(i,s));const f=i!==o||s!==a,p=f?t.getCell(this.wot.createCellCoords(o,a)):d,g=zG(d),m=f?zG(p):g,b=zG(t.TABLE),v=BG(t.TABLE),y=g.top,O=g.left,w=this.wot.wtSettings.getSetting("rtlMode");let x=0,S=0;if(w){const e=BG(d),t=r.innerWidth-b.left-v;S=O+e-m.left,x=r.innerWidth-O-e-t-1}else S=m.left+BG(p)-O,x=O-b.left-1;if(this.isEntireColumnSelected(i,o)){const e=this.getDimensionsFromHeader("columns",s,a,l,b);let t=null;e&&([t,x,S]=e),t&&(d=t)}let k=y-b.top-1,C=m.top+jG(p)-y;if(this.isEntireRowSelected(s,a)){const e=this.getDimensionsFromHeader("rows",i,o,c,b);let t=null;e&&([t,k,C]=e),t&&(d=t)}const _=VG(d,r);parseInt(_.borderTopWidth,10)>0&&(k+=1,C=C>0?C-1:0),parseInt(_[w?"borderRightWidth":"borderLeftWidth"],10)>0&&(x+=1,S=S>0?S-1:0);const T=w?"right":"left";this.topStyle.top=`${k}px`,this.topStyle[T]=`${x}px`,this.topStyle.width=`${S}px`,this.topStyle.display="block",this.startStyle.top=`${k}px`,this.startStyle[T]=`${x}px`,this.startStyle.height=`${C}px`,this.startStyle.display="block";const R=Math.floor(this.settings.border.width/2);this.bottomStyle.top=k+C-R+"px",this.bottomStyle[T]=`${x}px`,this.bottomStyle.width=`${S}px`,this.bottomStyle.display="block",this.endStyle.top=`${k}px`,this.endStyle[T]=x+S-R+"px",this.endStyle.height=`${C+1}px`,this.endStyle.display="block";let E=this.settings.border.cornerVisible;E="function"==typeof E?E(this.settings.layerLevel):E;const M=this.wot.getSetting("onModifyGetCellCoords",o,a);let[P,A]=[o,a];if(M&&Array.isArray(M)&&([,,P,A]=M),ZK()||!E||this.isPartRange(P,A))this.cornerStyle.display="none";else{this.cornerStyle.top=k+C+this.cornerCenterPointOffset-1+"px",this.cornerStyle[T]=x+S+this.cornerCenterPointOffset-1+"px",this.cornerStyle.borderRightWidth=this.cornerDefaultStyle.borderWidth,this.cornerStyle.width=this.cornerDefaultStyle.width,this.cornerStyle.display="none";let e=LG(t.TABLE);const i=e===r;i&&(e=n.documentElement);const s=parseInt(this.cornerDefaultStyle.width,10)/2,l=parseInt(this.cornerDefaultStyle.height,10)/2;if(a===this.wot.getSetting("totalColumns")-1){const t=i?p.getBoundingClientRect().left:p.offsetLeft;let n=!1,r=0;w?(r=t-parseInt(this.cornerDefaultStyle.width,10)/2,n=r<0):(r=t+BG(p)+parseInt(this.cornerDefaultStyle.width,10)/2,n=r>=XG(e)),n&&(this.cornerStyle[T]=`${Math.floor(x+S+this.cornerCenterPointOffset-s)}px`,this.cornerStyle[w?"borderLeftWidth":"borderRightWidth"]=0)}o===this.wot.getSetting("totalRows")-1&&(i?p.getBoundingClientRect().top:p.offsetTop)+jG(p)+parseInt(this.cornerDefaultStyle.height,10)/2>=ZG(e)&&(this.cornerStyle.top=`${Math.floor(k+C+this.cornerCenterPointOffset-l)}px`,this.cornerStyle.borderBottomWidth=0),this.cornerStyle.display="block"}ZK()&&this.updateMultipleSelectionHandlesPosition(o,a,k,x,S,C)}isEntireColumnSelected(e,t){return e===this.wot.wtTable.getFirstRenderedRow()&&t===this.wot.wtTable.getLastRenderedRow()}isEntireRowSelected(e,t){return e===this.wot.wtTable.getFirstRenderedColumn()&&t===this.wot.wtTable.getLastRenderedColumn()}getDimensionsFromHeader(e,t,n,r,i){const{wtTable:o}=this.wot,s=o.wtRootElement.parentNode;let a=null,l=null,c=null,h=null,u=null,d=null,f=null,p=null;switch(e){case"rows":a=function(){return o.getRowHeader(...arguments)},l=function(){return jG(...arguments)},c="ht__selection--rows",d="top";break;case"columns":a=function(){return o.getColumnHeader(...arguments)},l=function(){return BG(...arguments)},c="ht__selection--columns",d="left"}if(s.classList.contains(c)){const e=this.wot.getSetting("columnHeaders").length;if(f=a(t,e-r),p=a(n,e-r),!f||!p)return!1;const o=zG(f),s=zG(p);return f&&p&&(h=o[d]-i[d]-1,u=s[d]+l(p)-o[d]),[f,h,u]}return!1}changeBorderStyle(e,t){const n=this[e].style,r=t[e];!r||r.hide?TG(this[e],"hidden"):(_G(this[e],"hidden")&&RG(this[e],"hidden"),n.backgroundColor=r.color,"top"!==e&&"bottom"!==e||(n.height=`${r.width}px`),"start"!==e&&"end"!==e||(n.width=`${r.width}px`))}changeBorderToDefaultStyle(e){const t=this[e].style;t.backgroundColor="#000",t.width="1px",t.height="1px"}toggleHiddenClass(e,t){this.changeBorderToDefaultStyle(e),t?TG(this[e],"hidden"):RG(this[e],"hidden")}disappear(){this.topStyle.display="none",this.bottomStyle.display="none",this.startStyle.display="none",this.endStyle.display="none",this.cornerStyle.display="none",ZK()&&(this.selectionHandles.styles.top.display="none",this.selectionHandles.styles.topHitArea.display="none",this.selectionHandles.styles.bottom.display="none",this.selectionHandles.styles.bottomHitArea.display="none")}destroy(){this.eventManager.destroyWithOwnEventsOnly(),this.main.parentNode.removeChild(this.main)}},C3=class{constructor(e,t){this.settings=e,this.cellRange=t||null,this.instanceBorders={},this.classNames=[this.settings.className],this.classNameGenerator=this.linearClassNameGenerator(this.settings.className,this.settings.layerLevel)}getBorder(e){return this.instanceBorders[e.guid]||(this.instanceBorders[e.guid]=new k3(e,this.settings)),this.instanceBorders[e.guid]}isEmpty(){return null===this.cellRange}add(e){return this.isEmpty()?this.cellRange=this.settings.createCellRange(e):this.cellRange.expand(e),this}replace(e,t){if(!this.isEmpty()){if(this.cellRange.from.isEqual(e))return this.cellRange.from=t,!0;if(this.cellRange.to.isEqual(e))return this.cellRange.to=t,!0}return!1}clear(){return this.cellRange=null,this}getCorners(){const e=this.cellRange.getOuterTopStartCorner(),t=this.cellRange.getOuterBottomEndCorner();return[e.row,e.col,t.row,t.col]}addClassAtCoords(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const o=e.wtTable.getCell(this.settings.createCellCoords(t,n));if("object"==typeof o){let e=r;i&&(e=this.classNameGenerator(o),this.classNames.includes(e)||this.classNames.push(e)),TG(o,e)}return this}linearClassNameGenerator(e,t){return function n(r){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;if(0===t||0===i)return e;let o=i>=0?i:t,s=e;return o-=1,s=_G(r,0===o?e:`${e}-${o}`)?`${e}-${o+1}`:n(r,o),s}}draw(e){if(this.isEmpty())return void(this.settings.border&&this.getBorder(e).disappear());const t=e.wtTable.getRenderedRowsCount(),n=e.wtTable.getRenderedColumnsCount(),r=this.getCorners(),[i,o,s,a]=r,{highlightHeaderClassName:l,highlightColumnClassName:c,highlightRowClassName:h,highlightOnlyClosestHeader:u,selectionType:d}=this.settings,f=void 0===d||["active-header","header"].includes(d);if(f&&null!==o&&null!==a){let t=0;for(let r=0;r=o&&n<=a){let r=e.wtTable.getColumnHeaders(n);const i=r.length-1;u&&r.length>1&&(r=[r[i]]);for(let s=0;s=i&&t<=s){let n=e.wtTable.getRowHeaders(t);const o=n.length-1;u&&n.length>1&&(n=[n[o]]);for(let a=0;a=i&&t<=s&&n>=o&&n<=a?this.settings.className&&this.addClassAtCoords(e,t,n,this.settings.className,this.settings.markIntersections):t>=i&&t<=s?h&&this.addClassAtCoords(e,t,n,h):n>=o&&n<=a&&c&&this.addClassAtCoords(e,t,n,c);const l=e.getSetting("onAfterDrawSelection",t,n,this.settings.layerLevel);"string"==typeof l&&this.addClassAtCoords(e,t,n,l)}}}e.getSetting("onBeforeDrawBorders",r,this.settings.className),this.settings.border&&this.getBorder(e).appear(r)}destroy(){Object.values(this.instanceBorders).forEach((e=>e.destroy()))}};const _3=class extends C3{constructor(e,t){super(e,null),function(e,t,n){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"visualCellRange",null),this.visualCellRange=t||null,this.commit()}add(e){return null===this.visualCellRange?this.visualCellRange=this.settings.createCellRange(e):this.visualCellRange.expand(e),this}clear(){return this.visualCellRange=null,super.clear()}trimToVisibleCellsRangeOnly(e){let{from:t,to:n}=e,r=this.getNearestNotHiddenCoords(t,1),i=this.getNearestNotHiddenCoords(n,-1);if(null===r||null===i)return null;if(r.row>i.row||r.col>i.col){if("header"!==this.settings.type&&"active-header"!==this.settings.type)return null;r=t,i=n}return this.settings.createCellRange(r,r,i)}getNearestNotHiddenCoords(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t;const r=this.getNearestNotHiddenIndex(this.settings.rowIndexMapper(),e.row,t);if(null===r)return null;const i=this.getNearestNotHiddenIndex(this.settings.columnIndexMapper(),e.col,n);return null===i?null:this.settings.createCellCoords(r,i)}getNearestNotHiddenIndex(e,t,n){if(t<0)return t;const r=e.getNearestNotHiddenIndex(t,n);return"header"!==this.settings.type&&"active-header"!==this.settings.type||null!==r?r:-1}commit(){if(null===this.visualCellRange)return this;const e=this.trimToVisibleCellsRangeOnly(this.visualCellRange);return this.cellRange=null===e?null:this.createRenderableCellRange(e.from,e.to),this}syncWith(e){const t="N-S"===e.getVerticalDirection()?1:-1,n="W-E"===e.getHorizontalDirection()?1:-1,r=this.getNearestNotHiddenCoords(e.from.clone().normalize(),t,n);if(null!==r&&e.overlaps(r)){if(null===this.cellRange){const e=this.settings.visualToRenderableCoords(r);this.cellRange=this.settings.createCellRange(e)}return e.setHighlight(r),this}return e.setHighlight(e.from),this}getCorners(){const{from:e,to:t}=this.cellRange,n=null===e.row||null===t.row,r=null===e.col||null===t.col,i=this.settings.createCellCoords(n?null:Math.min(e.row,t.row),r?null:Math.min(e.col,t.col)),o=this.settings.createCellCoords(n?null:Math.max(e.row,t.row),r?null:Math.max(e.col,t.col));return[i.row,i.col,o.row,o.col]}getVisualCorners(){const e=this.settings.renderableToVisualCoords(this.cellRange.getTopStartCorner()),t=this.settings.renderableToVisualCoords(this.cellRange.getBottomEndCorner());return[e.row,e.col,t.row,t.col]}createRenderableCellRange(e,t){const n=this.settings.visualToRenderableCoords(e),r=this.settings.visualToRenderableCoords(t);return this.settings.createCellRange(n,n,r)}},{register:T3,getItem:R3}=cJ("highlight/types");function E3(e,t){return R3(e)({type:e,...t})}T3(v3,(function(e){let{activeHeaderClassName:t,...n}=e;return new _3({highlightHeaderClassName:t,...n,selectionType:v3})})),T3(y3,(function(e){let{layerLevel:t,areaCornerVisible:n,...r}=e;return new _3({className:"area",markIntersections:!0,layerLevel:Math.min(t,7),border:{width:1,color:"#4b89ff",cornerVisible:n},...r,selectionType:y3})})),T3(O3,(function(e){let{cellCornerVisible:t,...n}=e;return new _3({className:"current",border:{width:2,color:"#4b89ff",cornerVisible:t},...n,selectionType:O3})})),T3(S3,(function(e){let{border:t,visualCellRange:n,...r}=e;return new _3({...t,...r,selectionType:S3},n)})),T3(w3,(function(e){let{...t}=e;return new _3({className:"fill",border:{width:1,color:"#ff0000"},...t,selectionType:w3})})),T3(x3,(function(e){let{headerClassName:t,rowClassName:n,columnClassName:r,...i}=e;return new _3({className:"highlight",highlightHeaderClassName:t,highlightRowClassName:n,highlightColumnClassName:r,...i,highlightOnlyClosestHeader:!0,selectionType:x3})}));class M3{constructor(e){this.options=e,this.layerLevel=0,this.cell=E3(O3,e),this.fill=E3(w3,e),this.areas=new Map,this.headers=new Map,this.activeHeaders=new Map,this.customSelections=[]}isEnabledFor(e,t){let n=e;e===O3&&(n="current");let r=this.options.disabledCellSelection(t.row,t.col);return"string"==typeof r&&(r=[r]),!1===r||Array.isArray(r)&&!r.includes(n)}useLayerLevel(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.layerLevel=e,this}getCell(){return this.cell}getFill(){return this.fill}createOrGetArea(){const e=this.layerLevel;let t;return this.areas.has(e)?t=this.areas.get(e):(t=E3(y3,{layerLevel:e,...this.options}),this.areas.set(e,t)),t}getAreas(){return[...this.areas.values()]}createOrGetHeader(){const e=this.layerLevel;let t;return this.headers.has(e)?t=this.headers.get(e):(t=E3(x3,{...this.options}),this.headers.set(e,t)),t}getHeaders(){return[...this.headers.values()]}createOrGetActiveHeader(){const e=this.layerLevel;let t;return this.activeHeaders.has(e)?t=this.activeHeaders.get(e):(t=E3(v3,{...this.options}),this.activeHeaders.set(e,t)),t}getActiveHeaders(){return[...this.activeHeaders.values()]}getCustomSelections(){return[...this.customSelections.values()]}addCustomSelection(e){this.customSelections.push(E3(S3,{...this.options,...e}))}clear(){this.cell.clear(),this.fill.clear(),aK(this.areas.values(),(e=>{e.clear()})),aK(this.headers.values(),(e=>{e.clear()})),aK(this.activeHeaders.values(),(e=>{e.clear()}))}[Symbol.iterator](){return[this.cell,this.fill,...this.areas.values(),...this.headers.values(),...this.activeHeaders.values(),...this.customSelections][Symbol.iterator]()}}const P3=M3;class A3{constructor(e){this.ranges=[],this.createCellRange=e}isEmpty(){return 0===this.size()}set(e){return this.clear(),this.ranges.push(this.createCellRange(e)),this}add(e){return this.ranges.push(this.createCellRange(e)),this}pop(){return this.ranges.pop(),this}current(){return this.peekByIndex(0)}previous(){return this.peekByIndex(-1)}includes(e){return this.ranges.some((t=>t.includes(e)))}clear(){return this.ranges.length=0,this}size(){return this.ranges.length}peekByIndex(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const t=this.size()+e-1;let n;return t>=0&&(n=this.ranges[t]),n}[Symbol.iterator](){return this.ranges[Symbol.iterator]()}}const $3=A3;class z3{constructor(e,t){this.range=e,this.options=t}transformStart(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=this.options.createCellCoords(e,t),i=this.range.current().highlight,{row:o,col:s}=this.options.visualToRenderableCoords(i);let a=i,l=0,c=0;if(this.runLocalHooks("beforeTransformStart",r),null!==o&&null!==s){let t=this.options.countRows(),i=this.options.countCols();const h=this.options.fixedRowsBottom(),u=this.options.minSpareRows(),d=this.options.minSpareCols(),f=this.options.autoWrapRow(),p=this.options.autoWrapCol();o+e>t-1?n&&u>0&&!(h&&o>=t-h-1)?(this.runLocalHooks("insertRowRequire",t),t=this.options.countRows()):p&&(r.row=1-t,r.col=s+r.col===i-1?1-i:1):p&&o+r.row<0&&s+r.col>=0&&(r.row=t-1,r.col=s+r.col===0?i-1:-1),s+r.col>i-1?n&&d>0?(this.runLocalHooks("insertColRequire",i),i=this.options.countCols()):f&&(r.row=o+r.row===t-1?1-t:1,r.col=1-i):f&&s+r.col<0&&o+r.row>=0&&(r.row=o+r.row===0?t-1:-1,r.col=i-1);const g=this.options.createCellCoords(o+r.row,s+r.col);l=0,c=0,g.row<0?(l=-1,g.row=0):g.row>0&&g.row>=t&&(l=1,g.row=t-1),g.col<0?(c=-1,g.col=0):g.col>0&&g.col>=i&&(c=1,g.col=i-1),a=this.options.renderableToVisualCoords(g)}return this.runLocalHooks("afterTransformStart",a,l,c),a}transformEnd(e,t){const n=this.options.createCellCoords(e,t),r=this.range.current();let i=r.to,o=0,s=0;this.runLocalHooks("beforeTransformEnd",n);const{row:a,col:l}=this.options.visualToRenderableCoords(r.highlight);if(null!==a&&null!==l){const e=this.options.countRows(),t=this.options.countCols(),{row:a,col:l}=this.options.visualToRenderableCoords(r.to),c=this.options.createCellCoords(a+n.row,l+n.col);o=0,s=0,c.row<0?(o=-1,c.row=0):c.row>0&&c.row>=e&&(o=1,c.row=e-1),c.col<0?(s=-1,c.col=0):c.col>0&&c.col>=t&&(s=1,c.col=t-1),i=this.options.renderableToVisualCoords(c)}return this.runLocalHooks("afterTransformEnd",i,o,s),i}}AK(z3,e2);const Q3=z3,I3=[3,2],N3=[["number"],["number","string"],["number","undefined"],["number","string","undefined"]],D3=Symbol("root"),W3=Symbol("child");function L3(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:D3;if(t!==D3&&t!==W3)throw new Error("The second argument is used internally only and cannot be overwritten.");const n=Array.isArray(e),r=t===D3;let i=0;if(n){const t=e[0];if(0===e.length)i=1;else if(r&&t instanceof F0)i=3;else if(r&&Array.isArray(t))i=L3(t,W3);else if(e.length>=2&&e.length<=4){const t=!e.some(((e,t)=>!N3[t].includes(typeof e)));t&&(i=2)}}return i}function H3(e){return"number"==typeof e&&e>=0&&e<(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/0)}class V3{constructor(e,t){var n=this;this.settings=e,this.tableProps=t,this.inProgress=!1,this.selectedByCorner=!1,this.selectedByRowHeader=new Set,this.selectedByColumnHeader=new Set,this.selectedRange=new $3(((e,t,n)=>this.tableProps.createCellRange(e,t,n))),this.highlight=new P3({headerClassName:e.currentHeaderClassName,activeHeaderClassName:e.activeHeaderClassName,rowClassName:e.currentRowClassName,columnClassName:e.currentColClassName,disabledCellSelection:(e,t)=>this.tableProps.isDisabledCellSelection(e,t),cellCornerVisible:function(){return n.isCellCornerVisible(...arguments)},areaCornerVisible:function(){return n.isAreaCornerVisible(...arguments)},visualToRenderableCoords:e=>this.tableProps.visualToRenderableCoords(e),renderableToVisualCoords:e=>this.tableProps.renderableToVisualCoords(e),createCellCoords:(e,t)=>this.tableProps.createCellCoords(e,t),createCellRange:(e,t,n)=>this.tableProps.createCellRange(e,t,n),rowIndexMapper:()=>this.tableProps.rowIndexMapper(),columnIndexMapper:()=>this.tableProps.columnIndexMapper()}),this.transformation=new Q3(this.selectedRange,{countRows:()=>this.tableProps.countRowsTranslated(),countCols:()=>this.tableProps.countColsTranslated(),visualToRenderableCoords:e=>this.tableProps.visualToRenderableCoords(e),renderableToVisualCoords:e=>this.tableProps.renderableToVisualCoords(e),createCellCoords:(e,t)=>this.tableProps.createCellCoords(e,t),fixedRowsBottom:()=>e.fixedRowsBottom,minSpareRows:()=>e.minSpareRows,minSpareCols:()=>e.minSpareCols,autoWrapRow:()=>e.autoWrapRow,autoWrapCol:()=>e.autoWrapCol}),this.transformation.addLocalHook("beforeTransformStart",(function(){for(var e=arguments.length,t=new Array(e),r=0;r2&&void 0!==arguments[2]&&arguments[2];const r="multiple"===this.settings.selectionMode,i=fK(t)?this.tableProps.getShortcutManager().isCtrlPressed():t,o=e.row<0,s=e.col<0,a=o&&s,l=e.clone();this.selectedByCorner=a,this.runLocalHooks("beforeSetRangeStart"+(n?"Only":""),l),(!r||r&&!i&&fK(t))&&this.selectedRange.clear(),this.selectedRange.add(l),0===this.getLayerLevel()&&(this.selectedByRowHeader.clear(),this.selectedByColumnHeader.clear()),!a&&s&&this.selectedByRowHeader.add(this.getLayerLevel()),!a&&o&&this.selectedByColumnHeader.add(this.getLayerLevel()),n||this.setRangeEnd(e)}setRangeStartOnly(e,t){this.setRangeStart(e,t,!0)}setRangeEnd(e){if(this.selectedRange.isEmpty())return;const t=e.clone();this.runLocalHooks("beforeSetRangeEnd",t),this.begin();const n=this.selectedRange.current();"single"!==this.settings.selectionMode&&n.setTo(this.tableProps.createCellCoords(t.row,t.col)),this.highlight.getCell().clear(),this.highlight.isEnabledFor(O3,n.highlight)&&this.highlight.getCell().add(this.selectedRange.current().highlight).commit().syncWith(n);const r=this.getLayerLevel();r{e.clear()})),aK(this.highlight.getHeaders(),(e=>{e.clear()})),aK(this.highlight.getActiveHeaders(),(e=>{e.clear()}))),this.highlight.useLayerLevel(r);const i=this.highlight.createOrGetArea(),o=this.highlight.createOrGetHeader(),s=this.highlight.createOrGetActiveHeader();if(i.clear(),o.clear(),s.clear(),this.highlight.isEnabledFor(y3,n.highlight)&&(this.isMultiple()||r>=1)&&(i.add(n.from).add(n.to).commit(),1===r)){const e=this.selectedRange.previous();this.highlight.useLayerLevel(r-1).createOrGetArea().add(e.from).commit().syncWith(e),this.highlight.useLayerLevel(r)}if(this.highlight.isEnabledFor(x3,n.highlight)){const e=0===this.tableProps.countRowsTranslated(),t=0===this.tableProps.countColsTranslated();let r=n;(e||t)&&(r=n.clone()),e&&(r.from.row=-1),t&&(r.from.col=-1),"single"===this.settings.selectionMode?(this.isSelectedByAnyHeader()&&r.from.normalize(),o.add(r.from).commit()):o.add(r.from).add(r.to).commit(),this.isEntireRowSelected()&&this.tableProps.countCols()===n.getWidth()&&s.add(this.tableProps.createCellCoords(n.from.row,-1)).add(this.tableProps.createCellCoords(n.to.row,-1)).commit(),this.isEntireColumnSelected()&&this.tableProps.countRows()===n.getHeight()&&s.add(this.tableProps.createCellCoords(-1,n.from.col)).add(this.tableProps.createCellCoords(-1,n.to.col)).commit()}this.runLocalHooks("afterSetRangeEnd",e)}isMultiple(){const e=WK(!this.selectedRange.current().isSingle());return this.runLocalHooks("afterIsMultipleSelection",e),e.value}transformStart(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.setRangeStart(this.transformation.transformStart(e,t,n))}transformEnd(e,t){this.setRangeEnd(this.transformation.transformEnd(e,t))}getLayerLevel(){return this.selectedRange.size()-1}isSelected(){return!this.selectedRange.isEmpty()}isSelectedByRowHeader(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getLayerLevel();return!this.isSelectedByCorner(e)&&this.isEntireRowSelected(e)}isEntireRowSelected(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getLayerLevel();return-1===e?this.selectedByRowHeader.size>0:this.selectedByRowHeader.has(e)}isSelectedByColumnHeader(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getLayerLevel();return!this.isSelectedByCorner()&&this.isEntireColumnSelected(e)}isEntireColumnSelected(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getLayerLevel();return-1===e?this.selectedByColumnHeader.size>0:this.selectedByColumnHeader.has(e)}isSelectedByAnyHeader(){return this.isSelectedByRowHeader(-1)||this.isSelectedByColumnHeader(-1)||this.isSelectedByCorner()}isSelectedByCorner(){return this.selectedByCorner}inInSelection(e){return this.selectedRange.includes(e)}isCellCornerVisible(){return this.settings.fillHandle&&!this.tableProps.isEditorOpened()&&!this.isMultiple()}isAreaCornerVisible(e){return(!Number.isInteger(e)||e===this.getLayerLevel())&&this.settings.fillHandle&&!this.tableProps.isEditorOpened()&&this.isMultiple()}clear(){this.selectedRange.clear(),this.highlight.clear()}deselect(){this.isSelected()&&(this.inProgress=!1,this.clear(),this.runLocalHooks("afterDeselect"))}selectAll(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=this.tableProps.countRows(),r=this.tableProps.countCols();if(!(e||t||0!==n&&0!==r))return;const i=this.tableProps.createCellCoords(t?-1:0,e?-1:0),o=this.tableProps.createCellCoords(n-1,r-1);this.clear(),this.setRangeStartOnly(i),this.selectedByRowHeader.add(this.getLayerLevel()),this.selectedByColumnHeader.add(this.getLayerLevel()),this.setRangeEnd(o),this.finish()}selectCells(e){const t=L3(e);if(1===t)return!1;if(0===t)throw new Error(hK`Unsupported format of the selection ranges was passed. To select cells pass\x20 the coordinates as an array of arrays ([[rowStart, columnStart/columnPropStart, rowEnd,\x20 columnEnd/columnPropEnd]]) or as an array of CellRange objects.`);const n=function(e){let{keepDirection:t=!1,propToCol:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!I3.includes(e))throw new Error("Unsupported selection ranges schema type was provided.");return function(r){const i=3===e;let o=i?r.from.row:r[0],s=i?r.from.col:r[1],a=i?r.to.row:r[2],l=i?r.to.col:r[3];if("function"==typeof n&&("string"==typeof s&&(s=n(s)),"string"==typeof l&&(l=n(l))),fK(a)&&(a=o),fK(l)&&(l=s),!t){const e=o,t=s,n=a,r=l;o=Math.min(e,n),s=Math.min(t,r),a=Math.max(e,n),l=Math.max(t,r)}return[o,s,a,l]}}(t,{propToCol:e=>this.tableProps.propToCol(e),keepDirection:!0}),r=this.tableProps.countRows(),i=this.tableProps.countCols(),o=!e.some((e=>{const[t,o,s,a]=n(e);return!(H3(t,r)&&H3(o,i)&&H3(s,r)&&H3(a,i))}));return o&&(this.clear(),aK(e,(e=>{const[t,r,i,o]=n(e);this.setRangeStartOnly(this.tableProps.createCellCoords(t,r),!1),this.setRangeEnd(this.tableProps.createCellCoords(i,o)),this.finish()}))),o}selectColumns(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;const r="string"==typeof e?this.tableProps.propToCol(e):e,i="string"==typeof t?this.tableProps.propToCol(t):t,o=this.tableProps.countCols(),s=this.tableProps.countRows(),a=H3(r,o)&&H3(i,o);return a&&(this.setRangeStartOnly(this.tableProps.createCellCoords(n,r)),this.setRangeEnd(this.tableProps.createCellCoords(s-1,i)),this.finish()),a}selectRows(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;const r=this.tableProps.countRows(),i=this.tableProps.countCols(),o=H3(e,r)&&H3(t,r);return o&&(this.setRangeStartOnly(this.tableProps.createCellCoords(e,n)),this.setRangeEnd(this.tableProps.createCellCoords(t,i-1)),this.finish()),o}refresh(){if(this.highlight.getCustomSelections().forEach((e=>{e.commit()})),!this.isSelected())return;const e=this.highlight.getCell(),t=this.getLayerLevel();e.commit().syncWith(this.selectedRange.current());for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:e;const r="string"==typeof t.type?function(e){if(!X3(e))throw Error(`You declared cell type "${e}" as a string that is not mapped to a known object.\n Cell type must be an object or a string mapped to an object registered by\n "Handsontable.cellTypes.registerCellType" method`);return Z3(e)}(t.type):t.type;if(e._automaticallyAssignedMetaProps&&IK(t,((t,n)=>{e._automaticallyAssignedMetaProps.delete(n)})),!zK(r))return;n!==e||e._automaticallyAssignedMetaProps||(e._automaticallyAssignedMetaProps=new Set);const i={};IK(r,((t,r)=>{var o;(function(e,t){var n;return"CELL_TYPE"!==e&&((null===(n=t._automaticallyAssignedMetaProps)||void 0===n?void 0:n.has(e))||!LK(t,e))})(r,n)&&(i[r]=t,null===(o=e._automaticallyAssignedMetaProps)||void 0===o||o.add(r))})),EK(e,i)}function U3(e){return Number.isInteger(e)&&e>=0}function G3(e,t){if(!e())throw new Error(`Assertion failed: ${t}`)}function K3(e){return null==e}const J3=()=>({_automaticallyAssignedMetaProps:void 0,activeHeaderClassName:"ht__active_highlight",allowEmpty:!0,allowHtml:!1,allowInsertColumn:!0,allowInsertRow:!0,allowInvalid:!0,allowRemoveColumn:!0,allowRemoveRow:!0,autoColumnSize:void 0,autoRowSize:void 0,autoWrapCol:!1,autoWrapRow:!1,bindRowsWithHeaders:void 0,cell:[],cells:void 0,checkedTemplate:void 0,className:void 0,colHeaders:null,collapsibleColumns:void 0,columnHeaderHeight:void 0,columns:void 0,columnSorting:void 0,columnSummary:void 0,colWidths:void 0,commentedCellClassName:"htCommentCell",comments:!1,contextMenu:void 0,copyable:!0,copyPaste:!0,correctFormat:!1,currentColClassName:void 0,currentHeaderClassName:"ht__highlight",currentRowClassName:void 0,customBorders:!1,data:void 0,dataSchema:void 0,dateFormat:"DD/MM/YYYY",datePickerConfig:void 0,defaultDate:void 0,disableVisualSelection:!1,dragToScroll:!0,dropdownMenu:void 0,editor:void 0,enterBeginsEditing:!0,enterMoves:{col:0,row:1},fillHandle:{autoInsertRow:!1},filter:!0,filteringCaseSensitive:!1,filters:void 0,fixedColumnsLeft:0,fixedColumnsStart:0,fixedRowsBottom:0,fixedRowsTop:0,formulas:void 0,fragmentSelection:!1,height:void 0,hiddenColumns:void 0,hiddenRows:void 0,invalidCellClassName:"htInvalid",isEmptyCol(e){let t,n,r;for(t=0,n=this.countRows();tU3(e)),"Expecting an unsigned number.");const t=this._getStorageIndexByKey(e);let n;if(t>=0)n=this.data[t],void 0===n&&(n=this.valueFactory(e),this.data[t]=n);else if(n=this.valueFactory(e),this.holes.size>0){const t=this.holes.values().next().value;this.holes.delete(t),this.data[t]=n,this.index[e]=t}else this.data.push(n),this.index[e]=this.data.length-1;return n}insert(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;G3((()=>U3(e)||K3(e)),"Expecting an unsigned number or null/undefined argument.");const n=[],r=this.data.length;for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:1;G3((()=>U3(e)||K3(e)),"Expecting an unsigned number or null/undefined argument.");const n=this.index.splice(K3(e)?this.index.length-t:e,t);for(let e=0;e!this.holes.has(t)))[Symbol.iterator]()}entries(){const e=[];for(let t=0;t{if(te?this.index[e]:-1}_getKeyByStorageIndex(e){return this.index.indexOf(e)}[Symbol.iterator](){return this.entries()}}const r4=["data","width"];class i4{constructor(e){this.globalMeta=e,this.metas=new n4((()=>this._createMeta()))}updateMeta(e,t){const n=this.getMeta(e);EK(n,t),q3(n,t)}createColumn(e,t){this.metas.insert(e,t)}removeColumn(e,t){this.metas.remove(e,t)}getMeta(e){return this.metas.obtain(e)}getMetaConstructor(e){return this.metas.obtain(e).constructor}clearCache(){this.metas.clear()}_createMeta(){return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];function n(){}var r,i;r=n,(i=e).prototype.constructor=i,r.prototype=new i,r.prototype.constructor=r;for(let e=0;ethis._createRow()))}updateMeta(e,t,n){const r=this.getMeta(e,t);EK(r,n),q3(r,n)}createRow(e,t){this.metas.insert(e,t)}createColumn(e,t){for(let n=0;nU3(e)),"Expecting an unsigned number.");const t=new Map(this.metas);return t.has(e)?Array.from(t.get(e).values()):[]}clearCache(){this.metas.clear()}_createRow(){return new n4((e=>this._createMeta(e)))}_createMeta(e){return new(this.columnMeta.getMetaConstructor(e))}}class s4{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];this.hot=e,this.globalMeta=new e4(e),this.tableMeta=new t4(this.globalMeta),this.columnMeta=new i4(this.globalMeta),this.cellMeta=new o4(this.columnMeta),n.forEach((e=>new e(this))),this.globalMeta.updateMeta(t)}getGlobalMeta(){return this.globalMeta.getMeta()}updateGlobalMeta(e){this.globalMeta.updateMeta(e)}getTableMeta(){return this.tableMeta.getMeta()}updateTableMeta(e){this.tableMeta.updateMeta(e)}getColumnMeta(e){return this.columnMeta.getMeta(e)}updateColumnMeta(e,t){this.columnMeta.updateMeta(e,t)}getCellMeta(e,t,n){let{visualRow:r,visualColumn:i}=n;const o=this.cellMeta.getMeta(e,t);return o.visualRow=r,o.visualCol=i,o.row=e,o.col=t,this.runLocalHooks("afterGetCellMeta",o),o}getCellMetaKeyValue(e,t,n){if("string"!=typeof n)throw new Error("The passed cell meta object key is not a string");return this.cellMeta.getMeta(e,t,n)}setCellMeta(e,t,n,r){this.cellMeta.setMeta(e,t,n,r)}updateCellMeta(e,t,n){this.cellMeta.updateMeta(e,t,n)}removeCellMeta(e,t,n){this.cellMeta.removeMeta(e,t,n)}getCellsMeta(){return this.cellMeta.getMetas()}getCellsMetaAtRow(e){return this.cellMeta.getMetasAtRow(e)}createRow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.cellMeta.createRow(e,t)}removeRow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.cellMeta.removeRow(e,t)}createColumn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.cellMeta.createColumn(e,t),this.columnMeta.createColumn(e,t)}removeColumn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.cellMeta.removeColumn(e,t),this.columnMeta.removeColumn(e,t)}clearCellsCache(){this.cellMeta.clearCache()}clearCache(){this.cellMeta.clearCache(),this.columnMeta.clearCache()}}AK(s4,e2);class a4{constructor(e){this.metaManager=e,this.metaSyncMemo=new Map,e.addLocalHook("afterGetCellMeta",(e=>this.extendCellMeta(e))),aJ.getSingleton().add("beforeRender",(e=>{e&&this.metaSyncMemo.clear()}),this.metaManager.hot)}extendCellMeta(e){var t;const{row:n,col:r}=e;if(null!==(t=this.metaSyncMemo.get(n))&&void 0!==t&&t.has(r))return;const{visualRow:i,visualCol:o}=e,s=this.metaManager.hot,a=s.colToProp(o);e.prop=a,s.runHooks("beforeGetCellMeta",i,o,e);const l=LK(e,"type")?e.type:null;let c=_K(e.cells)?e.cells(n,r,a):null;var h;l&&(c?c.type=null!==(h=c.type)&&void 0!==h?h:l:c={type:l}),c&&this.metaManager.updateCellMeta(n,r,c),s.runHooks("afterGetCellMeta",i,o,e),this.metaSyncMemo.has(n)||this.metaSyncMemo.set(n,new Set),this.metaSyncMemo.get(n).add(r)}}class l4{constructor(e){this.metaManager=e,this.usageTracker=new Set,this.propDescriptors=new Map([["fixedColumnsLeft",{target:"fixedColumnsStart",onChange(e){if(this.metaManager.hot.isRtl()&&"fixedColumnsLeft"===e)throw new Error("The `fixedColumnsLeft` is not supported for RTL. Please use option `fixedColumnsStart`.");if(this.usageTracker.has("fixedColumnsLeft")&&this.usageTracker.has("fixedColumnsStart"))throw new Error("The `fixedColumnsLeft` and `fixedColumnsStart` should not be used together. Please use only the option `fixedColumnsStart`.")}}],["layoutDirection",{onChange(e,t,n){if(!n)throw new Error(`The \`${e}\` option can not be updated after the Handsontable is initialized.`)}}]]),this.extendMetaProps()}extendMetaProps(){this.propDescriptors.forEach(((e,t)=>{const{target:n,onChange:r=(()=>{})}=e,i="string"==typeof n,o=i?n:t,s=`_${o}`;this.metaManager.globalMeta.meta[s]=this.metaManager.globalMeta.meta[o],this.installPropWatcher(t,s,r),i&&this.installPropWatcher(n,s,r)}))}installPropWatcher(e,t,n){const r=this;Object.defineProperty(this.metaManager.globalMeta.meta,e,{get(){return this[t]},set(i){const o=!r.usageTracker.has(e);r.usageTracker.add(e),n.call(r,e,i,o),this[t]=i},enumerable:!0,configurable:!0})}}function c4(e){let t,n,r,i,o,s="";for(t=0,n=e.length;t0&&(s+="\t"),o=e[t][r],"string"==typeof o?o.indexOf("\n")>-1?s+=`"${o.replace(/"/g,'""')}"`:s+=o:s+=null==o?"":o;t!==n-1&&(s+="\n")}return s}class h4{static get DESTINATION_RENDERER(){return 1}static get DESTINATION_CLIPBOARD_GENERATOR(){return 2}constructor(e,t,n){this.instance=e,this.metaManager=n,this.tableMeta=n.getTableMeta(),this.dataSource=t,this.duckSchema=this.createDuckSchema(),this.colToPropCache=void 0,this.propToColCache=void 0,this.createMap()}createMap(){const e=this.getSchema();if(void 0===e)throw new Error("trying to create `columns` definition but you didn't provide `schema` nor `data`");const t=this.tableMeta.columns;let n;if(this.colToPropCache=[],this.propToColCache=new Map,t){let r=0,i=0,o=!1;if("function"==typeof t){const t=DK(e);r=t>0?t:this.countFirstRowKeys(),o=!0}else{const e=this.tableMeta.maxCols;r=Math.min(e,t.length)}for(n=0;n{null===e?(r=o+t,this.colToPropCache.push(r),this.propToColCache.set(r,i),i+=1):i=this.recursiveDuckColumns(e,i,`${t}.`)})),i}colToProp(e){if(!1===Number.isInteger(e))return e;const t=this.instance.toPhysicalColumn(e);return null===t?e:this.colToPropCache&&dK(this.colToPropCache[t])?this.colToPropCache[t]:t}propToCol(e){const t=this.propToColCache.get(e);if(dK(t))return this.instance.toVisualColumn(t);const n=this.instance.toVisualColumn(e);return null===n?e:n}getSchema(){const e=this.tableMeta.dataSchema;return e?"function"==typeof e?e():e:this.duckSchema}createDuckSchema(){return this.dataSource&&this.dataSource[0]?RK(this.dataSource[0]):{}}refreshDuckSchema(){this.duckSchema=this.createDuckSchema()}createRow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,{source:n,mode:r="above"}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=this.instance.countSourceRows();let o=i,s=0,a=e;if(("number"!=typeof a||a>=i)&&(a=i),ae.push(null)))):"function"===this.instance.dataType?e=this.tableMeta.dataSchema(a+s):(e={},MK(e,this.getSchema())),h.push(e),s+=1}this.instance.rowIndexMapper.insertIndexes(a,s),"below"===r&&(o=Math.min(o+1,i)),this.spliceData(o,0,h);const u=this.instance.toVisualRow(o);return this.instance.countSourceRows()===h.length&&this.instance.columnIndexMapper.initToLength(this.instance.getInitialColumnCount()),s>0&&(null==e?this.metaManager.createRow(null,s):"auto"!==n&&this.metaManager.createRow(o,t)),this.instance.runHooks("afterCreateRow",u,s,n),this.instance.forceFullRender=!0,{delta:s,startPhysicalIndex:o}}createCol(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,{source:n,mode:r="start"}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!this.instance.isColumnModificationAllowed())throw new Error("Cannot create new column. When data source in an object, you can only have as much columns as defined in first data row, data schema or in the 'columns' setting.If you want to be able to add new columns, you have to use array datasource.");const i=this.dataSource,o=this.tableMeta.maxCols,s=this.instance.countSourceCols();let a=e;if(("number"!=typeof a||a>=s)&&(a=s),!1===this.instance.runHooks("beforeCreateCol",a,t,n))return{delta:0};let l=s;a=h)if(c>0)for(let e=0;e0&&(null==e?this.metaManager.createColumn(null,u):"auto"!==n&&this.metaManager.createColumn(f,t));const p=this.instance.toVisualColumn(f);return this.instance.runHooks("afterCreateCol",p,u,n),this.instance.forceFullRender=!0,this.refreshDuckSchema(),{delta:u,startPhysicalIndex:f}}removeRow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2?arguments[2]:void 0,r=Number.isInteger(e)?e:-t;const i=this.visualRowsToPhysical(r,t),o=this.instance.countSourceRows();if(r=(o+r)%o,!1===this.instance.runHooks("beforeRemoveRow",r,i.length,i,n))return!1;const s=i.length;if(this.filterData(r,s,i),rt-e));return a.forEach((e=>{this.metaManager.removeRow(e,1)})),this.instance.runHooks("afterRemoveRow",r,s,i,n),this.instance.forceFullRender=!0,!0}removeCol(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2?arguments[2]:void 0;if("object"===this.instance.dataType||this.tableMeta.columns)throw new Error("cannot remove column with object data source or columns option specified");let r="number"!=typeof e?-t:e;r=(this.instance.countCols()+r)%this.instance.countCols();const i=this.visualColumnsToPhysical(r,t),o=i.slice(0).sort(((e,t)=>t-e));if(!1===this.instance.runHooks("beforeRemoveCol",r,t,i,n))return!1;let s=!0;const a=o.length,l=this.dataSource;for(let e=0;e3?s-3:0),l=3;l3?s-3:0),l=3;lthis.dataSource.push(e)))}}filterData(e,t,n){let r=this.instance.runHooks("filterData",e,t,n);!1===Array.isArray(r)&&(r=this.dataSource.filter(((e,t)=>-1===n.indexOf(t)))),this.dataSource.length=0,Array.prototype.push.apply(this.dataSource,r)}get(e,t){const n=this.instance.toPhysicalRow(e);let r=this.dataSource[n];const i=this.instance.runHooks("modifyRowData",n);r=isNaN(i)?i:r;let o=null;if(r&&r.hasOwnProperty&&LK(r,t))o=r[t];else if("string"==typeof t&&t.indexOf(".")>-1){const e=t.split(".");let n=r;if(!n)return null;for(let t=0,r=e.length;t-1){const e=t.split(".");let n,r=o,s=0;for(s=0,n=e.length-1;s=0?this.instance.toPhysicalRow(i):i;for(o=Math.min(e.col,t.col);o<=u&&null!==n;o++)s.push(c.call(this,i,this.colToProp(o)));null!==n&&r.push(s)}return r}getText(e,t){return c4(this.getRange(e,t,h4.DESTINATION_RENDERER))}getCopyableText(e,t){return c4(this.getRange(e,t,h4.DESTINATION_CLIPBOARD_GENERATOR))}destroy(){this.instance=null,this.metaManager=null,this.dataSource=null,this.duckSchema=null,this.colToPropCache.length=0,this.propToColCache.clear(),this.propToColCache=void 0}}const u4=h4;function d4(e,t,n,r){const{hotInstance:i,dataMap:o,dataSource:s,internalSource:a,source:l,metaManager:c,firstRun:h}=r,u=bG(a),d=i.getSettings();Array.isArray(d.dataSchema)?i.dataType="array":_K(d.dataSchema)?i.dataType="function":i.dataType="object",o&&o.destroy(),e=i.runHooks(`before${u}`,e,h,l);const f=new u4(i,e,c);if(t(f),"object"==typeof e&&null!==e)e.push&&e.splice||(e=[e]);else{if(null!==e)throw new Error(`${a} only accepts array of objects or array of arrays (${typeof e} given)`);{const t=f.getSchema();let n;e=[];let r=0,o=0;for(r=0,o=d.startRows;re.map((e=>{const t=e.toLowerCase();return f4.has(t)?f4.get(t):t})).sort().join("+"),g4=e=>e.toLowerCase(),m4=["meta","alt","shift","control"],b4=function(){const e=new Set;return{press(t){e.add(t)},release(t){e.delete(t)},releaseAll(){e.clear()},isPressed:t=>e.has(t)}}(),v4=e=>{let{ownerWindow:t,handleEvent:n,beforeKeyDown:r,afterKeyDown:i}=e;const o=IJ({errorIdExists:e=>`The "${e}" context name is already registered.`});let s="grid";const a=()=>s,l=e=>o.getItem(e);let c=!1;const h=function(e,t,n,r,i){const o=e=>m4.includes(e),s=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=[];return e.altKey&&n.push("alt"),t&&(e.ctrlKey||e.metaKey)?n.push("control/meta"):(e.ctrlKey&&n.push("control"),e.metaKey&&n.push("meta")),e.shiftKey&&n.push("shift"),n},a=e=>{if(!1===t(e))return;const a=n(e);if(229===e.keyCode||!1===a||GK(e))return;const l=g4(e.key);let c=[];o(l)?b4.press(l):c=s(e);const h=[l].concat(c);!i(e,h)&&(FK()&&c.includes("meta")||!FK()&&c.includes("control"))&&i(e,[l].concat(s(e,!0))),r(e)},l=e=>{if(!1===t(e))return;const n=g4(e.key);!1!==o(n)&&b4.release(n)},c=()=>{b4.releaseAll()};return{mount:()=>{let t=e;for(;t;)t.document.documentElement.addEventListener("keydown",a),t.document.documentElement.addEventListener("keyup",l),t.document.documentElement.addEventListener("blur",c),t=OG(t)},unmount:()=>{let t=e;for(;t;)t.document.documentElement.removeEventListener("keydown",a),t.document.documentElement.removeEventListener("keyup",l),t.document.documentElement.removeEventListener("blur",c),t=OG(t)},isPressed:e=>b4.isPressed(e),releasePressedKeys:()=>b4.releaseAll()}}(t,n,r,i,((e,t)=>{const n=l(a());let r=!1;if(!n.hasShortcut(t))return r;const i=n.getShortcuts(t);for(let n=0;n{const t=(e=>{const t=IJ({errorIdExists:t=>`The "${t}" shortcut is already registered in the "${e}" context.`}),n=function(){let{keys:e,callback:n,group:r,runOnlyIf:i=(()=>!0),captureCtrl:o=!1,preventDefault:s=!0,stopPropagation:a=!1,relativeToGroup:l,position:c}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(fK(r))throw new Error("You need to define the shortcut's group.");if(!1===_K(n))throw new Error("The shortcut's callback needs to be a function.");if(!1===Array.isArray(e))throw new Error(hK`Pass the shortcut\'s keys as an array of arrays,\x20 using the KeyboardEvent.key properties:\x20 https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values.`);const h={callback:n,group:r,runOnlyIf:i,captureCtrl:o,preventDefault:s,stopPropagation:a};dK(l)&&([h.relativeToGroup,h.position]=[l,c]),e.forEach((e=>{const n=p4(e);if(t.hasItem(n)){const e=t.getItem(n);let r=e.findIndex((e=>e.group===l));-1!==r?"before"===c?r-=1:r+=1:r=e.length,e.splice(r,0,h)}else t.addItem(n,[h])}))},r=e=>{const n=p4(e);t.removeItem(n)};return{addShortcut:n,addShortcuts:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.forEach((e=>{IK(t,((n,r)=>{!1===Object.prototype.hasOwnProperty.call(e,r)&&(e[r]=t[r])})),n(e)}))},getShortcuts:e=>{const n=p4(e),r=t.getItem(n);return dK(r)?r.slice():[]},hasShortcut:e=>{const n=p4(e);return t.hasItem(n)},removeShortcutsByKeys:r,removeShortcutsByGroup:e=>{t.getItems().forEach((t=>{let[n,i]=t;const o=i.filter((t=>t.group!==e));0===o.length?r((e=>e.split("+"))(n)):(i.length=0,i.push(...o))}))}}})(e);return o.addItem(e,t),t},getActiveContextName:a,getContext:l,setActiveContextName:e=>{s=e},isCtrlPressed:()=>!c&&(h.isPressed("control")||h.isPressed("meta")),releasePressedKeys:()=>h.releasePressedKeys(),destroy:()=>h.unmount()}},y4="gridDefault";let O4=null;function w4(e,t){var n;let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=!1,o=this;const s=new OJ(o);let a,l,c,h,u=!0;W1(r)&&function(e){N1.set(e,!0)}(this),this.rootElement=e,this.rootDocument=e.ownerDocument,this.rootWindow=this.rootDocument.defaultView,this.isDestroyed=!1,this.renderSuspendedCounter=0,this.executionSuspendedCounter=0;const d=null!==(n=null==t?void 0:t.layoutDirection)&&void 0!==n?n:"inherit",f=["rtl","ltr"].includes(d)?d:this.rootWindow.getComputedStyle(this.rootElement).direction;this.rootElement.setAttribute("dir",f),this.isRtl=function(){return"rtl"===f},this.isLtr=function(){return!o.isRtl()},this.getDirectionFactor=function(){return o.isLtr()?1:-1},t.language=function(e){let t=P2(e);return m3(t)||(t=c3,A2(e)),t}(t.language);const p=new s4(o,t,[a4,l4]),g=p.getTableMeta(),m=p.getGlobalMeta(),b=IJ();this.container=this.rootDocument.createElement("div"),this.renderCall=!1,e.insertBefore(this.container,e.firstChild),L1(this)&&function(e,t){const n=!pK(e),r="string"==typeof e&&"non-commercial-and-evaluation"===e.toLowerCase(),i="13.1.0";let o,s="invalid",a="invalid";const l=function(e){let t=[][gK],n=t;if(e[gK]!==yK("Z"))return!1;for(let t="",r="B>1:t=vK(e,i,i?1===r[gK]?9:8:6);return n===t}(e=OK(e||""));if(n||r||l)if(l){const t=tK("31/08/2023","DD/MM/YYYY"),n=Math.floor(t.toDate().getTime()/864e5),r=wK(e);o=tK(864e5*(r+1),"x").format("MMMM DD, YYYY"),n>r?(s="expired",a="expired"):(s="valid",a="valid")}else r?(s="non_commercial",a="valid"):(s="invalid",a="invalid");else s="missing",a="missing";if(xK()&&(s="valid",a="valid"),SK||"valid"===s||(kK[s]({keyValidityDate:o,hotVersion:i})&&console["non_commercial"===s?"info":"warn"](kK[s]({keyValidityDate:o,hotVersion:i})),SK=!0),"valid"!==a&&t.parentNode&&CK[a]({keyValidityDate:o,hotVersion:i})){const e=document.createElement("div");e.className="hot-display-license-info",e.innerHTML=CK[a]({keyValidityDate:o,hotVersion:i}),t.parentNode.insertBefore(e,t.nextSibling)}}(t.licenseKey,e),this.guid=`ht_${vG()}`,this.columnIndexMapper=new M2,this.rowIndexMapper=new M2,this.columnIndexMapper.addLocalHook("indexesSequenceChange",(e=>{o.runHooks("afterColumnSequenceChange",e)})),this.rowIndexMapper.addLocalHook("indexesSequenceChange",(e=>{o.runHooks("afterRowSequenceChange",e)})),l=new K1(o),this.rootElement.id&&"ht_"!==this.rootElement.id.substring(0,3)||(this.rootElement.id=this.guid);const v=e=>{const{row:t,col:n}=e;return o._createCellCoords(t>=0?o.rowIndexMapper.getRenderableFromVisualIndex(t):t,n>=0?o.columnIndexMapper.getRenderableFromVisualIndex(n):n)};let y=new B3(g,{rowIndexMapper:()=>o.rowIndexMapper,columnIndexMapper:()=>o.columnIndexMapper,countCols:()=>o.countCols(),countRows:()=>o.countRows(),propToCol:e=>a.propToCol(e),isEditorOpened:()=>!!o.getActiveEditor()&&o.getActiveEditor().isOpened(),countColsTranslated:()=>this.view.countRenderableColumns(),countRowsTranslated:()=>this.view.countRenderableRows(),getShortcutManager:()=>o.getShortcutManager(),createCellCoords:(e,t)=>o._createCellCoords(e,t),createCellRange:(e,t,n)=>o._createCellRange(e,t,n),visualToRenderableCoords:v,renderableToVisualCoords:e=>{const{row:t,col:n}=e;return o._createCellCoords(t>=0?o.rowIndexMapper.getVisualFromRenderableIndex(t):t,n>=0?o.columnIndexMapper.getVisualFromRenderableIndex(n):n)},isDisabledCellSelection:(e,t)=>o.getCellMeta(e,t).disableVisualSelection});this.selection=y;const O=e=>{let{hiddenIndexesChanged:t}=e;t&&this.selection.refresh()};function w(e){const t=P2(e);m3(t)?(o.runHooks("beforeLanguageChange",t),m.language=t,o.runHooks("afterLanguageChange",t)):A2(e)}function x(e,t){const n="className"===e?o.rootElement:o.table;if(u)TG(n,t);else{let r=[],i=[];m[e]&&(r=Array.isArray(m[e])?m[e]:cK(m[e])),t&&(i=Array.isArray(t)?t:cK(t));const o=lK(r,i),s=lK(i,r);o.length&&RG(n,o),s.length&&TG(n,s)}m[e]=t}function S(){let e=!1;return{validatorsInQueue:0,valid:!0,addValidatorToQueue(){this.validatorsInQueue+=1,e=!1},removeValidatorFormQueue(){this.validatorsInQueue=this.validatorsInQueue-1<0?0:this.validatorsInQueue-1,this.checkIfQueueIsEmpty()},onQueueEmpty(){},checkIfQueueIsEmpty(){0===this.validatorsInQueue&&!1===e&&(e=!0,this.onQueueEmpty(this.valid))}}}function k(e){const t=e.replace(",",".");return!1===isNaN(parseFloat(t))?parseFloat(t):e}function C(e,t,n){if(!e.length)return;const r=o.getActiveEditor(),i=new S;let s=!0;i.onQueueEmpty=e=>{r&&s&&r.cancelChanges(),n(e)};for(let n=e.length-1;n>=0;n--){const[r,l,,c]=e[n],h=a.propToCol(l),u=o.getCellMeta(r,h);"numeric"===u.type&&"string"==typeof c&&RJ(c)&&(e[n][3]=k(c)),o.getCellValidator(u)&&(i.addValidatorToQueue(),o.validateCell(e[n][3],u,function(t,n){return function(r){if("boolean"!=typeof r)throw new Error("Validation error: result is not boolean");if(!1===r&&!1===n.allowInvalid){s=!1,e.splice(t,1),n.valid=!0;const r=o.getCell(n.visualRow,n.visualCol);null!==r&&RG(r,g.invalidCellClassName)}i.removeValidatorFormQueue()}}(n,u),t))}i.checkIfQueueIsEmpty()}function _(e,t){let n=e.length-1;if(n<0)return;for(;n>=0;n--){let r=!1;if(null!==e[n]){if(null!==e[n][2]&&void 0!==e[n][2]||null!==e[n][3]&&void 0!==e[n][3]){if(g.allowInsertRow)for(;e[n][0]>o.countRows()-1;){const{delta:e}=a.createRow(void 0,void 0,{source:t});if(0===e){r=!0;break}}if("array"===o.dataType&&(!g.columns||0===g.columns.length)&&g.allowInsertColumn)for(;a.propToCol(e[n][1])>o.countCols()-1;){const{delta:e}=a.createCol(void 0,void 0,{source:t});if(0===e){r=!0;break}}r||a.set(e[n][0],e[n][1],e[n][3])}}else e.splice(n,1)}o.forceFullRender=!0,c.adjustRowsAndCols(),o.runHooks("beforeChangeRender",e,t),h.lockEditor(),o._refreshBorders(null),h.unlockEditor(),o.view.adjustElementsSize(),o.runHooks("afterChange",e,t||"edit");const r=o.getActiveEditor();r&&dK(r.refreshValue)&&r.refreshValue()}function T(e,t,n){return Array.isArray(e)?e:[[e,t,n]]}function R(e,t){const n=o.getActiveEditor(),r=o.runHooks("beforeChange",e,t||"edit"),i=e.filter((e=>null!==e));return!1===r||0===i.length?(n&&n.cancelChanges(),[]):i}this.columnIndexMapper.addLocalHook("cacheUpdated",O),this.rowIndexMapper.addLocalHook("cacheUpdated",O),this.selection.addLocalHook("beforeSetRangeStart",(e=>{this.runHooks("beforeSetRangeStart",e)})),this.selection.addLocalHook("beforeSetRangeStartOnly",(e=>{this.runHooks("beforeSetRangeStartOnly",e)})),this.selection.addLocalHook("beforeSetRangeEnd",(e=>{this.runHooks("beforeSetRangeEnd",e),e.row<0&&(e.row=this.view._wt.wtTable.getFirstVisibleRow()),e.col<0&&(e.col=this.view._wt.wtTable.getFirstVisibleColumn())})),this.selection.addLocalHook("afterSetRangeEnd",(e=>{const t=WK(!1),n=this.selection.getSelectedRange(),{from:r,to:s}=n.current(),a=n.size()-1;this.runHooks("afterSelection",r.row,r.col,s.row,s.col,t,a),this.runHooks("afterSelectionByProp",r.row,o.colToProp(r.col),s.row,o.colToProp(s.col),t,a);const l=this.selection.isSelectedByAnyHeader(),c=this.selection.selectedRange.current();let h=!0;i&&(h=!1),t.isTouched()&&(h=!t.value);const u=this.selection.isSelectedByRowHeader(),d=this.selection.isSelectedByColumnHeader();!1!==h&&(l?u?this.view.scrollViewportVertically(o.rowIndexMapper.getRenderableFromVisualIndex(e.row)):d&&this.view.scrollViewportHorizontally(o.columnIndexMapper.getRenderableFromVisualIndex(e.col)):c&&!this.selection.isMultiple()?this.view.scrollViewport(v(c.from)):this.view.scrollViewport(v(e))),u&&d?TG(this.rootElement,["ht__selection--rows","ht__selection--columns"]):u?(RG(this.rootElement,"ht__selection--columns"),TG(this.rootElement,"ht__selection--rows")):d?(RG(this.rootElement,"ht__selection--rows"),TG(this.rootElement,"ht__selection--columns")):RG(this.rootElement,["ht__selection--rows","ht__selection--columns"]),this._refreshBorders(null)})),this.selection.addLocalHook("afterSelectionFinished",(e=>{const t=e.length-1,{from:n,to:r}=e[t];this.runHooks("afterSelectionEnd",n.row,n.col,r.row,r.col,t),this.runHooks("afterSelectionEndByProp",n.row,o.colToProp(n.col),r.row,o.colToProp(r.col),t)})),this.selection.addLocalHook("afterIsMultipleSelection",(e=>{const t=this.runHooks("afterIsMultipleSelection",e.value);e.value&&(e.value=t)})),this.selection.addLocalHook("beforeModifyTransformStart",(e=>{this.runHooks("modifyTransformStart",e)})),this.selection.addLocalHook("afterModifyTransformStart",((e,t,n)=>{this.runHooks("afterModifyTransformStart",e,t,n)})),this.selection.addLocalHook("beforeModifyTransformEnd",(e=>{this.runHooks("modifyTransformEnd",e)})),this.selection.addLocalHook("afterModifyTransformEnd",((e,t,n)=>{this.runHooks("afterModifyTransformEnd",e,t,n)})),this.selection.addLocalHook("afterDeselect",(()=>{h.destroyEditor(),this._refreshBorders(),RG(this.rootElement,["ht__selection--rows","ht__selection--columns"]),this.runHooks("afterDeselect")})),this.selection.addLocalHook("insertRowRequire",(e=>{this.alter("insert_row_above",e,1,"auto")})),this.selection.addLocalHook("insertColRequire",(e=>{this.alter("insert_col_start",e,1,"auto")})),c={alter(e,t){var n,r;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3?arguments[3]:void 0,l=arguments.length>4?arguments[4]:void 0;const h=e=>{if(0===e.length)return[];const t=[...e];return t.sort(((e,t)=>{let[n]=e,[r]=t;return n===r?0:n>r?1:-1})),iK(t,((e,t)=>{let[n,r]=t;const i=e[e.length-1],[o,s]=i,a=o+s;if(n<=a){const e=Math.max(r-(a-n),0);i[1]+=e}else e.push([n,r]);return e}),[t[0]])};switch(e){case"insert_row_below":case"insert_row_above":const l=o.countSourceRows();if(g.maxRows===l)return;const u="insert_row_below"===e?"below":"above";t=null!==(n=t)&&void 0!==n?n:"below"===u?l:0;const{delta:d,startPhysicalIndex:f}=a.createRow(t,i,{source:s,mode:u});if(d){const e=y.selectedRange.current(),t=null==e?void 0:e.from,n=null==t?void 0:t.row,r=o.toVisualRow(f);if(y.isSelectedByCorner())o.selectAll();else if(dK(n)&&n>=r){const{row:r,col:i}=e.to;let s=t.col;y.isSelectedByRowHeader()&&(s=-1),y.getSelectedRange().pop(),y.setRangeStartOnly(o._createCellCoords(n+d,s),!0),y.setRangeEnd(o._createCellCoords(r+d,i))}else o._refreshBorders()}break;case"insert_col_start":case"insert_col_end":const p="insert_col_end"===e?"end":"start";t=null!==(r=t)&&void 0!==r?r:"end"===p?o.countSourceCols():0;const{delta:m,startPhysicalIndex:b}=a.createCol(t,i,{source:s,mode:p});if(m){if(Array.isArray(g.colHeaders)){const e=[o.toVisualColumn(b),0];e.length+=m,Array.prototype.splice.apply(g.colHeaders,e)}const e=y.selectedRange.current(),t=null==e?void 0:e.from,n=null==t?void 0:t.col,r=o.toVisualColumn(b);if(y.isSelectedByCorner())o.selectAll();else if(dK(n)&&n>=r){const{row:r,col:i}=e.to;let s=t.row;y.isSelectedByColumnHeader()&&(s=-1),y.getSelectedRange().pop(),y.setRangeStartOnly(o._createCellCoords(s,n+m),!0),y.setRangeEnd(o._createCellCoords(r,i+m))}else o._refreshBorders()}break;case"remove_row":const v=e=>{let t=0;aK(e,(e=>{let[n,r]=e;const i=pK(n)?o.countRows()-1:Math.max(n-t,0);if(Number.isInteger(n)&&(n=Math.max(n-t,0)),!a.removeRow(n,r,s))return;const l=o.countRows(),c=g.fixedRowsTop;c>=i+1&&(g.fixedRowsTop-=Math.min(r,c-i));const h=g.fixedRowsBottom;h&&i>=l-h&&(g.fixedRowsBottom-=Math.min(r,h)),t+=r}))};Array.isArray(t)?v(h(t)):v([[t,i]]),c.adjustRowsAndCols(),o._refreshBorders();break;case"remove_col":const O=e=>{let t=0;aK(e,(e=>{let[n,r]=e;const i=pK(n)?o.countCols()-1:Math.max(n-t,0);let l=o.toPhysicalColumn(i);if(Number.isInteger(n)&&(n=Math.max(n-t,0)),!a.removeCol(n,r,s))return;const c=g.fixedColumnsStart;c>=i+1&&(g.fixedColumnsStart-=Math.min(r,c-i)),Array.isArray(g.colHeaders)&&(void 0===l&&(l=-1),g.colHeaders.splice(l,r)),t+=r}))};Array.isArray(t)?O(h(t)):O([[t,i]]),c.adjustRowsAndCols(),o._refreshBorders();break;default:throw new Error(`There is no such action "${e}"`)}l||c.adjustRowsAndCols()},adjustRowsAndCols(){const e=g.minRows,t=g.minSpareRows,n=g.minCols,r=g.minSpareCols;if(0===o.countRows()&&0===o.countCols()&&y.deselect(),e){const t=o.countRows();t{let r=!1,i=n.from.row,s=n.from.col,a=n.to.row,l=n.to.col;i>e-1?(i=e-1,r=!0,a>i&&(a=i)):a>e-1&&(a=e-1,r=!0,i>a&&(i=a)),s>t-1?(s=t-1,r=!0,l>s&&(l=s)):l>t-1&&(l=t-1,r=!0,s>l&&(s=l)),r&&o.selectCell(i,s,a,l)}))}o.view&&o.view.adjustElementsSize()},populateFromArray(e,t,n,r,i){let s,a,l,c;const h=[],u={},d=[],f=e.row,p=e.col;if(a=t.length,0===a)return!1;let m=0,b=0;switch(zK(n)&&(m=n.col-p+1,b=n.row-f+1),i){case"shift_down":const i=rK(t),v=i.length,y=Math.max(v,m),O=o.getData().slice(f),w=rK(O).slice(p,p+y);for(l=0;le.slice(p)));for(s=0;s1&&void 0!==arguments[1]?arguments[1]:null;const r=t[e%t.length];return null!==n?r[n%r.length]:r},M=t.length,P=n?n.row-e.row+1:0;for(a=n?P:Math.max(M,P),s=0;sn.row&&P>M||!g.allowInsertRow&&u.row>o.countRows()-1||u.row>=g.maxRows);s++){const t=s-_,i=E(t).length,d=n?n.col-e.col+1:0;if(c=n?d:Math.max(i,d),u.col=e.col,C=o.getCellMeta(u.row,u.col),"CopyPaste.paste"!==r&&"Autofill.fill"!==r||!C.skipRowOnPaste){for(T=0,l=0;ln.col&&d>i||!g.allowInsertColumn&&u.col>o.countCols()-1||u.col>=g.maxCols);l++){if(C=o.getCellMeta(u.row,u.col),("CopyPaste.paste"===r||"Autofill.fill"===r)&&C.skipColumnOnPaste){T+=1,u.col+=1,c+=1;continue}if(C.readOnly&&"UndoRedo.undo"!==r){u.col+=1;continue}let e=E(t,l-T),n=o.getDataAtCell(u.row,u.col);if(null!==e&&"object"==typeof e)if(Array.isArray(e)&&null===n&&(n=[]),null===n||"object"!=typeof n)R=!1;else{const t=RK(Array.isArray(n)?n:n[0]||n),r=RK(Array.isArray(e)?e:e[0]||e);$K(t,r)||Array.isArray(t)&&Array.isArray(r)?e=PK(e):R=!1}else null!==n&&"object"==typeof n&&(R=!1);R&&h.push([u.row,u.col,e]),R=!0,u.col+=1}u.row+=1}else _+=1,u.row+=1,a+=1}o.setDataAtCell(h,null,null,r||"populateFromArray")}}},this.init=function(){var e,t;l.setData(g.data),o.runHooks("beforeInit"),(ZK()||function(){let{maxTouchPoints:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:navigator;return e>2&&BK.mac.value}())&&TG(o.rootElement,"mobile"),this.updateSettings(g,!0),this.view=new q1(this),h=CJ.getInstance(o,g,y),o.runHooks("init"),this.forceFullRender=!0,this.view.render(),u&&null===o.rootElement.offsetParent&&(e=o.rootElement,t=()=>{o.view._wt.wtOverlays.updateLastSpreaderSize(),o.render(),o.view.adjustElementsSize()},new IntersectionObserver(((n,r)=>{n.forEach((n=>{n.isIntersecting&&null!==e.offsetParent&&(t(),r.unobserve(e))}))}),{root:e.ownerDocument.body}).observe(e)),"object"==typeof u&&(o.runHooks("afterChange",u[0],u[1]),u=!1),o.runHooks("afterInit")},this._createCellCoords=function(e,t){return o.view._wt.createCellCoords(e,t)},this._createCellRange=function(e,t,n){return o.view._wt.createCellRange(e,t,n)},this.validateCell=function(e,t,n,r){let i=o.getCellValidator(t);function s(e){if(arguments.length>1&&void 0!==arguments[1]&&!arguments[1]||!0===t.hidden)return void n(e);const r=t.visualCol,i=t.visualRow,s=o.getCell(i,r,!0);if(s&&"TH"!==s.nodeName){const e=o.rowIndexMapper.getRenderableFromVisualIndex(i),t=o.columnIndexMapper.getRenderableFromVisualIndex(r);o.view._wt.getSetting("cellRenderer",e,t,s)}n(e)}var a,l;l=i,"[object RegExp]"===Object.prototype.toString.call(l)&&(a=i,i=function(e,t){t(a.test(e))}),_K(i)?(e=o.runHooks("beforeValidate",e,t.visualRow,t.prop,r),o._registerImmediate((()=>{i.call(t,e,(n=>{o&&(n=o.runHooks("afterValidate",n,e,t.visualRow,t.prop,r),t.valid=n,s(n),o.runHooks("postAfterValidate",n,e,t.visualRow,t.prop,r))}))}))):o._registerImmediate((()=>{t.valid=!0,s(t.valid,!1)}))},this.setDataAtCell=function(e,t,n,r){const i=T(e,t,n),s=[];let c,h,u,d=r;for(c=0,h=i.length;c=this.countCols()?i[c][1]:a.colToProp(i[c][1]),s.push([i[c][0],u,l.getAtCell(this.toPhysicalRow(i[c][0]),i[c][1]),i[c][2]])}d||"object"!=typeof e||(d=t);const f=R(s,r);o.runHooks("afterSetDataAtCell",f,d),C(f,d,(()=>{_(f,d)}))},this.setDataAtRowProp=function(e,t,n,r){const i=T(e,t,n),s=[];let a,c,h=r;for(a=0,c=i.length;a{_(u,h)}))},this.listen=function(){o&&!o.isListening()&&(O4=o.guid,o.runHooks("afterListen"))},this.unlisten=function(){this.isListening()&&(O4=null,o.runHooks("afterUnlisten"))},this.isListening=function(){return O4===o.guid},this.destroyEditor=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];o._refreshBorders(e,t)},this.populateFromArray=function(e,t,n,r,i,s,a){if("object"!=typeof n||"object"!=typeof n[0])throw new Error("populateFromArray parameter `input` must be an array of arrays");const l="number"==typeof r?o._createCellCoords(r,i):null;return c.populateFromArray(o._createCellCoords(e,t),n,l,s,a)},this.spliceCol=function(e,t,n){for(var r=arguments.length,i=new Array(r>3?r-3:0),o=3;o3?r-3:0),o=3;o{let{from:t,to:n}=e;return[t.row,t.col,n.row,n.col]}))},this.getSelectedLast=function(){const e=this.getSelected();let t;return e&&e.length>0&&(t=e[e.length-1]),t},this.getSelectedRange=function(){if(y.isSelected())return Array.from(y.getSelectedRange())},this.getSelectedRangeLast=function(){const e=this.getSelectedRange();let t;return e&&e.length>0&&(t=e[e.length-1]),t},this.emptySelectedCells=function(e){if(!y.isSelected()||0===this.countRows()||0===this.countCols())return;const t=[];aK(y.getSelectedRange(),(e=>{const n=e.getTopStartCorner(),r=e.getBottomEndCorner();EJ(n.row,r.row,(e=>{EJ(n.col,r.col,(n=>{this.getCellMeta(e,n).readOnly||t.push([e,n,null])}))}))})),t.length>0&&this.setDataAtCell(t,e)},this.isRenderSuspended=function(){return this.renderSuspendedCounter>0},this.suspendRender=function(){this.renderSuspendedCounter+=1},this.resumeRender=function(){const e=this.renderSuspendedCounter-1;this.renderSuspendedCounter=Math.max(e,0),this.isRenderSuspended()||e!==this.renderSuspendedCounter||(this.renderCall?this.render():this._refreshBorders(null))},this.render=function(){this.view&&(this.renderCall=!0,this.forceFullRender=!0,this.isRenderSuspended()||(h.lockEditor(),this._refreshBorders(null),h.unlockEditor()))},this.batchRender=function(e){this.suspendRender();const t=e();return this.resumeRender(),t},this.isExecutionSuspended=function(){return this.executionSuspendedCounter>0},this.suspendExecution=function(){this.executionSuspendedCounter+=1,this.columnIndexMapper.suspendOperations(),this.rowIndexMapper.suspendOperations()},this.resumeExecution=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=this.executionSuspendedCounter-1;this.executionSuspendedCounter=Math.max(t,0),(!this.isExecutionSuspended()&&t===this.executionSuspendedCounter||e)&&(this.columnIndexMapper.resumeOperations(),this.rowIndexMapper.resumeOperations())},this.batchExecution=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.suspendExecution();const n=e();return this.resumeExecution(t),n},this.batch=function(e){this.suspendRender(),this.suspendExecution();const t=e();return this.resumeExecution(),this.resumeRender(),t},this.refreshDimensions=function(){if(!o.view)return;const{width:e,height:t}=o.view.getLastSize(),{width:n,height:r}=o.rootElement.getBoundingClientRect(),i=n!==e||r!==t;!1===o.runHooks("beforeRefreshDimensions",{width:e,height:t},{width:n,height:r},i)||((i||o.view._wt.wtOverlays.scrollableElement===o.rootWindow)&&(o.view.setLastSize(n,r),o.render()),o.runHooks("afterRefreshDimensions",{width:e,height:t},{width:n,height:r},i))},this.updateData=function(e,t){d4(e,(e=>{a=e}),(e=>{a=e,o.columnIndexMapper.fitToLength(this.getInitialColumnCount()),o.rowIndexMapper.fitToLength(this.countSourceRows()),c.adjustRowsAndCols()}),{hotInstance:o,dataMap:a,dataSource:l,internalSource:"updateData",source:t,metaManager:p,firstRun:u})},this.loadData=function(e,t){d4(e,(e=>{a=e}),(()=>{p.clearCellsCache(),o.initIndexMappers(),c.adjustRowsAndCols(),u&&(u=[null,"loadData"])}),{hotInstance:o,dataMap:a,dataSource:l,internalSource:"loadData",source:t,metaManager:p,firstRun:u})},this.getInitialColumnCount=function(){const e=g.columns;let t=0;if(Array.isArray(e))t=e.length;else if(_K(e))if("array"===o.dataType){const n=this.countSourceCols();for(let r=0;r1&&void 0!==arguments[1]&&arguments[1];const n=(u?o.loadData:o.updateData).bind(this);let r,i,s=!1;if(dK(e.rows))throw new Error('The "rows" setting is no longer supported. Do you mean startRows, minRows or maxRows?');if(dK(e.cols))throw new Error('The "cols" setting is no longer supported. Do you mean startCols, minCols or maxCols?');if(dK(e.ganttChart))throw new Error('Since 8.0.0 the "ganttChart" setting is no longer supported.');for(r in e)"data"===r||("language"===r?w(e.language):"className"===r?x("className",e.className):"tableClassName"===r&&o.table?(x("tableClassName",e.tableClassName),o.view._wt.wtOverlays.syncOverlayTableClassNames()):aJ.getSingleton().isRegistered(r)||aJ.getSingleton().isDeprecated(r)?(_K(e[r])||Array.isArray(e[r]))&&(e[r].initialHook=!0,o.addHook(r,e[r])):!t&&LK(e,r)&&(m[r]=e[r]));void 0===e.data&&void 0===g.data?n(null,"updateSettings"):void 0!==e.data?n(e.data,"updateSettings"):void 0!==e.columns&&(a.createMap(),o.initIndexMappers());const l=o.countCols(),d=g.columns;if(d&&_K(d)&&(s=!0),void 0===e.cell&&void 0===e.cells&&void 0===e.columns||p.clearCache(),l>0)for(r=0,i=0;r{o.setCellMetaObject(e.row,e.col,e)})),o.runHooks("afterCellMetaReset");let f=o.rootElement.style.height;""!==f&&(f=parseInt(o.rootElement.style.height,10));let b=e.height;if(_K(b)&&(b=b()),t&&o.rootElement.getAttribute("style")&&o.rootElement.setAttribute("data-initialstyle",o.rootElement.getAttribute("style")),null===b){const e=o.rootElement.getAttribute("data-initialstyle");e&&(e.indexOf("height")>-1||e.indexOf("overflow")>-1)?o.rootElement.setAttribute("style",e):(o.rootElement.style.height="",o.rootElement.style.overflow="")}else void 0!==b&&(o.rootElement.style.height=isNaN(b)?`${b}`:`${b}px`,o.rootElement.style.overflow="hidden");if(void 0!==e.width){let t=e.width;_K(t)&&(t=t()),o.rootElement.style.width=isNaN(t)?`${t}`:`${t}px`}t||(o.view&&(o.view._wt.wtViewport.resetHasOversizedColumnHeadersMarked(),o.view._wt.exportSettingsAsClassNames()),o.runHooks("afterUpdateSettings",e)),c.adjustRowsAndCols(),o.view&&!u&&(o.forceFullRender=!0,h.lockEditor(),o._refreshBorders(null),o.view._wt.wtOverlays.adjustElementsSize(),h.unlockEditor()),t||!o.view||""!==f&&""!==b&&void 0!==b||f===b||o.view._wt.wtOverlays.updateMainScrollableElements()},this.getValue=function(){const e=o.getSelectedLast();if(g.getValue){if(_K(g.getValue))return g.getValue.call(o);if(e)return o.getData()[e[0][0]][g.getValue]}else if(e)return o.getDataAtCell(e[0],e[1])},this.getSettings=function(){return g},this.clear=function(){this.selectAll(),this.emptySelectedCells()},this.alter=function(e,t,n,r,i){c.alter(e,t,n,r,i)},this.getCell=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t,i=e;if(t>=0){if(this.columnIndexMapper.isHidden(this.toPhysicalColumn(t)))return null;r=this.columnIndexMapper.getRenderableFromVisualIndex(t)}if(e>=0){if(this.rowIndexMapper.isHidden(this.toPhysicalRow(e)))return null;i=this.rowIndexMapper.getRenderableFromVisualIndex(e)}return null===i||null===r?null:o.view.getCellAtCoords(o._createCellCoords(i,r),n)},this.getCoords=function(e){const t=this.view._wt.wtTable.getCoords(e);if(null===t)return null;const{row:n,col:r}=t;let i=n,s=r;return n>=0&&(i=this.rowIndexMapper.getVisualFromRenderableIndex(n)),r>=0&&(s=this.columnIndexMapper.getVisualFromRenderableIndex(r)),o._createCellCoords(i,s)},this.colToProp=function(e){return a.colToProp(e)},this.propToCol=function(e){return a.propToCol(e)},this.toVisualRow=e=>this.rowIndexMapper.getVisualFromPhysicalIndex(e),this.toVisualColumn=e=>this.columnIndexMapper.getVisualFromPhysicalIndex(e),this.toPhysicalRow=e=>this.rowIndexMapper.getPhysicalFromVisualIndex(e),this.toPhysicalColumn=e=>this.columnIndexMapper.getPhysicalFromVisualIndex(e),this.getDataAtCell=function(e,t){return a.get(e,a.colToProp(t))},this.getDataAtRowProp=function(e,t){return a.get(e,t)},this.getDataAtCol=function(e){const t=[],n=a.getRange(o._createCellCoords(0,e),o._createCellCoords(g.data.length-1,e),a.DESTINATION_RENDERER);for(let e=0;e{let[t,n,r]=e;a.push([t,n,l.getAtCell(t,n),r])})),aK(i,(e=>{let[t,n,r]=e;l.setAtCell(t,n,r)})),s&&this.runHooks("afterSetSourceDataAtCell",a,r),this.render();const c=o.getActiveEditor();c&&dK(c.refreshValue)&&c.refreshValue()},this.getSourceDataAtRow=function(e){return l.getAtRow(e)},this.getSourceDataAtCell=function(e,t){return l.getAtCell(e,t)},this.getDataAtRow=function(e){return a.getRange(o._createCellCoords(e,0),o._createCellCoords(e,this.countCols()-1),a.DESTINATION_RENDERER)[0]||[]},this.getDataType=function(e,t,n,r){const i=void 0===e?[0,0,this.countRows(),this.countCols()]:[e,t,n,r],[o,s]=i;let[,,a,l]=i,c=null,h=null;void 0===a&&(a=o),void 0===l&&(l=s);let u="mixed";return EJ(Math.max(Math.min(o,a),0),Math.max(o,a),(e=>{let t=!0;return EJ(Math.max(Math.min(s,l),0),Math.max(s,l),(n=>{const r=this.getCellMeta(e,n);return h=r.type,c?t=c===h:c=h,t})),u=t?h:"mixed",t})),u},this.removeCellMeta=function(e,t,n){const[r,i]=[this.toPhysicalRow(e),this.toPhysicalColumn(t)];let s=p.getCellMetaKeyValue(r,i,n);!1!==o.runHooks("beforeRemoveCellMeta",e,t,n,s)&&(p.removeCellMeta(r,i,n),o.runHooks("afterRemoveCellMeta",e,t,n,s)),s=null},this.spliceCellsMeta=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i0&&!Array.isArray(r[0]))throw new Error("The 3rd argument (cellMetaRows) has to be passed as an array of cell meta objects array.");t>0&&p.removeRow(this.toPhysicalRow(e),t),r.length>0&&aK(r.reverse(),(t=>{p.createRow(this.toPhysicalRow(e)),aK(t,((t,n)=>this.setCellMetaObject(e,n,t)))})),o.render()},this.setCellMetaObject=function(e,t,n){"object"==typeof n&&IK(n,((n,r)=>{this.setCellMeta(e,t,r,n)}))},this.setCellMeta=function(e,t,n,r){if(!1===o.runHooks("beforeSetCellMeta",e,t,n,r))return;let i=e,s=t;e=0;){if(void 0!==t&&-1===t.indexOf(i)){i-=1;continue}let e=o.countCols()-1;for(;e>=0;)void 0===n||-1!==n.indexOf(e)?(r.addValidatorToQueue(),o.validateCell(o.getDataAtCell(i,e),o.getCellMeta(i,e),(e=>{if("boolean"!=typeof e)throw new Error("Validation error: result is not boolean");!1===e&&(r.valid=!1),r.removeValidatorFormQueue()}),"validateCells"),e-=1):e-=1;i-=1}r.checkIfQueueIsEmpty()},this.getRowHeader=function(e){let t=g.rowHeaders,n=e;return void 0!==n&&(n=o.runHooks("modifyRowHeader",n)),void 0===n?(t=[],EJ(o.countRows()-1,(e=>{t.push(o.getRowHeader(e))}))):Array.isArray(t)&&void 0!==t[n]?t=t[n]:_K(t)?t=t(n):t&&"string"!=typeof t&&"number"!=typeof t&&(t=n+1),t},this.hasRowHeaders=function(){return!!g.rowHeaders},this.hasColHeaders=function(){if(void 0!==g.colHeaders&&null!==g.colHeaders)return!!g.colHeaders;for(let e=0,t=o.countCols();e1&&void 0!==arguments[1]?arguments[1]:-1;const n=o.runHooks("modifyColHeader",e);if(void 0===n){const e=[],t=o.countCols();for(let n=0;n0;)t=(n-1)%U1,r=String.fromCharCode(65+t)+r,n=parseInt((n-t)/U1,10);return r}(n)),r=o.runHooks("modifyColumnHeaderValue",r,e,t),r},this._getColWidthFromSettings=function(e){let t;if(e>=0&&(t=o.getCellMeta(0,e).width),void 0!==t&&t!==g.width||(t=g.colWidths),null!=t){switch(typeof t){case"object":t=t[e];break;case"function":t=t(e)}"string"==typeof t&&(t=parseInt(t,10))}return t},this.getColWidth=function(e){let t=o._getColWidthFromSettings(e);return t=o.runHooks("modifyColWidth",t,e),void 0===t&&(t=M1.DEFAULT_WIDTH),t},this._getRowHeightFromSettings=function(e){let t=g.rowHeights;if(null!=t){switch(typeof t){case"object":t=t[e];break;case"function":t=t(e)}"string"==typeof t&&(t=parseInt(t,10))}return t},this.getRowHeight=function(e){let t=o._getRowHeightFromSettings(e);return t=o.runHooks("modifyRowHeight",t,e),t},this.countSourceRows=function(){return l.countRows()},this.countSourceCols=function(){return l.countFirstRowKeys()},this.countRows=function(){return a.getLength()},this.countCols=function(){const e=g.maxCols,t=this.columnIndexMapper.getNotTrimmedIndexesLength();return Math.min(e,t)},this.countRenderedRows=function(){return o.view._wt.drawn?o.view._wt.wtTable.getRenderedRowsCount():-1},this.countVisibleRows=function(){return o.view._wt.drawn?o.view._wt.wtTable.getVisibleRowsCount():-1},this.countRenderedCols=function(){return o.view._wt.drawn?o.view._wt.wtTable.getRenderedColumnsCount():-1},this.countVisibleCols=function(){return o.view._wt.drawn?o.view._wt.wtTable.getVisibleColumnsCount():-1},this.countEmptyRows=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=0;return MJ(o.countRows()-1,(n=>{if(o.isEmptyRow(n))t+=1;else if(!0===e)return!1})),t},this.countEmptyCols=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=0;return MJ(o.countCols()-1,(n=>{if(o.isEmptyCol(n))t+=1;else if(!0===e)return!1})),t},this.isEmptyRow=function(e){return g.isEmptyRow.call(o,e)},this.isEmptyCol=function(e){return g.isEmptyCol.call(o,e)},this.selectCell=function(e,t,n,r){let i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];return!fK(e)&&!fK(t)&&this.selectCells([[e,t,n,r]],i,o)},this.selectCells=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[[]],t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];!1===(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&(i=!0);const n=y.selectCells(e);return n&&t&&o.listen(),i=!1,n},this.selectColumns=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return y.selectColumns(e,t)},this.selectRows=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return y.selectRows(e,t)},this.deselectCell=function(){y.deselect()},this.selectAll=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=e&&this.hasRowHeaders(),n=e&&this.hasColHeaders();i=!0,y.selectAll(t,n),i=!1};const E=(e,t)=>e.getNearestNotHiddenIndex(t,1,!0);this.scrollViewportTo=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=!n,s=!r;let a=e,l=t;if(!(arguments.length>4&&void 0!==arguments[4])||arguments[4]){const n=Number.isInteger(e),r=Number.isInteger(t),i=n?E(this.rowIndexMapper,e):void 0,s=r?E(this.columnIndexMapper,t):void 0;if(null===i||null===s)return!1;a=n?o.rowIndexMapper.getRenderableFromVisualIndex(i):void 0,l=r?o.columnIndexMapper.getRenderableFromVisualIndex(s):void 0}const c=Number.isInteger(a),h=Number.isInteger(l);return c&&h?o.view.scrollViewport(o._createCellCoords(a,l),i,r,n,s):c&&!1===h?o.view.scrollViewportVertically(a,i,n):!(!h||!1!==c)&&o.view.scrollViewportHorizontally(l,r,s)},this.destroy=function(){if(o._clearTimeouts(),o._clearImmediates(),o.view&&o.view.destroy(),l&&l.destroy(),l=null,this.getShortcutManager().destroy(),p.clearCache(),L1(o)){const e=this.rootDocument.querySelector(".hot-display-license-info");e&&e.parentNode.removeChild(e)}MG(o.rootElement),s.destroy(),h&&h.destroy(),o.batchExecution((()=>{o.rowIndexMapper.unregisterAll(),o.columnIndexMapper.unregisterAll(),b.getItems().forEach((e=>{let[,t]=e;t.destroy()})),b.clear(),o.runHooks("afterDestroy")}),!0),aJ.getSingleton().destroy(o),IK(o,((e,t,n)=>{var r;_K(e)?n[t]=(r=t,()=>{throw new Error(`The "${r}" method cannot be called because this Handsontable instance has been destroyed`)}):"guid"!==t&&(n[t]=null)})),o.isDestroyed=!0,a&&a.destroy(),a=null,c=null,y=null,h=null,o=null},this.getActiveEditor=function(){return h.getActiveEditor()},this.getPlugin=function(e){const t=bG(e);return"UndoRedo"===t?this.undoRedo:b.getItem(t)},this.getPluginName=function(e){return e===this.undoRedo?this.undoRedo.constructor.PLUGIN_KEY:b.getId(e)},this.getInstance=function(){return o},this.addHook=function(e,t){aJ.getSingleton().add(e,t,o)},this.hasHook=function(e){return aJ.getSingleton().has(e,o)||aJ.getSingleton().has(e)},this.addHookOnce=function(e,t){aJ.getSingleton().once(e,t,o)},this.removeHook=function(e,t){aJ.getSingleton().remove(e,t,o)},this.runHooks=function(e,t,n,r,i,s,a){return aJ.getSingleton().run(o,e,t,n,r,i,s,a)},this.getTranslatedPhrase=function(e,t){return b3(g.language,e,t)},this.toHTML=()=>_J(this),this.toTableElement=()=>{const e=this.rootDocument.createElement("div");return e.insertAdjacentHTML("afterbegin",_J(this)),e.firstElementChild},this.timeouts=[],this._registerTimeout=function(e){let t=e;"function"==typeof t&&(t=setTimeout(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)),this.timeouts.push(t)},this._clearTimeouts=function(){aK(this.timeouts,(e=>{clearTimeout(e)}))},this.immediates=[],this._registerImmediate=function(e){this.immediates.push(setImmediate(e))},this._clearImmediates=function(){aK(this.immediates,(e=>{clearImmediate(e)}))},this._refreshBorders=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];h.destroyEditor(e),o.view.render(),t&&y.isSelected()&&h.prepareEditor()},this.isRtl=function(){return"rtl"===o.rootWindow.getComputedStyle(o.rootElement).direction},this.isLtr=function(){return!o.isRtl()},this.getDirectionFactor=function(){return o.isLtr()?1:-1};const M=v4({handleEvent(e){const t=o.isListening(),n=void 0!==(null==e?void 0:e.key);return t&&n},beforeKeyDown:e=>this.runHooks("beforeKeyDown",e),afterKeyDown:e=>{this.isDestroyed||o.runHooks("afterDocumentKeyDown",e)},ownerWindow:this.rootWindow});this.addHook("beforeOnCellMouseDown",(e=>{!1===e.ctrlKey&&!1===e.metaKey&&M.releasePressedKeys()})),this.getShortcutManager=function(){return M};const P=M.addContext("grid"),A={runOnlyIf:()=>dK(o.getSelected())&&o.countRenderedRows()>0&&o.countRenderedCols()>0,group:y4};M.setActiveContextName("grid"),P.addShortcuts([{keys:[["Control/Meta","A"]],callback:()=>{o.selectAll()}},{keys:[["Control/Meta","Enter"]],callback:()=>{const e=o.getSelectedRange(),{row:t,col:n}=e[e.length-1].highlight,r=o.getDataAtCell(t,n),i=new Map;for(let s=0;s{if(e>=0&&s>=0&&(e!==t||s!==n)){const{readOnly:t}=o.getCellMeta(e,s);t||i.set(`${e}x${s}`,[e,s,r])}}));o.setDataAtCell(Array.from(i.values()))},runOnlyIf:()=>o.getSelectedRangeLast().getCellsCount()>1},{keys:[["ArrowUp"]],callback:()=>{y.transformStart(-1,0)}},{keys:[["ArrowUp","Control/Meta"]],captureCtrl:!0,callback:()=>{y.setRangeStart(o._createCellCoords(o.rowIndexMapper.getNearestNotHiddenIndex(0,1),o.getSelectedRangeLast().highlight.col))}},{keys:[["ArrowUp","Shift"]],callback:()=>{y.transformEnd(-1,0)}},{keys:[["ArrowUp","Shift","Control/Meta"]],captureCtrl:!0,callback:()=>{const{from:e,to:t}=o.getSelectedRangeLast(),n=o.rowIndexMapper.getNearestNotHiddenIndex(0,1);y.setRangeStart(e.clone()),y.setRangeEnd(o._createCellCoords(n,t.col))},runOnlyIf:()=>!(o.selection.isSelectedByCorner()||o.selection.isSelectedByColumnHeader())},{keys:[["ArrowDown"]],callback:()=>{y.transformStart(1,0)}},{keys:[["ArrowDown","Control/Meta"]],captureCtrl:!0,callback:()=>{y.setRangeStart(o._createCellCoords(o.rowIndexMapper.getNearestNotHiddenIndex(o.countRows()-1,-1),o.getSelectedRangeLast().highlight.col))}},{keys:[["ArrowDown","Shift"]],callback:()=>{y.transformEnd(1,0)}},{keys:[["ArrowDown","Shift","Control/Meta"]],captureCtrl:!0,callback:()=>{const{from:e,to:t}=o.getSelectedRangeLast(),n=o.rowIndexMapper.getNearestNotHiddenIndex(o.countRows()-1,-1);y.setRangeStart(e.clone()),y.setRangeEnd(o._createCellCoords(n,t.col))},runOnlyIf:()=>!(o.selection.isSelectedByCorner()||o.selection.isSelectedByColumnHeader())},{keys:[["ArrowLeft"]],callback:()=>{y.transformStart(0,-1*o.getDirectionFactor())}},{keys:[["ArrowLeft","Control/Meta"]],captureCtrl:!0,callback:()=>{const e=o.getSelectedRangeLast().highlight.row,t=o.columnIndexMapper.getNearestNotHiddenIndex(...o.isRtl()?[o.countCols()-1,-1]:[0,1]);y.setRangeStart(o._createCellCoords(e,t))}},{keys:[["ArrowLeft","Shift"]],callback:()=>{y.transformEnd(0,-1*o.getDirectionFactor())}},{keys:[["ArrowLeft","Shift","Control/Meta"]],captureCtrl:!0,callback:()=>{const{from:e,to:t}=o.getSelectedRangeLast(),n=o.columnIndexMapper.getNearestNotHiddenIndex(...o.isRtl()?[o.countCols()-1,-1]:[0,1]);y.setRangeStart(e.clone()),y.setRangeEnd(o._createCellCoords(t.row,n))},runOnlyIf:()=>!(o.selection.isSelectedByCorner()||o.selection.isSelectedByRowHeader())},{keys:[["ArrowRight"]],callback:()=>{y.transformStart(0,o.getDirectionFactor())}},{keys:[["ArrowRight","Control/Meta"]],captureCtrl:!0,callback:()=>{const e=o.getSelectedRangeLast().highlight.row,t=o.columnIndexMapper.getNearestNotHiddenIndex(...o.isRtl()?[0,1]:[o.countCols()-1,-1]);y.setRangeStart(o._createCellCoords(e,t))}},{keys:[["ArrowRight","Shift"]],callback:()=>{y.transformEnd(0,o.getDirectionFactor())}},{keys:[["ArrowRight","Shift","Control/Meta"]],captureCtrl:!0,callback:()=>{const{from:e,to:t}=o.getSelectedRangeLast(),n=o.columnIndexMapper.getNearestNotHiddenIndex(...o.isRtl()?[0,1]:[o.countCols()-1,-1]);y.setRangeStart(e.clone()),y.setRangeEnd(o._createCellCoords(t.row,n))},runOnlyIf:()=>!(o.selection.isSelectedByCorner()||o.selection.isSelectedByRowHeader())},{keys:[["Home"]],captureCtrl:!0,callback:()=>{const e=parseInt(o.getSettings().fixedColumnsStart,10),t=o.getSelectedRangeLast().highlight.row,n=o.columnIndexMapper.getNearestNotHiddenIndex(e,1);y.setRangeStart(o._createCellCoords(t,n))},runOnlyIf:()=>o.view.isMainTableNotFullyCoveredByOverlays()},{keys:[["Home","Shift"]],callback:()=>{y.setRangeEnd(o._createCellCoords(y.selectedRange.current().from.row,o.columnIndexMapper.getNearestNotHiddenIndex(0,1)))}},{keys:[["Home","Control/Meta"]],captureCtrl:!0,callback:()=>{const e=parseInt(o.getSettings().fixedRowsTop,10),t=parseInt(o.getSettings().fixedColumnsStart,10),n=o.rowIndexMapper.getNearestNotHiddenIndex(e,1),r=o.columnIndexMapper.getNearestNotHiddenIndex(t,1);y.setRangeStart(o._createCellCoords(n,r))},runOnlyIf:()=>o.view.isMainTableNotFullyCoveredByOverlays()},{keys:[["End"]],captureCtrl:!0,callback:()=>{y.setRangeStart(o._createCellCoords(o.getSelectedRangeLast().highlight.row,o.columnIndexMapper.getNearestNotHiddenIndex(o.countCols()-1,-1)))},runOnlyIf:()=>o.view.isMainTableNotFullyCoveredByOverlays()},{keys:[["End","Shift"]],callback:()=>{y.setRangeEnd(o._createCellCoords(y.selectedRange.current().from.row,o.columnIndexMapper.getNearestNotHiddenIndex(o.countCols()-1,-1)))}},{keys:[["End","Control/Meta"]],captureCtrl:!0,callback:()=>{const e=parseInt(o.getSettings().fixedRowsBottom,10),t=o.rowIndexMapper.getNearestNotHiddenIndex(o.countRows()-e-1,-1),n=o.columnIndexMapper.getNearestNotHiddenIndex(o.countCols()-1,-1);y.setRangeStart(o._createCellCoords(t,n))},runOnlyIf:()=>o.view.isMainTableNotFullyCoveredByOverlays()},{keys:[["PageUp"]],callback:()=>{y.transformStart(-o.countVisibleRows(),0)}},{keys:[["PageUp","Shift"]],callback:()=>{const{to:e}=o.getSelectedRangeLast(),t=Math.max(e.row-o.countVisibleRows(),0),n=o.rowIndexMapper.getNearestNotHiddenIndex(t,1);if(null!==n){const t=o._createCellCoords(n,e.col),r=e.row-o.view.getFirstFullyVisibleRow(),i=Math.max(t.row-r,0);y.setRangeEnd(t),o.scrollViewportTo(i)}}},{keys:[["PageDown"]],callback:()=>{y.transformStart(o.countVisibleRows(),0)}},{keys:[["PageDown","Shift"]],callback:()=>{const{to:e}=o.getSelectedRangeLast(),t=Math.min(e.row+o.countVisibleRows(),o.countRows()-1),n=o.rowIndexMapper.getNearestNotHiddenIndex(t,-1);if(null!==n){const t=o._createCellCoords(n,e.col),r=e.row-o.view.getFirstFullyVisibleRow(),i=Math.min(t.row-r,o.countRows()-1);y.setRangeEnd(t),o.scrollViewportTo(i)}}},{keys:[["Tab"]],callback:e=>{const t="function"==typeof g.tabMoves?g.tabMoves(e):g.tabMoves;y.transformStart(t.row,t.col,!0)}},{keys:[["Shift","Tab"]],callback:e=>{const t="function"==typeof g.tabMoves?g.tabMoves(e):g.tabMoves;y.transformStart(-t.row,-t.col)}}],A),[...WJ.getItems(),...LJ.getItems()].forEach((e=>{const t=function(e){const t=bG(e);return HJ.getItem(t)}(e);b.addItem(e,new t(this))})),aJ.getSingleton().run(o,"construct")}new Set;const x4={_hooksStorage:Object.create(null),addHook(e,t){return this._hooksStorage[e]||(this._hooksStorage[e]=[]),this.hot.addHook(e,t),this._hooksStorage[e].push(t),this},removeHooksByKey(e){aK(this._hooksStorage[e]||[],(t=>{this.hot.removeHook(e,t)}))},clearHooks(){IK(this._hooksStorage,((e,t)=>this.removeHooksByKey(t))),this._hooksStorage={}}};QK(x4,"MIXIN_NAME","hooksRefRegisterer",{writable:!1,enumerable:!1});const S4=x4,k4=Object.freeze({VIRGIN:"STATE_VIRGIN",EDITING:"STATE_EDITING",WAITING:"STATE_WAITING",FINISHED:"STATE_FINISHED"}),C4="baseEditor";class _4{static get EDITOR_TYPE(){return"base"}constructor(e){this.hot=e,this.instance=e,this.state=k4.VIRGIN,this._opened=!1,this._fullEditMode=!1,this._closeCallback=null,this.TD=null,this.row=null,this.col=null,this.prop=null,this.originalValue=null,this.cellProperties=null,this.init()}_fireCallbacks(e){this._closeCallback&&(this._closeCallback(e),this._closeCallback=null)}init(){}getValue(){throw Error("Editor getValue() method unimplemented")}setValue(){throw Error("Editor setValue() method unimplemented")}open(){throw Error("Editor open() method unimplemented")}close(){throw Error("Editor close() method unimplemented")}prepare(e,t,n,r,i,o){this.TD=r,this.row=e,this.col=t,this.prop=n,this.originalValue=i,this.cellProperties=o,this.state=k4.VIRGIN}extend(){return class extends this.constructor{}}saveValue(e,t){let n,r,i,o;if(t){const e=this.hot.getSelectedLast();n=Math.max(Math.min(e[0],e[2]),0),r=Math.max(Math.min(e[1],e[3]),0),i=Math.max(e[0],e[2]),o=Math.max(e[1],e[3])}else[n,r,i,o]=[this.row,this.col,null,null];const s=this.hot.runHooks("modifyGetCellCoords",n,r);Array.isArray(s)&&([n,r]=s);const a=this.hot.getShortcutManager().getContext("editor"),l={runOnlyIf:()=>dK(this.hot.getSelected()),group:C4};this.isInFullEditMode()&&a.addShortcuts([{keys:[["ArrowUp"]],callback:()=>{this.hot.selection.transformStart(-1,0)}},{keys:[["ArrowDown"]],callback:()=>{this.hot.selection.transformStart(1,0)}},{keys:[["ArrowLeft"]],callback:()=>{this.hot.selection.transformStart(0,-1*this.hot.getDirectionFactor())}},{keys:[["ArrowRight"]],callback:()=>{this.hot.selection.transformStart(0,this.hot.getDirectionFactor())}}],l),this.hot.populateFromArray(n,r,e,i,o,"edit")}beginEditing(e,t){if(this.state!==k4.VIRGIN)return;const n=this.hot,r=n.rowIndexMapper.getRenderableFromVisualIndex(this.row),i=n.columnIndexMapper.getRenderableFromVisualIndex(this.col);if(n.view.scrollViewport(n._createCellCoords(r,i)),this.state=k4.EDITING,this.isInFullEditMode()){const t="string"==typeof e?e:uK(this.originalValue);this.setValue(t)}this.open(t),this._opened=!0,this.focus(),n.view.render(),n.runHooks("afterBeginEditing",this.row,this.col)}finishEditing(e,t,n){let r;if(n){const e=this._closeCallback;this._closeCallback=t=>{e&&e(t),n(t),this.hot.view.render()}}if(this.isWaiting())return;const i=this.hot.getShortcutManager().getContext("editor");if(i.removeShortcutsByGroup(C4),i.removeShortcutsByGroup(wJ),this.state!==k4.VIRGIN){if(this.state===k4.EDITING){if(e)return this.cancelChanges(),void this.hot.view.render();const n=this.getValue();r=this.cellProperties.trimWhitespace?[["string"==typeof n?String.prototype.trim.call(n||""):n]]:[[n]],this.state=k4.WAITING,this.saveValue(r,t),this.hot.getCellValidator(this.cellProperties)?this.hot.addHookOnce("postAfterValidate",(e=>{this.state=k4.FINISHED,this.discardEditor(e)})):(this.state=k4.FINISHED,this.discardEditor(!0))}}else this.hot._registerTimeout((()=>{this._fireCallbacks(!0)}))}cancelChanges(){this.state=k4.FINISHED,this.discardEditor()}discardEditor(e){this.state===k4.FINISHED&&(!1===e&&!0!==this.cellProperties.allowInvalid?(this.hot.selectCell(this.row,this.col),this.focus(),this.state=k4.EDITING,this._fireCallbacks(!1)):(this.close(),this._opened=!1,this._fullEditMode=!1,this.state=k4.VIRGIN,this._fireCallbacks(!0),this.hot.getShortcutManager().setActiveContextName("grid")))}enableFullEditMode(){this._fullEditMode=!0}isInFullEditMode(){return this._fullEditMode}isOpened(){return this._opened}isWaiting(){return this.state===k4.WAITING}getEditedCellRect(){var e;const t=this.getEditedCell();if(!t)return;const{wtOverlays:n,wtViewport:r}=this.hot.view._wt,i=this.hot.rootWindow,o=zG(t),s=BG(t),a=zG(this.hot.rootElement),l=BG(this.hot.rootElement),c=n.topOverlay.holder,h=n.inlineStartOverlay.holder,u=c!==i?c.scrollTop:0,d=h!==i?h.scrollLeft:0,f=i.innerWidth-a.left-l,{wtTable:p}=null!==(e=n.getParentOverlay(t))&&void 0!==e?e:this.hot.view._wt,g=p.name,m=["master","inline_start"].includes(g)?u:0,b=["master","top","bottom"].includes(g)?d:0,v=o.top===a.top?0:1;let y=o.top-a.top-v-m,O=0;O=this.hot.isRtl()?i.innerWidth-o.left-s-f-1+b:o.left-a.left-1-b,["top","top_inline_start_corner"].includes(g)&&(y+=n.topOverlay.getOverlayOffset()),["inline_start","top_inline_start_corner"].includes(g)&&(O+=Math.abs(n.inlineStartOverlay.getOverlayOffset()));const w=this.hot.hasColHeaders(),x=this.hot.rowIndexMapper.getRenderableFromVisualIndex(this.row),S=this.hot.columnIndexMapper.getRenderableFromVisualIndex(this.col),k=this.hot.rowIndexMapper.getRenderableIndexesLength()-this.hot.view._wt.getSetting("fixedRowsBottom");(w&&x<=0||x===k)&&(y+=1),S<=0&&(O+=1);const C=r.rowsRenderCalculator.startPosition,_=r.columnsRenderCalculator.startPosition,T=Math.abs(n.inlineStartOverlay.getScrollPosition()),R=n.topOverlay.getScrollPosition(),E=UG(this.hot.rootDocument),M=t.offsetTop+C-R;let P=0;if(this.hot.isRtl()){const e=t.offsetLeft;P=e>=0?p.getWidth()-t.offsetLeft:Math.abs(e),P+=_-T-s}else P=t.offsetLeft+_-T;const A=VG(this.TD,this.hot.rootWindow),$=this.hot.isRtl()?"borderRightWidth":"borderLeftWidth",z=parseInt(A[$],10)>0?0:1,Q=parseInt(A.borderTopWidth,10)>0?0:1,I=BG(t)+z,N=jG(t)+Q,D=(W=c).offsetWidth!==W.clientWidth?E:0;var W;const L=function(e){return e.offsetHeight!==e.clientHeight}(h)?E:0,H=this.hot.view.maximumVisibleElementWidth(P)-D+z;return{top:y,start:O,height:N,maxHeight:Math.max(this.hot.view.maximumVisibleElementHeight(M)-L+Q,23),width:I,maxWidth:H}}getEditedCellsLayerClass(){switch(this.checkEditorSection()){case"inline-start":return"ht_clone_left ht_clone_inline_start";case"bottom":return"ht_clone_bottom";case"bottom-inline-start-corner":return"ht_clone_bottom_left_corner ht_clone_bottom_inline_start_corner";case"top":return"ht_clone_top";case"top-inline-start-corner":return"ht_clone_top_left_corner ht_clone_top_inline_start_corner";default:return"ht_clone_master"}}getEditedCell(){return this.hot.getCell(this.row,this.col,!0)}checkEditorSection(){const e=this.hot.countRows();let t="";return this.row=e-this.hot.getSettings().fixedRowsBottom?t=this.cols?e.style.width=t.minWidth+"px":s>t.maxWidth?e.style.width=t.maxWidth+"px":e.style.width=s+"px",a=e.scrollHeight?e.scrollHeight-1:0,t.minHeight>a?e.style.height=t.minHeight+"px":t.maxHeightthis.destroy()))}getValue(){return this.TEXTAREA.value}setValue(e){this.TEXTAREA.value=e}open(){this.refreshDimensions(),this.showEditableElement(),this.hot.getShortcutManager().setActiveContextName("editor"),this.addHook("afterDocumentKeyDown",(e=>this.onAfterDocumentKeyDown(e))),this.registerShortcuts()}close(){this.autoResize.unObserve(),this.hot.rootDocument.activeElement===this.TEXTAREA&&this.hot.listen(),this.hideEditableElement(),this.unregisterShortcuts(),this.removeHooksByKey("afterDocumentKeyDown")}prepare(e,t,n,r,i,o){const s=this.state;if(super.prepare(e,t,n,r,i,o),!o.readOnly){this.refreshDimensions(!0);const{allowInvalid:e,fragmentSelection:t}=o;e&&(this.TEXTAREA.value=""),s!==k4.FINISHED&&this.hideEditableElement(),!t&&!ZK()&&this.focus()}}beginEditing(e,t){this.state===k4.VIRGIN&&(this.TEXTAREA.value="",super.beginEditing(e,t))}focus(){this.TEXTAREA.select(),YG(this.TEXTAREA,this.TEXTAREA.value.length)}createElements(){const{rootDocument:e}=this.hot;this.TEXTAREA=e.createElement("TEXTAREA"),this.TEXTAREA.setAttribute("data-hot-input",""),this.TEXTAREA.tabIndex=-1,TG(this.TEXTAREA,"handsontableInput"),this.textareaStyle=this.TEXTAREA.style,this.textareaStyle.width=0,this.textareaStyle.height=0,this.textareaStyle.overflowY="visible",this.TEXTAREA_PARENT=e.createElement("DIV"),TG(this.TEXTAREA_PARENT,"handsontableInputHolder"),_G(this.TEXTAREA_PARENT,this.layerClass)&&RG(this.TEXTAREA_PARENT,this.layerClass),TG(this.TEXTAREA_PARENT,E4),this.textareaParentStyle=this.TEXTAREA_PARENT.style,this.TEXTAREA_PARENT.appendChild(this.TEXTAREA),this.hot.rootElement.appendChild(this.TEXTAREA_PARENT)}hideEditableElement(){VK.edge.value&&(this.textareaStyle.textIndent="-99999px"),this.textareaStyle.overflowY="visible",this.textareaParentStyle.opacity="0",this.textareaParentStyle.height="1px",RG(this.TEXTAREA_PARENT,this.layerClass),TG(this.TEXTAREA_PARENT,E4)}showEditableElement(){this.textareaParentStyle.height="",this.textareaParentStyle.overflow="",this.textareaParentStyle.position="",this.textareaParentStyle[this.hot.isRtl()?"left":"right"]="auto",this.textareaParentStyle.opacity="1",this.textareaStyle.textIndent="",this.textareaStyle.overflowY="hidden";const e=this.TEXTAREA_PARENT.childNodes;let t=!1;EJ(e.length-1,(n=>{if(_G(e[n],"handsontableEditor"))return t=!0,!1})),_G(this.TEXTAREA_PARENT,E4)&&RG(this.TEXTAREA_PARENT,E4),t?(this.layerClass="ht_editor_visible",TG(this.TEXTAREA_PARENT,this.layerClass)):(this.layerClass=this.getEditedCellsLayerClass(),TG(this.TEXTAREA_PARENT,this.layerClass))}refreshValue(){const e=this.hot.toPhysicalRow(this.row),t=this.hot.getSourceDataAtCell(e,this.col);this.originalValue=t,this.setValue(t),this.refreshDimensions()}refreshDimensions(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.state!==k4.EDITING&&!e)return;if(this.TD=this.getEditedCell(),!this.TD)return void(e||this.close());const{top:t,start:n,width:r,maxWidth:i,height:o,maxHeight:s}=this.getEditedCellRect();this.textareaParentStyle.top=`${t}px`,this.textareaParentStyle[this.hot.isRtl()?"right":"left"]=`${n}px`,this.showEditableElement();const a=VG(this.TD,this.hot.rootWindow);this.TEXTAREA.style.fontSize=a.fontSize,this.TEXTAREA.style.fontFamily=a.fontFamily,this.TEXTAREA.style.backgroundColor=this.TD.style.backgroundColor;const l=VG(this.TEXTAREA),c=parseInt(l.paddingLeft,10)+parseInt(l.paddingRight,10),h=parseInt(l.paddingTop,10)+parseInt(l.paddingBottom,10),u=r-c,d=o-h,f=i-c,p=s-h;this.autoResize.init(this.TEXTAREA,{minWidth:Math.min(u,f),minHeight:Math.min(d,p),maxWidth:f,maxHeight:p},!0)}bindEvents(){this.eventManager.addEventListener(this.TEXTAREA,"cut",(e=>e.stopPropagation())),this.eventManager.addEventListener(this.TEXTAREA,"paste",(e=>e.stopPropagation())),XK()&&this.eventManager.addEventListener(this.TEXTAREA,"focusout",(()=>this.finishEditing(!1))),this.addHook("afterScrollHorizontally",(()=>this.refreshDimensions())),this.addHook("afterScrollVertically",(()=>this.refreshDimensions())),this.addHook("afterColumnResize",(()=>{this.refreshDimensions(),this.focus()})),this.addHook("afterRowResize",(()=>{this.refreshDimensions(),this.focus()}))}allowKeyEventPropagation(){}destroy(){this.eventManager.destroy(),this.clearHooks()}registerShortcuts(){const e=this.hot.getShortcutManager().getContext("editor"),t={runOnlyIf:()=>dK(this.hot.getSelected()),group:M4},n=()=>{this.hot.rootDocument.execCommand("insertText",!1,"\n")};e.addShortcuts([{keys:[["Tab"]],callback:e=>{const t=this.hot.getSettings(),n="function"==typeof t.tabMoves?t.tabMoves(e):t.tabMoves;this.hot.selection.transformStart(n.row,n.col,!0)}},{keys:[["Shift","Tab"]],callback:e=>{const t=this.hot.getSettings(),n="function"==typeof t.tabMoves?t.tabMoves(e):t.tabMoves;this.hot.selection.transformStart(-n.row,-n.col)}},{keys:[["Control","Enter"]],callback:()=>(n(),!1),runOnlyIf:e=>!this.hot.selection.isMultiple()&&!e.altKey,relativeToGroup:xJ,position:"before"},{keys:[["Meta","Enter"]],callback:()=>(n(),!1),runOnlyIf:()=>!this.hot.selection.isMultiple(),relativeToGroup:xJ,position:"before"},{keys:[["Alt","Enter"]],callback:()=>(n(),!1),relativeToGroup:xJ,position:"before"},{keys:[["PageUp"]],callback:()=>{this.hot.selection.transformStart(-this.hot.countVisibleRows(),0)}},{keys:[["PageDown"]],callback:()=>{this.hot.selection.transformStart(this.hot.countVisibleRows(),0)}},{keys:[["Home"]],callback:(e,t)=>{let[n]=t;R4(n,this.TEXTAREA)}},{keys:[["End"]],callback:(e,t)=>{let[n]=t;R4(n,this.TEXTAREA)}},{keys:[["Control/Meta","Z"]],preventDefault:!1,callback:()=>{this.hot._registerTimeout((()=>{this.autoResize.resize()}),10)}},{keys:[["Control/Meta","Shift","Z"]],preventDefault:!1,callback:()=>{this.hot._registerTimeout((()=>{this.autoResize.resize()}),10)}}],t)}unregisterShortcuts(){const e=this.hot.getShortcutManager().getContext("editor");e.removeShortcutsByGroup(wJ),e.removeShortcutsByGroup(M4),e.removeShortcutsByGroup(C4)}onAfterDocumentKeyDown(e){-1===[YK.ARROW_UP,YK.ARROW_RIGHT,YK.ARROW_DOWN,YK.ARROW_LEFT].indexOf(e.keyCode)&&this.autoResize.resize(String.fromCharCode(e.keyCode))}},renderer:A4};function z4(e,t){const n=new w4(e,t||{},D1);return n.init(),n}!function(e,t){"string"!=typeof e&&(e=(t=e).CELL_TYPE);const{editor:n,renderer:r,validator:i}=t;n&&vJ(e,n),r&&function(e,t){"string"!=typeof e&&(e=(t=e).RENDERER_TYPE),VJ(e,t)}(e,r),i&&function(e,t){"string"!=typeof e&&(e=(t=e).VALIDATOR_TYPE),YJ(e,t)}(e,i),j3(e,t)}($4),z4.editors={BaseEditor:_4},z4.Core=function(e){return new w4(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},D1)},z4.DefaultSettings=J3(),z4.hooks=aJ.getSingleton(),z4.CellCoords=H0,z4.CellRange=F0,z4.packageName="handsontable",z4.buildDate="31/08/2023 08:23:33",z4.version="13.1.0",z4.languages={dictionaryKeys:l3,getLanguageDictionary:g3,getLanguagesDictionaries:function(){return f3()},registerLanguageDictionary:p3,getTranslatedPhrase:b3};const Q4=z4;function I4(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function N4(e){return N4="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},N4(e)}function D4(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function W4(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:document,t=arguments.length>1?arguments[1]:void 0;if(null===t)return null;var n=t6(t.props,!1);return n.className="".concat("hot-wrapper-editor-container"," ").concat(n.className),gG.createPortal(c.createElement("div",Object.assign({},n),t),e.body)}function e6(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:U4,r=G4(e,"hot-editor"),i=K4(r);return r?c.cloneElement(r,{emitEditorInstance:function(e,n){t.get(i)||t.set(i,new Map),t.get(i).set(null!=n?n:U4,e)},editorColumnScope:n,isEditor:!0}):null}function t6(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return{id:e.id||(t?"hot-"+Math.random().toString(36).substring(5):void 0),className:e.className||"",style:e.style||{}}}var n6=function(){function e(){D4(this,e)}return L4(e,null,[{key:"getSettings",value:function(e){var t={};if(e.settings){var n=e.settings;for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])}for(var i in e)"settings"!==i&&"children"!==i&&e.hasOwnProperty(i)&&(t[i]=e[i]);return t}}]),e}(),r6=function(e){V4(n,e);var t=X4(n);function n(){return D4(this,n),t.apply(this,arguments)}return L4(n,[{key:"getSettingsProps",value:function(){var e=this;return this.internalProps=["_componentRendererColumns","_emitColumnSettings","_columnIndex","_getChildElementByType","_getRendererWrapper","_getEditorClass","_getEditorCache","_getOwnerDocument","hot-renderer","hot-editor","children"],Object.keys(this.props).filter((function(t){return!e.internalProps.includes(t)})).reduce((function(t,n){return t[n]=e.props[n],t}),{})}},{key:"getLocalEditorElement",value:function(){return e6(this.props.children,this.props._getEditorCache(),this.props._columnIndex)}},{key:"createColumnSettings",value:function(){var e=this.props._getChildElementByType(this.props.children,"hot-renderer"),t=this.getLocalEditorElement();this.columnSettings=n6.getSettings(this.getSettingsProps()),null!==e&&(this.columnSettings.renderer=this.props._getRendererWrapper(e),this.props._componentRendererColumns.set(this.props._columnIndex,!0)),null!==t&&(this.columnSettings.editor=this.props._getEditorClass(t,this.props._columnIndex))}},{key:"emitColumnSettings",value:function(){this.props._emitColumnSettings(this.columnSettings,this.props._columnIndex)}},{key:"componentDidMount",value:function(){this.createColumnSettings(),this.emitColumnSettings()}},{key:"componentDidUpdate",value:function(){this.createColumnSettings(),this.emitColumnSettings()}},{key:"render",value:function(){var e=J4(this.props._getOwnerDocument(),this.getLocalEditorElement());return c.createElement(c.Fragment,null,e)}}]),n}(c.Component),i6=function(e){V4(n,e);var t=X4(n);function n(){var e;return D4(this,n),(e=t.apply(this,arguments)).state={portals:[]},e}return L4(n,[{key:"render",value:function(){return c.createElement(c.Fragment,null,this.state.portals)}}]),n}(c.Component);function o6(e,t){return e(t={exports:{}},t.exports),t.exports}var s6="function"==typeof Symbol&&Symbol.for,a6=s6?Symbol.for("react.element"):60103,l6=s6?Symbol.for("react.portal"):60106,c6=s6?Symbol.for("react.fragment"):60107,h6=s6?Symbol.for("react.strict_mode"):60108,u6=s6?Symbol.for("react.profiler"):60114,d6=s6?Symbol.for("react.provider"):60109,f6=s6?Symbol.for("react.context"):60110,p6=s6?Symbol.for("react.async_mode"):60111,g6=s6?Symbol.for("react.concurrent_mode"):60111,m6=s6?Symbol.for("react.forward_ref"):60112,b6=s6?Symbol.for("react.suspense"):60113,v6=s6?Symbol.for("react.suspense_list"):60120,y6=s6?Symbol.for("react.memo"):60115,O6=s6?Symbol.for("react.lazy"):60116,w6=s6?Symbol.for("react.block"):60121,x6=s6?Symbol.for("react.fundamental"):60117,S6=s6?Symbol.for("react.responder"):60118,k6=s6?Symbol.for("react.scope"):60119;function C6(e){if("object"===N4(e)&&null!==e){var t=e.$$typeof;switch(t){case a6:switch(e=e.type){case p6:case g6:case c6:case u6:case h6:case b6:return e;default:switch(e=e&&e.$$typeof){case f6:case m6:case O6:case y6:case d6:return e;default:return t}}case l6:return t}}}function _6(e){return C6(e)===g6}var T6={AsyncMode:p6,ConcurrentMode:g6,ContextConsumer:f6,ContextProvider:d6,Element:a6,ForwardRef:m6,Fragment:c6,Lazy:O6,Memo:y6,Portal:l6,Profiler:u6,StrictMode:h6,Suspense:b6,isAsyncMode:function(e){return _6(e)||C6(e)===p6},isConcurrentMode:_6,isContextConsumer:function(e){return C6(e)===f6},isContextProvider:function(e){return C6(e)===d6},isElement:function(e){return"object"===N4(e)&&null!==e&&e.$$typeof===a6},isForwardRef:function(e){return C6(e)===m6},isFragment:function(e){return C6(e)===c6},isLazy:function(e){return C6(e)===O6},isMemo:function(e){return C6(e)===y6},isPortal:function(e){return C6(e)===l6},isProfiler:function(e){return C6(e)===u6},isStrictMode:function(e){return C6(e)===h6},isSuspense:function(e){return C6(e)===b6},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===c6||e===g6||e===u6||e===h6||e===b6||e===v6||"object"===N4(e)&&null!==e&&(e.$$typeof===O6||e.$$typeof===y6||e.$$typeof===d6||e.$$typeof===f6||e.$$typeof===m6||e.$$typeof===x6||e.$$typeof===S6||e.$$typeof===k6||e.$$typeof===w6)},typeOf:C6},R6=o6((function(e,t){}));R6.AsyncMode,R6.ConcurrentMode,R6.ContextConsumer,R6.ContextProvider,R6.Element,R6.ForwardRef,R6.Fragment,R6.Lazy,R6.Memo,R6.Portal,R6.Profiler,R6.StrictMode,R6.Suspense,R6.isAsyncMode,R6.isConcurrentMode,R6.isContextConsumer,R6.isContextProvider,R6.isElement,R6.isForwardRef,R6.isFragment,R6.isLazy,R6.isMemo,R6.isPortal,R6.isProfiler,R6.isStrictMode,R6.isSuspense,R6.isValidElementType,R6.typeOf,o6((function(e){e.exports=T6}));Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;(function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(t).map((function(e){return t[e]}));if("0123456789"!==r.join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach((function(e){i[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(e){return!1}})()&&Object.assign;function E6(){}function M6(){}Function.call.bind(Object.prototype.hasOwnProperty),M6.resetWarningCache=E6;var P6=o6((function(e){e.exports=function(){function e(e,t,n,r,i,o){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==o){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:M6,resetWarningCache:E6};return n.PropTypes=n,n}()})),A6=function(e){V4(n,e);var t=X4(n);function n(){var e;return D4(this,n),(e=t.apply(this,arguments)).id=null,e.__hotInstance=null,e.hotElementRef=null,e.columnSettings=[],e.renderersPortalManager=null,e.portalCacheArray=[],e.renderedCellCache=new Map,e.editorCache=new Map,e.componentRendererColumns=new Map,e}return L4(n,[{key:"hotInstance",get:function(){return!this.__hotInstance||this.__hotInstance&&!this.__hotInstance.isDestroyed?this.__hotInstance:(console.warn("The Handsontable instance bound to this component was destroyed and cannot be used properly."),null)},set:function(e){this.__hotInstance=e}},{key:"getRenderedCellCache",value:function(){return this.renderedCellCache}},{key:"getEditorCache",value:function(){return this.editorCache}},{key:"clearCache",value:function(){this.getRenderedCellCache().clear(),this.componentRendererColumns.clear()}},{key:"getOwnerDocument",value:function(){return this.hotElementRef?this.hotElementRef.ownerDocument:document}},{key:"setHotElementRef",value:function(e){this.hotElementRef=e}},{key:"getRendererWrapper",value:function(e){var t=this;return function(n,r,i,o,s,a,l){var h=t.getRenderedCellCache();if(h.has("".concat(i,"-").concat(o))&&(r.innerHTML=h.get("".concat(i,"-").concat(o)).innerHTML),r&&!r.getAttribute("ghost-table")){for(var u=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document;n||(n=document),q4||(q4=n.createDocumentFragment());var r=n.createElement("DIV");q4.appendChild(r);var i=c.cloneElement(e,function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:U4,r=K4(e),i=null===(t=this.getEditorCache().get(r))||void 0===t?void 0:t.get(n);return this.makeEditorClass(i)}},{key:"makeEditorClass",value:function(e){var t=function(t){V4(r,t);var n=X4(r);function r(t){var i;return D4(this,r),i=n.call(this,t),e.hotCustomEditorInstance=Z4(i),i.editorComponent=e,i}return L4(r,[{key:"focus",value:function(){}},{key:"getValue",value:function(){}},{key:"setValue",value:function(){}},{key:"open",value:function(){}},{key:"close",value:function(){}}]),r}(Q4.editors.BaseEditor);return Object.getOwnPropertyNames(Q4.editors.BaseEditor.prototype).forEach((function(n){"constructor"!==n&&(t.prototype[n]=function(){for(var t,r=arguments.length,i=new Array(r),o=0;o0&&function(){var e;"undefined"!=typeof console&&(e=console).warn.apply(e,arguments)}("Your `HotTable` configuration includes `autoRowSize`/`autoColumnSize` options, which are not compatible with the component-based renderers`. Disable `autoRowSize` and `autoColumnSize` to prevent row and column misalignment.")}},{key:"setHotColumnSettings",value:function(e,t){this.columnSettings[t]=e}},{key:"handsontableBeforeViewRender",value:function(){this.getRenderedCellCache().clear()}},{key:"handsontableAfterViewRender",value:function(){var e,t=this;this.renderersPortalManager.setState({portals:(e=this.portalCacheArray,function(e){if(Array.isArray(e))return F4(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return F4(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?F4(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())},(function(){t.portalCacheArray=[]}))}},{key:"updateHot",value:function(e){this.hotInstance&&this.hotInstance.updateSettings(e,!1)}},{key:"setRenderersPortalManagerRef",value:function(e){this.renderersPortalManager=e}},{key:"componentDidMount",value:function(){var e=this,t=this.createNewGlobalSettings();this.hotInstance=new Q4.Core(this.hotElementRef,t),this.hotInstance.addHook("beforeViewRender",(function(){return e.handsontableBeforeViewRender()})),this.hotInstance.addHook("afterViewRender",(function(){return e.handsontableAfterViewRender()})),this.hotInstance.init(),this.displayAutoSizeWarning(t)}},{key:"componentDidUpdate",value:function(){this.clearCache();var e=this.createNewGlobalSettings();this.updateHot(e),this.displayAutoSizeWarning(e)}},{key:"componentWillUnmount",value:function(){this.clearCache(),this.hotInstance&&this.hotInstance.destroy()}},{key:"render",value:function(){var e=this,t=t6(this.props),n=c.Children.toArray(this.props.children).filter((function(e){return function(e){return e.type===r6}(e)})).map((function(t,n){return c.cloneElement(t,{_componentRendererColumns:e.componentRendererColumns,_emitColumnSettings:e.setHotColumnSettings.bind(e),_columnIndex:n,_getChildElementByType:G4.bind(e),_getRendererWrapper:e.getRendererWrapper.bind(e),_getEditorClass:e.getEditorClass.bind(e),_getOwnerDocument:e.getOwnerDocument.bind(e),_getEditorCache:e.getEditorCache.bind(e),children:t.props.children})})),r=J4(this.getOwnerDocument(),this.getGlobalEditorElement());return c.createElement(c.Fragment,null,c.createElement("div",Object.assign({ref:this.setHotElementRef.bind(this)},t),n),c.createElement(i6,{ref:this.setRenderersPortalManagerRef.bind(this)}),r)}}],[{key:"version",get:function(){return"13.1.0"}}]),n}(c.Component);A6.propTypes={style:P6.object,id:P6.string,className:P6.string},c.Component;const $6={bg:"#f6f7f7",sidebar:"#f0f0f1",border:"#dcdcde",dark:"#1d2327",gray1:"#646970",gray2:"#8c8f94",gray3:"#c3c4c7",dim:"#f0f0f1",hover:"#f6f7f7"},z6=({children:e})=>(0,c.createElement)(sa,{fontSize:"11px",color:$6.gray2,mt:"1",lineHeight:"1.5"},e),Q6=({children:e})=>(0,c.createElement)(sa,{fontSize:"11px",fontWeight:"500",color:$6.gray1,letterSpacing:"0.03em",textTransform:"uppercase",mb:"1"},e),I6={"&::placeholder":{color:"#C4C2BC"},"&:focus":{borderColor:"#1C1C1E",boxShadow:"0 0 0 3px rgba(28,28,30,0.07)",outline:"none"}},N6=e=>(0,c.createElement)(ta,{as:"input",display:"block",w:"100%",px:"11px",py:"9px",borderRadius:"9px",border:"1.5px solid",borderColor:$6.border,bg:"white",color:$6.dark,fontSize:"13px",fontFamily:"inherit",sx:I6,...e}),D6=[{id:"manual",Icon:function({active:e}){const t=e?"#fff":$6.gray1;return(0,c.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none"},(0,c.createElement)("rect",{x:"1",y:"1",width:"12",height:"3",rx:"1",fill:t,opacity:".9"}),(0,c.createElement)("rect",{x:"1",y:"6",width:"12",height:"2",rx:"1",fill:t,opacity:".6"}),(0,c.createElement)("rect",{x:"1",y:"10",width:"7",height:"2",rx:"1",fill:t,opacity:".35"}))},label:(0,a.__)("Manual","visualizer")},{id:"sheet",Icon:function({active:e}){const t=e?"#fff":$6.gray1;return(0,c.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none"},(0,c.createElement)("rect",{x:"1",y:"2",width:"12",height:"10",rx:"1.5",stroke:t,strokeWidth:"1.2"}),(0,c.createElement)("path",{d:"M1 5h12M1 8h12M5 2v10M9 2v10",stroke:t,strokeWidth:"1",opacity:".7"}))},label:(0,a.__)("Spreadsheet","visualizer")},{id:"csv_file",Icon:function({active:e}){const t=e?"#fff":$6.gray1;return(0,c.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none"},(0,c.createElement)("path",{d:"M3 2a1 1 0 0 1 1-1h5l3 3v8a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2z",stroke:t,strokeWidth:"1.2"}),(0,c.createElement)("path",{d:"M8 1v3h3",stroke:t,strokeWidth:"1.2"}),(0,c.createElement)("path",{d:"M5 8h4M5 10.5h2.5",stroke:t,strokeWidth:"1",strokeLinecap:"round"}))},label:(0,a.__)("File","visualizer")},{id:"url",Icon:function({active:e}){const t=e?"#fff":$6.gray1;return(0,c.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none"},(0,c.createElement)("path",{d:"M5.5 8.5a3.5 3.5 0 0 0 4.95 0l1.5-1.5a3.5 3.5 0 0 0-4.95-4.95L6.07 3",stroke:t,strokeWidth:"1.2",strokeLinecap:"round"}),(0,c.createElement)("path",{d:"M8.5 5.5a3.5 3.5 0 0 0-4.95 0L2.05 7a3.5 3.5 0 0 0 4.95 4.95L7.93 11",stroke:t,strokeWidth:"1.2",strokeLinecap:"round"}))},label:(0,a.__)("URL","visualizer")}],W6="Task,Hours per Day\nstring,number\nWork,11\nEat,2\nCommute,2\nWatch TV,2\nSleep,7",L6="Month,Revenue,Costs\nstring,number,number\nJan,45000,32000\nFeb,52000,38000";function H6({chartId:e,uploadNonce:t,onDataReady:n,dataLoaded:r,initialCsvText:i="",disabled:o=!1,dataWarning:l=null,onClearWarning:h=null}){const u=!!window?.vizAIBuilder?.isPro,[d,f]=(0,s.useState)("manual"),[p,g]=(0,s.useState)(!1),[m,b]=(0,s.useState)(null),[v,y]=(0,s.useState)(i||W6),[O,w]=(0,s.useState)(P(i||W6)),x=(0,s.useRef)(!1),S=(0,s.useRef)(null),[k,C]=(0,s.useState)(null),_=(0,s.useRef)(null),T=(0,s.useRef)(!!i),[R,E]=(0,s.useState)(""),M=(0,s.useRef)(null);function P(e){const t=e.split(/\r?\n/).filter((e=>e.length));if(0===t.length)return[["Column 1","Column 2"],["string","number"],["",""]];const n=t.map((e=>e.split(","))),r=Math.max(...n.map((e=>e.length)));return n.map((e=>[...e,...Array(Math.max(0,r-e.length)).fill("")]))}function A(e){return e.map((e=>e.join(","))).join("\n")}function $(e=[],t=[]){if(!e.length)return"";const n=e.map((e=>e.label)).join(","),r=e.map((e=>e.type||"string")).join(","),i=(t||[]).map((e=>e.join(",")));return[n,r,...i].join("\n")}return(0,s.useEffect)((()=>{i&&(T.current=!0,M.current=i.trim(),y(i))}),[i]),(0,s.useEffect)((()=>{if(o)return;if("manual"!==d&&"sheet"!==d||!v.trim()||!e||!t)return;if(T.current)return void(T.current=!1);const r=v.trim();if(M.current===r)return;const i=function(e){const t=e.split(/\r?\n/).map((e=>e.trim())).filter(Boolean);return t.length<3?null:{header:t[0],types:t[1],data:t.slice(2).join("\n")}}(r);if(!i)return void b((0,a.__)("CSV must include header and types rows.","visualizer"));const s=setTimeout((async()=>{g(!0),b(null);try{const i=await uG(e,t,r);n(i.series,i.data),M.current=r}catch(e){b(e.message)}finally{g(!1)}}),700);return()=>clearTimeout(s)}),[d,v,t]),(0,s.useEffect)((()=>{"sheet"===d&&(x.current?x.current=!1:w(P(v)))}),[d,v]),(0,c.createElement)(pG,{gap:"4"},(0,c.createElement)(ta,{bg:$6.sidebar,borderRadius:"10px",p:"3px",border:"1px solid",borderColor:$6.border,display:"flex",gap:"3px"},D6.map((e=>{const t=d===e.id;return(0,c.createElement)(ta,{key:e.id,flex:"1",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",py:"6px",borderRadius:"8px",bg:t?"white":"transparent",border:t?"1px solid":"1px solid transparent",borderColor:t?$6.border:"transparent",boxShadow:t?"0 2px 6px rgba(0,0,0,0.06)":"none",cursor:o?"not-allowed":"pointer",opacity:o?.6:1,onClick:o?void 0:()=>function(e){if("manual"===e&&"sheet"===d){const e=function(e){if(!e||!e.length)return e;const t=e=>null==e||""===String(e).trim();let n=-1;e.forEach((e=>{e.forEach(((e,r)=>{t(e)||(n=Math.max(n,r))}))})),n=Math.max(n,1);let r=e.map((e=>e.slice(0,n+1))),i=-1;for(let e=2;e!t(e)))&&(i=e);const o=r.slice(0,2);return r=i>=2?o.concat(r.slice(2,i+1)):o.concat([Array(n+1).fill("")]),r}(O);T.current=!0,w(e),y(A(e))}f(e),b(null),h&&h()}(e.id),transition:"all 0.15s"},(0,c.createElement)(ta,{w:"18px",h:"18px",borderRadius:"5px",display:"flex",alignItems:"center",justifyContent:"center",bg:t?$6.dark:"white",border:"1px solid",borderColor:t?$6.dark:$6.border,transition:"background 0.15s"},(0,c.createElement)(e.Icon,{active:t})),(0,c.createElement)(sa,{fontSize:"10px",fontWeight:t?"600":"500",color:t?$6.dark:$6.gray1,letterSpacing:"0.01em",lineHeight:"1",whiteSpace:"nowrap"},e.label))}))),!u&&"manual"!==d&&(0,c.createElement)(ta,{p:"4",borderRadius:"12px",bg:"linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%)",border:"1px solid",borderColor:$6.border,boxShadow:"0 8px 24px rgba(16,24,40,0.08)"},(0,c.createElement)(sa,{fontSize:"13px",fontWeight:"700",color:$6.dark,mb:"1"},(0,a.__)("Unlock advanced data sources","visualizer")),(0,c.createElement)(sa,{fontSize:"12px",color:$6.gray1,mb:"3"},(0,a.__)("Spreadsheet, File, and URL imports are available in Pro.","visualizer")),(0,c.createElement)(aa,{align:"center",gap:"2",mb:"3"},(0,c.createElement)(sa,{fontSize:"11px",color:$6.gray1},(0,a.__)("• Spreadsheet editor","visualizer")),(0,c.createElement)(sa,{fontSize:"11px",color:$6.gray1},(0,a.__)("• CSV & XLSX upload","visualizer")),(0,c.createElement)(sa,{fontSize:"11px",color:$6.gray1},(0,a.__)("• Remote URL import","visualizer"))),(0,c.createElement)(aa,{align:"center",gap:"2"},(0,c.createElement)(ta,{as:"a",href:window?.vizAIBuilder?.upgradeUrl||"https://themeisle.com/plugins/visualizer-charts-and-graphs/upgrade/",target:"_blank",rel:"noopener noreferrer",display:"inline-flex",alignItems:"center",gap:"6px",px:"12px",py:"8px",borderRadius:"9px",fontSize:"12px",fontWeight:"700",bg:$6.dark,color:"white",_hover:{color:"white",textDecoration:"none",filter:"brightness(0.98)"},_focus:{color:"white",textDecoration:"none"}},(0,a.__)("Upgrade to Pro","visualizer")),(0,c.createElement)(sa,{fontSize:"11px",color:$6.gray2},(0,a.__)("Cancel anytime","visualizer")))),"manual"===d&&(0,c.createElement)(ta,{border:`1.5px solid ${$6.border}`,borderRadius:"10px",overflow:"hidden"},(0,c.createElement)(aa,{align:"center",justify:"space-between",px:"3",py:"1.5",bg:$6.sidebar,borderBottom:`1.5px solid ${$6.border}`},(0,c.createElement)(sa,{fontSize:"11px",fontWeight:"500",color:$6.gray1,letterSpacing:"0.03em",textTransform:"uppercase"},(0,a.__)("CSV data","visualizer")),(0,c.createElement)(aa,{align:"center",gap:"2.5"},(0,c.createElement)(sa,{fontSize:"11px",color:$6.gray2},(0,a.__)("Row 1: labels · Row 2: types","visualizer")),(0,c.createElement)(ta,{as:"button",fontSize:"11px",color:$6.gray1,fontWeight:"500",px:"7px",py:"2px",borderRadius:"5px",bg:"#E8E6E1",border:"none",cursor:"pointer",onClick:o?void 0:()=>y(W6),disabled:o,opacity:o?.6:1,style:{cursor:o?"not-allowed":"pointer"}},(0,a.__)("Load sample","visualizer")))),(0,c.createElement)(ta,{as:"textarea",display:"block",w:"100%",minH:"96px",border:"none",outline:"none",resize:"vertical",px:"12px",py:"10px",fontFamily:"'SF Mono', 'Fira Code', monospace",fontSize:"12px",lineHeight:"1.6",color:$6.dark,placeholder:L6,value:v,onChange:o?void 0:e=>y(e.target.value),disabled:o,sx:{"&::placeholder":{color:$6.gray3}}})),"sheet"===d&&u&&(0,c.createElement)(ta,{border:`1.5px solid ${$6.border}`,borderRadius:"10px",overflow:"hidden",bg:"white"},(0,c.createElement)(aa,{align:"center",justify:"space-between",px:"3",py:"1.5",bg:$6.sidebar,borderBottom:`1.5px solid ${$6.border}`},(0,c.createElement)(sa,{fontSize:"11px",fontWeight:"500",color:$6.gray1,letterSpacing:"0.03em",textTransform:"uppercase"},(0,a.__)("Spreadsheet","visualizer")),(0,c.createElement)(aa,{align:"center",gap:"2"},(0,c.createElement)(sa,{fontSize:"11px",color:$6.gray2},(0,a.__)("Row 1: labels · Row 2: types","visualizer")),(0,c.createElement)(ta,{as:"button",fontSize:"11px",color:$6.gray1,fontWeight:"500",px:"7px",py:"2px",borderRadius:"5px",bg:"#E8E6E1",border:"none",onClick:o?void 0:()=>y(W6),disabled:o,opacity:o?.6:1,style:{cursor:o?"not-allowed":"pointer"}},(0,a.__)("Load sample","visualizer")))),(0,c.createElement)(ta,{className:"viz-ai-hot",position:"relative",overflow:"visible"},O.length?(0,c.createElement)(A6,{ref:S,data:O,handsontable:window?.Handsontable,colHeaders:!0,rowHeaders:!0,allowInsertRow:!0,allowInsertColumn:!0,outsideClickDeselects:!1,stretchH:"all",height:"240",licenseKey:"non-commercial-and-evaluation",minRows:3,minCols:2,manualColumnResize:!0,manualRowResize:!0,readOnly:o,afterChange:(e,t)=>{e&&"loadData"!==t&&e.forEach((([e,t,,n])=>{!function(e,t,n){w((r=>{const i=r.map((e=>[...e]));return i[e]||(i[e]=[]),i[e][t]=n,x.current=!0,y(A(i)),i}))}(e,t,null!=n?n:"")}))}}):(0,c.createElement)(sa,{fontSize:"12px",color:$6.gray2,px:"3",py:"3"},(0,a.__)("Loading spreadsheet…","visualizer"))),(0,c.createElement)(aa,{align:"center",gap:"2",px:"3",py:"2",borderTop:`1.5px solid ${$6.border}`,bg:"white"},(0,c.createElement)(ta,{as:"button",px:"10px",py:"5px",borderRadius:"7px",fontSize:"11px",fontWeight:"500",bg:"white",border:"1.5px solid",borderColor:$6.border,cursor:o?"not-allowed":"pointer",opacity:o?.6:1,onClick:o?void 0:function(){w((e=>{const t=e[0]?e[0].length:2,n=[...e,Array(t).fill("")];return x.current=!0,y(A(n)),n}))}},(0,a.__)("Add row","visualizer")),(0,c.createElement)(ta,{as:"button",px:"10px",py:"5px",borderRadius:"7px",fontSize:"11px",fontWeight:"500",bg:"white",border:"1.5px solid",borderColor:$6.border,cursor:o?"not-allowed":"pointer",opacity:o?.6:1,onClick:o?void 0:function(){w((e=>{const t=e.map((e=>[...e,""]));return x.current=!0,y(A(t)),t}))}},(0,a.__)("Add column","visualizer")))),"csv_file"===d&&u&&(0,c.createElement)(c.Fragment,null,(0,c.createElement)(aa,{align:"center",gap:"2"},(0,c.createElement)(ta,{flex:"1",px:"10px",py:"7px",borderRadius:"8px",border:"1.5px solid",borderColor:$6.border,fontSize:"12px",bg:"white",color:k?$6.dark:$6.gray2,opacity:o?.6:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},k?k.name:(0,a.__)("Choose a file (.csv or .xlsx)","visualizer")),(0,c.createElement)(ta,{as:"button",px:"12px",py:"7px",borderRadius:"8px",fontSize:"11px",fontWeight:"600",bg:$6.dark,color:"white",border:"none",cursor:o?"not-allowed":"pointer",onClick:o?void 0:()=>_.current?.click(),disabled:o,opacity:o?.6:1},(0,a.__)("Browse","visualizer"))),(0,c.createElement)(ta,null,(0,c.createElement)(ta,{as:"button",px:"14px",py:"7px",borderRadius:"9px",fontSize:"12px",fontWeight:"500",bg:$6.dark,color:"white",border:"none",cursor:o||!k?"not-allowed":"pointer",opacity:o||!k?.6:1,onClick:o||!k?void 0:async function(){if(!o&&k&&e){g(!0),b(null);try{const r=await async function(e,t,n){return lG("visualizer-ai-upload",{chart_id:e,source_type:"xlsx"===n.name.split(".").pop().toLowerCase()?"xlsx_file":"csv_file",data_file:n},{nonceOverride:t,omitEmpty:!0})}(e,t,k);n(r.series,r.data);const i=$(r.series,r.data);i&&(T.current=!0,y(i)),f("manual")}catch(e){b(e.message)}finally{g(!1)}}}},(0,a.__)("Import file","visualizer"))),(0,c.createElement)("input",{ref:_,type:"file",accept:".csv,.xlsx",disabled:o,style:{display:"none"},onChange:e=>C(e.target.files[0]||null)}),(0,c.createElement)(z6,null,(0,a.__)("Row 1 = column names · Row 2 = types (string / number / date / boolean)","visualizer"))),"url"===d&&u&&(0,c.createElement)(pG,{gap:"3"},(0,c.createElement)(ta,null,(0,c.createElement)(Q6,null,(0,a.__)("Remote file URL","visualizer")),(0,c.createElement)(N6,{type:"url",placeholder:"https://example.com/data.csv",value:R,onChange:o?void 0:e=>E(e.target.value),disabled:o}),(0,c.createElement)(z6,null,(0,a.__)("Supports .csv and .xlsx · Google Spreadsheet share URLs accepted","visualizer"))),(0,c.createElement)(ta,null,(0,c.createElement)(ta,{as:"button",px:"14px",py:"7px",borderRadius:"9px",fontSize:"12px",fontWeight:"500",bg:$6.dark,color:"white",border:"none",cursor:o||!R.trim()?"not-allowed":"pointer",opacity:o||!R.trim()?.6:1,onClick:o||!R.trim()?void 0:async function(){if(!o&&R.trim()&&e){g(!0),b(null);try{const r=await async function(e,t,n,r=""){return lG("visualizer-ai-upload",{chart_id:e,source_type:"file_url",file_url:n,schedule:r},{nonceOverride:t,omitEmpty:!0})}(e,t,R.trim());n(r.series,r.data);const i=$(r.series,r.data);i&&(T.current=!0,y(i)),f("manual")}catch(e){b(e.message)}finally{g(!1)}}}},(0,a.__)("Import URL","visualizer")))),p&&(0,c.createElement)(aa,{align:"center",gap:"2"},(0,c.createElement)(ta,{w:"14px",h:"14px",borderRadius:"full",border:"2px solid #ddd",borderTopColor:$6.dark,style:{animation:"viz-spin 0.7s linear infinite"},flexShrink:0}),(0,c.createElement)(sa,{fontSize:"12px",color:$6.gray2},(0,a.__)("Loading data…","visualizer"))),m&&(0,c.createElement)(ta,{p:"2.5",bg:"#fff5f5",border:"1.5px solid #fca5a5",borderRadius:"8px"},(0,c.createElement)(sa,{fontSize:"12px",color:"#b91c1c"},m)),r&&!p&&!m&&(0,c.createElement)(aa,{align:"center",gap:"1.5"},(0,c.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none"},(0,c.createElement)("circle",{cx:"7",cy:"7",r:"6",fill:"#d1fae5"}),(0,c.createElement)("path",{d:"M4.5 7l2 2 3-3",stroke:"#059669",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})),(0,c.createElement)(sa,{fontSize:"12px",color:"#059669",fontWeight:"500"},(0,a.__)("Data loaded","visualizer"))),l&&(0,c.createElement)(ta,{p:"2.5",bg:"#fffbeb",border:"1.5px solid #fcd34d",borderRadius:"8px"},(0,c.createElement)(sa,{fontSize:"12px",color:"#b45309"},l)))}function V6(e,t,n,o){if(!e||!t)return;const s=function(e,t){return t.map((t=>{const n={};return e.forEach(((e,r)=>{n[e.label]=t[r]})),n}))}(n,o);t.innerHTML="";try{return new Function("d3","topojson","container","data",e)(r,i,t,s),null}catch(e){const n=`Chart error: ${e.message}`;return t.innerHTML=`

${n}

`,n}}const B6={bg:"#f6f7f7",sidebar:"#f0f0f1",border:"#dcdcde",dark:"#1d2327",gray1:"#646970",gray2:"#8c8f94",gray3:"#c3c4c7",dim:"#f0f0f1",teal:"#39c3d2"},j6=[(0,a.__)("Bar chart comparing totals by category, sorted descending","visualizer"),(0,a.__)("Line chart showing trend over time with markers","visualizer"),(0,a.__)("Stacked area chart to show part-to-whole over time","visualizer"),(0,a.__)("Scatter plot showing correlation between two numeric fields","visualizer"),(0,a.__)("Pie chart showing share by category with labels","visualizer")];function Z6({num:e,active:t}){return(0,c.createElement)(ta,{w:"22px",h:"22px",borderRadius:"full",flexShrink:0,bg:t?B6.dark:B6.dim,border:t?"none":`1px solid ${B6.border}`,display:"flex",alignItems:"center",justifyContent:"center"},(0,c.createElement)(sa,{fontSize:"11px",fontWeight:t?"600":"500",color:t?"white":B6.gray2,lineHeight:"1"},e))}function X6({children:e,onClick:t,disabled:n,bg:r=B6.dark,color:i="white",border:o,borderColor:s,cursor:a}){return(0,c.createElement)(ta,{as:"button",onClick:n?void 0:t,disabled:n,display:"inline-flex",alignItems:"center",gap:"6px",px:"20px",py:"9px",borderRadius:"9px",fontSize:"13px",fontWeight:"500",bg:n&&r===B6.dark?"#555":r,color:i,border:o||"none",borderColor:s,cursor:n?"not-allowed":a||"pointer",opacity:n?.65:1,transition:"background 0.15s",_hover:n?{}:{filter:"brightness(0.92)"}},e)}function F6({onClose:e,initialChartId:t=null}){const[n,r]=(0,s.useState)(null),[i,o]=(0,s.useState)(null),[l,h]=(0,s.useState)(null),[u,d]=(0,s.useState)([]),[f,p]=(0,s.useState)([]),[g,m]=(0,s.useState)([]),[b,v]=(0,s.useState)([]),[y,O]=(0,s.useState)(!1),[w,x]=(0,s.useState)(""),[S,k]=(0,s.useState)(""),[C,_]=(0,s.useState)(null),[T,R]=(0,s.useState)(null),[E,M]=(0,s.useState)(!1),[P,A]=(0,s.useState)(null),[$,z]=(0,s.useState)(null),[Q,I]=(0,s.useState)(null),[N,D]=(0,s.useState)(null),[W,L]=(0,s.useState)(!1),[H,V]=(0,s.useState)(!1),[B,j]=(0,s.useState)(""),[Z,X]=(0,s.useState)(""),[F,Y]=(0,s.useState)(!1),[q,U]=(0,s.useState)(null),[G,K]=(0,s.useState)(null),[J,ee]=(0,s.useState)(!1),te=(0,s.useRef)(null),ne=(0,s.useRef)(null),re=(0,s.useRef)(null),ie=(0,s.useRef)(null),[oe,se]=(0,s.useState)(!1),ae=(0,s.useRef)(null),le=(0,s.useRef)(!1),ce=(0,s.useRef)("agent"),he=E||W,ue=!!S?.trim()&&!E&&!W;function de(e,t){const n=JSON.stringify(e||[]),r=ae.current&&ae.current!==n;if(d(e),p(t),O(!0),r)D((0,a.__)("The column headers changed. Please regenerate to update the chart.","visualizer")),z(null);else if(T){const n=document.createElement("div");V6(T,n,e,t)?(D((0,a.__)("These data changes do not match the current chart. Please regenerate to update the preview.","visualizer")),z(null)):(m(e),v(t),D(null))}else m(e),v(t),D(null);A(null),ae.current=n}async function fe(){if(S?.trim()){M(!0),A(null),z(null),D(null),le.current=!1;try{let t=null,r=null;C&&(t=await new Promise(((e,t)=>{const n=new FileReader;n.onload=()=>e(n.result.split(",")[1]),n.onerror=()=>t(new Error((0,a.__)("Failed to read image file.","visualizer"))),n.readAsDataURL(C)})),r=C.type||"image/jpeg");const{workflow_id:o}=await dG(n,S,u,f,T||null,t,r),s=90,l=2e3;let c=0;for(;csetTimeout(e,l))),c++;const t=await fG(o),r=null!==(e=t.status)&&void 0!==e?e:t.workflowStatus;if("completed"===r){const e=t.output?.code,r=t.output?.data_csv||t.output?.csv||null;if(!e)throw new Error((0,a.__)("Generation completed but no code was returned.","visualizer"));if(R(e),ce.current="agent",r&&i)try{const e=String(r).trim(),t=await uG(n,i,e);x(e),de(t.series,t.data)}catch(e){m(u),v(f),D(null),A((0,a.__)("Chart generated, but the extracted data could not be parsed. Please verify the data or regenerate.","visualizer"))}else m(u),v(f),D(null);return}if("failed"===r)throw new Error((0,a.__)("Chart generation failed. Please try again.","visualizer"))}throw new Error((0,a.__)("Generation timed out. Please try again.","visualizer"))}catch(e){A(e.message)}finally{M(!1)}}}async function pe(e){if(n&&y&&!W){L(!0),A(null);try{const r=function(e){const t=["The D3 code you returned threw a runtime/syntax error when executed.",`Error: "${e}"`,"Please fix the D3 code to resolve the error.","Keep the chart intent the same and only return corrected D3 code."].join("\n");return S?.trim()?`${t}\n\nOriginal user request:\n${S.trim()}`:t}(e),{workflow_id:i}=await dG(n,r,u,f,T||null,null,null),o=60,s=2e3;let l=0;for(;lsetTimeout(e,s))),l++;const e=await fG(i),n=null!==(t=e.status)&&void 0!==t?t:e.workflowStatus;if("completed"===n){const t=e.output?.code;if(!t)throw new Error((0,a.__)("Fix completed but no code was returned.","visualizer"));return R(t),ce.current="agent",void z(null)}if("failed"===n)throw new Error((0,a.__)("Fix attempt failed. Please try again.","visualizer"))}throw new Error((0,a.__)("Fix attempt timed out. Please try again.","visualizer"))}catch(e){A(e.message)}finally{L(!1)}}}function ge(){V(!1),I(null)}return(0,s.useEffect)((()=>{if(!oe)return;re.current?.focus();const e=e=>{"Escape"===e.key&&se(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}),[oe]),(0,s.useEffect)((()=>{if(!H)return;const e=e=>{"Escape"===e.key&&ge()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}),[H]),(0,s.useEffect)((()=>{if(!H)return;const{body:e}=document,t=e.style.overflow;return e.style.overflow="hidden",()=>{e.style.overflow=t}}),[H]),(0,s.useEffect)((()=>{t?(r(parseInt(t,10)),Promise.all([cG(t),hG(t)]).then((([e,n])=>{o(e.upload_nonce);const r=e=>{if(e.title&&X(e.title),e.series&&d(e.series),e.data&&(p(e.data),O(!0)),e.series&&m(e.series),e.data&&v(e.data),e.series&&e.data){const t=function(e,t){if(!Array.isArray(e)||!e.length)return"";const n=e.map((e=>e.label)).join(","),r=e.map((e=>e.type||"string")).join(","),i=(t||[]).map((e=>e.join(",")));return[n,r,...i].join("\n")}(e.series,e.data);t&&x(t)}e.code&&R(e.code)},i="visualizer-"+t,s=window.visualizer?.charts?.[i];s?r(s):n&&r(n)})).catch((e=>h(e.message)))):async function(){return lG("visualizer-ai-create",{})}().then((e=>{r(e.chart_id),o(e.upload_nonce)})).catch((e=>h(e.message)))}),[t]),(0,s.useEffect)((()=>{const e=H?B:T;if(!e||!te.current)return;if(!Array.isArray(g)||!Array.isArray(b)||0===g.length)return void(te.current.innerHTML="");const t=V6(e,te.current,g,b);H?I(t||null):t?(z(t),"agent"!==ce.current||W||le.current||(le.current=!0,pe(t))):z(null)}),[T,B,H,g,b]),(0,s.useEffect)((()=>{if(!oe||!T||!ne.current)return;if(!Array.isArray(u)||!Array.isArray(f)||0===u.length)return void(ne.current.innerHTML="");V6(T,ne.current,u,f);const e=()=>V6(T,ne.current,u,f);return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e),ne.current&&(ne.current.innerHTML="")}}),[oe,T,u,f]),(0,s.useEffect)((()=>{u&&u.length&&(ae.current=JSON.stringify(u))}),[u]),l?(0,c.createElement)(aa,{flex:"1",align:"center",justify:"center",p:"10"},(0,c.createElement)(ta,{px:"4",py:"3",bg:"#fef2f2",borderLeft:"3px solid #cc1818",borderRadius:"4px"},(0,c.createElement)(sa,{fontSize:"sm",color:"#cc1818"},l))):n?(0,c.createElement)(c.Fragment,null,(0,c.createElement)(aa,{flex:"1",overflow:"hidden",minH:"0"},(0,c.createElement)(ta,{flex:"1",overflowY:H?"hidden":"auto",px:"6",py:"5",bg:B6.bg,display:"flex",flexDirection:"column",gap:"5",borderRight:"1px solid",borderColor:B6.border},H?(0,c.createElement)(c.Fragment,null,(0,c.createElement)(aa,{align:"center",justify:"space-between"},(0,c.createElement)(sa,{fontSize:"13px",fontWeight:"600",color:B6.dark,lineHeight:"1"},(0,a.__)("Edit D3 code","visualizer")),(0,c.createElement)(X6,{onClick:ge,bg:"white",color:B6.gray1,border:"1.5px solid",borderColor:B6.border},(0,a.__)("Back","visualizer"))),(0,c.createElement)(ta,{flex:"1",h:"100%",minH:"360px",bg:"white",border:"1.5px solid",borderColor:B6.border,borderRadius:"10px",overflow:"auto",onWheel:e=>e.stopPropagation(),sx:{".cm-editor":{height:"100%"},".cm-scroller":{height:"100%",overflow:"auto"}}},(0,c.createElement)(Gq,{value:B,height:"100%",maxHeight:"100%",autoFocus:!0,extensions:[nG({jsx:!1})],onChange:e=>j(e),editable:!he,basicSetup:{lineNumbers:!0}})),Q&&(0,c.createElement)(ta,{px:"3",py:"2",bg:"#fff7ed",borderLeft:"3px solid #f59e0b",borderRadius:"4px"},(0,c.createElement)(sa,{fontSize:"12px",color:"#b45309"},Q)),(0,c.createElement)(sa,{fontSize:"11px",color:B6.gray2},(0,a.__)("Need a refresher? Read the D3 documentation to understand selections, scales, and shapes:","visualizer")," ",(0,c.createElement)("a",{href:"https://d3js.org/getting-started",target:"_blank",rel:"noopener noreferrer"},(0,a.__)("d3js.org/getting-started","visualizer"))),(0,c.createElement)(aa,{align:"center",justify:"flex-end",gap:"2"},(0,c.createElement)(X6,{onClick:ge,bg:"white",color:B6.gray1,border:"1.5px solid",borderColor:B6.border},(0,a.__)("Cancel","visualizer")),(0,c.createElement)(X6,{onClick:function(){if(B){if(y&&Array.isArray(u)&&Array.isArray(f)&&u.length){const e=document.createElement("div"),t=V6(B,e,u,f);if(t)return void I(t)}R(B),ce.current="manual",m(u),v(f),D(null),I(null),z(null),le.current=!1,V(!1)}},disabled:he||!B||!!Q,bg:B6.dark},(0,a.__)("Save","visualizer")))):(0,c.createElement)(c.Fragment,null,(0,c.createElement)(aa,{align:"center",gap:"2.5"},(0,c.createElement)(Z6,{num:"1",active:!0}),(0,c.createElement)(sa,{fontSize:"13px",fontWeight:"600",color:B6.dark,lineHeight:"1"},(0,a.__)("Data source","visualizer"))),(0,c.createElement)(H6,{chartId:n,uploadNonce:i,onDataReady:de,dataLoaded:y,initialCsvText:w,disabled:he,dataWarning:N,onClearWarning:()=>D(null)}),(0,c.createElement)(ta,{borderTop:"1px solid",borderColor:B6.border}),(0,c.createElement)(ta,{display:"flex",flexDirection:"column",gap:"2.5"},(0,c.createElement)(aa,{align:"center",gap:"2.5"},(0,c.createElement)(Z6,{num:"2",active:!0}),(0,c.createElement)(sa,{fontSize:"13px",fontWeight:"600",color:B6.dark,lineHeight:"1"},(0,a.__)("Describe your chart","visualizer"))),(0,c.createElement)(ta,{border:"1.5px solid",borderColor:B6.border,borderRadius:"10px",overflow:"hidden",bg:"white"},(0,c.createElement)(ta,{as:"textarea",w:"100%",minH:"68px",border:"none",outline:"none",bg:"transparent",p:"10px 12px",fontSize:"13px",fontFamily:"inherit",resize:"vertical",color:B6.dark,placeholder:(0,a.__)("e.g. Create a grouped bar chart comparing revenue and profit by quarter","visualizer"),value:S,onChange:he?void 0:e=>k(e.target.value),onKeyDown:he?void 0:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),ue&&fe())},disabled:he,display:"block",sx:{"&::placeholder":{color:B6.gray3}}}),(0,c.createElement)(aa,{align:"center",justify:"space-between",px:"3",py:"1.5",borderTop:"1.5px solid",borderColor:B6.border,bg:"white",gap:"2"},(0,c.createElement)(ta,{as:"button",display:"flex",alignItems:"center",gap:"5px",px:"10px",py:"5px",borderRadius:"7px",fontSize:"11px",fontWeight:"500",bg:"white",border:"1.5px solid",borderColor:B6.border,cursor:he?"not-allowed":"pointer",color:B6.gray1,opacity:he?.6:1,onClick:he?void 0:()=>ie.current?.click()},(0,c.createElement)("svg",{width:"11",height:"11",viewBox:"0 0 11 11",fill:"none"},(0,c.createElement)("path",{d:"M1.5 5.5h8M5.5 1.5v8",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})),C?C.name:(0,a.__)("Reference image","visualizer")),!G&&(0,c.createElement)(ta,{as:"button",display:"flex",alignItems:"center",gap:"5px",px:"10px",py:"5px",borderRadius:"7px",fontSize:"11px",fontWeight:"500",bg:T?"white":ue?B6.teal:B6.dim,color:T?B6.gray1:ue?"white":B6.gray2,border:T?`1.5px solid ${B6.border}`:"none",cursor:ue?"pointer":"not-allowed",opacity:ue?1:.65,onClick:ue?fe:void 0,transition:"background 0.15s",_hover:ue?{filter:"brightness(0.92)"}:{}},E?(0,c.createElement)(c.Fragment,null,(0,c.createElement)(ha,{size:"xs",mr:"1",color:T?B6.gray1:"white"}),(0,a.__)("Generating…","visualizer")):W?(0,c.createElement)(c.Fragment,null,(0,c.createElement)(ha,{size:"xs",mr:"1",color:T?B6.gray1:"white"}),(0,a.__)("Fixing…","visualizer")):T?(0,a.__)("↺ Regenerate","visualizer"):(0,c.createElement)(c.Fragment,null,(0,c.createElement)("svg",{width:"11",height:"11",viewBox:"0 0 13 13",fill:"none"},(0,c.createElement)("circle",{cx:"6.5",cy:"6.5",r:"5.5",stroke:"currentColor",strokeWidth:"1.2"}),(0,c.createElement)("path",{d:"M4.5 6.5l1.5 1.5 3-3",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})),(0,a.__)("Generate","visualizer"))))),(0,c.createElement)(sa,{fontSize:"11px",color:B6.gray2},(0,a.__)("Press Enter to generate. Shift + Enter for a new line.","visualizer")),(0,c.createElement)("input",{ref:ie,type:"file",accept:"image/*",style:{display:"none"},disabled:he,onChange:e=>_(e.target.files[0]||null)}),P&&(0,c.createElement)(ta,{px:"3",py:"2",bg:"#fef2f2",borderLeft:"3px solid #cc1818",borderRadius:"4px"},(0,c.createElement)(sa,{fontSize:"12px",color:"#cc1818"},P)),(0,c.createElement)(ta,null,(0,c.createElement)(sa,{fontSize:"11px",fontWeight:"600",color:B6.gray1,letterSpacing:"0.03em",textTransform:"uppercase",mb:"2"},(0,a.__)("Presets","visualizer")),(0,c.createElement)(aa,{wrap:"wrap",gap:"2"},j6.map((e=>(0,c.createElement)(ta,{key:e,as:"button",px:"10px",py:"6px",borderRadius:"999px",fontSize:"11px",fontWeight:"500",bg:"white",border:"1px solid",borderColor:B6.border,color:B6.gray1,cursor:he?"not-allowed":"pointer",opacity:he?.6:1,onClick:he?void 0:()=>function(e){const t=S?`${S.trim()}\n${e}`:e;k(t)}(e)},e))))),$&&(0,c.createElement)(ta,{px:"3",py:"2",bg:"#fff7ed",borderLeft:"3px solid #f59e0b",borderRadius:"4px"},(0,c.createElement)(sa,{fontSize:"12px",color:"#b45309"},$),le.current&&!W&&(0,c.createElement)(ta,{mt:"2"},(0,c.createElement)(X6,{onClick:async function(){$&&await pe($)},bg:"white",color:B6.dark,border:"1.5px solid",borderColor:B6.border},(0,a.__)("Fix","visualizer"))))))),(0,c.createElement)(ta,{w:"560px",flexShrink:0,display:"flex",flexDirection:"column",bg:"#f7f7f8",borderLeft:"1px solid #e2e3e6"},(0,c.createElement)(aa,{align:"center",justify:"space-between",px:"5",py:"4",borderBottom:"1px solid #e2e3e6"},(0,c.createElement)(ta,null,(0,c.createElement)(sa,{fontSize:"12px",fontWeight:"700",color:B6.dark,letterSpacing:"0.02em"},(0,a.__)("Preview","visualizer")),(0,c.createElement)(sa,{fontSize:"12px",color:B6.gray1,lineHeight:"1.4"},(0,a.__)("Live rendering based on your data and prompt","visualizer"))),!H&&(0,c.createElement)(aa,{align:"center",gap:"2"},(0,c.createElement)(ta,{as:"button",fontSize:"12px",fontWeight:"600",px:"10px",py:"6px",borderRadius:"8px",bg:"white",border:"1px solid #dcdcde",color:B6.gray1,cursor:he?"not-allowed":"pointer",opacity:he?.6:1,onClick:he?void 0:function(){j(T||""),I(null),V(!0)}},(0,a.__)("Edit code","visualizer")),T&&(0,c.createElement)(ta,{as:"button",fontSize:"12px",fontWeight:"600",px:"10px",py:"6px",borderRadius:"8px",bg:"white",border:"1px solid #dcdcde",color:B6.gray1,cursor:he?"not-allowed":"pointer",opacity:he?.6:1,onClick:he?void 0:()=>se(!0)},(0,a.__)("Full screen","visualizer")))),(0,c.createElement)(ta,{flex:"1",p:"5",display:"flex",flexDirection:"column",minH:"0",position:"relative"},(0,c.createElement)(ta,{ref:te,flex:"1",minH:"320px",overflow:"auto",position:"relative",display:T?"flex":"none",alignItems:"flex-start",justifyContent:"flex-start",sx:{"> svg":{width:"100% !important",height:"100% !important",display:"block"},"> iframe":{maxWidth:"100%",maxHeight:"100%"}}}),!T&&(0,c.createElement)(ta,{position:"absolute",inset:"0",display:"flex",alignItems:"center",justifyContent:"center",p:"6"},(0,c.createElement)(ta,{textAlign:"center"},(0,c.createElement)(sa,{fontSize:"13px",fontWeight:"600",color:B6.dark,mb:"1"},(0,a.__)("No chart yet","visualizer")),(0,c.createElement)(sa,{fontSize:"12px",color:B6.gray2,lineHeight:"1.5"},(0,a.__)("Load data and describe your chart to get started","visualizer"))))),G&&(0,c.createElement)(ta,{px:"5",py:"4",borderTop:"1px solid #e2e3e6",bg:"#f7f7f8"},(0,c.createElement)(sa,{fontSize:"11px",fontWeight:"700",color:B6.gray1,textTransform:"uppercase",letterSpacing:"0.06em",mb:"2"},(0,a.__)("Shortcode","visualizer")),(0,c.createElement)(aa,{align:"center",gap:"2"},(0,c.createElement)(ta,{as:"code",flex:"1",px:"3",py:"2",fontSize:"11px",fontFamily:"mono",bg:"white",border:"1px solid #e2e3e6",borderRadius:"8px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},G),(0,c.createElement)(ta,{as:"button",px:"10px",py:"6px",borderRadius:"8px",fontSize:"12px",fontWeight:"600",bg:"white",border:"1px solid #dcdcde",color:B6.gray1,cursor:he?"not-allowed":"pointer",opacity:he?.6:1,onClick:he?void 0:function(){navigator.clipboard?.writeText(G).catch((()=>{})),ee(!0),setTimeout((()=>ee(!1)),2e3)}},J?(0,a.__)("Copied!","visualizer"):(0,a.__)("Copy","visualizer")))))),(0,c.createElement)(aa,{align:"center",justify:"flex-end",gap:"2",px:"6",py:"3.5",borderTop:"1px solid",borderColor:B6.border,bg:B6.bg,flexShrink:0},q&&(0,c.createElement)(sa,{fontSize:"12px",color:"#cc1818",mr:"auto"},q),(0,c.createElement)(X6,{onClick:e,bg:"white",color:B6.gray1,border:"1.5px solid",borderColor:B6.border},(0,a.__)("Cancel","visualizer")),T&&!G&&!H&&(0,c.createElement)(c.Fragment,null,(0,c.createElement)(ta,{px:"4",py:"1.5",mr:"1"},(0,c.createElement)(ta,{as:"input",type:"text",placeholder:(0,a.__)("Chart title…","visualizer"),value:Z,onChange:he?void 0:e=>X(e.target.value),disabled:he,px:"10px",py:"7px",borderRadius:"8px",border:`1.5px solid ${B6.border}`,fontSize:"12px",color:B6.dark,bg:"white",outline:"none",sx:{"&::placeholder":{color:B6.gray3},"&:focus":{borderColor:B6.dark}}})),(0,c.createElement)(X6,{onClick:async function(){if(T){Y(!0),U(null);try{const e=await async function(e,t,n){return lG("visualizer-ai-save",{chart_id:e,title:t,code:n})}(n,Z.trim()||(0,a.__)("AI Chart","visualizer"),T);K(e.shortcode)}catch(e){U(e.message)}finally{Y(!1)}}},disabled:F||he,bg:B6.teal},F?(0,a.__)("Publishing…","visualizer"):(0,a.__)("Publish chart","visualizer"))),G&&(0,c.createElement)(X6,{onClick:()=>{if(e(),"function"==typeof window.vizAIBuilderDoneCallback){const e=window.vizAIBuilderDoneCallback;window.vizAIBuilderDoneCallback=null,e()}else window.location.reload()},disabled:he,bg:B6.dark},(0,a.__)("Done","visualizer"))),oe&&(0,c.createElement)("div",{className:"viz-ai-fullscreen-overlay",role:"dialog","aria-modal":"true",onClick:e=>{e.target===e.currentTarget&&se(!1)},tabIndex:-1,ref:re},(0,c.createElement)("div",{className:"viz-ai-fullscreen-modal"},(0,c.createElement)("div",{className:"viz-ai-fullscreen-header"},(0,c.createElement)("span",null,(0,a.__)("Full screen preview","visualizer")),(0,c.createElement)("button",{className:"viz-ai-fullscreen-close",onClick:()=>se(!1),"aria-label":(0,a.__)("Close","visualizer")},(0,c.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},(0,c.createElement)("path",{d:"M12 4L4 12M4 4l8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})),(0,c.createElement)("span",null,(0,a.__)("Close","visualizer")))),(0,c.createElement)("div",{className:"viz-ai-fullscreen-body",ref:ne})))):(0,c.createElement)(aa,{flex:"1",align:"center",justify:"center",gap:"3",p:"10",color:B6.gray2,fontSize:"13px"},(0,c.createElement)(ha,{size:"sm"}),(0,a.__)("Initializing…","visualizer"))}const Y6="viz_chart_builder_default";function q6(e){try{window.localStorage.setItem(Y6,e)}catch(e){}}const U6=document.getElementById("viz-chart-builder-root");U6&&(0,s.render)((0,s.createElement)((function(){const[e,t]=(0,s.useState)("hidden"),[n,r]=(0,s.useState)(null),[i,o]=(0,s.useState)(null);function l(){t("hidden"),o(null)}return(0,s.useEffect)((()=>(window.vizOpenChartChooser=e=>{o(null),r((()=>e));const n=function(){try{return window.localStorage.getItem(Y6)}catch(e){return null}}();"classic"!==n?t("ai"!==n?"chooser":"ai-builder"):e()},window.vizOpenAIBuilderEdit=e=>{o(String(e)),t("ai-builder")},window.vizOpenAIBuilderNew=()=>{o(null),t("ai-builder")},()=>{delete window.vizOpenChartChooser,delete window.vizOpenAIBuilderEdit,delete window.vizOpenAIBuilderNew})),[]),(0,s.createElement)(Xe,{value:$s},(0,s.createElement)(zs,{isOpen:"chooser"===e,onClassic:function(e=!1){e&&q6("classic"),t("hidden"),"function"==typeof n&&n()},onAIBuilder:function(e=!1){e&&q6("ai"),t("ai-builder")},onClose:l}),"ai-builder"===e&&(0,s.createElement)("div",{className:"viz-ai-builder-overlay",role:"dialog","aria-modal":"true"},(0,s.createElement)("div",{className:"viz-ai-builder-modal"},(0,s.createElement)("div",{className:"viz-ai-builder-header"},(0,s.createElement)("div",{style:{display:"flex",alignItems:"center",gap:10}},(0,s.createElement)("div",{className:"viz-ai-builder-header__logo"},(0,s.createElement)("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none"},(0,s.createElement)("rect",{x:"1",y:"7",width:"3",height:"6",rx:"1",fill:"white",fillOpacity:".5"}),(0,s.createElement)("rect",{x:"6",y:"4",width:"3",height:"9",rx:"1",fill:"white",fillOpacity:".75"}),(0,s.createElement)("rect",{x:"11",y:"1",width:"3",height:"12",rx:"1",fill:"white"}))),(0,s.createElement)("p",{style:{fontSize:14,fontWeight:600,color:"#1d2327",margin:0}},(0,a.__)("Visualizer","visualizer"))),(0,s.createElement)("button",{className:"viz-ai-builder-close",onClick:l,"aria-label":"Close"},(0,s.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},(0,s.createElement)("path",{d:"M12 4L4 12M4 4l8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})))),(0,s.createElement)(F6,{onClose:l,initialChartId:i}))))})),U6)},2838:function(e){e.exports=function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,n){return t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(e,n)}function n(e,r,i){return n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct:function(e,n,r){var i=[null];i.push.apply(i,n);var o=new(Function.bind.apply(e,i));return r&&t(o,r.prototype),o},n.apply(null,arguments)}function r(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?n-1:0),i=1;i/gm),Z=u(/\${[\w\W]*}/gm),X=u(/^data-[\-\w.\u00B7-\uFFFF]+$/),F=u(/^aria-[\-\w]+$/),Y=u(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),q=u(/^(?:\w+script|data):/i),U=u(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),G=u(/^html$/i),K=u(/^[a-z][.\w]*(-[.\w]+)+$/i),J=function(){return"undefined"==typeof window?null:window};return function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:J(),i=function(e){return t(e)};if(i.version="2.5.9",i.removed=[],!n||!n.document||9!==n.document.nodeType)return i.isSupported=!1,i;var o=n.document,s=n.document,a=n.DocumentFragment,l=n.HTMLTemplateElement,c=n.Node,u=n.Element,d=n.NodeFilter,f=n.NamedNodeMap,p=void 0===f?n.NamedNodeMap||n.MozNamedAttrMap:f,g=n.HTMLFormElement,m=n.DOMParser,R=n.trustedTypes,ee=u.prototype,te=P(ee,"cloneNode"),ne=P(ee,"nextSibling"),re=P(ee,"childNodes"),ie=P(ee,"parentNode");if("function"==typeof l){var oe=s.createElement("template");oe.content&&oe.content.ownerDocument&&(s=oe.content.ownerDocument)}var se=function(t,n){if("object"!==e(t)||"function"!=typeof t.createPolicy)return null;var r=null,i="data-tt-policy-suffix";n.currentScript&&n.currentScript.hasAttribute(i)&&(r=n.currentScript.getAttribute(i));var o="dompurify"+(r?"#"+r:"");try{return t.createPolicy(o,{createHTML:function(e){return e},createScriptURL:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(R,o),ae=se?se.createHTML(""):"",le=s,ce=le.implementation,he=le.createNodeIterator,ue=le.createDocumentFragment,de=le.getElementsByTagName,fe=o.importNode,pe={};try{pe=M(s).documentMode?s.documentMode:{}}catch(e){}var ge={};i.isSupported="function"==typeof ie&&ce&&void 0!==ce.createHTMLDocument&&9!==pe;var me,be,ve=B,ye=j,Oe=Z,we=X,xe=F,Se=q,ke=U,Ce=K,_e=Y,Te=null,Re=E({},[].concat(r(A),r($),r(z),r(I),r(D))),Ee=null,Me=E({},[].concat(r(W),r(L),r(H),r(V))),Pe=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ae=null,$e=null,ze=!0,Qe=!0,Ie=!1,Ne=!0,De=!1,We=!0,Le=!1,He=!1,Ve=!1,Be=!1,je=!1,Ze=!1,Xe=!0,Fe=!1,Ye=!0,qe=!1,Ue={},Ge=null,Ke=E({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Je=null,et=E({},["audio","video","img","source","image","track"]),tt=null,nt=E({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),rt="http://www.w3.org/1998/Math/MathML",it="http://www.w3.org/2000/svg",ot="http://www.w3.org/1999/xhtml",st=ot,at=!1,lt=null,ct=E({},[rt,it,ot],w),ht=["application/xhtml+xml","text/html"],ut=null,dt=s.createElement("form"),ft=function(e){return e instanceof RegExp||e instanceof Function},pt=function(t){ut&&ut===t||(t&&"object"===e(t)||(t={}),t=M(t),me=me=-1===ht.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,be="application/xhtml+xml"===me?w:O,Te="ALLOWED_TAGS"in t?E({},t.ALLOWED_TAGS,be):Re,Ee="ALLOWED_ATTR"in t?E({},t.ALLOWED_ATTR,be):Me,lt="ALLOWED_NAMESPACES"in t?E({},t.ALLOWED_NAMESPACES,w):ct,tt="ADD_URI_SAFE_ATTR"in t?E(M(nt),t.ADD_URI_SAFE_ATTR,be):nt,Je="ADD_DATA_URI_TAGS"in t?E(M(et),t.ADD_DATA_URI_TAGS,be):et,Ge="FORBID_CONTENTS"in t?E({},t.FORBID_CONTENTS,be):Ke,Ae="FORBID_TAGS"in t?E({},t.FORBID_TAGS,be):{},$e="FORBID_ATTR"in t?E({},t.FORBID_ATTR,be):{},Ue="USE_PROFILES"in t&&t.USE_PROFILES,ze=!1!==t.ALLOW_ARIA_ATTR,Qe=!1!==t.ALLOW_DATA_ATTR,Ie=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Ne=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,De=t.SAFE_FOR_TEMPLATES||!1,We=!1!==t.SAFE_FOR_XML,Le=t.WHOLE_DOCUMENT||!1,Be=t.RETURN_DOM||!1,je=t.RETURN_DOM_FRAGMENT||!1,Ze=t.RETURN_TRUSTED_TYPE||!1,Ve=t.FORCE_BODY||!1,Xe=!1!==t.SANITIZE_DOM,Fe=t.SANITIZE_NAMED_PROPS||!1,Ye=!1!==t.KEEP_CONTENT,qe=t.IN_PLACE||!1,_e=t.ALLOWED_URI_REGEXP||_e,st=t.NAMESPACE||ot,Pe=t.CUSTOM_ELEMENT_HANDLING||{},t.CUSTOM_ELEMENT_HANDLING&&ft(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Pe.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&ft(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Pe.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Pe.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),De&&(Qe=!1),je&&(Be=!0),Ue&&(Te=E({},r(D)),Ee=[],!0===Ue.html&&(E(Te,A),E(Ee,W)),!0===Ue.svg&&(E(Te,$),E(Ee,L),E(Ee,V)),!0===Ue.svgFilters&&(E(Te,z),E(Ee,L),E(Ee,V)),!0===Ue.mathMl&&(E(Te,I),E(Ee,H),E(Ee,V))),t.ADD_TAGS&&(Te===Re&&(Te=M(Te)),E(Te,t.ADD_TAGS,be)),t.ADD_ATTR&&(Ee===Me&&(Ee=M(Ee)),E(Ee,t.ADD_ATTR,be)),t.ADD_URI_SAFE_ATTR&&E(tt,t.ADD_URI_SAFE_ATTR,be),t.FORBID_CONTENTS&&(Ge===Ke&&(Ge=M(Ge)),E(Ge,t.FORBID_CONTENTS,be)),Ye&&(Te["#text"]=!0),Le&&E(Te,["html","head","body"]),Te.table&&(E(Te,["tbody"]),delete Ae.tbody),h&&h(t),ut=t)},gt=E({},["mi","mo","mn","ms","mtext"]),mt=E({},["annotation-xml"]),bt=E({},["title","style","font","a","script"]),vt=E({},$);E(vt,z),E(vt,Q);var yt=E({},I);E(yt,N);var Ot=function(e){y(i.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=ae}catch(t){e.remove()}}},wt=function(e,t){try{y(i.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){y(i.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!Ee[e])if(Be||je)try{Ot(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},xt=function(e){var t,n;if(Ve)e=""+e;else{var r=x(e,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===me&&st===ot&&(e=''+e+"");var i=se?se.createHTML(e):e;if(st===ot)try{t=(new m).parseFromString(i,me)}catch(e){}if(!t||!t.documentElement){t=ce.createDocument(st,"template",null);try{t.documentElement.innerHTML=at?ae:i}catch(e){}}var o=t.body||t.documentElement;return e&&n&&o.insertBefore(s.createTextNode(n),o.childNodes[0]||null),st===ot?de.call(t,Le?"html":"body")[0]:Le?t.documentElement:o},St=function(e){return he.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null,!1)},kt=function(e){return e instanceof g&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof p)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Ct=function(t){return"object"===e(c)?t instanceof c:t&&"object"===e(t)&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},_t=function(e,t,n){ge[e]&&b(ge[e],(function(e){e.call(i,t,n,ut)}))},Tt=function(e){var t;if(_t("beforeSanitizeElements",e,null),kt(e))return Ot(e),!0;if(_(/[\u0080-\uFFFF]/,e.nodeName))return Ot(e),!0;var n=be(e.nodeName);if(_t("uponSanitizeElement",e,{tagName:n,allowedTags:Te}),e.hasChildNodes()&&!Ct(e.firstElementChild)&&(!Ct(e.content)||!Ct(e.content.firstElementChild))&&_(/<[/\w]/g,e.innerHTML)&&_(/<[/\w]/g,e.textContent))return Ot(e),!0;if("select"===n&&_(/